Skip to content

Commit d3826af

Browse files
committed
feat(guest): replace musl with picolibc
Signed-off-by: Tomasz Andrzejak <andreiltd@gmail.com>
1 parent 852f0ff commit d3826af

File tree

559 files changed

+1511
-46619
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

559 files changed

+1511
-46619
lines changed

.gitmodules

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

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

c.just

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ mkdir := if os() == "windows" { "mkdir -f -p" } else { "mkdir -p"}
22

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.
5-
c-compile-options-elf := '-nobuiltininc -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/musl/include/" + " -I " + root / "src/hyperlight_guest_bin/third_party/musl/arch/x86_64" + " -I " + root / "src/hyperlight_guest_bin/third_party/printf"
7-
c-linker-options-elf := '--entry "entrypoint" --nostdlib -pie'
5+
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/newlib/libc/include/" + " -I " + root / "src/hyperlight_guest_bin/third_party/picolibc/newlib/libc/tinystdio/"
7+
c-linker-options-elf := '--entry "entrypoint" --nostdlib -pie --no-dynamic-linker'
88
c-flags-debug-elf := '-O0'
99
c-flags-release-elf := '-O3'
1010

hack/clippy-package-features.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ PROFILE=$([ "$TARGET" = "debug" ] && echo "dev" || echo "$TARGET")
1919
if [[ "$PACKAGE" == "hyperlight-host" ]]; then
2020
REQUIRED_FEATURES=("kvm" "mshv3")
2121
elif [[ "$PACKAGE" == "hyperlight-guest-bin" ]]; then
22-
REQUIRED_FEATURES=("printf")
22+
REQUIRED_FEATURES=("libc")
2323
else
2424
REQUIRED_FEATURES=()
2525
fi
@@ -68,4 +68,4 @@ if [[ -n "$features" ]]; then
6868
echo "Testing $PACKAGE with all features: $all_features"
6969
(set -x; cargo clippy -p "$PACKAGE" --all-targets --no-default-features --features "$all_features" --profile="$PROFILE" -- -D warnings)
7070
fi
71-
fi
71+
fi

src/hyperlight_guest_bin/Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ and third-party code used by our C-API needed to build a native hyperlight-guest
1414
"""
1515

1616
[features]
17-
default = ["libc", "printf"]
18-
libc = [] # compile musl libc
19-
printf = [ "libc" ] # compile printf
17+
default = ["libc"]
18+
libc = [] # compile libc from picolibc
19+
libm = ["libc"] # compile libm from picolibc
2020
trace_guest = ["hyperlight-common/trace_guest", "hyperlight-guest/trace_guest", "hyperlight-guest-tracing/trace"]
2121
mem_profile = ["hyperlight-common/unwind_guest","hyperlight-common/mem_profile"]
2222

@@ -32,6 +32,7 @@ spin = "0.10.0"
3232
workspace = true
3333

3434
[build-dependencies]
35+
anyhow = "1"
3536
cc = "1.2"
3637
cfg-if = "1.0"
3738
glob = "0.3.3"

0 commit comments

Comments
 (0)