https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118803
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Also if you the gcc driver and use -save-temps, the driver will pass via
COLLECT_GCC_OPTIONS and collect2 picks that up there.
/* Now pick up any flags we want early from COLLECT_GCC_OPTIONS
The LTO options are passed here as are other options that might
be unsuitable for ld (e.g. -save-temps). */
p = getenv ("COLLECT_GCC_OPTIONS");
while (p && *p)
{
const char *q = extract_string (&p);
if (*q == '-' && (q[1] == 'm' || q[1] == 'f'))
num_c_args++;
if (startswith (q, "-flto-partition=none"))
no_partition = true;
else if (startswith (q, "-fno-lto"))
lto_mode = LTO_MODE_NONE;
else if (startswith (q, "-save-temps"))
/* FIXME: Honour =obj. */
save_temps = true;
...
/* Make temp file names. */
if (save_temps)
{
c_file = concat (output_file, ".cdtor.c", NULL);
o_file = concat (output_file, ".cdtor.o", NULL);
#ifdef COLLECT_EXPORT_LIST
export_file = concat (output_file, ".x", NULL);
#endif
}
else
{
c_file = make_temp_file (".cdtor.c");
o_file = make_temp_file (".cdtor.o");
#ifdef COLLECT_EXPORT_LIST
export_file = make_temp_file (".x");
#endif
}
Anyways on elf targets either .init_array or .init sections are used.
.init_array is executed by ld.so directly.