https://sourceware.org/bugzilla/show_bug.cgi?id=28124
Alan Modra <amodra at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2024-02-16
--- Comment #2 from Alan Modra <amodra at gmail dot com> ---
It isn't that SHT_INIT_ARRAY sections are treated specially (although they are
for ld -r). The reason why .init_array.bbb and .init_array.a is kept is the
KEEP in the default linker script:
.init_array :
{
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*)
SORT_BY_INIT_PRIORITY(.ctors.*)))
KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o
*crtend?.o ) .ctors))
PROVIDE_HIDDEN (__init_array_end = .);
}
The pattern .init_array.* is there to match .init_array.65530 or similar with a
numeric suffix. (In fact, it's probably wrong to match other named .init_array
sections there, but that's a side issue.)
KEEP operates on the named sections regardless of whether they are part of a
group or not. We'd need to change the behaviour of KEEP (or invent a new
keyword) if .init_array inside a group was to be gc'ed.
--
You are receiving this mail because:
You are on the CC list for the bug.