Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined floating point symbols on aarch64-unknown-uefi and i686-unknown-uefi #119019

Closed
radioactiveray opened this issue Dec 16, 2023 · 4 comments
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. O-AArch64 Armv8-A or later processors in AArch64 mode O-UEFI UEFI T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@radioactiveray
Copy link

I have the following code to reproduce the problem occured during the compilation or probably linking:

fn main() {
    let a: f32 = 1.5;
    let mut b: f32 = 2.5;
    let c = a % b;
    b %= c;
    println!("B: {}", b);
}

It is stored in an cargo package with the name "ex2"
I tried to compile this code for aarch64-unknown-uefi and i686-unknown-uefi but I got a linking error.
I could determine from the original error that it has something to do with the remainder operator % and %= and created the example code above!

So instead of successfully compiling and linking, linking fails, and this happened:
I got an linking error for both targets
for i686-unknown-uefi:

username@MacBook-Pro ex2 % cargo build --target i686-unknown-uefi
   Compiling ex2 v0.1.0 (/Users/username/Downloads/ex2)
error: linking with `rust-lld` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/bin:/opt/homebrew/opt/llvm/bin:/Users/username/.bun/bin:/opt/homebrew/opt/icu4c/sbin:/opt/homebrew/opt/icu4c/bin:/opt/homebrew/opt/icu4c/sbin:/opt/homebrew/opt/icu4c/bin:/opt/homebrew/opt/icu4c/sbin:/opt/homebrew/opt/icu4c/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/Cellar/llvm/16.0.6/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/ruby/bin:/Library/Frameworks/Python.framework/Versions/3.11/bin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Library/Frameworks/Python.framework/Versions/3.9/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/X11/bin:/Library/Apple/usr/bin:/Users/username/.cargo/bin" VSLANG="1033" "rust-lld" "-flavor" "link" "/NOLOGO" "/entry:efi_main" "/subsystem:efi_application" "/var/folders/gv/wn3vglhn6c1_0t217lvltjwh0000gn/T/rustcgPkc1x/symbols.o" "/Users/username/Downloads/ex2/target/i686-unknown-uefi/debug/deps/ex2-1b2e3615c92d76f1.2nt2y5gpv4yt3xk3.rcgu.o" "/Users/username/Downloads/ex2/target/i686-unknown-uefi/debug/deps/ex2-1b2e3615c92d76f1.4ezio3ls8fxbjkrl.rcgu.o" "/Users/username/Downloads/ex2/target/i686-unknown-uefi/debug/deps/ex2-1b2e3615c92d76f1.4jvc0vxvfvn11cal.rcgu.o" "/Users/username/Downloads/ex2/target/i686-unknown-uefi/debug/deps/ex2-1b2e3615c92d76f1.4nlvq803p7y312p6.rcgu.o" "/Users/username/Downloads/ex2/target/i686-unknown-uefi/debug/deps/ex2-1b2e3615c92d76f1.tu3jsdgq3f563ck.rcgu.o" "/Users/username/Downloads/ex2/target/i686-unknown-uefi/debug/deps/ex2-1b2e3615c92d76f1.vuuyty2xvpioi23.rcgu.o" "/Users/username/Downloads/ex2/target/i686-unknown-uefi/debug/deps/ex2-1b2e3615c92d76f1.2jbqfwdd0tjpqxc8.rcgu.o" "/LIBPATH:/Users/username/Downloads/ex2/target/i686-unknown-uefi/debug/deps" "/LIBPATH:/Users/username/Downloads/ex2/target/debug/deps" "/LIBPATH:/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/libstd-7e7eb2062a142a3e.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/libpanic_abort-36055457cbe0f850.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/libr_efi_alloc-64927457facf34ab.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/libr_efi-2a1e98549a7a00a3.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/librustc_demangle-7e037608473db5f3.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/libstd_detect-132d557b2a09b864.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/libhashbrown-c715bed4850f7834.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/librustc_std_workspace_alloc-fbe0241b636787e7.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/libminiz_oxide-6a445fca4be70af4.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/libadler-84b1d06710df4508.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/libunwind-82bbd58025dda93f.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/libcfg_if-3ad873c706c6fc66.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/liblibc-78116445f3ae4a07.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/liballoc-d1446abb07db39d6.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/librustc_std_workspace_core-1a18fcda0162af1a.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/libcore-f8a59c1f7ffdbc09.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/libcompiler_builtins-d8f60dd2696e72df.rlib" "/NXCOMPAT" "/LIBPATH:/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib" "/OUT:/Users/username/Downloads/ex2/target/i686-unknown-uefi/debug/deps/ex2-1b2e3615c92d76f1.efi" "/OPT:REF,NOICF" "/DEBUG" "/NODEFAULTLIB"
  = note: rust-lld: error: undefined symbol: _fmodf
          >>> referenced by /Users/username/Downloads/ex2/src/main.rs:5
          >>>               /Users/username/Downloads/ex2/target/i686-unknown-uefi/debug/deps/ex2-1b2e3615c92d76f1.4ezio3ls8fxbjkrl.rcgu.o:(ex2::main::h0c0a4be9d6555d8f)
          >>> referenced by /Users/username/Downloads/ex2/src/main.rs:6
          >>>               /Users/username/Downloads/ex2/target/i686-unknown-uefi/debug/deps/ex2-1b2e3615c92d76f1.4ezio3ls8fxbjkrl.rcgu.o:(ex2::main::h0c0a4be9d6555d8f)
          

