This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: ld, access to symbols
- To: hanland@mcd.alcatel.be
- Subject: Re: ld, access to symbols
- From: Ian Lance Taylor <ian@zembu.com>
- Date: 9 Jul 1999 11:49:58 -0400
- CC: binutils@sourceware.cygnus.com
- References: <3785C788.D0216370@mcd.alcatel.be>
Date: Fri, 09 Jul 1999 10:57:28 +0100
From: Dominic Hanlan <hanland@mcd.alcatel.be>
my question is this, is it possible form within a link script to access
abd manipulate variables from
an object that is being linked.
i.e.
test.c contains int x.
can I access x in the link script and assign its value to a link script
global variable.
I'd say the answer is yes, but it depends upon exactly what you mean.
The linker script deals with symbol values. That means that the value
`x' in a linker script is (in most cases) equal to the value `&x' in
C. A ``link script global variable'' is a symbol. You can certainly
assign the value of the symbol x to another symbol in a linker script.
The linker script does not give you any access to the value of a
global variable in the sense of the value of x rather than the address
of x.
Ian