about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/mono_item.rs
diff options
context:
space:
mode:
authorMarcel Hlopko <hlopko@google.com>2021-09-10 15:11:56 +0200
committerMarcel Hlopko <hlopko@google.com>2021-10-01 08:06:42 +0200
commit198d90786b9fb429928d70c423bad5d65374a532 (patch)
treedfe7e0753b3e6071471f9a29075fb134b2679f72 /compiler/rustc_codegen_llvm/src/mono_item.rs
parent497ee321af3b8496eaccd7af7b437f18bab81abf (diff)
downloadrust-198d90786b9fb429928d70c423bad5d65374a532.tar.gz
rust-198d90786b9fb429928d70c423bad5d65374a532.zip
Add `pie` as another `relocation-model` value
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/mono_item.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/mono_item.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/mono_item.rs b/compiler/rustc_codegen_llvm/src/mono_item.rs
index 8ba3e870fbb..17bf55bf512 100644
--- a/compiler/rustc_codegen_llvm/src/mono_item.rs
+++ b/compiler/rustc_codegen_llvm/src/mono_item.rs
@@ -144,6 +144,12 @@ impl CodegenCx<'ll, 'tcx> {
             return true;
         }
 
+        // With pie relocation model calls of functions defined in the translation
+        // unit can use copy relocations.
+        if self.tcx.sess.relocation_model() == RelocModel::Pie && !is_declaration {
+            return true;
+        }
+
         return false;
     }
 }