Browse Source

Merge commit 'origin/master' into prelink

Carmelo Amoroso 15 years ago
parent
commit
d181797c70

+ 2 - 2
Makefile.in

@@ -280,10 +280,10 @@ HEADERS_RM-$(UCLIBC_SUSV4_LEGACY)            += utime.h
 	### ucontext.h
 	### ucontext.h
 
 
 ifneq ($(findstring install,$(MAKECMDGOALS)),)
 ifneq ($(findstring install,$(MAKECMDGOALS)),)
-$(addprefix $(PREFIX)$(DEVEL_PREFIX),include lib):
+$(addprefix $(PREFIX)$(DEVEL_PREFIX),include $(MULTILIB_DIR)):
 	$(do_mkdir)
 	$(do_mkdir)
 # avoid warning about duplicate targets in rule or overrides
 # avoid warning about duplicate targets in rule or overrides
-ifneq ($(abspath $(RUNTIME_PREFIX)$(MULTILIB_DIR)),$(abspath $(DEVEL_PREFIX)lib))
+ifneq ($(abspath $(RUNTIME_PREFIX)$(MULTILIB_DIR)),$(abspath $(DEVEL_PREFIX)$(MULTILIB_DIR)))
 $(PREFIX)$(RUNTIME_PREFIX)$(MULTILIB_DIR):
 $(PREFIX)$(RUNTIME_PREFIX)$(MULTILIB_DIR):
 	$(do_mkdir)
 	$(do_mkdir)
 endif
 endif

+ 0 - 3
extra/Configs/Config.sparc

@@ -19,9 +19,6 @@ choice
 	  This is the processor type of your CPU. This information is used for
 	  This is the processor type of your CPU. This information is used for
 	  optimizing purposes.  Building for a v8 SPARC is pretty safe nowadays.
 	  optimizing purposes.  Building for a v8 SPARC is pretty safe nowadays.
 
 
-	  Warning: shared library support requires v8 or better, so building for 
-	  SPARC v7 will give you only static support.
-
 config CONFIG_SPARC_V7
 config CONFIG_SPARC_V7
 	bool "SPARC v7"
 	bool "SPARC v7"
 
 

+ 1 - 1
include/stdlib.h

@@ -214,7 +214,7 @@ __END_NAMESPACE_STD
 
 
 /* Convert a string to a quadword integer.  */
 /* Convert a string to a quadword integer.  */
 __extension__
 __extension__
-extern long long int strtoq (__const char *__restrict __nptr,
+extern quad_t strtoq (__const char *__restrict __nptr,
 			     char **__restrict __endptr, int __base)
 			     char **__restrict __endptr, int __base)
      __THROW __nonnull ((1)) __wur;
      __THROW __nonnull ((1)) __wur;
 /* Convert a string to an unsigned quadword integer.  */
 /* Convert a string to an unsigned quadword integer.  */

+ 3 - 0
libc/stdlib/stdlib.c

@@ -342,6 +342,9 @@ extern __typeof(__XL_NPP(strtol)) __XL_NPP(strtoll);
 libc_hidden_proto(__XL_NPP(strtoll))
 libc_hidden_proto(__XL_NPP(strtoll))
 strong_alias(__XL_NPP(strtol),__XL_NPP(strtoll))
 strong_alias(__XL_NPP(strtol),__XL_NPP(strtoll))
 libc_hidden_def(__XL_NPP(strtoll))
 libc_hidden_def(__XL_NPP(strtoll))
+#if !defined(L_strtol_l)
+strong_alias(strtol,strtoq)
+#endif
 #endif
 #endif
 
 
 #endif
 #endif

+ 1 - 1
libpthread/nptl/sysdeps/mips/libc-tls.c

@@ -17,7 +17,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
    02111-1307 USA.  */
 
 
-#include <../generic/libc-tls.c>
+#include <sysdeps/generic/libc-tls.c>
 #include <dl-tls.h>
 #include <dl-tls.h>
 
 
 #if USE_TLS
 #if USE_TLS

+ 1 - 1
libpthread/nptl/sysdeps/sh/Makefile.arch

