Linker relaxation and "SYM = DEFINED (SYM) ? SYM : other"

Ian Lance Taylor ian@wasabisystems.com
Tue Oct 7 04:40:00 GMT 2003


Hans-Peter Nilsson <hp@bitrange.com> writes:

> I guess
> I'll try another approach; keeping track of the definedness of a
> symbol from within the linker script separately from the usual
> linker symbol hash table.  That way, you'd get the IMHO natural
> zero/false from "DEFINED (SYM)" on every linker script walk
> before the point of definition in the linker script (assuming
> there is one), but you can still take its value safely before
> the actual definition: the last two linker script walks yield
> the same value for relaxing links.  Signs of agony and disgust
> and/or suggestions of a better approach?

The linker already has the concept of lang_phase_type.  We could
record lang_phase_type (or something like it) for each symbol
explicitly mentioned in the linker script or on the command line.
Then DEFINED(sym) would check the phase of sym, and the phase of the
current link, to see whether it was defined.

The effect would probably be more or less like what you propose,
though.  I don't know that it is any cleaner.

Ian



More information about the Binutils mailing list