[PATCH] D113615: [ELF] Make --no-relax disable R_X86_64_{,REX_}GOTPCRELX GOT optimization

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 10 14:21:27 PST 2021


MaskRay created this revision.
MaskRay added reviewers: alexander-shaposhnikov, grimar, peter.smith.
Herald added subscribers: luke957, dang, luismarques, pengfei, s.egerton, PkmX, simoncook, kristof.beyls, arichardson, emaste.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This brings back the original version of D81359 <https://reviews.llvm.org/D81359>.
I can find several use cases now.

- Unlike GNU ld, LLD's relocation processing is one pass. If we decide to optimize(relax) R_X86_64_{,REX_}GOTPCRELX, we will suppress GOT generation and cannot undo the decision later. Optimizing R_X86_64_REX_GOTPCRELX can usually make it easy to hit `relocation R_X86_64_REX_GOTPCRELX` relocation out of range. Without --no-relax, the user has to recompile with `-Wa,-mrelax-relocations=no`.
- The option would help during my investigationg of the root cause of https://git.kernel.org/linus/09e43968db40c33a73e9ddbfd937f46d5c334924
- There is need for relaxation for AArch64 & RISC-V. Implementing this for x86-64 improves consistency with little target-specific cost (two-line X86_64.cpp change).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113615

Files:
  lld/ELF/Arch/X86_64.cpp
  lld/ELF/Config.h
  lld/ELF/Driver.cpp
  lld/ELF/Options.td
  lld/docs/ld.lld.1
  lld/test/ELF/x86-64-gotpc-relax.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113615.386320.patch
Type: text/x-patch
Size: 3969 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211110/7fa203e4/attachment.bin>


More information about the llvm-commits mailing list