bug-gnu-utils
[Top][All Lists]
Advanced

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

segfault in bfd_elf32_bfd_final_link


From: Ethan Aubin
Subject: segfault in bfd_elf32_bfd_final_link
Date: 09 Nov 2002 18:51:25 -0500

Hi, 

I'm having some trouble w/ ld (GNU ld version 2.13.90.0.10 20021010
Debian GNU/Linux) segfaulting. I don't know ld well enough to really
know what to hunt for, but there is a stacktrace at the end of this
email. To replicate it: 

> echo 'int id (int i) { return i; }' > t.c
> gcc -v -shared t.c
Reading specs from /usr/lib/gcc-lib/i386-linux/3.0.4/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,objc --prefix=/usr
--infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as
--with-gnu-ld --with-system-zlib --enable-long-long --enable-nls
--without-included-gettext --disable-checking --enable-threads=posix
--enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc
i386-linux
Thread model: posix
gcc version 3.0.4
 /usr/lib/gcc-lib/i386-linux/3.0.4/cc1 -lang-c -v -D__GNUC__=3
-D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=4 -D__ELF__ -Dunix -Dlinux
-D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix
-D__NO_INLINE__ -D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -Di386
-D__i386 -D__i386__ -D__tune_i386__ t.c -quiet -dumpbase t.c -version -o
/tmp/cc4V4LuW.s
GNU CPP version 3.0.4 (cpplib) (i386 Linux/ELF)
GNU C version 3.0.4 (i386-linux)
        compiled by GNU C version 3.0.4.
ignoring nonexistent directory "/usr/i386-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc-lib/i386-linux/3.0.4/include
 /usr/include
End of search list.
 as -V -Qy -o /tmp/cccnTxEX.o /tmp/cc4V4LuW.s
GNU assembler version 2.13.90.0.10 (i386-linux) using BFD version
2.13.90.0.10 20021010 Debian GNU/Linux
 /usr/lib/gcc-lib/i386-linux/3.0.4/collect2 -m elf_i386 -shared
/usr/lib/gcc-lib/i386-linux/3.0.4/../../../crti.o
/usr/lib/gcc-lib/i386-linux/3.0.4/crtbeginS.o
-L/usr/lib/gcc-lib/i386-linux/3.0.4
-L/usr/lib/gcc-lib/i386-linux/3.0.4/../../.. /tmp/cccnTxEX.o -lgcc_s -lc
-lgcc_s /usr/lib/gcc-lib/i386-linux/3.0.4/crtendS.o
/usr/lib/gcc-lib/i386-linux/3.0.4/../../../crtn.o
collect2: ld terminated with signal 11 [Segmentation fault], core dumped

Running ld in the gdb gives:

(gdb) run -verbose -m elf_i386 -shared -o dllt.so
/usr/lib/gcc-lib/i386-linux/3.0.4/../../../crti.o
/usr/lib/gcc-lib/i386-linux/3.0.4/crtbeginS.o
-L/usr/lib/gcc-lib/i386-linux/3.0.4
-L/usr/lib/gcc-lib/i386-linux/3.0.4/../../.. t.o -lgcc_s -lc -lgcc_s
/usr/lib/gcc-lib/i386-linux/3.0.4/crtendS.o
/usr/lib/gcc-lib/i386-linux/3.0.4/../../../crtn.o
Starting program: /usr/bin/ld -verbose -m elf_i386 -shared -o dllt.so
/usr/lib/gcc-lib/i386-linux/3.0.4/../../../crti.o
/usr/lib/gcc-lib/i386-linux/3.0.4/crtbeginS.o
-L/usr/lib/gcc-lib/i386-linux/3.0.4
-L/usr/lib/gcc-lib/i386-linux/3.0.4/../../.. t.o -lgcc_s -lc -lgcc_s
/usr/lib/gcc-lib/i386-linux/3.0.4/crtendS.o
/usr/lib/gcc-lib/i386-linux/3.0.4/../../../crtn.o
(no debugging symbols found)...(no debugging symbols found)...
GNU ld version 2.13.90.0.10 20021010 Debian GNU/Linux
  Supported emulations:
   elf_i386
   i386linux
using internal linker script:
==================================================
/* Script for --shared -z combreloc: shared library, combine & sort
relocs */
OUTPUT_FORMAT("elf32-i386", "elf32-i386",
              "elf32-i386")
OUTPUT_ARCH(i386)
ENTRY(_start)
SEARCH_DIR("/usr/i386-linux/lib"); SEARCH_DIR("/usr/lib");
SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib");
/* Do we need any of these for elf?
   __DYNAMIC = 0;    */
