config/mips/trampolines.c on SGI

Godmar Back gback at
Fri Oct 29 08:06:22 PDT 1999

Essentially, you need to ensure that
the jalr $25 below calls (jumps with lr) soft_fixup_trampoline, which
is a symbol in the text segment.

Upon entry $25 points to mips_do_fixup_trampoline.  lw $25, -4($25)
loads the address of soft_fixup_trampoline in $25 to which jalr $25
then jumps. This is so because it is stored in the text segment right
before mips_do_fixup_trampoline.

Now if your assembler doesn't like words in the text segment,
it seems like doing something like:

     lui $25,soft_fixup_trampoline(high)
     ori $25,$25,soft_fixup_trampoline(low)
     jalr $25
     lui $25,high(soft_fixup_trampoline)
     ori $25,$25,low(soft_fixup_trampoline)
     jalr $25

(? I don't know MIPS assembler syntax) should work too.
See mips/jit.h.

Btw, it seems as though the first "sw $31, 0($sp) is superfluous.

	- Godmar

> In the process of re-adapting kaffe for SGI Irix 6.x I've run into a
> problem with the trampoline definition.  It seems that the lines:
> 	sw	$31, 0($sp)					\n
> l1:	.word	" C_FUNC_NAME(soft_fixup_trampoline) "		\n
> 	.globl 	mips_do_fixup_trampoline			\n
> 	.ent	mips_do_fixup_trampoline			\n
> mips_do_fixup_trampoline:					\n
> cause a problem with the SGI assembler in which it refuses to compile
> with the following error:
> /bin/sh ../../../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../../../config -I../../../include -I../../../kaffe/kaffevm/systems/unix-jthreads -I.. -I./.. -DTRANSLATOR -DJIT3  -DKVER='"1.0.5"' -I/home/canada2/leei/src/gcc/kaffe-cvs/./kaffe/kaffevm -I/home/canada2/leei/src/gcc/kaffe-cvs/./kaffe/kaffevm/systems/unix-jthreads -I../../../config -I../../../include  -I/usr/local/include  -g -O2 -Wall -Wstrict-prototypes -c -o machine.lo machine.c
> gcc -DHAVE_CONFIG_H -I. -I. -I../../../config -I../../../include -I../../../kaffe/kaffevm/systems/unix-jthreads -I.. -I./.. -DTRANSLATOR -DJIT3 -DKVER=\"1.0.5\" -I/home/canada2/leei/src/gcc/kaffe-cvs/./kaffe/kaffevm -I/home/canada2/leei/src/gcc/kaffe-cvs/./kaffe/kaffevm/systems/unix-jthreads -I../../../config -I../../../include -I/usr/local/include -g -O2 -Wall -Wstrict-prototypes -c machine.c  -DPIC -Wp,-MD,.deps/machine.TPlo -o machine.lo
> as: Error: /var/tmp/cc0Bxeo8.s, line 12706: Cannot use data-generating directives in the .text section.: .word
> as: Error: /var/tmp/cc0Bxeo8.s, line 12706: Cannot use data-generating directives in the .text section.: .word
> make[3]: *** [machine.lo] Error 1
> Is there some documentation as to what this functions is *expected* to
> do or some other means by which it can be achieved?  Given context,
> I'm sure I can fix it, I just don't have time to track down that
> context from the sources.
> -------------------------------------------------------------------------------
> Lee Iverson     		SRI International
> leei at			333 Ravenswood Ave., Menlo Park CA 94025
>	(650) 859-3307

More information about the kaffe mailing list