bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/437] New: LD core dumps on bad flags from gcc. Binutils 2.14 and


From: schonm at yahoo dot com
Subject: [Bug ld/437] New: LD core dumps on bad flags from gcc. Binutils 2.14 and 2.15
Date: 10 Oct 2004 17:15:53 -0000

address@hidden ~/c]$ more hello.c
#include <stdio.h>

int main()
{
        printf ("hello world\n");
};

address@hidden ~/c]$ gcc -o run hello.c
address@hidden ~/c]$ ./run
hello world

address@hidden ~/c]$ limit core unlimited
address@hidden ~/c]$ gcc run hello.c
collect2: ld terminated with signal 11 [Segmentation fault], core dumped
(lots of noise deleted here)

address@hidden ~/c]$ file core.3696
core.3696: ELF 32-bit LSB core file Intel 80386, version 1 (SYSV), SVR4-style,
SVR4-style, from 'ld'
address@hidden ~/c]$ which ld
/usr/bin/ld
address@hidden ~/c]$ /usr/bin/ld -v
GNU ld version 2.14.90.0.7 20031029

address@hidden ~/c]$ gdb core.3696 /usr/bin/ld
GNU gdb 6.0-2mdk (Mandrake Linux)
(gdb) where
#0  0x40042f74 in bfd_getl32 ()
   from /usr/lib/libbfd-2.14.90.0.7.so
#1  0x4005e257 in bfd_elf32_swap_reloc_in ()
   from /usr/lib/libbfd-2.14.90.0.7.so
(gdb) 

Checking the source code of binutils-2.14.90.0.7 I find in bfd/libbfd.c
 
bfd_vma
bfd_getl32 (const bfd_byte *addr)
{
  unsigned long v;

  v = (unsigned long) addr[0];
  v |= (unsigned long) addr[1] << 8;
  v |= (unsigned long) addr[2] << 16;
  v |= (unsigned long) addr[3] << 24;
  return v;
}

My first guess is that addr is NULL.

I tried building binutils-2.15.92.0.2 and found a similar problem.  An exercise
I will repeat here in hopes that it provides additional information.

address@hidden bin]# pwd  
/usr/bin
address@hidden bin]# mv ld ld.old
address@hidden bin]# ln -s /home/jason/Development/bin/ld ld
address@hidden bin]# exit
exit
address@hidden bin]$ which ld 
/usr/bin/ld
address@hidden bin]$ ld -v
GNU ld version 2.15.92.0.2 20040927

Starting with an empty directory with hello.c again.

address@hidden ~/c]$ gcc -o run hello.c
address@hidden ~/c]$ ./run
hello world
address@hidden ~/c]$ gcc run hello.c
collect2: ld terminated with signal 11 [Segmentation fault], core dumped
(more noise deleted here)

address@hidden ~/c]$ file core.3789
core.3789: ELF 32-bit LSB core file Intel 80386, version 1 (SYSV), SVR4-style,
SVR4-style, from 'ld'

address@hidden ~/c]$ gdb /usr/bin/ld core.3789 

#0  bfd_getl32 (p=0x0) at libbfd.c:462
462       v |= (unsigned long) addr[1] << 8;
(gdb) where
#0  bfd_getl32 (p=0x0) at libbfd.c:462
#1  0x0808cc3a in elf_link_sort_relocs (abfd=0x8100228, 
    info=0x80f5300, psec=0xbfffedbc) at elflink.c:5664
#2  0x08090396 in bfd_elf_final_link (abfd=0x8100228, 
    info=0x80f5300) at elflink.c:8038
#3  0x0805a1d9 in ldwrite () at ldwrite.c:554
#4  0x08057f25 in main (argc=20, argv=0xbfffef54) at ldmain.c:484 
(gdb) print p
$1 = (const void *) 0x0
(gdb) print v
$2 = 0


If additional information would be useful to resolve this problem, please don't
hesitate to ask.

Thanks.

-- 
           Summary: LD core dumps on bad flags from gcc.  Binutils 2.14 and
                    2.15
           Product: binutils
           Version: 2.14
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: schonm at yahoo dot com
                CC: bug-binutils at gnu dot org
  GCC host triplet: i586-mandrake-linux-gnu
GCC target triplet: i586-mandrake-linux-gnu


http://sources.redhat.com/bugzilla/show_bug.cgi?id=437

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

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