[PATCH] D65242: [ELF] More dynamic relocation packing

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 29 21:23:37 PDT 2019


MaskRay added a subscriber: grimar.
MaskRay added a comment.

> You may have duplication between .rela.plt and .rela.dyn if a function is both called and address taken. But if there are many PLT entries then you should expect to see an improvement just from compressing the relocations themselves since right now they're being stored uncompressed.

GOTPLT (JUMP_SLOT) and GOT (GLOB_DAT) slots can be combined to a single GOT slot. @grimar has a draft D37333 <https://reviews.llvm.org/D37333>

> We could just emit the relocations that would otherwise go to .rela.plt into .rela.dyn in the case where -z now is passed. Then they'll get compressed automatically. But that's largely orthogonal to what you're doing here so it can be done as a separate patch.

Combined GOTPLT and GOT is not very useful on x86 if you always use `-z relro -z now` (`-z relro` is the default in lld) and don't use a non-standard PLT. In that case, PLT is just useless (unless you use some ). GOTPLT should just be eliminated by turning on -fno-plt. The call/jmp instruction will be one byte longer, though.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65242/new/

https://reviews.llvm.org/D65242





More information about the llvm-commits mailing list