libs/libbuiltin/compiler-rt: skip unsupported Arm VFP builtins asm#19513
Open
uditjainstjis wants to merge 1 commit into
Open
libs/libbuiltin/compiler-rt: skip unsupported Arm VFP builtins asm#19513uditjainstjis wants to merge 1 commit into
uditjainstjis wants to merge 1 commit into
Conversation
The compiler-rt builtins build globs every arm/*.S source, but several of
those hand-written assembly files require FPU features the target may not
have. Upstream compiler-rt selects them conditionally; NuttX did not, so
BUILTIN_COMPILER_RT builds for single-precision-FPU Arm targets (e.g.
Cortex-M33, -mfpu=fpv5-sp-d16) failed to assemble with errors such as
"selected FPU does not support instruction -- vadd.f64".
Filter the source list to match the configured FPU, in both the Makefile
and CMake builds:
- chkstk.S / chkstk2.S are Windows/MinGW-only stack probes, always dropped;
- with no hardware FPU (!CONFIG_ARCH_FPU) all arm/*vfp.S are dropped;
- with a single-precision FPU (!CONFIG_ARCH_DPFPU) the double-precision
*df*vfp.S routines are dropped.
Reproduced against compiler-rt 17.0.1 with arm-none-eabi-gcc 14.2 using the
Cortex-M33 single-precision flags: 18 of 86 arm/*.S files failed to assemble
(17 double-precision *df*vfp.S plus chkstk.S); after the filter all remaining
68 files assemble cleanly.
Fixes: apache#17386
Generated-by: Claude (Anthropic)
Signed-off-by: Udit Jain <uditjainstjis@gmail.com>
uditjainstjis
force-pushed
the
fix/17386-compiler-rt-arm-vfp
branch
from
July 24, 2026 02:25
7aa491c to
adc3f61
Compare
xiaoxiang781216
approved these changes
Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
libs/libbuiltin/compiler-rtglobs everyarm/*.Ssource into the builtinslibrary (
$(wildcard .../arm/*.S)inMake.defs,file(GLOB ...)inCMakeLists.txt). Several of those hand-written VFP assembly files require FPUfeatures the selected target may not have. Upstream compiler-rt selects them
conditionally in its own CMake logic; NuttX did not, so enabling
BUILTIN_COMPILER_RTon a single-precision-FPU Arm target (e.g. Cortex-M33 with-mfpu=fpv5-sp-d16, as on the Raspberry Pi Pico 2 / RP2350) breaks the buildwith assembler errors such as:
This filters the Arm
.Ssource list to match the configured FPU, in both theMakefile and CMake builds:
chkstk.S/chkstk2.Sare Windows/MinGW-only stack probes — always dropped;!CONFIG_ARCH_FPU), everyarm/*vfp.Sis dropped;!CONFIG_ARCH_DPFPU), the double-precision*df*vfp.Sroutines are dropped.The excluded set mirrors upstream compiler-rt's own conditional selection.
Fixes #17386.
Impact
CONFIG_BUILTIN_COMPILER_RT=yon single-precision-FPU andsoft-float Arm targets (previously failed to link/assemble).
non-Arm architectures: those targets keep the same source set (the double-
precision
*df*vfp.Sfiles are only removed whenCONFIG_ARCH_DPFPUis unset,and the whole block is guarded by
CONFIG_ARCH_ARM).Testing
Host: Ubuntu 24.04 (x86_64),
arm-none-eabi-gcc14.2.rel1 (matching thetoolchain in the original report), compiler-rt 17.0.1 (NuttX default
LIB_COMPILER_RT_VERSION).Reproduced the failure by assembling every
arm/*.Sbuiltin with the Cortex-M33single-precision flags from the issue
(
-march=armv8-m.main+dsp -mtune=cortex-m33 -mfpu=fpv5-sp-d16 -mfloat-abi=softfp -mthumb -mcmse):Applying this patch's exclusion set (17 double-precision
*df*vfp.Sfiles +chkstk.S) and re-assembling the remainder:negdf2vfp.Sand the single-precision*sf*vfp.Sroutines are correctlyretained (they assemble under a single-precision FPU). Verified the Make filter
logic independently: for a single-precision target it removes exactly the DP-VFP
and
chkstkfiles while keepingnegdf2vfp.S,addsf3vfp.S, and.csources../tools/checkpatch.sh -fpasses on both changed files (includingcmake-format).