Red Hat Bugzilla – Bug 741053
binutils-188.8.131.52.2-build-id.patch causes segfault on ARM
Last modified: 2012-08-07 16:00:22 EDT
F15 gcc fails to link on armv5tel due to ld crashing. 100% reproducible.
/usr/bin/ld --build-id --no-add-needed --eh-frame-hdr --hash-style=gnu -export-dynamic -dynamic-linker /lib/ld-linux.so.3 -X -m armelf_linux_eabi -o cc1 /usr/lib/gcc/armv5tel-redhat-linux-gnueabi/4.5.1/../../../crt1.o /usr/lib/gcc/armv5tel-redhat-linux-gnueabi/4.5.1/../../../crti.o /usr/lib/gcc/armv5tel-redhat-linux-gnueabi/4.5.1/crtbegin.o -L/usr/lib/gcc/armv5tel-redhat-linux-gnueabi/4.5.1 -L/usr/lib/gcc/armv5tel-redhat-linux-gnueabi/4.5.1/../../.. c-lang.o c-family/stub-objc.o attribs.o c-errors.o c-decl.o c-typeck.o c-convert.o c-aux-info.o c-objc-common.o c-parser.o tree-mudflap.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o arm-c.o cc1-checksum.o main.o libbackend.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a ../libcpp/libcpp.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -lmpc -lmpfr -lgmp -ldl -lz -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/armv5tel-redhat-linux-gnueabi/4.5.1/crtend.o /usr/lib/gcc/armv5tel-redhat-linux-gnueabi/4.5.1/../../../crtn.o
Program received signal SIGSEGV, Segmentation fault.
sha1_process_block (buffer=<value optimized out>, len=<value optimized out>,
ctx=0x6a578500) at ./sha1.c:319
319 while (words < endp)
Missing separate debuginfos, use: debuginfo-install glibc-2.13-2.1.armv5tel libgcc-4.5.1-5.fc14.1.armv5tel zlib-1.2.5-2.fc14.armv5tel
#0 sha1_process_block (buffer=<value optimized out>,
len=<value optimized out>, ctx=0x6a578500) at ./sha1.c:319
#1 0x000348c8 in sha1_process_bytes (buffer=0x43ef2068, len=42803016,
ctx=0xbefff430) at ./sha1.c:245
#2 0x4006fc44 in bfd_elf32_checksum_contents (abfd=0x92530,
process=0x34808 <sha1_process_bytes>, arg=0xbefff430) at elfcode.h:1182
#3 0x0002d090 in gldarmelf_linux_eabi_write_build_id_section (abfd=0x90558)
#4 0x400790d8 in _bfd_elf_write_object_contents (abfd=0x90558) at elf.c:5321
#5 0x4004301c in bfd_close (abfd=0x90558) at opncls.c:699
#6 0x000229fc in main (argc=10000, argv=0x43) at ./ldmain.c:497
This is with binutils-184.108.40.206.6-7.fc15.
I determined that removing --build-id from the ld invocation avoids the issue, and also that this issue doesn't occur if I rebuild binutils without patch08 "binutils-220.127.116.11.2-build-id.patch". I think this patch is buggy somehow.
The same bug is reported at Ubuntu:
probably because they have also included the suspected-buggy patch:
SSH access is available to an ARM box that trivially reproduces this issue if needed.
Any help much appreciated, as this is holding back F15/F16 ARM porting efforts. Thanks!
This issue does not appear if we shift to a newer binutils version (by taking one of the f16 ones and rebuilding for f15).
The last version where this bug still occurs: 18.104.22.168.8-3.fc16
The first version that doesn't crash: 22.214.171.124.9-1.fc16
The suspected buggy patch is still included in the working version.
I took a look at the differences between 126.96.36.199.8 and 188.8.131.52.9 and identified that the following commit (included in 0.9 but not 0.8) solves the issue:
If I add that to F15 (even without removing binutils-184.108.40.206.2-build-id.patch), the crash no longer occurs.
Looking at that commit, I guess binutils-220.127.116.11.2-build-id.patch may not be buggy after all. The commit seems to fix the specific case of reading sections after bfd_final_link has written the contents out to disk, which is exactly what binutils-18.104.22.168.2-build-id.patch does. This looks like the right fix to me.
Sorry for the very long delay in responding to this issue. I have looked over the patch you located and I agree that it does the job, so I have now checked it in to the f15 sources. Please try binutils-22.214.171.124.6-8.fc15 and let me know if you have any more problems.
Another ARM contributor hit exactly the same issue compiling ghc (matching backtrace), and confirms that binutils-126.96.36.199.6-9.fc15 fixes the problem. Thanks!
This message is a notice that Fedora 15 is now at end of life. Fedora
has stopped maintaining and issuing updates for Fedora 15. It is
Fedora's policy to close all bug reports from releases that are no
longer maintained. At this time, all open bugs with a Fedora 'version'
of '15' have been closed as WONTFIX.
(Please note: Our normal process is to give advanced warning of this
occurring, but we forgot to do that. A thousand apologies.)
Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen
this bug and simply change the 'version' to a later Fedora version.
Bug Reporter: Thank you for reporting this issue and we are sorry that
we were unable to fix it before Fedora 15 reached end of life. If you
would still like to see this bug fixed and are able to reproduce it
against a later version of Fedora, you are encouraged to click on
"Clone This Bug" (top right of this page) and open it against that
version of Fedora.
Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
The process we are following is described here: