Skip to content

Use Rust stubs instead of C#28

Merged
jprendes merged 2 commits intohyperlight-dev:mainfrom
jprendes:rust-stubs
Mar 3, 2026
Merged

Use Rust stubs instead of C#28
jprendes merged 2 commits intohyperlight-dev:mainfrom
jprendes:rust-stubs

Conversation

@jprendes
Copy link
Contributor

@jprendes jprendes commented Feb 28, 2026

This PR replaces the use of C stubs with Rust stubs, also removing the __secs_to_tm function taken from the musl codebase.

Before we were compiling C files in build.rs with some stub functions that hyperlight's libc is missing.
Big part of the reason for that is that they took arguments defined as C structs (e.g., tm, timespec, etc.) that would be brittle to replicate in rust.
With this PR, those types are now being generated with bindgen, so we can write the stubs purely in Rust.

@jprendes jprendes added the kind/refactor Code refactoring label Feb 28, 2026
@jprendes jprendes force-pushed the rust-stubs branch 3 times, most recently from 370555f to 968eab6 Compare February 28, 2026 22:12
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.

Overall it looks good to me. Nice job getting rid of the C sources.
Can we add some tests to the functions in the stubs? For the time related ones at least.
I left some comments.

Signed-off-by: Jorge Prendes <jorge.prendes@gmail.com>
Signed-off-by: Jorge Prendes <jorge.prendes@gmail.com>
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!

@jprendes jprendes merged commit 30014b3 into hyperlight-dev:main Mar 3, 2026
22 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/refactor Code refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants