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 x86_64-unknown-none #509

Closed
mkroening opened this issue Dec 7, 2022 · 0 comments · Fixed by #510
Closed

Undefined floating point symbols on x86_64-unknown-none #509

mkroening opened this issue Dec 7, 2022 · 0 comments · Fixed by #510

Comments

@mkroening
Copy link
Contributor

The following symbols are not available on x86_64-unknown-none:

  • fmin
  • fminf
  • fmax
  • fmaxf
  • fmod
  • fmodf

Reproduction:

// foo.rs
#![no_std]
#![no_main]

#[no_mangle]
pub extern "C" fn _start() -> ! {
    use core::hint::black_box;

    let f = black_box(1.0_f32);
    black_box(f.min(1.0));
    black_box(f.max(1.0));
    black_box(f % 1.0);

    let f = black_box(1.0_f64);
    black_box(f.min(1.0));
    black_box(f.max(1.0));
    black_box(f % 1.0);

    panic!()
}

#[panic_handler]
fn panic(_: &core::panic::PanicInfo) -> ! {
    loop {}
}
$ rustc +nightly-2022-12-07 --target x86_64-unknown-none foo.rs
error: linking with `rust-lld` failed: exit status: 1
  |
  = note: "rust-lld" "-flavor" "gnu" "/var/folders/25/fkdqct450w39l8ws39k941jh0000gn/T/rustceBzca5/symbols.o" "foo.foo.aba6b5b9-cgu.0.rcgu.o" "foo.foo.aba6b5b9-cgu.1.rcgu.o" "foo.foo.aba6b5b9-cgu.2.rcgu.o" "foo.foo.aba6b5b9-cgu.3.rcgu.o" "--as-needed" "-L" "/Users/mkroening/.rustup/toolchains/nightly-2022-12-07-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-none/lib" "-Bstatic" "/Users/mkroening/.rustup/toolchains/nightly-2022-12-07-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-none/lib/librustc_std_workspace_core-4bf14777d6346759.rlib" "/Users/mkroening/.rustup/toolchains/nightly-2022-12-07-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-none/lib/libcore-205d88bf497b2586.rlib" "/Users/mkroening/.rustup/toolchains/nightly-2022-12-07-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-none/lib/libcompiler_builtins-f0aaa0512d1a096b.rlib" "-Bdynamic" "--eh-frame-hdr" "-znoexecstack" "-L" "/Users/mkroening/.rustup/toolchains/nightly-2022-12-07-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-none/lib" "-o" "foo" "--gc-sections" "-pie" "-zrelro" "-znow"
  = note: rust-lld: error: undefined symbol: fmax
          >>> referenced by foo.aba6b5b9-cgu.1
          >>>               foo.foo.aba6b5b9-cgu.1.rcgu.o:(core::f64::_$LT$impl$u20$f64$GT$::max::hb8f56ded435178fc)
          
          rust-lld: error: undefined symbol: fmin
          >>> referenced by foo.aba6b5b9-cgu.1
          >>>               foo.foo.aba6b5b9-cgu.1.rcgu.o:(core::f64::_$LT$impl$u20$f64$GT$::min::h96fdc18609326941)
          
          rust-lld: error: undefined symbol: fmodf
          >>> referenced by foo.aba6b5b9-cgu.2
          >>>               foo.foo.aba6b5b9-cgu.2.rcgu.o:(_start)
          
          rust-lld: error: undefined symbol: fmod
          >>> referenced by foo.aba6b5b9-cgu.2
          >>>               foo.foo.aba6b5b9-cgu.2.rcgu.o:(_start)
          
          rust-lld: error: undefined symbol: fmaxf
          >>> referenced by foo.aba6b5b9-cgu.3
          >>>               foo.foo.aba6b5b9-cgu.3.rcgu.o:(core::f32::_$LT$impl$u20$f32$GT$::max::h44f01d00f3d26d49)
          
          rust-lld: error: undefined symbol: fminf
          >>> referenced by foo.aba6b5b9-cgu.3
          >>>               foo.foo.aba6b5b9-cgu.3.rcgu.o:(core::f32::_$LT$impl$u20$f32$GT$::min::h4f3c8d0acfd3c696)
          

error: aborting due to previous error

CC: @haraldh, @mikeleany (x86_64-unknown-none target maintainers)

Amanieu added a commit that referenced this issue Dec 8, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Dec 10, 2022
…, r=Mark-Simulacrum

Bump compiler-builtins to 0.1.85

This makes minimal floating point symbols available on `x86_64-unknown-none`.

See rust-lang/compiler-builtins#509 and rust-lang/compiler-builtins#510.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Dec 10, 2022
…, r=Mark-Simulacrum

Bump compiler-builtins to 0.1.85

This makes minimal floating point symbols available on `x86_64-unknown-none`.

See rust-lang/compiler-builtins#509 and rust-lang/compiler-builtins#510.
thomcc pushed a commit to tcdi/postgrestd that referenced this issue May 31, 2023
…Simulacrum

Bump compiler-builtins to 0.1.85

This makes minimal floating point symbols available on `x86_64-unknown-none`.

See rust-lang/compiler-builtins#509 and rust-lang/compiler-builtins#510.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant