[uclibc-ng-devel] uClibc-ng - small C library for embedded systems branch upstream updated. f1f98784e65ce9621a570af50998b1940e7fb81d

wbx wbx at helium.waldemar-brodkorb.de
Thu Apr 23 00:01:25 CEST 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".

The branch, upstream has been updated
       via  f1f98784e65ce9621a570af50998b1940e7fb81d (commit)
       via  6173ee4f61b1c7a9c2c670952f9a18345e614c90 (commit)
       via  e71fc570caec4f2d4bbe729dfe9eb41bfe5a732a (commit)
       via  298f58e073b2782bd264edea969769b7b5e7cf41 (commit)
       via  7c78a5c52b2db6bb0d6e163b38897a003a289958 (commit)
       via  8e04c064c4cb39bae5e5bec166c762d2fc88cb11 (commit)
       via  9058b43530b6be9146ea3448e8a5f642c09a1818 (commit)
      from  c78cc48514723c9182a4fb5baa35bd59b8485cc7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit f1f98784e65ce9621a570af50998b1940e7fb81d
Author: Alexey Brodkin <abrodkin at synopsys.com>
Date:   Wed Apr 22 09:31:38 2015 +0530

    ARC: enable more options to satisfy build requirements of applications
    
    As reported by Buildroot autobuilder following options were missing:
    
     * Libutil stub (UCLIBC_HAS_LIBUTIL option)
       http://autobuild.buildroot.org/results/ce3/ce39eb9b9ece0968563641fb2207099d1a37b191/
    
     * Program_invocation_name (UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y)
       http://autobuild.buildroot.org/results/154/1546d909e606daefd41b87dece94d642c0fdeba4/
       http://autobuild.buildroot.org/results/bd5/bd54581d7b0cc73bc501072d27e870a443dfce79/
    
     * Ifaddrd support (UCLIBC_SUPPORT_AI_ADDRCONFIG=y)
       http://autobuild.buildroot.org/results/134/134e78ef1fa87f7fbf26c23ec5dfc68785d79613/
    
     * Libnsl (UCLIBC_HAS_LIBNSL_STUB=y)
       http://autobuild.buildroot.net/results/331/331ed781b422448205fb9e7c9730ec0c438d6306/
       http://autobuild.buildroot.net/results/402/402d64965ac7ac6e1d4e1990080394958802fe8c/
       http://autobuild.buildroot.net/results/960/9605bac2972d3e3d3fb91947ae6921e89210247b/
       http://autobuild.buildroot.net/results/6b6/6b61ea80a3a6dcead233c4b408eba8b8d647e841/
    
    * UTMP got reworked recently, which breaks packages such as busybox, gdbserver
      etc so enable that too
    
    Enabling mentioned options to make sure more packages could be built with ARC pre-built uClibc tools.
    
    Note UCLIBC_USE_NETLINK is a prerequisite for UCLIBC_SUPPORT_AI_ADDRCONFIG.
    
    Signed-off-by: Alexey Brodkin <abrodkin at synopsys.com>
    Cc: Anton Kolesov <akolesov at synopsys.com>
    Signed-off-by: Vineet Gupta <vgupta at synopsys.com>
    Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>

commit 6173ee4f61b1c7a9c2c670952f9a18345e614c90
Author: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
Date:   Sat Apr 18 22:57:45 2015 +0200

    buildsys: pregen depends on xlocale
    
    since ae9e3f46 sched.h pulls in stdlib.h (for malloc() and free()) and
    thus also xlocale..
    
    Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>

commit e71fc570caec4f2d4bbe729dfe9eb41bfe5a732a
Author: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
Date:   Sat Apr 18 22:41:46 2015 +0200

    arm: Add BX and BXC macros
    
    Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>

commit 298f58e073b2782bd264edea969769b7b5e7cf41
Author: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
Date:   Sat Apr 18 22:38:29 2015 +0200

    arm: Fix POP_RET for armv4t && interworking
    
    It seems the condition was reversed which lead to e.g. arm-920t being
    confused
    
    Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>

