This is the mail archive of the binutils@sourceware.org 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]
Other format: [Raw text]

Re: Confusion about value stored in linker script


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

Attachment: signature.asc
Description: This is a digitally signed message part.


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