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/c428d1165266
branches:  trunk
changeset: 984270:c428d1165266
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 569cdf0d5010 -r c428d1165266 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 @@
         // 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 @@
 
 1:
         msr CPSR_f, ip
+        add sp, #4
         pop {r0-r3}
         POP_PC()
 END_COMPILERRT_FUNCTION(__aeabi_cfcmple)
diff -r 569cdf0d5010 -r c428d1165266 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 569cdf0d5010 -r c428d1165266 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 569cdf0d5010 -r c428d1165266 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