Skip to content

Commit 0526e75

Browse files
committed
started using cc crate
1 parent 6db0590 commit 0526e75

File tree

6 files changed

+29
-4
lines changed

6 files changed

+29
-4
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CHECK: cc_plus_one_c
2+
CHECK: lfence
3+
CHECK: popq
4+
CHECK-NEXT: popq [[REGISTER:%[a-z]+]]
5+
CHECK-NEXT: lfence
6+
CHECK-NEXT: jmpq *[[REGISTER]]

src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ edition = "2018"
77
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
88

99
[dependencies]
10+
11+
[build-dependencies]
12+
cc = "1.0"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
fn main() {
2+
cc::Build::new()
3+
.file("foo.c")
4+
.compile("foo");
5+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
int cc_plus_one_c(int *arg) {
3+
return *arg + 1;
4+
}
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
extern {
2+
fn cc_plus_one_c(arg : &u32) -> u32;
3+
}
4+
15
fn main() {
2-
println!("Hello, world!");
6+
let value : u32 = 41;
7+
8+
unsafe{
9+
println!("Answer to the Ultimate Question of Life, the Universe, and Everything: {}!", cc_plus_one_c(&value));
10+
}
311
}

src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ function build {
1212
# HACK(eddyb) sets `RUSTC_BOOTSTRAP=1` so Cargo can accept nightly features.
1313
# These come from the top-level Rust workspace, that this crate is not a
1414
# member of, but Cargo tries to load the workspace `Cargo.toml` anyway.
15-
env RUSTC_BOOTSTRAP=1 \
15+
env RUSTC_BOOTSTRAP=1
1616
cargo -v run --target $TARGET
17-
env RUSTC_BOOTSTRAP=1 \
18-
cargo -v run --target $TARGET --release
1917
popd
2018
popd
2119
}
@@ -40,3 +38,4 @@ build
4038
#check "libunwind::Registers_x86_64::jumpto()" jumpto.checks
4139

4240
check "std::io::stdio::_print::h87f0c238421c45bc" print.checks
41+
check cc_plus_one_c cc_plus_one_c.checks

0 commit comments

Comments
 (0)