From bfabf71781ab40ed81a42cb26c6e983ecbe25604 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Wed, 30 Apr 2025 12:59:50 +0000 Subject: [PATCH] Fix naked asm symbol name for cg_clif on macOS --- src/global_asm.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/global_asm.rs b/src/global_asm.rs index eef5288027c3..203b443269fa 100644 --- a/src/global_asm.rs +++ b/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 } } }