error: could not compile `ex2` (bin "ex2") due to previous error

and the same happened for aarch64-unknown-uefi:

username@MacBook-Pro ex2 % cargo build --target aarch64-unknown-uefi
   Compiling ex2 v0.1.0 (/Users/username/Downloads/ex2)
error: linking with `rust-lld` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/bin:/opt/homebrew/opt/llvm/bin:/Users/username/.bun/bin:/opt/homebrew/opt/icu4c/sbin:/opt/homebrew/opt/icu4c/bin:/opt/homebrew/opt/icu4c/sbin:/opt/homebrew/opt/icu4c/bin:/opt/homebrew/opt/icu4c/sbin:/opt/homebrew/opt/icu4c/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/Cellar/llvm/16.0.6/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/ruby/bin:/Library/Frameworks/Python.framework/Versions/3.11/bin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Library/Frameworks/Python.framework/Versions/3.9/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/X11/bin:/Library/Apple/usr/bin:/Users/username/.cargo/bin" VSLANG="1033" "rust-lld" "-flavor" "link" "/NOLOGO" "/entry:efi_main" "/subsystem:efi_application" "/machine:arm64" "/var/folders/gv/wn3vglhn6c1_0t217lvltjwh0000gn/T/rustcfvlUlB/symbols.o" "/Users/username/Downloads/ex2/target/aarch64-unknown-uefi/debug/deps/ex2-40e49d99a1ba38d5.3n5kea1bbzqv9exw.rcgu.o" "/Users/username/Downloads/ex2/target/aarch64-unknown-uefi/debug/deps/ex2-40e49d99a1ba38d5.3s6as3gzpgkhm1lb.rcgu.o" "/Users/username/Downloads/ex2/target/aarch64-unknown-uefi/debug/deps/ex2-40e49d99a1ba38d5.48zjmqduziw8znvq.rcgu.o" "/Users/username/Downloads/ex2/target/aarch64-unknown-uefi/debug/deps/ex2-40e49d99a1ba38d5.4n3zypb28wcsgae7.rcgu.o" "/Users/username/Downloads/ex2/target/aarch64-unknown-uefi/debug/deps/ex2-40e49d99a1ba38d5.4tn53av522z357v6.rcgu.o" "/Users/username/Downloads/ex2/target/aarch64-unknown-uefi/debug/deps/ex2-40e49d99a1ba38d5.5bjc1y9grdkfp6vp.rcgu.o" "/Users/username/Downloads/ex2/target/aarch64-unknown-uefi/debug/deps/ex2-40e49d99a1ba38d5.2e167e6ucqjwaehl.rcgu.o" "/LIBPATH:/Users/username/Downloads/ex2/target/aarch64-unknown-uefi/debug/deps" "/LIBPATH:/Users/username/Downloads/ex2/target/debug/deps" "/LIBPATH:/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/libstd-045ee8b849b30216.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/libpanic_abort-c732a680599a6eeb.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/libr_efi_alloc-26d551f77507b9ac.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/libr_efi-6f81a053f87c571f.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/librustc_demangle-f6c09371e3a8b4dd.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/libstd_detect-6ccc2cd4d08e2616.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/libhashbrown-4795e194fbfd757a.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/librustc_std_workspace_alloc-f20462b0ce198a27.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/libminiz_oxide-700adc019a42334f.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/libadler-3d455cdb3342002c.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/libunwind-0c051c2a79d70599.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/libcfg_if-e42d98bd1229a159.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/liblibc-adf453a07c32158a.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/liballoc-bed710ebc6362cc8.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/librustc_std_workspace_core-007be4a60b9b0158.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/libcore-a87d1789f559fcdd.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/libcompiler_builtins-b22895ca42b8fa2f.rlib" "/NXCOMPAT" "/LIBPATH:/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib" "/OUT:/Users/username/Downloads/ex2/target/aarch64-unknown-uefi/debug/deps/ex2-40e49d99a1ba38d5.efi" "/OPT:REF,NOICF" "/DEBUG" "/NODEFAULTLIB"
  = note: rust-lld: error: undefined symbol: fmodf
          >>> referenced by /Users/username/Downloads/ex2/src/main.rs:5
          >>>               /Users/username/Downloads/ex2/target/aarch64-unknown-uefi/debug/deps/ex2-40e49d99a1ba38d5.4tn53av522z357v6.rcgu.o:(ex2::main::h6ceee2e1b3b2c246)
          >>> referenced by /Users/username/Downloads/ex2/src/main.rs:6
          >>>               /Users/username/Downloads/ex2/target/aarch64-unknown-uefi/debug/deps/ex2-40e49d99a1ba38d5.4tn53av522z357v6.rcgu.o:(ex2::main::h6ceee2e1b3b2c246)
          

