Skip to content

Commit 6295bec

Browse files
committed
[hyperlight_guest_bin] Disable red zones when compiling C
Because we don't presently switch stacks on interrupt entry, we cannot support a red zone in the ABI. rustc's x86_64-unknown-none target already does not use a redzone, but clang's x86_64-unknown-none-linux target, which we use for compiling C code, does use a red zone by default. This commit modifies the clang options that we use to remove uses of a red zone from generated code. Signed-off-by: Lucy Menon <[email protected]>
1 parent 63ba9a3 commit 6295bec

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/hyperlight_guest_bin/build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ fn cargo_main() {
8888
// targets will eventually show up.
8989
cfg.flag("--target=x86_64-unknown-linux-none");
9090

91+
// We don't use a different stack for all interrupts, so there
92+
// can be no red zone
93+
cfg.flag("-mno-red-zone");
94+
9195
// We don't support stack protectors at the moment, but Arch Linux clang
9296
// auto-enables them for -linux platforms, so explicitly disable them.
9397
cfg.flag("-fno-stack-protector");
@@ -245,6 +249,7 @@ fn main() -> std::process::ExitCode {
245249
"-fno-stack-protector",
246250
"-fstack-clash-protection",
247251
"-mstack-probe-size=4096",
252+
"-mno-red-zone",
248253
])
249254
.arg("-nostdinc")
250255
.arg("-isystem")

0 commit comments

Comments
 (0)