[LLVMdev] Relocation issue with jump tables in ELF object files on X86_64

Smith, Tim tim at bioware.com
Thu Jun 17 12:38:26 PDT 2010


(llvm 2.6)

We have an application where we are using LLVM to generate ELF object files for X86_64.   At runtime we load these objects files into memory using our own ELF loader.

Everything is working except for the jump tables.

The ELF emitter is generating JMPQ instructions using X86::reloc_absolute_word_sext relocations which we are unable to patch to the jump table in the .rodata segment unless we force that segment to load in the low 2GB of the address range.  Currently we just request pages of memory from the OS and that memory is much deeper in the address space.

Is there proper way to patch the address or instruction (ewww) or have the ELF emitter generate a RIP based instruction.  If a real linker doesn't patch the instruction, does the ELF loader always try to load .rodata segments in the low 2GB of memory regardless of if it is from the main image or from a shared library?

Thanks for any help.

---
Tim Smith
Principal Programmer - Austin MMO
BioWare, Edmonton Studio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100617/325e14c5/attachment.html>


More information about the llvm-dev mailing list