error: could not compile `ex2` (bin "ex2") due to previous error

It works fine for x86_64-unknown-uefi but not for the other *-unknown-uefi targets
for x86_64-unknown-uefi:

username@MacBook-Pro ex2 % cargo build --target x86_64-unknown-uefi
   Compiling ex2 v0.1.0 (/Users/username/Downloads/ex2)
    Finished dev [unoptimized + debuginfo] target(s) in 0.29s

Meta

rustc --version --verbose:

rustc 1.74.0 (79e9716c9 2023-11-13)
binary: rustc
commit-hash: 79e9716c980570bfd1f666e3b16ac583f0168962
commit-date: 2023-11-13
host: aarch64-apple-darwin
release: 1.74.0
LLVM version: 17.0.4
Backtrace

username@MacBook-Pro src % RUST_BACKTRACE=1 cargo build --target x86_64-unknown-uefi
   Compiling ex2 v0.1.0 (/Users/username/Downloads/ex2)
    Finished dev [unoptimized + debuginfo] target(s) in 0.70s
username@MacBook-Pro src % RUST_BACKTRACE=1 cargo build --target i686-unknown-uefi
   Compiling ex2 v0.1.0 (/Users/username/Downloads/ex2)
error: linking with `rust-lld` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/bin:/opt/homebrew/opt/llvm/bin:/Users/username/.bun/bin:/opt/homebrew/opt/icu4c/sbin:/opt/homebrew/opt/icu4c/bin:/opt/homebrew/opt/icu4c/sbin:/opt/homebrew/opt/icu4c/bin:/opt/homebrew/opt/icu4c/sbin:/opt/homebrew/opt/icu4c/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/Cellar/llvm/16.0.6/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/ruby/bin:/Library/Frameworks/Python.framework/Versions/3.11/bin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Library/Frameworks/Python.framework/Versions/3.9/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/X11/bin:/Library/Apple/usr/bin:/Users/username/.cargo/bin" VSLANG="1033" "rust-lld" "-flavor" "link" "/NOLOGO" "/entry:efi_main" "/subsystem:efi_application" "/var/folders/gv/wn3vglhn6c1_0t217lvltjwh0000gn/T/rustcdM4lPN/symbols.o" "/Users/username/Downloads/ex2/target/i686-unknown-uefi/debug/deps/ex2-1b2e3615c92d76f1.2nt2y5gpv4yt3xk3.rcgu.o" "/Users/username/Downloads/ex2/target/i686-unknown-uefi/debug/deps/ex2-1b2e3615c92d76f1.4ezio3ls8fxbjkrl.rcgu.o" "/Users/username/Downloads/ex2/target/i686-unknown-uefi/debug/deps/ex2-1b2e3615c92d76f1.4jvc0vxvfvn11cal.rcgu.o" "/Users/username/Downloads/ex2/target/i686-unknown-uefi/debug/deps/ex2-1b2e3615c92d76f1.4nlvq803p7y312p6.rcgu.o" "/Users/username/Downloads/ex2/target/i686-unknown-uefi/debug/deps/ex2-1b2e3615c92d76f1.tu3jsdgq3f563ck.rcgu.o" "/Users/username/Downloads/ex2/target/i686-unknown-uefi/debug/deps/ex2-1b2e3615c92d76f1.vuuyty2xvpioi23.rcgu.o" "/Users/username/Downloads/ex2/target/i686-unknown-uefi/debug/deps/ex2-1b2e3615c92d76f1.2jbqfwdd0tjpqxc8.rcgu.o" "/LIBPATH:/Users/username/Downloads/ex2/target/i686-unknown-uefi/debug/deps" "/LIBPATH:/Users/username/Downloads/ex2/target/debug/deps" "/LIBPATH:/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/libstd-7e7eb2062a142a3e.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/libpanic_abort-36055457cbe0f850.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/libr_efi_alloc-64927457facf34ab.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/libr_efi-2a1e98549a7a00a3.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/librustc_demangle-7e037608473db5f3.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/libstd_detect-132d557b2a09b864.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/libhashbrown-c715bed4850f7834.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/librustc_std_workspace_alloc-fbe0241b636787e7.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/libminiz_oxide-6a445fca4be70af4.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/libadler-84b1d06710df4508.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/libunwind-82bbd58025dda93f.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/libcfg_if-3ad873c706c6fc66.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/liblibc-78116445f3ae4a07.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/liballoc-d1446abb07db39d6.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/librustc_std_workspace_core-1a18fcda0162af1a.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/libcore-f8a59c1f7ffdbc09.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib/libcompiler_builtins-d8f60dd2696e72df.rlib" "/NXCOMPAT" "/LIBPATH:/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/i686-unknown-uefi/lib" "/OUT:/Users/username/Downloads/ex2/target/i686-unknown-uefi/debug/deps/ex2-1b2e3615c92d76f1.efi" "/OPT:REF,NOICF" "/DEBUG" "/NODEFAULTLIB"
  = note: rust-lld: error: undefined symbol: _fmodf
          >>> referenced by /Users/username/Downloads/ex2/src/main.rs:5
          >>>               /Users/username/Downloads/ex2/target/i686-unknown-uefi/debug/deps/ex2-1b2e3615c92d76f1.4ezio3ls8fxbjkrl.rcgu.o:(ex2::main::h0c0a4be9d6555d8f)
          >>> referenced by /Users/username/Downloads/ex2/src/main.rs:6
          >>>               /Users/username/Downloads/ex2/target/i686-unknown-uefi/debug/deps/ex2-1b2e3615c92d76f1.4ezio3ls8fxbjkrl.rcgu.o:(ex2::main::h0c0a4be9d6555d8f)
          

