diff options
| author | bors <bors@rust-lang.org> | 2024-12-11 21:51:07 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-12-11 21:51:07 +0000 |
| commit | 1daec069fbf562f5ec22c2ab1c6aee3573348858 (patch) | |
| tree | 54b44d3331bb2bacfaa747bd89e9651936c7ec42 /compiler/rustc_codegen_gcc | |
| parent | 21fe748be15271ea5804e0507cd699b675efe038 (diff) | |
| parent | 9aabef1c2839ac5cbbe7477c7c597be25d8fd7f9 (diff) | |
| download | rust-1daec069fbf562f5ec22c2ab1c6aee3573348858.tar.gz rust-1daec069fbf562f5ec22c2ab1c6aee3573348858.zip | |
Auto merge of #128004 - folkertdev:naked-fn-asm, r=Amanieu
codegen `#[naked]` functions using global asm tracking issue: https://github.com/rust-lang/rust/issues/90957 Fixes #124375 This implements the approach suggested in the tracking issue: use the existing global assembly infrastructure to emit the body of `#[naked]` functions. The main advantage is that we now have full control over what gets generated, and are no longer dependent on LLVM not sneakily messing with our output (inlining, adding extra instructions, etc). I discussed this approach with `@Amanieu` and while I think the general direction is correct, there is probably a bunch of stuff that needs to change or move around here. I'll leave some inline comments on things that I'm not sure about. Combined with https://github.com/rust-lang/rust/pull/127853, if both accepted, I think that resolves all steps from the tracking issue. r? `@Amanieu`
Diffstat (limited to 'compiler/rustc_codegen_gcc')
| -rw-r--r-- | compiler/rustc_codegen_gcc/src/asm.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_gcc/src/asm.rs b/compiler/rustc_codegen_gcc/src/asm.rs index a1f9eab10e7..415f8affab9 100644 --- a/compiler/rustc_codegen_gcc/src/asm.rs +++ b/compiler/rustc_codegen_gcc/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( |
