Skip to content

Commit e8a3074

Browse files
authored
[builtins][AArch32] Fix __gnu_* functions (llvm#137638)
Move to a consistent calling convention for both Clang/GNU such that they can be linked with each other. All ARM targets now use the soft-float calling convention for `__gnu_h2f_ieee` and `__gnu_f2h_ieee`, as described in https://github.com/ARM-software/abi-aa/blob/main/rtabi32/rtabi32.rst#the-floating-point-helper-functions.
1 parent 416b7df commit e8a3074

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

compiler-rt/lib/builtins/extendhfsf2.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ COMPILER_RT_ABI NOINLINE float __extendhfsf2(src_t a) {
1616
return __extendXfYf2__(a);
1717
}
1818

19-
COMPILER_RT_ABI float __gnu_h2f_ieee(src_t a) { return __extendhfsf2(a); }
20-
2119
#if defined(__ARM_EABI__)
2220
#if defined(COMPILER_RT_ARMHF_TARGET)
21+
AEABI_RTABI float __gnu_h2f_ieee(src_t a) { return __extendhfsf2(a); }
2322
AEABI_RTABI float __aeabi_h2f(src_t a) { return __extendhfsf2(a); }
2423
#else
24+
COMPILER_RT_ALIAS(__extendhfsf2, __gnu_h2f_ieee)
2525
COMPILER_RT_ALIAS(__extendhfsf2, __aeabi_h2f)
2626
#endif
27+
#else
28+
COMPILER_RT_ABI float __gnu_h2f_ieee(src_t a) { return __extendhfsf2(a); }
2729
#endif

compiler-rt/lib/builtins/truncsfhf2.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ COMPILER_RT_ABI NOINLINE dst_t __truncsfhf2(float a) {
1616
return __truncXfYf2__(a);
1717
}
1818

19-
COMPILER_RT_ABI dst_t __gnu_f2h_ieee(float a) { return __truncsfhf2(a); }
20-
2119
#if defined(__ARM_EABI__)
2220
#if defined(COMPILER_RT_ARMHF_TARGET)
21+
AEABI_RTABI dst_t __gnu_f2h_ieee(float a) { return __truncsfhf2(a); }
2322
AEABI_RTABI dst_t __aeabi_f2h(float a) { return __truncsfhf2(a); }
2423
#else
24+
COMPILER_RT_ALIAS(__truncsfhf2, __gnu_f2h_ieee)
2525
COMPILER_RT_ALIAS(__truncsfhf2, __aeabi_f2h)
2626
#endif
27+
#else
28+
COMPILER_RT_ABI dst_t __gnu_f2h_ieee(float a) { return __truncsfhf2(a); }
2729
#endif

0 commit comments

Comments
 (0)