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/arm Align sp ...



details:   https://anonhg.NetBSD.org/src/rev/93b29ec3e2dc
branches:  trunk
changeset: 379992:93b29ec3e2dc
user:      rin <rin%NetBSD.org@localhost>
date:      Tue Jun 29 23:26:00 2021 +0000

description:
Align sp to 8-byte boundary as required by EABI.

This is especially important for non-leaf functions; GCC optimizes codes
based on assumption that sp is aligned properly.

Mostly fix broken earmv5 userland compiled by GCC10 due to alignment
faults in ld.elf_so, where {ld,st}rd are used for [sp, #8x].

No regression for ATF is observed for earmv[67]{,hf}{,eb}.

diffstat:

 sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmp.S |  6 ++++++
 sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divmodsi4.S   |  4 +++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divsi3.S      |  4 +++-
 sys/external/bsd/compiler_rt/dist/lib/builtins/arm/modsi3.S      |  4 +++-
 4 files changed, 15 insertions(+), 3 deletions(-)

diffs (84 lines):

diff -r b1f687901492 -r 93b29ec3e2dc sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmp.S
--- a/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmp.S  Tue Jun 29 22:40:53 2021 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmp.S  Tue Jun 29 23:26:00 2021 +0000
@@ -28,8 +28,10 @@
         .p2align 2
 DEFINE_COMPILERRT_FUNCTION(__aeabi_cfcmpeq)
         push {r0-r3, lr}
+        sub sp, #4
         bl __aeabi_cfcmpeq_check_nan
         cmp r0, #1
+        add sp, #4
         pop {r0-r3, lr}
 
         // NaN has been ruled out, so __aeabi_cfcmple can't trap
@@ -56,13 +58,16 @@ DEFINE_COMPILERRT_FUNCTION(__aeabi_cfcmp
         // Per the RTABI, this function must preserve r0-r11.
         // Save lr in the same instruction for compactness
         push {r0-r3, lr}
+        sub sp, #4
 
         bl __aeabi_fcmplt
         cmp r0, #1
         moveq ip, #0
         beq 1f
 
+        add sp, #4
         ldm sp, {r0-r3}
+        sub sp, #4
         bl __aeabi_fcmpeq
         cmp r0, #1
         moveq ip, #(APSR_C | APSR_Z)
@@ -70,6 +75,7 @@ DEFINE_COMPILERRT_FUNCTION(__aeabi_cfcmp
 
 1:
         msr CPSR_f, ip
+        add sp, #4
         pop {r0-r3}
         POP_PC()
 END_COMPILERRT_FUNCTION(__aeabi_cfcmple)
diff -r b1f687901492 -r 93b29ec3e2dc sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divmodsi4.S
--- a/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divmodsi4.S    Tue Jun 29 22:40:53 2021 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divmodsi4.S    Tue Jun 29 23:26:00 2021 +0000
@@ -17,8 +17,10 @@
 
 #define ESTABLISH_FRAME    \
     push   {r4-r7, lr}   ;\
-    add     r7,     sp, #12
+    add     r7,     sp, #12   ;\
+    sub     sp,     #4
 #define CLEAR_FRAME_AND_RETURN \
+    add     sp,     #4   ;\
     pop    {r4-r7, pc}
 
        .syntax unified
diff -r b1f687901492 -r 93b29ec3e2dc sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divsi3.S
--- a/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divsi3.S       Tue Jun 29 22:40:53 2021 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divsi3.S       Tue Jun 29 23:26:00 2021 +0000
@@ -16,8 +16,10 @@
 
 #define ESTABLISH_FRAME \
     push   {r4, r7, lr}    ;\
-    add     r7,     sp, #4
+    add     r7,     sp, #4   ;\
+    sub     sp,     #4
 #define CLEAR_FRAME_AND_RETURN \
+    add     sp,     #4   ;\
     pop    {r4, r7, pc}
 
        .syntax unified
diff -r b1f687901492 -r 93b29ec3e2dc sys/external/bsd/compiler_rt/dist/lib/builtins/arm/modsi3.S
--- a/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/modsi3.S       Tue Jun 29 22:40:53 2021 +0000
+++ b/sys/external/bsd/compiler_rt/dist/lib/builtins/arm/modsi3.S       Tue Jun 29 23:26:00 2021 +0000
@@ -16,8 +16,10 @@
 
 #define ESTABLISH_FRAME \
     push   {r4, r7, lr}    ;\
-    add     r7,     sp, #4
+    add     r7,     sp, #4   ;\
+    sub     sp,     #4
 #define CLEAR_FRAME_AND_RETURN \
+    add     sp,     #4   ;\
     pop    {r4, r7, pc}
 
        .syntax unified



Home | Main Index | Thread Index | Old Index