Created attachment 6428 [details] test case I have an issue were I get an "assertion fail ../../bfd/elf32-arm.c:12264" when I link a shared library which links itself two static libraries and hides the symbols using the "--exclude-libs ALL" switch. The sources are build with -ffunction-sections and -fdata-sections and at link time --gc-section is used. When removing --gc-sections or --exclude-libs the problem disappears. See the attached testcase (tar containing 3 short C files and a Makefile which you need to adapt for the right compiler name since it is an arm cross compiler) Actually the output is currently: $ make ../bin/arm-PP-linux-uclibcgnueabi-gcc -fPIC -ffunction-sections -fdata-sections -c -o test.o test.c ../bin/arm-PP-linux-uclibcgnueabi-gcc -fPIC -ffunction-sections -fdata-sections -c -o test1.o test1.c rm -f libtest1.a ../bin/arm-PP-linux-uclibcgnueabi-ar cru libtest1.a test1.o ../bin/arm-PP-linux-uclibcgnueabi-gcc -fPIC -ffunction-sections -fdata-sections -c -o test2.o test2.c rm -f libtest2.a ../bin/arm-PP-linux-uclibcgnueabi-ar cru libtest2.a test2.o ../bin/arm-PP-linux-uclibcgnueabi-gcc -shared -o libtest.so test.o -Wl,--gc-sections,--exclude-libs,ALL -L. -ltest2 -ltest1 /opt/pp_toolchain/cross/008/bin/../lib/gcc/arm-pp-linux-uclibcgnueabi/4.6.3/../../../../arm-pp-linux-uclibcgnueabi/bin/ld: BFD (Linux/GNU Binutils) 2.22.52.0.2.20120424 assertion fail ../../bfd/elf32-arm.c:12264 Looking at the code I saw that there was some recent activity where the assert is generated (PLT ref count book-keeping check). Probably some case was overlooked?!
Please provide a self-contained testcase with only assembly codes for cross binutils. Not all binutils developers have ARM cross compilers.
Created attachment 6430 [details] test case with assembly only Added test case which uses only assembly so no cross compiler is required.
It was caused by http://sourceware.org/ml/binutils-cvs/2011-03/msg00080.html
Is there a fix available for this bug? Apparently, the build of systemd for ARM is broken when passing --gc-sections to ld. This is reproducible on IPFire as well as Fedora. https://bugs.freedesktop.org/show_bug.cgi?id=51365
Created attachment 6496 [details] Do not increment refcount for locally bound symbols.
Hi Michael, Hi Ronald, Please could you try out the uploaded patch and let me know if it works for you ? Cheers Nick
Hi Nick, I can confirm that the patch fixes the problem over here. The build of systemd runs through without any assertion errors. Thank you very much.
CVSROOT: /cvs/src Module name: src Changes by: nickc@sourceware.org 2012-06-29 15:20:31 Modified files: bfd : ChangeLog elf32-arm.c Log message: PR ld/14189 * elf32-arm.c (elf32_arm_check_relocs): Do not increment refcount for locally bound symbols. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5737&r2=1.5738 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf32-arm.c.diff?cvsroot=src&r1=1.295&r2=1.296
Patch applied.
The patch works here as well. Thanks!