Confusion about value stored in linker script
Mike Frysinger
vapier@gentoo.org
Thu Nov 1 19:13:00 GMT 2007
On Thursday 01 November 2007, Rick Mann wrote:
> 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!
please read the manual:
http://sourceware.org/binutils/docs-2.18/ld/Source-Code-Reference.html#Source-Code-Reference
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 827 bytes
Desc: This is a digitally signed message part.
URL: <https://sourceware.org/pipermail/binutils/attachments/20071101/697797b7/attachment.sig>
More information about the Binutils
mailing list