]> git.proxmox.com Git - rustc.git/blobdiff - compiler/rustc_codegen_llvm/src/consts.rs
New upstream version 1.54.0+dfsg1
[rustc.git] / compiler / rustc_codegen_llvm / src / consts.rs
index 99046839973d5c64ba968a1ecc06792944d01669..e50d5506e222f5794f7c9ebd194521df8d53e4b7 100644 (file)
@@ -282,6 +282,12 @@ impl CodegenCx<'ll, 'tcx> {
             }
         }
 
+        unsafe {
+            if self.should_assume_dso_local(g, true) {
+                llvm::LLVMRustSetDSOLocal(g, true);
+            }
+        }
+
         self.instances.borrow_mut().insert(instance, g);
         g
     }
@@ -363,6 +369,10 @@ impl StaticMethods for CodegenCx<'ll, 'tcx> {
             set_global_alignment(&self, g, self.align_of(ty));
             llvm::LLVMSetInitializer(g, v);
 
+            if self.should_assume_dso_local(g, true) {
+                llvm::LLVMRustSetDSOLocal(g, true);
+            }
+
             // As an optimization, all shared statics which do not have interior
             // mutability are placed into read-only memory.
             if !is_mutable && self.type_is_freeze(ty) {