Skip to content

Commit 58fcbef

Browse files
authored
Move libc from hyperlight-guest-bin to hyperlight-libc (#1437)
* move libc from hl-guest-bin to hl-libc Signed-off-by: Jorge Prendes <jorge.prendes@gmail.com> * cleanup Cargo.toml Signed-off-by: Jorge Prendes <jorge.prendes@gmail.com> * remove crate local .cargo/config.toml Signed-off-by: Jorge Prendes <jorge.prendes@gmail.com> * use cargo-hyperlight 0.1.10 Signed-off-by: Jorge Prendes <jorge.prendes@gmail.com> * Add derives to bindings Signed-off-by: Jorge Prendes <jorge.prendes@gmail.com> * Move gettimeofday to use clock_gettime Signed-off-by: Jorge Prendes <jorge.prendes@gmail.com> * fix picolibc.md Signed-off-by: Jorge Prendes <jorge.prendes@gmail.com> * Add README.md to hyperlight-libc Signed-off-by: Jorge Prendes <jorge.prendes@gmail.com> * add license header Signed-off-by: Jorge Prendes <jorge.prendes@gmail.com> * fix clippy Signed-off-by: Jorge Prendes <jorge.prendes@gmail.com> --------- Signed-off-by: Jorge Prendes <jorge.prendes@gmail.com>
1 parent 43118b2 commit 58fcbef

26 files changed

Lines changed: 773 additions & 115 deletions

File tree

.github/workflows/RustNightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ jobs:
7878
src/tests/rust_guests/witguest -> target
7979
8080
- name: Install cargo-hyperlight
81-
run: cargo install cargo-hyperlight --version 0.1.9 --locked --force
81+
run: cargo install cargo-hyperlight --version 0.1.10 --locked --force
8282

8383
- name: Build and move Rust guests
8484
run: |

.github/workflows/dep_build_guests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
src/tests/rust_guests/witguest -> target
6969
7070
- name: Install cargo-hyperlight
71-
run: cargo install cargo-hyperlight --version 0.1.9 --locked --force
71+
run: cargo install cargo-hyperlight --version 0.1.10 --locked --force
7272

7373
- name: Build Rust guests
7474
run: |

.github/workflows/dep_code_checks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
run: just fmt-check
7575

7676
- name: Install cargo-hyperlight
77-
run: cargo install cargo-hyperlight --version 0.1.9 --locked --force
77+
run: cargo install cargo-hyperlight --version 0.1.10 --locked --force
7878

7979
- name: clippy exhaustive check (debug)
8080
run: just clippy-exhaustive debug
@@ -145,7 +145,7 @@ jobs:
145145
run: just fmt-check
146146

147147
- name: Install cargo-hyperlight
148-
run: cargo install cargo-hyperlight --version 0.1.9 --locked --force
148+
run: cargo install cargo-hyperlight --version 0.1.10 --locked --force
149149

150150
- name: clippy (debug)
151151
run: |

.gitmodules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[submodule "src/hyperlight_guest_bin/third_party/picolibc"]
2-
path = src/hyperlight_guest_bin/third_party/picolibc
1+
[submodule "src/hyperlight_libc/third_party/picolibc"]
2+
path = src/hyperlight_libc/third_party/picolibc
33
url = https://github.com/hyperlight-dev/picolibc-bsd.git
44
shallow = true

Cargo.lock

Lines changed: 31 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ members = [
1515
"fuzz",
1616
"src/hyperlight_guest_bin",
1717
"src/hyperlight_guest_macro",
18+
"src/hyperlight_libc",
1819
"src/hyperlight_component_util",
1920
"src/hyperlight_component_macro",
2021
"src/trace_dump",
@@ -43,6 +44,7 @@ hyperlight-guest-bin = { path = "src/hyperlight_guest_bin", version = "0.14.0",
4344
hyperlight-guest-macro = { path = "src/hyperlight_guest_macro", version = "0.14.0", default-features = false }
4445
hyperlight-testing = { path = "src/hyperlight_testing", default-features = false }
4546
hyperlight-guest-tracing = { path = "src/hyperlight_guest_tracing", version = "0.14.0", default-features = false }
47+
hyperlight-libc = { path = "src/hyperlight_libc", version = "0.14.0", default-features = false }
4648
hyperlight-component-util = { path = "src/hyperlight_component_util", version = "0.14.0", default-features = false }
4749
hyperlight-component-macro = { path = "src/hyperlight_component_macro", version = "0.14.0", default-features = false }
4850

NOTICE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Copyright © 2020 The Newlib Project
5353
Newlib code is licensed under a collection of BSD-compatible and
5454
permissive licenses. The full license details for all files are
5555
documented in the COPYING.picolibc and COPYING.NEWLIB files in the
56-
picolibc submodule at src/hyperlight_guest_bin/third_party/picolibc/.
56+
picolibc submodule at src/hyperlight_libc/third_party/picolibc/.
5757

5858
Note: The picolibc submodule uses the picolibc-bsd fork
5959
(https://github.com/hyperlight-dev/picolibc-bsd), which is a redistribution

c.just

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ mkdir := if os() == "windows" { "mkdir -f -p" } else { "mkdir -p"}
33
# Elf options
44
# We don't support stack protectors at the moment, but Arch Linux clang auto-enables them for -linux platforms, so explicitly disable them.
55
c-compile-options-elf := '-nostdlibinc -H --target=x86_64-unknown-linux-none -fno-stack-protector -fstack-clash-protection -mstack-probe-size=4096 -fPIC'
6-
c-include-flags-elf := "-I " + root / "src/hyperlight_guest_capi/include/" + " -I " + root / "src/hyperlight_guest_bin/third_party/picolibc/libc/include/" + " -I " + root / "src/hyperlight_guest_bin/third_party/picolibc/libc/stdio/" + " -I " + root / "src/hyperlight_guest_bin/include/"
6+
c-include-flags-elf := "-I " + root / "src/hyperlight_guest_capi/include/" + " -I " + root / "src/hyperlight_libc/third_party/picolibc/libc/include/" + " -I " + root / "src/hyperlight_libc/third_party/picolibc/libc/stdio/" + " -I " + root / "src/hyperlight_libc/include/"
77
c-linker-options-elf := '--entry "entrypoint" --nostdlib -pie --no-dynamic-linker'
88
c-flags-debug-elf := '-O0'
99
c-flags-release-elf := '-O3'

docs/picolibc.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ for embedded systems, making it well-suited for Hyperlight's micro-VM environmen
88

99
The picolibc integration is controlled by the `libc` feature flag on the `hyperlight-guest-bin`
1010
crate (enabled by default). When enabled, the build script compiles picolibc from source using the
11-
vendored submodule at `src/hyperlight_guest_bin/third_party/picolibc`.
11+
vendored submodule at `src/hyperlight_libc/third_party/picolibc`.
1212

1313
The submodule points to [picolibc-bsd](https://github.com/hyperlight-dev/picolibc-bsd), a
1414
redistribution of picolibc with all copyleft-licensed files (GPL/AGPL) removed from the tree and
@@ -17,7 +17,7 @@ licensing details.
1717

1818
## Host Function Stubs
1919

20-
When the `libc` feature is enabled, the POSIX stubs in `src/hyperlight_guest_bin/src/libc.rs`
20+
When the `libc` feature is enabled, the POSIX stubs in `src/hyperlight_guest_bin/src/libc_stubs.rs`
2121
provide C-compatible implementations of `read`, `write`, `clock_gettime`, `gettimeofday`, and other
2222
functions that picolibc calls internally.
2323

@@ -66,11 +66,11 @@ To update picolibc to a new version:
6666
2. Update the submodule in hyperlight:
6767

6868
```bash
69-
cd src/hyperlight_guest_bin/third_party/picolibc
69+
cd src/hyperlight_libc/third_party/picolibc
7070
git fetch origin
7171
git checkout <new-fork-tag>
7272
cd ../../../..
73-
git add src/hyperlight_guest_bin/third_party/picolibc
73+
git add src/hyperlight_libc/third_party/picolibc
7474
```
7575

7676
3. Verify licensing: The fork's CI runs scancode-toolkit to ensure no copyleft files are present.

src/hyperlight_guest_bin/.cargo/config.toml

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)