From feabb903c275f30f22184fbca639b4081a344d54 Mon Sep 17 00:00:00 2001 From: William Huynh Date: Mon, 28 Apr 2025 15:16:26 +0100 Subject: [PATCH 1/4] [builtins][AArch64] Fix __gnu_* functions Move to a consistent calling convention for both Clang and GNU such that they can be linked with each other. --- compiler-rt/lib/builtins/extendhfsf2.c | 4 ++-- compiler-rt/lib/builtins/truncsfhf2.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/compiler-rt/lib/builtins/extendhfsf2.c b/compiler-rt/lib/builtins/extendhfsf2.c index 0159ab09d3ebb..0dc8cf33cccb6 100644 --- a/compiler-rt/lib/builtins/extendhfsf2.c +++ b/compiler-rt/lib/builtins/extendhfsf2.c @@ -16,12 +16,12 @@ COMPILER_RT_ABI NOINLINE float __extendhfsf2(src_t a) { return __extendXfYf2__(a); } -COMPILER_RT_ABI float __gnu_h2f_ieee(src_t a) { return __extendhfsf2(a); } - #if defined(__ARM_EABI__) #if defined(COMPILER_RT_ARMHF_TARGET) +AEABI_RTABI float __gnu_h2f_ieee(src_t a) { return __extendhfsf2(a); } AEABI_RTABI float __aeabi_h2f(src_t a) { return __extendhfsf2(a); } #else +COMPILER_RT_ALIAS(__extendhfsf2, __gnu_h2f_ieee) COMPILER_RT_ALIAS(__extendhfsf2, __aeabi_h2f) #endif #endif diff --git a/compiler-rt/lib/builtins/truncsfhf2.c b/compiler-rt/lib/builtins/truncsfhf2.c index 379e7cb6f7845..310cacd93c558 100644 --- a/compiler-rt/lib/builtins/truncsfhf2.c +++ b/compiler-rt/lib/builtins/truncsfhf2.c @@ -16,12 +16,13 @@ COMPILER_RT_ABI NOINLINE dst_t __truncsfhf2(float a) { return __truncXfYf2__(a); } -COMPILER_RT_ABI dst_t __gnu_f2h_ieee(float a) { return __truncsfhf2(a); } #if defined(__ARM_EABI__) #if defined(COMPILER_RT_ARMHF_TARGET) +AEABI_RTABI dst_t __gnu_f2h_ieee(float a) { return __truncsfhf2(a); } AEABI_RTABI dst_t __aeabi_f2h(float a) { return __truncsfhf2(a); } #else +COMPILER_RT_ALIAS(__truncsfhf2, __gnu_f2h_ieee) COMPILER_RT_ALIAS(__truncsfhf2, __aeabi_f2h) #endif #endif From 29b643124094dcd0c3bdbb10744d6b16e516179b Mon Sep 17 00:00:00 2001 From: William Huynh Date: Wed, 30 Apr 2025 17:15:39 +0100 Subject: [PATCH 2/4] fixup! [builtins][AArch64] Fix __gnu_* functions --- compiler-rt/lib/builtins/extendhfsf2.c | 1 + compiler-rt/lib/builtins/truncsfhf2.c | 1 + 2 files changed, 2 insertions(+) diff --git a/compiler-rt/lib/builtins/extendhfsf2.c b/compiler-rt/lib/builtins/extendhfsf2.c index 0dc8cf33cccb6..22ce9150d6291 100644 --- a/compiler-rt/lib/builtins/extendhfsf2.c +++ b/compiler-rt/lib/builtins/extendhfsf2.c @@ -24,4 +24,5 @@ AEABI_RTABI float __aeabi_h2f(src_t a) { return __extendhfsf2(a); } COMPILER_RT_ALIAS(__extendhfsf2, __gnu_h2f_ieee) COMPILER_RT_ALIAS(__extendhfsf2, __aeabi_h2f) #endif +COMPILER_RT_ABI float __gnu_h2f_ieee(src_t a) { return __extendhfsf2(a); } #endif diff --git a/compiler-rt/lib/builtins/truncsfhf2.c b/compiler-rt/lib/builtins/truncsfhf2.c index 310cacd93c558..e16dbeb3a1c4d 100644 --- a/compiler-rt/lib/builtins/truncsfhf2.c +++ b/compiler-rt/lib/builtins/truncsfhf2.c @@ -25,4 +25,5 @@ AEABI_RTABI dst_t __aeabi_f2h(float a) { return __truncsfhf2(a); } COMPILER_RT_ALIAS(__truncsfhf2, __gnu_f2h_ieee) COMPILER_RT_ALIAS(__truncsfhf2, __aeabi_f2h) #endif +COMPILER_RT_ABI dst_t __gnu_f2h_ieee(float a) { return __truncsfhf2(a); } #endif From 0632b79fcb682c0e985a443ca2aad5eebeb0a30f Mon Sep 17 00:00:00 2001 From: William Huynh Date: Mon, 19 May 2025 11:04:23 +0100 Subject: [PATCH 3/4] fixup! fixup! [builtins][AArch64] Fix __gnu_* functions --- compiler-rt/lib/builtins/extendhfsf2.c | 1 + compiler-rt/lib/builtins/truncsfhf2.c | 1 + 2 files changed, 2 insertions(+) diff --git a/compiler-rt/lib/builtins/extendhfsf2.c b/compiler-rt/lib/builtins/extendhfsf2.c index 22ce9150d6291..c0f25cdadcd4f 100644 --- a/compiler-rt/lib/builtins/extendhfsf2.c +++ b/compiler-rt/lib/builtins/extendhfsf2.c @@ -24,5 +24,6 @@ AEABI_RTABI float __aeabi_h2f(src_t a) { return __extendhfsf2(a); } COMPILER_RT_ALIAS(__extendhfsf2, __gnu_h2f_ieee) COMPILER_RT_ALIAS(__extendhfsf2, __aeabi_h2f) #endif +#else COMPILER_RT_ABI float __gnu_h2f_ieee(src_t a) { return __extendhfsf2(a); } #endif diff --git a/compiler-rt/lib/builtins/truncsfhf2.c b/compiler-rt/lib/builtins/truncsfhf2.c index e16dbeb3a1c4d..c8a4630928739 100644 --- a/compiler-rt/lib/builtins/truncsfhf2.c +++ b/compiler-rt/lib/builtins/truncsfhf2.c @@ -25,5 +25,6 @@ AEABI_RTABI dst_t __aeabi_f2h(float a) { return __truncsfhf2(a); } COMPILER_RT_ALIAS(__truncsfhf2, __gnu_f2h_ieee) COMPILER_RT_ALIAS(__truncsfhf2, __aeabi_f2h) #endif +#else COMPILER_RT_ABI dst_t __gnu_f2h_ieee(float a) { return __truncsfhf2(a); } #endif From 345e0b62726c5f00ec01c97a31980268754c7e27 Mon Sep 17 00:00:00 2001 From: William Huynh Date: Mon, 19 May 2025 11:08:19 +0100 Subject: [PATCH 4/4] fixup! fixup! fixup! [builtins][AArch64] Fix __gnu_* functions --- compiler-rt/lib/builtins/truncsfhf2.c | 1 - 1 file changed, 1 deletion(-) diff --git a/compiler-rt/lib/builtins/truncsfhf2.c b/compiler-rt/lib/builtins/truncsfhf2.c index c8a4630928739..6ad8621b8bb02 100644 --- a/compiler-rt/lib/builtins/truncsfhf2.c +++ b/compiler-rt/lib/builtins/truncsfhf2.c @@ -16,7 +16,6 @@ COMPILER_RT_ABI NOINLINE dst_t __truncsfhf2(float a) { return __truncXfYf2__(a); } - #if defined(__ARM_EABI__) #if defined(COMPILER_RT_ARMHF_TARGET) AEABI_RTABI dst_t __gnu_f2h_ieee(float a) { return __truncsfhf2(a); }