This is the mail archive of the
mailing list for the binutils project.
Re: Confusion about value stored in linker script
"Dave Korn" <email@example.com> writes:
> On 01 November 2007 19:02, Rick Mann wrote:
> They aren't pointers and they aren't variables. They are just numbers. Try
> this instead: tell the compiler that these are references to a single byte of
> memory by pretending they are 'char' variables:
> extern char gVectorsStart, gVectorsEnd;
> Then take the address of those variables:
> extern UInt32 *pgVectorsStart = &gVectorsStart;
> extern UInt32 *pgVectorsEnd = &gVectorsEnd;
Beware, this may not work for some architectures. Safer bet is:
extern UInt32 gVectorStart, gVectorEnd;
extern UInt32 *pgVectorsStart = gVectorsStart;
extern UInt32 *pgVectorsEnd = gVectorsEnd;
 E.g., for archs where there is "small .data" or "small .bss"
section, compiler will expect simple "char" variables are in the small
section and do wrong thing when you try to take their address. It won't
expect this when you declare these virtual variables as arrays of
unknown size though.