commit 7c78a5c52b2db6bb0d6e163b38897a003a289958
Author: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
Date:   Sat Apr 18 21:37:30 2015 +0200

    NPTL: Rename a variable
    
    There seems to be a bug in gold with static TLS at least on x86_64 (?)
    
    Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>

commit 8e04c064c4cb39bae5e5bec166c762d2fc88cb11
Author: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
Date:   Sat Apr 18 21:36:26 2015 +0200

    ldso: PRELINK: Remove surplus newline
    
    in early debugging code
    
    Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>

commit 9058b43530b6be9146ea3448e8a5f642c09a1818
Author: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
Date:   Sat Apr 18 20:24:44 2015 +0200

    buildsys: try to merge all constants
    
    Saves a couple of bytes
    
    Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>

-----------------------------------------------------------------------

Summary of changes:
 Rules.mak                                          |    2 ++
 extra/Configs/defconfigs/arc/arcv2_defconfig       |    6 +++++
 extra/Configs/defconfigs/arc/defconfig             |    6 +++++
 extra/locale/Makefile.in                           |    4 +--
 include/libc-symbols.h                             |    2 +-
 ldso/include/ldsodefs.h                            |    2 ++
 ldso/ldso/arm/dl-startup.h                         |   12 ++-------
 ldso/ldso/arm/resolve.S                            |   18 +++++---------
 ldso/ldso/dl-tls.c                                 |    9 +++++--
 ldso/ldso/ldso.c                                   |    3 ++-
 libc/misc/pthread/tsd.c                            |   11 +++++++--
 libc/string/arm/_memcpy.S                          |   18 +++-----------
 libc/string/arm/memcmp.S                           |   12 ++-------
 libc/string/arm/memset.S                           |   13 ++--------
 libc/string/arm/strcmp.S                           |    6 +----
 libc/string/arm/strlen.S                           |    7 +-----
 libc/sysdeps/linux/arm/__longjmp.S                 |    7 +-----
 libc/sysdeps/linux/arm/bits/arm_asm.h              |   12 ++++-----
 libc/sysdeps/linux/arm/bits/arm_bx.h               |   12 ++++++---
 libc/sysdeps/linux/arm/bits/uClibc_arch_features.h |   26 ++++++++++++++++++++
 libc/sysdeps/linux/arm/clone.S                     |    6 +----
 libc/sysdeps/linux/arm/mmap64.S                    |    6 +----
 libc/sysdeps/linux/arm/syscall-eabi.S              |    8 ++----
 libc/sysdeps/linux/arm/sysdep.h                    |   14 +++--------
 libc/sysdeps/linux/arm/vfork.S                     |   12 ++-------
 25 files changed, 105 insertions(+), 129 deletions(-)

diff --git a/Rules.mak b/Rules.mak
index 71ceb90..aa2e3a7 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -296,6 +296,8 @@ CPU_CFLAGS-y := -funsigned-char -fno-builtin
 
 $(eval $(call check-gcc-var,-fno-asm))
 CPU_CFLAGS-y += $(CFLAG_-fno-asm)
+$(eval $(call check-gcc-var,-fmerge-all-constants))
+CPU_CFLAGS-y += $(CFLAG_-fmerge-all-constants)
 
 LDADD_LIBFLOAT=
 ifeq ($(UCLIBC_HAS_SOFT_FLOAT),y)
diff --git a/extra/Configs/defconfigs/arc/arcv2_defconfig b/extra/Configs/defconfigs/arc/arcv2_defconfig
index 7c4694e..1e204aa 100644
--- a/extra/Configs/defconfigs/arc/arcv2_defconfig
+++ b/extra/Configs/defconfigs/arc/arcv2_defconfig
@@ -10,16 +10,22 @@ LDSO_RUNPATH=y
 UCLIBC_HAS_THREADS_NATIVE=y
 PTHREADS_DEBUG_SUPPORT=y
 UCLIBC_HAS_OBSTACK=y
