[PATCH] D84360: [LLD][PowerPC] Implement GOT to PC-Rel relaxation

Nemanja Ivanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 6 07:12:04 PDT 2020


nemanjai added inline comments.


================
Comment at: lld/ELF/Options.td:407
 
+defm pcrel_got_optimize : B<"pcrel-got-optimize",
+    "(PowerPC64) Enable PCRel GOT related optimizations (default)",
----------------
MaskRay wrote:
> Is this an option binutils will support as well?
> 
> Note that on x86, --no-relax can control whether R_X86_64_GOTPCRELX is optimized.
> I hope PowerPC can adopt the same option.
> 
> There is a related thread https://sourceware.org/pipermail/binutils/2020-June/111571.html before I knew the PCREL GOT optimization activities on PowerPC.
I have asked Alan about support for this option in the GNU linkers. I'll get back to you when he responds.

I personally am not in favour of reducing the granularity by having all of this controlled by `--no-relax` because if we encounter bugs (or mismatches between compiler version and linker version) it is good to be able to turn off only the minimum set of optimizations.
A real example:
In Power9, we got new D-Form instructions which then ended up with relocations on them. The version of the linker in binutils on the various distros did not have support for those. Upgrading binutils was not an option for many customers, so they had to add `--no-toc-optimize` to their builds. If there was only `--no-relax` and that implied a bunch of other optimizations are turned off, such customers would be unnecessarily penalized in terms of performance.

Of course, the integration between LLD and Clang/LLVM is much more close so this particular issue is less likely to occur, but I think the argument for having finer granularity is still valid.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84360



More information about the llvm-commits mailing list