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

Re: putting a variable in an own section


Hi,

> > > http://sourceware.org/binutils/docs-2.12/ld.info/Output-Section-LMA.htm
> > >l#Ou tput%20Section%20LMA
> >
> > thanks for that hint.  That's exactly what i was
> > searching for, but i have some problems with it.
> >
> > What's bothering me here is that there is no
> > additional section generated, but isn't that
> > necessary to mark a memory region as "used"
> > or "reserved for something"?
>
> On most systems it is not.  Since you are generating S-records, what
> you would expect to see in the reserved memory region?  The S-records
> will give you something to burn into PROM.  You don't need anything to
> put into RAM.  Just initialize it at runtime.

Oops, i think i didn't write that too clear.  I don't want to
have that region in the S-Rec, this is clear to me.
I just don't want ld to also put the .bss at the same address
as the .data section.  That's why i thought it was necessary to
generate a section ".data".
Is this unnecessary?
If i just put all the values in section .rodata, how does
ld know to reserve some space and NOT use it for .bss?

>
> > I'm testing this on v850-unknown-elf and i have
> > for V850/SF1:
> >
> > 	.text : { *(.text) _etext = . ; } >rom
> > 	.rodata : { *(.rodata) } >rom
> > 	.data : AT(ADDR(.rodata)) { *(.data) } >ram
> >
> >
> > But this leads to an error in the line with ".data":
> > v850-unknown-elf-ld: ADDR forward reference of section .rodata
> > What's wrong here?
>
> Not sure, really.  It might be a bug.  On the other hand, the script
> doesn't really make sense, because you're trying to load both .rodata
> and .data at the same LMA.

That's true, but .rodata should be just empty, so i assumed i should be
able to use the address.

> > Now i've tried the following, basically i put everything that
> > goes in .data into .rodata and set the size of .data
> > to the size of .rodata:
> >
> > 	.text : { *(.text) _etext = . ; } >rom
> > 	.rodata : { *(.data) } >rom
> > 	.data : { . += SIZEOF(.rodata); } >ram
>
> I don't see any need to create the .data section at all.

If i omit that section, .bss is placed there.  I've generated this
section, so ld knows it can't use it for .bss .  In my ld script,
.bss is following .data, at the moment.


Best regards,
Torsten.


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