Revert "Build with -Cpanic=unwind by default"

This reverts commit afe74d71e4c2f08696ade0de321a45f7442440d8. It
shouldn't have been pushed to master as it isn't ready yet.
This commit is contained in:
bjorn3 2021-03-31 13:47:10 +02:00
parent 2ceb527728
commit ab425a4bca
5 changed files with 6 additions and 24 deletions

View File

@ -23,7 +23,7 @@ rm -r target/*/{debug,release}/{build,deps,examples,libsysroot*,native} 2>/dev/n
export CARGO_TARGET_DIR=target
# Build libs
export RUSTFLAGS="$RUSTFLAGS -Zforce-unstable-if-unmarked"
export RUSTFLAGS="$RUSTFLAGS -Zforce-unstable-if-unmarked -Cpanic=abort"
export __CARGO_DEFAULT_LIB_METADATA="cg_clif"
if [[ "$1" != "--debug" ]]; then
sysroot_channel='release'

View File

@ -1,4 +1,4 @@
#![feature(start, box_syntax, core_intrinsics, alloc_prelude, alloc_error_handler, lang_items)]
#![feature(start, box_syntax, core_intrinsics, alloc_prelude, alloc_error_handler)]
#![no_std]
extern crate alloc;
@ -27,11 +27,6 @@ fn alloc_error_handler(_: alloc::alloc::Layout) -> ! {
core::intrinsics::abort();
}
#[lang = "eh_personality"]
fn eh_personality() -> ! {
loop {}
}
#[start]
fn main(_argc: isize, _argv: *const *const u8) -> isize {
let world: Box<&str> = box "Hello World!\0";

View File

@ -61,11 +61,11 @@ function base_sysroot_tests() {
$RUN_WRAPPER ./target/out/std_example arg
echo "[AOT] subslice-patterns-const-eval"
$MY_RUSTC example/subslice-patterns-const-eval.rs --crate-type bin --target "$TARGET_TRIPLE"
$MY_RUSTC example/subslice-patterns-const-eval.rs --crate-type bin -Cpanic=abort --target "$TARGET_TRIPLE"
$RUN_WRAPPER ./target/out/subslice-patterns-const-eval
echo "[AOT] track-caller-attribute"
$MY_RUSTC example/track-caller-attribute.rs --crate-type bin --target "$TARGET_TRIPLE"
$MY_RUSTC example/track-caller-attribute.rs --crate-type bin -Cpanic=abort --target "$TARGET_TRIPLE"
$RUN_WRAPPER ./target/out/track-caller-attribute
echo "[AOT] mod_bench"

View File

@ -24,16 +24,7 @@ impl rustc_driver::Callbacks for CraneliftPassesCallbacks {
self.time_passes = config.opts.prints.is_empty()
&& (config.opts.debugging_opts.time_passes || config.opts.debugging_opts.time);
if config.opts.test {
// Unwinding is not yet supported by cg_clif. `-Cpanic=abort` in combination with
// `-Zpanic-abort-tests` ensures that tests are run in a subprocess. This avoids
// crashing the test driver on panics, thereby allowing it to report the error and
// continue with other tests.
config.opts.cg.panic = Some(PanicStrategy::Abort);
// Avoid `-Cprefer-dynamic` in case of `-Cpanic=abort` as that will cause a dynamically
// linked libstd with `-Cpanic=unwind` to be linked in, which isn't allowed.
config.opts.cg.prefer_dynamic = false;
}
config.opts.cg.panic = Some(PanicStrategy::Abort);
config.opts.debugging_opts.panic_abort_tests = true;
config.opts.maybe_sysroot = Some(config.opts.maybe_sysroot.clone().unwrap_or_else(|| {
std::env::current_exe().unwrap().parent().unwrap().parent().unwrap().to_owned()

View File

@ -44,11 +44,7 @@ impl rustc_driver::Callbacks for CraneliftPassesCallbacks {
return;
}
if config.opts.crate_name.as_deref() == Some("panic_abort") {
// panic_abort must always be built with `-Cpanic=abort`
config.opts.cg.panic = Some(PanicStrategy::Abort);
}
config.opts.cg.panic = Some(PanicStrategy::Abort);
config.opts.debugging_opts.panic_abort_tests = true;
config.opts.maybe_sysroot =
Some(std::env::current_exe().unwrap().parent().unwrap().parent().unwrap().to_owned());