Skip to content

[FIPS 2025 CHERRYPICK] Fix FIPS delocator handling of floating-point immediates on aarch64#3255

Merged
justsmth merged 1 commit into
aws:fips-2025-09-12-ltsfrom
samuel40791765:fips-2025-09-12-lts-gcc-15
May 15, 2026
Merged

[FIPS 2025 CHERRYPICK] Fix FIPS delocator handling of floating-point immediates on aarch64#3255
justsmth merged 1 commit into
aws:fips-2025-09-12-ltsfrom
samuel40791765:fips-2025-09-12-lts-gcc-15

Conversation

@samuel40791765
Copy link
Copy Markdown
Contributor

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+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:

  • 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)

…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)
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.75%. Comparing base (e732603) to head (b8f39a8).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@justsmth justsmth merged commit 8bc6825 into aws:fips-2025-09-12-lts May 15, 2026
162 of 193 checks passed
@samuel40791765 samuel40791765 deleted the fips-2025-09-12-lts-gcc-15 branch May 15, 2026 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants