Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/compiler_rt/dist/lib/builtins PR port-arm/5...



details:   https://anonhg.NetBSD.org/src/rev/5df9c600d783
branches:  trunk
changeset: 983976:5df9c600d783
user:      rin <rin%NetBSD.org@localhost>
date:      Wed Jun 16 05:06:45 2021 +0000

description:
PR port-arm/55897

Cherry-pick upstream commit llvm-svn: 303188:

https://github.com/llvm/llvm-project/commit/36ac5ddff7377586390a71cb3261f0a40d274308#diff-549f1733063df365663fe375f336034e33e16d6bf2826cd4f966045aeb136007
----
[PATCH] builtins: expand out the AEABI function stubs

These actually may change calling conventions.  We cannot simply provide
function aliases as the aliased function may have a different calling
convention.  Provide a forwarding function instead to permit the
compiler to synthesize the calling convention adjustment thunk.

Remove the `ARM_EABI_FNALIAS` macro as that is not safe to use.

Resolves PR33030!

llvm-svn: 303188

diffstat:

 sys/external/bsd/compiler_rt/dist/lib/builtins/adddf3.c                      |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/addsf3.c                      |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cdcmpeq_check_nan.c |   3 +-
 sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmpeq_check_nan.c |   3 +-
 sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_div0.c              |   4 +-
 sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_drsub.c             |   4 +-
 sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_frsub.c             |   4 +-
 sys/external/bsd/compiler_rt/dist/lib/builtins/ashldi3.c                     |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/ashrdi3.c                     |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/comparedf2.c                  |   8 ++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/comparesf2.c                  |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/divdf3.c                      |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/divsf3.c                      |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/divsi3.c                      |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/extendhfsf2.c                 |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/extendsfdf2.c                 |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/fixdfdi.c                     |  13 ++++++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/fixdfsi.c                     |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/fixsfdi.c                     |  14 ++++++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/fixsfsi.c                     |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/fixunsdfdi.c                  |  14 ++++++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/fixunsdfsi.c                  |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/fixunssfdi.c                  |  14 ++++++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/fixunssfsi.c                  |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/floatdidf.c                   |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/floatdisf.c                   |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/floatsidf.c                   |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/floatsisf.c                   |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/floatundidf.c                 |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/floatundisf.c                 |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/floatunsidf.c                 |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/floatunsisf.c                 |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.h                     |   5 +--
 sys/external/bsd/compiler_rt/dist/lib/builtins/lshrdi3.c                     |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/muldf3.c                      |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/muldi3.c                      |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/mulsf3.c                      |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/negdf2.c                      |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/negsf2.c                      |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/subdf3.c                      |   8 ++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/subsf3.c                      |   8 ++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/truncdfhf2.c                  |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/truncdfsf2.c                  |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/truncsfhf2.c                  |   9 +++++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/udivsi3.c                     |   9 +++++-
 45 files changed, 300 insertions(+), 90 deletions(-)

diffs (truncated from 965 to 300 lines):

diff -r b995c9ad26b1 -r 5df9c600d783 sys/external/bsd/compiler_rt/dist/lib/builtins/adddf3.c
--- a/sys/external/bsd/compiler_rt/dist/lib/builtins/adddf3.c   Wed Jun 16 05:06:21 2021 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/builtins/adddf3.c   Wed Jun 16 05:06:45 2021 +0000
@@ -15,8 +15,13 @@
 #define DOUBLE_PRECISION
 #include "fp_add_impl.inc"
 
-ARM_EABI_FNALIAS(dadd, adddf3)
-
 COMPILER_RT_ABI double __adddf3(double a, double b){
     return __addXf3__(a, b);
 }
+
+#if defined(__ARM_EABI__)
+AEABI_RTABI double __aeabi_dadd(double a, double b) {
+  return __adddf3(a, b);
+}
+#endif
+
diff -r b995c9ad26b1 -r 5df9c600d783 sys/external/bsd/compiler_rt/dist/lib/builtins/addsf3.c
--- a/sys/external/bsd/compiler_rt/dist/lib/builtins/addsf3.c   Wed Jun 16 05:06:21 2021 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/builtins/addsf3.c   Wed Jun 16 05:06:45 2021 +0000
@@ -15,8 +15,13 @@
 #define SINGLE_PRECISION
 #include "fp_add_impl.inc"
 
