This is the mail archive of the crossgcc@sourceware.cygnus.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


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

Re: elf rodata / data sections


Daniel Kahlin writes:
 > Mark Pulver wrote:
 > > bounce3.elf:     file format elf32-littlearm
 > > 
 > > Sections:
 > > Idx Name          Size      VMA       LMA       File off  Algn
 > >   0 .text         000049e8  00008000  00008000  00008000  2**2
 > >                   CONTENTS, ALLOC, LOAD, READONLY, CODE
 > >   1 .rodata       00000100  0000c9e8  0000c9e8  0000c9e8  2**2
 > >                   CONTENTS, ALLOC, LOAD, READONLY, DATA
 > >   2 .data         00000470  0000cbe8  0000cbe8  0000cbe8  2**2
 > >                   CONTENTS, ALLOC, LOAD, DATA
 > >   3 .bss          0013cc0c  00010000  00010000  00010000  2**15
 > >                   ALLOC
 > > 
 > > So the above assembler should copy the .rodata section on top
 > > of the .data section until it rearches the .bss section. (Actually
 > > to the end of the .data section, __bss_start__ was assigned 0xd058,
 > > .data + 470)
 > > 
 > > The .rodata is only 0x100 in size, and the .data
 > > is 0x470, so it not big enough to initialize the whole .data area.
 > > As a result, all the .data section is not inialize correctly.
 > > 
 > > What happening here?
 > 
 > I think you have confused things a bit.
That I know :-)
 > 
 > What are the sections:
 > '.text' is code (not modifiable) (this could stay in ROM)
 > '.rodata' is data that is not modified. (this could stay in ROM)
 > '.data' is data that could be modified. (this must be placed in RAM)
 > '.bss' should be zero initialized (and placed in RAM)
 > 
 > First of all, your example is linked for running from RAM.
Yes, I was trying to a version to work under the debugger before I
build a standalone one for ROM.
 > Ok, now if the above is loaded to the LMA's indicated, the routine above
 > should be made to zero only the '.bss' section. (everything should run fine
 > from RAM)
 > 
 > If you want the above to be located in ROM, you will have to write a linker
 > script to make the VMA's of '.data' '.bss' go into RAM, and everything else
 > into ROM.  The above code should then be made to copy '.data' from it's LMA
 > to it's VMA, and zero the '.bss' at it's VMA. 
I would expect I will need to move the .text to RAM for faster
execution as well?
 > 
 > try: 'info ld' for information on linker scripts
info sucks :-)
 > 
 > i.e:
 > The binary will be linked to _run_ with the sections placed as indicated by
 > the VMA's, but _load_ as indicated by the LMA's.
 > 
 > Ok, this got a bit confusing.  Hope it helps!
Thanks, it has.
	Mark
 > 
 > /Daniel Kahlin
 > 
 > -- 
 > Daniel Kahlin <daniel.kahlin@netinsight.se>
 > Hardware System Designer
 > Net Insight AB
 > URL: http://www.netinsight.se/
 > 

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


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