[LLVMdev] failed assertion in PPCJITInfo.cpp when calling native function

Andreas Eriksson aeriksson at gmail.com
Tue Sep 19 13:17:59 PDT 2006


Hi,

This is a follow up to my previous email since I have now found out a bit
more about what goes wrong.

I am generating JIT code that calls a native function, but I get the following
assertion telling me that the PC relative jump is too long:

/llvm/lib/Target/PowerPC/PPCJITInfo.cpp:206: failed assertion
`ResultPtr >= -(1 << 23) && ResultPtr < (1 << 23) && "Relocation out
of range!"'

I have looked into this a bit further, and everythings seems perfectly all
right except for the fact that the 16M block of memory for the JIT code that
is allocated in the JITMemoryManager constructor is simply to far from the
native function.

I can actually get my program to work if I run it in gdb which causes the 16M
block to be allocated at a different address, closer to the native function.
When I run the same program (the very same binary) outside of gdb, the memory
for the JIT code is too far off.

When I run my program outside of gdb, the native function is more than 2^23
words from the JIT code, which is too far for a PC relative jump:

	nativeFunction address 0x63b4d4c
	JIT memory base 0x9008000 (allocated in JITMemoryManager constructor)
	/Users/andreas/build/llvm-1.8/debugBuild/../llvm/lib/Target/PowerPC/PPCJITInfo.cpp:206:
failed assertion `ResultPtr >= -(1 << 23) && ResultPtr < (1 << 23) &&
"Relocation out of range!"'

And when I run the same program from gdb, I get lucky and the native function
is less than 2^23 words from the JIT code:

	nativeFunction address 0x63b4d4c
	JIT memory base 0x8008000 (allocated in JITMemoryManager constructor)
	Hello from nativeFunction

So how is this supposed to work? Is it wrong that the memory block for the JIT
code is allocated too far off or should a non PC relative jump be generated
instead?

Regards,

Andreas



More information about the llvm-dev mailing list