[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
Mon Jul 15 16:26:17 PDT 2019


phosek added a comment.

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

> I'd like to understand the motivation behind this change a little better because the relaxation of the code model from PIC to static is technically an "optimization" that the linker should have license to perform and in fact is already performing in some ways (e.g. emitting addresses into the binary instead of RELATIVE/RELR relocations for statically known addresses).


In the case of our kernel, we need the generated code to be position independent for our KASLR scheme, but we're not doing traditional PIE link. When compiling individual translation units, we use `-fpie`, but when linking we use `--no-pie`. Changing the code model from PIC to static in this case results in an invalid kernel image because the generated code is not relocatable. I think it's a matter of principle that it shouldn't be the linker's responsibility to decide how to combine our code-generation choices with our linking choices. I'm open to suggestions for other ways to solve this issue though as we'd really like to be able to use ThinLTO for our kernel.


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