Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support panicking and make unsupported platforms a nop #5

Closed
wants to merge 12 commits into from
Prev Previous commit
Next Next commit
Properly build fallback code
oli-obk committed Nov 6, 2018
commit 9f97d52ad5950dd3300bf171755fed4843464d55
3 changes: 2 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
@@ -23,7 +23,8 @@ fn main() {
cfg.file(if msvc {"src/arch/i686.asm"} else {"src/arch/i686.S"});
cfg.define("X86", None);
} else {
cfg.file("fallback.rs");
println!("cargo:rustc-cfg=fallback");
return;
}

cfg.include("src/arch").compile("libstacker.a");
5 changes: 4 additions & 1 deletion src/arch/fallback.rs
Original file line number Diff line number Diff line change
@@ -10,4 +10,7 @@ unsafe extern fn __stacker_switch_stacks(
_dataptr: &mut &mut FnMut(),
) {
panic!("not supported")
}
}

#[no_mangle]
extern fn __stacker_black_box(_: *const u8) {}
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -35,6 +35,10 @@ extern crate libc;

use std::cell::Cell;

#[cfg(fallback)]
#[path="arch/fallback.rs"]
mod fallback;

extern {
fn __stacker_stack_pointer() -> usize;
fn __stacker_switch_stacks(new_stack: usize,