+UCLIBC_HAS_UTMPX=y
+UCLIBC_HAS_UTMP=y
 UCLIBC_SUSV2_LEGACY=y
 UCLIBC_SUSV3_LEGACY=y
 UCLIBC_SUSV4_LEGACY=y
 UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y
+UCLIBC_HAS_LIBUTIL=y
 UCLIBC_HAS_OBSOLETE_BSD_SIGNAL=y
 UCLIBC_SV4_DEPRECATED=y
 UCLIBC_HAS_RPC=y
 UCLIBC_HAS_FULL_RPC=y
+UCLIBC_USE_NETLINK=y
+UCLIBC_SUPPORT_AI_ADDRCONFIG=y
 UCLIBC_HAS_RESOLVER_SUPPORT=y
 UCLIBC_HAS_LIBRESOLV_STUB=y
+UCLIBC_HAS_LIBNSL_STUB=y
 UCLIBC_HAS_LOCALE=y
 UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y
 UCLIBC_HAS_NFTW=y
diff --git a/extra/Configs/defconfigs/arc/defconfig b/extra/Configs/defconfigs/arc/defconfig
index eebb115..994abeb 100644
--- a/extra/Configs/defconfigs/arc/defconfig
+++ b/extra/Configs/defconfigs/arc/defconfig
@@ -9,16 +9,22 @@ LDSO_RUNPATH=y
 UCLIBC_HAS_THREADS_NATIVE=y
 PTHREADS_DEBUG_SUPPORT=y
 UCLIBC_HAS_OBSTACK=y
+UCLIBC_HAS_UTMPX=y
+UCLIBC_HAS_UTMP=y
 UCLIBC_SUSV2_LEGACY=y
 UCLIBC_SUSV3_LEGACY=y
 UCLIBC_SUSV4_LEGACY=y
 UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y
+UCLIBC_HAS_LIBUTIL=y
 UCLIBC_HAS_OBSOLETE_BSD_SIGNAL=y
 UCLIBC_SV4_DEPRECATED=y
 UCLIBC_HAS_RPC=y
 UCLIBC_HAS_FULL_RPC=y
+UCLIBC_USE_NETLINK=y
+UCLIBC_SUPPORT_AI_ADDRCONFIG=y
 UCLIBC_HAS_RESOLVER_SUPPORT=y
 UCLIBC_HAS_LIBRESOLV_STUB=y
+UCLIBC_HAS_LIBNSL_STUB=y
 UCLIBC_HAS_LOCALE=y
 UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y
 UCLIBC_HAS_NFTW=y
diff --git a/extra/locale/Makefile.in b/extra/locale/Makefile.in
index 3834c5c..1a2305b 100644
--- a/extra/locale/Makefile.in
+++ b/extra/locale/Makefile.in
@@ -46,7 +46,7 @@ locale_OBJ := $(locale_OUT)/locale_data.o
 
 CFLAGS-locale_data.c := -D__WCHAR_ENABLED -I$(locale_OUT) -I$(locale_DIR)
 
-#headers-$(UCLIBC_HAS_LOCALE) += $(locale_headers-y)
+headers_dep += $(locale_headers-y)
 headers: $(locale_headers-y)
 
 libc-$(UCLIBC_HAS_LOCALE) += $(locale_OBJ)
@@ -68,7 +68,7 @@ $(locale_OUT)%.s:  $(locale_OUT)%.S FORCE ; $(compile.s)
 $(locale_OUT)%.dep:
 
 
