GCC 11.1.10 ld: warning: .init_array section has zero size
Chris Packham
Chris.Packham@alliedtelesis.co.nz
Thu Jun 17 21:20:56 GMT 2021
Hi Nick,
On 17/06/21 11:50 pm, Nick Clifton wrote:
> Hi Chris,
>
>> I'm trying to migrate our builds to GCC 11.1.0 + binutils 2.36.1 and I'm
>> getting a weird linker warning for ARM (I'm also building for MIPS64
>> where I don't see the warning).
>>
>> $ rm -f test; make CC=arm-unknown-linux-gnueabi-gcc test
>> arm-unknown-linux-gnueabi-gcc test.c -o test
>> /usr/bin/../lib/gcc/arm-unknown-linux-gnueabi/11.1.0/../../../../arm-unknown-linux-gnueabi/bin/ld:
>>
>> warning: .init_array section has zero size
>
> This message happens when the linker is trying to populate
> the .dynamic section with information about the executable.
>
> The fact that it is happening suggests that either you are
> creating a dynamic executable when you expected to be creating
> a static one, or that you are linking against the wrong libraries,
>
> If the former, try adding "-static" to the gcc command line.
-static does avoid the error. But generally I do want dynamic
executables so it's not a solution but does look like we're on the right
track.
> If the latter, check to see which libraries you have installed. For
> example are they old versions which were built by an old version of gcc ?
Everything build from scratch. A few more details on the crosstool-ng
issue[1]. I don't see the problem with GCC 9.3.0 (same libc & binutils).
I do see it with GCC 10.3.0.
I'm in the process of getting a GCC bugzilla account so I was also going
to report there.
--
[1] - https://github.com/crosstool-ng/crosstool-ng/issues/1531
More information about the Binutils
mailing list