ld i386 differences 2.10.2 / 2.12

David O'Brien obrien@FreeBSD.org
Tue Mar 26 14:54:00 GMT 2002


On Tue, Mar 26, 2002 at 04:39:51PM +1030, Alan Modra wrote:
> 
> You've likely found a bug in some changes I made.

Sorry to be the barer of bad news... but yes.

Your change on 29-Sept-2001 is causing no end of trouble in FreeBSD/i386.

    cvs diff -D '9/29/2001 06:21:00 UTC' -D '9/29/2001 06:22:00 UTC' bfd ld

shows the bad code.  I have been spending the past day tracking this
down.  I can 100% repeat the problem on FreeBSD/i386 (but the same C code
does not cause an 'ld' core dump on FreeBSD/alpha).

The bug appears to be triggered when compiling a dynamic binary (does not
happen when 'cc -static' is used) using GCC 2.95.4 in code that uses this
macro:

    #define	__warn_references(sym,msg)	\
        __asm__(".section .gnu.warning." #sym);	\
        __asm__(".asciz \"" msg "\"");	\
        __asm__(".previous")

If I use bfd/elf32-i386.c rev 1.51 rather than 1.52 (reset of files -D
'9/29/2001 06:22:00 UTC') I do not get the segfault.

-- 
-- David  (obrien@FreeBSD.org)


GNU gdb 4.18
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-unknown-freebsd"...
Core was generated by `ld'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libc.so.5...done.
Reading symbols from /usr/libexec/ld-elf.so.1...done.
#0  bfd_putl32 (data=0, addr=0x0) at ../../fmeharder/bfd/libbfd.c:1202
1202            addr[0] = (bfd_byte) data;
(gdb) where
#0  bfd_putl32 (data=0, addr=0x0) at ../../fmeharder/bfd/libbfd.c:1202
#1  0x806c0f3 in elf_i386_finish_dynamic_symbol (output_bfd=0x80cc000, 
    info=0x80c1aa0, h=0x8122468, sym=0xbfbfeee8)
    at ../../fmeharder/bfd/elf32-i386.c:2168
#2  0x8074f41 in elf_link_output_extsym (h=0x8122468, data=0xbfbff05c)
    at ../../fmeharder/bfd/elflink.h:5668
#3  0x8074f01 in elf_link_output_extsym (h=0x81224c4, data=0xbfbff05c)
    at ../../fmeharder/bfd/elflink.h:5654
#4  0x8064659 in bfd_hash_traverse (table=0x80cd284, 
    func=0x8074c48 <elf_link_output_extsym>, info=0xbfbff05c)
    at ../../fmeharder/bfd/hash.c:493
#5  0x8064b2b in bfd_link_hash_traverse (table=0x80cd284, 
    func=0x8074c48 <elf_link_output_extsym>, info=0xbfbff05c)
    at ../../fmeharder/bfd/linker.c:615
#6  0x8074153 in bfd_elf32_bfd_final_link (abfd=0x80cc000, info=0x80c1aa0)
    at ../../fmeharder/bfd/elflink.h:5074
#7  0x8058811 in ldwrite () at ../../fmeharder/ld/ldwrite.c:536
#8  0x805604a in main (argc=18, argv=0xbfbff16c)
    at ../../fmeharder/ld/ldmain.c:412
#9  0x80495d1 in _start ()
(gdb) 



More information about the Binutils mailing list