Discussion:
STARTUP linker script option
Matthew Stock
2018-11-21 05:09:28 UTC
Permalink
Hi all,

I'm new to the mailing list, but I've been tinkering in a fork of the code
for the past few years. My fundamental question is pretty simple: is the
STARTUP() linker script option deprecated? It seems to do nothing.

After looking at the code in ld/ldlang.c, it seems like the filename that
is provided in STARTUP() is stored in first_file, but that variable appears
to be both static to the file and never referenced. Looking back in the
archive, it seems like it's been that way for at least the past decade, so
what am I missing?

I was able to solve my problem by explicitly adding my bootstrap code file
to the top of the .text file in the linker script. STARTUP() isn't really
essential, and so maybe that's why this hasn't come up.

Thanks for any guidance,

Matt
Alan Modra
2018-11-21 11:13:34 UTC
Permalink
Post by Matthew Stock
Hi all,
I'm new to the mailing list, but I've been tinkering in a fork of the code
for the past few years. My fundamental question is pretty simple: is the
STARTUP() linker script option deprecated? It seems to do nothing.
After looking at the code in ld/ldlang.c, it seems like the filename that
is provided in STARTUP() is stored in first_file, but that variable appears
to be both static to the file and never referenced. Looking back in the
archive, it seems like it's been that way for at least the past decade, so
what am I missing?
lang_init creates an entry of header.type lang_input_statement_enum on
the linker's statement list, with flags.real not set. first_file
points at that dummy statement. That statement is modified to real by
lang_startup, so it should be processed in open_input_bfds.
--
Alan Modra
Australia Development Lab, IBM
Matthew Stock
2018-11-21 15:27:38 UTC
Permalink
Thanks Alan, with a bit more digging I see what you mean. I'll do some
additional tests and see why this isn't working the way I expect it to.

Matt
Post by Matthew Stock
Post by Matthew Stock
Hi all,
I'm new to the mailing list, but I've been tinkering in a fork of the
code
Post by Matthew Stock
for the past few years. My fundamental question is pretty simple: is the
STARTUP() linker script option deprecated? It seems to do nothing.
After looking at the code in ld/ldlang.c, it seems like the filename that
is provided in STARTUP() is stored in first_file, but that variable
appears
Post by Matthew Stock
to be both static to the file and never referenced. Looking back in the
archive, it seems like it's been that way for at least the past decade,
so
Post by Matthew Stock
what am I missing?
lang_init creates an entry of header.type lang_input_statement_enum on
the linker's statement list, with flags.real not set. first_file
points at that dummy statement. That statement is modified to real by
lang_startup, so it should be processed in open_input_bfds.
--
Alan Modra
Australia Development Lab, IBM
Loading...