From 0c468129356f5ce6780e7369c271d74631ae03ba Mon Sep 17 00:00:00 2001 From: Carmelo Amoroso Date: Mon, 29 Nov 2010 22:21:52 +0100 Subject: libc_tls: Do not include generic libc-tls from arch specific implementation libpthread/nptl/sysdeps/generic/libc-tls.c is built as well, so it does not need that arch specific version of libc-tls.c (MIPS and ALPHA) includes it. The arch libc-tls.s is aimed to provide the implementation of __tls_get_addr for the static libc.a, because on these archs the linker relaxations are not required and it could be possible to have local-dynamic access models in static libraries as well. Signed-off-by: Carmelo Amoroso --- libpthread/nptl/sysdeps/alpha/libc-tls.c | 1 - libpthread/nptl/sysdeps/mips/libc-tls.c | 1 - 2 files changed, 2 deletions(-) diff --git a/libpthread/nptl/sysdeps/alpha/libc-tls.c b/libpthread/nptl/sysdeps/alpha/libc-tls.c index a3b68e928..01f6f3c04 100644 --- a/libpthread/nptl/sysdeps/alpha/libc-tls.c +++ b/libpthread/nptl/sysdeps/alpha/libc-tls.c @@ -17,7 +17,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include #include #if USE_TLS diff --git a/libpthread/nptl/sysdeps/mips/libc-tls.c b/libpthread/nptl/sysdeps/mips/libc-tls.c index fdedc9f5a..7bbba01d1 100644 --- a/libpthread/nptl/sysdeps/mips/libc-tls.c +++ b/libpthread/nptl/sysdeps/mips/libc-tls.c @@ -17,7 +17,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include <../generic/libc-tls.c> #include #if USE_TLS -- cgit v1.2.3 From bfeeeb57588f6a58d6a154fbc59b30fb48e27956 Mon Sep 17 00:00:00 2001 From: Carmelo Amoroso Date: Wed, 1 Dec 2010 17:04:05 +0100 Subject: Revert "libc_tls: Do not include generic libc-tls from arch specific implementation" This reverts commit 0c468129356f5ce6780e7369c271d74631ae03ba. Indeed recent updates into buildsys managed to filter-out generic implementation when arch specific one is defined, so duplicated symbols into the libc.a In the meanwhile, do a minor fix into mips version not using relative path to include Signed-off-by: Carmelo Amoroso --- libpthread/nptl/sysdeps/alpha/libc-tls.c | 1 + libpthread/nptl/sysdeps/mips/libc-tls.c | 1 + 2 files changed, 2 insertions(+) diff --git a/libpthread/nptl/sysdeps/alpha/libc-tls.c b/libpthread/nptl/sysdeps/alpha/libc-tls.c index 01f6f3c04..a3b68e928 100644 --- a/libpthread/nptl/sysdeps/alpha/libc-tls.c +++ b/libpthread/nptl/sysdeps/alpha/libc-tls.c @@ -17,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include #include #if USE_TLS diff --git a/libpthread/nptl/sysdeps/mips/libc-tls.c b/libpthread/nptl/sysdeps/mips/libc-tls.c index 7bbba01d1..157ba3389 100644 --- a/libpthread/nptl/sysdeps/mips/libc-tls.c +++ b/libpthread/nptl/sysdeps/mips/libc-tls.c @@ -17,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include #include #if USE_TLS -- cgit v1.2.3 From c5db8f051be9846485911e973f26943c114c66fb Mon Sep 17 00:00:00 2001 From: Filippo Arcidiacono Date: Mon, 29 Nov 2010 23:31:49 +0100 Subject: libc_sh: add __tls_get_addr to static libc (SH) Add __tls_get_addr function to static libc allowing to handle local dynamic TLS access model. On SH, linker optimizations are not required, so __tls_get_addr can be called even in statically linked binaries. Signed-off-by: Filippo Arcidiacono Signed-off-by: Carmelo Amoroso --- libpthread/nptl/sysdeps/sh/Makefile.arch | 2 +- libpthread/nptl/sysdeps/sh/libc-tls.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 libpthread/nptl/sysdeps/sh/libc-tls.c diff --git a/libpthread/nptl/sysdeps/sh/Makefile.arch b/libpthread/nptl/sysdeps/sh/Makefile.arch index 3cb58ec36..411622adc 100644 --- a/libpthread/nptl/sysdeps/sh/Makefile.arch +++ b/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 - +libc_arch_a_CSRC := libc-tls.c diff --git a/libpthread/nptl/sysdeps/sh/libc-tls.c b/libpthread/nptl/sysdeps/sh/libc-tls.c new file mode 100644 index 000000000..7b3389503 --- /dev/null +++ b/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 + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + * + */ + +#include +#include + +#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 -- cgit v1.2.3 From 78009d25addb8487702f902ed4ad581a5004bfe9 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Fri, 26 Nov 2010 14:49:56 +0000 Subject: libc: fix strtoq strtoq should always return a quad_t and be an alias of strtol on 64 bit and strtoll on 32 bit. Signed-off-by: Natanael Copa Signed-off-by: Bernhard Reutner-Fischer --- include/stdlib.h | 2 +- libc/stdlib/stdlib.c | 3 ++ test/.gitignore | 1 + test/stdlib/teststrtoq.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 test/stdlib/teststrtoq.c diff --git a/include/stdlib.h b/include/stdlib.h index ce92ccd28..300edf04a 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -214,7 +214,7 @@ __END_NAMESPACE_STD /* Convert a string to a quadword integer. */ __extension__ -extern long long int strtoq (__const char *__restrict __nptr, +extern quad_t strtoq (__const char *__restrict __nptr, char **__restrict __endptr, int __base) __THROW __nonnull ((1)) __wur; /* Convert a string to an unsigned quadword integer. */ diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c index ad0c4aac0..4d608eeac 100644 --- a/libc/stdlib/stdlib.c +++ b/libc/stdlib/stdlib.c @@ -342,6 +342,9 @@ extern __typeof(__XL_NPP(strtol)) __XL_NPP(strtoll); libc_hidden_proto(__XL_NPP(strtoll)) strong_alias(__XL_NPP(strtol),__XL_NPP(strtoll)) libc_hidden_def(__XL_NPP(strtoll)) +#if !defined(L_strtol_l) +strong_alias(strtol,strtoq) +#endif #endif #endif diff --git a/test/.gitignore b/test/.gitignore index 605d16d55..991ce5f85 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -256,6 +256,7 @@ stdlib/test-canon stdlib/test-canon2 stdlib/teston_exit stdlib/teststrtol +stdlib/teststrtoq string/bug-strcoll1 string/bug-strncat1 string/bug-strpbrk1 diff --git a/test/stdlib/teststrtoq.c b/test/stdlib/teststrtoq.c new file mode 100644 index 000000000..6e1a4cbc6 --- /dev/null +++ b/test/stdlib/teststrtoq.c @@ -0,0 +1,89 @@ + +#include +#include + + +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 Date: Wed, 1 Dec 2010 15:32:41 -0800 Subject: Config.sparc: remove warning about shared libs on v7 Signed-off-by: Austin Foxley --- extra/Configs/Config.sparc | 3 --- 1 file changed, 3 deletions(-) diff --git a/extra/Configs/Config.sparc b/extra/Configs/Config.sparc index dd8949039..1852efee9 100644 --- a/extra/Configs/Config.sparc +++ b/extra/Configs/Config.sparc @@ -19,9 +19,6 @@ choice This is the processor type of your CPU. This information is used for 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 bool "SPARC v7" -- cgit v1.2.3 From e2903ddb06b1f50cb4ac9af0b035c74ed6b9d30f Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Tue, 24 Aug 2010 08:19:27 +0000 Subject: create DEVEL_PREFIX/MULTILIB_DIR dir rather than DEVEL_PREFIX/lib This fixes issue with GNU Make 3.82 when running: make install DESTDIR=$someplace Signed-off-by: Natanael Copa Signed-off-by: Khem Raj --- Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index b199293ae..3399f8842 100644 --- a/Makefile.in +++ b/Makefile.in @@ -280,10 +280,10 @@ HEADERS_RM-$(UCLIBC_SUSV4_LEGACY) += utime.h ### ucontext.h ifneq ($(findstring install,$(MAKECMDGOALS)),) -$(addprefix $(PREFIX)$(DEVEL_PREFIX),include lib): +$(addprefix $(PREFIX)$(DEVEL_PREFIX),include $(MULTILIB_DIR)): $(do_mkdir) # 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): $(do_mkdir) endif -- cgit v1.2.3