tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Help needed with binutils solving [PR 54159]



On Wed, Aug 14, 2019 at 12:45:15PM +0200, tlaronde%polynum.com@localhost wrote:
> The bug reported via PR 54159 with spurious warnings from GNU lib about
> strings offsets past the size of the .strtab section are in fact due
> to the fact that in the case of dynamic linking, the code takes the
> .dynsym symbol table (and not the .symtab) and tries to match the offset
> against .strtab while they are relative to .dynstr.
> 
> The warnings come from bfd_link_add_symbols(). But this is a generic
> name and a backend version is called through the BFD xvec vector.

I just did:

gdb ld
break bfd_close
run ....

and get to this:

Breakpoint 2, bfd_close (abfd=0x76a6c000)
    at /work/src/external/gpl3/binutils/lib/libbfd/../../dist/bfd/opncls.c:729
729     /work/src/external/gpl3/binutils/lib/libbfd/../../dist/bfd/opncls.c: No such file or directory.
#0  bfd_close (abfd=0x76a6c000)
    at /work/src/external/gpl3/binutils/lib/libbfd/../../dist/bfd/opncls.c:729
#1  0x01438d04 in main (argc=<optimized out>, argv=<optimized out>)
    at /work/src/external/gpl3/binutils/usr.bin/ld/../../dist/ld/ldmain.c:489
(gdb) p *abfd
$1 = {filename = 0x76e4a3f8 "a.out", xvec = 0x76e3ac24 <arm_elf32_be_vec>, 
  iostream = 0x76d10e60, iovec = 0x76e38e88, lru_prev = 0x76a6c480, 
  lru_next = 0x76a6ca80, where = 3038, mtime = 0, id = 0, format = bfd_object, 
  direction = write_direction, flags = 386, cacheable = 1, 
...
(gdb) p *abfd->xvec
$2 = {name = 0x76e07224 "elf32-bigarm", flavour = bfd_target_elf_flavour, 
  byteorder = BFD_ENDIAN_BIG, header_byteorder = BFD_ENDIAN_BIG, 
  object_flags = 967167, section_flags = 63021375, 
  symbol_leading_char = 0 '\000', ar_pad_char = 47 '/', 
  ar_max_namelen = 15 '\017', match_priority = 1 '\001', 
  bfd_getx64 = 0x76dfc530 <bfd_getb64>, 
  bfd_getx_signed_64 = 0x76dfc62c <bfd_getb_signed_64>, 
  bfd_putx64 = 0x76dfc7b0 <bfd_putb64>, bfd_getx32 = 0x76dfc508 <bfd_getb32>, 
  bfd_getx_signed_32 = 0x76dfc51c <bfd_getb_signed_32>, 
  bfd_putx32 = 0x76dfc728 <bfd_putb32>, bfd_getx16 = 0x76dfc48c <bfd_getb16>, 
  bfd_getx_signed_16 = 0x76dfc4a4 <bfd_getb_signed_16>, 
  bfd_putx16 = 0x76dfc4b8 <bfd_putb16>, 
  bfd_h_getx64 = 0x76dfc530 <bfd_getb64>, 
  bfd_h_getx_signed_64 = 0x76dfc62c <bfd_getb_signed_64>, 
  bfd_h_putx64 = 0x76dfc7b0 <bfd_putb64>, 
  bfd_h_getx32 = 0x76dfc508 <bfd_getb32>, 
  bfd_h_getx_signed_32 = 0x76dfc51c <bfd_getb_signed_32>, 
  bfd_h_putx32 = 0x76dfc728 <bfd_putb32>, 
  bfd_h_getx16 = 0x76dfc48c <bfd_getb16>, 
  bfd_h_getx_signed_16 = 0x76dfc4a4 <bfd_getb_signed_16>, 
  bfd_h_putx16 = 0x76dfc4b8 <bfd_putb16>, _bfd_check_format = {
    0x76dfc240 <_bfd_dummy_target>, 0x76dce8cc <bfd_elf32_object_p>, 
    0x76df1d2c <bfd_generic_archive_p>, 0x76dcf734 <bfd_elf32_core_file_p>}, 
  _bfd_set_format = {0x76dfc0e8 <_bfd_bool_bfd_false_error>, 
    0x76dd3460 <elf32_arm_mkobject>, 0x76df13f4 <_bfd_generic_mkarchive>, 
    0x76dba99c <bfd_elf_mkcorefile>}, _bfd_write_contents = {
    0x76dfc0e8 <_bfd_bool_bfd_false_error>, 
    0x76dc2760 <_bfd_elf_write_object_contents>, 
    0x76df3368 <_bfd_write_archive_contents>, 
    0x76dc2b5c <_bfd_elf_write_corefile_contents>}, 
  _close_and_cleanup = 0x76dc7284 <_bfd_elf_close_and_cleanup>, 
  _bfd_free_cached_info = 0x76df8fcc <_bfd_free_cached_info>, 
  _new_section_hook = 0x76dd3414 <elf32_arm_new_section_hook>, 
  _bfd_get_section_contents = 0x76dfc948 <_bfd_generic_get_section_contents>, 
  _bfd_get_section_contents_in_window = 0x76dfcac4 <_bfd_generic_get_section_contents_in_window>, 
  _bfd_copy_private_bfd_data = 0x76ddb1e0 <elf32_arm_copy_private_bfd_data>, 
  _bfd_merge_private_bfd_data = 0x76dd2198 <elf32_arm_merge_private_bfd_data>, 
  _bfd_init_private_section_data = 0x76dc2c30 <_bfd_elf_init_private_section_data>, 
  _bfd_copy_private_section_data = 0x76dc2ddc <_bfd_elf_copy_private_section_data>, 
  _bfd_copy_private_symbol_data = 0x76dc4c28 <_bfd_elf_copy_private_symbol_data>, 
  _bfd_copy_private_header_data = 0x76dc2fc8 <_bfd_elf_copy_private_header_data>, _bfd_set_private_flags = 0x76dd43a4 <elf32_arm_set_private_flags>, 
...

and especially:

(gdb) p *abfd->xvec->_bfd_link_add_symbols
$3 = {bfd_boolean (bfd *, 
    struct bfd_link_info *)} 0x76dac764 <bfd_elf_link_add_symbols>
(gdb) list bfd_elf_link_add_symbols
5718    /work/src/external/gpl3/binutils/lib/libbfd/../../dist/bfd/elflink.c: No such file or directory.


(and with a source tree mounted on the proper directory it would have been
even better, sorry...)

Martin


Home | Main Index | Thread Index | Old Index