[LLVMdev] Generate ELF in x86 with RELA relocations

Yiannis Tsiouris gtsiour at softlab.ntua.gr
Tue Feb 4 13:51:19 PST 2014


Hi guys,

I 'd like to generate an ELF object file in x86 that uses RELA instead
of REL for relocations. The reason I want that is because I have a
custom loader that only works with Elf32_Rela. Is there any flag in LLVM
to force that relocation scheme?

Is this demand reasonable? The only thing that I managed to dig out of
Google was [1] that states, among other things:

> "REL relocations thus take 2 words of storage, and RELA relocations,
> 3. On x86, the ELF ABI *only* uses REL relocations, and words are 32
> bits, making each relocation take 8 bytes ; on x86-64, the ELF ABI
> only uses RELA relocations, and words are 64 bits, thus making each
> relocation take 24 bytes, 3 times that of x86 relocations. On ARM,
> both may be used, but apparently the compiler and the linker only use
> REL relocations."

However, I am not convinced that I should start hacking on the loader,
yet! :-)


Cheers,
Yiannis

[1]: http://glandium.org/blog/?m=201011
-- 
Yiannis Tsiouris
Ph.D. student,
Software Engineering Laboratory,
National Technical University of Athens
WWW: http://www.softlab.ntua.gr/~gtsiour

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 259 bytes
Desc: OpenPGP digital signature
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140204/02aec7a0/attachment.sig>


More information about the llvm-dev mailing list