From 91425f2c85764af92fd2cbae23b22f5d264d150d Mon Sep 17 00:00:00 2001 From: Folkert Date: Thu, 8 Aug 2024 10:20:40 +0200 Subject: [PATCH] codegen `#[naked]` functions using `global_asm!` --- src/asm.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/asm.rs b/src/asm.rs index a1f9eab10e76..415f8affab90 100644 --- a/src/asm.rs +++ b/src/asm.rs @@ -867,6 +867,13 @@ impl<'gcc, 'tcx> AsmCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> { template_str.push_str("\n.popsection"); self.context.add_top_level_asm(None, &template_str); } + + fn mangled_name(&self, instance: Instance<'tcx>) -> String { + // TODO(@Amanieu): Additional mangling is needed on + // some targets to add a leading underscore (Mach-O) + // or byte count suffixes (x86 Windows). + self.tcx.symbol_name(instance).name.to_string() + } } fn modifier_to_gcc(