arm: fix setjmp and longjmp asm for armv8-a
authorSzabolcs Nagy <nsz@port70.net>
Wed, 25 Sep 2019 18:34:25 +0000 (19:34 +0100)
committerRich Felker <dalias@aerifal.cx>
Thu, 26 Sep 2019 04:34:15 +0000 (00:34 -0400)
armv8 removed the coprocessor instructions other than cp14, so
on an armv8 system the related hwcaps should never be set.

new llvm complains about the use of coprocessor instructions in
armv8-a mode (even though they are never executed at runtime),
so ifdef them out when musl is built for armv8.

src/setjmp/arm/longjmp.S [new file with mode: 0644]
src/setjmp/arm/longjmp.s [deleted file]
src/setjmp/arm/setjmp.S [new file with mode: 0644]
src/setjmp/arm/setjmp.s [deleted file]

diff --git a/src/setjmp/arm/longjmp.S b/src/setjmp/arm/longjmp.S
new file mode 100644 (file)
index 0000000..8df0b81
--- /dev/null
@@ -0,0 +1,50 @@
+.syntax unified
+.global _longjmp
+.global longjmp
+.type _longjmp,%function
+.type longjmp,%function
+_longjmp:
+longjmp:
+       mov ip,r0
+       movs r0,r1
+       moveq r0,#1
+       ldmia ip!, {v1,v2,v3,v4,v5,v6,sl,fp}
+       ldmia ip!, {r2,lr}
+       mov sp,r2
+
+       adr r1,1f
+       ldr r2,1f
+       ldr r1,[r1,r2]
+
+#if __ARM_ARCH < 8
+       tst r1,#0x260
+       beq 3f
+       // HWCAP_ARM_FPA
+       tst r1,#0x20
+       beq 2f
+       ldc p2, cr4, [ip], #48
+#endif
+2:     tst r1,#0x40
+       beq 2f
+       .fpu vfp
+       vldmia ip!, {d8-d15}
+       .fpu softvfp
+       .eabi_attribute 10, 0
+       .eabi_attribute 27, 0
+#if __ARM_ARCH < 8
+       // HWCAP_ARM_IWMMXT
+2:     tst r1,#0x200
+       beq 3f
+       ldcl p1, cr10, [ip], #8
+       ldcl p1, cr11, [ip], #8
+       ldcl p1, cr12, [ip], #8
+       ldcl p1, cr13, [ip], #8
+       ldcl p1, cr14, [ip], #8
+       ldcl p1, cr15, [ip], #8
+#endif
+2:
+3:     bx lr
+
+.hidden __hwcap
+.align 2
+1:     .word __hwcap-1b
diff --git a/src/setjmp/arm/longjmp.s b/src/setjmp/arm/longjmp.s
deleted file mode 100644 (file)
index 76cc292..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-.syntax unified
-.global _longjmp
-.global longjmp
-.type _longjmp,%function
-.type longjmp,%function
-_longjmp:
-longjmp:
-       mov ip,r0
-       movs r0,r1
-       moveq r0,#1
-       ldmia ip!, {v1,v2,v3,v4,v5,v6,sl,fp}
-       ldmia ip!, {r2,lr}
-       mov sp,r2
-
-       adr r1,1f
-       ldr r2,1f
-       ldr r1,[r1,r2]
-
-       tst r1,#0x260
-       beq 3f
-       tst r1,#0x20
-       beq 2f
-       ldc p2, cr4, [ip], #48
-2:     tst r1,#0x40
-       beq 2f
-       .fpu vfp
-       vldmia ip!, {d8-d15}
-       .fpu softvfp
-       .eabi_attribute 10, 0
-       .eabi_attribute 27, 0
-2:     tst r1,#0x200
-       beq 3f
-       ldcl p1, cr10, [ip], #8
-       ldcl p1, cr11, [ip], #8
-       ldcl p1, cr12, [ip], #8
-       ldcl p1, cr13, [ip], #8
-       ldcl p1, cr14, [ip], #8
-       ldcl p1, cr15, [ip], #8
-3:     bx lr
-
-.hidden __hwcap
-.align 2
-1:     .word __hwcap-1b
diff --git a/src/setjmp/arm/setjmp.S b/src/setjmp/arm/setjmp.S
new file mode 100644 (file)
index 0000000..45731d2
--- /dev/null
@@ -0,0 +1,52 @@
+.syntax unified
+.global __setjmp
+.global _setjmp
+.global setjmp
+.type __setjmp,%function
+.type _setjmp,%function
+.type setjmp,%function
+__setjmp:
+_setjmp:
+setjmp:
+       mov ip,r0
+       stmia ip!,{v1,v2,v3,v4,v5,v6,sl,fp}
+       mov r2,sp
+       stmia ip!,{r2,lr}
+       mov r0,#0
+
+       adr r1,1f
+       ldr r2,1f
+       ldr r1,[r1,r2]
+
+#if __ARM_ARCH < 8
+       tst r1,#0x260
+       beq 3f
+       // HWCAP_ARM_FPA
+       tst r1,#0x20
+       beq 2f
+       stc p2, cr4, [ip], #48
+#endif
+2:     tst r1,#0x40
+       beq 2f
+       .fpu vfp
+       vstmia ip!, {d8-d15}
+       .fpu softvfp
+       .eabi_attribute 10, 0
+       .eabi_attribute 27, 0
+#if __ARM_ARCH < 8
+       // HWCAP_ARM_IWMMXT
+2:     tst r1,#0x200
+       beq 3f
+       stcl p1, cr10, [ip], #8
+       stcl p1, cr11, [ip], #8
+       stcl p1, cr12, [ip], #8
+       stcl p1, cr13, [ip], #8
+       stcl p1, cr14, [ip], #8
+       stcl p1, cr15, [ip], #8
+#endif
+2:
+3:     bx lr
+
+.hidden __hwcap
+.align 2
+1:     .word __hwcap-1b
diff --git a/src/setjmp/arm/setjmp.s b/src/setjmp/arm/setjmp.s
deleted file mode 100644 (file)
index 011315b..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-.syntax unified
-.global __setjmp
-.global _setjmp
-.global setjmp
-.type __setjmp,%function
-.type _setjmp,%function
-.type setjmp,%function
-__setjmp:
-_setjmp:
-setjmp:
-       mov ip,r0
-       stmia ip!,{v1,v2,v3,v4,v5,v6,sl,fp}
-       mov r2,sp
-       stmia ip!,{r2,lr}
-       mov r0,#0
-
-       adr r1,1f
-       ldr r2,1f
-       ldr r1,[r1,r2]
-
-       tst r1,#0x260
-       beq 3f
-       tst r1,#0x20
-       beq 2f
-       stc p2, cr4, [ip], #48
-2:     tst r1,#0x40
-       beq 2f
-       .fpu vfp
-       vstmia ip!, {d8-d15}
-       .fpu softvfp
-       .eabi_attribute 10, 0
-       .eabi_attribute 27, 0
-2:     tst r1,#0x200
-       beq 3f
-       stcl p1, cr10, [ip], #8
-       stcl p1, cr11, [ip], #8
-       stcl p1, cr12, [ip], #8
-       stcl p1, cr13, [ip], #8
-       stcl p1, cr14, [ip], #8
-       stcl p1, cr15, [ip], #8
-3:     bx lr
-
-.hidden __hwcap
-.align 2
-1:     .word __hwcap-1b