-ARM_EABI_FNALIAS(fadd, addsf3)
-
 COMPILER_RT_ABI float __addsf3(float a, float b) {
     return __addXf3__(a, b);
 }
+
+#if defined(__ARM_EABI__)
+AEABI_RTABI float __aeabi_fadd(float a, float b) {
+  return __addsf3(a, b);
+}
+#endif
+
diff -r b995c9ad26b1 -r 5df9c600d783 sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cdcmpeq_check_nan.c
--- a/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cdcmpeq_check_nan.c      Wed Jun 16 05:06:21 2021 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cdcmpeq_check_nan.c      Wed Jun 16 05:06:45 2021 +0000
@@ -9,8 +9,7 @@
 
 #include <stdint.h>
 
-__attribute__((pcs("aapcs")))
-__attribute__((visibility("hidden")))
+AEABI_RTABI __attribute__((visibility("hidden")))
 int __aeabi_cdcmpeq_check_nan(double a, double b) {
     return __builtin_isnan(a) || __builtin_isnan(b);
 }
diff -r b995c9ad26b1 -r 5df9c600d783 sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmpeq_check_nan.c
--- a/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmpeq_check_nan.c      Wed Jun 16 05:06:21 2021 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmpeq_check_nan.c      Wed Jun 16 05:06:45 2021 +0000
@@ -9,8 +9,7 @@
 
 #include <stdint.h>
 
-__attribute__((pcs("aapcs")))
-__attribute__((visibility("hidden")))
+AEABI_RTABI __attribute__((visibility("hidden")))
 int __aeabi_cfcmpeq_check_nan(float a, float b) {
     return __builtin_isnan(a) || __builtin_isnan(b);
 }
diff -r b995c9ad26b1 -r 5df9c600d783 sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_div0.c
--- a/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_div0.c   Wed Jun 16 05:06:21 2021 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_div0.c   Wed Jun 16 05:06:45 2021 +0000
@@ -30,12 +30,12 @@
 extern unsigned char declaration;
 
 #if defined(__ARM_EABI__)
-int __attribute__((weak)) __attribute__((visibility("hidden")))
+AEABI_RTABI int __attribute__((weak)) __attribute__((visibility("hidden")))
 __aeabi_idiv0(int return_value) {
   return return_value;
 }
 
-long long __attribute__((weak)) __attribute__((visibility("hidden")))
+AEABI_RTABI long long __attribute__((weak)) __attribute__((visibility("hidden")))
 __aeabi_ldiv0(long long return_value) {
   return return_value;
 }
diff -r b995c9ad26b1 -r 5df9c600d783 sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_drsub.c
--- a/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_drsub.c  Wed Jun 16 05:06:21 2021 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_drsub.c  Wed Jun 16 05:06:45 2021 +0000
@@ -10,10 +10,10 @@
 #define DOUBLE_PRECISION
 #include "../fp_lib.h"
 
-COMPILER_RT_ABI fp_t
+AEABI_RTABI fp_t
 __aeabi_dsub(fp_t, fp_t);
 
-COMPILER_RT_ABI fp_t
+AEABI_RTABI fp_t
 __aeabi_drsub(fp_t a, fp_t b) {
     return __aeabi_dsub(b, a);
 }
diff -r b995c9ad26b1 -r 5df9c600d783 sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_frsub.c
--- a/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_frsub.c  Wed Jun 16 05:06:21 2021 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_frsub.c  Wed Jun 16 05:06:45 2021 +0000
@@ -10,10 +10,10 @@
 #define SINGLE_PRECISION
 #include "../fp_lib.h"
 
-COMPILER_RT_ABI fp_t
+AEABI_RTABI fp_t
 __aeabi_fsub(fp_t, fp_t);
 
-COMPILER_RT_ABI fp_t
+AEABI_RTABI fp_t
 __aeabi_frsub(fp_t a, fp_t b) {
     return __aeabi_fsub(b, a);
 }
