about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFolkert de Vries <folkert@folkertdev.nl>2025-05-07 20:02:29 +0200
committerFolkert de Vries <folkert@folkertdev.nl>2025-06-12 20:27:10 +0200
commit65042d6da3f7261b49d1e9be7eb8e0e1d3bdead1 (patch)
treef7b2cb7332c7837848c9b93c993fc4c15d7ac456
parent98e21c8dfb6884780af42d68a19439346419cb64 (diff)
downloadrust-65042d6da3f7261b49d1e9be7eb8e0e1d3bdead1.tar.gz
rust-65042d6da3f7261b49d1e9be7eb8e0e1d3bdead1.zip
add `extern "custom"` functions
-rw-r--r--src/abi.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/abi.rs b/src/abi.rs
index 3d0c258f576..08f3d281904 100644
--- a/src/abi.rs
+++ b/src/abi.rs
@@ -239,12 +239,16 @@ impl<'gcc, 'tcx> FnAbiGccExt<'gcc, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
 pub fn conv_to_fn_attribute<'gcc>(conv: CanonAbi, arch: &str) -> Option<FnAttribute<'gcc>> {
     let attribute = match conv {
         CanonAbi::C | CanonAbi::Rust => return None,
+        CanonAbi::RustCold => FnAttribute::Cold,
+        // Functions with this calling convention can only be called from assembly, but it is
+        // possible to declare an `extern "custom"` block, so the backend still needs a calling
+        // convention for declaring foreign functions.
+        CanonAbi::Custom => return None,
         CanonAbi::Arm(arm_call) => match arm_call {
             ArmCall::CCmseNonSecureCall => FnAttribute::ArmCmseNonsecureCall,
             ArmCall::CCmseNonSecureEntry => FnAttribute::ArmCmseNonsecureEntry,
             ArmCall::Aapcs => FnAttribute::ArmPcs("aapcs"),
         },
-        CanonAbi::RustCold => FnAttribute::Cold,
         CanonAbi::GpuKernel => {
             if arch == "amdgpu" {
                 FnAttribute::GcnAmdGpuHsaKernel