[FIPS 2025 CHERRYPICK] Fix FIPS delocator handling of floating-point immediates on aarch64#3255
Merged
justsmth merged 1 commit intoMay 15, 2026
Conversation
…ws#3029) Addresses aws#3028 When GCC 15 compiles the FIPS module at `-O3` on aarch64, it emits `fmov` instructions with floating-point immediates (e.g. `fmov v8.4s, so it parses `#2.0e+0` as the integer `#2` followed by what it thinks is a symbol reference `.0e`. This gets turned into a redirector (`.Lbcm_redirector_.0e`), producing invalid assembly. This change fixes the issue in two ways: - **Grammar fix**: Adds a floating-point immediate alternative to the `RegisterOrConstant` rule in `delocate.peg`, so values like `#2.0e+0` are parsed as a single token. - **Pass-through**: Adds `fmov` to the special-case instruction list in `processAarch64Instruction()`. Since `fmov` only operates on registers and immediates (never memory), it never needs delocating and can safely be written through unchanged. The GCC 15 + FIPS exclusion in `arm-gcc-tests` CI is also removed now that the underlying issue is resolved. The `delocate.peg.go` file is regenerated from the grammar using the `peg` tool. The grammar change is the one line in `delocate.peg`; the rest of that file is mechanical. - Added 6 test cases to `testdata/aarch64-Basic/in.s` covering float immediates with exponent notation, simple decimals, negative values, fractional values, scalar forms, and register-to-register `fmov`. - All 19 existing delocator tests continue to pass. - Re-enabled the `arm-gcc-tests` CI matrix entry for GCC 15 + FIPS on arm64 which will validate the end-to-end build. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license. (cherry picked from commit 7b2a86c)
torben-hansen
approved these changes
May 14, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## fips-2025-09-12-lts #3255 +/- ##
=======================================================
- Coverage 78.77% 78.75% -0.02%
=======================================================
Files 667 667
Lines 113386 113386
Branches 16085 16103 +18
=======================================================
- Hits 89318 89299 -19
- Misses 23274 23293 +19
Partials 794 794 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
justsmth
approved these changes
May 15, 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.
When GCC 15 compiles the FIPS module at
-O3on aarch64, it emitsfmovinstructions with floating-point immediates (e.g.fmov v8.4s, so it parses#2.0e+0as the integer#2followed by what it thinks is a symbol reference.0e. This gets turned into a redirector (.Lbcm_redirector_.0e`), producing invalid assembly.This change fixes the issue in two ways:
RegisterOrConstantrule indelocate.peg, so values like#2.0e+0are parsed as a single token.fmovto the special-case instruction list inprocessAarch64Instruction(). Sincefmovonly operates on registers and immediates (never memory), it never needs delocating and can safely be written through unchanged.The GCC 15 + FIPS exclusion in
arm-gcc-testsCI is also removed now that the underlying issue is resolved.The
delocate.peg.gofile is regenerated from the grammar using thepegtool. The grammar change is the one line indelocate.peg; the rest of that file is mechanical.testdata/aarch64-Basic/in.scovering float immediates with exponent notation, simple decimals, negative values, fractional values, scalar forms, and register-to-registerfmov.arm-gcc-testsCI matrix entry for GCC 15 + FIPS on arm64 which will validate the end-to-end build.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.
(cherry picked from commit 7b2a86c)