[PATCH] D33372: Infer relocation model from module flags in relocatable LTO link

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 22 11:20:22 PDT 2017


pcc added a comment.

In https://reviews.llvm.org/D33372#760139, @joerg wrote:

> In https://reviews.llvm.org/D33372#760060, @pcc wrote:
>
> > > Non-LTO pipeline allows the user to put PIC code in a non-PIE executable, or non-PIC code in a shared library if they wish so. Maybe we should completely ignore the output type here and strictly go by module flags, to be consistent.
> >
> > Disabling PIC can sometimes act as an optimization.
>
>
> Disabling PIC was a performance hack on 32bit x86 due to the extreme register starvation of the architecture.
>  It is also generally agreed that it is fundamentally broken from a design perspective. I don't see good reasons for supporting that, frankly.


Disabling PIC on its own doesn't seem that problematic to me. The problematic part is the assumption in the backend that symbols are DSO-local, which leads to hacks such as copy relocations. But with LTO the linker knows whether each symbol is DSO-local, and it could in principle pass that information to the backend, which could then generate appropriate code for accessing each symbol. This is blocked on something like https://reviews.llvm.org/D20217 though.


Repository:
  rL LLVM

https://reviews.llvm.org/D33372





More information about the llvm-commits mailing list