Skip to content

Commit 3e174d4

Browse files
committed
Fix naked asm symbol name for cg_clif on macOS
1 parent 3066da8 commit 3e174d4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/rustc_codegen_cranelift/src/global_asm.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ impl<'tcx> AsmCodegenMethods<'tcx> for GlobalAsmContext<'_, 'tcx> {
3434
}
3535

3636
fn mangled_name(&self, instance: Instance<'tcx>) -> String {
37-
self.tcx.symbol_name(instance).name.to_owned()
37+
let symbol_name = self.tcx.symbol_name(instance).name.to_owned();
38+
if self.tcx.sess.target.is_like_darwin { format!("_{symbol_name}") } else { symbol_name }
3839
}
3940
}
4041

0 commit comments

Comments
 (0)