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]

elf rodata / data sections



I'm working on a arm-elf cross compiler for a Brutus board.
My latest problem trying to get a stand-alone system going (yet to happen)
appears to be in a routine to init memory that does the following:
SAir_InitBSSMemory:
	STMFD	sp!, {v1-v5, lr}
	LDR	v1, SA_TopOfROM		@ Copy predefined variables from here..
	LDR	v2, SA_StartOfBSS	@ ..to here
	LDR	v3, SA_ZeroBSS		@ 'C' BSS starts here
	CMP	v1, v2			@ Make sure there are some..
	BEQ	8f
7:
	CMP	v2, v3			@ Check if done..
	LDRCC	v4, [v1], #4		@ if not, get word and store to RAM
	STRCC	v4, [v2], #4
	BCC	7b

I've managed to the get the linker to set these to:
SA_TopOfROM: .word	_etext
SA_StartOfBSS: .word	.data
SA_ZeroBSS: .word	__bss_start__

_etext resulted to the start of .rodata section:
% arm-elf-objdump --header bounce3.elf 

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've also noticed that some c file that initialize global variables
do not it a .rodata section, while others do.

Mark





------
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]