The ld segfault happens on amd64 as well; since the problem is caused by
the linker, I'm investigating
the problem using the direct call to ld stripped down to the minimal set
of parameters:
ld -soname=libc.so.6 -uwctomb -ufclose -ureboot -upthread_mutex_lock -ufreopen64
-ugetmntent -usleep -usigaddset -uiconv -ugetresgid -uumask -usend
-usched_setparam
-u__fxstat -uisspace -ulocaltime -uiopl -ugetppid -uutime -ustrnlen -utcsetpgrp
-urecvfrom -usched_get_priority_max -ustderr -uiswspace -uklogctl -usnprintf
-umemset -usync -u_dl_vsym -usyslog -u_libc_intl_domainname -ustrcasestr
-u__ctype_get_mb_cur_max -umktemp -utcgetattr -ustrchrnul
-u_nss_files_parse_spent
-uopenlog -uaccess -ugrantpt -usetlogmask -u__dcgettext -u__clone -uioperm
-umunmap -usocketpair -uh_errno -o
/home/zino/gtk-miniiso_orig/installer/build/tmp/gtk-miniiso/tree/lib/libc.so.6-so
/usr/lib/libc_pic/soinit.o /usr/lib//libc_pic.a /usr/lib/libc_pic/sofini.o
/lib//ld-linux-x86-64.so.2 --version-script=/usr/lib//libc_pic.map -lgcc
-L./tmp/gtk-miniiso/tree/lib -L./tmp/gtk-miniiso/tree/usr/lib
-L./tmp/gtk-miniiso/udeblibs
-L/lib/ -L/usr/lib/ -L/usr/X11R6/lib/ -L./tmp/gtk-miniiso/tree//usr/lib/cdebconf
-L./tmp/gtk-miniiso/tree//usr/lib
if -uh_errno is removed from the previous command, the segfault does not
happen
I recompiled ld starting from binutils source package and here's a backtrace:
---
Starting program: /home/zino/binutils/TESTDIR/usr/local/bin/ld -soname=libc.so.6
-uwctomb -ufclose -ureboot -upthread_mutex_lock -ufreopen64 -ugetmntent -usleep
-usigaddset -uiconv -ugetresgid -uumask -usend -usched_setparam -u__fxstat
-uisspace -ulocaltime -uiopl -ugetppid -uutime -ustrnlen -utcsetpgrp -urecvfrom
-usched_get_priority_max -ustderr -uiswspace -uklogctl -usnprintf -umemset
-usync -u_dl_vsym -usyslog -u_libc_intl_domainname -ustrcasestr
-u__ctype_get_mb_cur_max
-umktemp -utcgetattr -ustrchrnul -u_nss_files_parse_spent -uopenlog -uaccess
-ugrantpt -usetlogmask -u__dcgettext -u__clone -uioperm -umunmap -usocketpair
-uh_errno -uiconv_open -o ./tmp/gtk-miniiso/tree/lib/libc.so.6-so
/usr/lib/libc_pic/soinit.o
/usr/lib//libc_pic.a /usr/lib/libc_pic/sofini.o /lib//ld-linux-x86-64.so.2
--version-script=/usr/lib//libc_pic.map -lgcc -L./tmp/gtk-miniiso/tree/lib
-L./tmp/gtk-miniiso/tree/usr/lib -L./tmp/gtk-miniiso/udeblibs -L/lib/
-L/usr/lib/
-L/usr/X11R6/lib/ -L./tmp/gtk-miniiso/tree//usr/lib/cdebconf
-L./tmp/gtk-miniiso/tree//usr/lib
/home/zino/binutils/TESTDIR/usr/local/bin/ld: warning: the use of `mktemp'
is dangerous, better use `mkstemp'
/home/zino/binutils/TESTDIR/usr/local/bin/ld:
Program received signal SIGSEGV, Segmentation fault.
_bfd_default_error_handler (fmt=0x4d231e ) at bfd.c:481
481 if (abfd-my_archive)
(gdb) bt
#0 _bfd_default_error_handler (fmt=0x4d231e ) at bfd.c:481
#1 0x00449575 in _bfd_elf_merge_symbol (abfd=Variable abfd is
not available.
) at elflink.c:941
#2 0x0044cb61 in bfd_elf_link_add_symbols (abfd=0xd7e2f0,
info=0x5f4580)
at elflink.c:3791
#3 0x0044be8a in elf_link_add_archive_symbols (abfd=0x64cf70,
info=0x5f4580)
at elflink.c:4664
#4 0x0044c425 in bfd_elf_link_add_symbols (abfd=0x64cf70,
info=0x5f4580)
at elflink.c:4720
#5 0x0040a1b1 in load_symbols (entry=0x5f9c10, place=Variable place
is not available.
) at ldlang.c:2278
#6 0x0040fb63 in open_input_bfds (s=0x5f9c10, force=0) at ldlang.c:2688
#7 0x0040fd66 in lang_process () at ldlang.c:5282
#8 0x00412c82 in main (argc=Variable argc is not available.
) at .././ld/ldmain.c:457
(gdb) p *abfd-my_archive
$16 = {id = 2, filename = 0x7f9f8a09 /usr/lib//libc_pic.a, xvec =
0x4cf320,
iostream = 0x64ca60, iovec = 0x4c3be0, cacheable = 1, target_defaulted
= 0,
lru_prev = 0x63e170, lru_next = 0x64b7d0, where = 3256338, opened_once
= 1, mtime_set = 0,
mtime = 0, ifd = 0, format = bfd_archive, direction = read_direction, flags
= 0, origin = 0,
output_has_begun = 0, section_htab = {table = 0x65aaf0, size = 251,
newfunc = 0x429350 bfd_section_hash_newfunc, memory = 0x64db90}, sections
= 0x0,
section_last = 0x0, section_count = 0, start_address = 0, symcount = 0,
outsymbols = 0x0,
dynsymcount = 0, arch_info = 0x4c37e0, no_export = 0, arelt_data = 0x0,
my_archive = 0x0,
next = 0x0, archive_head = 0x0, has_armap = 1, link_next = 0x0, archive_pass
= 0, tdata = {
aout_data = 0x659b00, aout_ar_data = 0x659b00, oasys_obj_data = 0x659b00,
oasys_ar_data = 0x659b00, coff_obj_data = 0x659b00, pe_obj_data = 0x659b00,
xcoff_obj_data = 0x659b00, ecoff_obj_data = 0x659b00, ieee_data = 0x659b00,
ieee_ar_data = 0x659b00, srec_data = 0x659b00, ihex_data = 0x659b00,
tekhex_data = 0x659b00,
elf_obj_data = 0x659b00, nlm_obj_data = 0x659b00, bout_data = 0x659b00,
mmo_data = 0x659b00,
sun_core_data = 0x659b00, sco5_core_data = 0x659b00, trad_core_data =