@@ -10,4 +10,4 @@ ASFLAGS-pthread_spin_trylock.S = -DNOT_IN_libc -DIS_IN_libpthread
 
 
 CFLAGS-pthread_spin_lock.c += -D_GNU_SOURCE
 CFLAGS-pthread_spin_lock.c += -D_GNU_SOURCE
 
 
-
+libc_arch_a_CSRC := libc-tls.c

+ 31 - 0
libpthread/nptl/sysdeps/sh/libc-tls.c

@@ -0,0 +1,31 @@
+/*
+ * Thread-local storage handling in statically linked binaries.  SH version.
+ * Copyright (C) 2009 Free Software Foundation, Inc.
+ *
+ * Based on GNU C Library (file: libc/sysdeps/sh/libc-tls.c)
+ *
+ * Copyright (C) 2010 STMicroelectronics Ltd.
+ * Author: Filippo Arcidiacono <filippo.arcidiacono@st.com>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ *
+ */
+
+#include <sysdeps/generic/libc-tls.c>
+#include <dl-tls.h>
+
+#if defined (USE_TLS) && (USE_TLS)
+
+/* On SH, linker optimizations are not required, so __tls_get_addr
+   can be called even in statically linked binaries.  In this case module
+   must be always 1 and PT_TLS segment exist in the binary, otherwise it
+   would not link.  */
+
+void *
+__tls_get_addr (tls_index *ti)
+{
+  dtv_t *dtv = THREAD_DTV ();
+  return (char *) dtv[1].pointer.val + ti->ti_offset;
+}
+
+#endif

+ 1 - 0
test/.gitignore

@@ -256,6 +256,7 @@ stdlib/test-canon
 stdlib/test-canon2
 stdlib/test-canon2
 stdlib/teston_exit
 stdlib/teston_exit
 stdlib/teststrtol
 stdlib/teststrtol
+stdlib/teststrtoq
 string/bug-strcoll1
 string/bug-strcoll1
 string/bug-strncat1
 string/bug-strncat1
 string/bug-strpbrk1
 string/bug-strpbrk1

+ 89 - 0
test/stdlib/teststrtoq.c

@@ -0,0 +1,89 @@
+
+#include <stdlib.h>
+#include <stdio.h>
+
+
+const char *strings[]={
+	/* some simple stuff */
+	"0", "1", "10",
+	"100", "1000", "10000", "100000", "1000000",
+	"10000000", "100000000", "1000000000",
+
+	/* negative */
+	"-0", "-1", "-10",
+	"-100", "-1000", "-10000", "-100000", "-1000000",
+	"-10000000", "-100000000", "-1000000000",
+
+	/* test base>10 */
+	"a", "b", "f", "g", "z",
+
+	/* test hex */
+	"0x0", "0x1", "0xa", "0xf", "0x10",
+
+	/* test octal */
+	"00", "01", "07", "08", "0a", "010",
+
+	/* other */
+	"0x8000000",
+
+	/* check overflow cases: (for 32 bit) */
+	"2147483645",
+	"2147483646",
+	"2147483647",
+	"2147483648",
+	"2147483649",
+	"-2147483645",
+	"-2147483646",
+	"-2147483647",
+	"-2147483648",
+	"-2147483649",
+	"4294967293",
+	"4294967294",
+	"4294967295",
+	"4294967296",
+	"4294967297",
+	"-4294967293",
+	"-4294967294",
+	"-4294967295",
+	"-4294967296",
+	"-4294967297",
+
+	/* bad input tests */
+	"",
+	"00",
+	"0x",
+	"0x0",
+	"-",
+	"+",
+	" ",
+	" -",
+	" - 0",
+};
+int n_tests=sizeof(strings)/sizeof(strings[0]);
+
+
+
+void do_test(int base);
+void do_test(int base)
+{
+	int i;
+	quad_t n;
+	char *endptr;
+
+	for(i=0;i<n_tests;i++){
+		n=strtoq(strings[i],&endptr,base);
+		printf("strtoq(\"%s\",%d) len=%lu res=%qd\n",
+			strings[i],base,(unsigned long)(endptr-strings[i]),n);
+	}
+}
+
+int main(int argc,char *argv[])
+{
+	do_test(0);
+	do_test(8);
+	do_test(10);
+	do_test(16);
+	do_test(36);
+
+	return 0;
+}