[PATCH] D48095: [ELF][X86_64] Use R_GOTREL_FROM_END instead of R_GOTREL for R_X86_64_GOTOFF64

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 13 12:08:41 PDT 2018


MaskRay added a comment.

> clang emits a movabsq instruction which compiles to a R_X86_64_RELATIVE relocation after linking, which is not useful to the dynamic loader.

The `movabsq` encodes the link-time address of a symbol, then in runtime the address is added by an offset `R_X86_64_RELATIVE`.

The clang way: one `movabsq` plus a `R_X86_64_RELATIVE` relocation that is supposed to be resolved by the dynamic loader.
The GCC way: two instructions but no relocation to be resolved.

The clang way is still position-independent.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D48095





More information about the llvm-commits mailing list