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]

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


A word regarding
<URL:http://sources.redhat.com/ml/binutils/2003-09/msg00408.html>.

I've tried the approach to undefine symbols after each walk
through the script, which would mean that you can't refer to
symbols before their point of definition in the script.  I
though that'd be the simplest approach, syntax-wise and whatever
but felt just a little uneasiness about possibly breaking
existing scripts.  Indeed, libgloss/i960/mon960.ld contains this
construct:

	___CTOR_LIST__ = .;
	LONG((___CTOR_END__ - ___CTOR_LIST__) / 4 - 2)
	*(.ctors)
	LONG(0)
	___CTOR_END__ = .;

which I can't find an obviously better way to express.  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?

brgds, H-P


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