[llvm-dev] Relocation Assertion error

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Thu Jan 26 11:45:14 PST 2017

On 26 January 2017 at 08:42, Christoph Höger via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> As far as I can tell, this test invokes a limit on the range of addresses
> for relocated symbols. I am running a 64bit machine and Value is quite large
> just after allocation (0x7ffff...), so I wonder if I did something wrong
> when creating the object file or if there is a bug in the loader.  Could
> someone please shed some light on this assertion?

It sounds like the issue could be the code model. When LLVM's JIT
requests memory for your program it can get virtually any address back
from most OSs (it uses mmap or an equivalent rather than the normal
heap), but normal code is typically compiled to run from only the low
2GB of memory on x86, or to make use of dynamic-loader help so that it
can run elsewhere.

So when compiling your original static object I'd suggest some
combination of "-fPIC" (for the linker support route) and
"-mcmodel=large" (to drop the assumptions entirely). Hopefully LLVM's
JIT can cope with those relocations, though I haven't tried it in a
while myself I'm afraid.


More information about the llvm-dev mailing list