Skip to content

Commit f64fdff

Browse files
committed
[guest,guest-bin,third-party] move third_party code to guest_bin lib
guest lib should only contain basic functions to interact with the host. Whatever we decide to bring in as third_party deps belong in the guest_bin crate. Signed-off-by: danbugs <[email protected]>
1 parent cb83d6e commit f64fdff

File tree

559 files changed

+36
-55
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

+36
-55
lines changed

Cargo.lock

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

Justfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,7 @@ run-rust-examples-linux target=default-target features="": (run-rust-examples ta
175175
#########################
176176

177177
tar-headers: (build-rust-capi) # build-rust-capi is a dependency because we need the hyperlight_guest.h to be built
178-
# TODO(danbugs): update this when I'm done w/ the move
179-
tar -zcvf include.tar.gz -C {{root}}/src/hyperlight_guest/third_party/ musl/include musl/arch/x86_64 printf/printf.h -C {{root}}/src/hyperlight_guest_capi include
178+
tar -zcvf include.tar.gz -C {{root}}/src/hyperlight_guest_bin/third_party/ musl/include musl/arch/x86_64 printf/printf.h -C {{root}}/src/hyperlight_guest_capi include
180179

181180
tar-static-lib: (build-rust-capi "release") (build-rust-capi "debug")
182181
tar -zcvf hyperlight-guest-c-api-linux.tar.gz -C {{root}}/target/x86_64-unknown-none/ release/libhyperlight_guest_capi.a -C {{root}}/target/x86_64-unknown-none/ debug/libhyperlight_guest_capi.a

c.just

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +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 := '-nobuiltininc -H --target=x86_64-unknown-linux-none -fno-stack-protector -fstack-clash-protection -mstack-probe-size=4096 -fPIC'
6-
# TODO(danbugs): update this when I'm done w/ the move
7-
c-include-flags-elf := "-I " + root / "src/hyperlight_guest_capi/include/" + " -I " + root / "src/hyperlight_guest/third_party/musl/include/" + " -I " + root / "src/hyperlight_guest/third_party/musl/arch/x86_64" + " -I " + root / "src/hyperlight_guest/third_party/printf"
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"
87
c-linker-options-elf := '--entry "entrypoint" --nostdlib -pie'
98
c-flags-debug-elf := '-O0'
109
c-flags-release-elf := '-O3'

src/hyperlight_guest/Cargo.toml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[package]
22
name = "hyperlight-guest"
3-
links = "c"
43
version.workspace = true
54
edition.workspace = true
65
rust-version.workspace = true
@@ -12,17 +11,7 @@ description = """
1211
Library to build guest applications for hyperlight.
1312
"""
1413

15-
[features]
16-
default = ["libc", "printf"]
17-
libc = [] # compile musl libc
18-
printf = [] # compile printf
19-
2014
[dependencies]
2115
anyhow = { version = "1.0.98", default-features = false }
2216
serde_json = { version = "1.0", default-features = false, features = ["alloc"] }
2317
hyperlight-common = { workspace = true }
24-
25-
[build-dependencies]
26-
cc = "1.2"
27-
cfg-if = "1.0"
28-
glob = "0.3.2"

src/hyperlight_guest_bin/Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[package]
22
name = "hyperlight-guest-bin"
3+
links = "c"
34
version.workspace = true
45
edition.workspace = true
56
rust-version.workspace = true
@@ -8,6 +9,11 @@ homepage.workspace = true
89
repository.workspace = true
910
readme.workspace = true
1011

12+
[features]
13+
default = ["libc", "printf"]
14+
libc = [] # compile musl libc
15+
printf = [] # compile printf
16+
1117
[dependencies]
1218
hyperlight-guest = { workspace = true, default-features = false }
1319
hyperlight-common = { workspace = true, default-features = false }
@@ -17,3 +23,8 @@ spin = "0.10.0"
1723

1824
[lints]
1925
workspace = true
26+
27+
[build-dependencies]
28+
cc = "1.2"
29+
cfg-if = "1.0"
30+
glob = "0.3.2"

src/hyperlight_guest/build.rs renamed to src/hyperlight_guest_bin/build.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ fn cargo_main() {
109109
unsafe { env::set_var("AR_x86_64_pc_windows_msvc", "llvm-lib") };
110110
}
111111

112-
// TODO(danbugs): update this when I'm done w/ the move.
113-
cfg.compile("hyperlight_guest");
112+
cfg.compile("hyperlight_guest_bin");
114113
}
115114

116115
let out_dir = env::var("OUT_DIR").expect("cargo OUT_DIR not set");

src/hyperlight_guest_bin/src/guest_err.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use hyperlight_guest::exit::halt;
2121

2222
use crate::GUEST_HANDLE;
2323

24-
// TODO(danbugs): move this to `hyperlight_guest_bin`
2524
/// Exposes a C API to allow the guest to set an error
2625
///
2726
/// # Safety

0 commit comments

Comments
 (0)