This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Confusion about value stored in linker script
- From: Rick Mann <rmann at latencyzero dot com>
- To: binutils <binutils at sourceware dot org>
- Date: Thu, 1 Nov 2007 12:02:15 -0700
- Subject: Confusion about value stored in linker script
I do a lot of this kind of thing:
. = 0x80008000
.text :
{
obj/start.o(.text);
src/Interrupts.o(.text);
. = ALIGN(4);
gVectorsStart = .;
KEEP (obj/vectors.o(.text));
gVectorsEnd = .;
. = ALIGN(4);
*(.text);
}
I expect gVectorsStart and gVectorsEnd to contain the value of the
address at each point. In C, I refer to them like this:
typedef unsigned long UInt32;
extern UInt32* gVectorsStart;
extern UInt32* gVectorsEnd;
However, when I look at the values in those variables from the C code,
it seems like the value contained is the value at that point in the
link. In other words, the first few bytes of vectors.o are 0xe59ff018,
and that's what I see as the value of the gVectorsStart. I *expected*
to see that for *gVectorsStart (the pointed-to data). According to the
map file:
0x8000807c gVectorsStart = .
obj/vectors.o(.text)
.text 0x8000807c 0x3c obj/vectors.o
0x800080b8 gVectorsEnd = .
Summarizing, the C code thinks:
Vectors start address: 0xE59FF018
Vectors start &addres: 0x8000807C
Vectors first word: 0x8000807C
help! Thanks!
--
Rick