This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
[PATCH 08/26] arm: Add IT insns for thumb mode
- From: Richard Henderson <rth at twiddle dot net>
- To: libc-ports at sourceware dot org
- Cc: Joseph Myers <joseph at codesourcery dot com>
- Date: Tue, 26 Feb 2013 19:16:08 -0800
- Subject: [PATCH 08/26] arm: Add IT insns for thumb mode
- References: <1361934986-17018-1-git-send-email-rth@twiddle.net>
These are ignored by the assembler in ARM mode, so by
default this has no effect on generated code.
---
* ports/sysdeps/arm/arm-mcount.S: Always use unified syntax and
always add IT markup.
* sysdeps/unix/sysv/linux/arm/mmap64.S (__mmap64): Likewise.
* sysdeps/arm/dl-tlsdesc.S (_dl_tlsdesc_dynamic): Add IT markup.
* sysdeps/unix/arm/sysdep.S (__syscall_error): Likewise.
* sysdeps/unix/sysv/linux/arm/clone.S (__clone): Likewise.
* sysdeps/unix/sysv/linux/arm/mmap.S (__mmap): Likewise.
* sysdeps/unix/sysv/linux/arm/syscall.S (syscall): Likewise.
* sysdeps/unix/sysv/linux/arm/sysdep.h (PSEUDO_RET): Likewise.
* sysdeps/unix/sysv/linux/arm/vfork.S (__vfork): Likewise.
---
ports/sysdeps/arm/arm-mcount.S | 9 ++-------
ports/sysdeps/arm/dl-tlsdesc.S | 1 +
ports/sysdeps/unix/arm/sysdep.S | 5 +++--
ports/sysdeps/unix/sysv/linux/arm/clone.S | 4 +++-
ports/sysdeps/unix/sysv/linux/arm/mmap.S | 1 +
ports/sysdeps/unix/sysv/linux/arm/mmap64.S | 6 +++++-
ports/sysdeps/unix/sysv/linux/arm/syscall.S | 1 +
ports/sysdeps/unix/sysv/linux/arm/sysdep.h | 1 +
ports/sysdeps/unix/sysv/linux/arm/vfork.S | 1 +
9 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/ports/sysdeps/arm/arm-mcount.S b/ports/sysdeps/arm/arm-mcount.S
index 6c24271..679d042 100644
--- a/ports/sysdeps/arm/arm-mcount.S
+++ b/ports/sysdeps/arm/arm-mcount.S
@@ -24,8 +24,8 @@
#ifdef __thumb2__
.thumb
- .syntax unified
#endif
+ .syntax unified
/* Use an assembly stub with a special ABI. The calling lr has been
@@ -77,15 +77,10 @@ ENTRY(_mcount)
cfi_rel_offset (r3, 12)
cfi_rel_offset (fp, 16)
cfi_rel_offset (lr, 20)
-#ifdef __thumb2__
movs r0, fp
ittt ne
ldrne r0, [r0, #-4]
-#else
- movs fp, fp
- ldrne r0, [fp, #-4]
-#endif
- movnes r1, lr
+ movsne r1, lr
blne __mcount_internal
#ifdef __thumb2__
ldmia sp!, {r0, r1, r2, r3, fp, pc}
diff --git a/ports/sysdeps/arm/dl-tlsdesc.S b/ports/sysdeps/arm/dl-tlsdesc.S
index 0ae3abb..c3e2b3e 100644
--- a/ports/sysdeps/arm/dl-tlsdesc.S
+++ b/ports/sysdeps/arm/dl-tlsdesc.S
@@ -116,6 +116,7 @@ _dl_tlsdesc_dynamic:
ldr r3, [r1]
ldr r2, [r0, r3, lsl #3]
cmn r2, #1
+ ittt ne
ldrne r3, [r1, #4]
addne r3, r2, r3
rsbne r0, r4, r3
diff --git a/ports/sysdeps/unix/arm/sysdep.S b/ports/sysdeps/unix/arm/sysdep.S
index 425f4ac..951642f 100644
--- a/ports/sysdeps/unix/arm/sysdep.S
+++ b/ports/sysdeps/unix/arm/sysdep.S
@@ -31,8 +31,9 @@ __syscall_error:
/* We translate the system's EWOULDBLOCK error into EAGAIN.
The GNU C library always defines EWOULDBLOCK==EAGAIN.
EWOULDBLOCK_sys is the original number. */
- cmp r0, $EWOULDBLOCK_sys /* Is it the old EWOULDBLOCK? */
- moveq r0, $EAGAIN /* Yes; translate it to EAGAIN. */
+ cmp r0, $EWOULDBLOCK_sys /* Is it the old EWOULDBLOCK? */
+ it eq
+ moveq r0, $EAGAIN /* Yes; translate it to EAGAIN. */
#endif
#ifndef IS_IN_rtld
diff --git a/ports/sysdeps/unix/sysv/linux/arm/clone.S b/ports/sysdeps/unix/sysv/linux/arm/clone.S
index 8807781..9de37f2 100644
--- a/ports/sysdeps/unix/sysv/linux/arm/clone.S
+++ b/ports/sysdeps/unix/sysv/linux/arm/clone.S
@@ -33,6 +33,7 @@
ENTRY(__clone)
@ sanity check args
cmp r0, #0
+ ite ne
cmpne r1, #0
moveq r0, #-EINVAL
beq PLTJMP(syscall_error)
@@ -76,8 +77,9 @@ PSEUDO_END (__clone)
GET_TLS
mov r1, r0
tst ip, #CLONE_VM
- movne r0, #-1
ldr r7, =SYS_ify(getpid)
+ ite ne
+ movne r0, #-1
swieq 0x0
str r0, [r1, #PID_OFFSET]
str r0, [r1, #TID_OFFSET]
diff --git a/ports/sysdeps/unix/sysv/linux/arm/mmap.S b/ports/sysdeps/unix/sysv/linux/arm/mmap.S
index fa8a2b8..68560b0 100644
--- a/ports/sysdeps/unix/sysv/linux/arm/mmap.S
+++ b/ports/sysdeps/unix/sysv/linux/arm/mmap.S
@@ -51,6 +51,7 @@ ENTRY (__mmap)
cfi_restore (r5)
cmn r0, $4096
+ it cc
RETINSTR(cc, lr)
b PLTJMP(syscall_error)
diff --git a/ports/sysdeps/unix/sysv/linux/arm/mmap64.S b/ports/sysdeps/unix/sysv/linux/arm/mmap64.S
index 2eafd1b..dcbab3a 100644
--- a/ports/sysdeps/unix/sysv/linux/arm/mmap64.S
+++ b/ports/sysdeps/unix/sysv/linux/arm/mmap64.S
@@ -17,6 +17,8 @@
#include <sysdep.h>
+ .syntax unified
+
#define EINVAL 22
#ifdef __ARMEB__
@@ -42,7 +44,8 @@ ENTRY (__mmap64)
cfi_remember_state
movs r4, ip, lsl $20 @ check that offset is page-aligned
mov ip, ip, lsr $12
- moveqs r4, r5, lsr $12 @ check for overflow
+ it eq
+ movseq r4, r5, lsr $12 @ check for overflow
bne .Linval
ldr r4, [sp, $8] @ load fd
orr r5, ip, r5, lsl $20 @ compose page offset
@@ -52,6 +55,7 @@ ENTRY (__mmap64)
cfi_adjust_cfa_offset (-8)
cfi_restore (r4)
cfi_restore (r5)
+ it cc
RETINSTR(cc, lr)
b PLTJMP(syscall_error)
diff --git a/ports/sysdeps/unix/sysv/linux/arm/syscall.S b/ports/sysdeps/unix/sysv/linux/arm/syscall.S
index c6dd57d..665ecb4 100644
--- a/ports/sysdeps/unix/sysv/linux/arm/syscall.S
+++ b/ports/sysdeps/unix/sysv/linux/arm/syscall.S
@@ -42,6 +42,7 @@ ENTRY (syscall)
cfi_restore (r6)
cfi_restore (r7)
cmn r0, #4096
+ it cc
RETINSTR(cc, lr)
b PLTJMP(syscall_error)
PSEUDO_END (syscall)
diff --git a/ports/sysdeps/unix/sysv/linux/arm/sysdep.h b/ports/sysdeps/unix/sysv/linux/arm/sysdep.h
index dae9d98..c1f2c9e 100644
--- a/ports/sysdeps/unix/sysv/linux/arm/sysdep.h
+++ b/ports/sysdeps/unix/sysv/linux/arm/sysdep.h
@@ -79,6 +79,7 @@
cmn r0, $4096;
#define PSEUDO_RET \
+ it cc; \
RETINSTR(cc, lr); \
b PLTJMP(SYSCALL_ERROR)
#undef ret
diff --git a/ports/sysdeps/unix/sysv/linux/arm/vfork.S b/ports/sysdeps/unix/sysv/linux/arm/vfork.S
index 4f84c57..ae931f7 100644
--- a/ports/sysdeps/unix/sysv/linux/arm/vfork.S
+++ b/ports/sysdeps/unix/sysv/linux/arm/vfork.S
@@ -51,6 +51,7 @@ ENTRY (__vfork)
RESTORE_PID
#endif
cmn a1, #4096
+ it cc
RETINSTR(cc, lr)
b PLTJMP(SYSCALL_ERROR)
--
1.8.1.2