about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/back/write.rs
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2021-10-01 09:18:16 -0700
committerGitHub <noreply@github.com>2021-10-01 09:18:16 -0700
commit6f1e93058137eb606cbee5ef778d30b379903f7c (patch)
tree1840b8bb51958a08a03e4a76d5ce698ff07d58c6 /compiler/rustc_codegen_llvm/src/back/write.rs
parent37df2753fc52ff80625430aa7e8cdcdc6f16e362 (diff)
parent198d90786b9fb429928d70c423bad5d65374a532 (diff)
downloadrust-6f1e93058137eb606cbee5ef778d30b379903f7c.tar.gz
rust-6f1e93058137eb606cbee5ef778d30b379903f7c.zip
Rollup merge of #88820 - hlopko:add_pie_relocation_model, r=petrochenkov
Add `pie` as another `relocation-model` value

MCP: https://github.com/rust-lang/compiler-team/issues/461
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/back/write.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/back/write.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs
index 92199f611ba..9b0e7526894 100644
--- a/compiler/rustc_codegen_llvm/src/back/write.rs
+++ b/compiler/rustc_codegen_llvm/src/back/write.rs
@@ -129,7 +129,8 @@ fn to_pass_builder_opt_level(cfg: config::OptLevel) -> llvm::PassBuilderOptLevel
 fn to_llvm_relocation_model(relocation_model: RelocModel) -> llvm::RelocModel {
     match relocation_model {
         RelocModel::Static => llvm::RelocModel::Static,
-        RelocModel::Pic => llvm::RelocModel::PIC,
+        // LLVM doesn't have a PIE relocation model, it represents PIE as PIC with an extra attribute.
+        RelocModel::Pic | RelocModel::Pie => llvm::RelocModel::PIC,
         RelocModel::DynamicNoPic => llvm::RelocModel::DynamicNoPic,
         RelocModel::Ropi => llvm::RelocModel::ROPI,
         RelocModel::Rwpi => llvm::RelocModel::RWPI,