Ensure strings created with const_str get the unnamed_addr attribute

This commit is contained in:
Thom Chiovoloni 2023-11-15 07:56:40 +00:00
parent 1db4b12494
commit 268f5c57b9

View File

@ -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)