error: could not compile `ex2` (bin "ex2") due to previous error
username@MacBook-Pro src % RUST_BACKTRACE=1 cargo build --target aarch64-unknown-uefi
   Compiling ex2 v0.1.0 (/Users/username/Downloads/ex2)
error: linking with `rust-lld` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/bin:/opt/homebrew/opt/llvm/bin:/Users/username/.bun/bin:/opt/homebrew/opt/icu4c/sbin:/opt/homebrew/opt/icu4c/bin:/opt/homebrew/opt/icu4c/sbin:/opt/homebrew/opt/icu4c/bin:/opt/homebrew/opt/icu4c/sbin:/opt/homebrew/opt/icu4c/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/Cellar/llvm/16.0.6/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/opt/ruby/bin:/Library/Frameworks/Python.framework/Versions/3.11/bin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Library/Frameworks/Python.framework/Versions/3.9/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/X11/bin:/Library/Apple/usr/bin:/Users/username/.cargo/bin" VSLANG="1033" "rust-lld" "-flavor" "link" "/NOLOGO" "/entry:efi_main" "/subsystem:efi_application" "/machine:arm64" "/var/folders/gv/wn3vglhn6c1_0t217lvltjwh0000gn/T/rustcGV3nJA/symbols.o" "/Users/username/Downloads/ex2/target/aarch64-unknown-uefi/debug/deps/ex2-40e49d99a1ba38d5.3n5kea1bbzqv9exw.rcgu.o" "/Users/username/Downloads/ex2/target/aarch64-unknown-uefi/debug/deps/ex2-40e49d99a1ba38d5.3s6as3gzpgkhm1lb.rcgu.o" "/Users/username/Downloads/ex2/target/aarch64-unknown-uefi/debug/deps/ex2-40e49d99a1ba38d5.48zjmqduziw8znvq.rcgu.o" "/Users/username/Downloads/ex2/target/aarch64-unknown-uefi/debug/deps/ex2-40e49d99a1ba38d5.4n3zypb28wcsgae7.rcgu.o" "/Users/username/Downloads/ex2/target/aarch64-unknown-uefi/debug/deps/ex2-40e49d99a1ba38d5.4tn53av522z357v6.rcgu.o" "/Users/username/Downloads/ex2/target/aarch64-unknown-uefi/debug/deps/ex2-40e49d99a1ba38d5.5bjc1y9grdkfp6vp.rcgu.o" "/Users/username/Downloads/ex2/target/aarch64-unknown-uefi/debug/deps/ex2-40e49d99a1ba38d5.2e167e6ucqjwaehl.rcgu.o" "/LIBPATH:/Users/username/Downloads/ex2/target/aarch64-unknown-uefi/debug/deps" "/LIBPATH:/Users/username/Downloads/ex2/target/debug/deps" "/LIBPATH:/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/libstd-045ee8b849b30216.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/libpanic_abort-c732a680599a6eeb.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/libr_efi_alloc-26d551f77507b9ac.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/libr_efi-6f81a053f87c571f.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/librustc_demangle-f6c09371e3a8b4dd.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/libstd_detect-6ccc2cd4d08e2616.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/libhashbrown-4795e194fbfd757a.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/librustc_std_workspace_alloc-f20462b0ce198a27.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/libminiz_oxide-700adc019a42334f.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/libadler-3d455cdb3342002c.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/libunwind-0c051c2a79d70599.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/libcfg_if-e42d98bd1229a159.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/liblibc-adf453a07c32158a.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/liballoc-bed710ebc6362cc8.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/librustc_std_workspace_core-007be4a60b9b0158.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/libcore-a87d1789f559fcdd.rlib" "/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib/libcompiler_builtins-b22895ca42b8fa2f.rlib" "/NXCOMPAT" "/LIBPATH:/Users/username/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-unknown-uefi/lib" "/OUT:/Users/username/Downloads/ex2/target/aarch64-unknown-uefi/debug/deps/ex2-40e49d99a1ba38d5.efi" "/OPT:REF,NOICF" "/DEBUG" "/NODEFAULTLIB"
  = note: rust-lld: error: undefined symbol: fmodf
          >>> referenced by /Users/username/Downloads/ex2/src/main.rs:5
          >>>               /Users/username/Downloads/ex2/target/aarch64-unknown-uefi/debug/deps/ex2-40e49d99a1ba38d5.4tn53av522z357v6.rcgu.o:(ex2::main::h6ceee2e1b3b2c246)
          >>> referenced by /Users/username/Downloads/ex2/src/main.rs:6
          >>>               /Users/username/Downloads/ex2/target/aarch64-unknown-uefi/debug/deps/ex2-40e49d99a1ba38d5.4tn53av522z357v6.rcgu.o:(ex2::main::h6ceee2e1b3b2c246)
          

