summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2015-04-24 19:57:28 -0500
committerWaldemar Brodkorb <wbx@openadk.org>2015-04-24 19:57:28 -0500
commit928ab832caa67c0c1a44e3a8e1483b0ed33cda50 (patch)
tree6e3df2d0437f834971fe28bdf519a2c8da694fc1 /libc
parent74c69da52ad5029cd2fc2d3d41d581022ed0a7aa (diff)
parentf1f98784e65ce9621a570af50998b1940e7fb81d (diff)
merge uClibc changes
Diffstat (limited to 'libc')
-rw-r--r--libc/misc/pthread/tsd.c11
-rw-r--r--libc/string/arm/_memcpy.S18
-rw-r--r--libc/string/arm/memcmp.S12
-rw-r--r--libc/string/arm/memset.S13
-rw-r--r--libc/string/arm/strcmp.S6
-rw-r--r--libc/string/arm/strlen.S7
-rw-r--r--libc/sysdeps/linux/arm/__longjmp.S7
-rw-r--r--libc/sysdeps/linux/arm/bits/arm_asm.h12
-rw-r--r--libc/sysdeps/linux/arm/bits/arm_bx.h12
-rw-r--r--libc/sysdeps/linux/arm/bits/uClibc_arch_features.h26
-rw-r--r--libc/sysdeps/linux/arm/clone.S7
-rw-r--r--libc/sysdeps/linux/arm/mmap64.S6
-rw-r--r--libc/sysdeps/linux/arm/syscall-eabi.S8
-rw-r--r--libc/sysdeps/linux/arm/sysdep.h14
-rw-r--r--libc/sysdeps/linux/arm/vfork.S12
15 files changed, 70 insertions, 101 deletions
diff --git a/libc/misc/pthread/tsd.c b/libc/misc/pthread/tsd.c
index 586ead3fa..3598b8927 100644
--- a/libc/misc/pthread/tsd.c
+++ b/libc/misc/pthread/tsd.c
@@ -1,11 +1,18 @@
+/*
+ * Copyright (C) 2006 by Steven J. Hill <sjhill@realitydiluted.com>
+ *
+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
+ */
/* libpthread sets _dl_error_catch_tsd to point to this function.
We define it here instead of in libpthread so that it doesn't
need to have a TLS segment of its own just for this one pointer. */
+#include <features.h>
+
void **__libc_dl_error_tsd(void) __attribute__ ((const));
void ** __attribute__ ((const))
__libc_dl_error_tsd (void)
{
- static __thread void *data __attribute__ ((tls_model ("initial-exec")));
- return &data;
+ static __thread void *__tsd_data attribute_tls_model_ie;
+ return &__tsd_data;
}
diff --git a/libc/string/arm/_memcpy.S b/libc/string/arm/_memcpy.S
index c59f5b808..2999e8ee6 100644
--- a/libc/string/arm/_memcpy.S
+++ b/libc/string/arm/_memcpy.S
@@ -111,11 +111,7 @@ _memcpy:
bcc .Lmemcpy_backwards
IT(t, eq) /* Quick abort for src=dst */
-#if defined(__USE_BX__)
- bxeq lr
-#else
- moveq pc, lr
-#endif
+ BXC(eq, lr)
stmdb sp!, {r0, lr} /* memcpy() returns dest addr */
subs r2, r2, #4
blt .Lmemcpy_fl4 /* less than 4 bytes */
@@ -455,11 +451,7 @@ _memcpy:
/* less than 4 bytes to go */
adds r2, r2, #4
IT(t, eq)
-#if defined(__USE_BX__)
- bxeq lr
-#else
- moveq pc, lr /* done */
-#endif
+ BXC(eq, lr) /* done */
/* copy the crud byte at a time */
cmp r2, #2
ldrb r3, [r1, #-1]!
@@ -477,11 +469,7 @@ _memcpy:
ldrgtb r3, [r1, #-1]!
strgtb r3, [r0, #-1]!
#endif
-#if defined(__USE_BX__)
- bx lr
-#else
- mov pc, lr
-#endif
+ BX(lr)
/* erg - unaligned destination */
.Lmemcpy_bdestul:
cmp r12, #2
diff --git a/libc/string/arm/memcmp.S b/libc/string/arm/memcmp.S
index 9f7841559..5b9473cd0 100644
--- a/libc/string/arm/memcmp.S
+++ b/libc/string/arm/memcmp.S
@@ -67,11 +67,7 @@ memcmp:
subs r2, r2, #1
IT(tt, mi)
movmi r0, #0
-#if defined(__USE_BX__)
- bxmi lr
-#else
- movmi pc, lr
-#endif
+ BXC(mi, lr)
/* ip == last src address to compare */
add ip, r0, r2
1:
@@ -82,11 +78,7 @@ memcmp:
cmpcs r2, r3
beq 1b
sub r0, r2, r3
-#if defined(__USE_BX__)
- bx lr
-#else
- mov pc, lr
-#endif
+ BX(lr)
#endif
.size memcmp,.-memcmp
diff --git a/libc/string/arm/memset.S b/libc/string/arm/memset.S
index 8ddc47eb1..2be4850e4 100644
--- a/libc/string/arm/memset.S
+++ b/libc/string/arm/memset.S
@@ -17,7 +17,6 @@
<http://www.gnu.org/licenses/>. */
#include <features.h>
-#include <sys/syscall.h>
#include <bits/arm_asm.h>
#include <bits/arm_bx.h>
@@ -109,11 +108,7 @@ memset:
2:
movs a3, a3 @ anything left?
IT(t, eq)
-#if defined(__USE_BX__)
- bxeq lr
-#else
- moveq pc, lr @ nope
-#endif
+ BXC(eq, lr) @ nope
#if defined (__thumb2__)
1:
strb a2, [a4], #1
@@ -131,11 +126,7 @@ memset:
strb a2, [a4], $1
strb a2, [a4], $1
strb a2, [a4], $1
-#if defined(__USE_BX__)
- bx lr
-#else
- mov pc, lr
-#endif
+ BX(lr)
#endif
#endif
diff --git a/libc/string/arm/strcmp.S b/libc/string/arm/strcmp.S
index 8b77ab0f1..81416a9a5 100644
--- a/libc/string/arm/strcmp.S
+++ b/libc/string/arm/strcmp.S
@@ -63,11 +63,7 @@ strcmp:
cmpcs r2, r3
beq 1b
sub r0, r2, r3
-#if defined(__USE_BX__)
- bx lr
-#else
- mov pc, lr
-#endif
+ BX(lr)
#endif
.size strcmp,.-strcmp
diff --git a/libc/string/arm/strlen.S b/libc/string/arm/strlen.S
index 0e7737e23..9995d768c 100644
--- a/libc/string/arm/strlen.S
+++ b/libc/string/arm/strlen.S
@@ -18,7 +18,6 @@
#include <features.h>
#include <endian.h>
-#include <sys/syscall.h>
#include <bits/arm_asm.h>
#include <bits/arm_bx.h>
@@ -99,11 +98,7 @@ Llastword: @ drop through to here once we find a
IT(t, ne)
addne r0, r0, $1 @ must be zero)
#endif
-#if defined(__USE_BX__)
- bx lr
-#else
- mov pc,lr
-#endif
+ BX(lr)
#endif
.size strlen,.-strlen
diff --git a/libc/sysdeps/linux/arm/__longjmp.S b/libc/sysdeps/linux/arm/__longjmp.S
index 853b906f8..58ae8ab58 100644
--- a/libc/sysdeps/linux/arm/__longjmp.S
+++ b/libc/sysdeps/linux/arm/__longjmp.S
@@ -98,12 +98,7 @@ __longjmp:
ldcl p1, cr14, [r12], #8
ldcl p1, cr15, [r12], #8
#endif
-
-#if defined(__USE_BX__)
- bx lr
-#else
- mov pc, lr
-#endif
+ BX(lr)
#endif
.size __longjmp,.-__longjmp
diff --git a/libc/sysdeps/linux/arm/bits/arm_asm.h b/libc/sysdeps/linux/arm/bits/arm_asm.h
index 04664b376..898a78bcc 100644
--- a/libc/sysdeps/linux/arm/bits/arm_asm.h
+++ b/libc/sysdeps/linux/arm/bits/arm_asm.h
@@ -13,12 +13,12 @@
unified assembly syntax. */
#define IT(t, cond)
/* Code to return from a thumb function stub. */
-#ifdef __ARM_ARCH_4T__
-#define POP_RET pop {r2, pc}
-#else
-#define POP_RET pop {r2, r3}; bx r3
-#endif
-#endif
+# if defined __ARM_ARCH_4T__ && defined __THUMB_INTERWORK__
+# define POP_RET pop {r2, r3}; bx r3
+# else
+# define POP_RET pop {r2, pc}
+# endif
+#endif /* __thumb2__ */
#if defined(__ARM_ARCH_6M__)
/* Force arm mode to flush out errors on M profile cores. */
diff --git a/libc/sysdeps/linux/arm/bits/arm_bx.h b/libc/sysdeps/linux/arm/bits/arm_bx.h
index 321490e55..2c290896d 100644
--- a/libc/sysdeps/linux/arm/bits/arm_bx.h
+++ b/libc/sysdeps/linux/arm/bits/arm_bx.h
@@ -24,11 +24,17 @@
#endif /* features.h not yet included */
#if defined(__USE_BX__)
-# if ( defined (__ARM_ARCH_2__) || defined (__ARM_ARCH_3__) \
- || defined (__ARM_ARCH_3M__) || defined (__ARM_ARCH_4__) \
- )
+# if (__ARM_ARCH <= 4 && !defined __ARM_ARCH_4T__)
# error Use of BX was requested, but is not available on the target processor.
# endif /* ARCH level */
#endif /* __USE_BX__ */
+#if defined(__USE_BX__) && (__ARM_ARCH > 4 || (__ARM_ARCH == 4 && defined __ARM_ARCH_4T__))
+# define BX(reg) bx reg
+# define BXC(cond, reg) bx##cond reg
+#else
+# define BX(reg) mov pc, reg
+# define BXC(cond, reg) mov##cond pc, reg
+#endif
+
#endif /* _ARM_BX_H */
diff --git a/libc/sysdeps/linux/arm/bits/uClibc_arch_features.h b/libc/sysdeps/linux/arm/bits/uClibc_arch_features.h
index b01d79c5c..e85aa52fe 100644
--- a/libc/sysdeps/linux/arm/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/arm/bits/uClibc_arch_features.h
@@ -48,6 +48,32 @@
/* only weird assemblers generally need this */
#undef __UCLIBC_ASM_LINE_SEP__
+
+/* The __ARM_ARCH define is provided by gcc 4.8. Construct it otherwise. */
+#ifndef __ARM_ARCH
+# ifdef __ARM_ARCH_2__
+# define __ARM_ARCH 2
+# elif defined (__ARM_ARCH_3__) || defined (__ARM_ARCH_3M__)
+# define __ARM_ARCH 3
+# elif defined (__ARM_ARCH_4__) || defined (__ARM_ARCH_4T__)
+# define __ARM_ARCH 4
+# elif defined (__ARM_ARCH_5__) || defined (__ARM_ARCH_5E__) \
+ || defined(__ARM_ARCH_5T__) || defined(__ARM_ARCH_5TE__) \
+ || defined(__ARM_ARCH_5TEJ__)
+# define __ARM_ARCH 5
+# elif defined (__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
+ || defined (__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) \
+ || defined (__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__)
+# define __ARM_ARCH 6
+# elif defined (__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
+ || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
+ || defined(__ARM_ARCH_7EM__)
+# define __ARM_ARCH 7
+# else
+# error unknown arm architecture
+# endif
+#endif
+
#ifdef __GNUC__
# define __need_uClibc_config_h
# include <bits/uClibc_config.h>
diff --git a/libc/sysdeps/linux/arm/clone.S b/libc/sysdeps/linux/arm/clone.S
index d1c9239da..b4c7d8a02 100644
--- a/libc/sysdeps/linux/arm/clone.S
+++ b/libc/sysdeps/linux/arm/clone.S
@@ -128,11 +128,8 @@ __clone:
beq 1f
pop {r4, r7}
blt __error
-#if defined(__USE_BX__)
- bxne lr
-#else
- movne pc, lr
-#endif
+ IT(t, ne)
+ BXC(ne, lr)
cfi_startproc
.fnend
diff --git a/libc/sysdeps/linux/arm/mmap64.S b/libc/sysdeps/linux/arm/mmap64.S
index f4c491aac..c9f2bd2f7 100644
--- a/libc/sysdeps/linux/arm/mmap64.S
+++ b/libc/sysdeps/linux/arm/mmap64.S
@@ -92,11 +92,7 @@ mmap64:
cmn r0, $4096
ldmfd sp!, {r4, r5}
IT(t, cc)
-#if defined(__USE_BX__)
- bxcc lr
-#else
- movcc pc, lr
-#endif
+ BXC(cc, lr)
b __syscall_error
.Linval:
mov r0, $-EINVAL
diff --git a/libc/sysdeps/linux/arm/syscall-eabi.S b/libc/sysdeps/linux/arm/syscall-eabi.S
index 005cfe357..534c6e988 100644
--- a/libc/sysdeps/linux/arm/syscall-eabi.S
+++ b/libc/sysdeps/linux/arm/syscall-eabi.S
@@ -15,7 +15,7 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <sys/syscall.h>
+#include <features.h>
#include <bits/arm_asm.h>
#include <bits/arm_bx.h>
@@ -62,11 +62,7 @@ syscall:
ldmfd sp!, {r4, r5, r6, r7}
cmn r0, #4096
IT(t, cc)
-#if defined(__USE_BX__)
- bxcc lr
-#else
- movcc pc, lr
-#endif
+ BXC(cc, lr)
b __syscall_error
#endif
diff --git a/libc/sysdeps/linux/arm/sysdep.h b/libc/sysdeps/linux/arm/sysdep.h
index 2d0a9cc41..7f1e9c1a9 100644
--- a/libc/sysdeps/linux/arm/sysdep.h
+++ b/libc/sysdeps/linux/arm/sysdep.h
@@ -21,7 +21,6 @@
#include <common/sysdep.h>
#include <bits/arm_bx.h>
-
#include <sys/syscall.h>
/* For Linux we can use the system call table in the header file
/usr/include/asm/unistd.h
@@ -50,17 +49,10 @@
#ifdef __APCS_32__
#define LOADREGS(cond, base, reglist...)\
ldm##cond base,reglist
-#ifdef __USE_BX__
-#define RETINSTR(cond, reg) \
- bx##cond reg
-#define DO_RET(_reg) \
- bx _reg
-#else
-#define RETINSTR(cond, reg) \
- mov##cond pc, reg
+#define RETINSTR(cond, reg) \
+ BXC(cond, reg)
#define DO_RET(_reg) \
- mov pc, _reg
-#endif
+ BX(_reg)
#else /* APCS-26 */
#define LOADREGS(cond, base, reglist...) \
ldm##cond base,reglist^
diff --git a/libc/sysdeps/linux/arm/vfork.S b/libc/sysdeps/linux/arm/vfork.S
index 99fb6cb1f..221a90c40 100644
--- a/libc/sysdeps/linux/arm/vfork.S
+++ b/libc/sysdeps/linux/arm/vfork.S
@@ -74,11 +74,7 @@ __vfork:
RESTORE_PID
cmn r0, #4096
IT(t, cc)
-#if defined(__USE_BX__)
- bxcc lr
-#else
- movcc pc, lr
-#endif
+ BXC(cc, lr)
/* Check if vfork even exists. */
ldr r1, =-ENOSYS
@@ -92,11 +88,7 @@ __vfork:
/* Syscall worked. Return to child/parent */
IT(t, cc)
-#if defined(__USE_BX__)
- bxcc lr
-#else
- movcc pc, lr
-#endif
+ BXC(cc, lr)
__error:
b __syscall_error