[PATCH] D64711: [LTO] Don't override relocation model stored in the module

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 16 19:07:40 PDT 2019


phosek added a comment.

In D64711#1586864 <https://reviews.llvm.org/D64711#1586864>, @pcc wrote:

> I guess I'd be fine with making it so that passing `-relocation-model` explicitly would override lld's decision (see e.g. how we handle function sections/data sections in the gold plugin). Then you can use `-mllvm -relocation-model=pic` for now.


I'd like to better understand the rationale behind the current implementation: eliding relocations feels qualitatively different because that's just an optimization of the linking work, whereas what's being done today in lld is effectively ignoring/overriding the (per-TU) compile-time decision which can lead to surprising results as in our case where we explicitly rely on the distinction between the compilation and linking stages. The LTO code generator should be allowed to relax when instructed to target non-PIC, but that's orthogonal to the linker's role as a linker.

Ultimately what really matters to us is that there's some combination of switches that does what we say, so if there's a strong desire to preserve the current semantics, I'm happy to implement the option to override the relocation model via `-mllvm -relocation-model=pic` as suggested.


Repository:
  rLLD LLVM Linker

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

https://reviews.llvm.org/D64711





More information about the llvm-commits mailing list