diff -r b995c9ad26b1 -r 5df9c600d783 sys/external/bsd/compiler_rt/dist/lib/builtins/ashldi3.c
--- a/sys/external/bsd/compiler_rt/dist/lib/builtins/ashldi3.c  Wed Jun 16 05:06:21 2021 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/builtins/ashldi3.c  Wed Jun 16 05:06:45 2021 +0000
@@ -18,8 +18,6 @@
 
 /* Precondition:  0 <= b < bits_in_dword */
 
-ARM_EABI_FNALIAS(llsl, ashldi3)
-
 COMPILER_RT_ABI di_int
 __ashldi3(di_int a, si_int b)
 {
@@ -41,3 +39,10 @@
     }
     return result.all;
 }
+
+#if defined(__ARM_EABI__)
+AEABI_RTABI di_int __aeabi_llsl(di_int a, si_int b) {
+  return __ashldi3(a, b);
+}
+#endif
+
diff -r b995c9ad26b1 -r 5df9c600d783 sys/external/bsd/compiler_rt/dist/lib/builtins/ashrdi3.c
--- a/sys/external/bsd/compiler_rt/dist/lib/builtins/ashrdi3.c  Wed Jun 16 05:06:21 2021 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/builtins/ashrdi3.c  Wed Jun 16 05:06:45 2021 +0000
@@ -18,8 +18,6 @@
 
 /* Precondition:  0 <= b < bits_in_dword */
 
-ARM_EABI_FNALIAS(lasr, ashrdi3)
-
 COMPILER_RT_ABI di_int
 __ashrdi3(di_int a, si_int b)
 {
@@ -42,3 +40,10 @@
     }
     return result.all;
 }
+
+#if defined(__ARM_EABI__)
+AEABI_RTABI di_int __aeabi_lasr(di_int a, si_int b) {
+  return __ashrdi3(a, b);
+}
+#endif
+
diff -r b995c9ad26b1 -r 5df9c600d783 sys/external/bsd/compiler_rt/dist/lib/builtins/comparedf2.c
--- a/sys/external/bsd/compiler_rt/dist/lib/builtins/comparedf2.c       Wed Jun 16 05:06:21 2021 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/builtins/comparedf2.c       Wed Jun 16 05:06:45 2021 +0000
@@ -113,8 +113,6 @@
     }
 }
 
-ARM_EABI_FNALIAS(dcmpun, unorddf2)
-
 COMPILER_RT_ABI int
 __unorddf2(fp_t a, fp_t b) {
     const rep_t aAbs = toRep(a) & absMask;
@@ -144,3 +142,9 @@
     return __gedf2(a, b);
 }
 
+#if defined(__ARM_EABI__)
+AEABI_RTABI int __aeabi_dcmpun(fp_t a, fp_t b) {
+  return __unorddf2(a, b);
+}
+#endif
+
diff -r b995c9ad26b1 -r 5df9c600d783 sys/external/bsd/compiler_rt/dist/lib/builtins/comparesf2.c
--- a/sys/external/bsd/compiler_rt/dist/lib/builtins/comparesf2.c       Wed Jun 16 05:06:21 2021 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/builtins/comparesf2.c       Wed Jun 16 05:06:45 2021 +0000
@@ -113,8 +113,6 @@
     }
 }
 
-ARM_EABI_FNALIAS(fcmpun, unordsf2)
-
 COMPILER_RT_ABI int
 __unordsf2(fp_t a, fp_t b) {
     const rep_t aAbs = toRep(a) & absMask;
@@ -143,3 +141,10 @@
 __gtsf2(fp_t a, fp_t b) {
     return __gesf2(a, b);
 }
+
+#if defined(__ARM_EABI__)
+AEABI_RTABI int __aeabi_fcmpun(fp_t a, fp_t b) {
+  return __unordsf2(a, b);
+}
+#endif
+
diff -r b995c9ad26b1 -r 5df9c600d783 sys/external/bsd/compiler_rt/dist/lib/builtins/divdf3.c
--- a/sys/external/bsd/compiler_rt/dist/lib/builtins/divdf3.c   Wed Jun 16 05:06:21 2021 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/builtins/divdf3.c   Wed Jun 16 05:06:45 2021 +0000
@@ -19,8 +19,6 @@
 #define DOUBLE_PRECISION
 #include "fp_lib.h"
 
-ARM_EABI_FNALIAS(ddiv, divdf3)
-
 COMPILER_RT_ABI fp_t
 __divdf3(fp_t a, fp_t b) {
     
@@ -183,3 +181,10 @@
         return result;
     }
 }