SECTIONS
{
  /* Read-only sections, merged into text segment: */
  . = 0 + SIZEOF_HEADERS;
  .hash           : { *(.hash) }
  .dynsym         : { *(.dynsym) }
  .dynstr         : { *(.dynstr) }
  .gnu.version    : { *(.gnu.version) }
  .gnu.version_d  : { *(.gnu.version_d) }
  .gnu.version_r  : { *(.gnu.version_r) }
  .rel.dyn        :
    {
      *(.rel.init)
      *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
      *(.rel.fini)
      *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
      *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
      *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
      *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
      *(.rel.ctors)
      *(.rel.dtors)
      *(.rel.got)
      *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
    }
  .rela.dyn       :
    {
      *(.rela.init)
      *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
      *(.rela.fini)
      *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
      *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
      *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
      *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
      *(.rela.ctors)
      *(.rela.dtors)
      *(.rela.got)
      *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
    }
  .rel.plt        : { *(.rel.plt) }
  .rela.plt       : { *(.rela.plt) }
  .init           :
  {
    KEEP (*(.init))
  } =0x90909090
  .plt            : { *(.plt) }
  .text           :
  {
    *(.text .stub .text.* .gnu.linkonce.t.*)
    /* .gnu.warning sections are handled specially by elf32.em.  */
    *(.gnu.warning)
  } =0x90909090
  .fini           :
  {
    KEEP (*(.fini))
  } =0x90909090
  PROVIDE (__etext = .);
  PROVIDE (_etext = .);
  PROVIDE (etext = .);
  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
  .rodata1        : { *(.rodata1) }
  .eh_frame_hdr : { *(.eh_frame_hdr) }
  /* Adjust the address for the data segment.  We want to adjust up to
     the same address within the page on the next page up.  */
  . = ALIGN (0x1000) - ((0x1000 - .) & (0x1000 - 1)); . =
DATA_SEGMENT_ALIGN (0x1000, 0x1000);
  /* Ensure the __preinit_array_start label is properly aligned.  We
     could instead move the label definition inside the section, but
     the linker would then create the section even if it turns out to
     be empty, which isn't pretty.  */
  . = ALIGN(32 / 8);
  .preinit_array     : { *(.preinit_array) }
  .init_array     : { *(.init_array) }
  .fini_array     : { *(.fini_array) }
  .data           :
  {
    *(.data .data.* .gnu.linkonce.d.*)
    SORT(CONSTRUCTORS)
  }
  .data1          : { *(.data1) }
  .tdata          : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
  .tbss           : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
  .eh_frame       : { KEEP (*(.eh_frame)) }
  .gcc_except_table   : { *(.gcc_except_table) }
  .dynamic        : { *(.dynamic) }
  .ctors          :
  {
    /* gcc uses crtbegin.o to find the start of
       the constructors, so we make sure it is
       first.  Because this is a wildcard, it
       doesn't matter if the user does not
       actually link against crtbegin.o; the
       linker won't look for a file to match a
       wildcard.  The wildcard also means that it
       doesn't matter which directory crtbegin.o
       is in.  */
    KEEP (*crtbegin.o(.ctors))
    /* We don't want to include the .ctor section from
       from the crtend.o file until after the sorted ctors.
       The .ctor section from the crtend file contains the
       end of ctors marker and it must be last */
    KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
    KEEP (*(SORT(.ctors.*)))
    KEEP (*(.ctors))
  }
  .dtors          :
  {
    KEEP (*crtbegin.o(.dtors))
    KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
    KEEP (*(SORT(.dtors.*)))
    KEEP (*(.dtors))
  }
  .jcr            : { KEEP (*(.jcr)) }
  .got            : { *(.got.plt) *(.got) }
  _edata = .;
  PROVIDE (edata = .);
  __bss_start = .;
  .bss            :
  {
   *(.dynbss)
   *(.bss .bss.* .gnu.linkonce.b.*)
   *(COMMON)
   /* Align here to ensure that the .bss section occupies space up to
      _end.  Align after .bss to ensure correct alignment even if the
      .bss section disappears because there are no input sections.  */
   . = ALIGN(32 / 8);
  }
  . = ALIGN(32 / 8);
  _end = .;
  PROVIDE (end = .);
  . = DATA_SEGMENT_END (.);
  /* Stabs debugging sections.  */
  .stab          0 : { *(.stab) }
  .stabstr       0 : { *(.stabstr) }
  .stab.excl     0 : { *(.stab.excl) }
  .stab.exclstr  0 : { *(.stab.exclstr) }
  .stab.index    0 : { *(.stab.index) }
  .stab.indexstr 0 : { *(.stab.indexstr) }
  .comment       0 : { *(.comment) }
  /* DWARF debug sections.
     Symbols in the DWARF debugging sections are relative to the
beginning
     of the section so we begin them at 0.  */
  /* DWARF 1 */
  .debug          0 : { *(.debug) }
  .line           0 : { *(.line) }
  /* GNU DWARF 1 extensions */
  .debug_srcinfo  0 : { *(.debug_srcinfo) }
  .debug_sfnames  0 : { *(.debug_sfnames) }
  /* DWARF 1.1 and DWARF 2 */
  .debug_aranges  0 : { *(.debug_aranges) }
  .debug_pubnames 0 : { *(.debug_pubnames) }
  /* DWARF 2 */
  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
  .debug_abbrev   0 : { *(.debug_abbrev) }
  .debug_line     0 : { *(.debug_line) }
  .debug_frame    0 : { *(.debug_frame) }
  .debug_str      0 : { *(.debug_str) }
  .debug_loc      0 : { *(.debug_loc) }
  .debug_macinfo  0 : { *(.debug_macinfo) }
  /* SGI/MIPS DWARF 2 extensions */
  .debug_weaknames 0 : { *(.debug_weaknames) }
  .debug_funcnames 0 : { *(.debug_funcnames) }
  .debug_typenames 0 : { *(.debug_typenames) }
  .debug_varnames  0 : { *(.debug_varnames) }
}


