[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sparc-unknown-linux-ld segfaults when linking non-PIC data into a .so
From: |
Nix |
Subject: |
sparc-unknown-linux-ld segfaults when linking non-PIC data into a .so |
Date: |
Sat, 13 Dec 2003 22:16:55 +0000 |
User-agent: |
Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Reasonable Discussion, linux) |
This is with HJ's 2.14.90.0.7 release.
Sometime since the 2.13 release, ld has started dying hard when asked to
link non-PIC data into a shared library on sparc-unknown-linux.
This is reproducible on every box I've tried it on given, for instance,
a non-PIC copy of inflate.o and infback.o from zlib, and the trivial
link line
/usr/bin/ld -m elf32_sparc -shared -o foo.so.10.0.0 -soname foo.so.1 inflate.o
infback.o
(a copy of these object files is in
<http://www.esperi.demon.co.uk/nix/downloads/ld-crash.tar.bz2>)
There's nothing wrong with failing when you try to link non-PIC data
into a shared library, but ld didn't always fail, and failure like this
is rather worse than failing with an error message. (If it had failed
with an error, I might have noticed that I was linking non-PIC data into
libz.so *before* burning half an hour debugging it. :) )
The crash happens inside libbfd, during relocation. Here's a backtrace
from an ld built with -O0:
Program received signal SIGSEGV, Segmentation fault.
0x00067858 in elf32_sparc_relocate_section (output_bfd=0x15ea88, info=0x1554f0,
input_bfd=0x173330, input_section=0x1b9428, contents=0x341d48 "\235ã¿`
\a¿ÀÂ\006@",
relocs=0x1befd8, local_syms=0x34aa90, local_sections=0x34afd8) at
../../2.14.90.0.7/bfd/elf32-sparc.c:2483
2483 indx = elf_section_data (osec)->dynindx;
(gdb) bt
#0 0x00067858 in elf32_sparc_relocate_section (output_bfd=0x15ea88,
info=0x1554f0, input_bfd=0x173330, input_section=0x1b9428, contents=0x341d48
"\235ã¿` \a¿ÀÂ\006@",
relocs=0x1befd8, local_syms=0x34aa90, local_sections=0x34afd8) at
../../2.14.90.0.7/bfd/elf32-sparc.c:2483
#1 0x0007e720 in elf_link_input_bfd (finfo=0xeffff0a8, input_bfd=0x173330) at
elflink.h:5046
#2 0x00079fa4 in bfd_elf32_bfd_final_link (abfd=0xeffff0a8, info=0x173330) at
elflink.h:3595
The line in question reads:
indx = elf_section_data (osec)->dynindx;
Here's osec:
(gdb) print *osec
$2 = {name = 0x142800 "*ABS*", id = 2, index = 0, next = 0x0, flags = 0,
user_set_vma = 0, reloc_done = 0, linker_mark = 0,
linker_has_input = 0, gc_mark = 1, segment_mark = 0,
sec_info_type = 0, use_rela_p = 0, has_tls_reloc = 0,
need_finalize_relax = 0, has_gp_reloc = 0, flag13 = 0,
flag14 = 0, flag15 = 0, flag16 = 0, flag20 = 0, flag24 = 0,vma = 0,
lma = 0, _cooked_size = 0, _raw_size = 0, output_offset = 0,
output_section = 0x1503a0, alignment_power = 0, relocation = 0x0,
orelocation = 0x0, reloc_count = 0, filepos = 0, rel_filepos = 0,
line_filepos = 0, userdata = 0x0, contents = 0x0, lineno = 0x0,
lineno_count = 0, entsize = 0, comdat = 0x0, kept_section = 0x0,
moving_line_filepos = 0, target_index = 0, used_by_bfd = 0x0,
constructor_chain = 0x0, owner = 0x0, symbol = 0x142850,
symbol_ptr_ptr = 0x142898, link_order_head = 0x0,
link_order_tail = 0x0}
used_by_bfd is NULL. This isn't going to help elf_section_data().
--
`...some suburbanite DSL customer who thinks kernel patches are some
form of military insignia.' --- Bob Apthorpe
- sparc-unknown-linux-ld segfaults when linking non-PIC data into a .so,
Nix <=