-locale_headers: headers $(top_builddir)include/bits/uClibc_locale_data.h
+locale_headers: $(top_builddir)include/bits/uClibc_locale_data.h
 
 # make sure that the host system has locales (this check is ok for uClibc/glibc)
 # we do not know though which locales were really enabled for libc at build time
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index a87cde6..97463ac 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -111,7 +111,7 @@
 /* Indirect stringification.  Doing two levels allows
  * the parameter to be a macro itself.
  */
-#define __stringify_1(x)    #x
+#define __stringify_1(x...)    #x
 #define __stringify(x)      __stringify_1(x)
 
 #ifdef __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
diff --git a/ldso/include/ldsodefs.h b/ldso/include/ldsodefs.h
index 4063d00..0feed89 100644
--- a/ldso/include/ldsodefs.h
+++ b/ldso/include/ldsodefs.h
@@ -106,7 +106,9 @@ EXTERN size_t _dl_tls_static_used;
 /* Alignment requirement of the static TLS block.  */
 EXTERN size_t _dl_tls_static_align;
 /* Function pointer for catching TLS errors.  */
+#if 1 /* def _LIBC_REENTRANT */
 EXTERN void **(*_dl_error_catch_tsd) (void) __attribute__ ((const));
+#endif
 
 /* Number of additional entries in the slotinfo array of each slotinfo
    list element.  A large number makes it almost certain take we never
diff --git a/ldso/ldso/arm/dl-startup.h b/ldso/ldso/arm/dl-startup.h
index df2c824..eb2a9a2 100644
--- a/ldso/ldso/arm/dl-startup.h
+++ b/ldso/ldso/arm/dl-startup.h
@@ -47,11 +47,7 @@ __asm__(
 	"	ldr	r0, .L_FINI_PROC\n"
 	"	ldr	r0, [sl, r0]\n"
 	"	@ jump to the user_s entry point\n"
-#if defined(__USE_BX__)
-	"	bx	r6\n"
-#else
-	"	mov	pc, r6\n"
-#endif
+	"	" __stringify(BX(r6)) "\n"
 	".L_GET_GOT:\n"
 	"	.word	_GLOBAL_OFFSET_TABLE_ - .L_GOT_GOT - 4\n"
 	".L_SKIP_ARGS:\n"
@@ -113,11 +109,7 @@ __asm__(
 	"	ldr	r0, .L_FINI_PROC\n"
 	"	ldr	r0, [r7, r0]\n"
 	"	@ jump to the user_s entry point\n"
-#if defined(__USE_BX__)
-	"	bx	r6\n"
-#else
-	"	mov	pc, r6\n"
-#endif
+	"	" __stringify(BX(r6)) "\n"
 	"\n\n"
 	".L_GET_GOT:\n"
 	"	.word	_GLOBAL_OFFSET_TABLE_ - .L_GOT_GOT - 4\n"
diff --git a/ldso/ldso/arm/resolve.S b/ldso/ldso/arm/resolve.S
index c1caf9a..7e0058e 100644
--- a/ldso/ldso/arm/resolve.S
+++ b/ldso/ldso/arm/resolve.S
@@ -90,12 +90,10 @@
  * dl-startup.c).
  */
 
-#include <sys/syscall.h>
+#include <features.h>
 #include <bits/arm_asm.h>
 #include <bits/arm_bx.h>
 
-#include <features.h>
-
 #define sl r10
 #define fp r11
 #define ip r12
@@ -114,8 +112,8 @@ _dl_linux_resolve:
          @ function must branch to the real function, and that expects
          @ r0-r3 and lr to be as they were before the whole PLT stuff -
          @ ip can be trashed.
