Skip to content

Commit b38d66c

Browse files
authored
Unrolled build for rust-lang#140552
Rollup merge of rust-lang#140552 - folkertdev:naked-function-rustc_std_internal_symbol, r=bjorn3 allow `#[rustc_std_internal_symbol]` in combination with `#[naked]` The need for this came up in rust-lang/compiler-builtins#897, but in general this seems useful and valid to allow. Based on a quick scan, I don't think changes to the generated assembly are needed. cc ``@bjorn3``
2 parents 3350c1e + 5d30814 commit b38d66c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

compiler/rustc_passes/src/check_attr.rs

+1
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
625625
sym::naked,
626626
sym::instruction_set,
627627
sym::repr,
628+
sym::rustc_std_internal_symbol,
628629
// code generation
629630
sym::cold,
630631
// documentation

tests/ui/asm/naked-functions.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//@ ignore-nvptx64
33
//@ ignore-spirv
44

5-
#![feature(asm_unwind, linkage)]
5+
#![feature(asm_unwind, linkage, rustc_attrs)]
66
#![crate_type = "lib"]
77

88
use std::arch::{asm, naked_asm};
@@ -225,3 +225,9 @@ pub extern "C" fn compatible_doc_attributes() {
225225
pub extern "C" fn compatible_linkage() {
226226
naked_asm!("", options(raw));
227227
}
228+
229+
#[rustc_std_internal_symbol]
230+
#[unsafe(naked)]
231+
pub extern "C" fn rustc_std_internal_symbol() {
232+
naked_asm!("", options(raw));
233+
}

0 commit comments

Comments
 (0)