diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs
index a61d446a3a93b..f04b167889f19 100644
--- a/compiler/rustc_passes/src/check_attr.rs
+++ b/compiler/rustc_passes/src/check_attr.rs
@@ -625,6 +625,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
             sym::naked,
             sym::instruction_set,
             sym::repr,
+            sym::rustc_std_internal_symbol,
             // code generation
             sym::cold,
             // documentation
diff --git a/tests/ui/asm/naked-functions.rs b/tests/ui/asm/naked-functions.rs
index 1eeb716e98a1f..cb5fde9a80b81 100644
--- a/tests/ui/asm/naked-functions.rs
+++ b/tests/ui/asm/naked-functions.rs
@@ -2,7 +2,7 @@
 //@ ignore-nvptx64
 //@ ignore-spirv
 
-#![feature(asm_unwind, linkage)]
+#![feature(asm_unwind, linkage, rustc_attrs)]
 #![crate_type = "lib"]
 
 use std::arch::{asm, naked_asm};
@@ -225,3 +225,9 @@ pub extern "C" fn compatible_doc_attributes() {
 pub extern "C" fn compatible_linkage() {
     naked_asm!("", options(raw));
 }
+
+#[rustc_std_internal_symbol]
+#[unsafe(naked)]
+pub extern "C" fn rustc_std_internal_symbol() {
+    naked_asm!("", options(raw));
+}