This is the mail archive of the binutils@sourceware.cygnus.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]

Re: ld, access to symbols


   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

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