==================================================
attempt to open /usr/lib/gcc-lib/i386-linux/3.0.4/../../../crti.o
succeeded
/usr/lib/gcc-lib/i386-linux/3.0.4/../../../crti.o
attempt to open /usr/lib/gcc-lib/i386-linux/3.0.4/crtbeginS.o succeeded
/usr/lib/gcc-lib/i386-linux/3.0.4/crtbeginS.o
attempt to open t.o succeeded
t.o
attempt to open /usr/lib/gcc-lib/i386-linux/3.0.4/libgcc_s.so succeeded
-lgcc_s (/usr/lib/gcc-lib/i386-linux/3.0.4/libgcc_s.so)
attempt to open /usr/lib/gcc-lib/i386-linux/3.0.4/libc.so failed
attempt to open /usr/lib/gcc-lib/i386-linux/3.0.4/libc.a failed
attempt to open /usr/lib/gcc-lib/i386-linux/3.0.4/../../../libc.so
succeeded
opened script file /usr/lib/gcc-lib/i386-linux/3.0.4/../../../libc.so
opened script file /usr/lib/gcc-lib/i386-linux/3.0.4/../../../libc.so
attempt to open /lib/libc.so.6 succeeded
/lib/libc.so.6
attempt to open /usr/lib/libc_nonshared.a succeeded
attempt to open /usr/lib/gcc-lib/i386-linux/3.0.4/libgcc_s.so succeeded
-lgcc_s (/usr/lib/gcc-lib/i386-linux/3.0.4/libgcc_s.so)
attempt to open /usr/lib/gcc-lib/i386-linux/3.0.4/crtendS.o succeeded
/usr/lib/gcc-lib/i386-linux/3.0.4/crtendS.o
attempt to open /usr/lib/gcc-lib/i386-linux/3.0.4/../../../crtn.o
succeeded
/usr/lib/gcc-lib/i386-linux/3.0.4/../../../crtn.o
(no debugging symbols found)...(no debugging symbols found)...
Program received signal SIGSEGV, Segmentation fault.
0x4004cd76 in bfd_elf32_bfd_final_link () from
/usr/lib/libbfd-2.13.90.0.10.so
(gdb) backtrace 
#0  0x4004cd76 in bfd_elf32_bfd_final_link () from
/usr/lib/libbfd-2.13.90.0.10.so
#1  0x40033b4d in bfd_hash_traverse () from
/usr/lib/libbfd-2.13.90.0.10.so
#2  0x400340e8 in bfd_link_hash_traverse () from
/usr/lib/libbfd-2.13.90.0.10.so
#3  0x4004bab9 in bfd_elf32_bfd_final_link () from
/usr/lib/libbfd-2.13.90.0.10.so
#4  0x08058abd in bfd_link_hash_lookup ()
#5  0x08056bc6 in bfd_link_hash_lookup ()
#6  0x4009a9d3 in __libc_start_main () from /lib/libc.so.6

If there is any other debug info that I can send, let me know. Regards -
address@hidden





reply via email to

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