Interesting things on nightly-2022-12-12
(which still has rustc_driver
built with ThinLTO on linux):
- the wrong panic hook is to be called
- symbols are duplicated with
-Zdylib-lto
, some of libstd's static, like the mutablestd::panicking::HOOK
storing the current panic hook.
Duplicates the structure between rustc's main binary wrapper and rustc_driver
's dylib containing the actual code, to reproduce issue #105637.
cargo clean && RUSTFLAGS="-Cprefer-dynamic" cargo run -q
Output:
rustc_main - updating panic hook
rustc_driver - DEFAULT_HOOK forced, installing new panic hook
Compiling, about to panic.
rustc_driver - panic hook executing
rustc_driver's panic hook is executed.
Looking at the dylib panic hook symbols, it's undefined:
nm ./target/debug/librustc_driver.so | rustfilt | grep "std::panicking::HOOK"
U std::panicking::HOOK
cargo clean && RUSTFLAGS="-Cprefer-dynamic -Zdylib-lto -Cembed-bitcode -Clto=thin" cargo run -q
Output:
rustc_main - updating panic hook
rustc_driver - DEFAULT_HOOK forced, installing new panic hook
Compiling, about to panic.
rustc_main - panic hook executing
rustc_main's panic hook is executed.
Looking at the dylib panic hook symbols, it's a local BSS symbol:
nm ./target/debug/librustc_driver.so | rustfilt | grep "std::panicking::HOOK"
00000000000e4118 b std::panicking::HOOK