https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98210
Bug ID: 98210
Summary: SHF_GNU_RETAIN breaks gold linker generated binaries
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: amodra at gmail dot com
Target Milestone: ---
gcc.dg/split-1.exe and other split-stack executables broke recently on
powerpc64le-linux, most likely due to git commit 6fbec038f7a7.
I see
[22] .init_array INIT_ARRAY 000000001001fda8 00fda8 000008 08 WAo
0 0 8
[23] .init_array INIT_ARRAY 000000001001fdb0 00fdb0 000010 00 WA
0 0 8
and in dynamic tags
0x0000000000000019 (INIT_ARRAY) 0x1001fda8
0x000000000000001b (INIT_ARRAYSZ) 8 (bytes)
0x0000000000000019 (INIT_ARRAY) 0x1001fdb0
0x000000000000001b (INIT_ARRAYSZ) 16 (bytes)
ld.so won't handle multiple tags like this, and symbols __init_array_start and
__init_array_end are defined to cover just the first .init_array section.
The same thing happens on x86_64 when using gold, objects like crtbegin.o that
have .init_array with "WAR" flags create separate .init_array output sections
if being linked with glibc files containing .init_array without the "R" flag.