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.html#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"?

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?


Now i've tried the following, basicall 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


In the map file i get:

.text           0x00000340      0x11a
 *(.text)
 .text          0x00000340       0x64 out/main.o
                0x00000340                f
                0x0000035e                main
 .text          0x000003a4       0xb6 out/crt0.o
                0x000003a4                _return_interrupt
                0x000003a4                _gccmain
                0x0000041a                _restore_all_interrupt
                0x000003da                _save_all_interrupt
                0x000003bc                _save_interrupt
                0x0000045a                _etext = .

.rodata         0x0000045c        0x4
 *(.data)
 .data          0x0000045c        0x4 out/main.o
                0x0000045c                abc

.data           0xffffb000        0x4
                0xffffb004                . = (. + SIZEOF (.rodata))
 *fill*         0xffffb000        0x4 00

.bss            0xffffb004        0x4

Do you see disadvantages of this approach?

Can i improve the size-setting of .data?

.data doesn't go into S-Record, .rodata goes into S-Record.  Is this
because *(.data) is now in .rodata and .data is just a "fill"?


Best regards,
Torsten.


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