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


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

Re: crossgcc: arbitrary sections?


I asked:

> > I have built m68k-coff for an embedded environment and it runs great.
> > But now I need arbitrary named sections to store data which can be
> > changed at run-time but needs to survive across power-downs. Nut
> > gcc says, I can't specify arbitrary named sections with coff.
> > Would this be possible with aout or elf? Or do I need to specify
> > some wired option while compiling?

> It is possible to have arbitrary named sections with ELF.

Sounds good...

> I built my own m68k-elf support out of bits'n'pieces in
> the binutils 2.7 release. There seem to be similar patches
> for binutils 2.8 floating around. Maybe you could search
> the crossgcc archives.

I've read the discussion about elf and fetched the patches.
But there remain some confusion: Do the sections have the same
names with elf as they had with coff? Are label-names called the
same way? I seem to recall that there werde some differences with
leading underscores? Here are some pieces out of my crt0.s. They
work with m68k-unknown-coff. Are there any chances that they will
work with elf?

	.text
	.long	__e_stack+0x4000,startup,	excpt_berr,	excpt_aerr
/* [ ... ] */
	.even
startup:
/* [ set up 68332-CS/Clock/etc/pp-registers ] */
/* Init user stack and frame pointer */
/* clear BSS */
	lea.l	__s_bss,%a0
	move.l	#__e_bss,%d0
1:	cmp.l	%d0,%a0
	beq.s	2f
	clr.b	(%a0)+
	bra.s	1b
/* copy DATA */
2:
	lea.l	__e_text,%a0
	lea.l	__s_data,%a1
	move.l	#__e_data,%d0
1:	cmp.l	%a1,%d0
	beq.s	2f
	move.b	(%a0)+,(%a1)+
	bra.s	1b
/* now call main */
	clr.l	-(%sp)
	clr.l	-(%sp)
	clr.l	-(%sp)
	jsr	main
	lea	12(%sp),%sp
h:	bra.s	h
	.even
.globl __main
__main:		/* oups, why do I need this one? */
	rts