diff --git a/src/hal/isr.rs b/src/hal/isr.rs index c82d865e..bf3eb55c 100644 --- a/src/hal/isr.rs +++ b/src/hal/isr.rs @@ -27,3 +27,5 @@ extern crate core; #[cfg(mcu_lpc17xx)] #[path="lpc17xx/isr.rs"] pub mod isr_lpc17xx; + +#[path="../lib/lang_items.rs"] mod lang_items; diff --git a/src/lib/lang_items.rs b/src/lib/lang_items.rs new file mode 100644 index 00000000..8a8f0490 --- /dev/null +++ b/src/lib/lang_items.rs @@ -0,0 +1,24 @@ +// Zinc, the bare metal stack for rust. +// Copyright 2014 Vladimir "farcaller" Pouzanov +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#[lang="stack_exhausted"] +#[no_split_stack] +extern fn stack_exhausted() {} +#[lang="eh_personality"] +#[no_split_stack] +extern fn eh_personality() {} +#[lang="begin_unwind"] +#[no_split_stack] +extern fn begin_unwind() {} diff --git a/src/lib/mod.rs b/src/lib/mod.rs index 68feae63..b03ccec6 100644 --- a/src/lib/mod.rs +++ b/src/lib/mod.rs @@ -19,3 +19,5 @@ pub mod strconv; pub mod volatile_cell; pub mod shared; pub mod queue; + +mod lang_items; diff --git a/support/rake.rb b/support/rake.rb index 81835f42..654eaf01 100644 --- a/support/rake.rb +++ b/support/rake.rb @@ -81,6 +81,10 @@ def compile_rust(n, h) "#{do_lto ? '-Z lto' : ''} #{crate_type} #{emit} " + "#{search_paths} #{codegen} " + "#{outflags} #{ignore_warnings} #{rust_src}" + if File.extname(t.name) == '.o' + sh "#{:strip.in_toolchain} -N rust_stack_exhausted -N rust_begin_unwind " + + "-N rust_eh_personality #{t.name}" + end end end