GCC 11.1.10 ld: warning: .init_array section has zero size
Chris Packham
Chris.Packham@alliedtelesis.co.nz
Fri Jun 18 00:49:55 GMT 2021
On 18/06/21 12:30 pm, Alan Modra wrote:
> On Thu, Jun 17, 2021 at 09:20:56PM +0000, Chris Packham via Binutils wrote:
>>>> warning: .init_array section has zero size
>> I'm in the process of getting a GCC bugzilla account so I was also going
>> to report there.
> Before doing that, inspect all of the object files you are linking
> with readelf -SW. (Use gcc -v to see the linker command line, and all
> of the objects/libraries involved, or link with -Wl,-t to have the
> linker report files it links.) One or more of them will have a zero
> size .init_array section. If they were objects created by gcc from
> source or supplied with the compiler (crtbegin*.o, crtend*.o) then a
> gcc bug report is appropriate. If they are other startup files, libc
> objects or assembly source objects you probably shouldn't complain
> about gcc.
>
Looks like crtbegin.o has a zero-sized .init_array/.fini_array
x-tool@063c4281c760:~$ readelf -SW
/home/x-tool/x-tools/arm-unknown-linux-gnueabi/lib/gcc/arm-unknown-linux-gnueabi/11.1.0/crtbegin.o
There are 13 section headers, starting at offset 0x2bc:
Section Headers:
[Nr] Name Type Addr Off Size ES Flg
Lk Inf Al
[ 0] NULL 00000000 000000 000000 00
0 0 0
[ 1] .text PROGBITS 00000000 000034 000000 00 AX
0 0 1
[ 2] .data PROGBITS 00000000 000034 000004 00 WA
0 0 4
[ 3] .bss NOBITS 00000000 000038 000000 00 WA
0 0 1
[ 4] .rodata PROGBITS 00000000 000038 000090 00 A
0 0 4
[ 5] .init_array INIT_ARRAY 00000000 0000c8 000000 04 WA
0 0 1
[ 6] .fini_array FINI_ARRAY 00000000 0000c8 000000 04 WA
0 0 1
[ 7] .comment PROGBITS 00000000 0000c8 00002f 01 MS
0 0 1
[ 8] .note.GNU-stack PROGBITS 00000000 0000f7 000000 00
0 0 1
[ 9] .ARM.attributes ARM_ATTRIBUTES 00000000 0000f7 000031 00
0 0 1
[10] .symtab SYMTAB 00000000 000128 0000f0 10
11 14 4
[11] .strtab STRTAB 00000000 000218 00002e 00
0 0 1
[12] .shstrtab STRTAB 00000000 000246 000075 00
0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
L (link order), O (extra OS processing required), G (group), T (TLS),
C (compressed), x (unknown), o (OS specific), E (exclude),
y (purecode), p (processor specific)
More information about the Binutils
mailing list