started using cc crate
This commit is contained in:
parent
6db05904f6
commit
0526e750cd
|
@ -0,0 +1,6 @@
|
|||
CHECK: cc_plus_one_c
|
||||
CHECK: lfence
|
||||
CHECK: popq
|
||||
CHECK-NEXT: popq [[REGISTER:%[a-z]+]]
|
||||
CHECK-NEXT: lfence
|
||||
CHECK-NEXT: jmpq *[[REGISTER]]
|
|
@ -7,3 +7,6 @@ edition = "2018"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
|
||||
[build-dependencies]
|
||||
cc = "1.0"
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
fn main() {
|
||||
cc::Build::new()
|
||||
.file("foo.c")
|
||||
.compile("foo");
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
int cc_plus_one_c(int *arg) {
|
||||
return *arg + 1;
|
||||
}
|
|
@ -1,3 +1,11 @@
|
|||
fn main() {
|
||||
println!("Hello, world!");
|
||||
extern {
|
||||
fn cc_plus_one_c(arg : &u32) -> u32;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let value : u32 = 41;
|
||||
|
||||
unsafe{
|
||||
println!("Answer to the Ultimate Question of Life, the Universe, and Everything: {}!", cc_plus_one_c(&value));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,10 +12,8 @@ function build {
|
|||
# HACK(eddyb) sets `RUSTC_BOOTSTRAP=1` so Cargo can accept nightly features.
|
||||
# These come from the top-level Rust workspace, that this crate is not a
|
||||
# member of, but Cargo tries to load the workspace `Cargo.toml` anyway.
|
||||
env RUSTC_BOOTSTRAP=1 \
|
||||
env RUSTC_BOOTSTRAP=1
|
||||
cargo -v run --target $TARGET
|
||||
env RUSTC_BOOTSTRAP=1 \
|
||||
cargo -v run --target $TARGET --release
|
||||
popd
|
||||
popd
|
||||
}
|
||||
|
@ -40,3 +38,4 @@ build
|
|||
#check "libunwind::Registers_x86_64::jumpto()" jumpto.checks
|
||||
|
||||
check "std::io::stdio::_print::h87f0c238421c45bc" print.checks
|
||||
check cc_plus_one_c cc_plus_one_c.checks
|
||||
|
|
Loading…
Reference in New Issue