Skip to content

fmodf symbol missing on i686-unknown-uefi since nightly-2024-07-30 #128533

Closed
@YtvwlD

Description

@YtvwlD

I'm using (a library that uses) floating point math on UEFI targets. For quite some time, fmodf was missing on i686-unknown-uefi (but available on x86_64-unknown-uefi). Since rust-lang/compiler-builtins#490, rust-lang/compiler-builtins#553, #119019, this was available, but it's gone missing a few days ago. I suspect it's due to this update to compiler-builtins, but I have not confirmed it.

Code

This is a minimal (but nonsensical) example code that compiles:

#![no_std]
#![no_main]

extern "C" { fn fmodf(); }

use core::panic::PanicInfo;

#[panic_handler]
fn panic(_: &PanicInfo) -> ! {
        loop {}
}

#[no_mangle]
pub fn efi_main() {
        unsafe { fmodf(); }
}

I expected to see this happen: The code should should compile.

Instead, this happened:

$ cargo build --target i686-unknown-uefi
   Compiling foo v0.1.0 (/tmp/tmp.4CIirv1HGb/foo)
error: linking with `rust-lld` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/niklas/.rustup/toolchains/nightly-2024-07-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/niklas/.rustup/toolchains/nightly-2024-07-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/niklas/.rustup/toolchains/nightly-2024-07-30-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/niklas/.local/bin:/home/niklas/.cargo/bin:/home/niklas/.gopath/bin:/home/niklas/bin:/snap/bin:/home/niklas/.local/bin:/home/niklas/.cargo/bin:/home/niklas/.gopath/bin:/home/niklas/bin:/snap/bin" VSLANG="1033" "rust-lld" "-flavor" "link" "/NOLOGO" "/entry:efi_main" "/subsystem:efi_application" "/tmp/rustckZUbYQ/symbols.o" "/tmp/tmp.4CIirv1HGb/foo/target/i686-unknown-uefi/debug/deps/foo-b50eac0687aac12d.21wnwtpp1uzembi52ejbydrsb.rcgu.o" "/LIBPATH:/tmp/tmp.4CIirv1HGb/foo/target/i686-unknown-uefi/debug/deps" "/LIBPATH:/tmp/tmp.4CIirv1HGb/foo/target/debug/deps" "/LIBPATH:/home/niklas/.rustup/toolchains/nightly-2024-07-30-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-uefi/lib" "/home/niklas/.rustup/toolchains/nightly-2024-07-30-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-uefi/lib/librustc_std_workspace_core-26a6383b0ec19675.rlib" "/home/niklas/.rustup/toolchains/nightly-2024-07-30-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-uefi/lib/libcore-70427371e67f0ba1.rlib" "/home/niklas/.rustup/toolchains/nightly-2024-07-30-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-uefi/lib/libcompiler_builtins-f2416250465866e5.rlib" "/NXCOMPAT" "/LIBPATH:/home/niklas/.rustup/toolchains/nightly-2024-07-30-x86_64-unknown-linux-gnu/lib/rustlib/i686-unknown-uefi/lib" "/OUT:/tmp/tmp.4CIirv1HGb/foo/target/i686-unknown-uefi/debug/deps/foo-b50eac0687aac12d.efi" "/OPT:REF,NOICF" "/DEBUG" "/PDBALTPATH:%_PDB%" "/NODEFAULTLIB"
  = note: rust-lld: error: undefined symbol: _fmodf
          >>> referenced by /tmp/tmp.4CIirv1HGb/foo/src/main.rs:15
          >>>               /tmp/tmp.4CIirv1HGb/foo/target/i686-unknown-uefi/debug/deps/foo-b50eac0687aac12d.21wnwtpp1uzembi52ejbydrsb.rcgu.o:(_efi_main)
          

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

Version it worked on

It most recently worked on:

$ rustc --version --verbose
rustc 1.82.0-nightly (2cbbe8b8b 2024-07-28)
binary: rustc
commit-hash: 2cbbe8b8bb2be672b14cf741a2f0ec24a49f3f0b
commit-date: 2024-07-28
host: x86_64-unknown-linux-gnu
release: 1.82.0-nightly
LLVM version: 18.1.7

Version with regression

$ rustc --version --verbose
rustc 1.82.0-nightly (612a33f20 2024-07-29)
binary: rustc
commit-hash: 612a33f20b9b2c27380edbc4b26a01433ed114bc
commit-date: 2024-07-29
host: x86_64-unknown-linux-gnu
release: 1.82.0-nightly
LLVM version: 18.1.7

Backtrace

There's no crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.O-UEFIUEFIregression-untriagedUntriaged performance or correctness regression.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions