From 268f5c57b9da5111cf10c4807bc7b367914d8f7b Mon Sep 17 00:00:00 2001 From: Thom Chiovoloni Date: Wed, 15 Nov 2023 07:56:40 +0000 Subject: [PATCH] Ensure strings created with `const_str` get the `unnamed_addr` attribute --- compiler/rustc_codegen_llvm/src/common.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/rustc_codegen_llvm/src/common.rs b/compiler/rustc_codegen_llvm/src/common.rs index 0b0816c27b6..d1b643f4967 100644 --- a/compiler/rustc_codegen_llvm/src/common.rs +++ b/compiler/rustc_codegen_llvm/src/common.rs @@ -203,6 +203,7 @@ impl<'ll, 'tcx> ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> { unsafe { llvm::LLVMSetInitializer(g, sc); llvm::LLVMSetGlobalConstant(g, True); + llvm::LLVMSetUnnamedAddress(g, llvm::UnnamedAddr::Global); llvm::LLVMRustSetLinkage(g, llvm::Linkage::InternalLinkage); } (s.to_owned(), g)