You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Provide missing native 128-bit arithmetic runtime helpers #805
Native i128 division/remainder and u128-to-f32 conversion compile to object files but fail to link on Linux amd64. LLVM introduces arithmetic helper references that wavec does not provide, so otherwise valid programs cannot produce an executable.
Reproduction
Reproduced at 648ade28 on Linux amd64 with LLVM 21.1.8, at both -O0 and -O2:
export(c, "quotient") fun quotient(a: i128, b: i128) -> i128 { return a / b; }
export(c, "remainder") fun remainder(a: i128, b: i128) -> i128 { return a % b; }
export(c, "to_float") fun to_float(value: u128) -> f32 { return value as f32; }
fun main() -> i32 { return 0; }
The linker reports undefined symbols __divti3, __modti3, and __floatuntisf. Emitting an object with --emit=obj and inspecting it with llvm-nm --undefined-only confirms those references. Repeat with -O2 for the same failure.
Scope
Provide the required native arithmetic support using compiler-owned, freestanding helpers, included only when needed with compiler-private symbols. This design has been approved by @LunaStev. Preserve existing arithmetic semantics and C ABI; do not require users to install compiler-rt, libgcc, or libc. Audit supported native targets for equivalent helper dependencies.
Completion criteria
Native wide arithmetic and integer/float conversions link and produce correct results at O0 and O2, including boundary values and signed/unsigned cases.
Final artifacts have no unresolved arithmetic helper dependencies, and unused helpers are omitted.
Regression coverage preserves the existing wasm64 arithmetic runtime behavior and native C ABI.
Activity