This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]