[LLVMdev] Assertions in RuntimeDyldELF in ExecutionEngine/MCJIT tests
azanella at linux.vnet.ibm.com
Tue Jan 29 04:47:57 PST 2013
I'm not quite familiar with x86_64 ABI but I faced a similar issue while coding the PPC64
MCJIT support: some functions calls could not be referenced in 24-bits branch offset.
I believe you'll need to handle it at 'RuntimeDyldELF::processRelocationRef' (look on how
ARM, MIPS or PPC64 do) and possible create a stub function.
On 01/29/2013 09:36 AM, Alexey Samsonov wrote:
> I'm trying to run LLVM test suite under AddressSanitizer and get test failures in:
> LLVM :: ExecutionEngine/MCJIT/simpletest-remote.ll
> LLVM :: ExecutionEngine/MCJIT/test-data-align-remote.ll
> LLVM :: ExecutionEngine/MCJIT/test-fp-no-external-funcs-remote.ll
> LLVM :: ExecutionEngine/MCJIT/test-global-init-nonzero-remote.ll
> All of them fail with assertion:
> lli: /usr/local/google/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp:230: void llvm::RuntimeDyldELF::resolveX86_64Relocation(const llvm::SectionEntry &, uint64_t, uint64_t, uint32_t, int64_t): Assertion `RealOffset <= (2147483647) && RealOffset >= (-2147483647-1)' failed.
> The reason is that AddressSanitizer replaces system malloc with its own allocator, which
> allocates memory at "unusual" parts of heap and the difference between pointers can be significant
> (and doesn't fit in 32 bytes).
> I add debug output to calculation of RealOffset in resolveX86_64Relocation:
> uint64_t FinalAddress = Section.LoadAddress + Offset;
> int64_t RealOffset = *Placeholder + Value + Addend - FinalAddress;
> fprintf(stderr, "%x + %lx + %lx - %lx = %lx\n",
> *Placeholder, Value, Addend, FinalAddress, RealOffset);
> assert(RealOffset <= INT32_MAX && RealOffset >= INT32_MIN);
> This is what I get for system malloc:
> 0 + 7fec9867a000 + 0 - 7fec9867a040 = ffffffffffffffc0
> This is what I get for ASan allocator (which results in assert failure):
> 0 + 600c0000a8a0 + 0 - 6018000090a0 = fffffff400001800
> Alexey Samsonov, MSK
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
More information about the llvm-dev