[LLVMdev] A weird, reproducable problem with MCJIT

Christian Schafmeister
Tue, 15 Oct 2013 03:28:53 -0000

With the help of iain at codesourcery.com and andrew.kaylor at intel.com we
tracked the problem down to a bad relocation that was clobbering the
first bytes of the eh_frame.   I think this problem/solution may be OS X
specific.

On akaylor's suggestion I made the change below and my reproducable test
case now compiles fine with MCJIT.

As well, my Common Lisp code base now compiles using MCJIT - that's about
1,000
functions at one MCJIT module per function.



In llvm/lib/ExecutionEngine/RuntimeDyld

Index: RuntimeDyldImpl.h
==================================================================---
RuntimeDyldImpl.h	(revision 192535)
+++ RuntimeDyldImpl.h	(working copy)
@@ -195,7 +195,7 @@
     else if (Arch == Triple::ppc64 || Arch == Triple::ppc64le)
       return 44;
     else if (Arch == Triple::x86_64)
-      return 6; // 2-byte jmp instruction + 32-bit relative address
+	return 8; /* was 6 but akaylor said change to 8 - meister Oct 2013 */ //
2-byte jmp instruction + 32-bit relative address
     else if (Arch == Triple::systemz)
       return 16;
     else