Rollup merge of #143920 - oli-obk:cg-llvm-safety, r=jieyouxu

Make more of codegen_llvm safe

Best reviewed commit-by-commit.
This commit is contained in:
Samuel Tardieu
2025-07-16 17:06:40 +02:00
committed by GitHub
15 changed files with 209 additions and 241 deletions

View File

@@ -74,7 +74,7 @@ pub(crate) fn get_or_insert_gdb_debug_scripts_section_global<'ll>(
llvm::set_section(section_var, c".debug_gdb_scripts");
llvm::set_initializer(section_var, cx.const_bytes(section_contents));
llvm::LLVMSetGlobalConstant(section_var, llvm::True);
llvm::LLVMSetUnnamedAddress(section_var, llvm::UnnamedAddr::Global);
llvm::set_unnamed_address(section_var, llvm::UnnamedAddr::Global);
llvm::set_linkage(section_var, llvm::Linkage::LinkOnceODRLinkage);
// This should make sure that the whole section is not larger than
// the string it contains. Otherwise we get a warning from GDB.