Skip to content

Commit 268f5c5

Browse files
committed
Ensure strings created with const_str get the unnamed_addr attribute
1 parent 1db4b12 commit 268f5c5

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

compiler/rustc_codegen_llvm/src/common.rs

+1
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ impl<'ll, 'tcx> ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
203203
unsafe {
204204
llvm::LLVMSetInitializer(g, sc);
205205
llvm::LLVMSetGlobalConstant(g, True);
206+
llvm::LLVMSetUnnamedAddress(g, llvm::UnnamedAddr::Global);
206207
llvm::LLVMRustSetLinkage(g, llvm::Linkage::InternalLinkage);
207208
}
208209
(s.to_owned(), g)

0 commit comments

Comments
 (0)