error: could not compile `ex2` (bin "ex2") due to previous error

@radioactiveray radioactiveray added the C-bug Category: This is a bug. label Dec 16, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 16, 2023
@Jules-Bertholet
Copy link
Contributor

Jules-Bertholet commented Dec 16, 2023

@rustbot label A-linkage O-UEFI

@rustbot rustbot added A-linkage Area: linking into static, shared libraries and binaries O-UEFI UEFI labels Dec 16, 2023
@Noratrieb Noratrieb added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. O-AArch64 Armv8-A or later processors in AArch64 mode and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Dec 16, 2023
@bjorn3
Copy link
Member

bjorn3 commented Dec 16, 2023

fmodf should be defined by compiler-builtins when compiling for uefi: https://github.com/rust-lang/compiler-builtins/blob/80ed5f8c3ddbea7986c4a8243e42b963cb954b42/src/math.rs#L56

@taiki-e
Copy link
Member

taiki-e commented Dec 17, 2023

This should be fixed in rust-lang/compiler-builtins@588cc2a, and the fix should be available in Rust 1.75+ (#117581).

@radioactiveray
Copy link
Author

The issue been fixed in Rust 1.75+ and the example compiles

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. O-AArch64 Armv8-A or later processors in AArch64 mode O-UEFI UEFI T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants