What changed, and why it matters
This commit removes a compiler flag called -mlong-calls from the firmware build settings. The flag was forcing the compiler to use a larger, longer-range calling convention for function calls, even though the firmware is small enough that the normal direct calling convention works fine. Removing it only reduces code size (saves about 11 KB) and has no security relevance.
No security action required. This is a benign size-optimization build cleanup.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch drops -mlong-calls from CMAKE_C_FLAGS and CARGO_C_FLAGS for the Cortex-M4 Thumb cross-compilation build. On Cortex-M4 Thumb, the BL instruction has a range of approximately ±16 MiB, which comfortably covers the firmware image. -mlong-calls was forcing indirect calls via registers at every call site, increasing code size. The change restores direct BL calls and reduces firmware.bin by 11,432 bytes. There is no functional, memory-safety, or security behavior change.
Changed components
CMakeLists.txt build configurationInspect captured patch +2 / −2
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 963c3e2..8e624e4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -135,7 +135,7 @@ set(CARGO_C_FLAGS "")
string(APPEND CMAKE_C_FLAGS " -std=c11 -pipe")
if(CMAKE_CROSSCOMPILING)
set(CMAKE_C_FLAGS "\
- ${CMAKE_C_FLAGS} -mcpu=cortex-m4 -mthumb -mlong-calls \
+ ${CMAKE_C_FLAGS} -mcpu=cortex-m4 -mthumb \
-mfloat-abi=softfp -mfpu=fpv4-sp-d16 -fomit-frame-pointer -D__SAMD51J20A__ \
"
)
@@ -147,7 +147,7 @@ if(CMAKE_CROSSCOMPILING)
)
string(APPEND CARGO_C_FLAGS "\
- -mlong-calls -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -fomit-frame-pointer -D__SAMD51J20A")
+ -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -fomit-frame-pointer -D__SAMD51J20A")
endif()
# Optimize for size by default
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.