This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: "defines" in linker script
On Thu, Mar 25, 2004 at 03:44:48PM +0000, Dave Korn wrote:
> What you've written is apparently meant to work. I believe it's a bug in
> ld. See
> http://sources.redhat.com/ml/binutils/2004-03/msg00540.html
> for an in-depth analysis of exactly why it doesn't work; as to a solution,
> I'm not very clear how to proceed.
There is no easy way to make this work. As you have discovered, the
ld script symbol lookup uses the main linker symbol hash table, which
isn't created until the output file is opened. The symbol hash table
can't be created much earlier because you don't know the output type
until the link script is scanned for OUTPUT_FORMAT statements, and the
hash table can depend on output type.
You'd need to track symbols defined in the link script by some other
means, eg. see how undefined symbols are handled, ldlang_add_undef.
Then you could use that list (or whatever other structure) to evaluate
expressions when lang_first_phase_enum.
--
Alan Modra
IBM OzLabs - Linux Technology Centre