-	 @ This routine is called after pushing lr, so we must push an odd
-	 @ number of words to keep the stack correctly aligned.
+         @ This routine is called after pushing lr, so we must push an odd
+         @ number of words to keep the stack correctly aligned.
 
          stmdb sp!, {r0, r1, r2, r3, r4}
          ldr r0, [lr, #-4]       @ r0 :        = [lr-4] (GOT_TABLE[1])
@@ -124,16 +122,12 @@ _dl_linux_resolve:
                                  @ ~x = -x-1, therefore ~(r1>>2) = (-((lr-ip)>>2)-1)
                                  @ = - ((lr-ip)/4) - 1 = (ip - lr - 4)/4, as required
 
-	bl _dl_linux_resolver
+        bl _dl_linux_resolver
 
-	mov ip, r0
+        mov ip, r0
         ldmia sp!, {r0, r1, r2, r3, r4, lr}
 
-#if defined(__USE_BX__)
-	bx ip
-#else
-	mov pc,ip
-#endif
+        BX(ip)
 #else
        @ In the thumb case _dl_linux_resolver is thumb.  If a bl is used
        @ from arm code the linker will insert a stub call which, with
diff --git a/ldso/ldso/dl-tls.c b/ldso/ldso/dl-tls.c
index 6679693..05193a8 100644
--- a/ldso/ldso/dl-tls.c
+++ b/ldso/ldso/dl-tls.c
@@ -950,8 +950,13 @@ static bool tls_init_tp_called;
 void ** __attribute__ ((const))
 _dl_initial_error_catch_tsd (void)
 {
-	static void *data;
-	return &data;
+	static
+#if 0 /* def ARCH_NEEDS_BOOTSTRAP_RELOCS */
+		/* If we have to do bootstrap relocs anyway we might as well */
+		__thread
+# endif
+		void *__tsd_data;
+	return &__tsd_data;
 }
 
 #ifdef SHARED
diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
index 5619629..f38f9e3 100644
--- a/ldso/ldso/ldso.c
+++ b/ldso/ldso/ldso.c
@@ -1196,6 +1196,7 @@ of this helper program; chances are you did not intend to run this program.\n\
 	}
 #endif
 #ifdef __UCLIBC_HAS_SSP__
+	_dl_debug_early("Setting up SSP guards\n");
 	/* Set up the stack checker's canary.  */
 	stack_chk_guard = _dl_setup_stack_chk_guard ();
 # ifdef THREAD_SET_STACK_GUARD
@@ -1268,7 +1269,7 @@ of this helper program; chances are you did not intend to run this program.\n\
 
 	}
 
-	_dl_debug_early ("\nprelink checking: %s\n", prelinked ? "ok" : "failed");
+	_dl_debug_early ("prelink checking: %s\n", prelinked ? "ok" : "failed");
 
 	if (prelinked) {
 		if (_dl_loaded_modules->dynamic_info[DT_GNU_CONFLICT_IDX]) {
diff --git a/libc/misc/pthread/tsd.c b/libc/misc/pthread/tsd.c
index 586ead3..3598b89 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 at 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 c59f5b8..2999e8e 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 9f78415..5b9473c 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 8ddc47e..2be4850 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 8b77ab0..81416a9 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 0e7737e..9995d76 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 853b906..58ae8ab 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 04664b3..898a78b 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 321490e..2c29089 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 b01d79c..e85aa52 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 03cd10e..63eca31 100644
--- a/libc/sysdeps/linux/arm/clone.S
+++ b/libc/sysdeps/linux/arm/clone.S
@@ -115,11 +115,7 @@ __clone:
 	ldmnefd	sp!, {r4}
 	blt	__error
 	IT(t, ne)
-#if defined(__USE_BX__)
-	bxne	lr
-#else
-	movne	pc, lr
-#endif
+	BXC(ne, lr)
 
 	@ pick the function arg and call address off the stack and execute
 	ldr	r0, [sp, #4]
diff --git a/libc/sysdeps/linux/arm/mmap64.S b/libc/sysdeps/linux/arm/mmap64.S
index f4c491a..c9f2bd2 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 005cfe3..534c6e9 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 64f4040..019dc37 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 99fb6cb..221a90c 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


hooks/post-receive
-- 
uClibc-ng - small C library for embedded systems


More information about the devel mailing list