bug-binutils
[Top][All Lists]
Advanced

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

[Bug binutils/29389] Failed assertions in bfd/cofflink.c and bfd/coff-x8


From: luca.bacci at outlook dot com
Subject: [Bug binutils/29389] Failed assertions in bfd/cofflink.c and bfd/coff-x86_64.c during the linking stage (MSYS2 MinGW64)
Date: Mon, 01 Aug 2022 16:55:15 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=29389

--- Comment #15 from Luca Bacci <luca.bacci at outlook dot com> ---
Uh...how strange!

One of the very first things that _bfd_coff_link_input_bfd() does is call
obj_coff_external_syms() which seeks into the lib file and reads the external
symbols table.

When _bfd_coff_link_input_bfd() is run with input_bfd->filename ==
"libgobject_2_0_0_dll_d000431.o" for the second time, obj_coff_external_syms()
is executed, which calls cache_bseek() (then _bfd_real_fseek(), then
fseeko64()) with an offset of 73060, on both Linux and MSYS2.

However, on Linux the read buffer is:

    (gdb) p abfd->where
    $19 = 73060
    (gdb) p result
    $20 = 0
    (gdb) n
    405     in /usr/src/debug/binutils-2.38/bfd/bfdio.c
    (gdb) 
    _bfd_coff_get_external_symbols (abfd=0x55555bc67750) at
/usr/src/debug/binutils-2.38/bfd/coffgen.c:1692
    1692    /usr/src/debug/binutils-2.38/bfd/coffgen.c: File o directory non
esistente.
    (gdb) n
    1694    in /usr/src/debug/binutils-2.38/bfd/coffgen.c
    (gdb) n
    1695    in /usr/src/debug/binutils-2.38/bfd/coffgen.c
    (gdb) p syms
    $21 = (void *) 0x555561e3c000
    (gdb) x /150db syms
    0x555561e3c000: 46      116     101     120     116     0       0       0
    0x555561e3c008: 0       0       0       0       1       0       0       0
    0x555561e3c010: 3       0       46      105     100     97      116     97
    0x555561e3c018: 36      55      0       0       0       0       2       0
    0x555561e3c020: 0       0       3       0       46      105     100     97
    0x555561e3c028: 116     97      36      53      0       0       0       0
    0x555561e3c030: 3       0       0       0       3       0       46      105
    0x555561e3c038: 100     97      116     97      36      52      0       0
    0x555561e3c040: 0       0       4       0       0       0       3       0
    0x555561e3c048: 46      105     100     97      116     97      36      54
    0x555561e3c050: 0       0       0       0       5       0       0       0
    0x555561e3c058: 3       0       0       0       0       0       4       0
    0x555561e3c060: 0       0       0       0       0       0       1       0
    0x555561e3c068: 0       0       2       0       0       0       0       0
    0x555561e3c070: 36      0       0       0       0       0       0       0
    0x555561e3c078: 3       0       0       0       2       0       0       0
    0x555561e3c080: 0       0       74      0       0       0       0       0
    0x555561e3c088: 0       0       0       0       0       0       2       0
    0x555561e3c090: 0       0       0       0       0       0
    (gdb) 

While on MSYS2 the read buffer is:

    _bfd_coff_get_external_symbols (abfd=0x1d47d7c2710) at
../../binutils-gdb/bfd/coffgen.c:1596
    1596      if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0)
    (gdb)
    1598      syms = _bfd_malloc_and_read (abfd, size, size);
    (gdb)
    1599      obj_coff_external_syms (abfd) = syms;
    (gdb) p size
    $9 = 144
    (gdb) x /150db syms
    0x1d40853a550:  48      1       0       0       0       0       0       0
    0x1d40853a558:  1       0       0       0       0       0       48      -64
    0x1d40853a560:  46      105     100     97      116     97      36      52
    0x1d40853a568:  0       0       0       0       0       0       0       0
    0x1d40853a570:  8       0       0       0       -16     0       0       0
    0x1d40853a578:  58      1       0       0       0       0       0       0
    0x1d40853a580:  1       0       0       0       0       0       48      -64
    0x1d40853a588:  46      105     100     97      116     97      36      54
    0x1d40853a590:  0       0       0       0       0       0       0       0
    0x1d40853a598:  36      0       0       0       -8      0       0       0
    0x1d40853a5a0:  0       0       0       0       0       0       0       0
    0x1d40853a5a8:  0       0       0       0       0       0       48      -64
    0x1d40853a5b0:  -1      37      0       0       0       0       -112   
-112
    0x1d40853a5b8:  0       0       0       0       0       0       0       0
    0x1d40853a5c0:  0       0       0       0       0       0       0       0
    0x1d40853a5c8:  0       0       0       0       -88     1       103     95
    0x1d40853a5d0:  118     97      108     117     101     95      114     101
    0x1d40853a5d8:  103     105     115     116     101     114     95      116
    0x1d40853a5e0:  -85     -85     -85     -85     -85     -85

Using an hex editor we can see that on Linux the FILE* refers to
d/msys64/mingw64/lib/libgobject-2.0.dll.a (which is right), on MSYS2 the FILE*
refers to subprojects/glib/gobject/libgobject-2.0.dll.a (which is not right)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]