compiler-builtins
compiler-builtins copied to clipboard
-Zbuild-std + lto="fat" = undefined reference to `core::panicking::panic`
$ cargo new --bin a
Created binary (application) `a` package
$ cd a/
$ echo -e '[profile.dev]\nlto="fat"' >> Cargo.toml
$ cargo run -Zbuild-std --target x86_64-unknown-linux-gnu
...
error: linking with `cc` failed: exit code: 1
|
= note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/../.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/tmp/a/target/x86_64-unknown-linux-gnu/debug/deps/a-f6afee8bd619dd6c.10btgdcccpdgwv38.rcgu.o" "-o" "/tmp/a/target/x86_64-unknown-linux-gnu/debug/deps/a-f6afee8bd619dd6c" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/tmp/a/target/x86_64-unknown-linux-gnu/debug/deps" "-L" "/tmp/a/target/debug/deps" "-L" "/tmp/a/target/x86_64-unknown-linux-gnu/debug/build/backtrace-sys-23683e5572d20c8c/out" "-L" "/../.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/tmp/rustcgyDZiW/libbacktrace_sys-ba159dd14189807b.rlib" "-Wl,--end-group" "/tmp/a/target/x86_64-unknown-linux-gnu/debug/deps/libcompiler_builtins-495badfa0e51e0a1.rlib" "-Wl,-Bdynamic" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil"
= note: /usr/bin/ld: /tmp/a/target/x86_64-unknown-linux-gnu/debug/deps/libcompiler_builtins-495badfa0e51e0a1.rlib(compiler_builtins-495badfa0e51e0a1.compiler_builtins.ecun6ipv-cgu.15.rcgu.o): in function `<i128 as core::ops::arith::Sub>::sub':
/../.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/ops/arith.rs:194: undefined reference to `core::panicking::panic'
/usr/bin/ld: /tmp/a/target/x86_64-unknown-linux-gnu/debug/deps/libcompiler_builtins-495badfa0e51e0a1.rlib(compiler_builtins-495badfa0e51e0a1.compiler_builtins.ecun6ipv-cgu.11.rcgu.o): in function `compiler_builtins::int::sdiv::Div::div':
/../.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.25/src/int/sdiv.rs:6: undefined reference to `core::panicking::panic'
/usr/bin/ld: /../.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.25/src/int/sdiv.rs:7: undefined reference to `core::panicking::panic'
/usr/bin/ld: /tmp/a/target/x86_64-unknown-linux-gnu/debug/deps/libcompiler_builtins-495badfa0e51e0a1.rlib(compiler_builtins-495badfa0e51e0a1.compiler_builtins.ecun6ipv-cgu.11.rcgu.o): in function `compiler_builtins::int::sdiv::Mod::mod_':
/../.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.25/src/int/sdiv.rs:28: undefined reference to `core::panicking::panic'
/usr/bin/ld: /../.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.25/src/int/sdiv.rs:31: undefined reference to `core::panicking::panic'
/usr/bin/ld: /tmp/a/target/x86_64-unknown-linux-gnu/debug/deps/libcompiler_builtins-495badfa0e51e0a1.rlib(compiler_builtins-495badfa0e51e0a1.compiler_builtins.ecun6ipv-cgu.13.rcgu.o):/../.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/ops/bit.rs:515: more undefined references to `core::panicking::panic' follow
collect2: error: ld returned 1 exit status
error: aborting due to previous error
Looks like this is either an issue with compiler-builtins which should avoid
using any checked operations which could generate references to core crate, or
an issue with cargo -Zbuild-std
which should always built this crate with
-Coverflow-checks=no
.
We encountered a similar issue in https://github.com/cloud-hypervisor/rust-hypervisor-firmware/pull/69 where the following three features in combination resulted in a link failure:
- LTO
- debug build
-
-Zbuild-std
However, our issues weren't solved by just using overflow-checks = false
or by disabling debug assertions. We had to disable LTO or set opt-level = 1
.
The issue seems to be that when libcore
/compiler-builtins
is built with LTO, compiler-builtins
still needs to reference some functions from libcore
(like core::ptr::const_ptr::offset
or core::panicking::panic
). However, these functions get eliminated from the main binary due to LTO, so compiler-builtins
ends up with undefined references. This doesn't happen with opt-level = 1
as the calls from compiler-builtins
to libcore
are inlined, removing any LTO related issues.
This crate is designed to in theory not reference any symbols from libcore. If that happens there's a bug in this crate. For example no functions should panic, and nothing should be referencing functions upstream in libcore itself.
I'm also facing this on AVR:
Compiling arduino-leonardo v0.1.0 (/avr-hal/boards/arduino-leonardo)
error: linking with `avr-gcc` failed: exit code: 1
|
= note: "avr-gcc" "-mmcu=atmega32u4" "-Wl,--as-needed" "-L" "/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/avr-atmega32u4/lib" "/avr-hal/target/avr-atmega32u4/debug/examples/rahix_are_we_large_int_yet-2408b37d61755303.panic_halt-adf0e0db19dc9c4b.panic_halt.524x37ge-cgu.0.rcgu.o.rcgu.o" "-o" "/avr-hal/target/avr-atmega32u4/debug/examples/rahix_are_we_large_int_yet-2408b37d61755303.elf" "-Wl,--gc-sections" "-no-pie" "-L" "/avr-hal/target/avr-atmega32u4/debug/deps" "-L" "/avr-hal/target/debug/deps" "-L" "/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/avr-atmega32u4/lib" "-Wl,--start-group" "-Wl,--end-group" "-Wl,-Bstatic" "/avr-hal/target/avr-atmega32u4/debug/deps/libcompiler_builtins-03d212bc2672989c.rlib" "-Wl,-Bdynamic" "-lgcc"
= note: /usr/bin/avr-ld: /avr-hal/target/avr-atmega32u4/debug/deps/libcompiler_builtins-03d212bc2672989c.rlib(compiler_builtins-03d212bc2672989c.compiler_builtins.elxguzph-cgu.7.rcgu.o): in function `compiler_builtins::int::shift::Ashl::ashl':
/home/rahix/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.36/src/int/shift.rs:(.text._ZN17compiler_builtins3int5shift4Ashl4ashl17hfb01a5f265cfc56eE+0x150): undefined reference to `core::panicking::panic'
/usr/bin/avr-ld: /avr-hal/target/avr-atmega32u4/debug/deps/libcompiler_builtins-03d212bc2672989c.rlib(compiler_builtins-03d212bc2672989c.compiler_builtins.elxguzph-cgu.7.rcgu.o): in function `compiler_builtins::int::shift::Lshr::lshr':
/home/rahix/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.36/src/int/shift.rs:(.text._ZN17compiler_builtins3int5shift4Lshr4lshr17hdf6ef8cc4c3c992bE+0x1f8): undefined reference to `core::panicking::panic'
/usr/bin/avr-ld: /avr-hal/target/avr-atmega32u4/debug/deps/libcompiler_builtins-03d212bc2672989c.rlib(compiler_builtins-03d212bc2672989c.compiler_builtins.elxguzph-cgu.1.rcgu.o): in function `compiler_builtins::int::specialized_div_rem::u32_div_rem':
/home/rahix/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.36/src/int/specialized_div_rem/delegate.rs:95: undefined reference to `core::panicking::panic'
collect2: error: ld returned 1 exit status
However, for me, adding overflow-checks = false
does fix it:
[profile.dev.package.compiler_builtins]
overflow-checks = false
Curiously, I get a warning about this not being used, but it works:
warning: profile package spec `compiler_builtins` in profile `dev` did not match any packages
Compiling compiler_builtins v0.1.36
Compiling bare-metal v0.2.5
Compiling nb v1.0.0
Compiling vcell v0.1.2
[...]
Compiling arduino-leonardo v0.1.0 (/avr-hal/boards/arduino-leonardo)
Finished dev [optimized + debuginfo] target(s) in 11.24s
As @tmiasko wrote, maybe compiler-builtins
should actually specify overflow-checks = false
by itself?
I'm also seeing this with WASM: there's an undefined reference to _ZN4core9panicking5panic17he4861068bc6d1d99E
in __multi3
which causes wasm-bindgen
to fail with cannot import from modules ('env') with '--no-modules'
.
I see the same behaviour as @Rahix: the profile package spec triggers a warning but does actually work.
I encountered this issue as well, and fixed it with the setting mentioned by @Rahix . This issue cropped up in my program when I introduced a usage of core::cell::RefCell
, not sure if that's related. I found this comment by googling "avr undefined reference to core panicking panic"
I'd like to note that the issue still occurs (one year already) and existing workaround is slightly annoying when building crates.
This should be fixed in the latest version of compiler-builtins. If this problem still occurs, please show the error message that indicates which function is calling panic.
Testing with compiler-builtins 0.1.68, the original steps still reproduce the issue for me. Panics originate from arithmetic operations that perform overflow checks:
error: linking with `cc` failed: exit status: 1
|
= note: "cc" "-m64" "/tmp/a/target/x86_64-unknown-linux-gnu/debug/deps/a-67c5d10adbae7870.std-5f98db226bab3e6c.std.dd5d69d6-cgu.0.rcgu.o.rcgu.o" "-Wl,--as-needed" "-L" "/tmp/a/target/x86_64-unknown-linux-gnu/debug/deps" "-L" "/tmp/a/target/debug/deps" "-L" "/home/../rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,--start-group" "-Wl,--end-group" "-Wl,-Bstatic" "/tmp/a/target/x86_64-unknown-linux-gnu/debug/deps/libcompiler_builtins-89ced71a6bca4a7c.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/home/../rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/tmp/a/target/x86_64-unknown-linux-gnu/debug/deps/a-67c5d10adbae7870" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro,-znow" "-nodefaultlibs"
= note: /usr/bin/ld: /tmp/a/target/x86_64-unknown-linux-gnu/debug/deps/libcompiler_builtins-89ced71a6bca4a7c.rlib(compiler_builtins-89ced71a6bca4a7c.compiler_builtins.1a0b759d-cgu.14.rcgu.o): in function `<u128 as core::ops::arith::Add>::add':
/home/../rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/src/rust/library/core/src/ops/arith.rs:126: undefined reference to `core::panicking::panic'
/usr/bin/ld: /tmp/a/target/x86_64-unknown-linux-gnu/debug/deps/libcompiler_builtins-89ced71a6bca4a7c.rlib(compiler_builtins-89ced71a6bca4a7c.compiler_builtins.1a0b759d-cgu.14.rcgu.o): in function `<i16 as core::ops::arith::Sub>::sub':
/home/../rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/src/rust/library/core/src/ops/arith.rs:233: undefined reference to `core::panicking::panic'
/usr/bin/ld: /tmp/a/target/x86_64-unknown-linux-gnu/debug/deps/libcompiler_builtins-89ced71a6bca4a7c.rlib(compiler_builtins-89ced71a6bca4a7c.compiler_builtins.1a0b759d-cgu.14.rcgu.o): in function `<u128 as core::ops::arith::AddAssign>::add_assign':
/home/../rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/src/rust/library/core/src/ops/arith.rs:779: undefined reference to `core::panicking::panic'
/usr/bin/ld: /tmp/a/target/x86_64-unknown-linux-gnu/debug/deps/libcompiler_builtins-89ced71a6bca4a7c.rlib(compiler_builtins-89ced71a6bca4a7c.compiler_builtins.1a0b759d-cgu.14.rcgu.o): in function `<i16 as core::ops::arith::SubAssign>::sub_assign':
/home/../rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/src/rust/library/core/src/ops/arith.rs:846: undefined reference to `core::panicking::panic'
/usr/bin/ld: /tmp/a/target/x86_64-unknown-linux-gnu/debug/deps/libcompiler_builtins-89ced71a6bca4a7c.rlib(compiler_builtins-89ced71a6bca4a7c.compiler_builtins.1a0b759d-cgu.7.rcgu.o): in function `compiler_builtins::int::specialized_div_rem::u128_div_rem':
/home/../.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.68/src/int/specialized_div_rem/asymmetric.rs:51: undefined reference to `core::panicking::panic'
/usr/bin/ld: /tmp/a/target/x86_64-unknown-linux-gnu/debug/deps/libcompiler_builtins-89ced71a6bca4a7c.rlib(compiler_builtins-89ced71a6bca4a7c.compiler_builtins.1a0b759d-cgu.7.rcgu.o):/home/../.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.68/src/int/specialized_div_rem/asymmetric.rs:52: more undefined references to `core::panicking::panic' follow
collect2: error: ld returned 1 exit status
= help: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
= note: use the `-l` flag to specify native libraries to link
= note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)
This seems like an issue in cargo with -Zbuild-std. It needs to pass -C overflow-checks=off
when building the compiler-builtins crate.
There is an open issue for this: https://github.com/rust-lang/cargo/issues/10118
Alternatively we could also forcibly disable overflow checks in rustc by checking for the #![compiler_builtins]
attribute on the crate.
I think that would make sense for all arguments compiler-builtins needs to be compiled with.
https://github.com/rust-lang/rust/pull/73136 seems to have gone in the opposite direction of pushing the work to the build system. It seems that this should be resolved on the Cargo end.
I have no idea if this is actually related to this, but I'm having a very similiar issue, where instead core::intrinsics::const_eval_select
is not defined:
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/11.2.0/../../../../arm-none-eabi/bin/ld: /home/marco/dev/skytemple/c-of-time/rust/target/armv5te-none-ndseoseabi-na/release/deps/libcompiler_builtins-4db42bb517921098.rlib(compiler_builtins-4db42bb517921098.compiler_builtins.cebaf718-cgu.12.rcgu.o): in function `compiler_builtins::math::libm::fmod::fmod':
compiler_builtins.cebaf718-cgu.12:(.text._ZN17compiler_builtins4math4libm4fmod4fmod17h25ae2fa4b314b26dE+0x18): undefined reference to `core::intrinsics::const_eval_select'
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/11.2.0/../../../../arm-none-eabi/bin/ld: compiler_builtins.cebaf718-cgu.12:(.text._ZN17compiler_builtins4math4libm4fmod4fmod17h25ae2fa4b314b26dE+0x2c): undefined reference to `core::intrinsics::const_eval_select'
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/11.2.0/../../../../arm-none-eabi/bin/ld: compiler_builtins.cebaf718-cgu.12:(.text._ZN17compiler_builtins4math4libm4fmod4fmod17h25ae2fa4b314b26dE+0x2f8): undefined reference to `core::intrinsics::const_eval_select'
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/11.2.0/../../../../arm-none-eabi/bin/ld: /home/marco/dev/skytemple/c-of-time/rust/target/armv5te-none-ndseoseabi-na/release/deps/libcompiler_builtins-4db42bb517921098.rlib(compiler_builtins-4db42bb517921098.compiler_builtins.cebaf718-cgu.12.rcgu.o): in function `compiler_builtins::math::libm::fmodf::fmodf':
compiler_builtins.cebaf718-cgu.12:(.text._ZN17compiler_builtins4math4libm5fmodf5fmodf17h3963d5e1d57025b9E+0xc): undefined reference to `core::intrinsics::const_eval_select'
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/11.2.0/../../../../arm-none-eabi/bin/ld: compiler_builtins.cebaf718-cgu.12:(.text._ZN17compiler_builtins4math4libm5fmodf5fmodf17h3963d5e1d57025b9E+0x18): undefined reference to `core::intrinsics::const_eval_select'
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/11.2.0/../../../../arm-none-eabi/bin/ld: compiler_builtins.cebaf718-cgu.12:(.text._ZN17compiler_builtins4math4libm5fmodf5fmodf17h3963d5e1d57025b9E+0x1c0): undefined reference to `core::intrinsics::const_eval_select'
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/11.2.0/../../../../arm-none-eabi/bin/ld: /home/marco/dev/skytemple/c-of-time/rust/target/armv5te-none-ndseoseabi-na/release/deps/libcompiler_builtins-4db42bb517921098.rlib(compiler_builtins-4db42bb517921098.compiler_builtins.cebaf718-cgu.13.rcgu.o): in function `<f32 as compiler_builtins::float::Float>::repr':
compiler_builtins.cebaf718-cgu.13:(.text._ZN55_$LT$f32$u20$as$u20$compiler_builtins..float..Float$GT$4repr17h865871b0377279b5E+0x0): undefined reference to `core::intrinsics::const_eval_select'
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/11.2.0/../../../../arm-none-eabi/bin/ld: /home/marco/dev/skytemple/c-of-time/rust/target/armv5te-none-ndseoseabi-na/release/deps/libcompiler_builtins-4db42bb517921098.rlib(compiler_builtins-4db42bb517921098.compiler_builtins.cebaf718-cgu.13.rcgu.o): in function `<f32 as compiler_builtins::float::Float>::signed_repr':
compiler_builtins.cebaf718-cgu.13:(.text._ZN55_$LT$f32$u20$as$u20$compiler_builtins..float..Float$GT$11signed_repr17h245acc82dd75beb2E+0x0): undefined reference to `core::intrinsics::const_eval_select'
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/11.2.0/../../../../arm-none-eabi/bin/ld: /home/marco/dev/skytemple/c-of-time/rust/target/armv5te-none-ndseoseabi-na/release/deps/libcompiler_builtins-4db42bb517921098.rlib(compiler_builtins-4db42bb517921098.compiler_builtins.cebaf718-cgu.13.rcgu.o): in function `<f32 as compiler_builtins::float::Float>::eq_repr':
compiler_builtins.cebaf718-cgu.13:(.text._ZN55_$LT$f32$u20$as$u20$compiler_builtins..float..Float$GT$7eq_repr17hd6685e3571aee4d5E+0x38): undefined reference to `core::intrinsics::const_eval_select'
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/11.2.0/../../../../arm-none-eabi/bin/ld: compiler_builtins.cebaf718-cgu.13:(.text._ZN55_$LT$f32$u20$as$u20$compiler_builtins..float..Float$GT$7eq_repr17hd6685e3571aee4d5E+0x44): undefined reference to `core::intrinsics::const_eval_select'
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/11.2.0/../../../../arm-none-eabi/bin/ld: /home/marco/dev/skytemple/c-of-time/rust/target/armv5te-none-ndseoseabi-na/release/deps/libcompiler_builtins-4db42bb517921098.rlib(compiler_builtins-4db42bb517921098.compiler_builtins.cebaf718-cgu.13.rcgu.o): in function `<f32 as compiler_builtins::float::Float>::sign':
compiler_builtins.cebaf718-cgu.13:(.text._ZN55_$LT$f32$u20$as$u20$compiler_builtins..float..Float$GT$4sign17h60ecac555f14d8efE+0x4): undefined reference to `core::intrinsics::const_eval_select'
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/11.2.0/../../../../arm-none-eabi/bin/ld: /home/marco/dev/skytemple/c-of-time/rust/target/armv5te-none-ndseoseabi-na/release/deps/libcompiler_builtins-4db42bb517921098.rlib(compiler_builtins-4db42bb517921098.compiler_builtins.cebaf718-cgu.13.rcgu.o):compiler_builtins.cebaf718-cgu.13:(.text._ZN55_$LT$f32$u20$as$u20$compiler_builtins..float..Float$GT$3exp17h44175dba8c213c92E+0x4): more undefined references to `core::intrinsics::const_eval_select' follow
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/11.2.0/../../../../arm-none-eabi/bin/ld: /home/marco/dev/skytemple/c-of-time/rust/target/armv5te-none-ndseoseabi-na/release/deps/libcompiler_builtins-4db42bb517921098.rlib(compiler_builtins-4db42bb517921098.compiler_builtins.cebaf718-cgu.13.rcgu.o): in function `<f32 as compiler_builtins::float::Float>::from_repr':
compiler_builtins.cebaf718-cgu.13:(.text._ZN55_$LT$f32$u20$as$u20$compiler_builtins..float..Float$GT$9from_repr17h1068509a5ae84fdeE+0x0): undefined reference to `core::intrinsics::const_eval_select'
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/11.2.0/../../../../arm-none-eabi/bin/ld: /home/marco/dev/skytemple/c-of-time/rust/target/armv5te-none-ndseoseabi-na/release/deps/libcompiler_builtins-4db42bb517921098.rlib(compiler_builtins-4db42bb517921098.compiler_builtins.cebaf718-cgu.13.rcgu.o): in function `<f32 as compiler_builtins::float::Float>::from_parts':
compiler_builtins.cebaf718-cgu.13:(.text._ZN55_$LT$f32$u20$as$u20$compiler_builtins..float..Float$GT$10from_parts17h7cb9f07c47d7edd9E+0x20): undefined reference to `core::intrinsics::const_eval_select'
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/11.2.0/../../../../arm-none-eabi/bin/ld: /home/marco/dev/skytemple/c-of-time/rust/target/armv5te-none-ndseoseabi-na/release/deps/libcompiler_builtins-4db42bb517921098.rlib(compiler_builtins-4db42bb517921098.compiler_builtins.cebaf718-cgu.13.rcgu.o): in function `<f32 as compiler_builtins::float::Float>::is_subnormal':
compiler_builtins.cebaf718-cgu.13:(.text._ZN55_$LT$f32$u20$as$u20$compiler_builtins..float..Float$GT$12is_subnormal17hb245ebccceef8b17E+0x4): undefined reference to `core::intrinsics::const_eval_select'
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/11.2.0/../../../../arm-none-eabi/bin/ld: /home/marco/dev/skytemple/c-of-time/rust/target/armv5te-none-ndseoseabi-na/release/deps/libcompiler_builtins-4db42bb517921098.rlib(compiler_builtins-4db42bb517921098.compiler_builtins.cebaf718-cgu.13.rcgu.o): in function `<f64 as compiler_builtins::float::Float>::repr':
compiler_builtins.cebaf718-cgu.13:(.text._ZN55_$LT$f64$u20$as$u20$compiler_builtins..float..Float$GT$4repr17h64dcd09b782bff63E+0x0): undefined reference to `core::intrinsics::const_eval_select'
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/11.2.0/../../../../arm-none-eabi/bin/ld: /home/marco/dev/skytemple/c-of-time/rust/target/armv5te-none-ndseoseabi-na/release/deps/libcompiler_builtins-4db42bb517921098.rlib(compiler_builtins-4db42bb517921098.compiler_builtins.cebaf718-cgu.13.rcgu.o): in function `<f64 as compiler_builtins::float::Float>::signed_repr':
compiler_builtins.cebaf718-cgu.13:(.text._ZN55_$LT$f64$u20$as$u20$compiler_builtins..float..Float$GT$11signed_repr17h21b48b45a582f638E+0x0): undefined reference to `core::intrinsics::const_eval_select'
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/11.2.0/../../../../arm-none-eabi/bin/ld: /home/marco/dev/skytemple/c-of-time/rust/target/armv5te-none-ndseoseabi-na/release/deps/libcompiler_builtins-4db42bb517921098.rlib(compiler_builtins-4db42bb517921098.compiler_builtins.cebaf718-cgu.13.rcgu.o): in function `<f64 as compiler_builtins::float::Float>::eq_repr':
compiler_builtins.cebaf718-cgu.13:(.text._ZN55_$LT$f64$u20$as$u20$compiler_builtins..float..Float$GT$7eq_repr17hf52be5534007befeE+0x50): undefined reference to `core::intrinsics::const_eval_select'
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/11.2.0/../../../../arm-none-eabi/bin/ld: compiler_builtins.cebaf718-cgu.13:(.text._ZN55_$LT$f64$u20$as$u20$compiler_builtins..float..Float$GT$7eq_repr17hf52be5534007befeE+0x64): undefined reference to `core::intrinsics::const_eval_select'
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/11.2.0/../../../../arm-none-eabi/bin/ld: /home/marco/dev/skytemple/c-of-time/rust/target/armv5te-none-ndseoseabi-na/release/deps/libcompiler_builtins-4db42bb517921098.rlib(compiler_builtins-4db42bb517921098.compiler_builtins.cebaf718-cgu.13.rcgu.o): in function `<f64 as compiler_builtins::float::Float>::sign':
compiler_builtins.cebaf718-cgu.13:(.text._ZN55_$LT$f64$u20$as$u20$compiler_builtins..float..Float$GT$4sign17hbacb426d56723aeeE+0x4): undefined reference to `core::intrinsics::const_eval_select'
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/11.2.0/../../../../arm-none-eabi/bin/ld: /home/marco/dev/skytemple/c-of-time/rust/target/armv5te-none-ndseoseabi-na/release/deps/libcompiler_builtins-4db42bb517921098.rlib(compiler_builtins-4db42bb517921098.compiler_builtins.cebaf718-cgu.13.rcgu.o):compiler_builtins.cebaf718-cgu.13:(.text._ZN55_$LT$f64$u20$as$u20$compiler_builtins..float..Float$GT$3exp17heb46918281e5eb04E+0x4): more undefined references to `core::intrinsics::const_eval_select' follow
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/11.2.0/../../../../arm-none-eabi/bin/ld: /home/marco/dev/skytemple/c-of-time/rust/target/armv5te-none-ndseoseabi-na/release/deps/libcompiler_builtins-4db42bb517921098.rlib(compiler_builtins-4db42bb517921098.compiler_builtins.cebaf718-cgu.13.rcgu.o): in function `<f64 as compiler_builtins::float::Float>::from_repr':
compiler_builtins.cebaf718-cgu.13:(.text._ZN55_$LT$f64$u20$as$u20$compiler_builtins..float..Float$GT$9from_repr17h053dd8552b78df79E+0x0): undefined reference to `core::intrinsics::const_eval_select'
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/11.2.0/../../../../arm-none-eabi/bin/ld: /home/marco/dev/skytemple/c-of-time/rust/target/armv5te-none-ndseoseabi-na/release/deps/libcompiler_builtins-4db42bb517921098.rlib(compiler_builtins-4db42bb517921098.compiler_builtins.cebaf718-cgu.13.rcgu.o): in function `<f64 as compiler_builtins::float::Float>::from_parts':
compiler_builtins.cebaf718-cgu.13:(.text._ZN55_$LT$f64$u20$as$u20$compiler_builtins..float..Float$GT$10from_parts17h8d491e235ce0449dE+0x28): undefined reference to `core::intrinsics::const_eval_select'
/opt/devkitpro/devkitARM/bin/../lib/gcc/arm-none-eabi/11.2.0/../../../../arm-none-eabi/bin/ld: /home/marco/dev/skytemple/c-of-time/rust/target/armv5te-none-ndseoseabi-na/release/deps/libcompiler_builtins-4db42bb517921098.rlib(compiler_builtins-4db42bb517921098.compiler_builtins.cebaf718-cgu.13.rcgu.o): in function `<f64 as compiler_builtins::float::Float>::is_subnormal':
compiler_builtins.cebaf718-cgu.13:(.text._ZN55_$LT$f64$u20$as$u20$compiler_builtins..float..Float$GT$12is_subnormal17h5cb2deab8c33f6a9E+0x4): undefined reference to `core::intrinsics::const_eval_select'
Any help would be appreciated, because I'm a bit lost here.
Ah, also: In dev profile I instead get the panicking issue. So I guess this is related. But I can't really get rid of the intrinstics issue by disabling overflow checks...
So it seems like a lot of stuff calls core::intrinsics::const_eval_select
, would it be possible to mark it as #[inline(always)]
to avoid such issues?
@theCapypara it might be worth it to mention your issue in https://github.com/rust-lang/rust/issues/96486
For reference, I provided some more background into my particular case here: https://github.com/rust-lang/rust/issues/96486#issuecomment-1118315282
I have seen this problem as well. But my kernel compiled just fine. I was seeing this when I was building a UEFI based bootloader with this particular workspace profile:
[profile.min-size-release]
inherits = "release"
codegen-units = 1
lto = "fat"
opt-level = "s"
I have no idea why.