This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

useless trampoline address alignment


Testing trampolines, I have found some strange code generated to get the
address of the nested function.  The code aligns an address that should
be generated correctly aligned.  This is on m68k-motorola-sysv, but I surmise
it is target-independent. (this is with egcs-971127, but I am waiting
for the .cexp/14 chars filename problem fix before downloading a newer version)

Philippe De Muyter

Here is the testcase :

f()
	{
	int	h(){}
	char	g[4096];
	int	i(){}

	a(h);
	a(i);
	}

and the assembler code (m68k); look at <<<<<<<<<'s :

	file	"trampo.c"
gcc2_compiled%:
text
	even
h_%2:
	link.w %fp,&-4
	mov.l %a0,-4(%fp)
	unlk %fp
	rts
	even
i_%5:
	link.w %fp,&-4
	mov.l %a0,-4(%fp)
	unlk %fp
	rts
	even
global f
f:
	link.w %fp,&-4124
	mov.l %a3,-(%sp)
	mov.l %a2,-(%sp)
	lea -4123(%fp),%a3	<<<<<<<<< ???
	lea -4122(%fp),%a0	<<<<<<<<< That's the trampoline's address
	mov.w &8316,(%a0)
	mov.l %fp,2(%a0)
	mov.w &20217,6(%a0)
	mov.l &i_%5,8(%a0)
	lea -4108(%fp),%a0
	mov.w &8316,(%a0)
	mov.l %fp,2(%a0)
	mov.w &20217,6(%a0)
	mov.l &h_%2,8(%a0)
	pea -4108(%fp)
	lea a,%a2
	jsr (%a2)
	mov.l %a3,%d0		<<<<<<<<<< ???
	addq.l &1,%d0		<<<<<<<<<< ???
	mov.l &-2,%d1		<<<<<<<<<< ???
	and.l %d0,%d1		<<<<<<<<<< ???
	mov.l %d1,-(%sp)	<<<<<<<<<< Should be : pea -4122(%fp)
	jsr (%a2)
	mov.l -4132(%fp),%a2
	mov.l -4128(%fp),%a3
	unlk %fp
	rts


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