Skip to content

Conversation

@ludfjig
Copy link
Contributor

@ludfjig ludfjig commented Jan 26, 2026

Update guest C api to use cargo hyperlight build which will use the right target. This fixes the previous ABI mismatch where clang used fp registers to pass floats, but rust didn't.

Note: To compile simpleguest/main.c, we're still using clang's x86_64-unknown-linux-none target

Closes #179

** For the curious, a small repro can be found here https://github.com/ludfjig/float-abi-test

@ludfjig ludfjig force-pushed the unignore_float_test branch from 760b5d9 to 306feb1 Compare January 26, 2026 22:59
@ludfjig ludfjig changed the title Unignore floating point tests Fix fp ABI for C guest Jan 26, 2026
@ludfjig ludfjig force-pushed the unignore_float_test branch 3 times, most recently from b665e69 to 282eb21 Compare January 26, 2026 23:09
@ludfjig ludfjig added the kind/bugfix For PRs that fix bugs label Jan 26, 2026
@ludfjig ludfjig marked this pull request as ready for review January 26, 2026 23:59
@ludfjig ludfjig requested a review from Copilot January 27, 2026 00:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the float ABI mismatch in the C guest path by switching the guest C API build to use cargo hyperlight build (which selects the correct target/ABI), and re-enables the previously ignored float roundtrip test with comparisons that tolerate FlatBuffers’ -0.0 behavior.

Changes:

  • Build hyperlight_guest_capi via cargo hyperlight build and update artifact paths to x86_64-hyperlight-none.
  • Re-enable float_roundtrip and adjust float comparisons to handle -0.0 and NaN.
  • Update a test guest lockfile dependency (quote 1.0.43 → 1.0.44).

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/tests/rust_guests/witguest/Cargo.lock Bumps quote dependency version/checksum in the witguest lockfile.
src/hyperlight_host/tests/sandbox_host_tests.rs Un-ignores float_roundtrip and adjusts float equality checks for -0.0/NaN.
src/hyperlight_guest_capi/.cargo/config.toml Removes hardcoded target/profile panic settings so builds are driven by cargo-hyperlight.
c.just Switches C API build to cargo hyperlight build and updates link search path to the new target dir.
Justfile Updates packaged static lib paths to target/x86_64-hyperlight-none/....

@ludfjig ludfjig force-pushed the unignore_float_test branch 2 times, most recently from 8e67f8e to ee7312d Compare January 27, 2026 01:18
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
@ludfjig ludfjig force-pushed the unignore_float_test branch from ee7312d to 9b2429f Compare January 27, 2026 01:20
@jsturtevant
Copy link
Contributor

This fixes the previous ABI mismatch where clang used fp registers to pass floats, but rust didn't.

Great find! I've was wondering why this was still failing. Specifically this means that it was using C was using xxm registers and rust was using soft-float because it was built in no std? With Cargo hyperlight the rust code will use the xxm registers which aligns with the c code.

Copy link
Contributor

@dblnz dblnz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Good catch!

@ludfjig ludfjig merged commit df35fab into hyperlight-dev:main Jan 27, 2026
55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bugfix For PRs that fix bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test float_roundtrip fails when using c guest

4 participants