[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
Tue Jun 12 20:01:34 PDT 2018


MaskRay added a comment.

OK moved the test to `x86-64-reloc-gotoff64.s`, and renamed `x86-64-reloc-got.s` to `x86-64-reloc-gotpc64.s`.

> Second of all, I got a different compilation result for the code that you gave to me: https://godbolt.org/g/qA1K9y. Is this expected?

Sorry, the code was produced by gcc, not clang

`gcc -O2 -S -mcmodel=medium -fPIC a.c` emits the expected two instruction which will compute the pc-relative address.
clang emits a `movabsq` instruction which compiles to a `R_X86_64_RELATIVE` relocation which is not useful to the dynamic loader. The dynamic loader needs a runtime-address to compute its image base.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D48095





More information about the llvm-commits mailing list