Skip to content

Commit 4a9a69c

Browse files
committed
Use regular Rust static-PIE for Rust storage example
1 parent 119aaae commit 4a9a69c

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

guest/rust_storage/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -e
33
pushd storage_program
44
./build.sh
55
popd
6-
storage_binary=./storage_program/target/x86_64-unknown-linux-musl/release/demo
6+
storage_binary=./storage_program/target/release/demo
77
objcopy -w --extract-symbol --strip-symbol=!remote* --strip-symbol=* $storage_binary storage.syms
88
gcc-12 -static -O2 symbol_offset.c -o symbol_offset
99
./symbol_offset storage.syms 0x44000000
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
#!/usr/bin/env bash
22
set -e
3-
RUSTFLAGS="-Zexport-executable-symbols" cargo build --target x86_64-unknown-linux-musl --release
3+
RUSTFLAGS="-Ctarget-feature=+crt-static -Zexport-executable-symbols" cargo build --release
4+
#RUSTFLAGS="-Zexport-executable-symbols" cargo build --target x86_64-unknown-linux-musl --release

guest/rust_storage/storage_program/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use std::process::ExitCode;
22

33
#[no_mangle]
44
extern "C" fn remote_function(arg: fn(i32) -> i32, value: i32) -> i32 {
5+
//println!("In remote_function with value: {}", value);
56
return arg(value);
67
}
78

0 commit comments

Comments
 (0)