Created attachment 3598 [details] JITTest.cpp addition to provoke the bug The attached unit test generates the following assembly: 0x00007ffff7f45010 <test+0>: sub $0x8,%rsp 0x00007ffff7f45014 <test+4>: mov $0x7,%edi 0x00007ffff7f45019 <test+9>: callq 0x800000427cd8 0x00007ffff7f4501e <test+14>: add $0x8,%rsp 0x00007ffff7f45022 <test+18>: retq where the intended target function is actually at address 0x427cd8. This appears to be happening because the actual 64-bit offset gets truncated to 32 bits when it's stored into the callq instruction. This will only happen on x86-64 systems when JIT code is allocated into memory far away from the pre-compiled code segment. If lazy compilation is enabled, or the function is looked up via dlsym instead of addGlobalMapping, the error doesn't happen.
Created attachment 3599 [details] Fix by removing "!TheJIT->isLazyCompilationDisabled()" This fixes the unittest I added and doesn't break `make check-lit unittests`. If it's going to break something else, could you provide a unittest?
I've applied the fix in r83353.