about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2025-04-30 12:59:50 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2025-04-30 12:59:50 +0000
commit3e174d4e692ad7337091eb6d3a3f84d39dc88bbb (patch)
tree7f3cd8a4b8a22bb3568d59485ebe51d3ab0fc494
parent3066da813b66ffe46bbe5ea62c56bd079b158cf8 (diff)
downloadrust-3e174d4e692ad7337091eb6d3a3f84d39dc88bbb.tar.gz
rust-3e174d4e692ad7337091eb6d3a3f84d39dc88bbb.zip
Fix naked asm symbol name for cg_clif on macOS
-rw-r--r--compiler/rustc_codegen_cranelift/src/global_asm.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/global_asm.rs b/compiler/rustc_codegen_cranelift/src/global_asm.rs
index eef5288027c..203b443269f 100644
--- a/compiler/rustc_codegen_cranelift/src/global_asm.rs
+++ b/compiler/rustc_codegen_cranelift/src/global_asm.rs
@@ -34,7 +34,8 @@ impl<'tcx> AsmCodegenMethods<'tcx> for GlobalAsmContext<'_, 'tcx> {
     }
 
     fn mangled_name(&self, instance: Instance<'tcx>) -> String {
-        self.tcx.symbol_name(instance).name.to_owned()
+        let symbol_name = self.tcx.symbol_name(instance).name.to_owned();
+        if self.tcx.sess.target.is_like_darwin { format!("_{symbol_name}") } else { symbol_name }
     }
 }