+
+#if defined(__ARM_EABI__)
+AEABI_RTABI fp_t __aeabi_ddiv(fp_t a, fp_t b) {
+  return __divdf3(a, b);
+}
+#endif
+
diff -r b995c9ad26b1 -r 5df9c600d783 sys/external/bsd/compiler_rt/dist/lib/builtins/divsf3.c
--- a/sys/external/bsd/compiler_rt/dist/lib/builtins/divsf3.c   Wed Jun 16 05:06:21 2021 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/builtins/divsf3.c   Wed Jun 16 05:06:45 2021 +0000
@@ -19,8 +19,6 @@
 #define SINGLE_PRECISION
 #include "fp_lib.h"
 
-ARM_EABI_FNALIAS(fdiv, divsf3)
-
 COMPILER_RT_ABI fp_t
 __divsf3(fp_t a, fp_t b) {
     
@@ -167,3 +165,10 @@
         return fromRep(absResult | quotientSign);
     }
 }
+
+#if defined(__ARM_EABI__)
+AEABI_RTABI fp_t __aeabi_fdiv(fp_t a, fp_t b) {
+  return __divsf3(a, b);
+}
+#endif
+
diff -r b995c9ad26b1 -r 5df9c600d783 sys/external/bsd/compiler_rt/dist/lib/builtins/divsi3.c
--- a/sys/external/bsd/compiler_rt/dist/lib/builtins/divsi3.c   Wed Jun 16 05:06:21 2021 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/builtins/divsi3.c   Wed Jun 16 05:06:45 2021 +0000
@@ -16,8 +16,6 @@
 
 /* Returns: a / b */
 
-ARM_EABI_FNALIAS(idiv, divsi3)
-
 COMPILER_RT_ABI si_int
 __divsi3(si_int a, si_int b)
 {
@@ -35,3 +33,10 @@
      */
     return ((su_int)a/(su_int)b ^ s_a) - s_a;    /* negate if s_a == -1 */
 }
+
+#if defined(__ARM_EABI__)
+AEABI_RTABI si_int __aeabi_idiv(si_int a, si_int b) {
+  return __divsi3(a, b);
+}
+#endif
+
diff -r b995c9ad26b1 -r 5df9c600d783 sys/external/bsd/compiler_rt/dist/lib/builtins/extendhfsf2.c
--- a/sys/external/bsd/compiler_rt/dist/lib/builtins/extendhfsf2.c      Wed Jun 16 05:06:21 2021 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/builtins/extendhfsf2.c      Wed Jun 16 05:06:45 2021 +0000
@@ -12,8 +12,6 @@
 #define DST_SINGLE
 #include "fp_extend_impl.inc"
 
-ARM_EABI_FNALIAS(h2f, extendhfsf2)
-
 // Use a forwarding definition and noinline to implement a poor man's alias,
 // as there isn't a good cross-platform way of defining one.
 COMPILER_RT_ABI NOINLINE float __extendhfsf2(uint16_t a) {
@@ -23,3 +21,10 @@
 COMPILER_RT_ABI float __gnu_h2f_ieee(uint16_t a) {
     return __extendhfsf2(a);
 }
+
+#if defined(__ARM_EABI__)
+AEABI_RTABI float __aeabi_h2f(uint16_t a) {
+  return __extendhfsf2(a);
+}
+#endif
+
diff -r b995c9ad26b1 -r 5df9c600d783 sys/external/bsd/compiler_rt/dist/lib/builtins/extendsfdf2.c
--- a/sys/external/bsd/compiler_rt/dist/lib/builtins/extendsfdf2.c      Wed Jun 16 05:06:21 2021 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/builtins/extendsfdf2.c      Wed Jun 16 05:06:45 2021 +0000



Home | Main Index | Thread Index | Old Index