Hi.
It seems there's some issue with panic=abort when the sysroot is compiled in debug mode.
Here's a reproducer.
With this bootstrap.toml:
profile = "compiler"
change-id = 140732
[rust]
codegen-backends = ["llvm"]
optimize = 0
deny-warnings = false
(I know that optimize = 0 is not supported, but that's an easy way to compile the sysroot in debug mode. There's another reproducer below that works without this option.)
Then, compile with:
then, compile this program:
fn main() {
println!("Hello, world!");
}
with -Cpanic=abort:
./build/host/stage1/bin/rustc -Cpanic=abort main.rs -o main
and we get some undefined symbol errors:
error: linking with `cc` failed: exit status: 1
|
= note: "cc" "-m64" "/tmp/rustc6lb0WO/symbols.o" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libpanic_abort-*,libstd-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,libcfg_if-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/tmp/rustc6lb0WO/raw-dylibs" "-B<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld" "-fuse-ld=lld" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/tmp/repro" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: rust-lld: error: undefined symbol: core::ptr::drop_glue::<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>
>>> referenced by mod.rs:1043 (library/core/src/mem/mod.rs:1043)
>>> std-7fe341122eadee7b.std.50f6979cfd703951-cgu.0.rcgu.o:(std::rt::lang_start_internal::{closure#0}::{closure#0}::{closure#0}) in archive /home/user/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-7fe341122eadee7b.rlib
>>> referenced by panicking.rs:565 (library/std/src/panicking.rs:565)
>>> std-7fe341122eadee7b.std.50f6979cfd703951-cgu.0.rcgu.o:(std::panicking::catch_unwind::cleanup) in archive /home/user/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-7fe341122eadee7b.rlib
rust-lld: error: undefined symbol: <alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>::from_raw_in
>>> referenced by boxed.rs:1325 (library/alloc/src/boxed.rs:1325)
>>> std-7fe341122eadee7b.std.50f6979cfd703951-cgu.0.rcgu.o:(std::panicking::catch_unwind::cleanup) in archive /home/user/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-7fe341122eadee7b.rlib
collect2: error: ld returned 1 exit status
Another way to reproduce is with this bootstrap.toml (which doesn't use the unsupported optimize = 0 option):
profile = "compiler"
change-id = 140732
[rust]
codegen-backends = ["llvm"]
deny-warnings = false
Then, compile the sysroot in debug mode with:
CARGO_PROFILE_DIST_OPT_LEVEL=0 ./x build library
Then compile with -Cpanic=abort like mentioned above.
If we compile the sysroot in debug mode, but with -Zshare-generics=off (with RUSTFLAGS_NOT_BOOTSTRAP="-Zshare-generics=off" CARGO_PROFILE_DIST_OPT_LEVEL=0 ./x build library), the issue is gone.
Is this bug just an unsupported config (debug sysroot) or is this a real bug that should be fixed?
(This is on commit eff8269.)
Thanks.
Hi.
It seems there's some issue with
panic=abortwhen the sysroot is compiled in debug mode.Here's a reproducer.
With this
bootstrap.toml:(I know that
optimize = 0is not supported, but that's an easy way to compile the sysroot in debug mode. There's another reproducer below that works without this option.)Then, compile with:
then, compile this program:
with
-Cpanic=abort:and we get some undefined symbol errors:
Another way to reproduce is with this
bootstrap.toml(which doesn't use the unsupportedoptimize = 0option):Then, compile the sysroot in debug mode with:
Then compile with
-Cpanic=abortlike mentioned above.If we compile the sysroot in debug mode, but with
-Zshare-generics=off(withRUSTFLAGS_NOT_BOOTSTRAP="-Zshare-generics=off" CARGO_PROFILE_DIST_OPT_LEVEL=0 ./x build library), the issue is gone.Is this bug just an unsupported config (debug sysroot) or is this a real bug that should be fixed?
(This is on commit eff8269.)
Thanks.