GCC 11.1.10 ld: warning: .init_array section has zero size
Nick Clifton
nickc@redhat.com
Thu Jun 17 11:50:50 GMT 2021
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.
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 ?
Cheers
Nick
More information about the Binutils
mailing list