Skip to content

Commit 085cd2f

Browse files
authored
[wasm64] Fix return type of builtin float comparisons (#16941)
The llvm-generated calls always use i32 as the return type for float comparisons such as __getf2, but compiler-rt was being built with `long` as the return type resulting in linker warning and runtime errors: ``` wasm-ld: warning: function signature mismatch: __eqtf2 >>> defined as (i64, i64, i64, i64) -> i32 in /usr/local/google/home/sbc/dev/wasm/emscripten/cache/sysroot/lib/wasm64-emscripten/libc-debug.a(fmodl.o) >>> defined as (i64, i64, i64, i64) -> i64 in /usr/local/google/home/sbc/dev/wasm/emscripten/cache/sysroot/lib/wasm64-emscripten/libcompiler_rt.a(comparetf2.o) ```
1 parent 506f93c commit 085cd2f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ jobs:
381381
executor: bionic
382382
steps:
383383
- run-tests-linux:
384-
test_targets: "wasm64.test_hello_world wasm64.test_ccall wasm64l.test_hello_world wasm64l.test_mmap wasm64l.test_unistd_* skip:wasm64l.test_unistd_sysconf wasm64l.test_mmap_file wasm64l.test_ccall wasm64l.test_signals wasm64l.test_emscripten_get_compiler_setting"
384+
test_targets: "wasm64.test_hello_world wasm64.test_ccall wasm64l.test_hello_world wasm64l.test_mmap wasm64l.test_unistd_* skip:wasm64l.test_unistd_sysconf wasm64l.test_mmap_file wasm64l.test_ccall wasm64l.test_signals wasm64l.test_emscripten_get_compiler_setting wasm64l.test_float_builtins"
385385
test-other:
386386
executor: bionic
387387
steps:

system/lib/compiler-rt/lib/builtins/fp_compare_impl.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// functions. We need to ensure that the return value is sign-extended in the
1313
// same way as GCC expects (since otherwise GCC-generated __builtin_isinf
1414
// returns true for finite 128-bit floating-point numbers).
15-
#ifdef __aarch64__
15+
#if defined(__aarch64__) || defined(__wasm__)
1616
// AArch64 GCC overrides libgcc_cmp_return to use int instead of long.
1717
typedef int CMP_RESULT;
1818
#elif __SIZEOF_POINTER__ == 8 && __SIZEOF_LONG__ == 4

0 commit comments

Comments
 (0)