I'm looking into a problem I'm seeing with the Blackfin linker (binutils 2.21 & HEAD) when I move to gcc-4.5 (from gcc-4.3). When compiling the example at the bottom (-O3 -g FDPIC), I get the following error: bin/ld: LINKER BUG: .rofixup section size mismatch bin/ld: final link failed: Nonrepresentable section on output i.e. the fixup section size is smaller than the fixup relocation count * 4. The problem appears to be caused by gcc 4.5's emission of a series of: .picptr funcdesc(_callback) in the .debug_info section which aren't being handled correctly. I can workaround the error by just not counting relocsfd for R_BFIN_FUNCDESCs in sections without the SEC_ALLOC flag, but this doesn't seem like the appropriate fix. Example: static int CallFunctionRec(int (*fun)()) { CallFunctionRec(fun); return 1; } static int CallFunction(int (*fun)()) { return CallFunctionRec(fun); } static int callback() { return 0; } int main() { CallFunction(callback); return 0; }
Anything can be done to fix this bug? It still happening with the test case and binutils git from today. wbx@gcc76:~/bfin$ ./toolchain_sim-bfin_uclibc-ng_bf512_fdpic/usr/bin/bfin-openadk-linux-uclibc-gcc -o test test.c wbx@gcc76:~/bfin$ ./toolchain_sim-bfin_uclibc-ng_bf512_fdpic/usr/bin/bfin-openadk-linux-uclibc-gcc -g3 -o test test.c wbx@gcc76:~/bfin$ ./toolchain_sim-bfin_uclibc-ng_bf512_fdpic/usr/bin/bfin-openadk-linux-uclibc-gcc -O3 -g3 -o test test.c /home/wbx/bfin/toolchain_sim-bfin_uclibc-ng_bf512_fdpic/usr/lib/gcc/bfin-openadk-linux-uclibc/7.2.0/../../../../bfin-openadk-linux-uclibc/bin/ld: LINKER BUG: .rofixup section size mismatch /home/wbx/bfin/toolchain_sim-bfin_uclibc-ng_bf512_fdpic/usr/lib/gcc/bfin-openadk-linux-uclibc/7.2.0/../../../../bfin-openadk-linux-uclibc/bin/ld: final link failed: Nonrepresentable section on output It triggers a lot of build failures in the Buildroot autobuilders.
(In reply to wbx from comment #1) > Anything can be done to fix this bug? > It still happening with the test case and binutils git from today. Can you provide a testcase which I could examine ? I know that the original report include a C source code example, but I do not have access to a bfin compiler or system libraries. An object file, minimal set of libraries and a linker command line would be really helpful. Cheers Nick
Created attachment 10713 [details] gcc verbose linker output gcc -Wl,-verbose output
Created attachment 10714 [details] crtbegin.o object file
Created attachment 10715 [details] crtbeginS.o object file
Created attachment 10716 [details] crtend.o object file
Created attachment 10717 [details] crtendS.o object file
Created attachment 10718 [details] libgcc.a static archive
Created attachment 10719 [details] libgcc_eh.a static archive
Created attachment 10720 [details] ld-uClibc.so shared library loader
Created attachment 10721 [details] libuClibc.so shared library
Created attachment 10722 [details] test.o object file
Hi Nick, all attached. best regards Waldemar
Created attachment 10723 [details] Proposed patch Hi Waldemar, Please try out this patch and let me know if it works for you. Cheers Nick PS. It probably needs testing on some real programs as well as just the simple test case...
Hi Nick, I just rebuild binutils with the patch and the testcase compiled. But afterwards I have done a complete rebuild of toolchain and base system and attached regression appeared (double checked with and without patch) while compiling uClibc-ng utils (ldd, ldconfig, ..) for target use. best regards Waldemar
Created attachment 10725 [details] regression introduced by patch
Hi Waldemar, *sigh* I suspected that something like this might happen. Please can you send me a reproducer for the new failure so that I can investigate ? Cheers Nick
Hi Nick, A link to all files is okay? https://debug.openadk.org/bfin/ best regards Waldemar
Created attachment 10729 [details] Proposed patch Hi Waldemar, Thanks - that worked and I could reproduce the new failure. I am clutching at straws a bit here, but please could you try out the revised patch attached ? It works for me, but that is not saying much... Cheers Nick
Hi Nick, It is getting better, the testcase works, the uClibc utils are compilable, but compilation of busybox fails now. See regression2.txt. best regards Waldemar
Created attachment 10730 [details] regression introduced by second patch
Hi Waldemar, > It is getting better, the testcase works, the uClibc utils are compilable, > but compilation of busybox fails now. *sigh*. OK, I will take a look, but it may not be for a little while as I am busy with the 2.30 release at the moment. Cheers Nick
Hi Nick, I can provide you shell access to a server with all stuff precompiled showing the error if you want? best regards Waldemar
Hi Waldemar, > I can provide you shell access to a server with all stuff precompiled > showing the error if you want? Can you send me another tarball of objects/libraries please ? And the linker command line. (It is much easier for me to debug things locally). Cheers Nick
Hi Nick, sorry for the long timeout. Here you find the objects and libraries: https://debug.openadk.org/bfin-report/ Binutils git from today. bb.tar.gz contains the busybox objects. u.tar.gz contains uClibc-ng/gcc objects and libraries. foo.sh is the compile step and foo.log the verbose output. best regards Waldemar