uditjainstjis opened a new pull request, #19513:
URL: https://github.com/apache/nuttx/pull/19513

   ## Summary
   
   `libs/libbuiltin/compiler-rt` globs **every** `arm/*.S` source into the 
builtins
   library (`$(wildcard .../arm/*.S)` in `Make.defs`, `file(GLOB ...)` in
   `CMakeLists.txt`). Several of those hand-written VFP assembly files require 
FPU
   features the selected target may not have. Upstream compiler-rt selects them
   conditionally in its own CMake logic; NuttX did not, so enabling
   `BUILTIN_COMPILER_RT` on 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 build
   with assembler errors such as:
   
   ```
   compiler-rt/lib/builtins/arm/adddf3vfp.S:24: Error: selected FPU does not 
support instruction -- `vadd.f64 d6,d6,d7'
   compiler-rt/lib/builtins/arm/chkstk.S:29:   Error: instruction not supported 
in Thumb16 mode -- `subs r5,r5,#4096'
   ```
   
   This filters the Arm `.S` 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`), every `arm/*vfp.S` is dropped;
   - with a single-precision FPU (`!CONFIG_ARCH_DPFPU`), the double-precision
     `*df*vfp.S` routines are dropped.
   
   The excluded set mirrors upstream compiler-rt's own conditional selection.
   
   Fixes #17386.
   
   ## Impact
   
   - Fixes the build for `CONFIG_BUILTIN_COMPILER_RT=y` on single-precision-FPU 
and
     soft-float Arm targets (previously failed to link/assemble).
   - No behavioural change for targets with a double-precision FPU or for
     non-Arm architectures: those targets keep the same source set (the double-
     precision `*df*vfp.S` files are only removed when `CONFIG_ARCH_DPFPU` is 
unset,
     and the whole block is guarded by `CONFIG_ARCH_ARM`).
   - Build system only; no runtime code, API, or documentation changes.
   
   ## Testing
   
   Host: Ubuntu 24.04 (x86_64), `arm-none-eabi-gcc` 14.2.rel1 (matching the
   toolchain in the original report), compiler-rt 17.0.1 (NuttX default
   `LIB_COMPILER_RT_VERSION`).
   
   Reproduced the failure by assembling every `arm/*.S` builtin with the 
Cortex-M33
   single-precision flags from the issue
   (`-march=armv8-m.main+dsp -mtune=cortex-m33 -mfpu=fpv5-sp-d16 
-mfloat-abi=softfp -mthumb -mcmse`):
   
   ```
   [RESULT] total=86  FAIL=18  PASS=68
   FAILING: adddf3vfp.S chkstk.S divdf3vfp.S eqdf2vfp.S extendsfdf2vfp.S
            fixdfsivfp.S fixunsdfsivfp.S floatsidfvfp.S floatunssidfvfp.S
            gedf2vfp.S gtdf2vfp.S ledf2vfp.S ltdf2vfp.S muldf3vfp.S nedf2vfp.S
            subdf3vfp.S truncdfsf2vfp.S unorddf2vfp.S
   ```
   
   Applying this patch's exclusion set (17 double-precision `*df*vfp.S` files +
   `chkstk.S`) and re-assembling the remainder:
   
   ```
   [POST-FIX] assembled=68  remaining_failures=0
   ```
   
   `negdf2vfp.S` and the single-precision `*sf*vfp.S` routines are correctly
   retained (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 `chkstk` files while keeping `negdf2vfp.S`, `addsf3vfp.S`, and `.c` 
sources.
   
   `./tools/checkpatch.sh -f` passes on both changed files (including
   `cmake-format`).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to