Skip to content

Linker error undefined symbol for some float transcendental functions on wasm32-unknown-unknown #154919

@kpreid

Description

@kpreid
pub fn main() {
    _ = 3.0f64.acosh();
}
rustc +nightly --target wasm32-unknown-unknown --edition=2024 --crate-type=bin problem.rs
error: linking with `rust-lld` failed: exit status: 1
  |
  = note:  "rust-lld" "-flavor" "wasm" "--export" "main" "--export=__heap_base" "--export=__data_end" "-z" "stack-size=1048576" "--stack-first" "--no-demangle" "--no-entry" "<2 object files omitted>" "<sysroot>/lib/rustlib/wasm32-unknown-unknown/lib/{libpanic_abort-*,libstd-*,libdlmalloc-*,libcfg_if-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-L" "<sysroot>/lib/rustlib/wasm32-unknown-unknown/lib/self-contained" "-o" "problem.wasm" "--gc-sections" "-O0"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: rust-lld: error: problem.problem.47f4112ed09eb652-cgu.0.rcgu.o: undefined symbol: acosh
          

error: aborting due to 1 previous error

The same error can be provoked for acosh, asinh, acoshf, and asinhf. (This is not an exhaustive list.)

This is presumably related to #149868 but code like this did compile and run on stable, so it’s not that the symbols are actually missing, unless that’s a coincidental nightly regression. If linked with --allow-undefined, the code fails to find the symbols in env, so this seems to be a regression causing these symbols to be missing (or used when something else should be used instead).

Meta

rustc --version --verbose:

rustc 1.96.0-nightly (9602bda1d 2026-04-05)
binary: rustc
commit-hash: 9602bda1dd0c1bbf5787e398385bbac81fd532f8
commit-date: 2026-04-05
host: aarch64-apple-darwin
release: 1.96.0-nightly
LLVM version: 22.1.2

@rustbot label regression-from-stable-to-nightly T-compiler O-wasm A-linkers

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linkersArea: linkers... you gotta love linkersC-bugCategory: This is a bug.O-wasmTarget: WASM (WebAssembly), http://webassembly.org/T-libsRelevant to the library team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions