Skip to content

__extenddftf2 is found to be missing at runtime when using the WASI SDK to build Rust crates' C code #561

Closed
@adamnovak

Description

@adamnovak

The WASI SDK folks said that WebAssembly/wasi-sdk#361 is probably a Rust issue.

I'm trying to build a Rust project that uses rusqlite (which compiles C code), for WebAssembly, for the wasm32-wasi Rust target.

When I do my build with:

RUSTC_LOG="rustc_codegen_ssa::back::link=info" CC_wasm32_wasi="$(pwd)/wasi-sdk-20.0/bin/clang" LIBSQLITE3_FLAGS="-DSQLITE_THREADSAFE=0" cargo build --release --target=wasm32-wasi

I end up with the Rust linker linking against /Users/anovak/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/wasm32-wasi/lib/libcompiler_builtins-a0294efb55e060eb.rlib, which does not define __extenddftf2. But the WASI SDK compiler version 20 (the current release) builds C code assuming it will link against its wasi-sdk-20.0/lib/clang/16/lib/wasi/libclang_rt.builtins-wasm32.a file, which does define __extenddftf2.

The WASI SDK folks suggested that the real problem is that the Rust libcompiler_builtins should define that symbol, and is out of date and needs updating. But I installed the wasm32-wasi target with rustup within the past 48 hours, so presumably I have the current version.

Can that function be added?

My full list of missing intrinsic-looking functions from my build seems to be:

 - func[0] sig=18 <__extenddftf2> <- env.__extenddftf2
 - func[1] sig=19 <__trunctfdf2> <- env.__trunctfdf2
 - func[2] sig=20 <__multf3> <- env.__multf3
 - func[3] sig=20 <__addtf3> <- env.__addtf3
 - func[4] sig=21 <__gttf2> <- env.__gttf2
 - func[5] sig=21 <__getf2> <- env.__getf2
 - func[6] sig=20 <__divtf3> <- env.__divtf3
 - func[7] sig=21 <__lttf2> <- env.__lttf2
 - func[8] sig=22 <__fixtfsi> <- env.__fixtfsi
 - func[9] sig=1 <__floatsitf> <- env.__floatsitf
 - func[10] sig=20 <__subtf3> <- env.__subtf3
 - func[11] sig=23 <__floatditf> <- env.__floatditf

Is libcompiler_builtins somehow out of date enough to be missing all of these?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions