Skip to content

ARM VFP calling convention detection uses LLVM triple suffix instead of llvm_floatabi, misses Apple ARM #471

@SebTardif

Description

@SebTardif

Bug

In compiler/rustc_target/src/callconv/arm.rs line 96, VFP (hardware floating-point) calling convention detection uses cx.target_spec().llvm_target.ends_with("hf") as a proxy for hard-float ABI. Apple ARM targets (armv7s-apple-ios, armv7k-apple-watchos) set llvm_floatabi: Some(FloatAbi::Hard) via the base spec (line 130-131 of spec/base/apple/mod.rs), but their LLVM triples end with "-ios" or "-watchos", not "hf".

This causes HFA (Homogeneous Floating-point Aggregate) arguments to be passed on the stack instead of in VFP registers on these targets, breaking ABI compatibility with C.

Impact

FFI functions on Apple 32-bit ARM targets may use wrong calling convention for structs like struct { f32, f32, f32, f32 }. These are Tier 3 targets.

Fix

PR #474

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-abiABI and calling conventionsI-wrongWrong result or data corruptionP-mediumMedium impact: affects specific usage patternsbugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions