From 6349a663038dbe7b59467c5bd06cd5f5dc91c867 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 6 Feb 2011 23:51:23 +0100 Subject: fix a problem with hidden getutent in non-threaded builds Signed-off-by: Denys Vlasenko --- libc/misc/utmp/utent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/misc/utmp/utent.c b/libc/misc/utmp/utent.c index bf265c2a3..11d615437 100644 --- a/libc/misc/utmp/utent.c +++ b/libc/misc/utmp/utent.c @@ -98,8 +98,8 @@ struct utmp *getutent(void) __UCLIBC_MUTEX_UNLOCK(utmplock); return ret; } -libc_hidden_def(getutent) #endif +libc_hidden_def(getutent) void endutent(void) { -- cgit v1.2.3 From 6a0aa4add30eecf76b9d14ad3f204e4017f9f22c Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 9 Feb 2011 20:08:20 +0100 Subject: arm: mv nptl specific atomic impl to common place Thanks to Nitin Garg for notincing! Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/arm/bits/atomic.h | 122 +++++++++++++++++++++ .../nptl/sysdeps/unix/sysv/linux/arm/bits/atomic.h | 122 --------------------- 2 files changed, 122 insertions(+), 122 deletions(-) create mode 100644 libc/sysdeps/linux/arm/bits/atomic.h delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/arm/bits/atomic.h diff --git a/libc/sysdeps/linux/arm/bits/atomic.h b/libc/sysdeps/linux/arm/bits/atomic.h new file mode 100644 index 000000000..8f63e2510 --- /dev/null +++ b/libc/sysdeps/linux/arm/bits/atomic.h @@ -0,0 +1,122 @@ +/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + + +typedef int8_t atomic8_t; +typedef uint8_t uatomic8_t; +typedef int_fast8_t atomic_fast8_t; +typedef uint_fast8_t uatomic_fast8_t; + +typedef int32_t atomic32_t; +typedef uint32_t uatomic32_t; +typedef int_fast32_t atomic_fast32_t; +typedef uint_fast32_t uatomic_fast32_t; + +typedef intptr_t atomicptr_t; +typedef uintptr_t uatomicptr_t; +typedef intmax_t atomic_max_t; +typedef uintmax_t uatomic_max_t; + +void __arm_link_error (void); + +#ifdef __thumb2__ +#define atomic_full_barrier() \ + __asm__ __volatile__ \ + ("movw\tip, #0x0fa0\n\t" \ + "movt\tip, #0xffff\n\t" \ + "blx\tip" \ + : : : "ip", "lr", "cc", "memory"); +#else +#define atomic_full_barrier() \ + __asm__ __volatile__ \ + ("mov\tip, #0xffff0fff\n\t" \ + "mov\tlr, pc\n\t" \ + "add\tpc, ip, #(0xffff0fa0 - 0xffff0fff)" \ + : : : "ip", "lr", "cc", "memory"); +#endif + +/* Atomic compare and exchange. This sequence relies on the kernel to + provide a compare and exchange operation which is atomic on the + current architecture, either via cleverness on pre-ARMv6 or via + ldrex / strex on ARMv6. */ + +#define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \ + ({ __arm_link_error (); oldval; }) + +#define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \ + ({ __arm_link_error (); oldval; }) + +/* It doesn't matter what register is used for a_oldval2, but we must + specify one to work around GCC PR rtl-optimization/21223. Otherwise + it may cause a_oldval or a_tmp to be moved to a different register. */ + +#ifdef __thumb2__ +/* Thumb-2 has ldrex/strex. However it does not have barrier instructions, + so we still need to use the kernel helper. */ +#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ + ({ register __typeof (oldval) a_oldval __asm__ ("r0"); \ + register __typeof (oldval) a_newval __asm__ ("r1") = (newval); \ + register __typeof (mem) a_ptr __asm__ ("r2") = (mem); \ + register __typeof (oldval) a_tmp __asm__ ("r3"); \ + register __typeof (oldval) a_oldval2 __asm__ ("r4") = (oldval); \ + __asm__ __volatile__ \ + ("0:\tldr\t%[tmp],[%[ptr]]\n\t" \ + "cmp\t%[tmp], %[old2]\n\t" \ + "bne\t1f\n\t" \ + "mov\t%[old], %[old2]\n\t" \ + "movw\t%[tmp], #0x0fc0\n\t" \ + "movt\t%[tmp], #0xffff\n\t" \ + "blx\t%[tmp]\n\t" \ + "bcc\t0b\n\t" \ + "mov\t%[tmp], %[old2]\n\t" \ + "1:" \ + : [old] "=&r" (a_oldval), [tmp] "=&r" (a_tmp) \ + : [new] "r" (a_newval), [ptr] "r" (a_ptr), \ + [old2] "r" (a_oldval2) \ + : "ip", "lr", "cc", "memory"); \ + a_tmp; }) +#else +#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ + ({ register __typeof (oldval) a_oldval __asm__ ("r0"); \ + register __typeof (oldval) a_newval __asm__ ("r1") = (newval); \ + register __typeof (mem) a_ptr __asm__ ("r2") = (mem); \ + register __typeof (oldval) a_tmp __asm__ ("r3"); \ + register __typeof (oldval) a_oldval2 __asm__ ("r4") = (oldval); \ + __asm__ __volatile__ \ + ("0:\tldr\t%[tmp],[%[ptr]]\n\t" \ + "cmp\t%[tmp], %[old2]\n\t" \ + "bne\t1f\n\t" \ + "mov\t%[old], %[old2]\n\t" \ + "mov\t%[tmp], #0xffff0fff\n\t" \ + "mov\tlr, pc\n\t" \ + "add\tpc, %[tmp], #(0xffff0fc0 - 0xffff0fff)\n\t" \ + "bcc\t0b\n\t" \ + "mov\t%[tmp], %[old2]\n\t" \ + "1:" \ + : [old] "=&r" (a_oldval), [tmp] "=&r" (a_tmp) \ + : [new] "r" (a_newval), [ptr] "r" (a_ptr), \ + [old2] "r" (a_oldval2) \ + : "ip", "lr", "cc", "memory"); \ + a_tmp; }) +#endif + +#define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \ + ({ __arm_link_error (); oldval; }) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/bits/atomic.h b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/bits/atomic.h deleted file mode 100644 index 8f63e2510..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/bits/atomic.h +++ /dev/null @@ -1,122 +0,0 @@ -/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#include - - -typedef int8_t atomic8_t; -typedef uint8_t uatomic8_t; -typedef int_fast8_t atomic_fast8_t; -typedef uint_fast8_t uatomic_fast8_t; - -typedef int32_t atomic32_t; -typedef uint32_t uatomic32_t; -typedef int_fast32_t atomic_fast32_t; -typedef uint_fast32_t uatomic_fast32_t; - -typedef intptr_t atomicptr_t; -typedef uintptr_t uatomicptr_t; -typedef intmax_t atomic_max_t; -typedef uintmax_t uatomic_max_t; - -void __arm_link_error (void); - -#ifdef __thumb2__ -#define atomic_full_barrier() \ - __asm__ __volatile__ \ - ("movw\tip, #0x0fa0\n\t" \ - "movt\tip, #0xffff\n\t" \ - "blx\tip" \ - : : : "ip", "lr", "cc", "memory"); -#else -#define atomic_full_barrier() \ - __asm__ __volatile__ \ - ("mov\tip, #0xffff0fff\n\t" \ - "mov\tlr, pc\n\t" \ - "add\tpc, ip, #(0xffff0fa0 - 0xffff0fff)" \ - : : : "ip", "lr", "cc", "memory"); -#endif - -/* Atomic compare and exchange. This sequence relies on the kernel to - provide a compare and exchange operation which is atomic on the - current architecture, either via cleverness on pre-ARMv6 or via - ldrex / strex on ARMv6. */ - -#define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \ - ({ __arm_link_error (); oldval; }) - -#define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \ - ({ __arm_link_error (); oldval; }) - -/* It doesn't matter what register is used for a_oldval2, but we must - specify one to work around GCC PR rtl-optimization/21223. Otherwise - it may cause a_oldval or a_tmp to be moved to a different register. */ - -#ifdef __thumb2__ -/* Thumb-2 has ldrex/strex. However it does not have barrier instructions, - so we still need to use the kernel helper. */ -#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ - ({ register __typeof (oldval) a_oldval __asm__ ("r0"); \ - register __typeof (oldval) a_newval __asm__ ("r1") = (newval); \ - register __typeof (mem) a_ptr __asm__ ("r2") = (mem); \ - register __typeof (oldval) a_tmp __asm__ ("r3"); \ - register __typeof (oldval) a_oldval2 __asm__ ("r4") = (oldval); \ - __asm__ __volatile__ \ - ("0:\tldr\t%[tmp],[%[ptr]]\n\t" \ - "cmp\t%[tmp], %[old2]\n\t" \ - "bne\t1f\n\t" \ - "mov\t%[old], %[old2]\n\t" \ - "movw\t%[tmp], #0x0fc0\n\t" \ - "movt\t%[tmp], #0xffff\n\t" \ - "blx\t%[tmp]\n\t" \ - "bcc\t0b\n\t" \ - "mov\t%[tmp], %[old2]\n\t" \ - "1:" \ - : [old] "=&r" (a_oldval), [tmp] "=&r" (a_tmp) \ - : [new] "r" (a_newval), [ptr] "r" (a_ptr), \ - [old2] "r" (a_oldval2) \ - : "ip", "lr", "cc", "memory"); \ - a_tmp; }) -#else -#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ - ({ register __typeof (oldval) a_oldval __asm__ ("r0"); \ - register __typeof (oldval) a_newval __asm__ ("r1") = (newval); \ - register __typeof (mem) a_ptr __asm__ ("r2") = (mem); \ - register __typeof (oldval) a_tmp __asm__ ("r3"); \ - register __typeof (oldval) a_oldval2 __asm__ ("r4") = (oldval); \ - __asm__ __volatile__ \ - ("0:\tldr\t%[tmp],[%[ptr]]\n\t" \ - "cmp\t%[tmp], %[old2]\n\t" \ - "bne\t1f\n\t" \ - "mov\t%[old], %[old2]\n\t" \ - "mov\t%[tmp], #0xffff0fff\n\t" \ - "mov\tlr, pc\n\t" \ - "add\tpc, %[tmp], #(0xffff0fc0 - 0xffff0fff)\n\t" \ - "bcc\t0b\n\t" \ - "mov\t%[tmp], %[old2]\n\t" \ - "1:" \ - : [old] "=&r" (a_oldval), [tmp] "=&r" (a_tmp) \ - : [new] "r" (a_newval), [ptr] "r" (a_ptr), \ - [old2] "r" (a_oldval2) \ - : "ip", "lr", "cc", "memory"); \ - a_tmp; }) -#endif - -#define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \ - ({ __arm_link_error (); oldval; }) -- cgit v1.2.3 From 6f810c757e5b14a97f05652972e91f95e321a404 Mon Sep 17 00:00:00 2001 From: Peter Korsgaard Date: Wed, 2 Feb 2011 17:58:38 +0100 Subject: sync bits/socket.h PF_* / AF_* values with 2.6.38-rc3 A number of new address / protocol families have been added over the years, so sync with Linux 2.6.38-rc3, adding CAN, ISDN, Phonet, Zigbee, .. which are starting to be used by applications. Signed-off-by: Peter Korsgaard Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/bits/socket.h | 22 +++++++++++++++++++++- libc/sysdeps/linux/mips/bits/socket.h | 22 +++++++++++++++++++++- libc/sysdeps/linux/sparc/bits/socket.h | 22 +++++++++++++++++++++- 3 files changed, 63 insertions(+), 3 deletions(-) diff --git a/libc/sysdeps/linux/common/bits/socket.h b/libc/sysdeps/linux/common/bits/socket.h index 11f6e9715..7e12733ae 100644 --- a/libc/sysdeps/linux/common/bits/socket.h +++ b/libc/sysdeps/linux/common/bits/socket.h @@ -98,8 +98,18 @@ enum __socket_type #define PF_IRDA 23 /* IRDA sockets. */ #define PF_PPPOX 24 /* PPPoX sockets. */ #define PF_WANPIPE 25 /* Wanpipe API sockets. */ +#define PF_LLC 26 /* Linux LLC. */ +#define PF_CAN 29 /* Controller Area Network. */ +#define PF_TIPC 30 /* TIPC sockets. */ #define PF_BLUETOOTH 31 /* Bluetooth sockets. */ -#define PF_MAX 32 /* For now.. */ +#define PF_IUCV 32 /* IUCV sockets. */ +#define PF_RXRPC 33 /* RxRPC sockets. */ +#define PF_ISDN 34 /* mISDN sockets. */ +#define PF_PHONET 35 /* Phonet sockets. */ +#define PF_IEEE802154 36 /* IEEE 802.15.4 sockets. */ +#define PF_CAIF 37 /* CAIF sockets. */ +#define PF_ALG 38 /* Algorithm sockets. */ +#define PF_MAX 39 /* For now.. */ /* Address families. */ #define AF_UNSPEC PF_UNSPEC @@ -130,7 +140,17 @@ enum __socket_type #define AF_IRDA PF_IRDA #define AF_PPPOX PF_PPPOX #define AF_WANPIPE PF_WANPIPE +#define AF_LLC PF_LLC +#define AF_CAN PF_CAN +#define AF_TIPC PF_TIPC #define AF_BLUETOOTH PF_BLUETOOTH +#define AF_IUCV PF_IUCV +#define AF_RXRPC PF_RXRPC +#define AF_ISDN PF_ISDN +#define AF_PHONET PF_PHONET +#define AF_IEEE802154 PF_IEEE802154 +#define AF_CAIF PF_CAIF +#define AF_ALG PF_ALG #define AF_MAX PF_MAX /* Socket level values. Others are defined in the appropriate headers. diff --git a/libc/sysdeps/linux/mips/bits/socket.h b/libc/sysdeps/linux/mips/bits/socket.h index b46e7be28..27ceafafe 100644 --- a/libc/sysdeps/linux/mips/bits/socket.h +++ b/libc/sysdeps/linux/mips/bits/socket.h @@ -100,8 +100,18 @@ enum __socket_type #define PF_IRDA 23 /* IRDA sockets. */ #define PF_PPPOX 24 /* PPPoX sockets. */ #define PF_WANPIPE 25 /* Wanpipe API sockets. */ +#define PF_LLC 26 /* Linux LLC. */ +#define PF_CAN 29 /* Controller Area Network. */ +#define PF_TIPC 30 /* TIPC sockets. */ #define PF_BLUETOOTH 31 /* Bluetooth sockets. */ -#define PF_MAX 32 /* For now.. */ +#define PF_IUCV 32 /* IUCV sockets. */ +#define PF_RXRPC 33 /* RxRPC sockets. */ +#define PF_ISDN 34 /* mISDN sockets. */ +#define PF_PHONET 35 /* Phonet sockets. */ +#define PF_IEEE802154 36 /* IEEE 802.15.4 sockets. */ +#define PF_CAIF 37 /* CAIF sockets. */ +#define PF_ALG 38 /* Algorithm sockets. */ +#define PF_MAX 39 /* For now.. */ /* Address families. */ #define AF_UNSPEC PF_UNSPEC @@ -132,7 +142,17 @@ enum __socket_type #define AF_IRDA PF_IRDA #define AF_PPPOX PF_PPPOX #define AF_WANPIPE PF_WANPIPE +#define AF_LLC PF_LLC +#define AF_CAN PF_CAN +#define AF_TIPC PF_TIPC #define AF_BLUETOOTH PF_BLUETOOTH +#define AF_IUCV PF_IUCV +#define AF_RXRPC PF_RXRPC +#define AF_ISDN PF_ISDN +#define AF_PHONET PF_PHONET +#define AF_IEEE802154 PF_IEEE802154 +#define AF_CAIF PF_CAIF +#define AF_ALG PF_ALG #define AF_MAX PF_MAX /* Socket level values. Others are defined in the appropriate headers. diff --git a/libc/sysdeps/linux/sparc/bits/socket.h b/libc/sysdeps/linux/sparc/bits/socket.h index e41527fd3..64973e2cf 100644 --- a/libc/sysdeps/linux/sparc/bits/socket.h +++ b/libc/sysdeps/linux/sparc/bits/socket.h @@ -88,8 +88,18 @@ enum __socket_type #define PF_IRDA 23 /* IRDA sockets. */ #define PF_PPPOX 24 /* PPPoX sockets. */ #define PF_WANPIPE 25 /* Wanpipe API sockets. */ +#define PF_LLC 26 /* Linux LLC. */ +#define PF_CAN 29 /* Controller Area Network. */ +#define PF_TIPC 30 /* TIPC sockets. */ #define PF_BLUETOOTH 31 /* Bluetooth sockets. */ -#define PF_MAX 32 /* For now.. */ +#define PF_IUCV 32 /* IUCV sockets. */ +#define PF_RXRPC 33 /* RxRPC sockets. */ +#define PF_ISDN 34 /* mISDN sockets. */ +#define PF_PHONET 35 /* Phonet sockets. */ +#define PF_IEEE802154 36 /* IEEE 802.15.4 sockets. */ +#define PF_CAIF 37 /* CAIF sockets. */ +#define PF_ALG 38 /* Algorithm sockets. */ +#define PF_MAX 39 /* For now.. */ /* Address families. */ #define AF_UNSPEC PF_UNSPEC @@ -120,7 +130,17 @@ enum __socket_type #define AF_IRDA PF_IRDA #define AF_PPPOX PF_PPPOX #define AF_WANPIPE PF_WANPIPE +#define AF_LLC PF_LLC +#define AF_CAN PF_CAN +#define AF_TIPC PF_TIPC #define AF_BLUETOOTH PF_BLUETOOTH +#define AF_IUCV PF_IUCV +#define AF_RXRPC PF_RXRPC +#define AF_ISDN PF_ISDN +#define AF_PHONET PF_PHONET +#define AF_IEEE802154 PF_IEEE802154 +#define AF_CAIF PF_CAIF +#define AF_ALG PF_ALG #define AF_MAX PF_MAX /* Socket level values. Others are defined in the appropriate headers. -- cgit v1.2.3 From 9a9a6365d5c5abb0fe3ec6cc09542e9c7e1d3bec Mon Sep 17 00:00:00 2001 From: Jones Desougi Date: Thu, 10 Jun 2010 15:04:51 +0200 Subject: *printf: Violation of precision with null string When a string format is processed and the argument is NULL, this yields "(null)" regardless of precision. This does not make sense, precision should not be exceeded. A simple test shows that glibc outputs nothing if precision is smaller than six and the attached patch implements this same behaviour. Consider the not uncommon case of strings implemented like this: struct string { int len; char *ptr; }; There is often no nultermination and they may be printed like this: printf("%.*s", string.len, string.ptr); If len is 0 then ptr may be anything, but NULL is a common value. Obviously the empty string would be expected, not "(null)". Signed-off-by: Jones Desougi Signed-off-by: Bernhard Reutner-Fischer --- libc/stdio/_vfprintf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libc/stdio/_vfprintf.c b/libc/stdio/_vfprintf.c index 3b007084d..fa5dc44fc 100644 --- a/libc/stdio/_vfprintf.c +++ b/libc/stdio/_vfprintf.c @@ -1670,6 +1670,9 @@ static int _do_one_spec(FILE * __restrict stream, #endif s = "(null)"; slen = 6; + /* Use an empty string rather than truncation if precision is too small. */ + if (ppfs->info.prec >= 0 && ppfs->info.prec < slen) + slen = 0; } } else { /* char */ s = buf; @@ -1726,6 +1729,9 @@ static int _do_one_spec(FILE * __restrict stream, NULL_STRING: s = "(null)"; SLEN = slen = 6; + /* Use an empty string rather than truncation if precision is too small. */ + if (ppfs->info.prec >= 0 && ppfs->info.prec < slen) + SLEN = slen = 0; } } else { /* char */ *wbuf = btowc( (unsigned char)(*((const int *) *argptr)) ); -- cgit v1.2.3 From d0aa7016ee1a95849a5a448083d8f8e675d80b5b Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 9 Feb 2011 20:21:12 +0100 Subject: i386: extend IMA guards to also cover LTO See GCC PR47577; TODO: Remove them. Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/i386/bits/syscalls.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libc/sysdeps/linux/i386/bits/syscalls.h b/libc/sysdeps/linux/i386/bits/syscalls.h index 9184bd6c3..eeafb3a48 100644 --- a/libc/sysdeps/linux/i386/bits/syscalls.h +++ b/libc/sysdeps/linux/i386/bits/syscalls.h @@ -43,9 +43,12 @@ /* We need some help from the assembler to generate optimal code. * We define some macros here which later will be used. */ +/* gcc>=4.6 with LTO need the same guards as IMA (a.k.a --combine) did. + * See gcc.gnu.org/PR47577 */ +/* FIXME: drop these b* macros! */ __asm__ ( -#ifdef __DOMULTI__ +#if defined __DOMULTI__ || __GNUC_PREREQ (4, 6) /* Protect against asm macro redefinition (happens in __DOMULTI__ mode). * Unfortunately, it ends up visible in .o files. */ ".ifndef _BITS_SYSCALLS_ASM\n\t" @@ -92,7 +95,7 @@ __asm__ ( ".endif\n\t" ".endm\n\t" -#ifdef __DOMULTI__ +#if defined __DOMULTI__ || __GNUC_PREREQ (4, 6) ".endif\n\t" /* _BITS_SYSCALLS_ASM */ #endif ); -- cgit v1.2.3 From 70dd77fa63a3df3c6dd38bd73c54598004d1b54e Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 9 Feb 2011 20:47:27 +0100 Subject: TODO: update Signed-off-by: Bernhard Reutner-Fischer --- TODO | 69 +++++++++++++++++++++++++++++++------------------------------------- 1 file changed, 31 insertions(+), 38 deletions(-) diff --git a/TODO b/TODO index b94d5415f..ae305a550 100644 --- a/TODO +++ b/TODO @@ -9,49 +9,42 @@ TODO list for every uClibc release: them in the include files as well by checking for the proper define from include/bits/uClibc_config.h (pulled in from features.h) -TODO list for the uClibc 0.9.31 release: +TODO list for the uClibc 1.0.0 release: ------------------------------------------------- - *) merge NPTL - Settle cancellation - support arches: (- todo; + done) - + arm - + sh - + mips - - i386 - - x86_64 - - ... + *) NPTL + support arches: (o todo; + done) + o alpha + + arm + o avr32 + o bfin + o cris + o e1 + o frv + o h8300 + o hppa + + i386 + o i960 + o ia64 + o m68k + o microblaze + + mips + o nios + o nios2 + + powerpc + + sh + + sh64 + o sparc + o v850 + o vax + o x86_64 + o xtensa + o ... *) Go through SUSv4 TOC: http://www.opengroup.org/onlinepubs/9699919799/xrat/contents.html shell (busybox): http://www.opengroup.org/onlinepubs/9699919799/xrat/V4_xcu_chap01.html#tag_22_01_01 interface: http://www.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap13.html#tag_21_13_02 http://www.opengroup.org/onlinepubs/9699919799/xrat/V4_xsh_chap01.html#tag_23_01_01 - - -TODO list for the uClibc 0.9.29 release: -------------------------------------------------- - *) as many of the arch-specific issues as possible - *) Remove N instances of libc_hidden_proto() from uClibc internals. - Instead add internal only header(s) defining all hidden prototypes. - This will avoid clutter and guarantee prototype consistancy. - *) The __is*_l() functions were all removed, such that we now only export - the is*_l() functions (no prefix). Before, we had the prefixed versions - for use by libstdc++ and weak versions without prefixes exported because - those functions belong to no std (unless you call glibc a std). This should - be fixed. Similar problems likely were created elsewhere. - *) misc stdio bugs: - http://bugs.uclibc.org/view.php?id=420 - http://bugs.uclibc.org/view.php?id=539 - *) bug in getopt handling: - http://bugs.uclibc.org/view.php?id=61 - http://www.uclibc.org/lists/uclibc/2006-January/013851.html - *) Should integrate test subdir better ... need to propagate CPU - CFLAGS/LDFLAGS to the build/link for target binaries so that when we have - a multilib toolchain, the proper ABI is selected. - - -TODO list for the uClibc 1.0.0 release: -------------------------------------------------- *) glob / fnmatch tests fail *) regex should pass AT&T conformance tests *) Finish hiding uClibc internal symbols from our exported namespace @@ -80,8 +73,8 @@ TODO list for the uClibc 1.0.0 release: and perhaps others (finalize list) produce a lib with a differing ABI. Make it so apps cannot use an ABI mis-matched uClibc. This is most easily done using symbol versioning... - *) Implement the long double versions of math funcs - using wrappers on top of the double versions (size / precision + *) Implement the long double versions of math funcs on interrested + arches using wrappers on top of the double versions (size / precision trade off where size clearly wins). *) Make all small objects (>~50 bytes) into either inlines or into a static library -- cgit v1.2.3 From da2d70ed69b57d63243a7b1e05ac7d43e91778ab Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Fri, 11 Feb 2011 17:26:19 +0100 Subject: arm: use CAS gcc builtin if SI-mode pattern is available Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/arm/bits/atomic.h | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/libc/sysdeps/linux/arm/bits/atomic.h b/libc/sysdeps/linux/arm/bits/atomic.h index 8f63e2510..07101fbe8 100644 --- a/libc/sysdeps/linux/arm/bits/atomic.h +++ b/libc/sysdeps/linux/arm/bits/atomic.h @@ -37,7 +37,12 @@ typedef uintmax_t uatomic_max_t; void __arm_link_error (void); -#ifdef __thumb2__ +/* Use the atomic builtins provided by GCC in case the backend provides + a pattern to do this efficiently. */ + +#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 +#define atomic_full_barrier() __sync_synchronize () +#elif defined __thumb2__ #define atomic_full_barrier() \ __asm__ __volatile__ \ ("movw\tip, #0x0fa0\n\t" \ @@ -64,17 +69,21 @@ void __arm_link_error (void); #define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \ ({ __arm_link_error (); oldval; }) +#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 +#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ + __sync_val_compare_and_swap ((mem), (oldval), (newval)) + /* It doesn't matter what register is used for a_oldval2, but we must specify one to work around GCC PR rtl-optimization/21223. Otherwise it may cause a_oldval or a_tmp to be moved to a different register. */ -#ifdef __thumb2__ +#elif defined __thumb2__ /* Thumb-2 has ldrex/strex. However it does not have barrier instructions, so we still need to use the kernel helper. */ #define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ - ({ register __typeof (oldval) a_oldval __asm__ ("r0"); \ - register __typeof (oldval) a_newval __asm__ ("r1") = (newval); \ - register __typeof (mem) a_ptr __asm__ ("r2") = (mem); \ + ({ register __typeof (oldval) a_oldval __asm__ ("r0"); \ + register __typeof (oldval) a_newval __asm__ ("r1") = (newval); \ + register __typeof (mem) a_ptr __asm__ ("r2") = (mem); \ register __typeof (oldval) a_tmp __asm__ ("r3"); \ register __typeof (oldval) a_oldval2 __asm__ ("r4") = (oldval); \ __asm__ __volatile__ \ @@ -95,9 +104,9 @@ void __arm_link_error (void); a_tmp; }) #else #define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ - ({ register __typeof (oldval) a_oldval __asm__ ("r0"); \ - register __typeof (oldval) a_newval __asm__ ("r1") = (newval); \ - register __typeof (mem) a_ptr __asm__ ("r2") = (mem); \ + ({ register __typeof (oldval) a_oldval __asm__ ("r0"); \ + register __typeof (oldval) a_newval __asm__ ("r1") = (newval); \ + register __typeof (mem) a_ptr __asm__ ("r2") = (mem); \ register __typeof (oldval) a_tmp __asm__ ("r3"); \ register __typeof (oldval) a_oldval2 __asm__ ("r4") = (oldval); \ __asm__ __volatile__ \ -- cgit v1.2.3 From 32814a2b15829df3a144391f5b8bd46e755f85f5 Mon Sep 17 00:00:00 2001 From: Kevin Cernekee Date: Thu, 10 Feb 2011 14:30:55 -0800 Subject: Fix GNU make v3.80 compatibility Commits 1f6601a and 094d82d introduced the "else ifeq" construct, which requires GNU make v3.81 or higher. This breaks the build on RHEL4 hosts. Signed-off-by: Kevin Cernekee Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/Makefile.in | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index cf4cf8708..bd45d941b 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -42,9 +42,11 @@ ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) CSRC := $(filter-out fork.c getpid.c raise.c open.c close.c read.c write.c, $(CSRC)) ifeq ($(TARGET_ARCH),arm) CSRC := $(filter-out vfork.c, $(CSRC)) -else ifeq ($(TARGET_ARCH),x86_64) +else +ifeq ($(TARGET_ARCH),x86_64) CSRC := $(filter-out vfork.c, $(CSRC)) -else ifeq ($(TARGET_ARCH),mips) +else +ifeq ($(TARGET_ARCH),mips) ifeq ($(CONFIG_MIPS_O32_ABI),y) CSRC := $(filter-out waitpid.c, $(CSRC)) endif @@ -52,6 +54,8 @@ else CSRC := $(filter-out waitpid.c, $(CSRC)) endif endif +endif +endif ifneq ($(ARCH_USE_MMU),y) # stubbed out in mman.h -- cgit v1.2.3 From bb8551685e2efc42c65a01479b9f9bb8b860da01 Mon Sep 17 00:00:00 2001 From: Philip Craig Date: Tue, 8 Feb 2011 16:11:38 +1000 Subject: Fix memory leak in dlopen()/dlclose(). The linked list of library dependencies created by dlopen() was not being freed by dlclose(). Signed-off-by: Philip Craig Signed-off-by: Bernhard Reutner-Fischer --- ldso/libdl/libdl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c index b88bc4819..ee5cd447a 100644 --- a/ldso/libdl/libdl.c +++ b/ldso/libdl/libdl.c @@ -922,6 +922,10 @@ static int do_dlclose(void *vhandle, int need_fini) free(tpnt); } } + for (rpnt1 = handle->next; rpnt1; rpnt1 = rpnt1_tmp) { + rpnt1_tmp = rpnt1->next; + free(rpnt1); + } free(handle->init_fini.init_fini); free(handle); -- cgit v1.2.3 From b6d971cbda6e769525c6f03c182323f39d791000 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sun, 13 Feb 2011 15:50:48 +0100 Subject: FORMAT_FDPIC_ELF: only for FRV and BFIN Signed-off-by: Bernhard Reutner-Fischer --- extra/Configs/Config.in.arch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/Configs/Config.in.arch b/extra/Configs/Config.in.arch index 8a02cb1a2..068bccc69 100644 --- a/extra/Configs/Config.in.arch +++ b/extra/Configs/Config.in.arch @@ -15,7 +15,7 @@ config UCLIBC_FORMAT_ELF depends on ARCH_USE_MMU config UCLIBC_FORMAT_FDPIC_ELF bool "FDPIC ELF" - depends on !ARCH_USE_MMU + depends on !ARCH_USE_MMU && (TARGET_bfin || TARGET_frv) select DOPIC config UCLIBC_FORMAT_FLAT bool "STATIC FLAT" -- cgit v1.2.3 From cdd129dbfe1234c41c7ebee538314417a757b8e8 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sun, 13 Feb 2011 15:56:30 +0100 Subject: nptl: fix typo in buildsys 0f85b228 used 'filter-pout' instead of 'filter-out'. Fix that. Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index bd45d941b..30341fd35 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -34,7 +34,7 @@ CSRC := $(filter-out capget.c capset.c inotify.c ioperm.c iopl.c \ sync_file_range.c sysctl.c sysinfo.c timerfd.c uselib.c vhangup.c,$(CSRC)) ifneq ($(UCLIBC_HAS_THREADS_NATIVE),y) # we need madvise.c in NPTL -CSRC := $(filter-pout madvise.c,$(CSRC)) +CSRC := $(filter-out madvise.c,$(CSRC)) endif endif -- cgit v1.2.3 From 133bc4376ac6c1042a88d9129f850158dbaed029 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sun, 13 Feb 2011 16:09:00 +0100 Subject: ldso: remove now unused variable Signed-off-by: Bernhard Reutner-Fischer --- ldso/libdl/libdl.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c index ee5cd447a..68cd5797e 100644 --- a/ldso/libdl/libdl.c +++ b/ldso/libdl/libdl.c @@ -612,7 +612,6 @@ void *dlsym(void *vhandle, const char *name) ElfW(Addr) from; struct dyn_elf *rpnt; void *ret; - struct elf_resolve *tls_tpnt = NULL; struct symbol_ref sym_ref = { NULL, NULL }; /* Nastiness to support underscore prefixes. */ #ifdef __UCLIBC_UNDERSCORES__ -- cgit v1.2.3 From 2c1c5db993c28e96b47a77148a4635931384810d Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sun, 13 Feb 2011 16:19:12 +0100 Subject: regex: remove set but not used variable Signed-off-by: Bernhard Reutner-Fischer --- libc/misc/regex/regex_internal.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libc/misc/regex/regex_internal.c b/libc/misc/regex/regex_internal.c index de640e08d..c6ac8dda1 100644 --- a/libc/misc/regex/regex_internal.c +++ b/libc/misc/regex/regex_internal.c @@ -627,7 +627,7 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags) if (pstr->is_utf8) { - const unsigned char *raw, *p, *q, *end; + const unsigned char *raw, *p, *end; /* Special case UTF-8. Multi-byte chars start with any byte other than 0x80 - 0xbf. */ @@ -654,13 +654,11 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags) unsigned char buf[6]; size_t mbclen; - q = p; if (BE (pstr->trans != NULL, 0)) { int i = mlen < 6 ? mlen : 6; while (--i >= 0) buf[i] = pstr->trans[p[i]]; - q = buf; } /* XXX Don't use mbrtowc, we know which conversion to use (UTF-8 -> UCS4). */ -- cgit v1.2.3 From a8f3b642f90ae425313b91ee8250e16aa971b8ff Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sun, 13 Feb 2011 16:45:43 +0100 Subject: arm: use EABI per default Signed-off-by: Bernhard Reutner-Fischer --- extra/Configs/Config.arm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/Configs/Config.arm b/extra/Configs/Config.arm index b060ace96..eb27a3391 100644 --- a/extra/Configs/Config.arm +++ b/extra/Configs/Config.arm @@ -14,7 +14,7 @@ config FORCE_OPTIONS_FOR_ARCH choice prompt "Target ABI" - default CONFIG_ARM_OABI + default CONFIG_ARM_EABI help If you choose "EABI" here, functions and constants required by the ARM EABI will be built into the library. You should choose "EABI" -- cgit v1.2.3 From e5651d24e38e0a96f9f8ab7a44e34deb08e11084 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Sun, 13 Feb 2011 18:31:27 +0100 Subject: buildsys: remove wrong file Somehow Makefile.in ended in there, remove it. Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index 30341fd35..fdb06c5f4 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -74,7 +74,7 @@ endif ifneq ($(UCLIBC_HAS_REALTIME),y) # aio_cancel|aio_error|aio_fsync|aio_read|aio_return|aio_suspend|aio_write|clock_getres|clock_gettime|clock_settime|clock_settime|fdatasync|lio_listio|mlockall|munlockall|mlock|munlock|mq_close|mq_getattr|mq_notify|mq_open|mq_receive|mq_timedreceive|mq_send|mq_timedsend|mq_setattr|mq_unlink|nanosleep|sched_getparam|sched_get_priority_max|sched_get_priority_min|sched_getscheduler|sched_rr_get_interval|sched_setparam|sched_setscheduler|sem_close|sem_destroy|sem_getvalue|sem_init|sem_open|sem_post|sem_trywait|sem_wait|sem_unlink|sem_wait|shm_open|shm_unlink|sigqueue|sigtimedwait|sigwaitinfo|sigwaitinfo|timer_create|timer_delete|timer_getoverrun|timer_gettime|timer_settime -CSRC := $(filter-out clock_getres.c clock_gettime.c clock_settime.c fdatasync.c Makefile.in mlockall.c mlock.c munlockall.c munlock.c nanosleep.c __rt_sigtimedwait.c sched_getparam.c sched_get_priority_max.c sched_get_priority_min.c sched_getscheduler.c sched_rr_get_interval.c sched_setparam.c sched_setscheduler.c sigqueue.c,$(CSRC)) +CSRC := $(filter-out clock_getres.c clock_gettime.c clock_settime.c fdatasync.c mlockall.c mlock.c munlockall.c munlock.c nanosleep.c __rt_sigtimedwait.c sched_getparam.c sched_get_priority_max.c sched_get_priority_min.c sched_getscheduler.c sched_rr_get_interval.c sched_setparam.c sched_setscheduler.c sigqueue.c,$(CSRC)) endif -- cgit v1.2.3 From 18e7136e79a89ba5e978f0dc445a8fcf8d619a40 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Mon, 14 Feb 2011 20:54:57 +0100 Subject: buildsys: use kbuild style Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/Makefile.in | 135 ++++++++++------------------------ 1 file changed, 39 insertions(+), 96 deletions(-) diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index fdb06c5f4..229c39164 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -8,127 +8,70 @@ COMMON_DIR := $(top_srcdir)libc/sysdeps/linux/common COMMON_OUT := $(top_builddir)libc/sysdeps/linux/common -CSRC := $(notdir $(wildcard $(COMMON_DIR)/*.c)) +CSRC-y := $(notdir $(wildcard $(COMMON_DIR)/*.c)) +CSRC- := ssp-local.c -ifneq ($(UCLIBC_HAS_LFS),y) CSRC_LFS := $(notdir $(wildcard $(COMMON_DIR)/*64.c)) -CSRC := $(filter-out llseek.c $(CSRC_LFS),$(CSRC)) -endif - -CSRC := $(filter-out ssp-local.c,$(CSRC)) -ifneq ($(UCLIBC_HAS_SSP),y) -CSRC := $(filter-out ssp.c,$(CSRC)) -endif - -ifneq ($(UCLIBC_LINUX_MODULE_24),y) -CSRC := $(filter-out create_module.c query_module.c get_kernel_syms.c,$(CSRC)) -endif +CSRC-y := $(filter-out llseek.c $(CSRC_LFS),$(CSRC-y)) +CSRC-$(UCLIBC_HAS_LFS) += llseek.c $(CSRC_LFS) -ifneq ($(UCLIBC_LINUX_SPECIFIC),y) +CSRC-$(UCLIBC_HAS_SSP) += ssp.c +CSRC-$(UCLIBC_LINUX_MODULE_24) += create_module.c query_module.c \ + get_kernel_syms.c # we need these internally: fstatfs.c statfs.c -CSRC := $(filter-out capget.c capset.c inotify.c ioperm.c iopl.c \ +CSRC-$(UCLIBC_LINUX_SPECIFIC) += capget.c capset.c inotify.c ioperm.c iopl.c \ modify_ldt.c personality.c ppoll.c prctl.c readahead.c reboot.c \ remap_file_pages.c sched_getaffinity.c sched_setaffinity.c \ sendfile64.c sendfile.c setfsgid.c setfsuid.c setresuid.c \ splice.c vmsplice.c tee.c signalfd.c swapoff.c swapon.c \ - sync_file_range.c sysctl.c sysinfo.c timerfd.c uselib.c vhangup.c,$(CSRC)) -ifneq ($(UCLIBC_HAS_THREADS_NATIVE),y) -# we need madvise.c in NPTL -CSRC := $(filter-out madvise.c,$(CSRC)) -endif -endif - + sync_file_range.c sysctl.c sysinfo.c timerfd.c uselib.c vhangup.c +CSRC-$(if $(and $(UCLIBC_LINUX_SPECIFIC),$(UCLIBC_HAS_THREADS_NATIVE)),y) += madvise.c +CSRC-$(UCLIBC_HAS_THREADS_NATIVE) += fork.c getpid.c raise.c open.c close.c \ + read.c write.c ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) -CSRC := $(filter-out fork.c getpid.c raise.c open.c close.c read.c write.c, $(CSRC)) -ifeq ($(TARGET_ARCH),arm) -CSRC := $(filter-out vfork.c, $(CSRC)) -else -ifeq ($(TARGET_ARCH),x86_64) -CSRC := $(filter-out vfork.c, $(CSRC)) -else -ifeq ($(TARGET_ARCH),mips) -ifeq ($(CONFIG_MIPS_O32_ABI),y) -CSRC := $(filter-out waitpid.c, $(CSRC)) -endif -else -CSRC := $(filter-out waitpid.c, $(CSRC)) -endif +CSRC- += waitpid.c +CSRC- += $(if $(findstring =arm=,=$(TARGET_ARCH)=),vfork.c) +CSRC- += $(if $(findstring =x86_64=,=$(TARGET_ARCH)=),vfork.c) +CSRC- += $(if $(findstring =mips=y=,=$(TARGET_ARCH)=$(CONFIG_MIPS_O32_ABI)),waitpid.c) endif -endif -endif - -ifneq ($(ARCH_USE_MMU),y) # stubbed out in mman.h -CSRC := $(filter-out msync.c, $(CSRC)) -endif - -ifneq ($(UCLIBC_BSD_SPECIFIC),y) +CSRC-$(ARCH_USE_MMU) += msync.c # we need these internally: getdomainname.c -CSRC := $(filter-out mincore.c setdomainname.c,$(CSRC)) -endif - -ifneq ($(UCLIBC_NTP_LEGACY),y) -CSRC := $(filter-out ntp_gettime.c,$(CSRC)) -endif - - -ifneq ($(UCLIBC_HAS_REALTIME),y) +CSRC-$(UCLIBC_BSD_SPECIFIC) += mincore.c setdomainname.c +CSRC-$(UCLIBC_NTP_LEGACY) += ntp_gettime.c # aio_cancel|aio_error|aio_fsync|aio_read|aio_return|aio_suspend|aio_write|clock_getres|clock_gettime|clock_settime|clock_settime|fdatasync|lio_listio|mlockall|munlockall|mlock|munlock|mq_close|mq_getattr|mq_notify|mq_open|mq_receive|mq_timedreceive|mq_send|mq_timedsend|mq_setattr|mq_unlink|nanosleep|sched_getparam|sched_get_priority_max|sched_get_priority_min|sched_getscheduler|sched_rr_get_interval|sched_setparam|sched_setscheduler|sem_close|sem_destroy|sem_getvalue|sem_init|sem_open|sem_post|sem_trywait|sem_wait|sem_unlink|sem_wait|shm_open|shm_unlink|sigqueue|sigtimedwait|sigwaitinfo|sigwaitinfo|timer_create|timer_delete|timer_getoverrun|timer_gettime|timer_settime -CSRC := $(filter-out clock_getres.c clock_gettime.c clock_settime.c fdatasync.c mlockall.c mlock.c munlockall.c munlock.c nanosleep.c __rt_sigtimedwait.c sched_getparam.c sched_get_priority_max.c sched_get_priority_min.c sched_getscheduler.c sched_rr_get_interval.c sched_setparam.c sched_setscheduler.c sigqueue.c,$(CSRC)) -endif - - -ifneq ($(UCLIBC_HAS_ADVANCED_REALTIME),y) +CSRC-$(UCLIBC_HAS_REALTIME) += clock_getres.c clock_gettime.c clock_settime.c \ + fdatasync.c mlockall.c mlock.c munlockall.c munlock.c \ + nanosleep.c __rt_sigtimedwait.c sched_getparam.c \ + sched_get_priority_max.c sched_get_priority_min.c sched_getscheduler.c \ + sched_rr_get_interval.c sched_setparam.c sched_setscheduler.c sigqueue.c # clock_getcpuclockid|clock_nanosleep|mq_timedreceive|mq_timedsend|posix_fadvise|posix_fallocate|posix_madvise|posix_memalign|posix_mem_offset|posix_spawnattr_destroy|posix_spawnattr_init|posix_spawnattr_getflags|posix_spawnattr_setflags|posix_spawnattr_getpgroup|posix_spawnattr_setpgroup|posix_spawnattr_getschedparam|posix_spawnattr_setschedparam|posix_spawnattr_getschedpolicy|posix_spawnattr_setschedpolicy|posix_spawnattr_getsigdefault|posix_spawnattr_setsigdefault|posix_spawnattr_getsigmask|posix_spawnattr_setsigmask|posix_spawnattr_init|posix_spawnattr_setflags|posix_spawnattr_setpgroup|posix_spawnattr_setschedparam|posix_spawnattr_setschedpolicy|posix_spawnattr_setsigdefault|posix_spawnattr_setsigmask|posix_spawn_file_actions_addclose|posix_spawn_file_actions_addopen|posix_spawn_file_actions_adddup2|posix_spawn_file_actions_addopen|posix_spawn_file_actions_destroy|posix_spawn_file_actions_init|posix_spawn_file_actions_init|posix_spawn|posix_spawnp|posix_spawnp|posix_typed_mem_get_info|pthread_mutex_timedlock|sem_timedwait -CSRC := $(filter-out posix_fadvise64.c posix_fadvise.c,$(CSRC)) -endif - -ifneq ($(UCLIBC_SUSV4_LEGACY),y) -CSRC := $(filter-out utime.c,$(CSRC)) -endif - -ifneq ($(UCLIBC_HAS_EPOLL),y) -CSRC := $(filter-out epoll.c,$(CSRC)) -endif - -ifneq ($(UCLIBC_HAS_XATTR),y) -CSRC := $(filter-out xattr.c,$(CSRC)) -endif - -ifneq ($(UCLIBC_HAS_PROFILING),y) -CSRC := $(filter-out noophooks.c pcprofile.c,$(CSRC)) -endif - -ifneq ($(UCLIBC_SV4_DEPRECATED),y) -CSRC := $(filter-out ustat.c,$(CSRC)) -endif - -ifeq ($(TARGET_ARCH),sh) -CSRC := $(filter-out longjmp.c vfork.c,$(CSRC)) -endif - -ifeq ($(TARGET_ARCH),sparc) -CSRC := $(filter-out vfork.c,$(CSRC)) -endif - -ifeq ($(TARGET_ARCH),i386) -CSRC := $(filter-out vfork.c,$(CSRC)) -endif +CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c +CSRC-$(UCLIBC_SUSV4_LEGACY) += utime.c +CSRC-$(UCLIBC_HAS_EPOLL) += epoll.c +CSRC-$(UCLIBC_HAS_XATTR) += xattr.c +CSRC-$(UCLIBC_HAS_PROFILING) += noophooks.c #pcprofile.c +CSRC-$(UCLIBC_SV4_DEPRECATED) += ustat.c +CSRC- += $(if $(findstring =sh=,=$(TARGET_ARCH)=),longjmp.c vfork.c) +CSRC- += $(if $(findstring =sparc=,=$(TARGET_ARCH)=),vfork.c) +CSRC- += $(if $(findstring =i386=,=$(TARGET_ARCH)=),vfork.c) + +CSRC-y := $(filter-out $(CSRC-),$(CSRC-y)) # provided via pthreads builddir -CSRC := $(filter-out $(libc_a_CSRC) $(notdir $(libpthread_libc_OBJS:.o=.c)),$(CSRC)) +CSRC-y := $(filter-out $(libc_a_CSRC) $(notdir $(libpthread_libc_OBJS:.o=.c)),$(CSRC-y)) SSRC := $(filter-out $(libc_a_SSRC) $(notdir $(libpthread_libc_OBJS:.o=.S)),$(SSRC)) # fails for some reason ifneq ($(strip $(ARCH_OBJS)),) -CSRC := $(filter-out $(notdir $(ARCH_OBJS:.o=.c)) $(ARCH_OBJ_FILTEROUT),$(CSRC)) +CSRC-y := $(filter-out $(notdir $(ARCH_OBJS:.o=.c)) $(ARCH_OBJ_FILTEROUT),$(CSRC-y)) endif CFLAGS-ssp.c := $(SSP_DISABLE_FLAGS) CFLAGS-ssp-local.c := $(SSP_DISABLE_FLAGS) -COMMON_SRC := $(patsubst %.c,$(COMMON_DIR)/%.c,$(CSRC)) -COMMON_OBJ := $(patsubst %.c,$(COMMON_OUT)/%.o,$(CSRC)) +COMMON_SRC := $(patsubst %.c,$(COMMON_DIR)/%.c,$(CSRC-y)) +COMMON_OBJ := $(patsubst %.c,$(COMMON_OUT)/%.o,$(CSRC-y)) libc-y += $(COMMON_OBJ) libc-static-$(UCLIBC_HAS_SSP) += $(COMMON_OUT)/ssp-local.o -- cgit v1.2.3 From 0f4516e32c3a2186e6b6f074cfc6a57bde90e9cc Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 16 Feb 2011 19:31:06 +0100 Subject: buildsys: fix inverted logic with thread impls Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/Makefile.in | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index 229c39164..a6d22e544 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -26,13 +26,12 @@ CSRC-$(UCLIBC_LINUX_SPECIFIC) += capget.c capset.c inotify.c ioperm.c iopl.c \ splice.c vmsplice.c tee.c signalfd.c swapoff.c swapon.c \ sync_file_range.c sysctl.c sysinfo.c timerfd.c uselib.c vhangup.c CSRC-$(if $(and $(UCLIBC_LINUX_SPECIFIC),$(UCLIBC_HAS_THREADS_NATIVE)),y) += madvise.c -CSRC-$(UCLIBC_HAS_THREADS_NATIVE) += fork.c getpid.c raise.c open.c close.c \ - read.c write.c ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) +CSRC- += fork.c getpid.c raise.c open.c close.c read.c write.c CSRC- += waitpid.c CSRC- += $(if $(findstring =arm=,=$(TARGET_ARCH)=),vfork.c) CSRC- += $(if $(findstring =x86_64=,=$(TARGET_ARCH)=),vfork.c) -CSRC- += $(if $(findstring =mips=y=,=$(TARGET_ARCH)=$(CONFIG_MIPS_O32_ABI)),waitpid.c) +CSRC- += $(if $(findstring =mips=y=,=$(TARGET_ARCH)=$(CONFIG_MIPS_O32_ABI)=),waitpid.c) endif # stubbed out in mman.h CSRC-$(ARCH_USE_MMU) += msync.c -- cgit v1.2.3 From b3144c7169fe374b74172b55dfa547290b20fa9f Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 21 Feb 2011 19:38:39 -0500 Subject: bfin: add missing GNU-stack markings to __longjmp Signed-off-by: Mike Frysinger --- libc/sysdeps/linux/bfin/__longjmp.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libc/sysdeps/linux/bfin/__longjmp.S b/libc/sysdeps/linux/bfin/__longjmp.S index 673cd30e8..b2fafbb25 100644 --- a/libc/sysdeps/linux/bfin/__longjmp.S +++ b/libc/sysdeps/linux/bfin/__longjmp.S @@ -105,3 +105,5 @@ ___longjmp: .size ___longjmp,.-___longjmp libc_hidden_def(__longjmp) + +.section .note.GNU-stack,"",%progbits -- cgit v1.2.3 From f8355584a335a2a2dc03842f19ba9f1b587b2f5c Mon Sep 17 00:00:00 2001 From: Steve Kilbane Date: Mon, 21 Feb 2011 19:43:32 -0500 Subject: bfin: fix sram/dma syscall definitions Once we pull in the header, we're forced to declare the syscall with all the right types. Signed-off-by: Steve Kilbane Signed-off-by: Mike Frysinger --- libc/sysdeps/linux/bfin/dma-memcpy.c | 4 ++-- libc/sysdeps/linux/bfin/sram-alloc.c | 2 +- libc/sysdeps/linux/bfin/sram-free.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libc/sysdeps/linux/bfin/dma-memcpy.c b/libc/sysdeps/linux/bfin/dma-memcpy.c index 274b99e8c..b715aeba0 100644 --- a/libc/sysdeps/linux/bfin/dma-memcpy.c +++ b/libc/sysdeps/linux/bfin/dma-memcpy.c @@ -1,6 +1,6 @@ #include #include #include +#include -_syscall3 (__ptr_t, dma_memcpy, __ptr_t, dest, __ptr_t, src, size_t, len) - +_syscall3 (void *, dma_memcpy, void *, dest, const void *, src, size_t, len) diff --git a/libc/sysdeps/linux/bfin/sram-alloc.c b/libc/sysdeps/linux/bfin/sram-alloc.c index 6b33b2670..8518119d7 100644 --- a/libc/sysdeps/linux/bfin/sram-alloc.c +++ b/libc/sysdeps/linux/bfin/sram-alloc.c @@ -1,6 +1,6 @@ #include #include #include +#include _syscall2 (__ptr_t, sram_alloc, size_t, len, unsigned long, flags) - diff --git a/libc/sysdeps/linux/bfin/sram-free.c b/libc/sysdeps/linux/bfin/sram-free.c index 0fba936c8..8260eb660 100644 --- a/libc/sysdeps/linux/bfin/sram-free.c +++ b/libc/sysdeps/linux/bfin/sram-free.c @@ -1,6 +1,6 @@ #include #include #include +#include -_syscall1 (__ptr_t, sram_free, __ptr_t, addr) - +_syscall1 (int, sram_free, const void *, addr) -- cgit v1.2.3 From 128e290b1e4204ac33b4cad7fc6189447f029311 Mon Sep 17 00:00:00 2001 From: Steve Kilbane Date: Mon, 21 Feb 2011 19:44:42 -0500 Subject: bfin: add support for new cacheflush syscall Newer gcc's will generate a call to cacheflush when updating jump tables, and that has to be done in kernel space (to avoid hardware anomalies). So make sure uClibc provides that symbol. Signed-off-by: Steve Kilbane Signed-off-by: Mike Frysinger --- libc/sysdeps/linux/bfin/Makefile.arch | 2 +- libc/sysdeps/linux/bfin/cacheflush.c | 14 ++++++++++++++ libc/sysdeps/linux/bfin/sys/cachectl.h | 25 +++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 libc/sysdeps/linux/bfin/cacheflush.c create mode 100644 libc/sysdeps/linux/bfin/sys/cachectl.h diff --git a/libc/sysdeps/linux/bfin/Makefile.arch b/libc/sysdeps/linux/bfin/Makefile.arch index 242703757..425a68898 100644 --- a/libc/sysdeps/linux/bfin/Makefile.arch +++ b/libc/sysdeps/linux/bfin/Makefile.arch @@ -6,7 +6,7 @@ # CSRC := bsdsetjmp.c clone.c \ - sram-alloc.c sram-free.c dma-memcpy.c + sram-alloc.c sram-free.c dma-memcpy.c cacheflush.c SSRC := __longjmp.S setjmp.S bsd-_setjmp.S diff --git a/libc/sysdeps/linux/bfin/cacheflush.c b/libc/sysdeps/linux/bfin/cacheflush.c new file mode 100644 index 000000000..a8d81c419 --- /dev/null +++ b/libc/sysdeps/linux/bfin/cacheflush.c @@ -0,0 +1,14 @@ +/* + * cacheflush.c - Cache control functions for Blackfin. + * + * Copyright (C) 2010 Analog Devices Inc. + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include +#include +#include +#include + +_syscall3 (int, cacheflush, void *, start, const int, nbytes, const int, flags) diff --git a/libc/sysdeps/linux/bfin/sys/cachectl.h b/libc/sysdeps/linux/bfin/sys/cachectl.h new file mode 100644 index 000000000..ee4c03155 --- /dev/null +++ b/libc/sysdeps/linux/bfin/sys/cachectl.h @@ -0,0 +1,25 @@ +/* + * cachectl.h - Functions for cache control on Blackfin. + * + * Copyright (C) 2010 Analog Devices, Inc. + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#ifndef _SYS_CACHECTL_H +#define _SYS_CACHECTL_H 1 + +#include + +/* + * Get the kernel definition for the flag bits + */ +#include + +__BEGIN_DECLS + +extern int cacheflush (void *addr, __const int nbytes, __const int flags); + +__END_DECLS + +#endif /* sys/cachectl.h */ -- cgit v1.2.3 From 3ac213101204750950a129e1a245c4730525287f Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 21 Feb 2011 20:25:29 -0500 Subject: ldso: fix fdpic builds Commit 33cb7f0b4 tried to add a small optimization for skipping unnecessary .dynamic adjustments, but did so by referencing an opaque type. While this works for non-fdpic targets (since the type can be cast to an integer), it falls apart for fdpic targets where the type is actually a structure. Since FDPIC can't support this optimization without walking a series of linked structures, just skip it. Signed-off-by: Mike Frysinger --- ldso/include/dl-elf.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ldso/include/dl-elf.h b/ldso/include/dl-elf.h index cbb2100b1..5aec64f0d 100644 --- a/ldso/include/dl-elf.h +++ b/ldso/include/dl-elf.h @@ -162,8 +162,13 @@ unsigned int __dl_parse_dynamic_info(ElfW(Dyn) *dpnt, unsigned long dynamic_info if (dynamic_info[tag]) \ dynamic_info[tag] = (unsigned long) DL_RELOC_ADDR(load_off, dynamic_info[tag]); \ } while (0) - /* Don't adjust .dynamic unnecessarily. */ - if (load_off != 0) { + /* Don't adjust .dynamic unnecessarily. For FDPIC targets, + we'd have to walk all the loadsegs to find out if it was + actually unnecessary, so skip this optimization. */ +#ifndef __FDPIC__ + if (load_off != 0) +#endif + { ADJUST_DYN_INFO(DT_HASH, load_off); ADJUST_DYN_INFO(DT_PLTGOT, load_off); ADJUST_DYN_INFO(DT_STRTAB, load_off); -- cgit v1.2.3 From 9bc14fb42980b738abfcd8be8cffcca0937b5220 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 22 Feb 2011 18:12:26 +0100 Subject: nptl: imit waitpid just for MIPS O32 Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/Makefile.in | 1 - 1 file changed, 1 deletion(-) diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index a6d22e544..302fa6450 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -28,7 +28,6 @@ CSRC-$(UCLIBC_LINUX_SPECIFIC) += capget.c capset.c inotify.c ioperm.c iopl.c \ CSRC-$(if $(and $(UCLIBC_LINUX_SPECIFIC),$(UCLIBC_HAS_THREADS_NATIVE)),y) += madvise.c ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) CSRC- += fork.c getpid.c raise.c open.c close.c read.c write.c -CSRC- += waitpid.c CSRC- += $(if $(findstring =arm=,=$(TARGET_ARCH)=),vfork.c) CSRC- += $(if $(findstring =x86_64=,=$(TARGET_ARCH)=),vfork.c) CSRC- += $(if $(findstring =mips=y=,=$(TARGET_ARCH)=$(CONFIG_MIPS_O32_ABI)=),waitpid.c) -- cgit v1.2.3 From 435f73337eff129943249b0d59aad50c8df5bd2e Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 21 Feb 2011 21:29:58 -0500 Subject: tempname: fix int precision warnings The printf precision takes an integer, not a size_t. Otherwise we get: libc/misc/internals/tempname.c: In function '___path_search': libc/misc/internals/tempname.c:116: warning: field precision should have type 'int', but argument 3 has type 'size_t' field precision should have type 'int', but argument 5 has type 'size_t' Signed-off-by: Mike Frysinger --- libc/misc/internals/tempname.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libc/misc/internals/tempname.c b/libc/misc/internals/tempname.c index 4145c9478..0db28455b 100644 --- a/libc/misc/internals/tempname.c +++ b/libc/misc/internals/tempname.c @@ -62,7 +62,10 @@ int attribute_hidden ___path_search (char *tmpl, size_t tmpl_len, const char *di const char *pfx /*, int try_tmpdir*/) { /*const char *d; */ - size_t dlen, plen; + /* dir and pfx lengths should always fit into an int, + so don't bother using size_t here. Especially since + the printf func requires an int for precision (%*s). */ + int dlen, plen; if (!pfx || !pfx[0]) { -- cgit v1.2.3 From 9112a2398ec58b32cd1a1c6feae195bd8f9a46a2 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 22 Feb 2011 16:23:23 -0500 Subject: bfin: fix fp reference in _JMPBUF_UNWINDS We want to access the frame pointer, so do so directly rather than "overflowing" the pregs array and ending up at the fp member. This fixes the Blackfin build warnings: libpthread/linuxthreads.old/ptlongjmp.c: In function 'pthread_cleanup_upto': libpthread/linuxthreads.old/ptlongjmp.c:35: warning: array subscript is above array bounds libpthread/linuxthreads.old/ptlongjmp.c:56: warning: array subscript is above array bounds Signed-off-by: Mike Frysinger --- libc/sysdeps/linux/bfin/bits/setjmp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/sysdeps/linux/bfin/bits/setjmp.h b/libc/sysdeps/linux/bfin/bits/setjmp.h index ee3f5e787..adb9c23af 100644 --- a/libc/sysdeps/linux/bfin/bits/setjmp.h +++ b/libc/sysdeps/linux/bfin/bits/setjmp.h @@ -52,6 +52,6 @@ typedef struct /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ #define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((void *) (address) < (void *) (jmpbuf)->__pregs[6]) + ((void *) (address) < (void *) (jmpbuf)->fp) #endif /* bits/setjmp.h */ -- cgit v1.2.3 From 73d59554144f429b1cf0d4d7fa7de42bdf59ad92 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 23 Jul 2009 01:11:38 -0400 Subject: unify stub logic Signed-off-by: Mike Frysinger --- extra/Configs/Config.in | 9 -- libc/sysdeps/linux/arm/posix_fadvise.c | 2 +- libc/sysdeps/linux/arm/posix_fadvise64.c | 2 +- libc/sysdeps/linux/common/__rt_sigtimedwait.c | 12 +- libc/sysdeps/linux/common/__rt_sigwaitinfo.c | 11 +- libc/sysdeps/linux/common/bdflush.c | 6 - libc/sysdeps/linux/common/capget.c | 6 - libc/sysdeps/linux/common/capset.c | 7 +- libc/sysdeps/linux/common/create_module.c | 7 - libc/sysdeps/linux/common/delete_module.c | 6 - libc/sysdeps/linux/common/epoll.c | 18 --- libc/sysdeps/linux/common/fdatasync.c | 7 - libc/sysdeps/linux/common/fork.c | 12 -- libc/sysdeps/linux/common/get_kernel_syms.c | 6 - libc/sysdeps/linux/common/getpgrp.c | 6 - libc/sysdeps/linux/common/init_module.c | 6 - libc/sysdeps/linux/common/pivot_root.c | 6 - libc/sysdeps/linux/common/posix_fadvise.c | 3 +- libc/sysdeps/linux/common/posix_fadvise64.c | 3 +- libc/sysdeps/linux/common/query_module.c | 7 - libc/sysdeps/linux/common/sched_getaffinity.c | 6 - libc/sysdeps/linux/common/sched_setaffinity.c | 11 -- libc/sysdeps/linux/common/signalfd.c | 6 +- libc/sysdeps/linux/common/splice.c | 7 - libc/sysdeps/linux/common/stubs.c | 183 ++++++++++++++++++++++++++ libc/sysdeps/linux/common/sync_file_range.c | 6 - libc/sysdeps/linux/common/umount.c | 9 -- libc/sysdeps/linux/common/umount2.c | 6 - libc/sysdeps/linux/common/vmsplice.c | 7 - libc/sysdeps/linux/common/xattr.c | 78 ----------- libc/sysdeps/linux/i386/posix_fadvise64.S | 9 +- 31 files changed, 195 insertions(+), 275 deletions(-) create mode 100644 libc/sysdeps/linux/common/stubs.c diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in index aa459e06a..f152a9666 100644 --- a/extra/Configs/Config.in +++ b/extra/Configs/Config.in @@ -665,15 +665,6 @@ config UCLIBC_HAS_STUBS functions which are impossible to implement on the target architecture. Otherwise, such functions are simply omitted. - As of 2008-07, this option makes uClibc provide fork() stub - on NOMMU targets. It always sets errno to ENOSYS and returns -1. - - This may be useful if you port a lot of software and cannot - audit all of it and replace or disable fork() usage. - With this option, a program which uses fork() will build - successfully. Of course, it may be useless if fork() - is essential for its operation. - config UCLIBC_HAS_SHADOW bool "Shadow Password Support" default y diff --git a/libc/sysdeps/linux/arm/posix_fadvise.c b/libc/sysdeps/linux/arm/posix_fadvise.c index 278bff981..80d3c5044 100644 --- a/libc/sysdeps/linux/arm/posix_fadvise.c +++ b/libc/sysdeps/linux/arm/posix_fadvise.c @@ -39,7 +39,7 @@ int posix_fadvise(int fd, off_t offset, off_t len, int advise) /* weak_alias(__libc_posix_fadvise, posix_fadvise); */ -#else +#elif defined __UCLIBC_HAS_STUBS__ int posix_fadvise(int fd attribute_unused, off_t offset attribute_unused, off_t len attribute_unused, int advice attribute_unused) { diff --git a/libc/sysdeps/linux/arm/posix_fadvise64.c b/libc/sysdeps/linux/arm/posix_fadvise64.c index 4b27381d1..678c42f90 100644 --- a/libc/sysdeps/linux/arm/posix_fadvise64.c +++ b/libc/sysdeps/linux/arm/posix_fadvise64.c @@ -47,7 +47,7 @@ int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advise) /* weak_alias(__libc_posix_fadvise64, posix_fadvise64); */ -#else +#elif defined __UCLIBC_HAS_STUBS__ int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advise) { diff --git a/libc/sysdeps/linux/common/__rt_sigtimedwait.c b/libc/sysdeps/linux/common/__rt_sigtimedwait.c index a7ab8fb61..26860d2d2 100644 --- a/libc/sysdeps/linux/common/__rt_sigtimedwait.c +++ b/libc/sysdeps/linux/common/__rt_sigtimedwait.c @@ -86,16 +86,6 @@ int attribute_hidden __sigtimedwait(const sigset_t * set, siginfo_t * info, return __rt_sigtimedwait(set, info, timeout, _NSIG / 8); } # endif /* !__UCLIBC_HAS_THREADS_NATIVE__ */ -#else -int attribute_hidden __sigtimedwait(const sigset_t * set, siginfo_t * info, - const struct timespec *timeout) -{ - if (set == NULL) - __set_errno(EINVAL); - else - __set_errno(ENOSYS); - return -1; -} -#endif weak_alias(__sigtimedwait,sigtimedwait) libc_hidden_weak(sigtimedwait) +#endif diff --git a/libc/sysdeps/linux/common/__rt_sigwaitinfo.c b/libc/sysdeps/linux/common/__rt_sigwaitinfo.c index 92a11c9b6..6b4332715 100644 --- a/libc/sysdeps/linux/common/__rt_sigwaitinfo.c +++ b/libc/sysdeps/linux/common/__rt_sigwaitinfo.c @@ -83,16 +83,7 @@ int attribute_hidden __sigwaitinfo(const sigset_t * set, siginfo_t * info) return __rt_sigwaitinfo(set, info, NULL, _NSIG / 8); } # endif -#else -int attribute_hidden __sigwaitinfo(const sigset_t * set, siginfo_t * info) -{ - if (set == NULL) - __set_errno(EINVAL); - else - __set_errno(ENOSYS); - return -1; -} -#endif libc_hidden_proto(sigwaitinfo) weak_alias (__sigwaitinfo, sigwaitinfo) libc_hidden_weak(sigwaitinfo) +#endif diff --git a/libc/sysdeps/linux/common/bdflush.c b/libc/sysdeps/linux/common/bdflush.c index 687a8f9a7..c2a05ed88 100644 --- a/libc/sysdeps/linux/common/bdflush.c +++ b/libc/sysdeps/linux/common/bdflush.c @@ -12,10 +12,4 @@ #ifdef __NR_bdflush _syscall2(int, bdflush, int, __func, long int, __data) -#else -int bdflush(int __func, long int __data) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/common/capget.c b/libc/sysdeps/linux/common/capget.c index 361de845d..c3e8c5771 100644 --- a/libc/sysdeps/linux/common/capget.c +++ b/libc/sysdeps/linux/common/capget.c @@ -11,10 +11,4 @@ int capget(void *header, void *data); #ifdef __NR_capget _syscall2(int, capget, void *, header, void *, data) -#else -int capget(void *header, void *data) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/common/capset.c b/libc/sysdeps/linux/common/capset.c index 0a77e05f4..c0cf5deb0 100644 --- a/libc/sysdeps/linux/common/capset.c +++ b/libc/sysdeps/linux/common/capset.c @@ -8,13 +8,8 @@ */ #include + int capset(void *header, const void *data); #ifdef __NR_capset _syscall2(int, capset, void *, header, const void *, data) -#elif defined __UCLIBC_HAS_STUBS__ -int capset(void *header, const void *data) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/common/create_module.c b/libc/sysdeps/linux/common/create_module.c index d8f24466d..ddd7c4cff 100644 --- a/libc/sysdeps/linux/common/create_module.c +++ b/libc/sysdeps/linux/common/create_module.c @@ -49,11 +49,4 @@ unsigned long create_module(const char *name, size_t size) _syscall2(unsigned long, create_module, const char *, name, size_t, size) #endif -#else /* !__NR_create_module */ -caddr_t create_module(const char *name attribute_unused, size_t size attribute_unused); -caddr_t create_module(const char *name attribute_unused, size_t size attribute_unused) -{ - __set_errno(ENOSYS); - return (caddr_t)-1; -} #endif diff --git a/libc/sysdeps/linux/common/delete_module.c b/libc/sysdeps/linux/common/delete_module.c index 44f9b30ae..8ac6e559e 100644 --- a/libc/sysdeps/linux/common/delete_module.c +++ b/libc/sysdeps/linux/common/delete_module.c @@ -10,10 +10,4 @@ int delete_module(const char *name, unsigned int flags); #ifdef __NR_delete_module _syscall2(int, delete_module, const char *, name, unsigned int, flags) -#elif defined __UCLIBC_HAS_STUBS__ -int delete_module(const char *name, unsigned int flags) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/common/epoll.c b/libc/sysdeps/linux/common/epoll.c index 86272d9aa..dda92282e 100644 --- a/libc/sysdeps/linux/common/epoll.c +++ b/libc/sysdeps/linux/common/epoll.c @@ -15,12 +15,6 @@ */ #ifdef __NR_epoll_create _syscall1(int, epoll_create, int, size) -#else -int epoll_create(int size) -{ - __set_errno(ENOSYS); - return -1; -} #endif /* @@ -28,12 +22,6 @@ int epoll_create(int size) */ #ifdef __NR_epoll_ctl _syscall4(int,epoll_ctl, int, epfd, int, op, int, fd, struct epoll_event *, event) -#else -int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event) -{ - __set_errno(ENOSYS); - return -1; -} #endif /* @@ -41,10 +29,4 @@ int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event) */ #ifdef __NR_epoll_wait _syscall4(int, epoll_wait, int, epfd, struct epoll_event *, events, int, maxevents, int, timeout) -#else -int epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/common/fdatasync.c b/libc/sysdeps/linux/common/fdatasync.c index 19d37b6e0..e51c72365 100644 --- a/libc/sysdeps/linux/common/fdatasync.c +++ b/libc/sysdeps/linux/common/fdatasync.c @@ -40,11 +40,4 @@ int fdatasync(int fd) # endif } -#elif defined __UCLIBC_HAS_STUBS__ -/* no syscall available, so provide a stub */ -int fdatasync(int fd) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/common/fork.c b/libc/sysdeps/linux/common/fork.c index f21ec35b8..14e00a2cd 100644 --- a/libc/sysdeps/linux/common/fork.c +++ b/libc/sysdeps/linux/common/fork.c @@ -20,16 +20,4 @@ weak_alias(__libc_fork,fork) libc_hidden_weak(fork) #endif -#elif defined __UCLIBC_HAS_STUBS__ - -extern __typeof(fork) __libc_fork; -pid_t __libc_fork(void) -{ - __set_errno(ENOSYS); - return -1; -} -weak_alias(__libc_fork,fork) -libc_hidden_weak(fork) -link_warning(fork, "fork: this function is not implemented on no-mmu systems") - #endif diff --git a/libc/sysdeps/linux/common/get_kernel_syms.c b/libc/sysdeps/linux/common/get_kernel_syms.c index d6595eaf5..6124a81d4 100644 --- a/libc/sysdeps/linux/common/get_kernel_syms.c +++ b/libc/sysdeps/linux/common/get_kernel_syms.c @@ -13,10 +13,4 @@ struct kernel_sym; int get_kernel_syms(struct kernel_sym *table attribute_unused); #ifdef __NR_get_kernel_syms _syscall1(int, get_kernel_syms, struct kernel_sym *, table) -#else -int get_kernel_syms(struct kernel_sym *table attribute_unused) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/common/getpgrp.c b/libc/sysdeps/linux/common/getpgrp.c index 5d36ba155..80a53daee 100644 --- a/libc/sysdeps/linux/common/getpgrp.c +++ b/libc/sysdeps/linux/common/getpgrp.c @@ -19,10 +19,4 @@ pid_t getpgrp(void) { return getpgid(getpid()); } -#elif defined __UCLIBC_HAS_STUBS__ -pid_t getpgrp(void) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/common/init_module.c b/libc/sysdeps/linux/common/init_module.c index 8a6e94199..cf6d74721 100644 --- a/libc/sysdeps/linux/common/init_module.c +++ b/libc/sysdeps/linux/common/init_module.c @@ -15,11 +15,5 @@ int init_module(void *first, void *second, void *third, void *fourth, void *fift * and let the kernel cope with whatever it gets. It's good at that. */ _syscall5(int, init_module, void *, first, void *, second, void *, third, void *, fourth, void *, fifth) -#else -int init_module(void *first, void *second, void *third, void *fourth, void *fifth) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/common/pivot_root.c b/libc/sysdeps/linux/common/pivot_root.c index 3e9705903..0e738d53f 100644 --- a/libc/sysdeps/linux/common/pivot_root.c +++ b/libc/sysdeps/linux/common/pivot_root.c @@ -12,10 +12,4 @@ int pivot_root(const char *new_root, const char *put_old); #ifdef __NR_pivot_root _syscall2(int, pivot_root, const char *, new_root, const char *, put_old) -#else -int pivot_root(const char *new_root, const char *put_old) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/common/posix_fadvise.c b/libc/sysdeps/linux/common/posix_fadvise.c index 7c43be959..17831c201 100644 --- a/libc/sysdeps/linux/common/posix_fadvise.c +++ b/libc/sysdeps/linux/common/posix_fadvise.c @@ -27,10 +27,9 @@ int posix_fadvise(int fd, off_t offset, off_t len, int advice) strong_alias(posix_fadvise,posix_fadvise64) #endif -#else +#elif defined __UCLIBC_HAS_STUBS__ int posix_fadvise(int fd attribute_unused, off_t offset attribute_unused, off_t len attribute_unused, int advice attribute_unused) { -#warning This is not correct as far as SUSv3 is concerned. return ENOSYS; } #endif diff --git a/libc/sysdeps/linux/common/posix_fadvise64.c b/libc/sysdeps/linux/common/posix_fadvise64.c index b53e64321..e8a530fdf 100644 --- a/libc/sysdeps/linux/common/posix_fadvise64.c +++ b/libc/sysdeps/linux/common/posix_fadvise64.c @@ -58,13 +58,12 @@ int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advice) #error your machine is neither 32 bit or 64 bit ... it must be magical #endif -#elif !defined __NR_fadvise64 +#elif !defined __NR_fadvise64 && defined __UCLIBC_HAS_STUBS__ /* This is declared as a strong alias in posix_fadvise.c if __NR_fadvise64 * is defined. */ int posix_fadvise64(int fd, __off64_t offset, __off64_t len, int advice) { -#warning This is not correct as far as SUSv3 is concerned. return ENOSYS; } #endif /* __NR_fadvise64_64 */ diff --git a/libc/sysdeps/linux/common/query_module.c b/libc/sysdeps/linux/common/query_module.c index 0f3d4700c..7c168df45 100644 --- a/libc/sysdeps/linux/common/query_module.c +++ b/libc/sysdeps/linux/common/query_module.c @@ -13,11 +13,4 @@ int query_module(const char *name attribute_unused, int which attribute_unused, #ifdef __NR_query_module _syscall5(int, query_module, const char *, name, int, which, void *, buf, size_t, bufsize, size_t *, ret) -#elif defined __UCLIBC_HAS_STUBS__ -int query_module(const char *name attribute_unused, int which attribute_unused, - void *buf attribute_unused, size_t bufsize attribute_unused, size_t * ret attribute_unused) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/common/sched_getaffinity.c b/libc/sysdeps/linux/common/sched_getaffinity.c index 5d5e5b2c4..8982582cc 100644 --- a/libc/sysdeps/linux/common/sched_getaffinity.c +++ b/libc/sysdeps/linux/common/sched_getaffinity.c @@ -44,11 +44,5 @@ int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *cpuset) } return res; } -#elif defined __UCLIBC_HAS_STUBS__ -int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *cpuset) -{ - __set_errno(ENOSYS); - return -1; -} #endif #endif diff --git a/libc/sysdeps/linux/common/sched_setaffinity.c b/libc/sysdeps/linux/common/sched_setaffinity.c index 1a0f55f75..980c44199 100644 --- a/libc/sysdeps/linux/common/sched_setaffinity.c +++ b/libc/sysdeps/linux/common/sched_setaffinity.c @@ -70,16 +70,5 @@ int sched_setaffinity(pid_t pid, size_t cpusetsize, const cpu_set_t *cpuset) return INLINE_SYSCALL (sched_setaffinity, 3, pid, cpusetsize, cpuset); } -#else -#define ___HAVE_NO_sched_setaffinity #endif - -#if defined ___HAVE_NO_sched_setaffinity && defined __UCLIBC_HAS_STUBS__ -int sched_setaffinity(pid_t pid, size_t cpusetsize, const cpu_set_t *cpuset) -{ - __set_errno(ENOSYS); - return -1; -} -#endif - #endif /* __USE_GNU */ diff --git a/libc/sysdeps/linux/common/signalfd.c b/libc/sysdeps/linux/common/signalfd.c index 3d76e04c4..a0c995a89 100644 --- a/libc/sysdeps/linux/common/signalfd.c +++ b/libc/sysdeps/linux/common/signalfd.c @@ -21,8 +21,7 @@ static __inline__ _syscall3(int, __syscall_signalfd, int, fd, const sigset_t *, mask, size_t, sizemask) #endif -#if defined __NR_signalfd4 || defined __NR_signalfd \ - || defined __UCLIBC_HAS_STUBS__ +#if defined __NR_signalfd4 || defined __NR_signalfd int signalfd (int fd, const sigset_t *mask, int flags) { #if defined __NR___syscall_signalfd4 @@ -33,9 +32,6 @@ int signalfd (int fd, const sigset_t *mask, int flags) return -1; } return __syscall_signalfd(fd, mask, _NSIG / 8); -#elif defined __UCLIBC_HAS_STUBS__ - __set_errno(ENOSYS); - return -1; #endif } #endif diff --git a/libc/sysdeps/linux/common/splice.c b/libc/sysdeps/linux/common/splice.c index b21d10336..83f348a48 100644 --- a/libc/sysdeps/linux/common/splice.c +++ b/libc/sysdeps/linux/common/splice.c @@ -13,11 +13,4 @@ #ifdef __NR_splice _syscall6(ssize_t, splice, int, __fdin, __off64_t *, __offin, int, __fdout, __off64_t *, __offout, size_t, __len, unsigned int, __flags) -#else -ssize_t splice(int __fdin, __off64_t *__offin, int __fdout, - __off64_t *__offout, size_t __len, unsigned int __flags) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c new file mode 100644 index 000000000..dd4a384f8 --- /dev/null +++ b/libc/sysdeps/linux/common/stubs.c @@ -0,0 +1,183 @@ +/* + * system call not available stub + * + * Copyright (C) 2009 Analog Devices Inc. + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include +#include + +#ifdef __UCLIBC_HAS_STUBS__ + +attribute_hidden int enosys_stub(void); +libc_hidden_proto(enosys_stub) + +attribute_hidden int enosys_stub(void) +{ + __set_errno(ENOSYS); + return -1; +} +libc_hidden_def(enosys_stub) + +#define make_stub(stub) \ + link_warning(stub, #stub ": this function is not implemented") \ + strong_alias(enosys_stub, stub) + +#ifndef __ARCH_USE_MMU__ +# undef __NR_fork +#endif + +#ifndef __UCLIBC_HAS_LFS__ +# undef __NR_fadvise64 +# undef __NR_fadvise64_64 +# undef __NR_sync_file_range +#endif + +#ifndef __NR_bdflush +make_stub(bdflush) +#endif + +#ifndef __NR_capget +make_stub(capget) +#endif + +#ifndef __NR_capset +make_stub(capset) +#endif + +#ifndef __NR_create_module +make_stub(create_module) +#endif + +#ifndef __NR_delete_module +make_stub(delete_module) +#endif + +#ifndef __NR_epoll_create +make_stub(epoll_create) +#endif + +#ifndef __NR_epoll_ctl +make_stub(epoll_ctl) +#endif + +#ifndef __NR_epoll_wait +make_stub(epoll_wait) +#endif + +#ifndef __NR_fdatasync +make_stub(fdatasync) +#endif + +#ifndef __NR_flistxattr +make_stub(flistxattr) +#endif + +#ifndef __NR_fork +make_stub(fork) +#endif + +#ifndef __NR_fgetxattr +make_stub(fgetxattr) +#endif + +#ifndef __NR_fremovexattr +make_stub(fremovexattr) +#endif + +#ifndef __NR_fsetxattr +make_stub(fsetxattr) +#endif + +#ifndef __NR_get_kernel_syms +make_stub(get_kernel_syms) +#endif + +#if !defined(__NR_getpgrp) && (defined(__NR_getpgid) && (defined(__NR_getpid) || defined(__NR_getxpid))) +make_stub(getpgrp) +#endif + +#ifndef __NR_getxattr +make_stub(getxattr) +#endif + +#ifndef __NR_init_module +make_stub(init_module) +#endif + +#ifndef __NR_lgetxattr +make_stub(lgetxattr) +#endif + +#ifndef __NR_listxattr +make_stub(listxattr) +#endif + +#ifndef __NR_llistxattr +make_stub(llistxattr) +#endif + +#ifndef __NR_lremovexattr +make_stub(lremovexattr) +#endif + +#ifndef __NR_lsetxattr +make_stub(lsetxattr) +#endif + +#ifndef __NR_pivot_root +make_stub(pivot_root) +#endif + +#ifndef __NR_query_module +make_stub(query_module) +#endif + +#ifndef __NR_removexattr +make_stub(removexattr) +#endif + +#ifndef __NR_sched_getaffinity +make_stub(sched_getaffinity) +#endif + +#ifndef __NR_sched_setaffinity +make_stub(sched_setaffinity) +#endif + +#ifndef __NR_setxattr +make_stub(setxattr) +#endif + +#if !defined(__NR_signalfd4) && !defined(__NR_signalfd) +make_stub(signalfd) +#endif + +#ifndef __NR_rt_sigtimedwait +make_stub(sigtimedwait) +make_stub(sigwaitinfo) +#endif + +#ifndef __NR_splice +make_stub(splice) +#endif + +#ifndef __NR_sync_file_range +make_stub(sync_file_range) +#endif + +#if !defined(__NR_umount) && !defined(__NR_umount2) +make_stub(umount) +#endif + +#ifndef __NR_umount2 +make_stub(umount2) +#endif + +#ifndef __NR_vmsplice +make_stub(vmsplice) +#endif + +#endif diff --git a/libc/sysdeps/linux/common/sync_file_range.c b/libc/sysdeps/linux/common/sync_file_range.c index 7e2deff41..d24403e1b 100644 --- a/libc/sysdeps/linux/common/sync_file_range.c +++ b/libc/sysdeps/linux/common/sync_file_range.c @@ -23,11 +23,5 @@ int sync_file_range(int fd, off64_t offset, off64_t nbytes, unsigned int flags) __LONG_LONG_PAIR((long)(nbytes >> 32), (long)(nbytes & 0xffffffff)), flags); } -#elif defined __UCLIBC_HAS_STUBS__ -int sync_file_range(int fd, __off64_t offset, __off64_t nbytes, unsigned int flags) -{ - __set_errno(ENOSYS); - return -1; -} #endif #endif diff --git a/libc/sysdeps/linux/common/umount.c b/libc/sysdeps/linux/common/umount.c index 453ecd27b..a084d29bd 100644 --- a/libc/sysdeps/linux/common/umount.c +++ b/libc/sysdeps/linux/common/umount.c @@ -28,14 +28,5 @@ int umount(const char *special_file) return (__syscall_umount2(special_file, 0)); } -/* arch doesn't provide any umount syscall !? */ -#else - -int umount(const char *special_file) -{ - __set_errno(ENOSYS); - return -1; -} - #endif #endif diff --git a/libc/sysdeps/linux/common/umount2.c b/libc/sysdeps/linux/common/umount2.c index bd44717d4..2cc4a2338 100644 --- a/libc/sysdeps/linux/common/umount2.c +++ b/libc/sysdeps/linux/common/umount2.c @@ -13,11 +13,5 @@ #include #ifdef __NR_umount2 /* Old kernels don't have umount2 */ _syscall2(int, umount2, const char *, special_file, int, flags) -#else -int umount2(const char *special_file, int flags) -{ - __set_errno(ENOSYS); - return -1; -} #endif #endif diff --git a/libc/sysdeps/linux/common/vmsplice.c b/libc/sysdeps/linux/common/vmsplice.c index c5fd6c7ed..dd0640e1e 100644 --- a/libc/sysdeps/linux/common/vmsplice.c +++ b/libc/sysdeps/linux/common/vmsplice.c @@ -13,11 +13,4 @@ #ifdef __NR_vmsplice _syscall4(ssize_t, vmsplice, int, __fdout, const struct iovec *, __iov, size_t, __count, unsigned int, __flags) -#else -ssize_t vmsplice(int __fdout, const struct iovec *__iov, size_t __count, - unsigned int __flags) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/common/xattr.c b/libc/sysdeps/linux/common/xattr.c index 8a4e3be29..dea471ad6 100644 --- a/libc/sysdeps/linux/common/xattr.c +++ b/libc/sysdeps/linux/common/xattr.c @@ -29,136 +29,58 @@ #ifdef __NR_setxattr _syscall5(int, setxattr, const char *, path, const char *, name, const void *, value, size_t, size, int, flags) -#else -int setxattr(__const char *__path, __const char *__name, - __const void *__value, size_t __size, int __flags) -{ - __set_errno(ENOSYS); - return -1; -} #endif #ifdef __NR_lsetxattr _syscall5(int, lsetxattr, const char *, path, const char *, name, const void *, value, size_t, size, int, flags) -#else -int lsetxattr(__const char *__path, __const char *__name, - __const void *__value, size_t __size, int __flags) -{ - __set_errno(ENOSYS); - return -1; -} #endif #ifdef __NR_fsetxattr _syscall5(int, fsetxattr, int, filedes, const char *, name, const void *, value, size_t, size, int, flags) -#else -int fsetxattr(int __fd, __const char *__name, __const void *__value, - size_t __size, int __flags) -{ - __set_errno(ENOSYS); - return -1; -} #endif /* gets */ #ifdef __NR_getxattr _syscall4(ssize_t, getxattr, const char *, path, const char *, name, void *, value, size_t, size) -#else -ssize_t getxattr(__const char *__path, __const char *__name, void *__value, - size_t __size) -{ - __set_errno(ENOSYS); - return -1; -} #endif #ifdef __NR_lgetxattr _syscall4(ssize_t, lgetxattr, const char *, path, const char *, name, void *, value, size_t, size) -#else -ssize_t lgetxattr(__const char *__path, __const char *__name, - void *__value, size_t __size) -{ - __set_errno(ENOSYS); - return -1; -} #endif #ifdef __NR_fgetxattr _syscall4(ssize_t, fgetxattr, int, filedes, const char *, name, void *, value, size_t, size) -#else -ssize_t fgetxattr(int __fd, __const char *__name, void *__value, - size_t __size) -{ - __set_errno(ENOSYS); - return -1; -} #endif /* list */ #ifdef __NR_listxattr _syscall3(ssize_t, listxattr, const char *, path, char *, list, size_t, size) -#else -ssize_t listxattr(__const char *__path, char *__list, size_t __size) -{ - __set_errno(ENOSYS); - return -1; -} #endif #ifdef __NR_llistxattr _syscall3(ssize_t, llistxattr, const char *, path, char *, list, size_t, size) -#else -ssize_t llistxattr(__const char *__path, char *__list, size_t __size) -{ - __set_errno(ENOSYS); - return -1; -} #endif #ifdef __NR_flistxattr _syscall3(ssize_t, flistxattr, int, filedes, char *, list, size_t, size) -#else -ssize_t flistxattr(int __fd, char *__list, size_t __size) -{ - __set_errno(ENOSYS); - return -1; -} #endif /* remove */ #ifdef __NR_removexattr _syscall2(int, removexattr, const char *, path, const char *, name) -#else -int removexattr(__const char *__path, __const char *__name) -{ - __set_errno(ENOSYS); - return -1; -} #endif #ifdef __NR_lremovexattr _syscall2(int, lremovexattr, const char *, path, const char *, name) -#else -int lremovexattr(__const char *__path, __const char *__name) -{ - __set_errno(ENOSYS); - return -1; -} #endif #ifdef __NR_fremovexattr _syscall2(int, fremovexattr, int, filedes, const char *, name) -#else -int fremovexattr(int __fd, __const char *__name) -{ - __set_errno(ENOSYS); - return -1; -} #endif diff --git a/libc/sysdeps/linux/i386/posix_fadvise64.S b/libc/sysdeps/linux/i386/posix_fadvise64.S index 17f006aa8..b4aeff1f4 100644 --- a/libc/sysdeps/linux/i386/posix_fadvise64.S +++ b/libc/sysdeps/linux/i386/posix_fadvise64.S @@ -22,6 +22,8 @@ #include #include +#if defined __NR_fadvise64_64 + /* Was named __libc_posix_fadvise64 for some inexplicable reason. ** google says only uclibc has *__libc*_posix_fadviseXXX, ** so it cannot be compat with anything. @@ -33,7 +35,6 @@ .global posix_fadvise64 .type posix_fadvise64,%function posix_fadvise64: -#if defined __NR_fadvise64_64 /* Save regs */ pushl %ebp pushl %ebx @@ -91,10 +92,6 @@ overflow: /* Returns 0 on success, else an error code. */ negl %eax -#elif defined __UCLIBC_HAS_STUBS__ - movl $-ENOSYS, %eax - jmp __syscall_error -#endif /* Successful; return the syscall's value. */ ret @@ -106,3 +103,5 @@ overflow: ** weak_alias(__libc_posix_fadvise64,posix_fadvise64) ** #endif */ + +#endif -- cgit v1.2.3 From 7a583ea370974998b4584595b9a4088fc070df1f Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 21 Feb 2011 17:19:35 -0500 Subject: linuxthreads.old: fix nommu initial thread stack detection Because the nommu address space is flat, and the application stack can literally be located anywhere, we cannot rely on the assumptions that the mmu port gets away with. Namely, that the first thread's stack lives at the top of memory and nothing will be created above it. Currently, the code rounds the current stack up a page and sets that as the "top" of the stack, and then marks the "bottom" of the stack as "1". Then as new threads are created, this assumption is further refined by slowly backing off the "bottom" when a new stack is created within the range of the initial stack. Simple ascii example (tid0 is the initial thread): 1 thread: [bos tid0 stack tos] 2 threads: [ tid0 stack ] [tid1 stack] 3 threads: [ tid0 stack ] [tid1 stack] [tid2 stack] As you can kind of see, this algorithm operates on one basic assumption: the initial top of stack calculation is the absolute top of the stack. While this assumption was fairly safe in the original nommu days of yore where the only file format was FLAT (which defaults to a 4KiB stack -- exactly 1 page), and memory was fairly tight, we can see that this falls apart pretty quickly as soon as the initial stack is larger than a page. The issue that crops up now is simple to hit: start an application with an 8KiB stack, execute some functions that put pressure on the stack so that it exceeds 4KiB, then start up some threads. The initial tos will be rounded up by a page, but this is actually the middle of the stack. Now when the initial thread returns from its functions (thus unwinding the stack) and tries to call something which calls back into libpthread, the thread_self() func fails to detect itself as the initial thread as the current stack is now above the tos. The __pthread_find_self() func kicks in, walks all the thread arrays, fails to find a hit, and then walks into uninitialized memory for the thread descriptor. Use of this garbage memory has obvious results -- things fall down & go boom. To address this, I extend the current algorithm to automatically scale back both the bottom and the top stack limits of the initial thread. We use the current stack pointer at "thread boot time" only as a single known point. The initial thread stack bottom is set to the bottom of memory and the initial thread stack top is set to the top of memory. Then as we create new stack threads, we figure out whether the new stack is above or below the single known good address, and then scale back either the tos or the bos accordingly. Reviewed-by: Steven J. Magnani Signed-off-by: Mike Frysinger --- libpthread/linuxthreads.old/internals.h | 24 ++++++++++++++++-------- libpthread/linuxthreads.old/pthread.c | 23 ++++++++++++++--------- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/libpthread/linuxthreads.old/internals.h b/libpthread/linuxthreads.old/internals.h index 637fcea62..110dd9d56 100644 --- a/libpthread/linuxthreads.old/internals.h +++ b/libpthread/linuxthreads.old/internals.h @@ -252,17 +252,25 @@ extern pthread_descr __pthread_main_thread; Initially 0, meaning that the current thread is (by definition) the initial thread. */ -/* For non-MMU systems also remember to stack top of the initial thread. - * This is adapted when other stacks are malloc'ed since we don't know - * the bounds a-priori. -StS */ - extern char *__pthread_initial_thread_bos; #ifndef __ARCH_USE_MMU__ -extern char *__pthread_initial_thread_tos; +/* For non-MMU systems, we have no idea the bounds of the initial thread + * stack, so we have to track it on the fly relative to other stacks. Do + * so by scaling back our assumptions on the limits of the bos/tos relative + * to the known mid point. See also the comments in pthread_initialize(). */ +extern char *__pthread_initial_thread_tos, *__pthread_initial_thread_mid; #define NOMMU_INITIAL_THREAD_BOUNDS(tos,bos) \ - if ((tos)>=__pthread_initial_thread_bos \ - && (bos)<__pthread_initial_thread_tos) \ - __pthread_initial_thread_bos = (tos)+1 + do { \ + char *__tos = (tos); \ + char *__bos = (bos); \ + if (__tos >= __pthread_initial_thread_bos && \ + __bos < __pthread_initial_thread_tos) { \ + if (__bos < __pthread_initial_thread_mid) \ + __pthread_initial_thread_bos = __tos; \ + else \ + __pthread_initial_thread_tos = __bos; \ + } \ + } while (0) #else #define NOMMU_INITIAL_THREAD_BOUNDS(tos,bos) /* empty */ #endif /* __ARCH_USE_MMU__ */ diff --git a/libpthread/linuxthreads.old/pthread.c b/libpthread/linuxthreads.old/pthread.c index ad392e34e..a8830b1a4 100644 --- a/libpthread/linuxthreads.old/pthread.c +++ b/libpthread/linuxthreads.old/pthread.c @@ -168,12 +168,10 @@ pthread_descr __pthread_main_thread = &__pthread_initial_thread; char *__pthread_initial_thread_bos = NULL; -/* For non-MMU systems also remember to stack top of the initial thread. - * This is adapted when other stacks are malloc'ed since we don't know - * the bounds a-priori. -StS */ - #ifndef __ARCH_USE_MMU__ +/* See nommu notes in internals.h and pthread_initialize() below. */ char *__pthread_initial_thread_tos = NULL; +char *__pthread_initial_thread_mid = NULL; #endif /* __ARCH_USE_MMU__ */ /* File descriptor for sending requests to the thread manager. */ @@ -457,12 +455,19 @@ static void pthread_initialize(void) setrlimit(RLIMIT_STACK, &limit); } #else - /* For non-MMU assume __pthread_initial_thread_tos at upper page boundary, and - * __pthread_initial_thread_bos at address 0. These bounds are refined as we - * malloc other stack frames such that they don't overlap. -StS + /* For non-MMU, the initial thread stack can reside anywhere in memory. + * We don't have a way of knowing where the kernel started things -- top + * or bottom (well, that isn't exactly true, but the solution is fairly + * complex and error prone). All we can determine here is an address + * that lies within that stack. Save that address as a reference so that + * as other thread stacks are created, we can adjust the estimated bounds + * of the initial thread's stack appropriately. + * + * This checking is handled in NOMMU_INITIAL_THREAD_BOUNDS(), so see that + * for a few more details. */ - __pthread_initial_thread_tos = - (char *)(((long)CURRENT_STACK_FRAME + getpagesize()) & ~(getpagesize() - 1)); + __pthread_initial_thread_mid = CURRENT_STACK_FRAME; + __pthread_initial_thread_tos = (char *) -1; __pthread_initial_thread_bos = (char *) 1; /* set it non-zero so we know we have been here */ PDEBUG("initial thread stack bounds: bos=%p, tos=%p\n", __pthread_initial_thread_bos, __pthread_initial_thread_tos); -- cgit v1.2.3 From be88a80858ea4febcc621f87166fbf4c1753e513 Mon Sep 17 00:00:00 2001 From: Carmelo Amoroso Date: Mon, 7 Feb 2011 18:03:36 +0100 Subject: nptl:arm: add a wrapper for .cfi_sections pseudo-ops ARM disables by default the support for ASM CFI directives. Anyway using an old version of binutils that does not support some new pseudo-op, the build fails as below: AS libpthread/nptl/sysdeps/unix/sysv/linux/close.oS libpthread/nptl/sysdeps/unix/sysv/linux/close.S: Assembler messages: libpthread/nptl/sysdeps/unix/sysv/linux/close.S:9: Error: unknown pseudo-op: `.cfi_sections' The problem is that the .cfi_sections pseudo should be wrapped by a macro that expands to nothing when the CFI is off. Signed-off-by: Carmelo Amoroso CC: Khem Ray --- libc/sysdeps/linux/common/sysdep.h | 5 +++++ libpthread/nptl/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h | 2 +- libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-resume.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libc/sysdeps/linux/common/sysdep.h b/libc/sysdeps/linux/common/sysdep.h index a7ec95480..156e5711a 100644 --- a/libc/sysdeps/linux/common/sysdep.h +++ b/libc/sysdeps/linux/common/sysdep.h @@ -51,6 +51,7 @@ /* Macros to generate eh_frame unwind information. */ # ifdef HAVE_ASM_CFI_DIRECTIVES +# define cfi_sections(sect...) .cfi_sections sect # define cfi_startproc .cfi_startproc # define cfi_endproc .cfi_endproc # define cfi_def_cfa(reg, off) .cfi_def_cfa reg, off @@ -71,6 +72,7 @@ # define cfi_lsda(enc, exp) .cfi_lsda enc, exp # else +# define cfi_sections(sect...) # define cfi_startproc # define cfi_endproc # define cfi_def_cfa(reg, off) @@ -95,6 +97,8 @@ # ifdef HAVE_ASM_CFI_DIRECTIVES # define CFI_STRINGIFY(Name) CFI_STRINGIFY2 (Name) # define CFI_STRINGIFY2(Name) #Name +# define CFI_SECTIONS(sect...) \ + ".cfi_sections " CFI_STRINGIFY(sect) # define CFI_STARTPROC ".cfi_startproc" # define CFI_ENDPROC ".cfi_endproc" # define CFI_DEF_CFA(reg, off) \ @@ -128,6 +132,7 @@ # define CFI_LSDA(enc, exp) \ ".cfi_lsda " CFI_STRINGIFY(enc) "," CFI_STRINGIFY(exp) # else +# define CFI_SECTIONS(sect...) # define CFI_STARTPROC # define CFI_ENDPROC # define CFI_DEF_CFA(reg, off) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h index 7ac9ca1e9..f0e5f6b37 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h @@ -36,7 +36,7 @@ .type __##syscall_name##_nocancel,%function; \ .globl __##syscall_name##_nocancel; \ __##syscall_name##_nocancel: \ - .cfi_sections .debug_frame; \ + cfi_sections(.debug_frame); \ cfi_startproc; \ DO_CALL (syscall_name, args); \ PSEUDO_RET; \ diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-resume.c b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-resume.c index e35374d34..15250157c 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-resume.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind-resume.c @@ -65,7 +65,7 @@ __asm__ ( " .globl _Unwind_Resume\n" " .type _Unwind_Resume, %function\n" "_Unwind_Resume:\n" -" .cfi_sections .debug_frame\n" +" " CFI_SECTIONS (.debug_frame) "\n" " " CFI_STARTPROC "\n" " stmfd sp!, {r4, r5, r6, lr}\n" " " CFI_ADJUST_CFA_OFFSET (16)" \n" -- cgit v1.2.3 From 435471db8561e4686e5921b7f719ab6d5a0d06f7 Mon Sep 17 00:00:00 2001 From: Carmelo Amoroso Date: Thu, 3 Mar 2011 09:22:15 +0100 Subject: ldso: use ADDR_ALIGN instead of hard-coded value Use ADDR_ALIGN to align the minvma when loading shared libraries instead of the hard coded 0xffffU value. This fixes teh stand/alone support on ARM as reported in bug #3133. Signed-off-by: Sven Ola Signed-off-by: Carmelo Amoroso --- ldso/ldso/dl-elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 5562e0784..61d495974 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -465,7 +465,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, DL_CHECK_LIB_TYPE (epnt, piclib, _dl_progname, libname); maxvma = (maxvma + ADDR_ALIGN) & PAGE_ALIGN; - minvma = minvma & ~0xffffU; + minvma = minvma & ~ADDR_ALIGN; flags = MAP_PRIVATE /*| MAP_DENYWRITE */ ; if (!piclib) -- cgit v1.2.3 From 41615c3fe7fe4bbcdd83975876e0108a09301f4a Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 18:15:29 +0100 Subject: include features.h include features.h to make the next ifdef work. Signed-off-by: Peter S. Mazinger --- include/protocols/timed.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/protocols/timed.h b/include/protocols/timed.h index 8101e9924..f50061cc1 100644 --- a/include/protocols/timed.h +++ b/include/protocols/timed.h @@ -32,6 +32,7 @@ #ifndef _PROTOCOLS_TIMED_H #define _PROTOCOLS_TIMED_H 1 +#include #ifdef __UCLIBC_HAS_RPC__ #include #endif -- cgit v1.2.3 From a82ba03b6ff449bdfdae4ad360c2ab59bda09ef4 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 18:28:19 +0100 Subject: add UCLIBC_STRICT_HEADERS config option Add config option to disable the visibility of structures/constants that should not be visible unless a feature is enabled. Signed-off-by: Peter S. Mazinger --- extra/Configs/Config.in | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in index f152a9666..15da168d5 100644 --- a/extra/Configs/Config.in +++ b/extra/Configs/Config.in @@ -657,6 +657,17 @@ config UCLIBC_SUSV4_LEGACY WARNING! ABI incompatibility. +config UCLIBC_STRICT_HEADERS + bool "Enable structures and constants for unsupported features" + default n + help + Enable structures and constants in headers that should not be used, + because the respective feature is disabled. + + WARNING! enabling this option requires to patch many faulty apps, + since they make (wrongly) use of these structures/constants, + although the feature was disabled. + config UCLIBC_HAS_STUBS bool "Provide stubs for unavailable functionality" default n -- cgit v1.2.3 From 9fa4711e364e9aa779d6b8d12220bbb63dbb1f3d Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 18:45:19 +0100 Subject: guard IPv6 stuff disable IPv6 related stuff if feature is disabled. Signed-off-by: Peter S. Mazinger --- include/net/route.h | 4 ++++ include/netinet/in.h | 17 +++++++++++++++-- libc/inet/getaddrinfo.c | 4 ++++ libc/inet/ifaddrs.c | 10 ++++++++++ libc/inet/rpc/sa_len.c | 4 ++++ 5 files changed, 37 insertions(+), 2 deletions(-) diff --git a/include/net/route.h b/include/net/route.h index da5c810c7..ea6c9b941 100644 --- a/include/net/route.h +++ b/include/net/route.h @@ -55,6 +55,7 @@ struct rtentry #define rt_mss rt_mtu +#if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__ struct in6_rtmsg { struct in6_addr rtmsg_dst; @@ -68,6 +69,7 @@ struct in6_rtmsg u_int32_t rtmsg_flags; int rtmsg_ifindex; }; +#endif #define RTF_UP 0x0001 /* Route usable. */ @@ -129,6 +131,7 @@ struct in6_rtmsg #define RT_CLASS_MAX 255 +#if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__ #define RTMSG_ACK NLMSG_ACK #define RTMSG_OVERRUN NLMSG_OVERRUN @@ -141,5 +144,6 @@ struct in6_rtmsg #define RTMSG_CONTROL 0x40 #define RTMSG_AR_FAILED 0x51 /* Address Resolution failed. */ +#endif #endif /* net/route.h */ diff --git a/include/netinet/in.h b/include/netinet/in.h index 6327001ee..235194bbe 100644 --- a/include/netinet/in.h +++ b/include/netinet/in.h @@ -194,6 +194,7 @@ struct in_addr #define INADDR_MAX_LOCAL_GROUP ((in_addr_t) 0xe00000ff) /* 224.0.0.255 */ +#if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__ /* IPv6 address */ struct in6_addr { @@ -218,8 +219,10 @@ libc_hidden_proto(in6addr_loopback) #define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } #define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } -#define INET_ADDRSTRLEN 16 #define INET6_ADDRSTRLEN 46 +#endif + +#define INET_ADDRSTRLEN 16 #if 1 /*def __UCLIBC_HAS_IPV4__*/ @@ -238,6 +241,7 @@ struct sockaddr_in }; #endif +#if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__ /* Ditto, for IPv6. */ struct sockaddr_in6 { @@ -247,6 +251,7 @@ struct sockaddr_in6 struct in6_addr sin6_addr; /* IPv6 address */ uint32_t sin6_scope_id; /* IPv6 scope-id */ }; +#endif #if defined __USE_MISC || defined __USE_GNU @@ -274,6 +279,7 @@ struct ip_mreq_source #endif +#if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__ /* Likewise, for IPv6. */ struct ipv6_mreq { @@ -283,6 +289,7 @@ struct ipv6_mreq /* local interface */ unsigned int ipv6mr_interface; }; +#endif #if defined __USE_MISC || defined __USE_GNU @@ -403,6 +410,7 @@ libc_hidden_proto(htons) # endif #endif +#if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__ #define IN6_IS_ADDR_UNSPECIFIED(a) \ (((__const uint32_t *) (a))[0] == 0 \ && ((__const uint32_t *) (a))[1] == 0 \ @@ -441,6 +449,7 @@ libc_hidden_proto(htons) && (((__const uint32_t *) (a))[1] == ((__const uint32_t *) (b))[1]) \ && (((__const uint32_t *) (a))[2] == ((__const uint32_t *) (b))[2]) \ && (((__const uint32_t *) (a))[3] == ((__const uint32_t *) (b))[3])) +#endif #if defined __USE_MISC || defined __USE_GNU /* Bind socket to a privileged IP port. */ @@ -455,6 +464,7 @@ extern int bindresvport6 (int __sockfd, struct sockaddr_in6 *__sock_in) #endif +#if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__ #define IN6_IS_ADDR_MC_NODELOCAL(a) \ (IN6_IS_ADDR_MULTICAST(a) \ && ((((__const uint8_t *) (a))[1] & 0xf) == 0x1)) @@ -476,13 +486,14 @@ extern int bindresvport6 (int __sockfd, struct sockaddr_in6 *__sock_in) && ((((__const uint8_t *) (a))[1] & 0xf) == 0xe)) -#if defined __USE_GNU && defined __UCLIBC_HAS_IPV6__ +#ifdef __USE_GNU /* IPv6 packet information. */ struct in6_pktinfo { struct in6_addr ipi6_addr; /* src/dst IPv6 address */ unsigned int ipi6_ifindex; /* send/recv interface index */ }; +#endif /* IPv6 MTU information. */ struct ip6_mtuinfo @@ -493,6 +504,7 @@ struct ip6_mtuinfo #endif #if 0 /*def __USE_GNU*/ +#ifdef __UCLIBC_HAS_IPV6__ /* Obsolete hop-by-hop and Destination Options Processing (RFC 2292). */ extern int inet6_option_space (int __nbytes) __THROW __attribute_deprecated__; @@ -540,6 +552,7 @@ extern int inet6_rth_reverse (__const void *__in, void *__out) __THROW; extern int inet6_rth_segments (__const void *__bp) __THROW; extern struct in6_addr *inet6_rth_getaddr (__const void *__bp, int __index) __THROW; +#endif /* Multicast source filter support. */ diff --git a/libc/inet/getaddrinfo.c b/libc/inet/getaddrinfo.c index cdfdb72cf..b3435a8b2 100644 --- a/libc/inet/getaddrinfo.c +++ b/libc/inet/getaddrinfo.c @@ -639,9 +639,13 @@ gaih_inet(const char *name, const struct gaih_service *service, tmpbuflen *= 2; tmpbuf = alloca(tmpbuflen); rc = gethostbyaddr_r(at2->addr, +#ifdef __UCLIBC_HAS_IPV6__ ((at2->family == AF_INET6) ? sizeof(struct in6_addr) : sizeof(struct in_addr)), +#else + sizeof(struct in_addr), +#endif at2->family, &th, tmpbuf, tmpbuflen, &h, &herrno); diff --git a/libc/inet/ifaddrs.c b/libc/inet/ifaddrs.c index 3b8b674c2..39729ef47 100644 --- a/libc/inet/ifaddrs.c +++ b/libc/inet/ifaddrs.c @@ -59,7 +59,9 @@ struct ifaddrs_storage struct sockaddr sa; struct sockaddr_ll sl; struct sockaddr_in s4; +#ifdef __UCLIBC_HAS_IPV6__ struct sockaddr_in6 s6; +#endif } addr, netmask, broadaddr; char name[IF_NAMESIZE + 1]; }; @@ -621,6 +623,7 @@ getifaddrs (struct ifaddrs **ifap) rta_data, rta_payload); break; +#ifdef __UCLIBC_HAS_IPV6__ case AF_INET6: /* Size must match that of an address for IPv6. */ if (rta_payload == 16) @@ -633,6 +636,7 @@ getifaddrs (struct ifaddrs **ifap) = ifam->ifa_index; } break; +#endif default: if (rta_payload <= sizeof (ifas[ifa_index].addr)) @@ -668,6 +672,7 @@ getifaddrs (struct ifaddrs **ifap) rta_data, rta_payload); break; +#ifdef __UCLIBC_HAS_IPV6__ case AF_INET6: /* Size must match that of an address for IPv6. */ if (rta_payload == 16) @@ -680,6 +685,7 @@ getifaddrs (struct ifaddrs **ifap) ifam->ifa_index; } break; +#endif default: if (rta_payload <= sizeof (ifas[ifa_index].addr)) @@ -709,6 +715,7 @@ getifaddrs (struct ifaddrs **ifap) rta_data, rta_payload); break; +#ifdef __UCLIBC_HAS_IPV6__ case AF_INET6: /* Size must match that of an address for IPv6. */ if (rta_payload == 16) @@ -721,6 +728,7 @@ getifaddrs (struct ifaddrs **ifap) = ifam->ifa_index; } break; +#endif default: if (rta_payload <= sizeof (ifas[ifa_index].addr)) @@ -777,10 +785,12 @@ getifaddrs (struct ifaddrs **ifap) max_prefixlen = 32; break; +#ifdef __UCLIBC_HAS_IPV6__ case AF_INET6: cp = (char *) &ifas[ifa_index].netmask.s6.sin6_addr; max_prefixlen = 128; break; +#endif } ifas[ifa_index].ifa.ifa_netmask->sa_family diff --git a/libc/inet/rpc/sa_len.c b/libc/inet/rpc/sa_len.c index 3b37eba44..5f258db1f 100644 --- a/libc/inet/rpc/sa_len.c +++ b/libc/inet/rpc/sa_len.c @@ -52,10 +52,14 @@ int __libc_sa_len (sa_family_t af) #endif case AF_INET: return sizeof (struct sockaddr_in); +#ifdef __UCLIBC_HAS_IPV6__ case AF_INET6: return sizeof (struct sockaddr_in6); +#endif +#if 0 case AF_IPX: return sizeof (struct sockaddr_ipx); +#endif case AF_LOCAL: return sizeof (struct sockaddr_un); } -- cgit v1.2.3 From 33c5506e97dc04a46fb7e06c03de144b66788520 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 18:52:21 +0100 Subject: disable build warnings in utils Disable some build warnings in utils. Signed-off-by: Peter S. Mazinger --- utils/getconf.c | 1 + utils/ldconfig.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/getconf.c b/utils/getconf.c index 812783ecf..5ff98e6fc 100644 --- a/utils/getconf.c +++ b/utils/getconf.c @@ -15,6 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define _GNU_SOURCE 1 #include #include #include diff --git a/utils/ldconfig.c b/utils/ldconfig.c index a25de260a..024be7ca4 100644 --- a/utils/ldconfig.c +++ b/utils/ldconfig.c @@ -568,7 +568,7 @@ static char *get_extpath(void) if ((file = fopen(realconffile, "r")) != NULL) { fstat(fileno(file), &st); res = xmalloc(st.st_size + 1); - fread(res, 1, st.st_size, file); + (void)fread(res, 1, st.st_size, file); fclose(file); res[st.st_size] = '\0'; -- cgit v1.2.3 From 60d28a6cda74226e0532a58336a83dae0af347fb Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 19:09:46 +0100 Subject: initialize tls_tpnt to NULL on all archs Initialize tls_tpnt to NULL on all archs instead of 0. Signed-off-by: Peter S. Mazinger --- ldso/ldso/i386/elfinterp.c | 2 +- ldso/ldso/sparc/elfinterp.c | 2 +- ldso/ldso/x86_64/elfinterp.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ldso/ldso/i386/elfinterp.c b/ldso/ldso/i386/elfinterp.c index 0017c239b..5fb288351 100644 --- a/ldso/ldso/i386/elfinterp.c +++ b/ldso/ldso/i386/elfinterp.c @@ -162,7 +162,7 @@ _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope, int reloc_type; int symtab_index; char *symname; - struct elf_resolve *tls_tpnt = 0; + struct elf_resolve *tls_tpnt = NULL; unsigned long *reloc_addr; unsigned long symbol_addr; #if defined (__SUPPORT_LD_DEBUG__) diff --git a/ldso/ldso/sparc/elfinterp.c b/ldso/ldso/sparc/elfinterp.c index 443f65bde..c684378cc 100644 --- a/ldso/ldso/sparc/elfinterp.c +++ b/ldso/ldso/sparc/elfinterp.c @@ -170,7 +170,7 @@ _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope, int reloc_type; int symtab_index; char *symname; - struct elf_resolve *tls_tpnt = 0; + struct elf_resolve *tls_tpnt = NULL; struct symbol_ref sym_ref; ElfW(Addr) *reloc_addr; ElfW(Addr) symbol_addr; diff --git a/ldso/ldso/x86_64/elfinterp.c b/ldso/ldso/x86_64/elfinterp.c index 15d773388..27b1a15fd 100644 --- a/ldso/ldso/x86_64/elfinterp.c +++ b/ldso/ldso/x86_64/elfinterp.c @@ -157,7 +157,7 @@ _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope, int reloc_type; int symtab_index; char *symname; - struct elf_resolve *tls_tpnt = 0; + struct elf_resolve *tls_tpnt = NULL; struct symbol_ref sym_ref; ElfW(Addr) *reloc_addr; ElfW(Addr) symbol_addr; -- cgit v1.2.3 From 624be66cb9b350d5c6538fca8592cdb3a4c23d37 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 19:15:32 +0100 Subject: try to fix duplicated slashes in the generated lib*.so files Try to fix duplicated slashes in the generated lib*.so files and make sure that on installation the *bin directories are really created (avoid the misbehaviour of creating usrbin dir). Signed-off-by: Peter S. Mazinger --- Makefile.in | 22 +++++++++++----------- Rules.mak | 6 +++--- utils/Makefile.in | 10 +++++----- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Makefile.in b/Makefile.in index 2cd226d96..6cb20342f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -186,8 +186,8 @@ $(top_builddir)include/bits/sysnum.h: $(top_srcdir)extra/scripts/gen_bits_syscal fi $(LOCAL_INSTALL_PATH): - $(Q)$(MAKE) PREFIX=$(shell pwd)/$(LOCAL_INSTALL_PATH) RUNTIME_PREFIX=/ \ - DEVEL_PREFIX=/usr/ \ + $(Q)$(MAKE) PREFIX=$(shell pwd)/$(LOCAL_INSTALL_PATH) RUNTIME_PREFIX= \ + DEVEL_PREFIX=/usr \ HOSTCC="$(HOSTCC)" \ install @@ -281,7 +281,7 @@ HEADERS_RM-$(UCLIBC_SUSV4_LEGACY) += utime.h ### ucontext.h ifneq ($(findstring install,$(MAKECMDGOALS)),) -$(addprefix $(PREFIX)$(DEVEL_PREFIX),include $(MULTILIB_DIR)): +$(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)$(MULTILIB_DIR))) @@ -289,22 +289,22 @@ $(PREFIX)$(RUNTIME_PREFIX)$(MULTILIB_DIR): $(do_mkdir) endif endif -install_headers: headers $(top_builddir)extra/scripts/unifdef | $(PREFIX)$(DEVEL_PREFIX)include - @$(call disp_install,"include -> $(PREFIX)$(DEVEL_PREFIX)include") +install_headers: headers $(top_builddir)extra/scripts/unifdef | $(PREFIX)$(DEVEL_PREFIX)/include + @$(call disp_install,"include -> $(PREFIX)$(DEVEL_PREFIX)/include") $(Q)top_builddir=$(top_builddir) \ $(top_srcdir)extra/scripts/install_headers.sh \ - include $(PREFIX)$(DEVEL_PREFIX)include + include $(PREFIX)$(DEVEL_PREFIX)/include ifneq ($(O),) # only run this step in O is set i.e. make O=/my/builddir/ .. - @$(call disp_install,"$(top_builddir)/include -> $(PREFIX)$(DEVEL_PREFIX)include") + @$(call disp_install,"$(top_builddir)/include -> $(PREFIX)$(DEVEL_PREFIX)/include") $(Q)top_builddir=$(top_builddir) \ $(top_srcdir)extra/scripts/install_headers.sh \ - $(top_builddir)/include $(PREFIX)$(DEVEL_PREFIX)include + $(top_builddir)/include $(PREFIX)$(DEVEL_PREFIX)/include endif - $(Q)cd $(PREFIX)$(DEVEL_PREFIX)include && $(RM) -r $(HEADERS_RM-) + $(Q)cd $(PREFIX)$(DEVEL_PREFIX)/include && $(RM) -r $(HEADERS_RM-) ifeq ($(UCLIBC_HAS_WCHAR),) - $(Q)cd $(PREFIX)$(DEVEL_PREFIX)include && mv -f wchar-stub.h wchar.h + $(Q)cd $(PREFIX)$(DEVEL_PREFIX)/include && mv -f wchar-stub.h wchar.h else - $(Q)cd $(PREFIX)$(DEVEL_PREFIX)include && $(RM) -f wchar-stub.h + $(Q)cd $(PREFIX)$(DEVEL_PREFIX)/include && $(RM) -f wchar-stub.h endif # Installs startfiles diff --git a/Rules.mak b/Rules.mak index 8165ccabe..fe287335b 100644 --- a/Rules.mak +++ b/Rules.mak @@ -95,9 +95,9 @@ export ARCH # Make certain these contain a final "/", but no "//"s. TARGET_SUBARCH:=$(call qstrip,$(shell grep -s '^TARGET_SUBARCH' $(top_builddir)/.config | $(SED) -e 's/^TARGET_SUBARCH=//')) TARGET_SUBARCH:=$(call qstrip,$(TARGET_SUBARCH)) -RUNTIME_PREFIX:=$(strip $(subst //,/, $(subst ,/, $(call qstrip,$(RUNTIME_PREFIX))))) -DEVEL_PREFIX:=$(strip $(subst //,/, $(subst ,/, $(call qstrip,$(DEVEL_PREFIX))))) -MULTILIB_DIR:=$(strip $(subst //,/, $(subst ,/, $(call qstrip,$(MULTILIB_DIR))))) +RUNTIME_PREFIX:=$(strip $(subst //,/, $(call qstrip,$(RUNTIME_PREFIX)))) +DEVEL_PREFIX:=$(strip $(subst //,/, $(call qstrip,$(DEVEL_PREFIX)))) +MULTILIB_DIR:=$(strip $(subst //,/, $(call qstrip,$(MULTILIB_DIR)))) KERNEL_HEADERS:=$(strip $(subst //,/, $(subst ,/, $(call qstrip,$(KERNEL_HEADERS))))) export RUNTIME_PREFIX DEVEL_PREFIX KERNEL_HEADERS MULTILIB_DIR diff --git a/utils/Makefile.in b/utils/Makefile.in index 65364d771..f3e67eb52 100644 --- a/utils/Makefile.in +++ b/utils/Makefile.in @@ -119,14 +119,14 @@ install-y += utils_install # This installs both utils and hostutils, so doesn't depend on either. utils_install: $(addsuffix $(DOTHOST), $(utils_OBJ) $(utils_LOCALE_OBJ)) - $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/getconf$(DOTHOST) $(PREFIX)$(DEVEL_PREFIX)bin/getconf + $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/getconf$(DOTHOST) $(PREFIX)$(DEVEL_PREFIX)/bin/getconf ifeq ($(HAVE_SHARED),y) - $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/ldd$(DOTHOST) $(PREFIX)$(DEVEL_PREFIX)bin/ldd - $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/ldconfig$(DOTHOST) $(PREFIX)$(RUNTIME_PREFIX)sbin/ldconfig + $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/ldd$(DOTHOST) $(PREFIX)$(DEVEL_PREFIX)/bin/ldd + $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/ldconfig$(DOTHOST) $(PREFIX)$(RUNTIME_PREFIX)/sbin/ldconfig endif ifeq ($(UCLIBC_HAS_LOCALE),y) - $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/iconv$(DOTHOST) $(PREFIX)$(DEVEL_PREFIX)bin/iconv - #$(Q)$(INSTALL) -m 755 $(utils_OUT)/locale$(DOTHOST) $(PREFIX)$(DEVEL_PREFIX)bin/locale + $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/iconv$(DOTHOST) $(PREFIX)$(DEVEL_PREFIX)/bin/iconv + #$(Q)$(INSTALL) -m 755 $(utils_OUT)/locale$(DOTHOST) $(PREFIX)$(DEVEL_PREFIX)/bin/locale endif -- cgit v1.2.3 From df25e26ca756038711354a32f7765ee6fa75b2ec Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 19:20:18 +0100 Subject: syntax fix Signed-off-by: Peter S. Mazinger --- ldso/ldso/ldso.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index ea4ad0f1c..89af5a505 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -110,7 +110,7 @@ uintptr_t __stack_chk_guard attribute_relro; # ifdef __UCLIBC_HAS_SSP_COMPAT__ strong_alias(__stack_chk_guard,__guard) # endif -# elif __UCLIBC_HAS_SSP_COMPAT__ +# elif defined __UCLIBC_HAS_SSP_COMPAT__ uintptr_t __guard attribute_relro; # endif #endif -- cgit v1.2.3 From 099b65127dd434846ca75d5fb11c2db303ed77a6 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 19:23:10 +0100 Subject: avoid warnings on _STACK_GROWS_* usage Signed-off-by: Peter S. Mazinger --- libpthread/linuxthreads/cancel.c | 2 +- libpthread/linuxthreads/manager.c | 10 +++++----- libpthread/linuxthreads/ptcleanup.c | 4 ++-- libpthread/linuxthreads/pthread.c | 4 ++-- libpthread/nptl/allocatestack.c | 16 ++++++++-------- libpthread/nptl/pt-cleanup.c | 4 ++-- libpthread/nptl/unwind.c | 2 +- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/libpthread/linuxthreads/cancel.c b/libpthread/linuxthreads/cancel.c index 34356801a..43f04457b 100644 --- a/libpthread/linuxthreads/cancel.c +++ b/libpthread/linuxthreads/cancel.c @@ -23,7 +23,7 @@ #ifdef _STACK_GROWS_DOWN # define FRAME_LEFT(frame, other) ((char *) frame >= (char *) other) -#elif _STACK_GROWS_UP +#elif defined _STACK_GROWS_UP # define FRAME_LEFT(frame, other) ((char *) frame <= (char *) other) #else # error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP" diff --git a/libpthread/linuxthreads/manager.c b/libpthread/linuxthreads/manager.c index 4293741ac..1dd626e23 100644 --- a/libpthread/linuxthreads/manager.c +++ b/libpthread/linuxthreads/manager.c @@ -445,7 +445,7 @@ static int pthread_allocate_stack(const pthread_attr_t *attr, new_thread = ((pthread_descr) (new_thread_bottom + stacksize + guardsize)) - 1; # endif -# elif _STACK_GROWS_DOWN +# elif defined _STACK_GROWS_DOWN guardaddr = map_addr; if (guardsize > 0) mprotect (guardaddr, guardsize, PROT_NONE); @@ -456,7 +456,7 @@ static int pthread_allocate_stack(const pthread_attr_t *attr, # else new_thread = ((pthread_descr) (new_thread_bottom + stacksize)) - 1; # endif -# elif _STACK_GROWS_UP +# elif defined _STACK_GROWS_UP guardaddr = map_addr + stacksize; if (guardsize > 0) mprotect (guardaddr, guardsize, PROT_NONE); @@ -744,7 +744,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr, (char *)stack_addr - new_thread_bottom, CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_SYSVSEM | __pthread_sig_cancel, new_thread); -#elif _STACK_GROWS_UP +#elif defined _STACK_GROWS_UP pid = __clone(pthread_start_thread_event, (void *) new_thread_bottom, CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_SYSVSEM | __pthread_sig_cancel, new_thread); @@ -785,7 +785,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr, (char *)stack_addr - new_thread_bottom, CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_SYSVSEM | __pthread_sig_cancel, new_thread); -#elif _STACK_GROWS_UP +#elif defined _STACK_GROWS_UP pid = __clone(pthread_start_thread, (void *) new_thread_bottom, CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_SYSVSEM | __pthread_sig_cancel, new_thread); @@ -806,7 +806,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr, - new_thread_bottom); munmap((caddr_t)new_thread_bottom, 2 * stacksize + new_thread->p_guardsize); -#elif _STACK_GROWS_UP +#elif defined _STACK_GROWS_UP # ifdef USE_TLS size_t stacksize = guardaddr - stack_addr; munmap(stack_addr, stacksize + guardsize); diff --git a/libpthread/linuxthreads/ptcleanup.c b/libpthread/linuxthreads/ptcleanup.c index 6213b56f3..75bb7d599 100644 --- a/libpthread/linuxthreads/ptcleanup.c +++ b/libpthread/linuxthreads/ptcleanup.c @@ -49,13 +49,13 @@ void __pthread_cleanup_upto (__jmp_buf target, char *targetframe) c != NULL && __JMPBUF_UNWINDS(target, c, demangle_ptr); c = c->__prev) { -#if _STACK_GROWS_DOWN +#ifdef _STACK_GROWS_DOWN if ((char *) c <= targetframe) { c = NULL; break; } -#elif _STACK_GROWS_UP +#elif defined _STACK_GROWS_UP if ((char *) c >= targetframe) { c = NULL; diff --git a/libpthread/linuxthreads/pthread.c b/libpthread/linuxthreads/pthread.c index db436342f..c3e28c6ac 100644 --- a/libpthread/linuxthreads/pthread.c +++ b/libpthread/linuxthreads/pthread.c @@ -750,7 +750,7 @@ int __pthread_initialize_manager(void) THREAD_MANAGER_STACK_SIZE, CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_SYSVSEM, mgr); -#elif _STACK_GROWS_UP +#elif defined _STACK_GROWS_UP pid = __clone(__pthread_manager_event, (void **) __pthread_manager_thread_bos, CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_SYSVSEM, @@ -789,7 +789,7 @@ int __pthread_initialize_manager(void) pid = __clone2(__pthread_manager, (void **) __pthread_manager_thread_bos, THREAD_MANAGER_STACK_SIZE, CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_SYSVSEM, mgr); -#elif _STACK_GROWS_UP +#elif defined _STACK_GROWS_UP pid = __clone(__pthread_manager, (void **) __pthread_manager_thread_bos, CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_SYSVSEM, mgr); #else diff --git a/libpthread/nptl/allocatestack.c b/libpthread/nptl/allocatestack.c index 1c549cee1..6a4e252e8 100644 --- a/libpthread/nptl/allocatestack.c +++ b/libpthread/nptl/allocatestack.c @@ -316,10 +316,10 @@ change_stack_perm (struct pthread *pd + (((((pd->stackblock_size - pd->guardsize) / 2) & pagemask) + pd->guardsize) & pagemask)); size_t len = pd->stackblock + pd->stackblock_size - stack; -#elif _STACK_GROWS_DOWN +#elif defined _STACK_GROWS_DOWN void *stack = pd->stackblock + pd->guardsize; size_t len = pd->stackblock_size - pd->guardsize; -#elif _STACK_GROWS_UP +#elif defined _STACK_GROWS_UP void *stack = pd->stackblock; size_t len = (uintptr_t) pd - pd->guardsize - (uintptr_t) pd->stackblock; #else @@ -591,9 +591,9 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp, { #ifdef NEED_SEPARATE_REGISTER_STACK char *guard = mem + (((size - guardsize) / 2) & ~pagesize_m1); -#elif _STACK_GROWS_DOWN +#elif defined _STACK_GROWS_DOWN char *guard = mem; -# elif _STACK_GROWS_UP +#elif defined _STACK_GROWS_UP char *guard = (char *) (((uintptr_t) pd - guardsize) & ~pagesize_m1); #endif if (mprotect (guard, guardsize, PROT_NONE) != 0) @@ -641,11 +641,11 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp, oldguard + pd->guardsize - guard - guardsize, prot) != 0) goto mprot_error; -#elif _STACK_GROWS_DOWN +#elif defined _STACK_GROWS_DOWN if (mprotect ((char *) mem + guardsize, pd->guardsize - guardsize, prot) != 0) goto mprot_error; -#elif _STACK_GROWS_UP +#elif defined _STACK_GROWS_UP if (mprotect ((char *) pd - pd->guardsize, pd->guardsize - guardsize, prot) != 0) goto mprot_error; @@ -688,9 +688,9 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp, #ifdef NEED_SEPARATE_REGISTER_STACK *stack = pd->stackblock; *stacksize = stacktop - *stack; -#elif _STACK_GROWS_DOWN +#elif defined _STACK_GROWS_DOWN *stack = stacktop; -#elif _STACK_GROWS_UP +#elif defined _STACK_GROWS_UP *stack = pd->stackblock; assert (*stack > 0); #endif diff --git a/libpthread/nptl/pt-cleanup.c b/libpthread/nptl/pt-cleanup.c index 97673b6c5..d7394ae44 100644 --- a/libpthread/nptl/pt-cleanup.c +++ b/libpthread/nptl/pt-cleanup.c @@ -39,13 +39,13 @@ __pthread_cleanup_upto (__jmp_buf target, char *targetframe) cbuf != NULL && _JMPBUF_UNWINDS_ADJ (target, cbuf, adj); cbuf = cbuf->__prev) { -#if _STACK_GROWS_DOWN +#ifdef _STACK_GROWS_DOWN if ((uintptr_t) cbuf - adj <= targetframe_adj) { cbuf = NULL; break; } -#elif _STACK_GROWS_UP +#elif defined _STACK_GROWS_UP if ((uintptr_t) cbuf - adj >= targetframe_adj) { cbuf = NULL; diff --git a/libpthread/nptl/unwind.c b/libpthread/nptl/unwind.c index c7e01e764..0322a6023 100644 --- a/libpthread/nptl/unwind.c +++ b/libpthread/nptl/unwind.c @@ -30,7 +30,7 @@ #ifdef _STACK_GROWS_DOWN # define FRAME_LEFT(frame, other, adj) \ ((uintptr_t) frame - adj >= (uintptr_t) other - adj) -#elif _STACK_GROWS_UP +#elif defined _STACK_GROWS_UP # define FRAME_LEFT(frame, other, adj) \ ((uintptr_t) frame - adj <= (uintptr_t) other - adj) #else -- cgit v1.2.3 From de71e42c04a7d35cf663b1c84ac1de5b6b93b052 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 19:26:30 +0100 Subject: syntax fixes Avoid compile warnings about the use of undefined constants Signed-off-by: Peter S. Mazinger --- include/ftw.h | 4 ++-- libc/misc/ftw/ftw.c | 4 ++-- libpthread/nptl/allocatestack.c | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/ftw.h b/include/ftw.h index 84f3e14a8..c79924dc8 100644 --- a/include/ftw.h +++ b/include/ftw.h @@ -129,7 +129,7 @@ typedef int (*__nftw64_func_t) (__const char *__filename, # endif #endif -#if __UCLIBC_HAS_FTW__ +#ifdef __UCLIBC_HAS_FTW__ /* Call a function on every element in a directory tree. This function is a possible cancellation point and therefore not @@ -151,7 +151,7 @@ extern int ftw64 (__const char *__dir, __ftw64_func_t __func, # endif #endif -#if __UCLIBC_HAS_NFTW__ && defined __USE_XOPEN_EXTENDED +#if defined __UCLIBC_HAS_NFTW__ && defined __USE_XOPEN_EXTENDED /* Call a function on every element in a directory tree. FLAG allows to specify the behaviour more detailed. diff --git a/libc/misc/ftw/ftw.c b/libc/misc/ftw/ftw.c index 4a62e388a..9031e3589 100644 --- a/libc/misc/ftw/ftw.c +++ b/libc/misc/ftw/ftw.c @@ -752,7 +752,7 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors, /* Entry points. */ -#if __UCLIBC_HAS_FTW__ +#ifdef __UCLIBC_HAS_FTW__ int FTW_NAME (const char *path, FTW_FUNC_T func, int descriptors) { @@ -760,7 +760,7 @@ FTW_NAME (const char *path, FTW_FUNC_T func, int descriptors) } #endif -#if __UCLIBC_HAS_NFTW__ +#ifdef __UCLIBC_HAS_NFTW__ #ifndef _LIBC int NFTW_NAME (const char *path, NFTW_FUNC_T func, int descriptors, int flags) diff --git a/libpthread/nptl/allocatestack.c b/libpthread/nptl/allocatestack.c index 6a4e252e8..e30fe41a2 100644 --- a/libpthread/nptl/allocatestack.c +++ b/libpthread/nptl/allocatestack.c @@ -122,7 +122,7 @@ static uintptr_t in_flight_stack; list_t __stack_user __attribute__ ((nocommon)); hidden_data_def (__stack_user) -#if COLORING_INCREMENT != 0 +#if defined COLORING_INCREMENT && COLORING_INCREMENT != 0 /* Number of threads created. */ static unsigned int nptl_ncreated; #endif @@ -443,7 +443,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp, void *mem = 0; const int prot = (PROT_READ | PROT_WRITE); -#if COLORING_INCREMENT != 0 +#if defined COLORING_INCREMENT && COLORING_INCREMENT != 0 /* Add one more page for stack coloring. Don't do it for stacks with 16 times pagesize or larger. This might just cause unnecessary misalignment. */ @@ -474,7 +474,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp, adjust the allocated stack size if necessary. This way allocations directly following each other will not have aliasing problems. */ -#if MULTI_PAGE_ALIASING != 0 +#if defined MULTI_PAGE_ALIASING && MULTI_PAGE_ALIASING != 0 if ((size % MULTI_PAGE_ALIASING) == 0) size += pagesize_m1 + 1; #endif @@ -494,7 +494,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp, So we can never get a null pointer back from mmap. */ assert (mem != NULL); -#if COLORING_INCREMENT != 0 +#if defined COLORING_INCREMENT && COLORING_INCREMENT != 0 /* Atomically increment NCREATED. */ unsigned int ncreated = atomic_increment_val (&nptl_ncreated); -- cgit v1.2.3 From d15e625b3c53c0059644d7b8323b49005f84fb36 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 19:28:53 +0100 Subject: style update Style update avoiding compile warnings Signed-off-by: Peter S. Mazinger --- libc/stdlib/arc4random.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/libc/stdlib/arc4random.c b/libc/stdlib/arc4random.c index 97f318a57..592c51ed5 100644 --- a/libc/stdlib/arc4random.c +++ b/libc/stdlib/arc4random.c @@ -54,8 +54,7 @@ static __inline__ uint8_t arc4_getbyte(struct arc4_stream *); static __inline__ uint32_t arc4_getword(struct arc4_stream *); static __inline__ void -arc4_init(as) - struct arc4_stream *as; +arc4_init(struct arc4_stream *as) { int n; @@ -66,10 +65,7 @@ arc4_init(as) } static __inline__ void -arc4_addrandom(as, dat, datlen) - struct arc4_stream *as; - u_char *dat; - int datlen; +arc4_addrandom(struct arc4_stream *as, u_char *dat, int datlen) { int n; uint8_t si; @@ -86,8 +82,7 @@ arc4_addrandom(as, dat, datlen) } static void -arc4_stir(as) - struct arc4_stream *as; +arc4_stir(struct arc4_stream *as) { int fd; struct { @@ -137,8 +132,7 @@ arc4_stir(as) } static __inline__ uint8_t -arc4_getbyte(as) - struct arc4_stream *as; +arc4_getbyte(struct arc4_stream *as) { uint8_t si, sj; @@ -152,8 +146,7 @@ arc4_getbyte(as) } static __inline__ uint32_t -arc4_getword(as) - struct arc4_stream *as; +arc4_getword(struct arc4_stream *as) { uint32_t val; val = arc4_getbyte(as) << 24; -- cgit v1.2.3 From 1fc68eae4846de4a1e276e68aee743ef731f3e91 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 19:31:39 +0100 Subject: add missing prototypes Add some missing prototypes Signed-off-by: Peter S. Mazinger --- include/alloca.h | 2 ++ libc/misc/pthread/tsd.c | 1 + libpthread/nptl/sysdeps/generic/dl-tls.c | 2 ++ libpthread/nptl/sysdeps/generic/libc-tls.c | 1 + libpthread/nptl/sysdeps/unix/sysv/linux/jmp-unwind.c | 1 + 5 files changed, 7 insertions(+) diff --git a/include/alloca.h b/include/alloca.h index 2565b4835..4790b300b 100644 --- a/include/alloca.h +++ b/include/alloca.h @@ -67,6 +67,8 @@ extern void *alloca (size_t __size) __THROW; # define extend_alloca(buf, len, newlen) \ alloca (((len) = (newlen))) # endif + +extern int __libc_alloca_cutoff (size_t size); #endif __END_DECLS diff --git a/libc/misc/pthread/tsd.c b/libc/misc/pthread/tsd.c index 835ee22ce..0c222e8e9 100644 --- a/libc/misc/pthread/tsd.c +++ b/libc/misc/pthread/tsd.c @@ -2,6 +2,7 @@ We define it here instead of in libpthread so t here instead of in libpthread so that it doesn't need to have a TLS segment of its own just for this one pointer. */ +void **__libc_dl_error_tsd(void) __attribute__ ((const)); void ** __attribute__ ((const)) __libc_dl_error_tsd (void) { diff --git a/libpthread/nptl/sysdeps/generic/dl-tls.c b/libpthread/nptl/sysdeps/generic/dl-tls.c index 4acfa4ba7..904da8b8d 100644 --- a/libpthread/nptl/sysdeps/generic/dl-tls.c +++ b/libpthread/nptl/sysdeps/generic/dl-tls.c @@ -66,6 +66,7 @@ oom (void) # endif +void *_dl_memalign(size_t alignment, size_t bytes); void *_dl_memalign(size_t alignment, size_t bytes) { return _dl_malloc(bytes); @@ -836,6 +837,7 @@ __tls_get_addr (GET_ADDR_ARGS) +void _dl_add_to_slotinfo (struct link_map *l); void _dl_add_to_slotinfo (struct link_map *l) { diff --git a/libpthread/nptl/sysdeps/generic/libc-tls.c b/libpthread/nptl/sysdeps/generic/libc-tls.c index b78d96483..c45e76120 100644 --- a/libpthread/nptl/sysdeps/generic/libc-tls.c +++ b/libpthread/nptl/sysdeps/generic/libc-tls.c @@ -110,6 +110,7 @@ init_static_tls (size_t memsz, size_t align) GL(dl_tls_static_nelem) = GL(dl_tls_max_dtv_idx); } +void __libc_setup_tls (size_t tcbsize, size_t tcbalign); void __libc_setup_tls (size_t tcbsize, size_t tcbalign) { diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/jmp-unwind.c b/libpthread/nptl/sysdeps/unix/sysv/linux/jmp-unwind.c index f2795510a..642198bad 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/jmp-unwind.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/jmp-unwind.c @@ -25,6 +25,7 @@ extern void __pthread_cleanup_upto (__jmp_buf env, char *targetframe); #pragma weak __pthread_cleanup_upto +void _longjmp_unwind (jmp_buf env, int val); void _longjmp_unwind (jmp_buf env, int val) { -- cgit v1.2.3 From 380b5c5b31bdbf5e171ce035009e5e53b0ea230d Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 19:33:21 +0100 Subject: use common sigthread.h NPTL build did not use the correct bits/sigthread.h, use a common version avoiding this. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/bits/sigthread.h | 8 ++++- libpthread/nptl/sysdeps/pthread/bits/sigthread.h | 44 ------------------------ 2 files changed, 7 insertions(+), 45 deletions(-) diff --git a/libc/sysdeps/linux/common/bits/sigthread.h b/libc/sysdeps/linux/common/bits/sigthread.h index 960bde18a..4f14b9f45 100644 --- a/libc/sysdeps/linux/common/bits/sigthread.h +++ b/libc/sysdeps/linux/common/bits/sigthread.h @@ -1,5 +1,5 @@ /* Signal handling function for threaded programs. - Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2002, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -35,4 +35,10 @@ extern int pthread_sigmask (int __how, /* Send signal SIGNO to the given thread. */ extern int pthread_kill (pthread_t __threadid, int __signo) __THROW; +#if defined __USE_GNU && defined __UCLIBC_HAS_THREADS_NATIVE__ +/* Queue signal and data to a thread. */ +extern int pthread_sigqueue (pthread_t __threadid, int __signo, + const union sigval __value) __THROW; +#endif + #endif /* bits/sigthread.h */ diff --git a/libpthread/nptl/sysdeps/pthread/bits/sigthread.h b/libpthread/nptl/sysdeps/pthread/bits/sigthread.h index 9a524e57d..e69de29bb 100644 --- a/libpthread/nptl/sysdeps/pthread/bits/sigthread.h +++ b/libpthread/nptl/sysdeps/pthread/bits/sigthread.h @@ -1,44 +0,0 @@ -/* Signal handling function for threaded programs. - Copyright (C) 1998, 1999, 2000, 2002, 2009 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 2.1 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _BITS_SIGTHREAD_H -#define _BITS_SIGTHREAD_H 1 - -#if !defined _SIGNAL_H && !defined _PTHREAD_H -# error "Never include this file directly. Use instead" -#endif - -/* Functions for handling signals. */ - -/* Modify the signal mask for the calling thread. The arguments have - the same meaning as for sigprocmask(2). */ -extern int pthread_sigmask (int __how, - __const __sigset_t *__restrict __newmask, - __sigset_t *__restrict __oldmask)__THROW; - -/* Send signal SIGNO to the given thread. */ -extern int pthread_kill (pthread_t __threadid, int __signo) __THROW; - -#ifdef __USE_GNU -/* Queue signal and data to a thread. */ -extern int pthread_sigqueue (pthread_t __threadid, int __signo, - const union sigval __value) __THROW; -#endif - -#endif /* bits/sigthread.h */ -- cgit v1.2.3 From f00e553e4b084007781df5e4b5accc2e152da231 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 19:41:29 +0100 Subject: add missing prototypes Add some missing prototypes Signed-off-by: Peter S. Mazinger --- include/signal.h | 6 ++++++ libc/misc/internals/__uClibc_main.c | 7 +++++-- libc/sysdeps/linux/common/longjmp.c | 4 ++++ libpthread/nptl/init.c | 1 + libpthread/nptl/pthreadP.h | 16 ++++++++++++++-- libpthread/nptl/sysdeps/generic/libc-tls.c | 1 + libpthread/nptl/unwind.c | 3 +++ 7 files changed, 34 insertions(+), 4 deletions(-) diff --git a/include/signal.h b/include/signal.h index 0a09c7ad4..80e4edee0 100644 --- a/include/signal.h +++ b/include/signal.h @@ -310,6 +310,9 @@ extern int sigwait (__const sigset_t *__restrict __set, int *__restrict __sig) __THROW. */ extern int sigwaitinfo (__const sigset_t *__restrict __set, siginfo_t *__restrict __info) __nonnull ((1)); +#ifdef _LIBC +extern __typeof(sigwaitinfo) __sigwaitinfo attribute_hidden; +#endif libc_hidden_proto(sigwaitinfo) /* Select any of pending signals from SET and place information in INFO. @@ -321,6 +324,9 @@ extern int sigtimedwait (__const sigset_t *__restrict __set, siginfo_t *__restrict __info, __const struct timespec *__restrict __timeout) __nonnull ((1)); +#ifdef _LIBC +extern __typeof(sigtimedwait) __sigtimedwait attribute_hidden; +#endif libc_hidden_proto(sigtimedwait) /* Send signal SIG to the process PID. Associate data in VAL with the diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index 58f6643b2..da29ef69e 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -313,6 +313,11 @@ void __uClibc_fini(void) } libc_hidden_def(__uClibc_fini) +#ifndef SHARED +extern void __nptl_deallocate_tsd (void) __attribute ((weak)); +extern unsigned int __nptl_nthreads __attribute ((weak)); +#endif + /* __uClibc_main is the new main stub for uClibc. This function is * called from crt1 (version 0.9.28 or newer), after ALL shared libraries * are initialized, just before we call the application's main function. @@ -481,7 +486,6 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc, # ifdef SHARED __libc_pthread_functions.ptr__nptl_deallocate_tsd (); # else - extern void __nptl_deallocate_tsd (void) __attribute ((weak)); __nptl_deallocate_tsd (); # endif @@ -491,7 +495,6 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc, # ifdef SHARED unsigned int *const ptr = __libc_pthread_functions.ptr_nthreads; # else - extern unsigned int __nptl_nthreads __attribute ((weak)); unsigned int *const ptr = &__nptl_nthreads; # endif diff --git a/libc/sysdeps/linux/common/longjmp.c b/libc/sysdeps/linux/common/longjmp.c index 4d1442414..b07eced6a 100644 --- a/libc/sysdeps/linux/common/longjmp.c +++ b/libc/sysdeps/linux/common/longjmp.c @@ -24,6 +24,10 @@ extern void __longjmp (__jmp_buf __env, int __val) attribute_noreturn; libc_hidden_proto(__longjmp) +#if 0 +extern void _longjmp_unwind (jmp_buf env, int val); +#endif + extern __typeof(longjmp) __libc_longjmp attribute_noreturn; /* Set the signal mask to the one specified in ENV, and jump to the position specified in ENV, causing the setjmp diff --git a/libpthread/nptl/init.c b/libpthread/nptl/init.c index 911293a65..c8ca09637 100644 --- a/libpthread/nptl/init.c +++ b/libpthread/nptl/init.c @@ -257,6 +257,7 @@ extern void **__libc_dl_error_tsd (void) __attribute__ ((const)); /* This can be set by the debugger before initialization is complete. */ static bool __nptl_initial_report_events __attribute_used__; +void __pthread_initialize_minimal_internal (void) attribute_hidden; void __pthread_initialize_minimal_internal (void) { diff --git a/libpthread/nptl/pthreadP.h b/libpthread/nptl/pthreadP.h index fbac7d08f..fb354eaa3 100644 --- a/libpthread/nptl/pthreadP.h +++ b/libpthread/nptl/pthreadP.h @@ -179,7 +179,13 @@ extern struct pthread_key_struct __pthread_keys[PTHREAD_KEYS_MAX]; hidden_proto (__pthread_keys) /* Number of threads running. */ -extern unsigned int __nptl_nthreads attribute_hidden; +extern unsigned int __nptl_nthreads +#ifdef SHARED + attribute_hidden +#else + __attribute ((weak)) +#endif + ; #ifndef __ASSUME_SET_ROBUST_LIST /* Negative if we do not have the system call and we can use it. */ @@ -563,7 +569,13 @@ extern void _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer, extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer, int execute); -extern void __nptl_deallocate_tsd (void) attribute_hidden; +extern void __nptl_deallocate_tsd (void) +#ifdef SHARED + attribute_hidden +#else + __attribute ((weak)) +#endif + ; extern int __nptl_setxid (struct xid_command *cmdp) attribute_hidden; diff --git a/libpthread/nptl/sysdeps/generic/libc-tls.c b/libpthread/nptl/sysdeps/generic/libc-tls.c index c45e76120..e14fc26c6 100644 --- a/libpthread/nptl/sysdeps/generic/libc-tls.c +++ b/libpthread/nptl/sysdeps/generic/libc-tls.c @@ -242,6 +242,7 @@ _dl_tls_setup (void) return 0; } +extern void __pthread_initialize_minimal(void) __attribute__((weak)); /* This is the minimal initialization function used when libpthread is not used. */ diff --git a/libpthread/nptl/unwind.c b/libpthread/nptl/unwind.c index 0322a6023..8f60ae410 100644 --- a/libpthread/nptl/unwind.c +++ b/libpthread/nptl/unwind.c @@ -117,6 +117,9 @@ unwind_cleanup (_Unwind_Reason_Code reason, struct _Unwind_Exception *exc) void attribute_protected __cleanup_fct_attribute __attribute ((noreturn)) +#if !defined SHARED && !defined IS_IN_LIBPTHREAD +weak_function +#endif __pthread_unwind (__pthread_unwind_buf_t *buf) { struct pthread_unwind_buf *ibuf = (struct pthread_unwind_buf *) buf; -- cgit v1.2.3 From 2e9d2266c0cea250f7a87dc6aa2b02d0bd5a0aea Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 21:49:38 +0100 Subject: Correct ssp code Avoid using strong_alias in ssp, some archs dislike it. Make stack_chk_guard static. Export __stack_smash_handler only if compatibility option is enabled. Signed-off-by: Peter S. Mazinger --- ldso/ldso/ldso.c | 14 ++++++-------- libc/misc/internals/__uClibc_main.c | 25 +++++++------------------ libc/sysdeps/linux/common/ssp.c | 3 ++- 3 files changed, 15 insertions(+), 27 deletions(-) diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index 89af5a505..4d79d4665 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -102,15 +102,13 @@ extern void _start(void); #ifdef __UCLIBC_HAS_SSP__ # include -uintptr_t stack_chk_guard; +static uintptr_t stack_chk_guard; # ifndef THREAD_SET_STACK_GUARD /* Only exported for architectures that don't store the stack guard canary * in local thread area. */ uintptr_t __stack_chk_guard attribute_relro; -# ifdef __UCLIBC_HAS_SSP_COMPAT__ -strong_alias(__stack_chk_guard,__guard) -# endif -# elif defined __UCLIBC_HAS_SSP_COMPAT__ +# endif +# ifdef __UCLIBC_HAS_SSP_COMPAT__ uintptr_t __guard attribute_relro; # endif #endif @@ -944,12 +942,12 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, stack_chk_guard = _dl_setup_stack_chk_guard (); # ifdef THREAD_SET_STACK_GUARD THREAD_SET_STACK_GUARD (stack_chk_guard); -# ifdef __UCLIBC_HAS_SSP_COMPAT__ - __guard = stack_chk_guard; -# endif # else __stack_chk_guard = stack_chk_guard; # endif +# ifdef __UCLIBC_HAS_SSP_COMPAT__ + __guard = stack_chk_guard; +# endif #endif diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index da29ef69e..315365a25 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -45,22 +45,15 @@ void *__libc_stack_end = NULL; # ifdef __UCLIBC_HAS_SSP__ # include +static uintptr_t stack_chk_guard; # ifndef THREAD_SET_STACK_GUARD /* Only exported for architectures that don't store the stack guard canary * in thread local area. */ -# include -uintptr_t stack_chk_guard; /* for gcc-4.1 non-TLS */ uintptr_t __stack_chk_guard attribute_relro; +# endif /* for gcc-3.x + Etoh ssp */ -# ifdef __UCLIBC_HAS_SSP_COMPAT__ -# ifdef __HAVE_SHARED__ -strong_alias(__stack_chk_guard,__guard) -# else -uintptr_t __guard attribute_relro; -# endif -# endif -# elif defined __UCLIBC_HAS_SSP_COMPAT__ +# ifdef __UCLIBC_HAS_SSP_COMPAT__ uintptr_t __guard attribute_relro; # endif # endif @@ -251,18 +244,14 @@ void __uClibc_init(void) #ifndef SHARED # ifdef __UCLIBC_HAS_SSP__ /* Set up the stack checker's canary. */ + stack_chk_guard = _dl_setup_stack_chk_guard(); # ifdef THREAD_SET_STACK_GUARD - uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard(); THREAD_SET_STACK_GUARD (stack_chk_guard); -# ifdef __UCLIBC_HAS_SSP_COMPAT__ - stack_chk_guard = _dl_setup_stack_chk_guard(); - __guard = stack_chk_guard; -# endif # else __stack_chk_guard = stack_chk_guard; -# if !defined __HAVE_SHARED__ && defined __UCLIBC_HAS_SSP_COMPAT__ - __guard = stack_chk_guard; -# endif +# endif +# ifdef __UCLIBC_HAS_SSP_COMPAT__ + __guard = stack_chk_guard; # endif # endif #endif diff --git a/libc/sysdeps/linux/common/ssp.c b/libc/sysdeps/linux/common/ssp.c index a2d7ff2ca..d81c706f4 100644 --- a/libc/sysdeps/linux/common/ssp.c +++ b/libc/sysdeps/linux/common/ssp.c @@ -71,6 +71,7 @@ static attribute_noreturn void terminate(void) _exit(127); } +#ifdef __UCLIBC_HAS_SSP_COMPAT__ void __stack_smash_handler(char func[], int damaged __attribute__ ((unused))) attribute_noreturn __cold; void __stack_smash_handler(char func[], int damaged) { @@ -84,6 +85,7 @@ void __stack_smash_handler(char func[], int damaged) while(1) terminate(); } +#endif void __stack_chk_fail(void) attribute_noreturn __cold; void __stack_chk_fail(void) @@ -114,4 +116,3 @@ void __chk_fail(void) while(1) terminate(); } - -- cgit v1.2.3 From 370e40a5d94efb44d6b8adbca6fcaa1262793f0b Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 22:13:19 +0100 Subject: initialize 2 variables to get rid of compiler warning Signed-off-by: Peter S. Mazinger --- libc/misc/time/time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c index ff44892a8..096c3b6b4 100644 --- a/libc/misc/time/time.c +++ b/libc/misc/time/time.c @@ -1013,7 +1013,7 @@ size_t __XL_NPP(strftime)(char *__restrict s, size_t maxsize, const char *stack[MAX_PUSH]; size_t count; size_t o_count; - int field_val, i, j, lvl; + int field_val = 0, i = 0, j, lvl; int x[3]; /* wday, yday, year */ int isofm, days; char buf[__UIM_BUFLEN_LONG]; -- cgit v1.2.3 From 5ecbf1730329be5e04229fb1ea23f4bc0bc3d2a3 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sun, 27 Feb 2011 00:20:58 +0100 Subject: fix stubs We use enosys_stub only in this file so make it static Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/stubs.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c index dd4a384f8..8688e98a1 100644 --- a/libc/sysdeps/linux/common/stubs.c +++ b/libc/sysdeps/linux/common/stubs.c @@ -11,15 +11,11 @@ #ifdef __UCLIBC_HAS_STUBS__ -attribute_hidden int enosys_stub(void); -libc_hidden_proto(enosys_stub) - -attribute_hidden int enosys_stub(void) +static int enosys_stub(void) { __set_errno(ENOSYS); return -1; } -libc_hidden_def(enosys_stub) #define make_stub(stub) \ link_warning(stub, #stub ": this function is not implemented") \ -- cgit v1.2.3 From 45dafbdb4e221f600895aa70a69e2e306093bd90 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sun, 27 Feb 2011 00:25:56 +0100 Subject: fix dependency on ADVANCED_REALTIME Do not depend on ADVANCED REALTIME for mq_send/mq_receive Added stubs implementation based on libc's stubs.c Signed-off-by: Peter S. Mazinger --- librt/mq_receive.c | 34 ++++++++++++++++++---------------- librt/mq_send.c | 35 ++++++++++++++++++----------------- librt/rt_stubs.c | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 33 deletions(-) create mode 100644 librt/rt_stubs.c diff --git a/librt/mq_receive.c b/librt/mq_receive.c index 40447dfb9..26fc45194 100644 --- a/librt/mq_receive.c +++ b/librt/mq_receive.c @@ -2,22 +2,23 @@ * mq_receive.c - functions for receiving from message queue. */ -#include -#include #include + +#ifdef __NR_mq_timedreceive + +#include #include -#warning FIXME: hard dependency on ADVANCED REALTIME feature +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ librt_hidden_proto(mq_timedreceive) +#else -#ifndef __UCLIBC_HAS_THREADS_NATIVE__ -#ifdef __NR_mq_timedreceive -#define __NR___syscall_mq_timedreceive __NR_mq_timedreceive -static __inline__ _syscall5(int, __syscall_mq_timedreceive, int, mqdes, - char *, msg_ptr, size_t, msg_len, unsigned int *, - msg_prio, const void *, abs_timeout); -#endif +# define __NR___syscall_mq_timedreceive __NR_mq_timedreceive +static _syscall5(int, __syscall_mq_timedreceive, int, mqdes, + char *, msg_ptr, size_t, msg_len, unsigned int *, + msg_prio, const void *, abs_timeout); +# ifdef __UCLIBC_HAS_ADVANCED_REALTIME__ /* * Receive the oldest from highest priority messages. * Stop waiting if abs_timeout expires. @@ -26,21 +27,22 @@ ssize_t mq_timedreceive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned int *msg_prio, const struct timespec *abs_timeout) { -#ifdef __NR_mq_timedreceive return __syscall_mq_timedreceive(mqdes, msg_ptr, msg_len, msg_prio, abs_timeout); -#else - errno = ENOSYS; - return -1; -#endif } +# endif -librt_hidden_def(mq_timedreceive) #endif /* Receive the oldest from highest priority messages */ ssize_t mq_receive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned int *msg_prio) { +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ return mq_timedreceive(mqdes, msg_ptr, msg_len, msg_prio, NULL); +#else + return __syscall_mq_timedreceive(mqdes, msg_ptr, msg_len, msg_prio, NULL); +#endif } + +#endif diff --git a/librt/mq_send.c b/librt/mq_send.c index f0fcfa35a..78308d8d9 100644 --- a/librt/mq_send.c +++ b/librt/mq_send.c @@ -2,22 +2,23 @@ * mq_send.c - functions for sending to message queue. */ -#include -#include #include + +#ifdef __NR_mq_timedsend + +#include #include -#warning FIXME: hard dependency on ADVANCED REALTIME feature +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ librt_hidden_proto(mq_timedsend) +#else -#ifndef __UCLIBC_HAS_THREADS_NATIVE__ -#ifdef __NR_mq_timedsend -#define __NR___syscall_mq_timedsend __NR_mq_timedsend -static __inline__ _syscall5(int, __syscall_mq_timedsend, int, mqdes, - const char *, msg_ptr, size_t, msg_len, unsigned int, - msg_prio, const void *, abs_timeout); -#endif +# define __NR___syscall_mq_timedsend __NR_mq_timedsend +static _syscall5(int, __syscall_mq_timedsend, int, mqdes, + const char *, msg_ptr, size_t, msg_len, unsigned int, + msg_prio, const void *, abs_timeout); +# ifdef __UCLIBC_HAS_ADVANCED_REALTIME__ /* * Add a message to queue. If O_NONBLOCK is set and queue is full, wait * for sufficient room in the queue until abs_timeout expires. @@ -25,21 +26,21 @@ static __inline__ _syscall5(int, __syscall_mq_timedsend, int, mqdes, int mq_timedsend(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout) { -#ifdef __NR_mq_timedsend return __syscall_mq_timedsend(mqdes, msg_ptr, msg_len, msg_prio, abs_timeout); -#else - errno = ENOSYS; - return -1; -#endif } - -librt_hidden_def(mq_timedsend) +# endif #endif /* Add a message to queue */ int mq_send(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned int msg_prio) { +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ return mq_timedsend(mqdes, msg_ptr, msg_len, msg_prio, NULL); +#else + return __syscall_mq_timedsend(mqdes, msg_ptr, msg_len, msg_prio, NULL); +#endif } + +#endif diff --git a/librt/rt_stubs.c b/librt/rt_stubs.c new file mode 100644 index 000000000..b2c09dea9 --- /dev/null +++ b/librt/rt_stubs.c @@ -0,0 +1,39 @@ +/* + * system call not available stub + * based on libc's stubs.c + * + * Copyright (C) 2009 Analog Devices Inc. + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include +#include + +#ifdef __UCLIBC_HAS_STUBS__ + +static int rt_enosys_stub(void) +{ + __set_errno(ENOSYS); + return -1; +} + +#define make_stub(stub) \ + link_warning(stub, #stub ": this function is not implemented") \ + strong_alias(rt_enosys_stub, stub) + +#ifndef __NR_mq_timedreceive +make_stub(mq_receive) +# ifdef __UCLIBC_HAS_ADVANCED_REALTIME__ +make_stub(mq_timedreceive) +# endif +#endif + +#ifndef __NR_mq_timedsend +make_stub(mq_send) +# ifdef __UCLIBC_HAS_ADVANCED_REALTIME__ +make_stub(mq_timedsend) +# endif +#endif + +#endif -- cgit v1.2.3 From 83c1854b97d79e2b67065b1a2651b0d11d8a8f6b Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 2 Mar 2011 15:06:51 +0100 Subject: remove error handling from some syscalls Remove error handling from getegid/getgid/geteuid/getuid/getppid/getpid/getpgrp Use strong_alias if fallbacks are needed Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/bits/syscalls-common.h | 1 + libc/sysdeps/linux/common/getegid.c | 22 +++++----------------- libc/sysdeps/linux/common/geteuid.c | 21 ++++----------------- libc/sysdeps/linux/common/getgid.c | 8 ++++++-- libc/sysdeps/linux/common/getpgrp.c | 2 +- libc/sysdeps/linux/common/getpid.c | 12 +++++++----- libc/sysdeps/linux/common/getppid.c | 8 ++------ libc/sysdeps/linux/common/getuid.c | 8 ++++++-- libc/sysdeps/linux/common/umask.c | 2 +- 9 files changed, 33 insertions(+), 51 deletions(-) diff --git a/libc/sysdeps/linux/common/bits/syscalls-common.h b/libc/sysdeps/linux/common/bits/syscalls-common.h index 5e4e350c5..1b84d9e2b 100644 --- a/libc/sysdeps/linux/common/bits/syscalls-common.h +++ b/libc/sysdeps/linux/common/bits/syscalls-common.h @@ -97,6 +97,7 @@ type name(C_DECL_ARGS_##nargs(args)) { \ } #define _syscall0(args...) SYSCALL_FUNC(0, args) +#define _syscall_noerr0(args...) SYSCALL_NOERR_FUNC(0, args) #define _syscall1(args...) SYSCALL_FUNC(1, args) #define _syscall_noerr1(args...) SYSCALL_NOERR_FUNC(1, args) #define _syscall2(args...) SYSCALL_FUNC(2, args) diff --git a/libc/sysdeps/linux/common/getegid.c b/libc/sysdeps/linux/common/getegid.c index f2b6401cf..80a8ac9bb 100644 --- a/libc/sysdeps/linux/common/getegid.c +++ b/libc/sysdeps/linux/common/getegid.c @@ -10,24 +10,12 @@ #include #include - -#if defined(__NR_getegid32) +#ifdef __NR_getegid32 # undef __NR_getegid # define __NR_getegid __NR_getegid32 -_syscall0(gid_t, getegid) - -#elif defined(__NR_getegid) -# define __NR___syscall_getegid __NR_getegid -static __inline__ _syscall0(int, __syscall_getegid) -gid_t getegid(void) -{ - return (__syscall_getegid()); -} -#else - -gid_t getegid(void) -{ - return (getgid()); -} #endif + +#ifdef __NR_getegid +_syscall_noerr0(gid_t, getegid) libc_hidden_def(getegid) +#endif diff --git a/libc/sysdeps/linux/common/geteuid.c b/libc/sysdeps/linux/common/geteuid.c index 6111e5d1b..610fbc170 100644 --- a/libc/sysdeps/linux/common/geteuid.c +++ b/libc/sysdeps/linux/common/geteuid.c @@ -10,25 +10,12 @@ #include #include - -#if defined(__NR_geteuid32) +#ifdef __NR_geteuid32 # undef __NR_geteuid # define __NR_geteuid __NR_geteuid32 -_syscall0(uid_t, geteuid) - -#elif defined(__NR_geteuid) -# define __NR___syscall_geteuid __NR_geteuid -static __inline__ _syscall0(int, __syscall_geteuid) -uid_t geteuid(void) -{ - return (__syscall_geteuid()); -} - -#else -uid_t geteuid(void) -{ - return (getuid()); -} #endif +#ifdef __NR_geteuid +_syscall_noerr0(uid_t, geteuid) libc_hidden_def(geteuid) +#endif diff --git a/libc/sysdeps/linux/common/getgid.c b/libc/sysdeps/linux/common/getgid.c index 80c60034e..ccfbfc067 100644 --- a/libc/sysdeps/linux/common/getgid.c +++ b/libc/sysdeps/linux/common/getgid.c @@ -10,7 +10,7 @@ #include #include -#if defined __NR_getxgid +#ifdef __NR_getxgid # undef __NR_getgid # define __NR_getgid __NR_getxgid #endif @@ -19,5 +19,9 @@ # define __NR_getgid __NR_getgid32 #endif -_syscall0(gid_t, getgid) +_syscall_noerr0(gid_t, getgid) libc_hidden_def(getgid) +#if !defined __NR_getegid32 && !defined __NR_getegid +strong_alias(getgid,getegid) +libc_hidden_def(getegid) +#endif diff --git a/libc/sysdeps/linux/common/getpgrp.c b/libc/sysdeps/linux/common/getpgrp.c index 80a53daee..0af9dc499 100644 --- a/libc/sysdeps/linux/common/getpgrp.c +++ b/libc/sysdeps/linux/common/getpgrp.c @@ -12,7 +12,7 @@ #ifdef __NR_getpgrp /* According to the manpage the POSIX.1 version is favoured */ -_syscall0(pid_t, getpgrp) +_syscall_noerr0(pid_t, getpgrp) #elif defined __NR_getpgid && (defined __NR_getpid || defined __NR_getxpid) /* IA64 doesn't have a getpgrp syscall */ pid_t getpgrp(void) diff --git a/libc/sysdeps/linux/common/getpid.c b/libc/sysdeps/linux/common/getpid.c index 8041022e7..d9a69084f 100644 --- a/libc/sysdeps/linux/common/getpid.c +++ b/libc/sysdeps/linux/common/getpid.c @@ -10,11 +10,13 @@ #include #include -extern __typeof(getpid) __libc_getpid; -#if defined __NR_getxpid +#ifdef __NR_getxpid +# undef __NR_getpid # define __NR_getpid __NR_getxpid #endif -#define __NR___libc_getpid __NR_getpid -_syscall0(pid_t, __libc_getpid) -weak_alias(__libc_getpid, getpid) + +_syscall_noerr0(pid_t, getpid) libc_hidden_weak(getpid) +#ifndef __NR_getppid +strong_alias(getpid,getppid) +#endif diff --git a/libc/sysdeps/linux/common/getppid.c b/libc/sysdeps/linux/common/getppid.c index 4f2b0e933..9d85661d9 100644 --- a/libc/sysdeps/linux/common/getppid.c +++ b/libc/sysdeps/linux/common/getppid.c @@ -9,11 +9,7 @@ #include #include + #ifdef __NR_getppid -_syscall0(pid_t, getppid) -#else -pid_t getppid(void) -{ - return getpid(); -} +_syscall_noerr0(pid_t, getppid) #endif diff --git a/libc/sysdeps/linux/common/getuid.c b/libc/sysdeps/linux/common/getuid.c index b6f813a06..f921acb2e 100644 --- a/libc/sysdeps/linux/common/getuid.c +++ b/libc/sysdeps/linux/common/getuid.c @@ -10,7 +10,7 @@ #include #include -#if defined __NR_getxuid +#ifdef __NR_getxuid # undef __NR_getuid # define __NR_getuid __NR_getxuid #endif @@ -19,5 +19,9 @@ # define __NR_getuid __NR_getuid32 #endif -_syscall0(uid_t, getuid) +_syscall_noerr0(uid_t, getuid) libc_hidden_def(getuid) +#if !defined __NR_geteuid32 && !defined __NR_geteuid +strong_alias(getuid,geteuid) +libc_hidden_def(geteuid) +#endif diff --git a/libc/sysdeps/linux/common/umask.c b/libc/sysdeps/linux/common/umask.c index ef9860e31..b838e1731 100644 --- a/libc/sysdeps/linux/common/umask.c +++ b/libc/sysdeps/linux/common/umask.c @@ -15,5 +15,5 @@ static __inline__ _syscall1(__kernel_mode_t, __syscall_umask, __kernel_mode_t, m mode_t umask(mode_t mode) { - return (__syscall_umask(mode)); + return __syscall_umask(mode); } -- cgit v1.2.3 From 8116ca7baec0ff8c9bc35a2920aa36549e6004a4 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 2 Mar 2011 15:31:00 +0100 Subject: make parse_printf_format() depend on UCLIBC_HAS_GLIBC_CUSTOM_PRINTF we already remove the printf.h header if this option is disabled Signed-off-by: Peter S. Mazinger --- extra/Configs/Config.in | 1 + libc/stdio/_vfprintf.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in index 15da168d5..4d2c870bd 100644 --- a/extra/Configs/Config.in +++ b/extra/Configs/Config.in @@ -1499,6 +1499,7 @@ config UCLIBC_HAS_GLIBC_CUSTOM_PRINTF help Answer Y to support glibc's register_printf_function() to allow an application to add its own printf conversion specifiers. + parse_printf_format() is also enabled. NOTE: Limits the number or registered specifiers to 10. NOTE: Requires new conversion specifiers to be ASCII diff --git a/libc/stdio/_vfprintf.c b/libc/stdio/_vfprintf.c index fa5dc44fc..3db8cdf67 100644 --- a/libc/stdio/_vfprintf.c +++ b/libc/stdio/_vfprintf.c @@ -417,6 +417,8 @@ extern uintmax_t _load_inttype(int desttype, const void *src, int uflag) attribu /**********************************************************************/ #ifdef L_parse_printf_format +#ifdef __UCLIBC_HAS_GLIBC_CUSTOM_PRINTF__ + /* NOTE: This function differs from the glibc version in that parsing stops * upon encountering an invalid conversion specifier. Since this is the way * my printf functions work, I think it makes sense to do it that way here. @@ -484,6 +486,8 @@ size_t parse_printf_format(register const char *template, return count; } +#endif + #endif /**********************************************************************/ #ifdef L__ppfs_init -- cgit v1.2.3 From 5e22e71adfef5ad46119cea98fccf4ae998ad0d8 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 2 Mar 2011 21:59:58 +0100 Subject: remove ucontext.h and guard sigstack structure with SUSV4_LEGACY and STRICT_HEADERS Remove ucontext.h if SUSV4_LEGACY is not set and fix it's references. Guard sigstack structure with SUSV4_LEGACY and STRICT_HEADERS. Disable sigstack function prototype, it is not provided by uClibc. Signed-off-by: Peter S. Mazinger --- Makefile.in | 4 +--- include/signal.h | 5 ++++- libc/sysdeps/linux/alpha/bits/sigstack.h | 2 ++ libc/sysdeps/linux/common/bits/sigstack.h | 2 ++ libc/sysdeps/linux/ia64/bits/sigstack.h | 2 ++ libc/sysdeps/linux/mips/bits/sigstack.h | 2 ++ libc/sysdeps/linux/sparc/bits/sigstack.h | 2 ++ libpthread/linuxthreads.old/signals.c | 1 - libpthread/linuxthreads/signals.c | 1 - 9 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Makefile.in b/Makefile.in index 6cb20342f..4d232b47c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -276,9 +276,7 @@ HEADERS_RM-$(UCLIBC_LINUX_SPECIFIC) += sys/fsuid.h sys/inotify.h sys/pe HEADERS_RM-$(UCLIBC_SUPPORT_AI_ADDRCONFIG) += ifaddrs.h HEADERS_RM-$(UCLIBC_SV4_DEPRECATED) += ustat.h sys/ustat.h bits/ustat.h HEADERS_RM-$(UCLIBC_SUSV3_LEGACY) += sys/timeb.h regexp.h -HEADERS_RM-$(UCLIBC_SUSV4_LEGACY) += utime.h - # BREAKAGE: include/signal.h uses it, this rm broke bbox compile: - ### ucontext.h +HEADERS_RM-$(UCLIBC_SUSV4_LEGACY) += utime.h ucontext.h ifneq ($(findstring install,$(MAKECMDGOALS)),) $(addprefix $(PREFIX)$(DEVEL_PREFIX),/include $(MULTILIB_DIR)): diff --git a/include/signal.h b/include/signal.h index 80e4edee0..37ed29780 100644 --- a/include/signal.h +++ b/include/signal.h @@ -392,14 +392,17 @@ extern int siginterrupt (int __sig, int __interrupt) __THROW; # include # ifdef __USE_XOPEN /* This will define `ucontext_t' and `mcontext_t'. */ -# include +/* SuSv4 obsoleted include/ucontext.h */ +# include # endif +# if 0 /* Run signals handlers on the stack specified by SS (if not NULL). If OSS is not NULL, it is filled in with the old signal stack status. This interface is obsolete and on many platform not implemented. */ extern int sigstack (struct sigstack *__ss, struct sigstack *__oss) __THROW __attribute_deprecated__; +# endif /* Alternate signal handler stack interface. This interface should always be preferred over `sigstack'. */ diff --git a/libc/sysdeps/linux/alpha/bits/sigstack.h b/libc/sysdeps/linux/alpha/bits/sigstack.h index 7faaf98d5..e9fbc6d6f 100644 --- a/libc/sysdeps/linux/alpha/bits/sigstack.h +++ b/libc/sysdeps/linux/alpha/bits/sigstack.h @@ -22,12 +22,14 @@ #endif +#if defined __UCLIBC_SUSV4_LEGACY__ || !defined __UCLIBC_STRICT_HEADERS__ /* Structure describing a signal stack (obsolete). */ struct sigstack { __ptr_t ss_sp; /* Signal stack pointer. */ int ss_onstack; /* Nonzero if executing on this stack. */ }; +#endif /* Possible values for `ss_flags.'. */ diff --git a/libc/sysdeps/linux/common/bits/sigstack.h b/libc/sysdeps/linux/common/bits/sigstack.h index 7f260367b..2b3b321bd 100644 --- a/libc/sysdeps/linux/common/bits/sigstack.h +++ b/libc/sysdeps/linux/common/bits/sigstack.h @@ -22,12 +22,14 @@ #endif +#if defined __UCLIBC_SUSV4_LEGACY__ || !defined __UCLIBC_STRICT_HEADERS__ /* Structure describing a signal stack (obsolete). */ struct sigstack { void *ss_sp; /* Signal stack pointer. */ int ss_onstack; /* Nonzero if executing on this stack. */ }; +#endif /* Possible values for `ss_flags.'. */ diff --git a/libc/sysdeps/linux/ia64/bits/sigstack.h b/libc/sysdeps/linux/ia64/bits/sigstack.h index c9c9d2fed..ea27a77bc 100644 --- a/libc/sysdeps/linux/ia64/bits/sigstack.h +++ b/libc/sysdeps/linux/ia64/bits/sigstack.h @@ -24,12 +24,14 @@ #ifndef _SIGSTACK_H #define _SIGSTACK_H 1 +#if defined __UCLIBC_SUSV4_LEGACY__ || !defined __UCLIBC_STRICT_HEADERS__ /* Structure describing a signal stack (obsolete). */ struct sigstack { __ptr_t ss_sp; /* Signal stack pointer. */ int ss_onstack; /* Nonzero if executing on this stack. */ }; +#endif /* Possible values for `ss_flags.'. */ diff --git a/libc/sysdeps/linux/mips/bits/sigstack.h b/libc/sysdeps/linux/mips/bits/sigstack.h index d2c855220..64643d1c5 100644 --- a/libc/sysdeps/linux/mips/bits/sigstack.h +++ b/libc/sysdeps/linux/mips/bits/sigstack.h @@ -22,12 +22,14 @@ #endif +#if defined __UCLIBC_SUSV4_LEGACY__ || !defined __UCLIBC_STRICT_HEADERS__ /* Structure describing a signal stack (obsolete). */ struct sigstack { void *ss_sp; /* Signal stack pointer. */ int ss_onstack; /* Nonzero if executing on this stack. */ }; +#endif /* Possible values for `ss_flags.'. */ diff --git a/libc/sysdeps/linux/sparc/bits/sigstack.h b/libc/sysdeps/linux/sparc/bits/sigstack.h index df4653949..432ec83b7 100644 --- a/libc/sysdeps/linux/sparc/bits/sigstack.h +++ b/libc/sysdeps/linux/sparc/bits/sigstack.h @@ -22,12 +22,14 @@ #endif +#if defined __UCLIBC_SUSV4_LEGACY__ || !defined __STRICT_HEADERS__ /* Structure describing a signal stack (obsolete). */ struct sigstack { void *ss_sp; /* Signal stack pointer. */ int ss_onstack; /* Nonzero if executing on this stack. */ }; +#endif /* Possible values for `ss_flags.'. */ diff --git a/libpthread/linuxthreads.old/signals.c b/libpthread/linuxthreads.old/signals.c index 2a451f3d2..23d838eb8 100644 --- a/libpthread/linuxthreads.old/signals.c +++ b/libpthread/linuxthreads.old/signals.c @@ -20,7 +20,6 @@ #include "pthread.h" #include "internals.h" #include "spinlock.h" -#include #include /* mods for uClibc: __libc_sigaction is not in any standard headers */ diff --git a/libpthread/linuxthreads/signals.c b/libpthread/linuxthreads/signals.c index 02bf1c64b..c08125579 100644 --- a/libpthread/linuxthreads/signals.c +++ b/libpthread/linuxthreads/signals.c @@ -19,7 +19,6 @@ #include "pthread.h" #include "internals.h" #include "spinlock.h" -#include /* mods for uClibc: __libc_sigaction is not in any standard headers */ extern __typeof(sigaction) __libc_sigaction; -- cgit v1.2.3 From 863b99c6dbe860ed88724294a037591ffb2cca59 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 2 Mar 2011 22:24:26 +0100 Subject: remove libc-internal.h on install Remove libc-internal.h on install, I think internal is a typo. Signed-off-by: Peter S. Mazinger --- Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index 4d232b47c..eea47aaa2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -206,7 +206,7 @@ $(top_builddir)extra/scripts/unifdef: $(top_srcdir)extra/scripts/unifdef.c # a "y" here means the feature is enabled and so we should *not* rm it. # if the option expands to nothing though, we can punt the headers. HEADERS_RM- := \ - internal \ + libc-internal.h \ dl-osinfo.h \ _lfs_64.h \ bits/uClibc_arch_features.h \ -- cgit v1.2.3 From ca8f0d9cf39e60851e17f0c6dd5f3e4f51b64f5b Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 2 Mar 2011 22:30:10 +0100 Subject: simplify guard of uClibc internals Simplify guard of uClibc internals, since _LIBC sections are removed on install. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/bits/uClibc_ctype.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/sysdeps/linux/common/bits/uClibc_ctype.h b/libc/sysdeps/linux/common/bits/uClibc_ctype.h index 3bf4e1b28..5ff281d8e 100644 --- a/libc/sysdeps/linux/common/bits/uClibc_ctype.h +++ b/libc/sysdeps/linux/common/bits/uClibc_ctype.h @@ -95,7 +95,7 @@ /**********************************************************************/ __BEGIN_DECLS -#if defined _LIBC && (defined NOT_IN_libc || defined IS_IN_libc) +#ifdef _LIBC /* These are uClibc-specific. */ # define __isdigit_char(c) ((unsigned char)((c) - '0') <= 9) # define __isdigit_int(c) ((unsigned int)((c) - '0') <= 9) -- cgit v1.2.3 From 587d7092180a5f2053906b87ea2b25b2bf6b34c6 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 2 Mar 2011 22:42:47 +0100 Subject: make it possible to compile with -std=gnu99/c99 and use extern inlines When compiled with -std=gnu99/c99 __GNUC_GNU_INLINE__ is not defined Signed-off-by: Peter S. Mazinger --- include/features.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/features.h b/include/features.h index 1d47b5660..f4d70d70f 100644 --- a/include/features.h +++ b/include/features.h @@ -433,7 +433,7 @@ uClibc was built without large file support enabled. */ #if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \ && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__ \ - && (defined __extern_inline || defined __GNUC_GNU_INLINE__) + && (defined __extern_inline || defined __GNUC_GNU_INLINE__ || defined __GNUC_STDC_INLINE__) # define __USE_EXTERN_INLINES 1 #endif -- cgit v1.2.3 From 152e66242f2af7cd26e29d59a31f8bb8479595e5 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 3 Mar 2011 00:37:29 +0100 Subject: update some headers Signed-off-by: Peter S. Mazinger --- include/langinfo.h | 7 ++++--- include/locale.h | 14 ++++++-------- include/net/if_arp.h | 4 +++- include/netinet/ether.h | 1 - include/netinet/icmp6.h | 4 ++-- include/netinet/in.h | 13 ++++++++----- include/netinet/ip.h | 38 +++++++++++++++++++++++++++++++++++++- include/netinet/udp.h | 12 +++++++++++- include/xlocale.h | 31 +++++++++---------------------- libc/misc/locale/locale.c | 1 + 10 files changed, 81 insertions(+), 44 deletions(-) diff --git a/include/langinfo.h b/include/langinfo.h index 2e2ee4ec8..c7cddc0fc 100644 --- a/include/langinfo.h +++ b/include/langinfo.h @@ -1,5 +1,5 @@ /* Access to locale-dependent parameters. - Copyright (C) 1995-2002,2003,2004,2005 Free Software Foundation, Inc. + Copyright (C) 1995-2002,2003,2004,2005,2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -352,6 +352,7 @@ enum _NL_CTYPE_TRANSLIT_IGNORE_LEN, _NL_CTYPE_TRANSLIT_IGNORE, _NL_CTYPE_MAP_TO_NONASCII, + _NL_CTYPE_NONASCII_CASE, _NL_CTYPE_EXTRA_MAP_1, _NL_CTYPE_EXTRA_MAP_2, _NL_CTYPE_EXTRA_MAP_3, @@ -620,7 +621,7 @@ extern char *nl_langinfo (nl_item __item) __THROW; libc_hidden_proto(nl_langinfo) -#if defined __USE_GNU && defined __UCLIBC_HAS_XLOCALE__ +#if defined __USE_XOPEN2K && defined __UCLIBC_HAS_XLOCALE__ /* This interface is for the extended locale model. See for more information. */ @@ -628,7 +629,7 @@ libc_hidden_proto(nl_langinfo) # include /* Just like nl_langinfo but get the information from the locale object L. */ -extern char *nl_langinfo_l (nl_item __item, __locale_t l); +extern char *nl_langinfo_l (nl_item __item, __locale_t __l); libc_hidden_proto(nl_langinfo_l) #endif diff --git a/include/locale.h b/include/locale.h index b740908f0..fa8d9e2d8 100644 --- a/include/locale.h +++ b/include/locale.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,92,95-99,2000,01,02 Free Software Foundation, Inc. +/* Copyright (C) 1991,1992,1995-2002,2007,2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -133,7 +133,7 @@ libc_hidden_proto(localeconv) __END_NAMESPACE_STD -#if defined __USE_GNU && defined __UCLIBC_HAS_LOCALE__ +#if defined __USE_XOPEN2K8 && defined __UCLIBC_HAS_LOCALE__ /* The concept of one static locale per category is not very well thought out. Many applications will need to process its data using information from several different locales. Another application is @@ -145,12 +145,13 @@ __END_NAMESPACE_STD Attention: all these functions are *not* standardized in any form. This is a proof-of-concept implementation. */ -#ifdef __UCLIBC_HAS_XLOCALE__ +#if 0 /* Get locale datatype definition. */ # include -#endif - +#else +/* POSIX 2008 makes locale_t official. */ typedef __locale_t locale_t; +#endif /* Return a reference to a data structure representing a set of locale datasets. Unlike for the CATEGORY parameter for `setlocale' the @@ -170,9 +171,6 @@ libc_hidden_proto(newlocale) # define LC_COLLATE_MASK (1 << __LC_COLLATE) # define LC_MONETARY_MASK (1 << __LC_MONETARY) # define LC_MESSAGES_MASK (1 << __LC_MESSAGES) -#ifdef L_newlocale -#warning mask defines for extra locale categories -#endif /* L_newlocale - uClibc note */ #ifdef LC_PAPER # define LC_PAPER_MASK (1 << __LC_PAPER) # define LC_NAME_MASK (1 << __LC_NAME) diff --git a/include/net/if_arp.h b/include/net/if_arp.h index 9608652ee..97cb61f62 100644 --- a/include/net/if_arp.h +++ b/include/net/if_arp.h @@ -1,5 +1,5 @@ /* Definitions for Address Resolution Protocol. - Copyright (C) 1997,1999,2001,2006 Free Software Foundation, Inc. + Copyright (C) 1997,1999,2001,2006,2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -128,6 +128,8 @@ struct arphdr #define ARPHRD_IEEE80211 801 /* IEEE 802.11. */ #define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header. */ #define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header. */ +#define ARPHRD_IEEE802154 804 /* IEEE 802.15.4 header. */ +#define ARPHRD_IEEE802154_PHY 805 /* IEEE 802.15.4 PHY header. */ #define ARPHRD_VOID 0xFFFF /* Void type, nothing is known. */ #define ARPHRD_NONE 0xFFFE /* Zero header length. */ diff --git a/include/netinet/ether.h b/include/netinet/ether.h index 2e52679fa..bd9aa982b 100644 --- a/include/netinet/ether.h +++ b/include/netinet/ether.h @@ -45,7 +45,6 @@ extern struct ether_addr *ether_aton_r (__const char *__asc, struct ether_addr *__addr) __THROW; libc_hidden_proto(ether_aton_r) - /* Map 48 bit Ethernet number ADDR to HOSTNAME. */ extern int ether_ntohost (char *__hostname, __const struct ether_addr *__addr) __THROW; diff --git a/include/netinet/icmp6.h b/include/netinet/icmp6.h index 225e49e07..8662cca8a 100644 --- a/include/netinet/icmp6.h +++ b/include/netinet/icmp6.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-1997,2000,2006 Free Software Foundation, Inc. +/* Copyright (C) 1991-1997,2000,2006,2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -339,7 +339,7 @@ struct nd_opt_home_agent_info uint8_t nd_opt_home_agent_info_type; uint8_t nd_opt_home_agent_info_len; uint16_t nd_opt_home_agent_info_reserved; - int16_t nd_opt_home_agent_info_preference; + uint16_t nd_opt_home_agent_info_preference; uint16_t nd_opt_home_agent_info_lifetime; }; diff --git a/include/netinet/in.h b/include/netinet/in.h index 235194bbe..ce5afa513 100644 --- a/include/netinet/in.h +++ b/include/netinet/in.h @@ -484,16 +484,17 @@ extern int bindresvport6 (int __sockfd, struct sockaddr_in6 *__sock_in) #define IN6_IS_ADDR_MC_GLOBAL(a) \ (IN6_IS_ADDR_MULTICAST(a) \ && ((((__const uint8_t *) (a))[1] & 0xf) == 0xe)) +#endif #ifdef __USE_GNU +# if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__ /* IPv6 packet information. */ struct in6_pktinfo { struct in6_addr ipi6_addr; /* src/dst IPv6 address */ unsigned int ipi6_ifindex; /* send/recv interface index */ }; -#endif /* IPv6 MTU information. */ struct ip6_mtuinfo @@ -501,10 +502,9 @@ struct ip6_mtuinfo struct sockaddr_in6 ip6m_addr; /* dst address including zone ID */ uint32_t ip6m_mtu; /* path MTU in host byte order */ }; -#endif -#if 0 /*def __USE_GNU*/ -#ifdef __UCLIBC_HAS_IPV6__ + +# if 0 /* Obsolete hop-by-hop and Destination Options Processing (RFC 2292). */ extern int inet6_option_space (int __nbytes) __THROW __attribute_deprecated__; @@ -552,9 +552,11 @@ extern int inet6_rth_reverse (__const void *__in, void *__out) __THROW; extern int inet6_rth_segments (__const void *__bp) __THROW; extern struct in6_addr *inet6_rth_getaddr (__const void *__bp, int __index) __THROW; -#endif +# endif +# endif +# if 0 /* Multicast source filter support. */ /* Get IPv4 source filter. */ @@ -584,6 +586,7 @@ extern int setsourcefilter (int __s, uint32_t __interface_addr, socklen_t __grouplen, uint32_t __fmode, uint32_t __numsrc, __const struct sockaddr_storage *__slist) __THROW; +# endif #endif /* use GNU */ __END_DECLS diff --git a/include/netinet/ip.h b/include/netinet/ip.h index fc9144052..38bd7556d 100644 --- a/include/netinet/ip.h +++ b/include/netinet/ip.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1991,92,93,95,96,97,98,99,2000 Free Software Foundation, Inc. +/* Copyright (C) 1991,92,93,95,96,97,98,99,2000,2009 Free Software + Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -152,6 +153,41 @@ struct ip_timestamp #define IPVERSION 4 /* IP version number */ #define IP_MAXPACKET 65535 /* maximum packet size */ +/* + * Definitions for Explicit Congestion Notification (ECN) + * + * Taken from RFC-3168, Section 5. + */ + +#define IPTOS_ECN_MASK 0x03 +#define IPTOS_ECN(x) ((x) & IPTOS_ECN_MASK) +#define IPTOS_ECN_NOT_ECT 0x00 +#define IPTOS_ECN_ECT1 0x01 +#define IPTOS_ECN_ECT0 0x02 +#define IPTOS_ECN_CE 0x03 + +/* + * Definitions for IP differentiated services code points (DSCP) + * + * Taken from RFC-2597, Section 6 and RFC-2598, Section 2.3. + */ + +#define IPTOS_DSCP_MASK 0xfc +#define IPTOS_DSCP(x) ((x) & IPTOS_DSCP_MASK) +#define IPTOS_DSCP_AF11 0x28 +#define IPTOS_DSCP_AF12 0x30 +#define IPTOS_DSCP_AF13 0x38 +#define IPTOS_DSCP_AF21 0x48 +#define IPTOS_DSCP_AF22 0x50 +#define IPTOS_DSCP_AF23 0x58 +#define IPTOS_DSCP_AF31 0x68 +#define IPTOS_DSCP_AF32 0x70 +#define IPTOS_DSCP_AF33 0x78 +#define IPTOS_DSCP_AF41 0x88 +#define IPTOS_DSCP_AF42 0x90 +#define IPTOS_DSCP_AF43 0x98 +#define IPTOS_DSCP_EF 0xb8 + /* * Definitions for IP type of service (ip_tos) */ diff --git a/include/netinet/udp.h b/include/netinet/udp.h index 45b69f749..ae1beb9e1 100644 --- a/include/netinet/udp.h +++ b/include/netinet/udp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 92, 93, 95, 96, 97, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1991-1993,1995-1997,2004,2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -74,6 +74,16 @@ struct udphdr }; #endif +/* UDP socket options */ +#define UDP_CORK 1 /* Never send partially complete segments. */ +#define UDP_ENCAP 100 /* Set the socket to accept + encapsulated packets. */ + +/* UDP encapsulation types */ +#define UDP_ENCAP_ESPINUDP_NON_IKE 1 /* draft-ietf-ipsec-nat-t-ike-00/01 */ +#define UDP_ENCAP_ESPINUDP 2 /* draft-ietf-ipsec-udp-encaps-06 */ +#define UDP_ENCAP_L2TPINUDP 3 /* rfc2661 */ + #define SOL_UDP 17 /* sockopt level for UDP */ #endif /* netinet/udp.h */ diff --git a/include/xlocale.h b/include/xlocale.h index 51a787f14..e3def347d 100644 --- a/include/xlocale.h +++ b/include/xlocale.h @@ -1,5 +1,5 @@ /* Definition of locale datatype. - Copyright (C) 1997,2000,02 Free Software Foundation, Inc. + Copyright (C) 1997,2000,2002,2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -21,15 +21,6 @@ #ifndef _XLOCALE_H #define _XLOCALE_H 1 -#include - -#ifndef __UCLIBC_HAS_XLOCALE__ -#error Attempted to include xlocale.h when uClibc built without extended locale support. -#endif - -#include -/* #include */ - #if 0 /* Structure for reentrant locale using functions. This is an (almost) opaque type for the user level programs. The file and @@ -37,26 +28,22 @@ go away without warning. */ typedef struct __locale_struct { -#if 0 /* Note: LC_ALL is not a valid index into this array. */ struct locale_data *__locales[13]; /* 13 = __LC_LAST. */ -#endif /* To increase the speed of this solution we add some special members. */ -/* const unsigned short int *__ctype_b; */ -/* const int *__ctype_tolower; */ -/* const int *__ctype_toupper; */ - const __uint16_t *__ctype_b; - const __ctype_touplow_t *__ctype_tolower; - const __ctype_touplow_t *__ctype_toupper; - - struct __uclibc_locale_struct *__locale_ptr; + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; -#if 0 /* Note: LC_ALL is not a valid index into this array. */ const char *__names[13]; -#endif } *__locale_t; +#else +# include #endif +/* POSIX 2008 makes locale_t official. */ +typedef __locale_t locale_t; + #endif /* xlocale.h */ diff --git a/libc/misc/locale/locale.c b/libc/misc/locale/locale.c index 52055a2d2..255c10d61 100644 --- a/libc/misc/locale/locale.c +++ b/libc/misc/locale/locale.c @@ -1057,6 +1057,7 @@ libc_hidden_def(__XL_NPP(nl_langinfo)) /**********************************************************************/ #ifdef L_newlocale +#warning mask defines for extra locale categories #ifdef __UCLIBC_MJN3_ONLY__ #warning TODO: Move posix and utf8 strings. -- cgit v1.2.3 From a37f5fd55332b72c7e8ca5436ab6cd04617985a7 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 3 Mar 2011 11:37:16 +0100 Subject: update some headers Sync some headers with glibc. realpath is an XSI extension in SuSv4, add back guard and update comment, since it seems to allow != NULL in second arg. Signed-off-by: Peter S. Mazinger --- include/stdint.h | 1 + include/stdlib.h | 42 ++++++++++++++++++++++++++---------------- include/sys/wait.h | 30 +++++++++++++----------------- 3 files changed, 40 insertions(+), 33 deletions(-) diff --git a/include/stdint.h b/include/stdint.h index 465a1b5bc..a0d7da947 100644 --- a/include/stdint.h +++ b/include/stdint.h @@ -238,6 +238,7 @@ typedef unsigned long long int uintmax_t; # define UINTPTR_MAX (4294967295U) # endif + #if !defined(__H8300H__) && !defined(__H8300S__) /* Minimum for largest signed integral type. */ # define INTMAX_MIN (-__INT64_C(9223372036854775807)-1) diff --git a/include/stdlib.h b/include/stdlib.h index 300edf04a..00bba5f54 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -50,9 +50,9 @@ __BEGIN_DECLS as well as POSIX.1 use of `int' for the status word. */ # if defined __GNUC__ && !defined __cplusplus -# define __WAIT_INT(status) \ - (__extension__ ({ union { __typeof(status) __in; int __i; } __u; \ - __u.__in = (status); __u.__i; })) +# define __WAIT_INT(status) \ + (__extension__ (((union { __typeof(status) __in; int __i; }) \ + { .__in = (status) }).__i)) # else # define __WAIT_INT(status) (*(int *) &(status)) # endif @@ -244,14 +244,14 @@ __END_NAMESPACE_C99 #if defined __USE_GNU && defined __UCLIBC_HAS_XLOCALE__ /* The concept of one static locale per category is not very well thought out. Many applications will need to process its data using - information from several different locales. Another application is + information from several different locales. Another problem is the implementation of the internationalization handling in the - upcoming ISO C++ standard library. To support this another set of - the functions using locale data exist which have an additional + ISO C++ standard library. To support this another set of + the functions using locale data exist which take an additional argument. - Attention: all these functions are *not* standardized in any form. - This is a proof-of-concept implementation. */ + Attention: even though several *_l interfaces are part of POSIX:2008, + these are not. */ /* Structure for reentrant locale using functions. This is an (almost) opaque type for the user level programs. */ @@ -347,10 +347,16 @@ struct random_data int32_t *fptr; /* Front pointer. */ int32_t *rptr; /* Rear pointer. */ int32_t *state; /* Array of state values. */ +#if 0 + int rand_type; /* Type of random number generator. */ + int rand_deg; /* Degree of random number generator. */ + int rand_sep; /* Distance between front and rear. */ +#else /* random_r.c, TYPE_x, DEG_x, SEP_x - small enough for int8_t */ int8_t rand_type; /* Type of random number generator. */ int8_t rand_deg; /* Degree of random number generator. */ int8_t rand_sep; /* Distance between front and rear. */ +#endif int32_t *end_ptr; /* Pointer behind state table. */ }; @@ -540,7 +546,7 @@ extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) __BEGIN_NAMESPACE_STD /* Call all functions registered with `atexit' and `on_exit', - in the reverse of the order in which they were registered + in the reverse of the order in which they were registered, perform stdio cleanup, and terminate program execution with STATUS. */ extern void exit (int __status) __THROW __attribute__ ((__noreturn__)); libc_hidden_proto(exit) @@ -619,7 +625,7 @@ extern char *mktemp (char *__template) __THROW __nonnull ((1)) __wur; Returns a file descriptor open on the file for reading and writing, or -1 if it cannot create a uniquely-named file. - This function is a possible cancellation points and therefore not + This function is a possible cancellation point and therefore not marked with __THROW. */ # ifndef __USE_FILE_OFFSET64 extern int mkstemp (char *__template) __nonnull ((1)) __wur; @@ -636,7 +642,7 @@ extern int mkstemp64 (char *__template) __nonnull ((1)) __wur; # endif #endif -#ifdef __USE_BSD +#if defined __USE_BSD || defined __USE_XOPEN2K8 /* Create a unique temporary directory from TEMPLATE. The last six characters of TEMPLATE must be "XXXXXX"; they are replaced with a string that makes the directory name unique. @@ -662,14 +668,17 @@ extern char *canonicalize_file_name (__const char *__name) __THROW __nonnull ((1)) __wur; #endif -/* Return the canonical absolute name of file NAME. If the - canonical name is PATH_MAX chars or more, returns null - with `errno' set to ENAMETOOLONG; if the name fits in - fewer than PATH_MAX chars, returns the name in RESOLVED. */ -/* we choose to handle __resolved==NULL as crash :) */ +#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED +/* Return the canonical absolute name of file NAME. If RESOLVED is + null, the result is malloc'd; otherwise, if the canonical name is + PATH_MAX chars or more, returns null with `errno' set to + ENAMETOOLONG; if the name fits in fewer than PATH_MAX chars, + returns the name in RESOLVED. */ extern char *realpath (__const char *__restrict __name, char *__restrict __resolved) __THROW __wur; libc_hidden_proto(realpath) +#endif + /* Shorthand for type of comparison functions. */ #ifndef __COMPAR_FN_T @@ -852,6 +861,7 @@ libc_hidden_proto(posix_openpt) #ifdef __USE_XOPEN /* The next four functions all take a master pseudo-tty fd and perform an operation on the associated slave: */ + #ifdef __UCLIBC_HAS_PTY__ /* Chown the slave to the calling user. */ extern int grantpt (int __fd) __THROW; diff --git a/include/sys/wait.h b/include/sys/wait.h index f283fe228..16893c0b9 100644 --- a/include/sys/wait.h +++ b/include/sys/wait.h @@ -1,5 +1,5 @@ -/* Copyright (C) 1991-1994,1996-2001,2003,2004,2005 - Free Software Foundation, Inc. +/* Copyright (C) 1991-1994,1996-2001,2003,2004,2005,2007,2009 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -51,7 +51,7 @@ __BEGIN_DECLS # endif /* This is the type of the argument to `wait'. The funky union - causes redeclarations with ether `int *' or `union wait *' to be + causes redeclarations with either `int *' or `union wait *' to be allowed without complaint. __WAIT_STATUS_DEFN is the type used in the actual function definitions. */ @@ -79,22 +79,22 @@ typedef union /* This will define all the `__W*' macros. */ # include -# define WEXITSTATUS(status) __WEXITSTATUS(__WAIT_INT(status)) -# define WTERMSIG(status) __WTERMSIG(__WAIT_INT(status)) -# define WSTOPSIG(status) __WSTOPSIG(__WAIT_INT(status)) -# define WIFEXITED(status) __WIFEXITED(__WAIT_INT(status)) -# define WIFSIGNALED(status) __WIFSIGNALED(__WAIT_INT(status)) -# define WIFSTOPPED(status) __WIFSTOPPED(__WAIT_INT(status)) +# define WEXITSTATUS(status) __WEXITSTATUS (__WAIT_INT (status)) +# define WTERMSIG(status) __WTERMSIG (__WAIT_INT (status)) +# define WSTOPSIG(status) __WSTOPSIG (__WAIT_INT (status)) +# define WIFEXITED(status) __WIFEXITED (__WAIT_INT (status)) +# define WIFSIGNALED(status) __WIFSIGNALED (__WAIT_INT (status)) +# define WIFSTOPPED(status) __WIFSTOPPED (__WAIT_INT (status)) # ifdef __WIFCONTINUED -# define WIFCONTINUED(status) __WIFCONTINUED(__WAIT_INT(status)) +# define WIFCONTINUED(status) __WIFCONTINUED (__WAIT_INT (status)) # endif #endif /* not included. */ #ifdef __USE_BSD # define WCOREFLAG __WCOREFLAG -# define WCOREDUMP(status) __WCOREDUMP(__WAIT_INT(status)) -# define W_EXITCODE(ret, sig) __W_EXITCODE(ret, sig) -# define W_STOPCODE(sig) __W_STOPCODE(sig) +# define WCOREDUMP(status) __WCOREDUMP (__WAIT_INT (status)) +# define W_EXITCODE(ret, sig) __W_EXITCODE (ret, sig) +# define W_STOPCODE(sig) __W_STOPCODE (sig) #endif /* The following values are used by the `waitid' function. */ @@ -172,10 +172,6 @@ extern __pid_t wait3 (__WAIT_STATUS __stat_loc, int __options, #endif #ifdef __USE_BSD -/* This being here makes the prototypes valid whether or not - we have already included to define `struct rusage'. */ -struct rusage; - /* PID is like waitpid. Other args are like wait3. */ extern __pid_t wait4 (__pid_t __pid, __WAIT_STATUS __stat_loc, int __options, struct rusage *__usage) __THROW; -- cgit v1.2.3 From b526c7807f0a54054c4b12edef58b521fe0ab4c7 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 3 Mar 2011 11:41:44 +0100 Subject: strcpy: remove unneeded includes from the generic version Signed-off-by: Peter S. Mazinger --- libc/string/generic/strcpy.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/libc/string/generic/strcpy.c b/libc/string/generic/strcpy.c index 4d070531f..ace6dea58 100644 --- a/libc/string/generic/strcpy.c +++ b/libc/string/generic/strcpy.c @@ -17,9 +17,6 @@ 02111-1307 USA. */ #include -#include - -#include "memcopy.h" /* Copy SRC to DEST. */ char *strcpy(char *dest, const char *src) -- cgit v1.2.3 From cb4625abd32512d02d18be7b6e173ec2d7877c17 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 3 Mar 2011 12:17:42 +0100 Subject: do not care about libc-internal.h, remove hp-timing.h Signed-off-by: Peter S. Mazinger --- Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index eea47aaa2..8a8b8b728 100644 --- a/Makefile.in +++ b/Makefile.in @@ -206,8 +206,8 @@ $(top_builddir)extra/scripts/unifdef: $(top_srcdir)extra/scripts/unifdef.c # a "y" here means the feature is enabled and so we should *not* rm it. # if the option expands to nothing though, we can punt the headers. HEADERS_RM- := \ - libc-internal.h \ dl-osinfo.h \ + hp-timing.h \ _lfs_64.h \ bits/uClibc_arch_features.h \ bits/kernel_sigaction.h \ -- cgit v1.2.3 From b776a692f8cc95c03853fcaf43833f9477ad8c36 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 3 Mar 2011 12:35:29 +0100 Subject: better guard of IPV6 related stuff Function prototypes are visible whenever IPV6 option is enabled. Structures and constants are visible either if IPV6 is enabled or STRICT_HEADERS is disabled. Signed-off-by: Peter S. Mazinger --- include/netinet/in.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/netinet/in.h b/include/netinet/in.h index ce5afa513..b42121ae3 100644 --- a/include/netinet/in.h +++ b/include/netinet/in.h @@ -213,15 +213,18 @@ struct in6_addr #endif }; -extern const struct in6_addr in6addr_any; /* :: */ -extern const struct in6_addr in6addr_loopback; /* ::1 */ -libc_hidden_proto(in6addr_loopback) #define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } #define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } #define INET6_ADDRSTRLEN 46 #endif +#ifdef __UCLIBC_HAS_IPV6__ +extern const struct in6_addr in6addr_any; /* :: */ +extern const struct in6_addr in6addr_loopback; /* ::1 */ +libc_hidden_proto(in6addr_loopback) +#endif + #define INET_ADDRSTRLEN 16 -- cgit v1.2.3 From 63a16d7e6832b65769e7c2be0aed39b8ff8cf741 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 3 Mar 2011 12:44:18 +0100 Subject: guard nl_catd structure and related constants with STRICT_HEADERS Signed-off-by: Peter S. Mazinger --- include/nl_types.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/nl_types.h b/include/nl_types.h index d6d48ecd9..e54612af7 100644 --- a/include/nl_types.h +++ b/include/nl_types.h @@ -21,11 +21,13 @@ #include +#ifndef __UCLIBC_STRICT_HEADERS__ /* The default message set used by the gencat program. */ #define NL_SETD 1 /* Value for FLAG parameter of `catgets' to say we want XPG4 compliance. */ #define NL_CAT_LOCALE 1 +#endif __BEGIN_DECLS @@ -34,8 +36,10 @@ __BEGIN_DECLS #warning "mjn3 FIXME: None of these prototypes have implementations." #endif +#ifndef __UCLIBC_STRICT_HEADERS__ /* Message catalog descriptor type. */ typedef void *nl_catd; +#endif /* Type used by `nl_langinfo'. */ typedef int nl_item; -- cgit v1.2.3 From fae4a5832519033c8c378e4cb4dadb96e5be1692 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 3 Mar 2011 13:08:54 +0100 Subject: paths.h: add _PATH_GSHADOW Signed-off-by: Peter S. Mazinger --- include/paths.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/paths.h b/include/paths.h index 305937fc5..0b4035d22 100644 --- a/include/paths.h +++ b/include/paths.h @@ -44,6 +44,7 @@ #define _PATH_DEVDB "/var/run/dev.db" #define _PATH_DEVNULL "/dev/null" #define _PATH_DRUM "/dev/drum" +#define _PATH_GSHADOW "/etc/gshadow" #define _PATH_KLOG "/proc/kmsg" #define _PATH_KMEM "/dev/kmem" #define _PATH_LASTLOG "/var/log/lastlog" -- cgit v1.2.3 From a36065a4fe6dcd6fc1847da9d063894e45c4a71e Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 3 Mar 2011 13:20:21 +0100 Subject: sgtty.h is useless, remove it on STRICT_HEADERS Signed-off-by: Peter S. Mazinger --- Makefile.in | 1 + include/sgtty.h | 6 ++++++ libc/sysdeps/linux/powerpc/bits/termios.h | 2 ++ 3 files changed, 9 insertions(+) diff --git a/Makefile.in b/Makefile.in index 8a8b8b728..bff501681 100644 --- a/Makefile.in +++ b/Makefile.in @@ -235,6 +235,7 @@ HEADERS_RM-$(UCLIBC_HAS_FLOATS) += complex.h fpu_control.h ieee754. bits/uClibc_fpmax.h \ bits/math*.h HEADERS_RM-$(findstring y,$(UCLIBC_HAS_FTW)$(UCLIBC_HAS_NFTW)) += ftw.h +HEADERS_RM-$(findstring y,$(UCLIBC_STRICT_HEADERS)) += sgtty.h HEADERS_RM-$(UCLIBC_HAS_GETTEXT_AWARENESS) += libintl.h HEADERS_RM-$(UCLIBC_HAS_GLIBC_CUSTOM_PRINTF) += printf.h HEADERS_RM-$(UCLIBC_HAS_GLOB) += glob.h diff --git a/include/sgtty.h b/include/sgtty.h index 5b2bc4184..f773c3123 100644 --- a/include/sgtty.h +++ b/include/sgtty.h @@ -19,21 +19,27 @@ #ifndef _SGTTY_H #define _SGTTY_H 1 +#warning useless header on uClibc + #include #include +#ifndef __UCLIBC_STRICT_HEADERS__ /* On some systems this type is not defined by ; in that case, the functions are just stubs that return ENOSYS. */ struct sgttyb; +#endif __BEGIN_DECLS +#if 0 /* Fill in *PARAMS with terminal parameters associated with FD. */ extern int gtty (int __fd, struct sgttyb *__params) __THROW; /* Set the terminal parameters associated with FD to *PARAMS. */ extern int stty (int __fd, __const struct sgttyb *__params) __THROW; +#endif __END_DECLS diff --git a/libc/sysdeps/linux/powerpc/bits/termios.h b/libc/sysdeps/linux/powerpc/bits/termios.h index 7aac02dc5..12513e3ea 100644 --- a/libc/sysdeps/linux/powerpc/bits/termios.h +++ b/libc/sysdeps/linux/powerpc/bits/termios.h @@ -220,6 +220,7 @@ struct termios { #define TCSADRAIN 1 #define TCSAFLUSH 2 +#ifndef __UCLIBC_STRICT_HEADERS__ struct sgttyb { char sg_ispeed; char sg_ospeed; @@ -227,6 +228,7 @@ struct sgttyb { char sg_kill; short sg_flags; }; +#endif struct tchars { char t_intrc; -- cgit v1.2.3 From 1f19ef8f9316e52f4940c34be3e056a8a41540e6 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 3 Mar 2011 13:52:34 +0100 Subject: do not enforce FORCE_SHAREABLE_TEXT_SEGMENTS on sh4 Signed-off-by: Peter S. Mazinger --- extra/Configs/Config.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/extra/Configs/Config.sh b/extra/Configs/Config.sh index 10e9d8b0c..6ce54c265 100644 --- a/extra/Configs/Config.sh +++ b/extra/Configs/Config.sh @@ -41,7 +41,6 @@ config CONFIG_SH3 bool "SH3" config CONFIG_SH4 - select FORCE_SHAREABLE_TEXT_SEGMENTS bool "SH4" endchoice -- cgit v1.2.3 From 96c9a8f7d00cdf6bb7968a2390b9d87da8a45e2d Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 3 Mar 2011 15:06:47 +0100 Subject: add _dl_errno support to errno.h, cleanup Add support to use errno.h in ldso. Move __set_errno into _LIBC guard. Remove uClibc_errno.h, unused. Signed-off-by: Peter S. Mazinger --- Makefile.in | 1 - include/errno.h | 12 ++++---- libc/sysdeps/linux/common/bits/uClibc_errno.h | 43 --------------------------- 3 files changed, 7 insertions(+), 49 deletions(-) delete mode 100644 libc/sysdeps/linux/common/bits/uClibc_errno.h diff --git a/Makefile.in b/Makefile.in index bff501681..3f1879539 100644 --- a/Makefile.in +++ b/Makefile.in @@ -215,7 +215,6 @@ HEADERS_RM- := \ bits/kernel_types.h \ bits/syscalls.h \ bits/syscalls-common.h \ - bits/uClibc_errno.h \ bits/uClibc_uintmaxtostr.h \ bits/sigcontextinfo.h \ bits/stackinfo.h \ diff --git a/include/errno.h b/include/errno.h index 85268f053..7e1f583a8 100644 --- a/include/errno.h +++ b/include/errno.h @@ -58,7 +58,12 @@ extern const char *program_invocation_name, *program_invocation_short_name; __END_DECLS -#if defined _LIBC && defined __UCLIBC_HAS_TLS__ +#ifdef _LIBC +#ifdef IS_IN_rtld +# undef errno +# define errno _dl_errno +extern int _dl_errno; /* attribute_hidden */ +#elif defined __UCLIBC_HAS_TLS__ # if !defined NOT_IN_libc || defined IS_IN_libpthread # undef errno # ifndef NOT_IN_libc @@ -73,10 +78,7 @@ extern __thread int errno attribute_tls_model_ie; #ifndef __set_errno #define __set_errno(val) (errno = (val)) #endif - -#ifndef __ASSEMBLER__ -extern int *__errno_location (void) __THROW __attribute__ ((__const__)); -#endif +#endif /* _LIBC */ #endif /* _ERRNO_H */ diff --git a/libc/sysdeps/linux/common/bits/uClibc_errno.h b/libc/sysdeps/linux/common/bits/uClibc_errno.h deleted file mode 100644 index 9c1561841..000000000 --- a/libc/sysdeps/linux/common/bits/uClibc_errno.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2000-2006 Erik Andersen - * - * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. - */ -#ifndef _BITS_UCLIBC_ERRNO_H -#define _BITS_UCLIBC_ERRNO_H 1 - -#ifdef IS_IN_rtld -# undef errno -# define errno _dl_errno -extern int _dl_errno; /* attribute_hidden; */ -#elif defined __UCLIBC_HAS_THREADS__ -# include -# if defined USE___THREAD && USE___THREAD -# undef errno -# ifndef NOT_IN_libc -# define errno __libc_errno -# else -# define errno errno -# endif -extern __thread int errno attribute_tls_model_ie; -# endif /* USE___THREAD */ -#endif /* IS_IN_rtld */ - -#define __set_errno(val) (errno = (val)) - -#ifndef __ASSEMBLER__ -extern int *__errno_location (void) __THROW __attribute__ ((__const__)) -# ifdef IS_IN_rtld - attribute_hidden -# endif -; -# if defined __UCLIBC_HAS_THREADS__ -# include -# if defined USE___THREAD && USE___THREAD -libc_hidden_proto(__errno_location) -# endif -# endif - -#endif /* !__ASSEMBLER__ */ - -#endif -- cgit v1.2.3 From 5ebef433698a13e5171f4b7dca04f2006bd92468 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 3 Mar 2011 16:04:03 +0100 Subject: provide internal hidden version of __fcntl_nocancel guard the prototype with _LIBC, it is only for internal use Signed-off-by: Peter S. Mazinger --- include/fcntl.h | 3 +++ libc/sysdeps/linux/common/__syscall_fcntl.c | 1 + 2 files changed, 4 insertions(+) diff --git a/include/fcntl.h b/include/fcntl.h index 3a9873461..26ad1fe6d 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -234,7 +234,10 @@ extern int posix_fallocate64 (int __fd, __off64_t __offset, __off64_t __len); # endif #endif +#ifdef _LIBC extern int __fcntl_nocancel (int fd, int cmd, ...); +libc_hidden_proto(__fcntl_nocancel) +#endif __END_DECLS diff --git a/libc/sysdeps/linux/common/__syscall_fcntl.c b/libc/sysdeps/linux/common/__syscall_fcntl.c index 5da3c5f32..6d4c339ab 100644 --- a/libc/sysdeps/linux/common/__syscall_fcntl.c +++ b/libc/sysdeps/linux/common/__syscall_fcntl.c @@ -40,6 +40,7 @@ int __fcntl_nocancel (int fd, int cmd, ...) # endif return INLINE_SYSCALL (fcntl, 3, fd, cmd, arg); } +libc_hidden_def(__fcntl_nocancel) int __libc_fcntl (int fd, int cmd, ...) { -- cgit v1.2.3 From 4e431d5f5cbdde5e4330c2961b084471de14c101 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 3 Mar 2011 16:23:05 +0100 Subject: remove obsoleted and incorrect comment Signed-off-by: Peter S. Mazinger --- include/libintl.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/include/libintl.h b/include/libintl.h index ba57f1698..be3969fff 100644 --- a/include/libintl.h +++ b/include/libintl.h @@ -34,11 +34,6 @@ __BEGIN_DECLS -#ifdef __UCLIBC_MJN3_ONLY__ -#warning "mjn3 FIXME: gettext has a prototype but isn't defined." -#warning "mjn3 FIXME: __OPTIMIZE__ is never defined." -#endif - /* Look up MSGID in the current default message catalog for the current LC_MESSAGES locale. If not found, returns MSGID itself (the default text). */ -- cgit v1.2.3 From 37525c04e45bb37bbc1532e11b5ab821a10f3cf4 Mon Sep 17 00:00:00 2001 From: Carmelo Amoroso Date: Fri, 4 Mar 2011 13:04:13 +0100 Subject: nptl: fix use of IS_IN_LIBPTHREAD macro IS_IN_LIBPTHREAD should be IS_IN_libpthread instead. Signed-off-by: Carmelo Amoroso --- libpthread/nptl/unwind.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpthread/nptl/unwind.c b/libpthread/nptl/unwind.c index 8f60ae410..671d70208 100644 --- a/libpthread/nptl/unwind.c +++ b/libpthread/nptl/unwind.c @@ -117,7 +117,7 @@ unwind_cleanup (_Unwind_Reason_Code reason, struct _Unwind_Exception *exc) void attribute_protected __cleanup_fct_attribute __attribute ((noreturn)) -#if !defined SHARED && !defined IS_IN_LIBPTHREAD +#if !defined SHARED && !defined IS_IN_libpthread weak_function #endif __pthread_unwind (__pthread_unwind_buf_t *buf) -- cgit v1.2.3 From ad7e468ca0aefd1adfebc7a87c249ef330e2362d Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Fri, 4 Mar 2011 13:18:27 +0100 Subject: fix removal of sgtty.h Signed-off-by: Peter S. Mazinger --- Makefile.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index 3f1879539..65dd4fda7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -222,6 +222,9 @@ HEADERS_RM- := \ rpc/des_crypt.h \ rpc/key_prot.h \ rpc/rpc_des.h +ifeq ($(UCLIBC_STRICT_HEADERS),y) +HEADERS_RM- += sgtty.h +endif HEADERS_RM-$(HAVE_SHARED) += dlfcn.h bits/dlfcn.h HEADERS_RM-$(PTHREADS_DEBUG_SUPPORT) += thread_db.h HEADERS_RM-$(UCLIBC_HAS_BSD_ERR) += err.h @@ -234,7 +237,6 @@ HEADERS_RM-$(UCLIBC_HAS_FLOATS) += complex.h fpu_control.h ieee754. bits/uClibc_fpmax.h \ bits/math*.h HEADERS_RM-$(findstring y,$(UCLIBC_HAS_FTW)$(UCLIBC_HAS_NFTW)) += ftw.h -HEADERS_RM-$(findstring y,$(UCLIBC_STRICT_HEADERS)) += sgtty.h HEADERS_RM-$(UCLIBC_HAS_GETTEXT_AWARENESS) += libintl.h HEADERS_RM-$(UCLIBC_HAS_GLIBC_CUSTOM_PRINTF) += printf.h HEADERS_RM-$(UCLIBC_HAS_GLOB) += glob.h -- cgit v1.2.3 From 2a0c568ddc7b6b142dc049d8cc9cf32eb38e2321 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Fri, 4 Mar 2011 18:28:26 +0100 Subject: fix locale build make xlocale.h a dummy, locale_t is needed without it and uClibc_locale.h is already included by locale.h Signed-off-by: Peter S. Mazinger --- include/locale.h | 6 +++--- include/xlocale.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/locale.h b/include/locale.h index fa8d9e2d8..d04c42ff6 100644 --- a/include/locale.h +++ b/include/locale.h @@ -145,13 +145,13 @@ __END_NAMESPACE_STD Attention: all these functions are *not* standardized in any form. This is a proof-of-concept implementation. */ -#if 0 +#ifdef __UCLIBC_HAS_XLOCALE__ /* Get locale datatype definition. */ # include -#else +#endif + /* POSIX 2008 makes locale_t official. */ typedef __locale_t locale_t; -#endif /* Return a reference to a data structure representing a set of locale datasets. Unlike for the CATEGORY parameter for `setlocale' the diff --git a/include/xlocale.h b/include/xlocale.h index e3def347d..82dabdfda 100644 --- a/include/xlocale.h +++ b/include/xlocale.h @@ -39,11 +39,11 @@ typedef struct __locale_struct /* Note: LC_ALL is not a valid index into this array. */ const char *__names[13]; } *__locale_t; -#else -# include -#endif /* POSIX 2008 makes locale_t official. */ typedef __locale_t locale_t; +#else +# include +#endif #endif /* xlocale.h */ -- cgit v1.2.3 From f4eebb6146ea3f6917481d5d24f3d99e97236399 Mon Sep 17 00:00:00 2001 From: "Bernd Schmidt bernds_cb1@t-online.de" Date: Wed, 2 Mar 2011 18:22:01 +0100 Subject: Add Makefile support for DSBT ELF. This adds support for a new binary format, DSBT ELF, to the Makefiles. Every shared library is assigned a DSBT index, and the link.so macro is adjusted to ensure the correct linker argument is passed. Configuration and ldso support will follow in separate commits. Signed-off-by: Bernd Schmidt Signed-off-by: Bernhard Reutner-Fischer --- Makerules | 3 ++- ldso/ldso/Makefile.in | 1 + ldso/libdl/Makefile.in | 1 + libc/Makefile.in | 1 + libcrypt/Makefile.in | 1 + libm/Makefile.in | 1 + libnsl/Makefile.in | 1 + libpthread/linuxthreads.old/Makefile.in | 1 + libresolv/Makefile.in | 1 + librt/Makefile.in | 1 + libutil/Makefile.in | 1 + 11 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Makerules b/Makerules index 84eeaea19..3a4d566d4 100644 --- a/Makerules +++ b/Makerules @@ -297,7 +297,8 @@ cmd_hcompile.o = $(HOSTCC) $(filter-out $(PHONY),$<) $(DEPS-$(notdir $@)) -c -o define link.so $(Q)$(RM) $@ $@.$(2) $(dir $@)$(1) @$(disp_ld) - $(Q)$(CC) $(LDFLAGS-$(notdir $@)) -Wl,-soname=$(notdir $@).$(2) \ + $(Q)$(CC) $(LDFLAGS-$(notdir $@)) $(LDFLAGS-y-$(@F)) \ + -Wl,-soname=$(notdir $@).$(2) \ $(NOSTDLIB_CFLAGS) -o $(dir $@)$(1) $(START_FILE-$(notdir $@)) \ -Wl,--whole-archive $(firstword $^) -Wl,--no-whole-archive \ $(LIBS-$(notdir $@)) $(LIBGCC) $(END_FILE-$(notdir $@)) diff --git a/ldso/ldso/Makefile.in b/ldso/ldso/Makefile.in index e71ae1563..7a9ffa643 100644 --- a/ldso/ldso/Makefile.in +++ b/ldso/ldso/Makefile.in @@ -30,6 +30,7 @@ CFLAGS-ldso/ldso/$(TARGET_ARCH)/ := $(CFLAGS-ldso) CFLAGS-ldso.c := -DLDSO_ELFINTERP=\"$(TARGET_ARCH)/elfinterp.c\" $(CFLAGS-ldso) +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-$(UCLIBC_LDSO_NAME).so := -Wl,--dsbt-index=1 ifneq ($(SUPPORT_LD_DEBUG),y) LDFLAGS-$(UCLIBC_LDSO_NAME).so := $(LDFLAGS) else diff --git a/ldso/libdl/Makefile.in b/ldso/libdl/Makefile.in index 39db7a876..152185e37 100644 --- a/ldso/libdl/Makefile.in +++ b/ldso/libdl/Makefile.in @@ -19,6 +19,7 @@ endif CFLAGS-libdl.c := -DLDSO_ELFINTERP=\"$(TARGET_ARCH)/elfinterp.c\" +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libdl.so := -Wl,--dsbt-index=3 LDFLAGS-libdl.so := $(LDFLAGS) -Wl,-fini,dl_cleanup LIBS-libdl.so := $(LIBS) $(ldso) diff --git a/libc/Makefile.in b/libc/Makefile.in index dd666ac7c..3b6a17b32 100644 --- a/libc/Makefile.in +++ b/libc/Makefile.in @@ -15,6 +15,7 @@ ifneq ($(VERSION_SCRIPT),) VERSION_SCRIPT := -Wl,--version-script,$(VERSION_SCRIPT) endif +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libc.so := -Wl,--dsbt-index=2 LDFLAGS-libc.so := $(LDFLAGS) $(VERSION_SCRIPT) -Wl,-init,$(SYMBOL_PREFIX)__uClibc_init ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y) CFLAGS += -D__USE_STDIO_FUTEXES__ diff --git a/libcrypt/Makefile.in b/libcrypt/Makefile.in index 3cbf9d04b..1d1fb55ad 100644 --- a/libcrypt/Makefile.in +++ b/libcrypt/Makefile.in @@ -9,6 +9,7 @@ subdirs += libcrypt CFLAGS-libcrypt := -DNOT_IN_libc -DIS_IN_libcrypt $(SSP_ALL_CFLAGS) +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libcrypt.so := -Wl,--dsbt-index=4 LDFLAGS-libcrypt.so := $(LDFLAGS) LIBS-libcrypt.so := $(LIBS) diff --git a/libm/Makefile.in b/libm/Makefile.in index 384365cac..223593304 100644 --- a/libm/Makefile.in +++ b/libm/Makefile.in @@ -25,6 +25,7 @@ subdirs += libm CFLAGS-libm := -DNOT_IN_libc -DIS_IN_libm $(SSP_ALL_CFLAGS) CFLAGS-libm += -D_IEEE_LIBM +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libm.so := -Wl,--dsbt-index=5 LDFLAGS-libm.so := $(LDFLAGS) LIBS-libm.so := $(LIBS) diff --git a/libnsl/Makefile.in b/libnsl/Makefile.in index 3aa05a0f7..333c4907b 100644 --- a/libnsl/Makefile.in +++ b/libnsl/Makefile.in @@ -9,6 +9,7 @@ subdirs += libnsl CFLAGS-libnsl := -DNOT_IN_libc -DIS_IN_libnsl $(SSP_ALL_CFLAGS) +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libnsl.so := -Wl,--dsbt-index=6 LDFLAGS-libnsl.so := $(LDFLAGS) $(call link.asneeded,-lc) LIBS-libnsl.so := $(LIBS) diff --git a/libpthread/linuxthreads.old/Makefile.in b/libpthread/linuxthreads.old/Makefile.in index d2e29c72d..f599b1697 100644 --- a/libpthread/linuxthreads.old/Makefile.in +++ b/libpthread/linuxthreads.old/Makefile.in @@ -18,6 +18,7 @@ LDFLAGS-libpthread.so := $(LDFLAGS_NOSTRIP) -Wl,-z,defs else LDFLAGS-libpthread.so := $(LDFLAGS) endif +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libpthread.so := -Wl,--dsbt-index=10 LIBS-libpthread.so := $(LIBS) $(ldso) diff --git a/libresolv/Makefile.in b/libresolv/Makefile.in index fb71b421e..fa3c34138 100644 --- a/libresolv/Makefile.in +++ b/libresolv/Makefile.in @@ -9,6 +9,7 @@ subdirs += libresolv CFLAGS-libresolv := -DNOT_IN_libc -DIS_IN_libresolv $(SSP_ALL_CFLAGS) +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libresolv.so := -Wl,--dsbt-index=7 LDFLAGS-libresolv.so := $(LDFLAGS) $(call link.asneeded,-lc) LIBS-libresolv.so := $(LIBS) diff --git a/librt/Makefile.in b/librt/Makefile.in index 6eb508cb2..7d295d4a6 100644 --- a/librt/Makefile.in +++ b/librt/Makefile.in @@ -9,6 +9,7 @@ subdirs += librt CFLAGS-librt := -DNOT_IN_libc -DIS_IN_librt $(SSP_ALL_CFLAGS) +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-librt.so := -Wl,--dsbt-index=9 LDFLAGS-librt.so := $(LDFLAGS) LIBS-librt.so := $(LIBS) ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) diff --git a/libutil/Makefile.in b/libutil/Makefile.in index 057d02ded..f904fc7e1 100644 --- a/libutil/Makefile.in +++ b/libutil/Makefile.in @@ -9,6 +9,7 @@ subdirs += libutil CFLAGS-libutil := -DNOT_IN_libc -DIS_IN_libutil $(SSP_ALL_CFLAGS) +LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libutil.so := -Wl,--dsbt-index=8 LDFLAGS-libutil.so := $(LDFLAGS) LIBS-libutil.so := $(LIBS) -- cgit v1.2.3 From 95adc01517efce365da4e40e0d2a081ec4497928 Mon Sep 17 00:00:00 2001 From: Mark Salter Date: Wed, 23 Feb 2011 12:56:43 +0100 Subject: Add support for DSBT ELF to ld.so This adds support for DSBT ELF to ld.so. This uses loadmaps like FD-PIC. Some code is added in ld.so to initialize the DSBT tables, and there's also a new target macro FINISH_BOOTSTRAP_RELOC. Signed-off-by: Mark Salter Signed-off-by: Aurelien Jacquiot Signed-off-by: Bernd Schmidt --- include/link.h | 13 ++++++++++++- ldso/include/dl-defs.h | 2 +- ldso/include/dl-elf.h | 11 ++++++++++- ldso/ldso/dl-elf.c | 23 ++++++++++++++++++++++- ldso/ldso/ldso.c | 11 ++++++++++- libc/misc/elf/dl-iterate-phdr.c | 4 +++- 6 files changed, 58 insertions(+), 6 deletions(-) diff --git a/include/link.h b/include/link.h index cbef6165a..185ee701e 100644 --- a/include/link.h +++ b/include/link.h @@ -1,6 +1,6 @@ /* Data structure for communication from the run-time dynamic linker for loaded ELF shared objects. - Copyright (C) 1995-2001, 2004, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 1995-2001, 2004, 2005, 2006, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -83,6 +83,9 @@ extern ElfW(Dyn) _DYNAMIC[]; #ifdef __FDPIC__ # include #endif +#ifdef __DSBT__ +# include +#endif /* Structure describing a loaded shared object. The `l_next' and `l_prev' members form a chain of all the shared objects loaded at startup. @@ -97,8 +100,12 @@ struct link_map #ifdef __FDPIC__ struct elf32_fdpic_loadaddr l_addr; +#else +#ifdef __DSBT__ + struct elf32_dsbt_loadaddr l_addr; #else ElfW(Addr) l_addr; /* Base address shared object is loaded at. */ +#endif #endif char *l_name; /* Absolute file name object was found in. */ ElfW(Dyn) *l_ld; /* Dynamic section of the shared object. */ @@ -177,8 +184,12 @@ struct dl_phdr_info { #ifdef __FDPIC__ struct elf32_fdpic_loadaddr dlpi_addr; +#else +#ifdef __DSBT__ + struct elf32_dsbt_loadaddr dlpi_addr; #else ElfW(Addr) dlpi_addr; +#endif #endif const char *dlpi_name; const ElfW(Phdr) *dlpi_phdr; diff --git a/ldso/include/dl-defs.h b/ldso/include/dl-defs.h index 2d6303cfe..be0a81da3 100644 --- a/ldso/include/dl-defs.h +++ b/ldso/include/dl-defs.h @@ -212,7 +212,7 @@ typedef struct { _dl_find_hash for this reloc TYPE. TPNT is the module in which the matching SYM was found. */ #ifndef DL_FIND_HASH_VALUE -# define DL_FIND_HASH_VALUE(TPNT, TYPE, SYM) (DL_RELOC_ADDR ((SYM)->st_value, (TPNT)->loadaddr)) +# define DL_FIND_HASH_VALUE(TPNT, TYPE, SYM) (DL_RELOC_ADDR ((TPNT)->loadaddr, (SYM)->st_value)) #endif /* Unmap all previously-mapped segments accumulated in LOADADDR. diff --git a/ldso/include/dl-elf.h b/ldso/include/dl-elf.h index 5aec64f0d..7fbb373b4 100644 --- a/ldso/include/dl-elf.h +++ b/ldso/include/dl-elf.h @@ -165,7 +165,7 @@ unsigned int __dl_parse_dynamic_info(ElfW(Dyn) *dpnt, unsigned long dynamic_info /* Don't adjust .dynamic unnecessarily. For FDPIC targets, we'd have to walk all the loadsegs to find out if it was actually unnecessary, so skip this optimization. */ -#ifndef __FDPIC__ +#if !defined __FDPIC__ && !defined __DSBT__ if (load_off != 0) #endif { @@ -179,6 +179,15 @@ unsigned int __dl_parse_dynamic_info(ElfW(Dyn) *dpnt, unsigned long dynamic_info ADJUST_DYN_INFO(DT_GNU_HASH_IDX, load_off); #endif } +#ifdef __DSBT__ + /* Get the mapped address of the DSBT base. */ + ADJUST_DYN_INFO(DT_DSBT_BASE_IDX, load_off); + + /* Initialize loadmap dsbt info. */ + load_off.map->dsbt_table = dynamic_info[DT_DSBT_BASE_IDX]; + load_off.map->dsbt_size = dynamic_info[DT_DSBT_SIZE_IDX]; + load_off.map->dsbt_index = dynamic_info[DT_DSBT_INDEX_IDX]; +#endif #undef ADJUST_DYN_INFO return rtld_flags; } diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 61d495974..4cbd3382f 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -188,7 +188,7 @@ unsigned long _dl_error_number; unsigned long _dl_internal_error_number; struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt, - struct elf_resolve *tpnt, char *full_libname, int __attribute__((unused)) trace_loaded_objects) + struct elf_resolve *tpnt, char *full_libname, int attribute_unused trace_loaded_objects) { char *pnt; struct elf_resolve *tpnt1; @@ -806,6 +806,27 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, INIT_GOT(lpnt, tpnt); } +#ifdef __DSBT__ + /* Handle DSBT initialization */ + { + struct elf_resolve *t, *ref = NULL; + int idx = tpnt->loadaddr.map->dsbt_index; + unsigned *dsbt = tpnt->loadaddr.map->dsbt_table; + + /* + * Setup dsbt slot for this module in dsbt of all modules. + */ + for (t = _dl_loaded_modules; t; t = t->next) { + /* find a dsbt table from another module */ + if (ref == NULL && t != tpnt) + ref = t; + t->loadaddr.map->dsbt_table[idx] = (unsigned)dsbt; + } + if (ref) + _dl_memcpy(dsbt, ref->loadaddr.map->dsbt_table, + tpnt->loadaddr.map->dsbt_size * sizeof(unsigned *)); + } +#endif _dl_if_debug_dprint("\n\tfile='%s'; generating link map\n", libname); _dl_if_debug_dprint("\t\tdynamic: %x base: %x\n", dynamic_addr, DL_LOADADDR_BASE(lib_loadaddr)); _dl_if_debug_dprint("\t\t entry: %x phdr: %x phnum: %x\n\n", diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index 4d79d4665..7ee925706 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -868,7 +868,16 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, ElfW(Ehdr) *epnt = (ElfW(Ehdr) *) auxvt[AT_BASE].a_un.a_val; ElfW(Phdr) *myppnt = (ElfW(Phdr) *) DL_RELOC_ADDR(load_addr, epnt->e_phoff); int j; - +#ifdef __DSBT__ + struct elf_resolve *ref = _dl_loaded_modules; + _dl_if_debug_dprint("ref is %x, dsbt %x, ref-dsbt %x size %x\n", + ref, tpnt->loadaddr.map->dsbt_table, + ref->loadaddr.map->dsbt_table, + tpnt->loadaddr.map->dsbt_size); + + _dl_memcpy(tpnt->loadaddr.map->dsbt_table, ref->loadaddr.map->dsbt_table, + tpnt->loadaddr.map->dsbt_size * sizeof(unsigned *)); +#endif tpnt = _dl_add_elf_hash_table(tpnt->libname, load_addr, tpnt->dynamic_info, (unsigned long)tpnt->dynamic_addr, diff --git a/libc/misc/elf/dl-iterate-phdr.c b/libc/misc/elf/dl-iterate-phdr.c index a7677f11f..f0233ca37 100644 --- a/libc/misc/elf/dl-iterate-phdr.c +++ b/libc/misc/elf/dl-iterate-phdr.c @@ -62,9 +62,11 @@ dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info, /* This entry describes this statically-linked program itself. */ struct dl_phdr_info info; int ret; -#ifdef __FDPIC__ +#if defined(__FDPIC__) info.dlpi_addr.map = NULL; info.dlpi_addr.got_value = NULL; +#elif defined(__DSBT__) + info.dlpi_addr.map = NULL; #else info.dlpi_addr = 0; #endif -- cgit v1.2.3 From 817f685f4c65ed1af6eef79749b1f158eedd5bfc Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Wed, 23 Feb 2011 02:57:49 +0100 Subject: Allow ABIs where SP points below the stack frame. On C6X, the stack pointer points to a word that is not part of the current function's stack frame. It may be overwritten by callees. Take this into account when creating the stack for a cloned thread. Signed-off-by: Bernd Schmidt --- libpthread/linuxthreads.old/manager.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/libpthread/linuxthreads.old/manager.c b/libpthread/linuxthreads.old/manager.c index 52c1ea9b6..85fee5ec5 100644 --- a/libpthread/linuxthreads.old/manager.c +++ b/libpthread/linuxthreads.old/manager.c @@ -35,6 +35,9 @@ #include "semaphore.h" #include "debug.h" /* PDEBUG, added by StS */ +#ifndef THREAD_STACK_OFFSET +#define THREAD_STACK_OFFSET 0 +#endif /* poll() is not supported in kernel <= 2.0, therefore is __NR_poll is * not available, we assume an old Linux kernel is in use and we will @@ -476,6 +479,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr, int pid; pthread_descr new_thread; char * new_thread_bottom; + char * new_thread_top; pthread_t new_thread_id; char *guardaddr = NULL; size_t guardsize = 0; @@ -561,7 +565,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr, /* Do the cloning. We have to use two different functions depending on whether we are debugging or not. */ pid = 0; /* Note that the thread never can have PID zero. */ - + new_thread_top = ((char *)new_thread - THREAD_STACK_OFFSET); /* ******************************************************** */ /* This code was moved from below to cope with running threads @@ -588,12 +592,12 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr, /* We have to report this event. */ #ifdef __ia64__ - pid = __clone2(pthread_start_thread_event, (void **) new_thread, - (char *)new_thread - new_thread_bottom, + pid = __clone2(pthread_start_thread_event, new_thread_top, + new_thread_top - new_thread_bottom, CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | __pthread_sig_cancel, new_thread); #else - pid = clone(pthread_start_thread_event, (void **) new_thread, + pid = clone(pthread_start_thread_event, new_thread_top, CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | __pthread_sig_cancel, new_thread); #endif @@ -626,12 +630,12 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr, { PDEBUG("cloning new_thread = %p\n", new_thread); #ifdef __ia64__ - pid = __clone2(pthread_start_thread, (void **) new_thread, - (char *)new_thread - new_thread_bottom, + pid = __clone2(pthread_start_thread, new_thread_top, + new_thread_top - new_thread_bottom, CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | __pthread_sig_cancel, new_thread); #else - pid = clone(pthread_start_thread, (void **) new_thread, + pid = clone(pthread_start_thread, new_thread_top, CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | __pthread_sig_cancel, new_thread); #endif -- cgit v1.2.3 From 46d6a24872b7fa2717f8f71b5e0598a14d38e1f6 Mon Sep 17 00:00:00 2001 From: Aurelien Jacquiot Date: Wed, 23 Feb 2011 13:04:59 +0100 Subject: The C6X port This adds support for the TI C6X family of processors. Signed-off-by: Mark Salter Signed-off-by: Aurelien Jacquiot Signed-off-by: Bernd Schmidt --- Rules.mak | 12 + extra/Configs/Config.c6x | 34 +++ extra/Configs/Config.in | 7 + extra/Configs/Config.in.arch | 4 + include/elf.h | 45 ++++ ldso/ldso/c6x/dl-debug.h | 49 ++++ ldso/ldso/c6x/dl-inlines.h | 91 +++++++ ldso/ldso/c6x/dl-startup.h | 122 +++++++++ ldso/ldso/c6x/dl-syscalls.h | 25 ++ ldso/ldso/c6x/dl-sysdep.h | 209 +++++++++++++++ ldso/ldso/c6x/elfinterp.c | 296 +++++++++++++++++++++ ldso/ldso/c6x/resolve.S | 68 +++++ libc/sysdeps/linux/c6x/Makefile | 13 + libc/sysdeps/linux/c6x/Makefile.arch | 15 ++ libc/sysdeps/linux/c6x/__longjmp.S | 47 ++++ libc/sysdeps/linux/c6x/_vfork.S | 55 ++++ libc/sysdeps/linux/c6x/bits/byteswap.h | 35 +++ libc/sysdeps/linux/c6x/bits/elf-dsbt.h | 123 +++++++++ libc/sysdeps/linux/c6x/bits/endian.h | 11 + libc/sysdeps/linux/c6x/bits/fcntl.h | 235 ++++++++++++++++ libc/sysdeps/linux/c6x/bits/kernel_stat.h | 52 ++++ libc/sysdeps/linux/c6x/bits/kernel_types.h | 46 ++++ libc/sysdeps/linux/c6x/bits/mathdef.h | 39 +++ libc/sysdeps/linux/c6x/bits/nan.h | 57 ++++ libc/sysdeps/linux/c6x/bits/poll.h | 43 +++ libc/sysdeps/linux/c6x/bits/resource.h | 209 +++++++++++++++ libc/sysdeps/linux/c6x/bits/setjmp.h | 39 +++ libc/sysdeps/linux/c6x/bits/sigcontextinfo.h | 26 ++ libc/sysdeps/linux/c6x/bits/stackinfo.h | 28 ++ libc/sysdeps/linux/c6x/bits/stat.h | 174 ++++++++++++ libc/sysdeps/linux/c6x/bits/syscalls.h | 182 +++++++++++++ libc/sysdeps/linux/c6x/bits/uClibc_arch_features.h | 48 ++++ libc/sysdeps/linux/c6x/bits/wordsize.h | 19 ++ libc/sysdeps/linux/c6x/brk.c | 54 ++++ libc/sysdeps/linux/c6x/bsd-_setjmp.s | 48 ++++ libc/sysdeps/linux/c6x/bsd-setjmp.S | 67 +++++ libc/sysdeps/linux/c6x/clone.S | 97 +++++++ libc/sysdeps/linux/c6x/crt1.S | 67 +++++ libc/sysdeps/linux/c6x/crti.S | 17 ++ libc/sysdeps/linux/c6x/crtn.S | 19 ++ libc/sysdeps/linux/c6x/prctl.c | 43 +++ libc/sysdeps/linux/c6x/pread_write.c | 103 +++++++ libc/sysdeps/linux/c6x/setjmp.s | 43 +++ libc/sysdeps/linux/c6x/sigaction.c | 115 ++++++++ libc/sysdeps/linux/c6x/sys/procfs.h | 122 +++++++++ libc/sysdeps/linux/c6x/sys/reg.h | 26 ++ libc/sysdeps/linux/c6x/sys/ucontext.h | 39 +++ libc/sysdeps/linux/c6x/sys/user.h | 28 ++ libc/sysdeps/linux/c6x/syscall.c | 49 ++++ libc/sysdeps/linux/c6x/vfork.c | 26 ++ libc/sysdeps/linux/common/Makefile.in | 1 + .../linuxthreads.old/sysdeps/c6x/pt-machine.h | 64 +++++ 52 files changed, 3486 insertions(+) create mode 100644 extra/Configs/Config.c6x create mode 100644 ldso/ldso/c6x/dl-debug.h create mode 100644 ldso/ldso/c6x/dl-inlines.h create mode 100644 ldso/ldso/c6x/dl-startup.h create mode 100644 ldso/ldso/c6x/dl-syscalls.h create mode 100644 ldso/ldso/c6x/dl-sysdep.h create mode 100644 ldso/ldso/c6x/elfinterp.c create mode 100644 ldso/ldso/c6x/resolve.S create mode 100644 libc/sysdeps/linux/c6x/Makefile create mode 100644 libc/sysdeps/linux/c6x/Makefile.arch create mode 100644 libc/sysdeps/linux/c6x/__longjmp.S create mode 100644 libc/sysdeps/linux/c6x/_vfork.S create mode 100644 libc/sysdeps/linux/c6x/bits/byteswap.h create mode 100644 libc/sysdeps/linux/c6x/bits/elf-dsbt.h create mode 100644 libc/sysdeps/linux/c6x/bits/endian.h create mode 100644 libc/sysdeps/linux/c6x/bits/fcntl.h create mode 100644 libc/sysdeps/linux/c6x/bits/kernel_stat.h create mode 100644 libc/sysdeps/linux/c6x/bits/kernel_types.h create mode 100644 libc/sysdeps/linux/c6x/bits/mathdef.h create mode 100644 libc/sysdeps/linux/c6x/bits/nan.h create mode 100644 libc/sysdeps/linux/c6x/bits/poll.h create mode 100644 libc/sysdeps/linux/c6x/bits/resource.h create mode 100644 libc/sysdeps/linux/c6x/bits/setjmp.h create mode 100644 libc/sysdeps/linux/c6x/bits/sigcontextinfo.h create mode 100644 libc/sysdeps/linux/c6x/bits/stackinfo.h create mode 100644 libc/sysdeps/linux/c6x/bits/stat.h create mode 100644 libc/sysdeps/linux/c6x/bits/syscalls.h create mode 100644 libc/sysdeps/linux/c6x/bits/uClibc_arch_features.h create mode 100644 libc/sysdeps/linux/c6x/bits/wordsize.h create mode 100644 libc/sysdeps/linux/c6x/brk.c create mode 100644 libc/sysdeps/linux/c6x/bsd-_setjmp.s create mode 100644 libc/sysdeps/linux/c6x/bsd-setjmp.S create mode 100644 libc/sysdeps/linux/c6x/clone.S create mode 100644 libc/sysdeps/linux/c6x/crt1.S create mode 100644 libc/sysdeps/linux/c6x/crti.S create mode 100644 libc/sysdeps/linux/c6x/crtn.S create mode 100644 libc/sysdeps/linux/c6x/prctl.c create mode 100644 libc/sysdeps/linux/c6x/pread_write.c create mode 100644 libc/sysdeps/linux/c6x/setjmp.s create mode 100644 libc/sysdeps/linux/c6x/sigaction.c create mode 100644 libc/sysdeps/linux/c6x/sys/procfs.h create mode 100644 libc/sysdeps/linux/c6x/sys/reg.h create mode 100644 libc/sysdeps/linux/c6x/sys/ucontext.h create mode 100644 libc/sysdeps/linux/c6x/sys/user.h create mode 100644 libc/sysdeps/linux/c6x/syscall.c create mode 100644 libc/sysdeps/linux/c6x/vfork.c create mode 100644 libpthread/linuxthreads.old/sysdeps/c6x/pt-machine.h diff --git a/Rules.mak b/Rules.mak index fe287335b..0727e362a 100644 --- a/Rules.mak +++ b/Rules.mak @@ -218,10 +218,12 @@ ifeq ($(UCLIBC_HAS_SOFT_FLOAT),y) ifneq ($(TARGET_ARCH),nios) ifneq ($(TARGET_ARCH),nios2) ifneq ($(TARGET_ARCH),sh) +ifneq ($(TARGET_ARCH),c6x) CPU_CFLAGS-y += -msoft-float endif endif endif +endif ifeq ($(TARGET_ARCH),arm) # No longer needed with current toolchains, but leave it here for now. # If anyone is actually still using gcc 2.95 (say), they can uncomment it. @@ -239,6 +241,7 @@ CPU_LDFLAGS-$(ARCH_BIG_ENDIAN) += -Wl,-EB PICFLAG-y := -fPIC PICFLAG-$(UCLIBC_FORMAT_FDPIC_ELF) := -mfdpic +PICFLAG-$(UCLIBC_FORMAT_DSBT_ELF) := -mdsbt -fpic PICFLAG := $(PICFLAG-y) PIEFLAG_NAME:=-fPIE @@ -485,6 +488,15 @@ ifeq ($(TARGET_ARCH),v850) SYMBOL_PREFIX=_ endif +ifeq ($(TARGET_ARCH),c6x) + PIEFLAG:= + CPU_CFLAGS-$(CONFIG_TMS320C64X) += -march=c64x + CPU_CFLAGS-$(CONFIG_TMS320C64XPLUS) += -march=c64x+ + CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN)+=-mlittle-endian + CPU_CFLAGS-$(ARCH_BIG_ENDIAN)+=-mbig-endian + CPU_LDFLAGS-y += $(CPU_CFLAGS) +endif + # Keep the check_gcc from being needlessly executed ifndef PIEFLAG export PIEFLAG:=$(call check_gcc,$(PIEFLAG_NAME),$(PICFLAG)) diff --git a/extra/Configs/Config.c6x b/extra/Configs/Config.c6x new file mode 100644 index 000000000..d71df3f14 --- /dev/null +++ b/extra/Configs/Config.c6x @@ -0,0 +1,34 @@ +# +# For a description of the syntax of this configuration file, +# see extra/config/Kconfig-language.txt +# + +config TARGET_ARCH + default "c6x" + +config FORCE_OPTIONS_FOR_ARCH + bool + default y + select ARCH_ANY_ENDIAN + +config ARCH_CFLAGS + string + +config ARCH_LDFLAGS + string + +choice + prompt "Target Processor Type" + default CONFIG_GENERIC_C6X + +config CONFIG_GENERIC_C6X + bool "Generic C6X DSP" + +config CONFIG_TMS320C64X + bool "TMS320C64X" + +config CONFIG_TMS320C64XPLUS + bool "TMS320C64X+" + +endchoice + diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in index 4d2c870bd..8628f28f6 100644 --- a/extra/Configs/Config.in +++ b/extra/Configs/Config.in @@ -114,6 +114,9 @@ config TARGET_x86_64 config TARGET_xtensa bool "xtensa" +config TARGET_c6x + bool "c6x" + endchoice @@ -219,6 +222,10 @@ if TARGET_xtensa source "extra/Configs/Config.xtensa" endif +if TARGET_c6x +source "extra/Configs/Config.c6x" +endif + config TARGET_SUBARCH string default "e500" if CONFIG_E500 diff --git a/extra/Configs/Config.in.arch b/extra/Configs/Config.in.arch index 068bccc69..5f7a2b0c6 100644 --- a/extra/Configs/Config.in.arch +++ b/extra/Configs/Config.in.arch @@ -17,6 +17,10 @@ config UCLIBC_FORMAT_FDPIC_ELF bool "FDPIC ELF" depends on !ARCH_USE_MMU && (TARGET_bfin || TARGET_frv) select DOPIC +config UCLIBC_FORMAT_DSBT_ELF + bool "DBST ELF" + depends on !ARCH_USE_MMU && TARGET_c6x + select DOPIC config UCLIBC_FORMAT_FLAT bool "STATIC FLAT" depends on !ARCH_USE_MMU diff --git a/include/elf.h b/include/elf.h index b86aa52be..d71691eb3 100644 --- a/include/elf.h +++ b/include/elf.h @@ -268,6 +268,7 @@ typedef struct #define EM_ALTERA_NIOS2 113 /* Altera Nios II soft-core processor */ #define EM_CRX 114 /* National Semiconductor CRX */ #define EM_NUM 95 +#define EM_TI_C6000 140 /* If it is necessary to assign new unofficial EM_* values, please pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision @@ -3063,6 +3064,50 @@ typedef Elf32_Addr Elf32_Conflict; /* Keep this the last entry. */ #define R_XTENSA_NUM 50 +/* C6X specific relocs */ +#define R_C6000_NONE 0 +#define R_C6000_ABS32 1 +#define R_C6000_ABS16 2 +#define R_C6000_ABS8 3 +#define R_C6000_PCR_S21 4 +#define R_C6000_PCR_S12 5 +#define R_C6000_PCR_S10 6 +#define R_C6000_PCR_S7 7 +#define R_C6000_ABS_S16 8 +#define R_C6000_ABS_L16 9 +#define R_C6000_ABS_H16 10 +#define R_C6000_SBR_U15_B 11 +#define R_C6000_SBR_U15_H 12 +#define R_C6000_SBR_U15_W 13 +#define R_C6000_SBR_S16 14 +#define R_C6000_SBR_L16_B 15 +#define R_C6000_SBR_L16_H 16 +#define R_C6000_SBR_L16_W 17 +#define R_C6000_SBR_H16_B 18 +#define R_C6000_SBR_H16_H 19 +#define R_C6000_SBR_H16_W 20 +#define R_C6000_SBR_GOT_U15_W 21 +#define R_C6000_SBR_GOT_L16_W 22 +#define R_C6000_SBR_GOT_H16_W 23 +#define R_C6000_DSBT_INDEX 24 +#define R_C6000_PREL31 25 +#define R_C6000_COPY 26 +#define R_C6000_JUMP_SLOT 27 +#define R_C6000_SBR_GOT32 28 +#define R_C6000_PCR_H16 29 +#define R_C6000_PCR_L16 30 +#define R_C6000_ALIGN 253 +#define R_C6000_FPHEAD 254 +#define R_C6000_NOCMP 255 + +/* C6x specific values for the Dyn d_tag field. */ +#define DT_C6000_DSBT_BASE (DT_LOPROC + 0) +#define DT_C6000_DSBT_SIZE (DT_LOPROC + 1) +#define DT_C6000_PREEMPTMAP (DT_LOPROC + 2) +#define DT_C6000_DSBT_INDEX (DT_LOPROC + 3) + +#define DT_C6000_NUM 4 + #ifdef __cplusplus } #endif diff --git a/ldso/ldso/c6x/dl-debug.h b/ldso/ldso/c6x/dl-debug.h new file mode 100644 index 000000000..9c6edab0a --- /dev/null +++ b/ldso/ldso/c6x/dl-debug.h @@ -0,0 +1,49 @@ +/* C6X DSBT ELF shared library loader suppport. + * + * Copyright (C) 2010 Texas Instruments Incorporated + * Contributed by Mark Salter + * + * All rights reserved. + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +static const char *_dl_reltypes_tab[] = +{ + "R_C6000_NONE", /* 0 */ + "R_C6000_ABS32", + "R_C6000_ABS16", + "R_C6000_ABS8", + "R_C6000_PCR_S21", + "R_C6000_PCR_S12", /* 5 */ + "R_C6000_PCR_S10", + "R_C6000_PCR_S7", + "R_C6000_ABS_S16", + "R_C6000_ABS_L16", + "R_C6000_ABS_H16", /* 10 */ + "R_C6000_SBR_U15_B", + "R_C6000_SBR_U15_H", + "R_C6000_SBR_U15_W", + "R_C6000_SBR_S16", + "R_C6000_SBR_L16_B", /* 15 */ + "R_C6000_SBR_L16_H", + "R_C6000_SBR_L16_W", + "R_C6000_SBR_H16_B", + "R_C6000_SBR_H16_H", + "R_C6000_SBR_H16_W", /* 20 */ + "R_C6000_SBR_GOT_U15_W", + "R_C6000_SBR_GOT_L16_W", + "R_C6000_SBR_GOT_H16_W", + "R_C6000_DSBT_INDEX", + "R_C6000_PREL31", /* 25 */ + "R_C6000_COPY", + "R_C6000_JUMP_SLOT", + "R_C6000_SBR_GOT32", + "R_C6000_PCR_H16", + "R_C6000_PCR_L16", /* 30 */ +#if 0 + "R_C6000_ALIGN", /* 253 */ + "R_C6000_FPHEAD", /* 254 */ + "R_C6000_NOCMP", /* 255 */ +#endif +}; diff --git a/ldso/ldso/c6x/dl-inlines.h b/ldso/ldso/c6x/dl-inlines.h new file mode 100644 index 000000000..d8fb42c55 --- /dev/null +++ b/ldso/ldso/c6x/dl-inlines.h @@ -0,0 +1,91 @@ +/* Copyright (C) 2010 Texas Instruments Incorporated + * Contributed by Mark Salter + * + * Borrowed heavily from frv arch: + * Copyright (C) 2003, 2004 Red Hat, Inc. + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +/* Figure out whether the given address is in one of the mapped + segments. */ +static __always_inline int +__dl_addr_in_loadaddr (void *p, struct elf32_dsbt_loadaddr loadaddr) +{ + struct elf32_dsbt_loadmap *map = loadaddr.map; + int c; + + for (c = 0; c < map->nsegs; c++) + if ((void*)map->segs[c].addr <= p + && (char*)p < (char*)map->segs[c].addr + map->segs[c].p_memsz) + return 1; + + return 0; +} + +/* Figure out how many LOAD segments there are in the given headers, + and allocate a block for the load map big enough for them. + got_value will be properly initialized later on, with INIT_GOT. */ +static __always_inline int +__dl_init_loadaddr (struct elf32_dsbt_loadaddr *loadaddr, Elf32_Phdr *ppnt, + int pcnt) +{ + int count = 0, i; + size_t size; + + for (i = 0; i < pcnt; i++) + if (ppnt[i].p_type == PT_LOAD) + count++; + + size = sizeof (struct elf32_dsbt_loadmap) + + sizeof (struct elf32_dsbt_loadseg) * count; + loadaddr->map = _dl_malloc (size); + if (! loadaddr->map) + _dl_exit (-1); + + loadaddr->map->version = 0; + loadaddr->map->nsegs = 0; + + return count; +} + +/* Incrementally initialize a load map. */ +static __always_inline void +__dl_init_loadaddr_hdr (struct elf32_dsbt_loadaddr loadaddr, void *addr, + Elf32_Phdr *phdr, int maxsegs) +{ + struct elf32_dsbt_loadseg *segdata; + + if (loadaddr.map->nsegs == maxsegs) + _dl_exit (-1); + + segdata = &loadaddr.map->segs[loadaddr.map->nsegs++]; + segdata->addr = (Elf32_Addr) addr; + segdata->p_vaddr = phdr->p_vaddr; + segdata->p_memsz = phdr->p_memsz; + +#if defined (__SUPPORT_LD_DEBUG__) + { + if (_dl_debug) + _dl_dprintf(_dl_debug_file, "%i: mapped %x at %x, size %x\n", + loadaddr.map->nsegs-1, + segdata->p_vaddr, segdata->addr, segdata->p_memsz); + } +#endif +} + +static __always_inline void +__dl_loadaddr_unmap (struct elf32_dsbt_loadaddr loadaddr) +{ + int i; + + for (i = 0; i < loadaddr.map->nsegs; i++) + _dl_munmap ((void*)loadaddr.map->segs[i].addr, + loadaddr.map->segs[i].p_memsz); + + /* _dl_unmap is only called for dlopen()ed libraries, for which + calling free() is safe, or before we've completed the initial + relocation, in which case calling free() is probably pointless, + but still safe. */ + _dl_free (loadaddr.map); +} diff --git a/ldso/ldso/c6x/dl-startup.h b/ldso/ldso/c6x/dl-startup.h new file mode 100644 index 000000000..b9ea30409 --- /dev/null +++ b/ldso/ldso/c6x/dl-startup.h @@ -0,0 +1,122 @@ +/* Copyright (C) 2010 Texas Instruments Incorporated + * Contributed by Mark Salter + * + * Borrowed heavily from frv arch: + * Copyright (C) 2003 Red Hat, Inc. + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#undef DL_START +#define DL_START(X) \ +int \ +_dl_start (unsigned placeholder, \ + struct elf32_dsbt_loadmap *dl_boot_progmap, \ + struct elf32_dsbt_loadmap *dl_boot_ldsomap, \ + Elf32_Dyn *dl_boot_ldso_dyn_pointer, \ + X) + +/* + * On entry, the kernel has set up the stack thusly: + * + * 0(sp) pad0 + * 4(sp) pad1 + * 8(sp) argc + * 12(sp) argv[0] + * ... + * (4*(argc+3))(sp) NULL + * (4*(argc+4))(sp) envp[0] + * ... + * NULL + * + * Register values are unspecified, except: + * + * B4 --> executable loadmap address + * A6 --> interpreter loadmap address + * B6 --> dynamic section address + * B14 --> our DP setup by kernel + * + * NB: DSBT index is always 0 for the executable + * and 1 for the interpreter + */ + +__asm__(" .text\n" + ".globl _start\n" + "_start:\n" + " B .S2 _dl_start\n" + " STW .D2T2 B14, *+B14[1]\n" + " ADD .D1X B15,8,A8\n" + " ADDKPC .S2 ret_from_dl,B3,2\n" + "ret_from_dl:\n" + " B .S2X A4\n" + " || LDW .D2T2 *+B14[0],B14\n" + " ADDKPC .S2 __dl_fini,B0,0\n" + " MV .S1X B0,A4\n" + " NOP\n" + " NOP\n" + " NOP\n" + "__dl_fini:\n" + " LDW .D2T2 *+B14[1],B14\n" + " NOP 4\n" + " LDW .D2T1 *+B14($GOT(_dl_fini)), A0\n" + " NOP 4\n" + " BNOP .S2X A0, 5\n"); + +__asm__(" .text\n" + "__c6x_cache_sync:\n" + " MVK .S2 330,B0\n" + " SWE\n" + " NOP\n" + " BNOP .S2 B3,5\n" + " NOP\n" + " NOP\n" + " NOP\n" + " NOP\n" + "\n" +); + +/* + * Get a pointer to the argv array. On many platforms this can be just + * the address of the first argument, on other platforms we need to + * do something a little more subtle here. + */ +#define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long*) ARGS) + 1) + +struct elf32_dsbt_loadmap; + +/* + * Here is a macro to perform a relocation. This is only used when + * bootstrapping the dynamic loader. RELP is the relocation that we + * are performing, REL is the pointer to the address we are relocating. + * SYMBOL is the symbol involved in the relocation, and LOAD is the + * load address. + */ +#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD,SYMTAB) \ + switch(ELF32_R_TYPE((RELP)->r_info)){ \ + case R_C6000_ABS_L16: \ + { \ + unsigned int opcode = *(REL); \ + unsigned int v = (SYMBOL) + (RELP)->r_addend; \ + opcode &= ~0x7fff80; \ + opcode |= ((v & 0xffff) << 7); \ + *(REL) = opcode; \ + } \ + break; \ + case R_C6000_ABS_H16: \ + { \ + unsigned int opcode = *(REL); \ + unsigned int v = (SYMBOL) + (RELP)->r_addend; \ + opcode &= ~0x7fff80; \ + opcode |= ((v >> 9) & 0x7fff80); \ + *(REL) = opcode; \ + } \ + break; \ + case R_C6000_ABS32: \ + *(REL) = (SYMBOL) + (RELP)->r_addend; \ + break; \ + default: \ + _dl_exit(1); \ + } + +extern void __c6x_cache_sync(unsigned long start, unsigned long end) + attribute_hidden; diff --git a/ldso/ldso/c6x/dl-syscalls.h b/ldso/ldso/c6x/dl-syscalls.h new file mode 100644 index 000000000..9ff3358b0 --- /dev/null +++ b/ldso/ldso/c6x/dl-syscalls.h @@ -0,0 +1,25 @@ +/* Copyright (C) 2010 Texas Instruments Incorporated + * Contributed by Mark Salter + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +/* We can't use the real errno in ldso, since it has not yet + * been dynamicly linked in yet. */ +#include "sys/syscall.h" +extern int _dl_errno; +#undef __set_errno +#define __set_errno(X) {(_dl_errno) = (X);} +#include + +#ifdef __NR_pread64 +#define __NR___syscall_pread __NR_pread64 +static __always_inline _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf, + size_t, count, off_t, offset_hi, off_t, offset_lo); + +static __always_inline ssize_t +_dl_pread(int fd, void *buf, size_t count, off_t offset) +{ + return(__syscall_pread(fd,buf,count, offset, offset >> 31)); +} +#endif diff --git a/ldso/ldso/c6x/dl-sysdep.h b/ldso/ldso/c6x/dl-sysdep.h new file mode 100644 index 000000000..8f1b122d3 --- /dev/null +++ b/ldso/ldso/c6x/dl-sysdep.h @@ -0,0 +1,209 @@ +/* Copyright (C) 2010 Texas Instruments Incorporated + * Contributed by Mark Salter + * + * Borrowed heavily from frv arch: + * Copyright (C) 2003, 2004 Red Hat, Inc. + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include + +/* + * Define this if the system uses RELOCA. + */ +#define ELF_USES_RELOCA 1 + +/* JMPREL relocs are inside the DT_RELA table. */ +/* Actually looks like a linker bug sets DT_JMPREL anyway */ +#define ELF_MACHINE_PLTREL_OVERLAP 1 + +#undef DL_NO_COPY_RELOCS + +#define HAVE_DL_INLINES_H + + +/* + * Various assembly language/system dependent hacks that are required + * so that we can minimize the amount of platform specific code. + */ + +/* Initialization sequence for the GOT. */ +#define INIT_GOT(GOT_BASE,MODULE) \ +{ \ + GOT_BASE[0] = (unsigned long) _dl_linux_resolve; \ + GOT_BASE[1] = (unsigned long) MODULE; \ +} + +/* Here we define the magic numbers that this dynamic loader should accept */ +#define MAGIC1 EM_TI_C6000 +#undef MAGIC2 + +/* Used for error messages */ +#define ELF_TARGET "C6000" + +/* Need bootstrap relocations */ +#define ARCH_NEEDS_BOOTSTRAP_RELOCS + +struct elf_resolve; + +extern int _dl_linux_resolve(void) attribute_hidden; + +struct funcdesc_ht; +struct elf32_dsbt_loadaddr; + +/* We must force strings used early in the bootstrap into the text + segment (const data), such that they are referenced relative to + the DP register rather than through the GOT which will not have + been relocated when these are used. */ +#undef SEND_EARLY_STDERR +#define SEND_EARLY_STDERR(S) \ + do { static char __s[] = (S); SEND_STDERR (__s); } while (0) + +#define DL_LOADADDR_TYPE struct elf32_dsbt_loadaddr + +#define DL_RELOC_ADDR(LOADADDR, ADDR) \ + ((ElfW(Addr))__reloc_pointer ((void*)(ADDR), (LOADADDR).map)) + +#define DL_INIT_LOADADDR_BOOT(LOADADDR, BASEADDR) \ + do { \ + struct elf32_dsbt_loadmap *map; \ + map = dl_boot_ldsomap ?: dl_boot_progmap; \ + if (map->version != 0) { \ + SEND_EARLY_STDERR ("Invalid loadmap version number\n"); \ + _dl_exit(-1); \ + } \ + if (map->nsegs < 2) { \ + SEND_EARLY_STDERR ("Invalid segment count in loadmap\n"); \ + _dl_exit(-1); \ + } \ + (LOADADDR).map = map; \ + } while(0) + +#define DL_INIT_LOADADDR_PROG(LOADADDR, BASEADDR) \ + do { \ + if (dl_boot_progmap->version != 0) { \ + SEND_EARLY_STDERR ("Invalid loadmap version number\n"); \ + _dl_exit(-1); \ + } \ + if (dl_boot_progmap->nsegs < 2) { \ + SEND_EARLY_STDERR ("Invalid segment count in loadmap\n"); \ + _dl_exit(-1); \ + } \ + (LOADADDR).map = dl_boot_progmap; \ + } while(0) + +#define DL_INIT_LOADADDR_EXTRA_DECLS \ + int dl_init_loadaddr_load_count; + +#define DL_INIT_LOADADDR(LOADADDR, BASEADDR, PHDR, PHDRCNT) \ + (dl_init_loadaddr_load_count = \ + __dl_init_loadaddr (&(LOADADDR), (PHDR), (PHDRCNT))) + +#define DL_INIT_LOADADDR_HDR(LOADADDR, ADDR, PHDR) \ + (__dl_init_loadaddr_hdr ((LOADADDR), (ADDR), (PHDR), \ + dl_init_loadaddr_load_count)) + +#define DL_LOADADDR_UNMAP(LOADADDR, LEN) \ + (__dl_loadaddr_unmap ((LOADADDR))) + +#define DL_LIB_UNMAP(LIB, LEN) \ + (__dl_loadaddr_unmap ((LIB)->loadaddr)) + +#define DL_LOADADDR_BASE(LOADADDR) \ + ((LOADADDR).map->dsbt_table) + +#define DL_ADDR_IN_LOADADDR(ADDR, TPNT, TFROM) \ + (! (TFROM) && __dl_addr_in_loadaddr ((void*)(ADDR), (TPNT)->loadaddr)) + + +/* We only support loading DSBT relocatable shared libraries. + It probably wouldn't be too hard to support loading statically + linked executables that require relocation.*/ +#define DL_CHECK_LIB_TYPE(epnt, piclib, _dl_progname, libname) \ +do \ +{ \ + (piclib) = 2; \ +} \ +while (0) + +/* We want want to apply all relocations in the interpreter during + bootstrap. Because of this, we have to skip the interpreter + relocations in _dl_parse_relocation_information(), see + elfinterp.c. */ +#define DL_SKIP_BOOTSTRAP_RELOC(SYMTAB, INDEX, STRTAB) 0 + +#ifdef __NR_pread64 +#define _DL_PREAD(FD, BUF, SIZE, OFFSET) \ + (_dl_pread((FD), (BUF), (SIZE), (OFFSET))) +#endif + +#define DL_GET_READY_TO_RUN_EXTRA_PARMS \ + , struct elf32_dsbt_loadmap *dl_boot_progmap \ + , struct elf32_dsbt_loadmap *dl_boot_ldsomap +#define DL_GET_READY_TO_RUN_EXTRA_ARGS \ + , dl_boot_progmap \ + , dl_boot_ldsomap + + +/* + * Compute the GOT address. + * Also setup program and interpreter DSBT table entries. + */ +#define DL_BOOT_COMPUTE_GOT(GOT) \ + do { \ + unsigned long *ldso_dsbt, *prog_dsbt; \ + ldso_dsbt = dl_boot_ldsomap->dsbt_table; \ + prog_dsbt = dl_boot_progmap->dsbt_table; \ + ldso_dsbt[0] = prog_dsbt[0] = (unsigned long)prog_dsbt; \ + ldso_dsbt[1] = prog_dsbt[1] = (unsigned long)ldso_dsbt; \ + (GOT) = ldso_dsbt + dl_boot_ldsomap->dsbt_size; \ + } while(0) + +#define DL_BOOT_COMPUTE_DYN(dpnt, got, load_addr) \ + ((dpnt) = dl_boot_ldso_dyn_pointer) + + +#ifdef __USE_GNU +# include +#else +# define __USE_GNU +# include +# undef __USE_GNU +#endif + +static __always_inline Elf32_Addr +elf_machine_load_address (void) +{ + /* this is never an issue on DSBT systems */ + return 0; +} + +static __always_inline void +elf_machine_relative (DL_LOADADDR_TYPE load_off, const Elf32_Addr rel_addr, + Elf32_Word relative_count) +{ +} + +/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so + PLT entries should not be allowed to define the value. + ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one + of the main executable's symbols, as for a COPY reloc. */ +#define elf_machine_type_class(type) \ + ((((type) == R_C6000_JUMP_SLOT) * ELF_RTYPE_CLASS_PLT) \ + | (((type) == R_C6000_COPY) * ELF_RTYPE_CLASS_COPY)) + +#define ARCH_NUM 3 +#define DT_DSBT_BASE_IDX (DT_NUM + OS_NUM) +#define DT_DSBT_SIZE_IDX (DT_NUM + OS_NUM + 1) +#define DT_DSBT_INDEX_IDX (DT_NUM + OS_NUM + 2) + +#define ARCH_DYNAMIC_INFO(dpnt, dynamic, debug_addr) \ +do { \ +if (dpnt->d_tag == DT_C6000_DSBT_BASE) \ + dynamic[DT_DSBT_BASE_IDX] = dpnt->d_un.d_val; \ +else if (dpnt->d_tag == DT_C6000_DSBT_SIZE) \ + dynamic[DT_DSBT_SIZE_IDX] = dpnt->d_un.d_val; \ +else if (dpnt->d_tag == DT_C6000_DSBT_INDEX) \ + dynamic[DT_DSBT_INDEX_IDX] = dpnt->d_un.d_val; \ +} while (0) diff --git a/ldso/ldso/c6x/elfinterp.c b/ldso/ldso/c6x/elfinterp.c new file mode 100644 index 000000000..7c79171ce --- /dev/null +++ b/ldso/ldso/c6x/elfinterp.c @@ -0,0 +1,296 @@ +/* TI C64X DSBT ELF shared library loader suppport + * Copyright (C) 2010 Texas Instruments Incorporated + * Contributed by Mark Salter + * + * Borrowed heavily from frv arch: + * Copyright (C) 2003, 2004 Red Hat, Inc. + * Contributed by Alexandre Oliva + * Lots of code copied from ../i386/elfinterp.c, so: + * Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald, + * David Engel, Hongjiu Lu and Mitch D'Souza + * Copyright (C) 2001-2002, Erik Andersen + * All rights reserved. + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include + +/* Program to load an ELF binary on a linux system, and run it. + References to symbols in sharable libraries can be resolved by either + an ELF sharable library or a linux style of shared library. */ + +/* Disclaimer: I have never seen any AT&T source code for SVr4, nor have + I ever taken any courses on internals. This program was developed using + information available through the book "UNIX SYSTEM V RELEASE 4, + Programmers guide: Ansi C and Programming Support Tools", which did + a more than adequate job of explaining everything required to get this + working. */ + +extern void __c6x_cache_sync(unsigned long start, unsigned long end) + attribute_hidden; + +static void +_dl_c6x_flush_relocs(struct elf32_dsbt_loadmap *map) +{ + unsigned long s, e; + s = map->segs[0].addr; + e = s + map->segs[0].p_memsz; + __c6x_cache_sync(s, e); + s = map->segs[1].addr; + e = s + map->segs[1].p_memsz; + __c6x_cache_sync(s, e); +} + + +attribute_hidden +char * +_dl_linux_resolver (struct elf_resolve *tpnt, int reloc_entry) +{ + ELF_RELOC *this_reloc; + char *strtab; + ElfW(Sym) *symtab; + int symtab_index; + char *rel_addr; + char *new_addr; + char **got_addr; + char *symname; + + rel_addr = (char *)tpnt->dynamic_info[DT_JMPREL]; + + this_reloc = (ELF_RELOC *)(intptr_t)(rel_addr + reloc_entry); + symtab_index = ELF_R_SYM(this_reloc->r_info); + + symtab = (Elf32_Sym *) tpnt->dynamic_info[DT_SYMTAB]; + strtab = (char *) tpnt->dynamic_info[DT_STRTAB]; + symname = strtab + symtab[symtab_index].st_name; + + /* Address of GOT entry fix up */ + got_addr = (char **) DL_RELOC_ADDR(tpnt->loadaddr, this_reloc->r_offset); + + /* Get the address to be used to fill in the GOT entry. */ + new_addr = _dl_find_hash(symname, tpnt->symbol_scope, tpnt, + ELF_RTYPE_CLASS_PLT, NULL); + if (unlikely(!new_addr)) { + _dl_dprintf(2, "%s: can't resolve symbol '%s' in lib '%s'.\n", _dl_progname, symname, tpnt->libname); + _dl_exit(1); + } + + +#if defined (__SUPPORT_LD_DEBUG__) + if (_dl_debug_bindings) { + _dl_dprintf(_dl_debug_file, "\nresolve function: %s", symname); + if (_dl_debug_detail) + _dl_dprintf(_dl_debug_file, + "\n\tpatched %x ==> %x @ %x\n", + *got_addr, new_addr, got_addr); + } + if (!_dl_debug_nofixups) { + *got_addr = new_addr; + } +#else + *got_addr = new_addr; +#endif + + return new_addr; +} + +static int +_dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope, + unsigned long rel_addr, unsigned long rel_size, + int (*reloc_fnc) (struct elf_resolve *tpnt, struct dyn_elf *scope, + ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab)) +{ + unsigned int i; + char *strtab; + Elf32_Sym *symtab; + ELF_RELOC *rpnt; + int symtab_index; + + /* Now parse the relocation information */ + rpnt = (ELF_RELOC *)rel_addr; + rel_size = rel_size / sizeof(ELF_RELOC); + + symtab = (Elf32_Sym *)tpnt->dynamic_info[DT_SYMTAB]; + strtab = (char *)tpnt->dynamic_info[DT_STRTAB]; + + for (i = 0; i < rel_size; i++, rpnt++) { + int res; + + symtab_index = ELF32_R_SYM(rpnt->r_info); + debug_sym(symtab,strtab,symtab_index); + debug_reloc(symtab,strtab,rpnt); + + res = reloc_fnc (tpnt, scope, rpnt, symtab, strtab); + + if (res==0) continue; + + _dl_dprintf(2, "\n%s: ",_dl_progname); + + if (symtab_index) + _dl_dprintf(2, "symbol '%s': ", strtab + symtab[symtab_index].st_name); + + if (res <0) { + int reloc_type = ELF32_R_TYPE(rpnt->r_info); +#if defined (__SUPPORT_LD_DEBUG__) + _dl_dprintf(2, "can't handle reloc type %s\n ", _dl_reltypes(reloc_type)); +#else + _dl_dprintf(2, "can't handle reloc type %x\n", reloc_type); +#endif + _dl_exit(-res); + } else if (res >0) { + _dl_dprintf(2, "can't resolve symbol\n"); + return res; + } + } + _dl_c6x_flush_relocs(tpnt->loadaddr.map); + return 0; +} + +static int +_dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope, + ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab) +{ + int reloc_type; + int symtab_index; + char *symname; + unsigned long *reloc_addr; + unsigned long symbol_addr, sym_val; + long reloc_addend; + unsigned long old_val, new_val; + + reloc_addr = (unsigned long *)(intptr_t) + DL_RELOC_ADDR (tpnt->loadaddr, rpnt->r_offset); + + reloc_type = ELF32_R_TYPE(rpnt->r_info); + reloc_addend = rpnt->r_addend; + symtab_index = ELF32_R_SYM(rpnt->r_info); + symbol_addr = 0; + symname = strtab + symtab[symtab_index].st_name; + + if (ELF32_ST_BIND (symtab[symtab_index].st_info) == STB_LOCAL) { + symbol_addr = (unsigned long) + DL_RELOC_ADDR (tpnt->loadaddr, symtab[symtab_index].st_value); + } else { + symbol_addr = (unsigned long) _dl_find_hash(strtab + symtab[symtab_index].st_name, + scope, tpnt, elf_machine_type_class(reloc_type), + NULL); + /* + * We want to allow undefined references to weak symbols - this might + * have been intentional. We should not be linking local symbols + * here, so all bases should be covered. + */ + + if (!symbol_addr && ELF32_ST_BIND(symtab[symtab_index].st_info) != STB_WEAK) { + _dl_dprintf (2, "%s: can't resolve symbol '%s'\n", + _dl_progname, strtab + symtab[symtab_index].st_name); + _dl_exit (1); + } + } + old_val = *reloc_addr; + sym_val = symbol_addr + reloc_addend; + + switch (reloc_type) { + case R_C6000_NONE: + break; + case R_C6000_ABS32: + case R_C6000_JUMP_SLOT: + new_val = sym_val; + *reloc_addr = sym_val; + break; + case R_C6000_ABS_L16: + new_val = (old_val & ~0x007fff80) | ((sym_val & 0xffff) << 7); + *reloc_addr = new_val; + break; + case R_C6000_ABS_H16: + new_val = (old_val & ~0x007fff80) | ((sym_val >> 9) & 0x007fff80); + *reloc_addr = new_val; + break; + case R_C6000_PCR_S21: + new_val = sym_val - (((unsigned long)reloc_addr) & ~31); + *reloc_addr = (old_val & ~0x0fffff80) | (((new_val >> 2) & 0x1fffff) << 7); + break; + case R_C6000_COPY: + if (symbol_addr) { +#if defined (__SUPPORT_LD_DEBUG__) + if (_dl_debug_move) + _dl_dprintf(_dl_debug_file, + "\n%s move %d bytes from %x to %x", + symname, symtab[symtab_index].st_size, + symbol_addr, reloc_addr); +#endif + + _dl_memcpy((char *)reloc_addr, + (char *)symbol_addr, + symtab[symtab_index].st_size); + } + break; + default: + return -1; /*call _dl_exit(1) */ + } +#if defined (__SUPPORT_LD_DEBUG__) + if (_dl_debug_reloc && _dl_debug_detail && reloc_type != R_C6000_NONE) { + _dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x\n", old_val, new_val, reloc_addr); + } +#endif + return 0; +} + +static int +_dl_do_lazy_reloc (struct elf_resolve *tpnt, + struct dyn_elf *scope attribute_unused, + ELF_RELOC *rpnt, ElfW(Sym) *symtab attribute_unused, + char *strtab attribute_unused) +{ + int reloc_type; + unsigned long *reloc_addr; + unsigned long old_val; + + reloc_addr = (unsigned long *) DL_RELOC_ADDR(tpnt->loadaddr, rpnt->r_offset); + reloc_type = ELF_R_TYPE(rpnt->r_info); + + old_val = *reloc_addr; + + switch (reloc_type) { + case R_C6000_NONE: + break; + case R_C6000_JUMP_SLOT: + *reloc_addr = DL_RELOC_ADDR(tpnt->loadaddr, old_val); + break; + default: + return -1; + } + +#if defined (__SUPPORT_LD_DEBUG__) + if (_dl_debug_reloc && _dl_debug_detail) + _dl_dprintf(_dl_debug_file, "\n\tpatched: %x ==> %x @ %x\n", + old_val, *reloc_addr, reloc_addr); +#endif + + return 0; +} + +void +_dl_parse_lazy_relocation_information +(struct dyn_elf *rpnt, unsigned long rel_addr, unsigned long rel_size) +{ + _dl_parse(rpnt->dyn, NULL, rel_addr, rel_size, _dl_do_lazy_reloc); +} + +int +_dl_parse_relocation_information +(struct dyn_elf *rpnt, unsigned long rel_addr, unsigned long rel_size) +{ + return _dl_parse(rpnt->dyn, rpnt->dyn->symbol_scope, rel_addr, rel_size, _dl_do_reloc); +} + +/* We don't have copy relocs. */ +int +_dl_parse_copy_information +(struct dyn_elf *rpnt, + unsigned long rel_addr, + unsigned long rel_size) +{ + return 0; +} + diff --git a/ldso/ldso/c6x/resolve.S b/ldso/ldso/c6x/resolve.S new file mode 100644 index 000000000..ce3cbe793 --- /dev/null +++ b/ldso/ldso/c6x/resolve.S @@ -0,0 +1,68 @@ +;; +;; Copyright (C) 2010 Texas Instruments Incorporated +;; Mark Salter +;; +;; Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +;; + +;; The function below is tail-called by resolver stubs when a +;; lazily-bound function is called. It must preserve all +;; registers that could be used to pass arguments to the actual +;; function. + +;; _dl_linux_resolver() figures out where the jump symbol is +;; _really_ supposed to have jumped to and returns that to us. +;; Once we have that, we prepare to tail-call the actual +;; function, clean up after ourselves, restoring the original +;; arguments, then jump to the fixed up address. */ + +; resolver stub - called from PLT to resolve target address and update GOT +; +; B0 : reloc offset (bytes from DT_RELPLT) +; B1 : module pointer, loaded from GOT[1] +; DP : caller's DP +; A4,B4, etc: callee's arguments +; B3 : return address + + .text + .align 5 + .global _dl_linux_resolve +_dl_linux_resolve: + stw .d2t2 B14, *B15--[2] + stdw .d2t1 A15:A14, *B15-- + stdw .d2t2 B13:B12, *B15-- + stdw .d2t1 A13:A12, *B15-- + stdw .d2t2 B11:B10, *B15-- + stdw .d2t1 A11:A10, *B15-- + stdw .d2t2 B9:B8, *B15-- + stdw .d2t1 A9:A8, *B15-- + stdw .d2t2 B7:B6, *B15-- + stdw .d2t1 A7:A6, *B15-- + stdw .d2t2 B5:B4, *B15-- + stdw .d2t1 A5:A4, *B15-- + stdw .d2t2 B3:B2, *B15-- + stdw .d2t1 A3:A2, *B15-- + + ; call lookup routine + MV .S1X B1, A4 ; arg 1: module id +|| MV .S2 B0,B4 ; arg 2: reloc offset + CALLP .S2 _dl_linux_resolver, B3 ; returns &f in A4 + MV .S2X A4,B0 ; &f + + lddw .d2t1 *++B15, A3:A2 + lddw .d2t2 *++B15, B3:B2 + lddw .d2t1 *++B15, A5:A4 + lddw .d2t2 *++B15, B5:B4 + lddw .d2t1 *++B15, A7:A6 + lddw .d2t2 *++B15, B7:B6 + lddw .d2t1 *++B15, A9:A8 + lddw .d2t2 *++B15, B9:B8 + lddw .d2t1 *++B15, A11:A10 + lddw .d2t2 *++B15, B11:B10 + lddw .d2t1 *++B15, A13:A12 + lddw .d2t2 *++B15, B13:B12 + lddw .d2t1 *++B15, A15:A14 + ldw .d2t2 *++B15[2], B14 + + B .S2 B0 ; tail-call f + NOP 5 diff --git a/libc/sysdeps/linux/c6x/Makefile b/libc/sysdeps/linux/c6x/Makefile new file mode 100644 index 000000000..633c91f3e --- /dev/null +++ b/libc/sysdeps/linux/c6x/Makefile @@ -0,0 +1,13 @@ +# Makefile for uClibc +# +# Copyright (C) 2000-2005 Erik Andersen +# +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +# + +top_srcdir=../../../../ +top_builddir=../../../../ +all: objs +include $(top_builddir)Rules.mak +include Makefile.arch +include $(top_srcdir)Makerules diff --git a/libc/sysdeps/linux/c6x/Makefile.arch b/libc/sysdeps/linux/c6x/Makefile.arch new file mode 100644 index 000000000..3e8dace07 --- /dev/null +++ b/libc/sysdeps/linux/c6x/Makefile.arch @@ -0,0 +1,15 @@ +# Makefile for uClibc +# +# Copyright (C) 2000-2005 Erik Andersen +# +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +# + +CSRC := brk.c pread_write.c syscall.c prctl.c +#CSRC := + +SSRC := __longjmp.S bsd-_setjmp.S bsd-setjmp.S clone.S setjmp.S _vfork.S +#SSRC := + +# libc-nonshared-y += $(ARCH_OUT)/_syscall.os + diff --git a/libc/sysdeps/linux/c6x/__longjmp.S b/libc/sysdeps/linux/c6x/__longjmp.S new file mode 100644 index 000000000..b9d9f9d9c --- /dev/null +++ b/libc/sysdeps/linux/c6x/__longjmp.S @@ -0,0 +1,47 @@ + ; + ; Port of uClibc for TMS320C6000 DSP architecture + ; Copyright (C) 2004 Texas Instruments Incorporated + ; Author of TMS320C6000 port: Aurelien Jacquiot + ; + ; This program is free software; you can redistribute it and/or modify it + ; under the terms of the GNU Library General Public License as published by + ; the Free Software Foundation; either version 2 of the License, or (at your + ; option) any later version. + ; + ; This program is distributed in the hope that it will be useful, but WITHOUT + ; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + ; FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License + ; for more details. + ; + ; You should have received a copy of the GNU Library General Public License + ; along with this program; if not, write to the Free Software Foundation, + ; Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ; + + .global __longjmp + +__longjmp: + LDW .D1T1 *+A4(48),A3 ; return address + MV .D2X A4,B6 ; jmp_buf pointer +|| MV .D1 A4,A6 +|| MV .S2 B4,B2 ; val + + LDW .D1T1 *+A6(0),A10 +|| LDW .D2T2 *+B6(4),B10 +|| [B2] MV .S1X B4,A4 +||[!B2] MVK .L1 1,A4 ; return val or 1 + + LDW .D1T1 *+A6(8),A11 +|| LDW .D2T2 *+B6(12),B11 + LDW .D1T1 *+A6(16),A12 +|| LDW .D2T2 *+B6(20),B12 + LDW .D1T1 *+A6(24),A13 +|| LDW .D2T2 *+B6(28),B13 + LDW .D1T1 *+A6(32),A14 +|| LDW .D2T2 *+B6(36),B14 + LDW .D1T1 *+A6(40),A15 +|| LDW .D2T2 *+B6(44),B15 +|| B .S2X A3 + NOP 5 + +libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/c6x/_vfork.S b/libc/sysdeps/linux/c6x/_vfork.S new file mode 100644 index 000000000..20cb6a52f --- /dev/null +++ b/libc/sysdeps/linux/c6x/_vfork.S @@ -0,0 +1,55 @@ + ; + ; Port of uClibc for TMS320C6000 DSP architecture + ; Copyright (C) 2004 Texas Instruments Incorporated + ; Author of TMS320C6000 port: Aurelien Jacquiot + ; + ; This program is free software; you can redistribute it and/or modify it + ; under the terms of the GNU Library General Public License as published by + ; the Free Software Foundation; either version 2 of the License, or (at your + ; option) any later version. + ; + ; This program is distributed in the hope that it will be useful, but WITHOUT + ; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + ; FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License + ; for more details. + ; + ; You should have received a copy of the GNU Library General Public License + ; along with this program; if not, write to the Free Software Foundation, + ; Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ; + +; .import __errno_location + .global __vfork + +__vfork: + MVK .S2 190,B0 ; __NR_vfork +#ifndef _TMS320C6400_PLUS + MVC .S2 CSR,B2 + CLR .S2 B2,0,0,B1 + MVC .S2 B1,CSR + MVC .S2 IFR,B1 + SET .S2 B1,6,6,B1 + MVC .S2 B1,ISR + MVC .S2 B2,CSR + NOP +#else + SWE +#endif + + MVK .S2 -4096,B4 + CMPGTU .L2X B4,A4,B2 ; check error + [B2] BNOP .S2 B3,5 + + NEG .S1 A4,A4 + STW .D2T1 A4,*B15--[2] + STW .D2T2 B3,*+B15[1] + CALLP .S2 __errno_location,B3 + LDW .D2T2 *+B15[1],B3 + LDW .D2T1 *++B15[2],A5 + NOP 3 + BNOP .S2 B3,3 + STW .D1T1 A5,*A4 + MVK .L1 -1,A4 + +weak_alias(__vfork,vfork) +libc_hidden_weak(vfork) diff --git a/libc/sysdeps/linux/c6x/bits/byteswap.h b/libc/sysdeps/linux/c6x/bits/byteswap.h new file mode 100644 index 000000000..eff26d54e --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/byteswap.h @@ -0,0 +1,35 @@ +/* + * Port of uClibc for TMS320C6000 DSP architecture + * Copyright (C) 2004 Texas Instruments Incorporated + * Author of TMS320C6000 port: Aurelien Jacquiot + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License + * for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef _ASM_BITS_BYTESWAP_H +#define _ASM_BITS_BYTESWAP_H 1 + +#if !defined _BYTESWAP_H && !defined _NETINET_IN_H +# error "Never use directly; include instead." +#endif + +#ifdef __GNUC__ +#define __bswap_non_constant_32(x) __builtin_bswap32(x) +#endif + +#include + +#endif diff --git a/libc/sysdeps/linux/c6x/bits/elf-dsbt.h b/libc/sysdeps/linux/c6x/bits/elf-dsbt.h new file mode 100644 index 000000000..ff8b24bd7 --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/elf-dsbt.h @@ -0,0 +1,123 @@ +/* Copyright (C) 2010 Texas Instruments Incorporated + +Borrowed heavily from frv arch: +Copyright 2003, 2004 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public License as +published by the Free Software Foundation; either version 2.1 of the +License, or (at your option) any later version. + +In addition to the permissions in the GNU Lesser General Public +License, the Free Software Foundation gives you unlimited +permission to link the compiled version of this file with other +programs, and to distribute those programs without any restriction +coming from the use of this file. (The GNU Lesser General Public +License restrictions do apply in other respects; for example, they +cover modification of the file, and distribution when not linked +into another program.) + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#ifndef _BITS_ELF_DSBT_H +#define _BITS_ELF_DSBT_H + +/* These data structures are described in the DSBT ABI. + The kernel passes a process a memory map of logical + load segments. For PIC code to work, all code segments + must be combined into a single mapping while maintaining + their relationship to one another. The same is true for + RW data segments. + + Furthermore, + segment there is an elf32_dsbt_loadseg entry. A pointer to an + elf32_dsbt_loadmap is passed in GR8 at start-up, and a pointer to + an additional such map is passed in GR9 for the interpreter, when + there is one. */ + +#include + +/* This data structure represents a PT_LOAD segment. */ +struct elf32_dsbt_loadseg +{ + /* Core address to which the segment is mapped. */ + Elf32_Addr addr; + /* VMA recorded in the program header. */ + Elf32_Addr p_vaddr; + /* Size of this segment in memory. */ + Elf32_Word p_memsz; +}; + +struct elf32_dsbt_loadmap { + /* Protocol version number, must be zero. */ + Elf32_Word version; + + /* Pointer to DSBT */ + unsigned *dsbt_table; + unsigned dsbt_size; + unsigned dsbt_index; + + /* number of segments */ + Elf32_Word nsegs; + + /* The actual memory map. */ + struct elf32_dsbt_loadseg segs[0]; +}; + +struct elf32_dsbt_loadaddr { + struct elf32_dsbt_loadmap *map; +}; + + +/* Map a pointer's VMA to its corresponding address according to the + load map. */ +static __always_inline void * +__reloc_pointer (void *p, + const struct elf32_dsbt_loadmap *map) +{ + int c; + +#if 0 + if (map->version != 0) + /* Crash. */ + ((void(*)())0)(); +#endif + + /* No special provision is made for NULL. We don't want NULL + addresses to go through relocation, so they shouldn't be in + .rofixup sections, and, if they're present in dynamic + relocations, they shall be mapped to the NULL address without + undergoing relocations. */ + + for (c = 0; c < map->nsegs; c++) + { + unsigned long offset = p - (void*)map->segs[c].p_vaddr; + /* We only check for one-past-the-end for the second segment, + assumed to be the data segment, because other cases are + ambiguous in the absence of padding between segments, and + rofixup already serves as padding between text and data. + Unfortunately, unless we special-case the second segment, + we fail to relocate the _end symbol. */ + if (offset < map->segs[c].p_memsz + || (offset == map->segs[c].p_memsz && c == 1)) + return (char*)map->segs[c].addr + offset; + } + + /* We might want to crash instead. */ + return (void*)-1; +} + +# define __RELOC_POINTER(ptr, loadaddr) \ + (__reloc_pointer ((void*)(ptr), \ + (loadaddr).map)) + +#endif /* _BITS_ELF_DSBT_H */ diff --git a/libc/sysdeps/linux/c6x/bits/endian.h b/libc/sysdeps/linux/c6x/bits/endian.h new file mode 100644 index 000000000..7297f9e2e --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/endian.h @@ -0,0 +1,11 @@ +/* c6x is little-endian by default. */ + +#ifndef _ENDIAN_H +# error "Never use directly; include instead." +#endif + +#ifdef _BIG_ENDIAN +#define __BYTE_ORDER __BIG_ENDIAN +#else +#define __BYTE_ORDER __LITTLE_ENDIAN +#endif diff --git a/libc/sysdeps/linux/c6x/bits/fcntl.h b/libc/sysdeps/linux/c6x/bits/fcntl.h new file mode 100644 index 000000000..6c0d5647f --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/fcntl.h @@ -0,0 +1,235 @@ +/* O_*, F_*, FD_* bit values for Linux. + Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _FCNTL_H +# error "Never use directly; include instead." +#endif + + +#include +#ifdef __USE_GNU +# include +#endif + +/* open/fcntl - O_SYNC is only implemented on blocks devices and on files + located on an ext2 file system */ +#define O_ACCMODE 0003 +#define O_RDONLY 00 +#define O_WRONLY 01 +#define O_RDWR 02 +#define O_CREAT 0100 /* not fcntl */ +#define O_EXCL 0200 /* not fcntl */ +#define O_NOCTTY 0400 /* not fcntl */ +#define O_TRUNC 01000 /* not fcntl */ +#define O_APPEND 02000 +#define O_NONBLOCK 04000 +#define O_NDELAY O_NONBLOCK +#define O_SYNC 010000 +#define O_FSYNC O_SYNC +#define O_ASYNC 020000 +#define O_DIRECT 040000 + +#ifdef __USE_GNU +# define O_LARGEFILE 0100000 +# define O_DIRECTORY 0200000 /* Must be a directory. */ +# define O_NOFOLLOW 0400000 /* don't follow links */ +# define O_NOATIME 01000000 +# define O_CLOEXEC 02000000/* set close on exec */ +#endif + +/* For now Linux has synchronisity options for data and read operations. + We define the symbols here but let them do the same as O_SYNC since + this is a superset. */ +#if defined __USE_POSIX199309 || defined __USE_UNIX98 +# define O_DSYNC O_SYNC /* Synchronize data. */ +# define O_RSYNC O_SYNC /* Synchronize read operations. */ +#endif + +#ifdef __USE_LARGEFILE64 +# define O_LARGEFILE 0100000 +#endif + +/* Values for the second argument to `fcntl'. */ +#define F_DUPFD 0 /* Duplicate file descriptor. */ +#define F_GETFD 1 /* Get file descriptor flags. */ +#define F_SETFD 2 /* Set file descriptor flags. */ +#define F_GETFL 3 /* Get file status flags. */ +#define F_SETFL 4 /* Set file status flags. */ +#ifndef __USE_FILE_OFFSET64 +# define F_GETLK 5 /* Get record locking info. */ +# define F_SETLK 6 /* Set record locking info (non-blocking). */ +# define F_SETLKW 7 /* Set record locking info (blocking). */ +#else +# define F_GETLK F_GETLK64 /* Get record locking info. */ +# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/ +# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */ +#endif +#define F_GETLK64 12 /* Get record locking info. */ +#define F_SETLK64 13 /* Set record locking info (non-blocking). */ +#define F_SETLKW64 14 /* Set record locking info (blocking). */ + +#if defined __USE_BSD || defined __USE_XOPEN2K +# define F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */ +# define F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */ +#endif + +#ifdef __USE_GNU +# define F_SETSIG 10 /* Set number of signal to be sent. */ +# define F_GETSIG 11 /* Get number of signal to be sent. */ +#endif + +#ifdef __USE_GNU +# define F_SETLEASE 1024 /* Set a lease. */ +# define F_GETLEASE 1025 /* Enquire what lease is active. */ +# define F_NOTIFY 1026 /* Request notfications on a directory. */ +#endif + +/* For F_[GET|SET]FL. */ +#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ + +/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */ +#define F_RDLCK 0 /* Read lock. */ +#define F_WRLCK 1 /* Write lock. */ +#define F_UNLCK 2 /* Remove lock. */ + +/* For old implementation of bsd flock(). */ +#define F_EXLCK 4 /* or 3 */ +#define F_SHLCK 8 /* or 4 */ + +#ifdef __USE_BSD +/* Operations for bsd flock(), also used by the kernel implementation. */ +# define LOCK_SH 1 /* shared lock */ +# define LOCK_EX 2 /* exclusive lock */ +# define LOCK_NB 4 /* or'd with one of the above to prevent + blocking */ +# define LOCK_UN 8 /* remove lock */ +#endif + +#ifdef __USE_GNU +# define LOCK_MAND 32 /* This is a mandatory flock: */ +# define LOCK_READ 64 /* ... which allows concurrent read operations. */ +# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */ +# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */ +#endif + +#ifdef __USE_GNU +/* Types of directory notifications that may be requested with F_NOTIFY. */ +# define DN_ACCESS 0x00000001 /* File accessed. */ +# define DN_MODIFY 0x00000002 /* File modified. */ +# define DN_CREATE 0x00000004 /* File created. */ +# define DN_DELETE 0x00000008 /* File removed. */ +# define DN_RENAME 0x00000010 /* File renamed. */ +# define DN_ATTRIB 0x00000020 /* File changed attibutes. */ +# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */ +#endif + +struct flock + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ +#ifndef __USE_FILE_OFFSET64 + __off_t l_start; /* Offset where the lock begins. */ + __off_t l_len; /* Size of the locked area; zero means until EOF. */ +#else + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ +#endif + __pid_t l_pid; /* Process holding the lock. */ + }; + +#ifdef __USE_LARGEFILE64 +struct flock64 + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ + __pid_t l_pid; /* Process holding the lock. */ + }; +#endif + +/* Define some more compatibility macros to be backward compatible with + BSD systems which did not managed to hide these kernel macros. */ +#ifdef __USE_BSD +# define FAPPEND O_APPEND +# define FFSYNC O_FSYNC +# define FASYNC O_ASYNC +# define FNONBLOCK O_NONBLOCK +# define FNDELAY O_NDELAY +#endif /* Use BSD. */ + +/* Advise to `posix_fadvise'. */ +#ifdef __USE_XOPEN2K +# define POSIX_FADV_NORMAL 0 /* No further special treatment. */ +# define POSIX_FADV_RANDOM 1 /* Expect random page references. */ +# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */ +# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */ +# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */ +# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ +#endif + +#if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__ +/* Flags for SYNC_FILE_RANGE. */ +# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages + in the range before performing the + write. */ +# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those + dirty pages in the range which are + not presently under writeback. */ +# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in + the range after performing the + write. */ + +/* Flags for SPLICE and VMSPLICE. */ +# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */ +# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing + (but we may still block on the fd + we splice from/to). */ +# define SPLICE_F_MORE 4 /* Expect more data. */ +# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */ +#endif + +__BEGIN_DECLS + +#if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__ + +/* Provide kernel hint to read ahead. */ +extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) + __THROW; + + +/* Selective file content synch'ing. */ +extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, + unsigned int __flags); + +/* Splice address range into a pipe. */ +extern ssize_t vmsplice (int __fdout, const struct iovec *__iov, + size_t __count, unsigned int __flags); + +/* Splice two files together. */ +extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout, + __off64_t *__offout, size_t __len, + unsigned int __flags); + +/* In-kernel implementation of tee for pipe buffers. */ +extern ssize_t tee (int __fdin, int __fdout, size_t __len, + unsigned int __flags); + +#endif +__END_DECLS diff --git a/libc/sysdeps/linux/c6x/bits/kernel_stat.h b/libc/sysdeps/linux/c6x/bits/kernel_stat.h new file mode 100644 index 000000000..9c0bfa640 --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/kernel_stat.h @@ -0,0 +1,52 @@ +#ifndef _BITS_STAT_STRUCT_H +#define _BITS_STAT_STRUCT_H + +/* This file provides whatever this particular arch's kernel thinks + * struct kernel_stat should look like... It turns out each arch has a + * different opinion on the subject... */ + +struct kernel_stat { + unsigned short st_dev; + unsigned short __pad1; + unsigned long st_ino; + unsigned short st_mode; + unsigned short st_nlink; + unsigned short st_uid; + unsigned short st_gid; + unsigned short st_rdev; + unsigned short __pad2; + unsigned long st_size; + unsigned long st_blksize; + unsigned long st_blocks; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + unsigned long __unused4; + unsigned long __unused5; +}; + +struct kernel_stat64 { + unsigned char __pad0[6]; + unsigned short st_dev; + unsigned char __pad1[2]; +#define _HAVE_STAT64___ST_INO + unsigned long __st_ino; + unsigned int st_mode; + unsigned int st_nlink; + unsigned long st_uid; + unsigned long st_gid; + unsigned char __pad2[6]; + unsigned short st_rdev; + unsigned char __pad3[2]; + __off64_t st_size; + unsigned long st_blksize; + unsigned long __pad4; /* future possible st_blocks high bits */ + unsigned long st_blocks; /* Number 512-byte blocks allocated. */ + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + __off64_t st_ino; +}; + +#endif /* _BITS_STAT_STRUCT_H */ + diff --git a/libc/sysdeps/linux/c6x/bits/kernel_types.h b/libc/sysdeps/linux/c6x/bits/kernel_types.h new file mode 100644 index 000000000..5dbd2c226 --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/kernel_types.h @@ -0,0 +1,46 @@ +/* Note that we use the exact same include guard #define names + * as asm/posix_types.h. This will avoid gratuitous conflicts + * with the posix_types.h kernel header, and will ensure that + * our private content, and not the kernel header, will win. + * -Erik + */ +#ifndef __ASM_GENERIC_POSIX_TYPES_H +#define __ASM_GENERIC_POSIX_TYPES_H + +typedef unsigned short __kernel_dev_t; +typedef unsigned long __kernel_ino_t; +typedef unsigned short __kernel_mode_t; +typedef unsigned short __kernel_nlink_t; +typedef long __kernel_off_t; +typedef int __kernel_pid_t; +typedef unsigned short __kernel_ipc_pid_t; +typedef unsigned short __kernel_uid_t; +typedef unsigned short __kernel_gid_t; +typedef unsigned int __kernel_size_t; +typedef int __kernel_ssize_t; +typedef int __kernel_ptrdiff_t; +typedef long __kernel_time_t; +typedef long __kernel_suseconds_t; +typedef long __kernel_clock_t; +typedef int __kernel_timer_t; +typedef int __kernel_clockid_t; +typedef int __kernel_daddr_t; +typedef char * __kernel_caddr_t; +typedef unsigned short __kernel_uid16_t; +typedef unsigned short __kernel_gid16_t; +typedef unsigned int __kernel_uid32_t; +typedef unsigned int __kernel_gid32_t; +typedef unsigned short __kernel_old_uid_t; +typedef unsigned short __kernel_old_gid_t; +typedef unsigned short __kernel_old_dev_t; +typedef long long __kernel_loff_t; + +typedef struct { +#ifdef __USE_ALL + int val[2]; +#else + int __val[2]; +#endif +} __kernel_fsid_t; + +#endif /* __ASM_GENERIC_POSIX_TYPES_H */ diff --git a/libc/sysdeps/linux/c6x/bits/mathdef.h b/libc/sysdeps/linux/c6x/bits/mathdef.h new file mode 100644 index 000000000..df12adf03 --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/mathdef.h @@ -0,0 +1,39 @@ +/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#if !defined _MATH_H && !defined _COMPLEX_H +# error "Never use directly; include instead" +#endif + +#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF +# define _MATH_H_MATHDEF 1 + +typedef float float_t; +typedef double double_t; + +/* The values returned by `ilogb' for 0 and NaN respectively. */ +# define FP_ILOGB0 (-2147483647 - 1) +# define FP_ILOGBNAN (2147483647) + +#endif /* ISO C99 */ + +#ifndef __NO_LONG_DOUBLE_MATH +/* Signal that we do not really have a `long double'. This disables the + declaration of all the `long double' function variants. */ +# define __NO_LONG_DOUBLE_MATH 1 +#endif diff --git a/libc/sysdeps/linux/c6x/bits/nan.h b/libc/sysdeps/linux/c6x/bits/nan.h new file mode 100644 index 000000000..85225da9f --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/nan.h @@ -0,0 +1,57 @@ +/* `NAN' constant for IEEE 754 machines. + Copyright (C) 1992,1996,1997,1999,2004,2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _MATH_H +# error "Never use directly; include instead." +#endif + +/* IEEE Not A Number. */ + +/* + * Copied from the common code and modified for TI tool wrapper. + * Copyright (C) 2010 Texas Instruments Incorporated + */ + +#if __GNUC_PREREQ(3,3) + +# define NAN (__builtin_nanf ("")) + +#elif defined __GNUC__ && ! defined __TI_TOOL_WRAPPER__ + +# define NAN \ + (__extension__ \ + ((union { unsigned __l __attribute__ ((__mode__ (__SI__))); float __d; }) \ + { __l: 0x7fc00000UL }).__d) + +#else + +# include + +# if __BYTE_ORDER == __BIG_ENDIAN +# define __nan_bytes { 0x7f, 0xc0, 0, 0 } +# endif +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define __nan_bytes { 0, 0, 0xc0, 0x7f } +# endif + +static union { unsigned char __c[4]; float __d; } __nan_union + = { __nan_bytes }; +# define NAN (__nan_union.__d) + +#endif /* GCC. */ diff --git a/libc/sysdeps/linux/c6x/bits/poll.h b/libc/sysdeps/linux/c6x/bits/poll.h new file mode 100644 index 000000000..f7a739315 --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/poll.h @@ -0,0 +1,43 @@ +/* Copyright (C) 1997, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_POLL_H +# error "Never use directly; include instead." +#endif + +/* Event types that can be polled for. These bits may be set in `events' + to indicate the interesting event types; they will appear in `revents' + to indicate the status of the file descriptor. */ +#define POLLIN 0x001 /* There is data to read. */ +#define POLLPRI 0x002 /* There is urgent data to read. */ +#define POLLOUT 0x004 /* Writing now will not block. */ + +#ifdef __USE_XOPEN +/* These values are defined in XPG4.2. */ +# define POLLRDNORM 0x040 /* Normal data may be read. */ +# define POLLRDBAND 0x080 /* Priority data may be read. */ +# define POLLWRNORM POLLOUT /* Writing now will not block. */ +# define POLLWRBAND 0x100 /* Priority data may be written. */ +#endif + +/* Event types always implicitly polled for. These bits need not be set in + `events', but they will appear in `revents' to indicate the status of + the file descriptor. */ +#define POLLERR 0x008 /* Error condition. */ +#define POLLHUP 0x010 /* Hung up. */ +#define POLLNVAL 0x020 /* Invalid polling request. */ diff --git a/libc/sysdeps/linux/c6x/bits/resource.h b/libc/sysdeps/linux/c6x/bits/resource.h new file mode 100644 index 000000000..57d17821e --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/resource.h @@ -0,0 +1,209 @@ +/* Bit values & structures for resource limits. Linux/m68k version. + Copyright (C) 1994,1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_RESOURCE_H +# error "Never use directly; include instead." +#endif + +#include + +/* Transmute defines to enumerations. The macro re-definitions are + necessary because some programs want to test for operating system + features with #ifdef RUSAGE_SELF. In ISO C the reflexive + definition is a no-op. */ + +/* Kinds of resource limit. */ +enum __rlimit_resource +{ + /* Per-process CPU limit, in seconds. */ + RLIMIT_CPU = 0, +#define RLIMIT_CPU RLIMIT_CPU + + /* Largest file that can be created, in bytes. */ + RLIMIT_FSIZE = 1, +#define RLIMIT_FSIZE RLIMIT_FSIZE + + /* Maximum size of data segment, in bytes. */ + RLIMIT_DATA = 2, +#define RLIMIT_DATA RLIMIT_DATA + + /* Maximum size of stack segment, in bytes. */ + RLIMIT_STACK = 3, +#define RLIMIT_STACK RLIMIT_STACK + + /* Largest core file that can be created, in bytes. */ + RLIMIT_CORE = 4, +#define RLIMIT_CORE RLIMIT_CORE + + /* Largest resident set size, in bytes. + This affects swapping; processes that are exceeding their + resident set size will be more likely to have physical memory + taken from them. */ + RLIMIT_RSS = 5, +#define RLIMIT_RSS RLIMIT_RSS + + /* Number of open files. */ + RLIMIT_NOFILE = 7, + RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same. */ +#define RLIMIT_NOFILE RLIMIT_NOFILE +#define RLIMIT_OFILE RLIMIT_OFILE + + /* Address space limit. */ + RLIMIT_AS = 9, +#define RLIMIT_AS RLIMIT_AS + + /* Number of processes. */ + RLIMIT_NPROC = 6, +#define RLIMIT_NPROC RLIMIT_NPROC + + /* Locked-in-memory address space. */ + RLIMIT_MEMLOCK = 8, +#define RLIMIT_MEMLOCK RLIMIT_MEMLOCK + + /* Maximum number of file locks. */ + RLIMIT_LOCKS = 10, +#define RLIMIT_LOCKS RLIMIT_LOCKS + + RLIMIT_NLIMITS = 11, + RLIM_NLIMITS = RLIMIT_NLIMITS +#define RLIMIT_NLIMITS RLIMIT_NLIMITS +#define RLIM_NLIMITS RLIM_NLIMITS +}; + +/* Value to indicate that there is no limit. */ +#ifndef __USE_FILE_OFFSET64 +# define RLIM_INFINITY ((unsigned long)(~0UL)) +#else +# define RLIM_INFINITY 0xffffffffffffffffuLL +#endif + +#ifdef __USE_LARGEFILE64 +# define RLIM64_INFINITY 0xffffffffffffffffuLL +#endif + +/* We can represent all limits. */ +#define RLIM_SAVED_MAX RLIM_INFINITY +#define RLIM_SAVED_CUR RLIM_INFINITY + + +/* Type for resource quantity measurement. */ +#ifndef __USE_FILE_OFFSET64 +typedef __rlim_t rlim_t; +#else +typedef __rlim64_t rlim_t; +#endif +#ifdef __USE_LARGEFILE64 +typedef __rlim64_t rlim64_t; +#endif + +struct rlimit + { + /* The current (soft) limit. */ + rlim_t rlim_cur; + /* The hard limit. */ + rlim_t rlim_max; + }; + +#ifdef __USE_LARGEFILE64 +struct rlimit64 + { + /* The current (soft) limit. */ + rlim64_t rlim_cur; + /* The hard limit. */ + rlim64_t rlim_max; + }; +#endif + +/* Whose usage statistics do you want? */ +enum __rusage_who +{ + /* The calling process. */ + RUSAGE_SELF = 0, +#define RUSAGE_SELF RUSAGE_SELF + + /* All of its terminated child processes. */ + RUSAGE_CHILDREN = -1, +#define RUSAGE_CHILDREN RUSAGE_CHILDREN + + /* Both. */ + RUSAGE_BOTH = -2 +#define RUSAGE_BOTH RUSAGE_BOTH +}; + +#define __need_timeval +#include /* For `struct timeval'. */ + +/* Structure which says how much of each resource has been used. */ +struct rusage + { + /* Total amount of user time used. */ + struct timeval ru_utime; + /* Total amount of system time used. */ + struct timeval ru_stime; + /* Maximum resident set size (in kilobytes). */ + long ru_maxrss; + /* Amount of sharing of text segment memory + with other processes (kilobyte-seconds). */ + long ru_ixrss; + /* Amount of data segment memory used (kilobyte-seconds). */ + long ru_idrss; + /* Amount of stack memory used (kilobyte-seconds). */ + long ru_isrss; + /* Number of soft page faults (i.e. those serviced by reclaiming + a page from the list of pages awaiting reallocation. */ + long ru_minflt; + /* Number of hard page faults (i.e. those that required I/O). */ + long ru_majflt; + /* Number of times a process was swapped out of physical memory. */ + long ru_nswap; + /* Number of input operations via the file system. Note: This + and `ru_oublock' do not include operations with the cache. */ + long ru_inblock; + /* Number of output operations via the file system. */ + long ru_oublock; + /* Number of IPC messages sent. */ + long ru_msgsnd; + /* Number of IPC messages received. */ + long ru_msgrcv; + /* Number of signals delivered. */ + long ru_nsignals; + /* Number of voluntary context switches, i.e. because the process + gave up the process before it had to (usually to wait for some + resource to be available). */ + long ru_nvcsw; + /* Number of involuntary context switches, i.e. a higher priority process + became runnable or the current process used up its time slice. */ + long ru_nivcsw; + }; + +/* Priority limits. */ +#define PRIO_MIN -20 /* Minimum priority a process can have. */ +#define PRIO_MAX 20 /* Maximum priority a process can have. */ + +/* The type of the WHICH argument to `getpriority' and `setpriority', + indicating what flavor of entity the WHO argument specifies. */ +enum __priority_which +{ + PRIO_PROCESS = 0, /* WHO is a process ID. */ +#define PRIO_PROCESS PRIO_PROCESS + PRIO_PGRP = 1, /* WHO is a process group ID. */ +#define PRIO_PGRP PRIO_PGRP + PRIO_USER = 2 /* WHO is a user ID. */ +#define PRIO_USER PRIO_USER +}; diff --git a/libc/sysdeps/linux/c6x/bits/setjmp.h b/libc/sysdeps/linux/c6x/bits/setjmp.h new file mode 100644 index 000000000..259e23b34 --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/setjmp.h @@ -0,0 +1,39 @@ +/* + * Port of uClibc for TMS320C6000 DSP architecture + * Copyright (C) 2004 Texas Instruments Incorporated + * Author of TMS320C6000 port: Aurelien Jacquiot + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License + * for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef _SETJMP_H +# error "Never include directly; use instead." +#endif + +typedef struct { + unsigned long __regs[12]; /* save A10,B10... A15,B15*/ + unsigned long __pc; /* the return address */ +} __jmp_buf[1]; + +/* the stack pointer (B15) */ +#define JP_SP 11 + +/* Test if longjmp to JMPBUF would unwind the frame + containing a local variable at ADDRESS. */ +#define _JMPBUF_UNWINDS(jmpbuf, address) \ + ((void *) (address) < (void *) (jmpbuf)->__regs[JP_SP]) + + diff --git a/libc/sysdeps/linux/c6x/bits/sigcontextinfo.h b/libc/sysdeps/linux/c6x/bits/sigcontextinfo.h new file mode 100644 index 000000000..b7e08cfc9 --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/sigcontextinfo.h @@ -0,0 +1,26 @@ +/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Andreas Schwab , 1998. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define SIGCONTEXT int _code, struct sigcontext * +#define SIGCONTEXT_EXTRA_ARGS _code, +#define GET_PC(ctx) ((void *) (ctx)->sc_pc) +#define GET_FRAME(ctx) ((void *) __builtin_frame_address (1)) +#define GET_STACK(ctx) ((void *) (ctx)->sc_usp) +#define CALL_SIGHANDLER(handler, signo, ctx) \ + (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx)) diff --git a/libc/sysdeps/linux/c6x/bits/stackinfo.h b/libc/sysdeps/linux/c6x/bits/stackinfo.h new file mode 100644 index 000000000..9dbf06ae6 --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/stackinfo.h @@ -0,0 +1,28 @@ +/* Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This file contains a bit of information about the stack allocation + of the processor. */ + +#ifndef _STACKINFO_H +#define _STACKINFO_H 1 + +/* On c6x the stack grows down. */ +#define _STACK_GROWS_DOWN 1 + +#endif /* stackinfo.h */ diff --git a/libc/sysdeps/linux/c6x/bits/stat.h b/libc/sysdeps/linux/c6x/bits/stat.h new file mode 100644 index 000000000..eba31245d --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/stat.h @@ -0,0 +1,174 @@ +/* Copyright (C) 1992,95,96,97,98,99,2000,2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_STAT_H +# error "Never include directly; use instead." +#endif + +/* Versions of the `struct stat' data structure. */ +#define _STAT_VER_LINUX_OLD 1 +#define _STAT_VER_KERNEL 1 +#define _STAT_VER_SVR4 2 +#define _STAT_VER_LINUX 3 +#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ + +/* Versions of the `xmknod' interface. */ +#define _MKNOD_VER_LINUX 1 +#define _MKNOD_VER_SVR4 2 +#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ + + +struct stat + { + __dev_t st_dev; /* Device. */ + unsigned short int __pad1; +#ifndef __USE_FILE_OFFSET64 + __ino_t st_ino; /* File serial number. */ +#else + __ino_t __st_ino; /* 32bit file serial number. */ +#endif + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + __dev_t st_rdev; /* Device number, if device. */ + unsigned short int __pad2; +#ifndef __USE_FILE_OFFSET64 + __off_t st_size; /* Size of file, in bytes. */ +#else + __off64_t st_size; /* Size of file, in bytes. */ +#endif + __blksize_t st_blksize; /* Optimal block size for I/O. */ + +#ifndef __USE_FILE_OFFSET64 + __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ +#else + __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ +#endif +#ifdef __USE_MISC + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +#else + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ +#endif +#ifndef __USE_FILE_OFFSET64 + unsigned long __unused4; + unsigned long __unused5; +#else + __ino64_t st_ino; /* File serial number. */ +#endif + }; + +#ifdef __USE_LARGEFILE64 +struct stat64 + { + __dev_t st_dev; /* Device. */ + +#if __WORDSIZE == 64 + __ino64_t st_ino; /* File serial number. */ + __nlink_t st_nlink; /* Link count. */ + __mode_t st_mode; /* File mode. */ +#else + unsigned int __pad1; + __ino_t __st_ino; /* 32bit file serial number. */ + __mode_t st_mode; /* File mode. */ + __nlink_t st_nlink; /* Link count. */ +#endif + __uid_t st_uid; /* User ID of the file's owner. */ + __gid_t st_gid; /* Group ID of the file's group.*/ + __dev_t st_rdev; /* Device number, if device. */ + unsigned short int __pad2; + __off64_t st_size; /* Size of file, in bytes. */ + __blksize_t st_blksize; /* Optimal block size for I/O. */ + + __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ +#ifdef __USE_MISC + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +#else + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ +#endif +#if __WORDSIZE == 64 + long int __unused[3]; +#else + __ino64_t st_ino; /* File serial number. */ +#endif + }; +#endif + +/* Tell code we have these members. */ +#define _STATBUF_ST_BLKSIZE +#define _STATBUF_ST_RDEV + +/* Encoding of the file mode. */ + +#define __S_IFMT 0170000 /* These bits determine file type. */ + +/* File types. */ +#define __S_IFDIR 0040000 /* Directory. */ +#define __S_IFCHR 0020000 /* Character device. */ +#define __S_IFBLK 0060000 /* Block device. */ +#define __S_IFREG 0100000 /* Regular file. */ +#define __S_IFIFO 0010000 /* FIFO. */ +#define __S_IFLNK 0120000 /* Symbolic link. */ +#define __S_IFSOCK 0140000 /* Socket. */ + +/* POSIX.1b objects. Note that these macros always evaluate to zero. But + they do it by enforcing the correct use of the macros. */ +#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) +#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) +#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) + +/* Protection bits. */ + +#define __S_ISUID 04000 /* Set user ID on execution. */ +#define __S_ISGID 02000 /* Set group ID on execution. */ +#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ +#define __S_IREAD 0400 /* Read by owner. */ +#define __S_IWRITE 0200 /* Write by owner. */ +#define __S_IEXEC 0100 /* Execute by owner. */ diff --git a/libc/sysdeps/linux/c6x/bits/syscalls.h b/libc/sysdeps/linux/c6x/bits/syscalls.h new file mode 100644 index 000000000..382ec5124 --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/syscalls.h @@ -0,0 +1,182 @@ +#ifndef _BITS_SYSCALLS_H +#define _BITS_SYSCALLS_H +#ifndef _SYSCALL_H +# error "Never use directly; include instead." +#endif + +#ifndef __ASSEMBLER__ + +#include + +#define SYS_ify(syscall_name) (__NR_##syscall_name) + +#undef __SYSCALL_STRING +# define __SYSCALL_STRING \ + "swe\n\t" \ + "nop\n\t" + +# define __SYSCALL_RES_CHECK (__res < -255 || __res >= 0) + +#define __SYSCALL_CLOBBERS "cc", "memory" + +#define __SYSCALL_RETURN(type) \ + if (__SYSCALL_RES_CHECK) \ + return (type) __res; \ + __set_errno (-__res); \ + return (type) -1; + +#ifndef NOT_IN_libc +#define DEBUG_SYSCALL(name) { \ + char d[64];\ + write( 2, d, snprintf( d, 64, "syscall %d error %d\n", __NR_##name, _inline_sys_result)); \ +} +#else +#define DEBUG_SYSCALL(name) do{} while(0) +#endif + +#undef INLINE_SYSCALL +#define INLINE_SYSCALL(name, nr, args...) \ + ({ unsigned int _inline_sys_result = INTERNAL_SYSCALL (name, , nr, args); \ + if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_inline_sys_result, ), 0)) \ + { \ + __set_errno (INTERNAL_SYSCALL_ERRNO (_inline_sys_result, )); \ + _inline_sys_result = (unsigned int) -1; \ + } \ + (int) _inline_sys_result; }) + +#undef INLINE_SYSCALL_NOERR +#define INLINE_SYSCALL_NOERR(name, nr, args...) \ + ({ unsigned int _inline_sys_result = INTERNAL_SYSCALL (name, , nr, args); \ + (int) _inline_sys_result; }) + +#undef INTERNAL_SYSCALL_DECL +#define INTERNAL_SYSCALL_DECL(err) do { } while (0) + + +#define INTERNAL_SYSCALL( name, err, nr, args...) \ + INTERNAL_SYSCALL_NCS( __NR_##name, err, nr, args ) + + +#define INTERNAL_SYSCALL_NCS(sys_num, err, nr, args...) \ + ({ \ + register long __A4 __asm__("A4"); \ + register long __b0 __asm__("B0") = sys_num; \ + LOAD_ARGS_##nr(args) \ + __asm__ __volatile__(__SYSCALL_STRING \ + : "=a" (__A4) \ + : "b" (__b0) ASM_ARGS_##nr \ + : __SYSCALL_CLOBBERS ); \ + (int)__A4; \ + }) + +#undef INTERNAL_SYSCALL_ERROR_P +#define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((unsigned int) (val) >= 0xfffff001u) + +#undef INTERNAL_SYSCALL_ERRNO +#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) + +#if 0 +# define CALL_ERRNO_LOCATION "call __errno_location;" +#define __CLONE_SYSCALL_STRING \ + "ta 0x10;" \ + "bcs 2f;" \ + " sub %%o1, 1, %%o1;" \ + "and %%A4, %%o1, %%A4;" \ + "1:" \ + ".subsection 2;" \ + "2:" \ + "save %%sp, -192, %%sp;" \ + CALL_ERRNO_LOCATION \ + " nop;" \ + "st %%i0, [%%A4];" \ + "ba 1b;" \ + " restore %%g0, -1, %%A4;" \ + ".previous;" + +#define INLINE_CLONE_SYSCALL(arg1,arg2,arg3,arg4,arg5) \ +({ \ + register long __A4 __asm__ ("A4") = (long)(arg1); \ + register long __B4 __asm__ ("B4") = (long)(arg2); \ + register long __A6 __asm__ ("A6") = (long)(arg3); \ + register long __B6 __asm__ ("B6") = (long)(arg4); \ + register long __A8 __asm__ ("A8") = (long)(arg5); \ + register long __g1 __asm__ ("g1") = __NR_clone; \ + __asm __volatile (__CLONE_SYSCALL_STRING : \ + "=r" (__g1), "=r" (__A4), "=r" (__B4) : \ + "0" (__g1), "1" (__A4), "2" (__B4), \ + "r" (__A6), "r" (__B6), "r" (__A8) : \ + __SYSCALL_CLOBBERS); \ + __A4; \ +}) +#endif + +#define LOAD_ARGS_0() +#define ASM_ARGS_0 +#define LOAD_ARGS_1(A4) \ + __A4 = (int)A4; \ + LOAD_ARGS_0() +#define ASM_ARGS_1 ASM_ARGS_0, "a" (__A4) +#define LOAD_ARGS_2(A4, B4) \ + register int __B4 __asm__ ("B4") = (int) (B4); \ + LOAD_ARGS_1 (A4) +#define ASM_ARGS_2 ASM_ARGS_1, "b" (__B4) +#define LOAD_ARGS_3(A4, B4, A6) \ + register int __A6 __asm__ ("A6") = (int) (A6); \ + LOAD_ARGS_2 (A4, B4) +#define ASM_ARGS_3 ASM_ARGS_2, "a" (__A6) +#define LOAD_ARGS_4(A4, B4, A6, B6) \ + register int __B6 __asm__ ("B6") = (int) (B6); \ + LOAD_ARGS_3 (A4, B4, A6) +#define ASM_ARGS_4 ASM_ARGS_3, "b" (__B6) +#define LOAD_ARGS_5(A4, B4, A6, B6, A8) \ + register int __A8 __asm__ ("A8") = (int) (A8); \ + LOAD_ARGS_4 (A4, B4, A6, B6) +#define ASM_ARGS_5 ASM_ARGS_4, "a" (__A8) +#define LOAD_ARGS_6(A4, B4, A6, B6, A8, B8) \ + register int __B8 __asm__ ("B8") = (int) (B8); \ + LOAD_ARGS_5 (A4, B4, A6, B6, A8) +#define ASM_ARGS_6 ASM_ARGS_5, "b" (__B8) + +#ifndef _syscall0 + +#define C_DECL_ARGS_0() void +#define C_DECL_ARGS_1(t, v) t v +#define C_DECL_ARGS_2(t, v, args...) t v, C_DECL_ARGS_1(args) +#define C_DECL_ARGS_3(t, v, args...) t v, C_DECL_ARGS_2(args) +#define C_DECL_ARGS_4(t, v, args...) t v, C_DECL_ARGS_3(args) +#define C_DECL_ARGS_5(t, v, args...) t v, C_DECL_ARGS_4(args) +#define C_DECL_ARGS_6(t, v, args...) t v, C_DECL_ARGS_5(args) + +#define C_ARGS_0() +#define C_ARGS_1(t, v) v +#define C_ARGS_2(t, v, args...) v, C_ARGS_1(args) +#define C_ARGS_3(t, v, args...) v, C_ARGS_2(args) +#define C_ARGS_4(t, v, args...) v, C_ARGS_3(args) +#define C_ARGS_5(t, v, args...) v, C_ARGS_4(args) +#define C_ARGS_6(t, v, args...) v, C_ARGS_5(args) + +#define SYSCALL_FUNC(nargs, type, name, args...) \ +type name(C_DECL_ARGS_##nargs(args)) { \ + return (type)INLINE_SYSCALL(name, nargs, C_ARGS_##nargs(args)); \ +} + +#define SYSCALL_NOERR_FUNC(nargs, type, name, args...) \ +type name(C_DECL_ARGS_##nargs(args)) { \ + return (type)INLINE_SYSCALL_NOERR(name, nargs, C_ARGS_##nargs(args)); \ +} + +#define _syscall0(args...) SYSCALL_FUNC(0, args) +#define _syscall1(args...) SYSCALL_FUNC(1, args) +#define _syscall_noerr1(args...) SYSCALL_NOERR_FUNC(1, args) +#define _syscall2(args...) SYSCALL_FUNC(2, args) +#define _syscall3(args...) SYSCALL_FUNC(3, args) +#define _syscall4(args...) SYSCALL_FUNC(4, args) +#define _syscall5(args...) SYSCALL_FUNC(5, args) +#define _syscall6(args...) SYSCALL_FUNC(6, args) + +#endif /* _syscall0 */ + +#endif /* __ASSEMBLER__ */ +#endif /* _BITS_SYSCALLS_H */ + diff --git a/libc/sysdeps/linux/c6x/bits/uClibc_arch_features.h b/libc/sysdeps/linux/c6x/bits/uClibc_arch_features.h new file mode 100644 index 000000000..59e7de987 --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/uClibc_arch_features.h @@ -0,0 +1,48 @@ +/* + * Track misc arch-specific features that aren't config options + */ + +#ifndef _BITS_UCLIBC_ARCH_FEATURES_H +#define _BITS_UCLIBC_ARCH_FEATURES_H + +/* instruction used when calling abort() to kill yourself */ +/*#define __UCLIBC_ABORT_INSTRUCTION__ "asm instruction"*/ +#undef __UCLIBC_ABORT_INSTRUCTION__ + +/* can your target use syscall6() for mmap ? */ +#define __UCLIBC_MMAP_HAS_6_ARGS__ + +/* does your target use syscall4() for truncate64 ? (32bit arches only) */ +#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__ + +/* does your target have a broken create_module() ? */ +#undef __UCLIBC_BROKEN_CREATE_MODULE__ + +/* does your target have to worry about older [gs]etrlimit() ? */ +#undef __UCLIBC_HANDLE_OLDER_RLIMIT__ + +/* does your target have an asm .set ? */ +#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ + +/* define if target doesn't like .global */ +#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__ + +/* define if target supports .weak */ +#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__ + +/* define if target supports .weakext */ +#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__ + +/* needed probably only for ppc64 */ +#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__ + +/* define if target supports CFI pseudo ops */ +#undef __UCLIBC_HAVE_ASM_CFI_DIRECTIVES__ + +/* define if target supports IEEE signed zero floats */ +#define __UCLIBC_HAVE_SIGNED_ZERO__ + +/* only weird assemblers generally need this */ +#define __UCLIBC_ASM_LINE_SEP__ @ + +#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ diff --git a/libc/sysdeps/linux/c6x/bits/wordsize.h b/libc/sysdeps/linux/c6x/bits/wordsize.h new file mode 100644 index 000000000..ba643b60a --- /dev/null +++ b/libc/sysdeps/linux/c6x/bits/wordsize.h @@ -0,0 +1,19 @@ +/* Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define __WORDSIZE 32 diff --git a/libc/sysdeps/linux/c6x/brk.c b/libc/sysdeps/linux/c6x/brk.c new file mode 100644 index 000000000..7eb486308 --- /dev/null +++ b/libc/sysdeps/linux/c6x/brk.c @@ -0,0 +1,54 @@ +/* + * Port of uClibc for TMS320C6000 DSP architecture + * Copyright (C) 2004 Texas Instruments Incorporated + * Author of TMS320C6000 port: Aurelien Jacquiot + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License + * for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include +#include +#include + +libc_hidden_proto(brk) + +/* This must be initialized data because commons can't have aliases. */ +void * __curbrk attribute_hidden = 0; + +int brk (void *addr) +{ + void *newbrk; + + __asm__ __volatile__ ( \ + "mv .d1 %2, A4\n\t" \ + "mvk .s2 %1, B0\n\t" \ + "swe\n\t" \ + "nop\n\t" \ + "mv .d2 B0, %0" \ + : "=b" (newbrk) \ + : "i" (__NR_brk), \ + "a" (addr) \ + : "memory", "cc", "B0", "A4"); \ + + __curbrk = newbrk; + + if (newbrk < addr) { + __set_errno (ENOMEM); + return -1; + } + return 0; +} +libc_hidden_def(brk) diff --git a/libc/sysdeps/linux/c6x/bsd-_setjmp.s b/libc/sysdeps/linux/c6x/bsd-_setjmp.s new file mode 100644 index 000000000..566318a2a --- /dev/null +++ b/libc/sysdeps/linux/c6x/bsd-_setjmp.s @@ -0,0 +1,48 @@ + ; + ; Port of uClibc for TMS320C6000 DSP architecture + ; Copyright (C) 2004 Texas Instruments Incorporated + ; Author of TMS320C6000 port: Aurelien Jacquiot + ; + ; This program is free software; you can redistribute it and/or modify it + ; under the terms of the GNU Library General Public License as published by + ; the Free Software Foundation; either version 2 of the License, or (at your + ; option) any later version. + ; + ; This program is distributed in the hope that it will be useful, but WITHOUT + ; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + ; FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License + ; for more details. + ; + ; You should have received a copy of the GNU Library General Public License + ; along with this program; if not, write to the Free Software Foundation, + ; Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ; + + .global _setjmp + +_setjmp: + MV .D2X A4,B4 ; jmp_buf address +|| STW .D1T2 B3,*+A4(48) ; return address + + STW .D1T1 A10,*+A4(0) +|| STW .D2T2 B10,*+B4(4) +|| ZERO .L1 A6 + + STW .D1T1 A6,*+A4(52) ; no signal mask set +|| B .S2 B3 ; returns in 5 cycles + + STW .D1T1 A11,*+A4(8) +|| STW .D2T2 B11,*+B4(12) + STW .D1T1 A12,*+A4(16) +|| STW .D2T2 B12,*+B4(20) + STW .D1T1 A13,*+A4(24) +|| STW .D2T2 B13,*+B4(28) + STW .D1T1 A14,*+A4(32) +|| STW .D2T2 B14,*+B4(36) + STW .D1T1 A15,*+A4(40) +|| STW .D2T2 B15,*+B4(44) +|| ZERO .L1 A4 ; return values + + + + diff --git a/libc/sysdeps/linux/c6x/bsd-setjmp.S b/libc/sysdeps/linux/c6x/bsd-setjmp.S new file mode 100644 index 000000000..3ab597d8e --- /dev/null +++ b/libc/sysdeps/linux/c6x/bsd-setjmp.S @@ -0,0 +1,67 @@ + ; + ; Port of uClibc for TMS320C6000 DSP architecture + ; Copyright (C) 2004 Texas Instruments Incorporated + ; Author of TMS320C6000 port: Aurelien Jacquiot + ; + ; This program is free software; you can redistribute it and/or modify it + ; under the terms of the GNU Library General Public License as published by + ; the Free Software Foundation; either version 2 of the License, or (at your + ; option) any later version. + ; + ; This program is distributed in the hope that it will be useful, but WITHOUT + ; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + ; FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License + ; for more details. + ; + ; You should have received a copy of the GNU Library General Public License + ; along with this program; if not, write to the Free Software Foundation, + ; Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ; + + .global setjmp +setjmp: +#if 0 +.if 1 /* was: .if (CONFIG_UCLIBC_SHARED == 0) */ + + MVKL .S1 ___curr_eh_stack_entry,A6 +|| SUB .D1X A4,B15,A3 + MVKH .S1 ___curr_eh_stack_entry,A6 +|| CMPGT .L1 A3,4,A0 ; A0 set if C++ exceptions case + + LDW .D1T1 *A6,A2 +.else + MVKL .S2 (___curr_eh_stack_entry - $bss)/4,B6 +|| SUB .D1X A4,B15,A3 + MVKH .S2 (___curr_eh_stack_entry - $bss)/4,B6 +|| CMPGT .L1 A3,4,A0 ; A0 set if C++ exceptions case + + LDW .D2T1 *+B14[B6],A2 +.endif + NOP +#else + MVK .S1 0, A0 +#endif + + MVK .L2 1,B4 ; indicate to ___sigjmp_save to save signal mask +|| MV .D2X A4,B6 ; jmp_buf address +|| STW .D1T2 B3,*+A4(48) ; return address + + ADDAW .D1 A2,2,A2 + [A0] CMPEQ .L1 A4,A2,A0 ; A0 set if C++ exceptions case + + STW .D1T1 A10,*+A4(0) +|| STW .D2T2 B10,*+B6(4) +||[!A0] B .S1 __sigjmp_save ; branch to ___sigjmp_save in 5 cycles +||[A0] B .S2 B3 + + STW .D1T1 A11,*+A4(8) +|| STW .D2T2 B11,*+B6(12) + STW .D1T1 A12,*+A4(16) +|| STW .D2T2 B12,*+B6(20) + STW .D1T1 A13,*+A4(24) +|| STW .D2T2 B13,*+B6(28) + STW .D1T1 A14,*+A4(32) +|| STW .D2T2 B14,*+B6(36) + STW .D1T1 A15,*+A4(40) +|| STW .D2T2 B15,*+B6(44) +||[A0] ZERO .L1 A4 ; returns 0 for the C++ case diff --git a/libc/sysdeps/linux/c6x/clone.S b/libc/sysdeps/linux/c6x/clone.S new file mode 100644 index 000000000..8d9da4b49 --- /dev/null +++ b/libc/sysdeps/linux/c6x/clone.S @@ -0,0 +1,97 @@ + ; + ; Port of uClibc for TMS320C6000 DSP architecture + ; Copyright (C) 2004 Texas Instruments Incorporated + ; Author of TMS320C6000 port: Aurelien Jacquiot + ; + ; This program is free software; you can redistribute it and/or modify it + ; under the terms of the GNU Library General Public License as published by + ; the Free Software Foundation; either version 2 of the License, or (at your + ; option) any later version. + ; + ; This program is distributed in the hope that it will be useful, but WITHOUT + ; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + ; FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License + ; for more details. + ; + ; You should have received a copy of the GNU Library General Public License + ; along with this program; if not, write to the Free Software Foundation, + ; Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ; + + ; int _clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); + +#include +#include + + .global __clone + .global clone + .global __errno_location + + ;Currently supports only + ;int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) + ; + ;Requires update for supporting + ; int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg, + ; int *parent_tidptr, struct user_desc *newtls, int *child_pidptr) + +__clone: + ; index 1 points to the forth argument and is to be moved to B6 + LDW .D2T2 *+B15[1],B5 + NOP 4 + OR .D2X B4,A4,B2 ; sanity check arguments, no NULL function or stack pointers +|| MV .S2 B4,B9 +|| MV .D1 A4,A9 ; backup fn and child_stack pointers + + [!B2] B .S2 __syscall_error +||[!B2] MVK .S1 EINVAL,A4 + NOP 4 + + MV .D1 A6,A4 ; get flags as arg0, arg1 is the new stack +|| AND .D2 ~7,B4,B4 + + ; do the system call +|| MVK .S2 120,B0 ; __NR_clone +|| MV .L2 B5,B6 +0: +#ifndef _TMS320C6400_PLUS + MVC .S2 CSR,B2 + CLR .S2 B2,0,0,B1 + MVC .S2 B1,CSR + MVC .S2 IFR,B1 + SET .S2 B1,6,6,B1 + MVC .S2 B1,ISR + MVC .S2 B2,CSR + NOP +#else + SWE +#endif + + MV .D2 B9,B4 ; restore child stack + +|| CMPEQ .L1 0,A4,A2 +|| CMPLT .L2X A4,0,B2 + + [B2] B .S2 __syscall_error ; if syscall < 0, it is an error + NOP 5 + [A2] B .S2X A9 ; branch to function +|| [A2] MV .D1X B6,A4 ; set arg (B6 is preserved by syscall) + [!A2] B .S2 B3 ; otherwise (syscall result > 0) returns directly + [A2] ADDKPC .S2 __return_thread,B3, 4 + +__return_thread: + b .s2 HIDDEN_JUMPTARGET(_exit) + nop 5 + +__syscall_error: + NEG .S1 A4,A4 + STW .D2T1 A4,*B15--[2] + STW .D2T2 B3,*+B15[1] + CALLP .S2 __errno_location,B3 + LDW .D2T2 *+B15[1],B3 + LDW .D2T1 *++B15[2],A5 + NOP 3 + BNOP .S2 B3,3 + STW .D1T1 A5,*A4 + MVK .L1 -1,A4 + +.set clone, __clone diff --git a/libc/sysdeps/linux/c6x/crt1.S b/libc/sysdeps/linux/c6x/crt1.S new file mode 100644 index 000000000..810f39557 --- /dev/null +++ b/libc/sysdeps/linux/c6x/crt1.S @@ -0,0 +1,67 @@ +; +; Port of uClibc for TMS320C6000 DSP architecture +; +; Copyright (C) 2010 Texas Instruments Incorporated +; Mark Salter +; +; This program is free software; you can redistribute it and/or modify it +; under the terms of the GNU Library General Public License as published by +; the Free Software Foundation; either version 2 of the License, or (at your +; option) any later version. +; +; This program is distributed in the hope that it will be useful, but WITHOUT +; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +; FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License +; for more details. +; +; You should have received a copy of the GNU Library General Public License +; along with this program; if not, write to the Free Software Foundation, +; Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +; + + .text + + ;; On entry, the dynamic linker + ;; + ;; 0(sp) pad0 + ;; 4(sp) pad1 + ;; 8(sp) argc + ;; 12(sp) argv[0] + ;; ... + ;; (4*(argc+3))(sp) NULL + ;; (4*(argc+4))(sp) envp[0] + ;; ... + ;; NULL + + ;; Register values are unspecified, except: + ;; + ;; A4 --> pointer to rtld fini rountine + ;; B14 --> pointer to application DSBT table + + .global _start +_start: + .global _c_int00 +_c_int00: + ;; Things to do: + ;; + ;; * call __uClibc_main( + ;; int (*main)(int, char **, char **), A4 + ;; int argc, B4 + ;; char **argv, A6 + ;; void (*app_init)(void), B6 + ;; void (*app_fini)(void), A8 + ;; void (*rtld_fini)(void), B8 + ;; void *stack_end) A10 + + MV .D2X A4,B8 ; rtld_fini + + LDW .D2T1 *+B14($GOT(main)), A4 + LDW .D2T2 *+B14($GOT(_init)), B6 + B .S2 __uClibc_main +|| LDW .D2T1 *+B14($GOT(_fini)), A8 + + LDW .D2T2 *+B15(8),B4 ; argc + ADDAW .D1X B15,3,A6 ; **argv + MV .D1X B15,A10 ; stack_end +|| ZERO .L1 A15 ; clear FP + NOP 2 diff --git a/libc/sysdeps/linux/c6x/crti.S b/libc/sysdeps/linux/c6x/crti.S new file mode 100644 index 000000000..e689a04d1 --- /dev/null +++ b/libc/sysdeps/linux/c6x/crti.S @@ -0,0 +1,17 @@ +/* + * This file just supplies function prologues for the .init and .fini + * sections. It is linked in before crtbegin.o. + */ + + .section .init + .globl _init + .type _init,@function +_init: + add .l2 -8, B15, B15 + stw .d2t2 B3,*+B15(4) + .section .fini + .globl _fini + .type _fini,@function +_fini: + add .l2 -8, B15, B15 + stw .d2t2 B3,*+B15(4) diff --git a/libc/sysdeps/linux/c6x/crtn.S b/libc/sysdeps/linux/c6x/crtn.S new file mode 100644 index 000000000..37e799df3 --- /dev/null +++ b/libc/sysdeps/linux/c6x/crtn.S @@ -0,0 +1,19 @@ +/* + * This file supplies function epilogues for the .init and .fini sections. + * It is linked in after all other files. + */ + + .section .init + ldw .d2t2 *+B15(4), B3 + add .d2 B15, 8, B15 + nop 3 + ret .s2 B3 + nop 5 + + .section .fini + ldw .d2t2 *+B15(4), B3 + add .d2 B15, 8, B15 + nop 3 + ret .s2 B3 + nop 5 + diff --git a/libc/sysdeps/linux/c6x/prctl.c b/libc/sysdeps/linux/c6x/prctl.c new file mode 100644 index 000000000..fcf1f9d54 --- /dev/null +++ b/libc/sysdeps/linux/c6x/prctl.c @@ -0,0 +1,43 @@ +/* vi: set sw=4 ts=4: */ +/* + * prctl() for uClibc + * + * Copyright (C) 2000-2006 Erik Andersen + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include +#include +/* psm: including sys/prctl.h would depend on kernel headers */ + +#ifdef __NR_prctl +extern int prctl (int __option, ...); +int prctl (int __option, ...) +{ + register long no __asm__("B0"); + register long a __asm__("A4"); + register long b __asm__("B4"); + register long c __asm__("A6"); + register long d __asm__("B6"); + register long e __asm__("A8"); + int __res; + va_list ap; + + va_start( ap, __option); + a = __option; + b = va_arg( ap, long); + c = va_arg( ap, long); + d = va_arg( ap, long); + e = va_arg( ap, long); + va_end( ap ); + + no = __NR_prctl; + + __asm__ __volatile__ ("SWE" : "=a" (a) : "a" (a), "b" (b), "a" (c), "b" (d), "a" (e), "b" (no) + : "memory", "cc"); + + __res = a; + __SYSCALL_RETURN (int); +} +#endif diff --git a/libc/sysdeps/linux/c6x/pread_write.c b/libc/sysdeps/linux/c6x/pread_write.c new file mode 100644 index 000000000..f985b4374 --- /dev/null +++ b/libc/sysdeps/linux/c6x/pread_write.c @@ -0,0 +1,103 @@ +/* vi: set sw=4 ts=4: + * + * Copyright (C) 2002 by Erik Andersen + * Based in part on the files + * ./sysdeps/unix/sysv/linux/pwrite.c, + * ./sysdeps/unix/sysv/linux/pread.c, + * sysdeps/posix/pread.c + * sysdeps/posix/pwrite.c + * from GNU libc 2.2.5, but reworked considerably... + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License + * for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#define _LARGEFILE64_SOURCE +#include +#undef __OPTIMIZE__ +/* We absolutely do _NOT_ want interfaces silently + * * * renamed under us or very bad things will happen... */ +#ifdef __USE_FILE_OFFSET64 +# undef __USE_FILE_OFFSET64 +#endif + + +#include +#include +#include +#include +#include + +extern __typeof(pread) __libc_pread; +extern __typeof(pwrite) __libc_pwrite; +#ifdef __UCLIBC_HAS_LFS__ +extern __typeof(pread64) __libc_pread64; +extern __typeof(pwrite64) __libc_pwrite64; +#endif + +#ifdef __NR_pread64 /* Newer kernels renamed but it's the same. */ +# ifdef __NR_pread +# error "__NR_pread and __NR_pread64 both defined???" +# endif +# define __NR_pread __NR_pread64 +#endif + +#define __NR___syscall_pread __NR_pread +static inline _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf, + size_t, count, off_t, offset_hi, off_t, offset_lo); + +ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset) +{ + return(__syscall_pread(fd,buf,count,offset,offset >> 31)); +} +weak_alias (__libc_pread, pread) + +#if defined __UCLIBC_HAS_LFS__ +ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) +{ + uint32_t low = offset & 0xffffffff; + uint32_t high = offset >> 32; + return(__syscall_pread(fd, buf, count, low, high)); +} +weak_alias (__libc_pread64, pread64) +#endif /* __UCLIBC_HAS_LFS__ */ + + +#ifdef __NR_pwrite64 /* Newer kernels renamed but it's the same. */ +# ifdef __NR_pwrite +# error "__NR_pwrite and __NR_pwrite64 both defined???" +# endif +# define __NR_pwrite __NR_pwrite64 +#endif + +#define __NR___syscall_pwrite __NR_pwrite +static inline _syscall5(ssize_t, __syscall_pwrite, int, fd, const void *, buf, + size_t, count, off_t, offset_hi, off_t, offset_lo); + +ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t offset) +{ + return(__syscall_pwrite(fd,buf,count,offset,offset >> 31)); +} +weak_alias (__libc_pwrite, pwrite) + +#if defined __UCLIBC_HAS_LFS__ +ssize_t __libc_pwrite64(int fd, const void *buf, size_t count, off64_t offset) +{ + uint32_t low = offset & 0xffffffff; + uint32_t high = offset >> 32; + return(__syscall_pwrite(fd, buf, count, low, high)); +} +weak_alias (__libc_pwrite64, pwrite64) +#endif /* __UCLIBC_HAS_LFS__ */ + diff --git a/libc/sysdeps/linux/c6x/setjmp.s b/libc/sysdeps/linux/c6x/setjmp.s new file mode 100644 index 000000000..28a4f0370 --- /dev/null +++ b/libc/sysdeps/linux/c6x/setjmp.s @@ -0,0 +1,43 @@ + ; + ; Port of uClibc for TMS320C6000 DSP architecture + ; Copyright (C) 2004 Texas Instruments Incorporated + ; Author of TMS320C6000 port: Aurelien Jacquiot + ; + ; This program is free software; you can redistribute it and/or modify it + ; under the terms of the GNU Library General Public License as published by + ; the Free Software Foundation; either version 2 of the License, or (at your + ; option) any later version. + ; + ; This program is distributed in the hope that it will be useful, but WITHOUT + ; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + ; FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License + ; for more details. + ; + ; You should have received a copy of the GNU Library General Public License + ; along with this program; if not, write to the Free Software Foundation, + ; Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ; + + .global __sigsetjmp +; .ref __sigjmp_save + +__sigsetjmp: + MV .D2X A4,B6 ; jmp_buf address +|| STW .D1T2 B3,*+A4(48) ; return address + + STW .D1T1 A10,*+A4(0) +|| STW .D2T2 B10,*+B6(4) +|| B .S2 __sigjmp_save ; branch to ___sigjmp_save in 5 cycles + + STW .D1T1 A11,*+A4(8) +|| STW .D2T2 B11,*+B6(12) + STW .D1T1 A12,*+A4(16) +|| STW .D2T2 B12,*+B6(20) + STW .D1T1 A13,*+A4(24) +|| STW .D2T2 B13,*+B6(28) + STW .D1T1 A14,*+A4(32) +|| STW .D2T2 B14,*+B6(36) + STW .D1T1 A15,*+A4(40) +|| STW .D2T2 B15,*+B6(44) + + diff --git a/libc/sysdeps/linux/c6x/sigaction.c b/libc/sysdeps/linux/c6x/sigaction.c new file mode 100644 index 000000000..1865998ee --- /dev/null +++ b/libc/sysdeps/linux/c6x/sigaction.c @@ -0,0 +1,115 @@ +/* + Copyright (C) 2010 Texas Instruments Incorporated + Adapted from i386 version by Mark Salter + + Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + + Totally hacked up for uClibc by Erik Andersen + */ + +#include +#include +#include +#include +#include + +#define SA_RESTORER 0x04000000 + +extern __typeof(sigaction) __libc_sigaction; + +extern void restore_rt(void) __asm__ ("__restore_rt") attribute_hidden; +extern void restore(void) __asm__ ("__restore") attribute_hidden; + +/* If ACT is not NULL, change the action for SIG to *ACT. + If OACT is not NULL, put the old action for SIG in *OACT. */ +int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) +{ + int result; + struct kernel_sigaction kact, koact; + +#ifdef SIGCANCEL + if (sig == SIGCANCEL) { + __set_errno (EINVAL); + return -1; + } +#endif + + if (act) { + kact.k_sa_handler = act->sa_handler; + memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask)); + kact.sa_flags = act->sa_flags; + + kact.sa_flags = act->sa_flags | SA_RESTORER; + kact.sa_restorer = ((act->sa_flags & SA_SIGINFO) + ? &restore_rt : &restore); + } + + /* XXX The size argument hopefully will have to be changed to the + real size of the user-level sigset_t. */ + result = __syscall_rt_sigaction(sig, act ? __ptrvalue (&kact) : NULL, + oact ? __ptrvalue (&koact) : NULL, _NSIG / 8); + + if (oact && result >= 0) { + oact->sa_handler = koact.k_sa_handler; + memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask)); + oact->sa_flags = koact.sa_flags; + oact->sa_restorer = koact.sa_restorer; + } + return result; +} + +#ifndef LIBC_SIGACTION +weak_alias(__libc_sigaction,sigaction) +libc_hidden_weak(sigaction) +#endif + +/* NOTE: Please think twice before making any changes to the bits of + code below. GDB needs some intimate knowledge about it to + recognize them as signal trampolines, and make backtraces through + signal handlers work right. Important are both the names + (__restore and __restore_rt) and the exact instruction sequence. + If you ever feel the need to make any changes, please notify the + appropriate GDB maintainer. */ + +#define RESTORE(name, syscall) RESTORE2 (name, syscall) +#define RESTORE2(name, syscall) \ +__asm__ \ + ( \ + " .text\n" \ + " .global " #name "\n" \ + "__" #name ":\n" \ + " MVK " #syscall ",B0\n" \ + " SWE\n" \ + " NOP\n" \ + " NOP\n" \ + " NOP\n" \ + " NOP\n" \ + " NOP\n" \ + " NOP\n" \ + ); + +#ifdef __NR_rt_sigaction +/* The return code for realtime-signals. */ +RESTORE (restore_rt, __NR_rt_sigreturn) +#endif + +#ifdef __NR_sigreturn +/* For the boring old signals. */ +RESTORE (restore, __NR_sigreturn) +#endif diff --git a/libc/sysdeps/linux/c6x/sys/procfs.h b/libc/sysdeps/linux/c6x/sys/procfs.h new file mode 100644 index 000000000..41c2d0866 --- /dev/null +++ b/libc/sysdeps/linux/c6x/sys/procfs.h @@ -0,0 +1,122 @@ +/* Copyright (C) 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_PROCFS_H +#define _SYS_PROCFS_H 1 + +/* This is somewhat modelled after the file of the same name on SVR4 + systems. It provides a definition of the core file format for ELF + used on Linux. It doesn't have anything to do with the /proc file + system, even though Linux has one. + + Anyway, the whole purpose of this file is for GDB and GDB only. + Don't read too much into it. Don't use it for anything other than + GDB unless you know what you are doing. */ + +#include +#include +#include +#include + +__BEGIN_DECLS + +/* Type for a general-purpose register. */ +typedef unsigned long elf_greg_t; + +/* And the whole bunch of them. We could have used `struct + user_regs_struct' directly in the typedef, but tradition says that + the register set is an array, which does have some peculiar + semantics, so leave it that way. */ +#define ELF_NGREG 20 +typedef elf_greg_t elf_gregset_t[ELF_NGREG]; + +/* Signal info. */ +struct elf_siginfo + { + int si_signo; /* Signal number. */ + int si_code; /* Extra code. */ + int si_errno; /* Errno. */ + }; + + +/* Definitions to generate Intel SVR4-like core files. These mostly + have the same names as the SVR4 types with "elf_" tacked on the + front to prevent clashes with Linux definitions, and the typedef + forms have been avoided. This is mostly like the SVR4 structure, + but more Linuxy, with things that Linux does not support and which + GDB doesn't really use excluded. */ + +struct elf_prstatus + { + struct elf_siginfo pr_info; /* Info associated with signal. */ + short int pr_cursig; /* Current signal. */ + unsigned long int pr_sigpend; /* Set of pending signals. */ + unsigned long int pr_sighold; /* Set of held signals. */ + __pid_t pr_pid; + __pid_t pr_ppid; + __pid_t pr_pgrp; + __pid_t pr_sid; + struct timeval pr_utime; /* User time. */ + struct timeval pr_stime; /* System time. */ + struct timeval pr_cutime; /* Cumulative user time. */ + struct timeval pr_cstime; /* Cumulative system time. */ + elf_gregset_t pr_reg; /* GP registers. */ + int pr_fpvalid; /* True if math copro being used. */ + }; + + +#define ELF_PRARGSZ (80) /* Number of chars for args. */ + +struct elf_prpsinfo + { + char pr_state; /* Numeric process state. */ + char pr_sname; /* Char for pr_state. */ + char pr_zomb; /* Zombie. */ + char pr_nice; /* Nice val. */ + unsigned long int pr_flag; /* Flags. */ + unsigned short int pr_uid; + unsigned short int pr_gid; + int pr_pid, pr_ppid, pr_pgrp, pr_sid; + /* Lots missing */ + char pr_fname[16]; /* Filename of executable. */ + char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ + }; + + +/* The rest of this file provides the types for emulation of the + Solaris interfaces that should be implemented by + users of libthread_db. */ + +/* Addresses. */ +typedef void *psaddr_t; + +/* Register sets. Linux has different names. */ +typedef elf_gregset_t prgregset_t; +typedef elf_gregset_t prfpregset_t; + +/* We don't have any differences between processes and threads, + therefore have only one PID type. */ +typedef __pid_t lwpid_t; + +/* Process status and info. In the end we do provide typedefs for them. */ +typedef struct elf_prstatus prstatus_t; +typedef struct elf_prpsinfo prpsinfo_t; + +__END_DECLS + +#endif /* sys/procfs.h */ diff --git a/libc/sysdeps/linux/c6x/sys/reg.h b/libc/sysdeps/linux/c6x/sys/reg.h new file mode 100644 index 000000000..46857ba71 --- /dev/null +++ b/libc/sysdeps/linux/c6x/sys/reg.h @@ -0,0 +1,26 @@ +/* + * Port of uClibc for TMS320C6000 DSP architecture + * Copyright (C) 2004 Texas Instruments Incorporated + * Author of TMS320C6000 port: Aurelien Jacquiot + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License + * for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +#ifndef _SYS_REG_H +#define _SYS_REG_H 1 + +#include + +#endif /* _SYS_REG_H */ diff --git a/libc/sysdeps/linux/c6x/sys/ucontext.h b/libc/sysdeps/linux/c6x/sys/ucontext.h new file mode 100644 index 000000000..9a3922a2e --- /dev/null +++ b/libc/sysdeps/linux/c6x/sys/ucontext.h @@ -0,0 +1,39 @@ +/* Copyright (C) 1997, 1999, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_UCONTEXT_H +#define _SYS_UCONTEXT_H 1 + +#include +#include +#include + +/* A machine context is exactly a sigcontext. */ +typedef struct sigcontext mcontext_t; + +/* Userlevel context. */ +typedef struct ucontext +{ + unsigned long uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; + __sigset_t uc_sigmask; +} ucontext_t; + +#endif /* sys/ucontext.h */ diff --git a/libc/sysdeps/linux/c6x/sys/user.h b/libc/sysdeps/linux/c6x/sys/user.h new file mode 100644 index 000000000..8c0a99dd8 --- /dev/null +++ b/libc/sysdeps/linux/c6x/sys/user.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2010 Texas Instruments Incorporated + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_USER_H +#define _SYS_USER_H 1 + +/* The whole purpose of this file is for GDB and GDB only. Don't read + too much into it. Don't use it for anything other than GDB unless + you know what you are doing. */ + +/* Left blank as a placeholder for now */ + +#endif /* sys/user.h */ diff --git a/libc/sysdeps/linux/c6x/syscall.c b/libc/sysdeps/linux/c6x/syscall.c new file mode 100644 index 000000000..ea947b28e --- /dev/null +++ b/libc/sysdeps/linux/c6x/syscall.c @@ -0,0 +1,49 @@ +/* + * syscall.c + * + * Port on Texas Instruments TMS320C6x architecture + * + * Copyright (C) 2006, 2010 Texas Instruments Incorporated + * Author: Thomas Charleux (thomas.charleux@jaluna.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include + +long int syscall (long int __sysno, ...) +{ + register long no __asm__("B0"); + register long a __asm__("A4"); + register long b __asm__("B4"); + register long c __asm__("A6"); + register long d __asm__("B6"); + register long e __asm__("A8"); + register long f __asm__("B8"); + long __res; + va_list ap; + + va_start( ap, __sysno); + a = va_arg( ap, long); + b = va_arg( ap, long); + c = va_arg( ap, long); + d = va_arg( ap, long); + e = va_arg( ap, long); + f = va_arg( ap, long); + va_end( ap ); + + no = __sysno; + + __asm__ __volatile__ ("SWE" : "=a" (a) : "a" (a), "b" (b), "a" (c), "b" (d), "a" (e), "b" (f), "b" (no) + : "memory", "cc"); + + __res = a; + __SYSCALL_RETURN (long); +} diff --git a/libc/sysdeps/linux/c6x/vfork.c b/libc/sysdeps/linux/c6x/vfork.c new file mode 100644 index 000000000..f19dcd464 --- /dev/null +++ b/libc/sysdeps/linux/c6x/vfork.c @@ -0,0 +1,26 @@ +/* + * Port of uClibc for TMS320C6000 DSP architecture + * Copyright (C) 2005 Texas Instruments Incorporated + * Author of TMS320C6000 port: Aurelien Jacquiot + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License + * for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +#include +__asm__(" .text\n" + "vfork: \n" + " MVKL .S1 ___libc_vfork,A0\n" + " MVKH .S1 ___libc_vfork,A0\n" + " BNOP .S2X A0,5\n"); diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index 302fa6450..fd55333fc 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -50,6 +50,7 @@ CSRC-$(UCLIBC_HAS_EPOLL) += epoll.c CSRC-$(UCLIBC_HAS_XATTR) += xattr.c CSRC-$(UCLIBC_HAS_PROFILING) += noophooks.c #pcprofile.c CSRC-$(UCLIBC_SV4_DEPRECATED) += ustat.c +CSRC- += $(if $(findstring =c6x=,=$(TARGET_ARCH)=),vfork.c) CSRC- += $(if $(findstring =sh=,=$(TARGET_ARCH)=),longjmp.c vfork.c) CSRC- += $(if $(findstring =sparc=,=$(TARGET_ARCH)=),vfork.c) CSRC- += $(if $(findstring =i386=,=$(TARGET_ARCH)=),vfork.c) diff --git a/libpthread/linuxthreads.old/sysdeps/c6x/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/c6x/pt-machine.h new file mode 100644 index 000000000..cabd4e33c --- /dev/null +++ b/libpthread/linuxthreads.old/sysdeps/c6x/pt-machine.h @@ -0,0 +1,64 @@ +/* Machine-dependent pthreads configuration and inline functions. + C6x version. + Copyright (C) 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Aurelien Jacquiot . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _PT_MACHINE_H +#define _PT_MACHINE_H 1 + +#ifndef PT_EI +# define PT_EI extern inline +#endif + +extern int __compare_and_swap (long int *p, long int oldval, long int newval); + +/* Spinlock implementation; required. */ +static inline long int +testandset (int *spinlock) +{ + register unsigned int ret = 1; + int dummy; + __asm__ __volatile__ ("mvc .s2 CSR, %0\n\tand .s2 -2, %0, %0\n\tmvc .s2 %0, CSR\n" + : "=b" (dummy)); + + if (*spinlock == 0) { + *spinlock = 1; + ret = 0; + } + __asm__ __volatile__ ("mvc .s2 CSR, %0\n\tor .s2 1, %0, %0\n\tmvc .s2 %0, CSR\n" + : "=b" (dummy)); + return ret; +} + +#define WRITE_MEMORY_BARRIER() +#define READ_MEMORY_BARRIER() + +/* Get some notion of the current stack. Need not be exactly the top + of the stack, just something somewhere in the current frame. */ +#define CURRENT_STACK_FRAME get_stack_pointer() +static inline char * get_stack_pointer(void) +{ + char *sp; + __asm__ __volatile__ ("mv .d2 B15, %0" : "=b" (sp)); + return sp; +} + +#define THREAD_STACK_OFFSET 8 + +#endif /* pt-machine.h */ -- cgit v1.2.3 From 9b1507df250e90b74099e0d05170d7d95060b016 Mon Sep 17 00:00:00 2001 From: Mark Salter Date: Wed, 2 Mar 2011 21:12:48 +0100 Subject: Add sanity checks to ld.so DSBT support This adds some DSBT index sanity checks to the runtime linker. It catches libraries which have no index (index 0) and libraries which try to use an already used index. Signed-off-by: Mark Salter Signed-off-by: Bernd Schmidt --- ldso/ldso/dl-elf.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 4cbd3382f..505247e6f 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -813,13 +813,40 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, int idx = tpnt->loadaddr.map->dsbt_index; unsigned *dsbt = tpnt->loadaddr.map->dsbt_table; + if (idx == 0) { + /* This DSO has not been assigned an index */ + _dl_dprintf(2, "%s: '%s' is missing a dsbt index assignment!\n", + _dl_progname, libname); + _dl_exit(1); + } + /* * Setup dsbt slot for this module in dsbt of all modules. */ for (t = _dl_loaded_modules; t; t = t->next) { /* find a dsbt table from another module */ - if (ref == NULL && t != tpnt) + if (ref == NULL && t != tpnt) { ref = t; + + /* make sure index is not already used */ + if (t->loadaddr.map->dsbt_table[idx]) { + struct elf_resolve *dup; + char *dup_name; + + for (dup = _dl_loaded_modules; dup; dup = dup->next) + if (dup != tpnt && dup->loadaddr.map->dsbt_index == idx) + break; + if (dup) + dup_name = dup->libname; + else if (idx == 1) + dup_name = "runtime linker"; + else + dup_name = "unknown library"; + _dl_dprintf(2, "%s: '%s' dsbt index %d already used by %s!\n", + _dl_progname, libname, idx, dup_name); + _dl_exit(1); + } + } t->loadaddr.map->dsbt_table[idx] = (unsigned)dsbt; } if (ref) -- cgit v1.2.3 From 2a19c1339d6bf46fe0f90fbd4e8dca6646d111ed Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Wed, 23 Feb 2011 00:14:42 +0100 Subject: Implement ffsl and ffsll. This imports and adapts ffsll.c from glibc. The same mechanism as in glibc is used to choose between ffs and ffsll to implement ffsl. The single user in libc is changed to use the hidden version __libc_ffs. Signed-off-by: Bernd Schmidt Acked-by: Bernhard Reutner-Fischer --- include/string.h | 10 ++++++++-- libc/inet/rpc/svc.c | 2 +- libc/string/ffs.c | 16 ++++++++++------ libc/string/ffsll.c | 40 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+), 9 deletions(-) create mode 100644 libc/string/ffsll.c diff --git a/include/string.h b/include/string.h index ca22055ed..66f64e7d1 100644 --- a/include/string.h +++ b/include/string.h @@ -374,11 +374,10 @@ extern char *rindex (__const char *__s, int __c) /* Return the position of the first bit set in I, or 0 if none are set. The least-significant bit is position 1, the most-significant 32. */ extern int ffs (int __i) __THROW __attribute__ ((__const__)); -libc_hidden_proto(ffs) /* The following two functions are non-standard but necessary for non-32 bit platforms. */ -# if 0 /*#ifdef __USE_GNU*/ +#ifdef __USE_GNU extern int ffsl (long int __l) __THROW __attribute__ ((__const__)); # ifdef __GNUC__ __extension__ extern int ffsll (long long int __ll) @@ -386,6 +385,13 @@ __extension__ extern int ffsll (long long int __ll) # endif # endif +#ifdef _LIBC +extern __typeof(ffs) __libc_ffs; +libc_hidden_proto(__libc_ffs); +extern __typeof(ffsll) __libc_ffsll; +libc_hidden_proto(__libc_ffsll) +#endif + /* Compare S1 and S2, ignoring case. */ extern int strcasecmp (__const char *__s1, __const char *__s2) __THROW __attribute_pure__ __nonnull ((1, 2)); diff --git a/libc/inet/rpc/svc.c b/libc/inet/rpc/svc.c index 0f5300c8b..03b406200 100644 --- a/libc/inet/rpc/svc.c +++ b/libc/inet/rpc/svc.c @@ -452,7 +452,7 @@ svc_getreqset (fd_set *readfds) setsize = _rpc_dtablesize (); maskp = (u_int32_t *) readfds->fds_bits; for (sock = 0; sock < setsize; sock += 32) - for (mask = *maskp++; (bit = ffs (mask)); mask ^= (1 << (bit - 1))) + for (mask = *maskp++; (bit = __libc_ffs (mask)); mask ^= (1 << (bit - 1))) svc_getreq_common (sock + bit - 1); } libc_hidden_def(svc_getreqset) diff --git a/libc/string/ffs.c b/libc/string/ffs.c index 22efe4a1e..4a5336d47 100644 --- a/libc/string/ffs.c +++ b/libc/string/ffs.c @@ -5,12 +5,12 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -/* ffsl,ffsll */ - +#include +#define ffsl __something_else #include "_string.h" - - -int ffs(int i) +#undef ffsl + +int __libc_ffs(int i) { #if 1 /* inlined binary search method */ @@ -51,4 +51,8 @@ int ffs(int i) return n; #endif } -libc_hidden_def(ffs) +libc_hidden_def(__libc_ffs) +weak_alias(__libc_ffs,ffs) +#if ULONG_MAX == UINT_MAX +weak_alias (__libc_ffs, ffsl) +#endif diff --git a/libc/string/ffsll.c b/libc/string/ffsll.c new file mode 100644 index 000000000..29e9ba9d9 --- /dev/null +++ b/libc/string/ffsll.c @@ -0,0 +1,40 @@ +/* Copyright (C) 1991, 1992, 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Torbjorn Granlund (tege@sics.se). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#define ffsl __something_else +#include "_string.h" +#undef ffsl + +/* Find the first bit set in I. */ +int __libc_ffsll (long long int i) +{ + unsigned long long int x = i & -i; + + if (x <= 0xffffffff) + return __libc_ffs (i); + else + return 32 + __libc_ffs (i >> 32); +} +libc_hidden_def(__libc_ffsll) + +weak_alias (__libc_ffsll, ffsll) +#if ULONG_MAX != UINT_MAX +weak_alias (__libc_ffsll, ffsl) +#endif -- cgit v1.2.3 From 80f5587940c2cd110d06c615db252c8122a3c697 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sun, 6 Mar 2011 15:40:09 +0100 Subject: Revert "try to fix duplicated slashes in the generated lib*.so files" This reverts commit 624be66cb9b350d5c6538fca8592cdb3a4c23d37. Signed-off-by: Peter S. Mazinger --- Makefile.in | 22 +++++++++++----------- Rules.mak | 6 +++--- utils/Makefile.in | 10 +++++----- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Makefile.in b/Makefile.in index 65dd4fda7..995347bf0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -186,8 +186,8 @@ $(top_builddir)include/bits/sysnum.h: $(top_srcdir)extra/scripts/gen_bits_syscal fi $(LOCAL_INSTALL_PATH): - $(Q)$(MAKE) PREFIX=$(shell pwd)/$(LOCAL_INSTALL_PATH) RUNTIME_PREFIX= \ - DEVEL_PREFIX=/usr \ + $(Q)$(MAKE) PREFIX=$(shell pwd)/$(LOCAL_INSTALL_PATH) RUNTIME_PREFIX=/ \ + DEVEL_PREFIX=/usr/ \ HOSTCC="$(HOSTCC)" \ install @@ -281,7 +281,7 @@ HEADERS_RM-$(UCLIBC_SUSV3_LEGACY) += sys/timeb.h regexp.h HEADERS_RM-$(UCLIBC_SUSV4_LEGACY) += utime.h ucontext.h ifneq ($(findstring install,$(MAKECMDGOALS)),) -$(addprefix $(PREFIX)$(DEVEL_PREFIX),/include $(MULTILIB_DIR)): +$(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)$(MULTILIB_DIR))) @@ -289,22 +289,22 @@ $(PREFIX)$(RUNTIME_PREFIX)$(MULTILIB_DIR): $(do_mkdir) endif endif -install_headers: headers $(top_builddir)extra/scripts/unifdef | $(PREFIX)$(DEVEL_PREFIX)/include - @$(call disp_install,"include -> $(PREFIX)$(DEVEL_PREFIX)/include") +install_headers: headers $(top_builddir)extra/scripts/unifdef | $(PREFIX)$(DEVEL_PREFIX)include + @$(call disp_install,"include -> $(PREFIX)$(DEVEL_PREFIX)include") $(Q)top_builddir=$(top_builddir) \ $(top_srcdir)extra/scripts/install_headers.sh \ - include $(PREFIX)$(DEVEL_PREFIX)/include + include $(PREFIX)$(DEVEL_PREFIX)include ifneq ($(O),) # only run this step in O is set i.e. make O=/my/builddir/ .. - @$(call disp_install,"$(top_builddir)/include -> $(PREFIX)$(DEVEL_PREFIX)/include") + @$(call disp_install,"$(top_builddir)/include -> $(PREFIX)$(DEVEL_PREFIX)include") $(Q)top_builddir=$(top_builddir) \ $(top_srcdir)extra/scripts/install_headers.sh \ - $(top_builddir)/include $(PREFIX)$(DEVEL_PREFIX)/include + $(top_builddir)/include $(PREFIX)$(DEVEL_PREFIX)include endif - $(Q)cd $(PREFIX)$(DEVEL_PREFIX)/include && $(RM) -r $(HEADERS_RM-) + $(Q)cd $(PREFIX)$(DEVEL_PREFIX)include && $(RM) -r $(HEADERS_RM-) ifeq ($(UCLIBC_HAS_WCHAR),) - $(Q)cd $(PREFIX)$(DEVEL_PREFIX)/include && mv -f wchar-stub.h wchar.h + $(Q)cd $(PREFIX)$(DEVEL_PREFIX)include && mv -f wchar-stub.h wchar.h else - $(Q)cd $(PREFIX)$(DEVEL_PREFIX)/include && $(RM) -f wchar-stub.h + $(Q)cd $(PREFIX)$(DEVEL_PREFIX)include && $(RM) -f wchar-stub.h endif # Installs startfiles diff --git a/Rules.mak b/Rules.mak index 0727e362a..abf958b50 100644 --- a/Rules.mak +++ b/Rules.mak @@ -95,9 +95,9 @@ export ARCH # Make certain these contain a final "/", but no "//"s. TARGET_SUBARCH:=$(call qstrip,$(shell grep -s '^TARGET_SUBARCH' $(top_builddir)/.config | $(SED) -e 's/^TARGET_SUBARCH=//')) TARGET_SUBARCH:=$(call qstrip,$(TARGET_SUBARCH)) -RUNTIME_PREFIX:=$(strip $(subst //,/, $(call qstrip,$(RUNTIME_PREFIX)))) -DEVEL_PREFIX:=$(strip $(subst //,/, $(call qstrip,$(DEVEL_PREFIX)))) -MULTILIB_DIR:=$(strip $(subst //,/, $(call qstrip,$(MULTILIB_DIR)))) +RUNTIME_PREFIX:=$(strip $(subst //,/, $(subst ,/, $(call qstrip,$(RUNTIME_PREFIX))))) +DEVEL_PREFIX:=$(strip $(subst //,/, $(subst ,/, $(call qstrip,$(DEVEL_PREFIX))))) +MULTILIB_DIR:=$(strip $(subst //,/, $(subst ,/, $(call qstrip,$(MULTILIB_DIR))))) KERNEL_HEADERS:=$(strip $(subst //,/, $(subst ,/, $(call qstrip,$(KERNEL_HEADERS))))) export RUNTIME_PREFIX DEVEL_PREFIX KERNEL_HEADERS MULTILIB_DIR diff --git a/utils/Makefile.in b/utils/Makefile.in index f3e67eb52..65364d771 100644 --- a/utils/Makefile.in +++ b/utils/Makefile.in @@ -119,14 +119,14 @@ install-y += utils_install # This installs both utils and hostutils, so doesn't depend on either. utils_install: $(addsuffix $(DOTHOST), $(utils_OBJ) $(utils_LOCALE_OBJ)) - $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/getconf$(DOTHOST) $(PREFIX)$(DEVEL_PREFIX)/bin/getconf + $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/getconf$(DOTHOST) $(PREFIX)$(DEVEL_PREFIX)bin/getconf ifeq ($(HAVE_SHARED),y) - $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/ldd$(DOTHOST) $(PREFIX)$(DEVEL_PREFIX)/bin/ldd - $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/ldconfig$(DOTHOST) $(PREFIX)$(RUNTIME_PREFIX)/sbin/ldconfig + $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/ldd$(DOTHOST) $(PREFIX)$(DEVEL_PREFIX)bin/ldd + $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/ldconfig$(DOTHOST) $(PREFIX)$(RUNTIME_PREFIX)sbin/ldconfig endif ifeq ($(UCLIBC_HAS_LOCALE),y) - $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/iconv$(DOTHOST) $(PREFIX)$(DEVEL_PREFIX)/bin/iconv - #$(Q)$(INSTALL) -m 755 $(utils_OUT)/locale$(DOTHOST) $(PREFIX)$(DEVEL_PREFIX)/bin/locale + $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/iconv$(DOTHOST) $(PREFIX)$(DEVEL_PREFIX)bin/iconv + #$(Q)$(INSTALL) -m 755 $(utils_OUT)/locale$(DOTHOST) $(PREFIX)$(DEVEL_PREFIX)bin/locale endif -- cgit v1.2.3 From 1f08001dd7c51ce09b39310604e4baa5a973629c Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sun, 6 Mar 2011 17:02:56 +0100 Subject: remove unused ARCH_CFLAGS and ARCH_LDFLAGS Signed-off-by: Peter S. Mazinger --- extra/Configs/Config.c6x | 6 ------ 1 file changed, 6 deletions(-) diff --git a/extra/Configs/Config.c6x b/extra/Configs/Config.c6x index d71df3f14..7b5b00528 100644 --- a/extra/Configs/Config.c6x +++ b/extra/Configs/Config.c6x @@ -11,12 +11,6 @@ config FORCE_OPTIONS_FOR_ARCH default y select ARCH_ANY_ENDIAN -config ARCH_CFLAGS - string - -config ARCH_LDFLAGS - string - choice prompt "Target Processor Type" default CONFIG_GENERIC_C6X -- cgit v1.2.3 From cda3f2658389330999ad35390ed2676a7dc37325 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sun, 6 Mar 2011 17:08:38 +0100 Subject: simplify ffs* code Remove __libc_ffs*, unneeded Signed-off-by: Peter S. Mazinger --- include/string.h | 8 +------- libc/inet/rpc/svc.c | 3 ++- libc/string/ffs.c | 11 ++++------- libc/string/ffsll.c | 14 +++++--------- 4 files changed, 12 insertions(+), 24 deletions(-) diff --git a/include/string.h b/include/string.h index 66f64e7d1..c71a85c9f 100644 --- a/include/string.h +++ b/include/string.h @@ -374,6 +374,7 @@ extern char *rindex (__const char *__s, int __c) /* Return the position of the first bit set in I, or 0 if none are set. The least-significant bit is position 1, the most-significant 32. */ extern int ffs (int __i) __THROW __attribute__ ((__const__)); +libc_hidden_proto(ffs) /* The following two functions are non-standard but necessary for non-32 bit platforms. */ @@ -385,13 +386,6 @@ __extension__ extern int ffsll (long long int __ll) # endif # endif -#ifdef _LIBC -extern __typeof(ffs) __libc_ffs; -libc_hidden_proto(__libc_ffs); -extern __typeof(ffsll) __libc_ffsll; -libc_hidden_proto(__libc_ffsll) -#endif - /* Compare S1 and S2, ignoring case. */ extern int strcasecmp (__const char *__s1, __const char *__s2) __THROW __attribute_pure__ __nonnull ((1, 2)); diff --git a/libc/inet/rpc/svc.c b/libc/inet/rpc/svc.c index 03b406200..b28485de3 100644 --- a/libc/inet/rpc/svc.c +++ b/libc/inet/rpc/svc.c @@ -41,6 +41,7 @@ #include #include +#include #include "rpc_private.h" #include #include @@ -452,7 +453,7 @@ svc_getreqset (fd_set *readfds) setsize = _rpc_dtablesize (); maskp = (u_int32_t *) readfds->fds_bits; for (sock = 0; sock < setsize; sock += 32) - for (mask = *maskp++; (bit = __libc_ffs (mask)); mask ^= (1 << (bit - 1))) + for (mask = *maskp++; (bit = ffs (mask)); mask ^= (1 << (bit - 1))) svc_getreq_common (sock + bit - 1); } libc_hidden_def(svc_getreqset) diff --git a/libc/string/ffs.c b/libc/string/ffs.c index 4a5336d47..f39d304b7 100644 --- a/libc/string/ffs.c +++ b/libc/string/ffs.c @@ -6,11 +6,9 @@ */ #include -#define ffsl __something_else -#include "_string.h" -#undef ffsl +#include -int __libc_ffs(int i) +int ffs(int i) { #if 1 /* inlined binary search method */ @@ -51,8 +49,7 @@ int __libc_ffs(int i) return n; #endif } -libc_hidden_def(__libc_ffs) -weak_alias(__libc_ffs,ffs) +libc_hidden_def(ffs) #if ULONG_MAX == UINT_MAX -weak_alias (__libc_ffs, ffsl) +strong_alias_untyped(ffs, ffsl) #endif diff --git a/libc/string/ffsll.c b/libc/string/ffsll.c index 29e9ba9d9..a7662900b 100644 --- a/libc/string/ffsll.c +++ b/libc/string/ffsll.c @@ -18,23 +18,19 @@ 02111-1307 USA. */ #include -#define ffsl __something_else -#include "_string.h" -#undef ffsl +#include /* Find the first bit set in I. */ -int __libc_ffsll (long long int i) +int ffsll (long long int i) { unsigned long long int x = i & -i; if (x <= 0xffffffff) - return __libc_ffs (i); + return ffs (i); else - return 32 + __libc_ffs (i >> 32); + return 32 + ffs (i >> 32); } -libc_hidden_def(__libc_ffsll) -weak_alias (__libc_ffsll, ffsll) #if ULONG_MAX != UINT_MAX -weak_alias (__libc_ffsll, ffsl) +strong_alias_untyped(ffsll, ffsl) #endif -- cgit v1.2.3 From 19373021defb3b917ba9617c3f45b22ab8da26dd Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Mon, 7 Mar 2011 17:28:57 +0100 Subject: locale.c, locale.h: no need for hidden duplocale Signed-off-by: Peter S. Mazinger --- include/locale.h | 1 - libc/misc/locale/locale.c | 1 - 2 files changed, 2 deletions(-) diff --git a/include/locale.h b/include/locale.h index d04c42ff6..b79626a46 100644 --- a/include/locale.h +++ b/include/locale.h @@ -204,7 +204,6 @@ libc_hidden_proto(newlocale) /* Return a duplicate of the set of locale in DATASET. All usage counters are increased if necessary. */ extern __locale_t duplocale (__locale_t __dataset) __THROW; -libc_hidden_proto(duplocale) /* Free the data associated with a locale dataset previously returned by a call to `setlocale_r'. */ diff --git a/libc/misc/locale/locale.c b/libc/misc/locale/locale.c index 255c10d61..e49cd3ba5 100644 --- a/libc/misc/locale/locale.c +++ b/libc/misc/locale/locale.c @@ -1337,7 +1337,6 @@ __locale_t duplocale(__locale_t dataset) } return r; } -libc_hidden_def(duplocale) #endif /**********************************************************************/ -- cgit v1.2.3 From 5c38edaeca35c3b3631d28acc43c96f3970d9d48 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Mon, 7 Mar 2011 17:39:14 +0100 Subject: locale.c: export newlocale only if XLOCALE is defined newlocale is used by setlocale, so we need the hidden version even if XLOCALE is not defined Signed-off-by: Peter S. Mazinger --- libc/misc/locale/locale.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libc/misc/locale/locale.c b/libc/misc/locale/locale.c index e49cd3ba5..40303ab14 100644 --- a/libc/misc/locale/locale.c +++ b/libc/misc/locale/locale.c @@ -1303,7 +1303,9 @@ __locale_t newlocale(int category_mask, const char *locale, __locale_t base) return base; } +#ifdef __UCLIBC_HAS_XLOCALE__ libc_hidden_def(newlocale) +#endif #endif /**********************************************************************/ -- cgit v1.2.3 From 07044019e6260991729926645e7d221f38376f9d Mon Sep 17 00:00:00 2001 From: Carmelo Amoroso Date: Mon, 7 Mar 2011 18:31:19 +0100 Subject: buildsys: prefer the form HEADERS_RM-$() Fix removal of sgtty.h using HEADERS_RM-$() syntax. Sort it alphabetically. Signed-off-by: Carmelo Amoroso --- Makefile.in | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Makefile.in b/Makefile.in index 995347bf0..dd88efc9e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -222,9 +222,6 @@ HEADERS_RM- := \ rpc/des_crypt.h \ rpc/key_prot.h \ rpc/rpc_des.h -ifeq ($(UCLIBC_STRICT_HEADERS),y) -HEADERS_RM- += sgtty.h -endif HEADERS_RM-$(HAVE_SHARED) += dlfcn.h bits/dlfcn.h HEADERS_RM-$(PTHREADS_DEBUG_SUPPORT) += thread_db.h HEADERS_RM-$(UCLIBC_HAS_BSD_ERR) += err.h @@ -275,6 +272,7 @@ HEADERS_RM-$(UCLIBC_LINUX_SPECIFIC) += sys/fsuid.h sys/inotify.h sys/pe sys/sysctl.h \ sys/sysinfo.h \ sys/vfs.h +HEADERS_RM-$(UCLIBC_STRICT_HEADERS) += sgtty.h HEADERS_RM-$(UCLIBC_SUPPORT_AI_ADDRCONFIG) += ifaddrs.h HEADERS_RM-$(UCLIBC_SV4_DEPRECATED) += ustat.h sys/ustat.h bits/ustat.h HEADERS_RM-$(UCLIBC_SUSV3_LEGACY) += sys/timeb.h regexp.h -- cgit v1.2.3 From 28bf003710d82135d0fe9f413c1df61c981f903c Mon Sep 17 00:00:00 2001 From: Carmelo Amoroso Date: Tue, 8 Mar 2011 11:39:48 +0100 Subject: Revert "buildsys: prefer the form HEADERS_RM-$()" This reverts commit 07044019e6260991729926645e7d221f38376f9d. Signed-off-by: Carmelo Amoroso --- Makefile.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index dd88efc9e..995347bf0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -222,6 +222,9 @@ HEADERS_RM- := \ rpc/des_crypt.h \ rpc/key_prot.h \ rpc/rpc_des.h +ifeq ($(UCLIBC_STRICT_HEADERS),y) +HEADERS_RM- += sgtty.h +endif HEADERS_RM-$(HAVE_SHARED) += dlfcn.h bits/dlfcn.h HEADERS_RM-$(PTHREADS_DEBUG_SUPPORT) += thread_db.h HEADERS_RM-$(UCLIBC_HAS_BSD_ERR) += err.h @@ -272,7 +275,6 @@ HEADERS_RM-$(UCLIBC_LINUX_SPECIFIC) += sys/fsuid.h sys/inotify.h sys/pe sys/sysctl.h \ sys/sysinfo.h \ sys/vfs.h -HEADERS_RM-$(UCLIBC_STRICT_HEADERS) += sgtty.h HEADERS_RM-$(UCLIBC_SUPPORT_AI_ADDRCONFIG) += ifaddrs.h HEADERS_RM-$(UCLIBC_SV4_DEPRECATED) += ustat.h sys/ustat.h bits/ustat.h HEADERS_RM-$(UCLIBC_SUSV3_LEGACY) += sys/timeb.h regexp.h -- cgit v1.2.3 From 2ea26d2c32507f11733a0d62e5723de26ea464ba Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Tue, 8 Mar 2011 12:49:10 +0100 Subject: try to fix duplicated slashes in the generated lib*.so files (round 2) sed s://:/:g on libc.so/libpthread.so if HARDWIRED_ABSPATH is defined Signed-off-by: Peter S. Mazinger --- Makefile.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile.in b/Makefile.in index 995347bf0..8c5689b2a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -327,6 +327,7 @@ ifeq ($(HARDWIRED_ABSPATH),y) -e 's:$(SHARED_LIBNAME):$(RUNTIME_PREFIX)$(MULTILIB_DIR)/$(SHARED_LIBNAME):' \ -e 's:$(UCLIBC_LDSO):$(RUNTIME_PREFIX)$(MULTILIB_DIR)/$(UCLIBC_LDSO):' \ $(top_builddir)lib/libc.so > $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libc.so; \ + $(SED) -i -e 's://:/:g' $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libc.so; \ fi else -$(INSTALL) -m 755 $(top_builddir)lib/libc.so $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/ @@ -345,6 +346,7 @@ ifeq ($(HARDWIRED_ABSPATH),y) cp $(top_srcdir)extra/scripts/format.lds $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libpthread.so; \ echo "GROUP ( $(RUNTIME_PREFIX)$(MULTILIB_DIR)/libpthread.so.$(ABI_VERSION) $(DEVEL_PREFIX)$(MULTILIB_DIR)/libpthread_nonshared.a )" \ >> $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libpthread.so; \ + $(SED) -i -e 's://:/:g' $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libpthread.so; \ fi else -$(INSTALL) -m 755 $(top_builddir)lib/libpthread.so $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/ -- cgit v1.2.3 From 5dffed7dd1a413f3965af702fa7ecd79809d1988 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Tue, 8 Mar 2011 12:56:13 +0100 Subject: Makerules: respect HARDWIRED_ABSPATH in interp.c Build LDSO path according to the HARDWIRED_ABSPATH setting While there, remove duplicated slashes in interp.c Signed-off-by: Peter S. Mazinger --- Makerules | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makerules b/Makerules index 3a4d566d4..f045e527f 100644 --- a/Makerules +++ b/Makerules @@ -364,8 +364,14 @@ $(top_builddir)%.dep: $(top_builddir)lib/interp.c: | $(top_builddir)lib $(Q)echo "/* Force shared libraries to know about the correct library loader */" > $@.tmp $(Q)echo "#include " >> $@.tmp +ifeq ($(HARDWIRED_ABSPATH),y) $(Q)echo "const char __dl_ldso__[] attribute_hidden __attribute__ ((weak)) __attribute__ ((section " \ "(\".interp\"))) =\""$(RUNTIME_PREFIX)$(MULTILIB_DIR)/$(UCLIBC_LDSO)"\";" >> $@.tmp + $(Q)$(SED) -i -e 's://:/:g' $@.tmp +else + $(Q)echo "const char __dl_ldso__[] attribute_hidden __attribute__ ((weak)) __attribute__ ((section " \ + "(\".interp\"))) =\""$(UCLIBC_LDSO)"\";" >> $@.tmp +endif $(Q)mv $@.tmp $@ $(interp): $(top_builddir)lib/interp.c | $(sub_headers) -- cgit v1.2.3 From d79710b3219420d4813479cf6542f31124fd1d33 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Tue, 8 Mar 2011 14:00:06 +0100 Subject: Makefile.in: remove uClibc_uwchar.h and uClibc_va_copy.h on install Signed-off-by: Peter S. Mazinger --- Makefile.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile.in b/Makefile.in index 8c5689b2a..381b8a93e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -216,6 +216,8 @@ HEADERS_RM- := \ bits/syscalls.h \ bits/syscalls-common.h \ bits/uClibc_uintmaxtostr.h \ + bits/uClibc_uwchar.h \ + bits/uClibc_va_copy.h \ bits/sigcontextinfo.h \ bits/stackinfo.h \ tls.h \ -- cgit v1.2.3 From 094e03a6600f0029aa045431f9bac1bd32b3193d Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Tue, 8 Mar 2011 14:01:04 +0100 Subject: resolv.h: disable unneeded prototypes Signed-off-by: Peter S. Mazinger --- include/resolv.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/resolv.h b/include/resolv.h index b9ce1e2a2..cba26f004 100644 --- a/include/resolv.h +++ b/include/resolv.h @@ -282,46 +282,61 @@ extern struct __res_state *__res_state(void) __attribute__ ((__const__)); __END_DECLS #define _res (*__res_state()) +#if 0 #define fp_nquery __fp_nquery #define fp_query __fp_query #define hostalias __hostalias #define p_query __p_query +#endif #define res_close __res_close #define res_init __res_init +#if 0 #define res_isourserver __res_isourserver #define res_mkquery __res_mkquery +#endif #define res_query __res_query #define res_querydomain __res_querydomain #define res_search __res_search +#if 0 #define res_send __res_send +#endif __BEGIN_DECLS +#if 0 void fp_nquery (const u_char *, int, FILE *) __THROW; void fp_query (const u_char *, FILE *) __THROW; const char * hostalias (const char *) __THROW; void p_query (const u_char *) __THROW; +#endif #ifdef __UCLIBC_HAS_BSD_RES_CLOSE__ void res_close (void) __THROW; #endif int res_init (void) __THROW; libc_hidden_proto(res_init) +#if 0 int res_isourserver (const struct sockaddr_in *) __THROW; int res_mkquery (int, const char *, int, int, const u_char *, int, const u_char *, u_char *, int) __THROW; +#endif int res_query (const char *, int, int, u_char *, int) __THROW; libc_hidden_proto(res_query) int res_querydomain (const char *, const char *, int, int, u_char *, int) __THROW; libc_hidden_proto(res_querydomain) int res_search (const char *, int, int, u_char *, int) __THROW; +#if 0 int res_send (const u_char *, int, u_char *, int) __THROW; +#endif __END_DECLS +#if 0 #define b64_ntop __b64_ntop #define b64_pton __b64_pton #define dn_comp __dn_comp #define dn_count_labels __dn_count_labels +#endif #define dn_expand __dn_expand +#if 0 #define dn_skipname __dn_skipname #define fp_resstat __fp_resstat #define loc_aton __loc_aton @@ -359,7 +374,9 @@ __END_DECLS #define sym_ntop __sym_ntop #define sym_ntos __sym_ntos #define sym_ston __sym_ston +#endif __BEGIN_DECLS +#if 0 int res_hnok (const char *) __THROW; int res_ownok (const char *) __THROW; int res_mailok (const char *) __THROW; @@ -389,8 +406,10 @@ char * p_secstodate (u_long) __THROW; int dn_count_labels (const char *) __THROW; int dn_comp (const char *, u_char *, int, u_char **, u_char **) __THROW; +#endif int dn_expand (const u_char *, const u_char *, const u_char *, char *, int) __THROW; +#if 0 u_int res_randomid (void) __THROW; int res_nameinquery (const char *, int, int, const u_char *, const u_char *) __THROW; @@ -418,6 +437,7 @@ int res_nmkquery (res_state, int, const char *, int, int, int res_nsend (res_state, const u_char *, int, u_char *, int) __THROW; void res_nclose (res_state) __THROW; +#endif __END_DECLS # if _LIBC -- cgit v1.2.3 From 3225a1935c46932de26bea2989f145098ef8bf6d Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Tue, 8 Mar 2011 15:50:01 +0100 Subject: Makefile.in: remove uClibc_fpmax.h independently of any config option Signed-off-by: Peter S. Mazinger --- Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index 381b8a93e..0c1f414ec 100644 --- a/Makefile.in +++ b/Makefile.in @@ -215,6 +215,7 @@ HEADERS_RM- := \ bits/kernel_types.h \ bits/syscalls.h \ bits/syscalls-common.h \ + bits/uClibc_fpmax.h \ bits/uClibc_uintmaxtostr.h \ bits/uClibc_uwchar.h \ bits/uClibc_va_copy.h \ @@ -236,7 +237,6 @@ HEADERS_RM-$(UCLIBC_HAS_FENV) += fenv.h bits/fenv.h bits/fenvinli HEADERS_RM-$(UCLIBC_HAS_FLOATS) += complex.h fpu_control.h ieee754.h \ math.h \ tgmath.h \ - bits/uClibc_fpmax.h \ bits/math*.h HEADERS_RM-$(findstring y,$(UCLIBC_HAS_FTW)$(UCLIBC_HAS_NFTW)) += ftw.h HEADERS_RM-$(UCLIBC_HAS_GETTEXT_AWARENESS) += libintl.h -- cgit v1.2.3 From eb68c5d7a4e76ab06443d42aaf2d9a72dd059a04 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Tue, 8 Mar 2011 17:23:30 +0100 Subject: shm.h: fix vax's bits/shm.h Do not use __ipc_pid_t, since that is not visible after install. Provide and use shmatt_t. Add missing __END_DECLS. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/vax/bits/shm.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libc/sysdeps/linux/vax/bits/shm.h b/libc/sysdeps/linux/vax/bits/shm.h index 191709f0e..f1a44c982 100644 --- a/libc/sysdeps/linux/vax/bits/shm.h +++ b/libc/sysdeps/linux/vax/bits/shm.h @@ -40,6 +40,10 @@ __BEGIN_DECLS #define SHMLBA (__getpagesize ()) extern int __getpagesize (void) __THROW __attribute__ ((__const__)); + +/* Type to count number of attaches. */ +typedef unsigned short int shmatt_t; + /* Data structure describing a set of semaphores. */ struct shmid_ds { @@ -48,9 +52,9 @@ struct shmid_ds __time_t shm_atime; /* time of last shmat() */ __time_t shm_dtime; /* time of last shmdt() */ __time_t shm_ctime; /* time of last change by shmctl() */ - __ipc_pid_t shm_cpid; /* pid of creator */ - __ipc_pid_t shm_lpid; /* pid of last shmop */ - unsigned short int shm_nattch; /* number of current attaches */ + __pid_t shm_cpid; /* pid of creator */ + __pid_t shm_lpid; /* pid of last shmop */ + shmatt_t shm_nattch; /* number of current attaches */ unsigned short int __shm_npages; /* size of segment (pages) */ unsigned long int *__shm_pages; /* array of ptrs to frames -> SHMMAX */ struct vm_area_struct *__attaches; /* descriptors for attaches */ @@ -86,3 +90,5 @@ struct shm_info }; #endif /* __USE_MISC */ + +__END_DECLS -- cgit v1.2.3 From 526af41956be03b56e1bf33ec144e797256c1255 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Tue, 8 Mar 2011 02:12:11 -0600 Subject: nptl: fix compilation on x86_64 This commit gives us a fully functioning NPTL on x86-64 by using the GOTOFF macro as needed. Signed-off-by: William Pitcock Signed-off-by: Khem Raj --- libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S | 2 +- .../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S | 2 +- .../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S | 10 +--------- .../unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S | 2 +- .../unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S | 2 +- libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S | 2 +- 6 files changed, 6 insertions(+), 14 deletions(-) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S index f87532359..e59bdda44 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S @@ -163,7 +163,7 @@ __lll_timedlock_wait: cfi_startproc # ifndef __ASSUME_FUTEX_CLOCK_REALTIME # ifdef __PIC__ - cmpl $0, __have_futex_clock_realtime(%rip) + cmpl $0, __have_futex_clock_realtime@GOTOFF(%rip) # else cmpl $0, __have_futex_clock_realtime # endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S index 2eb8e29fa..5cc4256a5 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S @@ -118,7 +118,7 @@ __lll_robust_timedlock_wait: cfi_startproc # ifndef __ASSUME_FUTEX_CLOCK_REALTIME # ifdef __PIC__ - cmpl $0, __have_futex_clock_realtime(%rip) + cmpl $0, __have_futex_clock_realtime@GOTOFF(%rip) # else cmpl $0, __have_futex_clock_realtime # endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S index 3a965ad0b..645436f99 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S @@ -98,7 +98,7 @@ __pthread_cond_timedwait: 22: #ifndef __ASSUME_FUTEX_CLOCK_REALTIME # ifdef __PIC__ - cmpl $0, __have_futex_clock_realtime(%rip) + cmpl $0, __have_futex_clock_realtime@GOTOFF(%rip) # else cmpl $0, __have_futex_clock_realtime # endif @@ -437,14 +437,6 @@ __pthread_cond_timedwait: /* Only clocks 0 and 1 are allowed so far. Both are handled in the kernel. */ leaq 32(%rsp), %rsi -# ifdef SHARED - movq __vdso_clock_gettime@GOTPCREL(%rip), %rax - movq (%rax), %rax - PTR_DEMANGLE (%rax) - jz 26f - call *%rax - jmp 27f -# endif 26: movl $__NR_clock_gettime, %eax syscall 27: diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S index 3629ffbe5..15edd6149 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S @@ -96,7 +96,7 @@ pthread_rwlock_timedrdlock: 11: #ifndef __ASSUME_FUTEX_CLOCK_REALTIME # ifdef __PIC__ - cmpl $0, __have_futex_clock_realtime(%rip) + cmpl $0, __have_futex_clock_realtime@GOTOFF(%rip) # else cmpl $0, __have_futex_clock_realtime # endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S index 23e1ee155..3c4a27912 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S @@ -93,7 +93,7 @@ pthread_rwlock_timedwrlock: 11: #ifndef __ASSUME_FUTEX_CLOCK_REALTIME # ifdef __PIC__ - cmpl $0, __have_futex_clock_realtime(%rip) + cmpl $0, __have_futex_clock_realtime@GOTOFF(%rip) # else cmpl $0, __have_futex_clock_realtime # endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S index 704a2223a..3ff34120c 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S @@ -61,7 +61,7 @@ sem_timedwait: #ifndef __ASSUME_FUTEX_CLOCK_REALTIME # ifdef __PIC__ - cmpl $0, __have_futex_clock_realtime(%rip) + cmpl $0, __have_futex_clock_realtime@GOTOFF(%rip) # else cmpl $0, __have_futex_clock_realtime # endif -- cgit v1.2.3 From eb9cca27b385873c6788b18a13d918c873540866 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Tue, 8 Mar 2011 09:34:25 +0100 Subject: nios2: Correct guard #defines in bits/kernel_types.h The guards in posix_types.h are called _ASM_NIOS2_POSIX_TYPES_H, so correctly use them here. Otherwise we wont be able to build uClibc with headers exported from the current nios2 kernel. Signed-off-by: Tobias Klauser Signed-off-by: Khem Raj --- libc/sysdeps/linux/nios2/bits/kernel_types.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libc/sysdeps/linux/nios2/bits/kernel_types.h b/libc/sysdeps/linux/nios2/bits/kernel_types.h index 3fcd1af05..8b86d796f 100644 --- a/libc/sysdeps/linux/nios2/bits/kernel_types.h +++ b/libc/sysdeps/linux/nios2/bits/kernel_types.h @@ -4,8 +4,8 @@ * our private content, and not the kernel header, will win. * -Erik */ -#ifndef __ARCH_NIOS2_POSIX_TYPES_H -#define __ARCH_NIOS2_POSIX_TYPES_H +#ifndef _ASM_NIOS2_POSIX_TYPES_H +#define _ASM_NIOS2_POSIX_TYPES_H typedef unsigned long __kernel_dev_t; typedef unsigned long __kernel_ino_t; @@ -41,4 +41,4 @@ typedef struct { #endif } __kernel_fsid_t; -#endif /* __ARCH_NIOS2_POSIX_TYPES_H */ +#endif /* _ASM_NIOS2_POSIX_TYPES_H */ -- cgit v1.2.3 From 82098ab9b853c33ee8ade61c9510b295cc696de1 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 09:23:48 +0100 Subject: guard *_chk() related stuff with UCLIBC_HAS_FORTIFY Guard x86_64 memset_chk/memcpy_chk be guarded by UCLIBC_HAS_FORTIFY. Compile ssp.c if one of SSP/FORTIFY is defined. Guard __chk_fail() with UCLIBC_HAS_FORTIFY and move its prototype to libc-internal.h. Disable _FORTIFY_SOURCE if UCLIBC_HAS_FORTIFY is not set. The config option itself is omitted on purpose, headers need to be reviewed and generic *_chk() functions need to be first provided. Signed-off-by: Peter S. Mazinger --- include/features.h | 5 ++++- include/libc-internal.h | 5 +++++ libc/string/x86_64/memcpy.S | 4 +--- libc/string/x86_64/memset.S | 6 ++---- libc/sysdeps/linux/common/Makefile.in | 2 +- libc/sysdeps/linux/common/ssp.c | 6 +++++- 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/include/features.h b/include/features.h index f4d70d70f..41e83a93f 100644 --- a/include/features.h +++ b/include/features.h @@ -198,9 +198,12 @@ # define __OPTIMIZE_SIZE__ 1 /* disable unsupported features */ -# undef _FORTIFY_SOURCE # undef __LDBL_COMPAT +# ifndef __UCLIBC_HAS_FORTIFY__ +# undef _FORTIFY_SOURCE +# endif + # ifndef __UCLIBC_HAS_THREADS__ # if defined _REENTRANT || defined _THREAD_SAFE # warning requested reentrant code, but thread support was disabled diff --git a/include/libc-internal.h b/include/libc-internal.h index 443b1fc50..3ac0b0509 100644 --- a/include/libc-internal.h +++ b/include/libc-internal.h @@ -65,6 +65,11 @@ libc_hidden_proto(__glibc_strerror_r) /* internal access to program name */ extern const char *__uclibc_progname attribute_hidden; +# ifdef __UCLIBC_HAS_FORTIFY__ +extern void __chk_fail(void) attribute_noreturn; +libc_hidden_proto(__chk_fail) +# endif + # endif /* IS_IN_libc */ #endif /* __ASSEMBLER__ */ diff --git a/libc/string/x86_64/memcpy.S b/libc/string/x86_64/memcpy.S index 6d941e0f2..9c8169b42 100644 --- a/libc/string/x86_64/memcpy.S +++ b/libc/string/x86_64/memcpy.S @@ -26,12 +26,10 @@ #define MEMPCPY_P (defined memcpy) .text -#if defined __PIC__ && !defined NOT_IN_libc +#if defined __PIC__ && !defined NOT_IN_libc && defined __UCLIBC_HAS_FORTIFY__ ENTRY (__memcpy_chk) cmpq %rdx, %rcx -#if defined __UCLIBC_HAS_SSP__ jb HIDDEN_JUMPTARGET (__chk_fail) -#endif END (__memcpy_chk) #endif ENTRY (BP_SYM (memcpy)) diff --git a/libc/string/x86_64/memset.S b/libc/string/x86_64/memset.S index df265f394..6b758ce3a 100644 --- a/libc/string/x86_64/memset.S +++ b/libc/string/x86_64/memset.S @@ -29,12 +29,10 @@ #define LARGE $120000 .text -#if defined __PIC__ && !defined NOT_IN_libc +#if defined __PIC__ && !defined NOT_IN_libc && defined __UCLIBC_HAS_FORTIFY__ ENTRY (__memset_chk) cmpq %rdx, %rcx -#if defined __UCLIBC_HAS_SSP__ jb HIDDEN_JUMPTARGET (__chk_fail) -#endif END (__memset_chk) #endif ENTRY (memset) @@ -144,6 +142,6 @@ END (memset) libc_hidden_def(memset) #endif -#if !BZERO_P && defined __PIC__ && !defined NOT_IN_libc +#if !BZERO_P && defined __PIC__ && !defined NOT_IN_libc && defined __UCLIBC_HAS_FORTIFY__ strong_alias (__memset_chk, __memset_zero_constant_len_parameter) #endif diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index fd55333fc..3f9791104 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -15,7 +15,7 @@ CSRC_LFS := $(notdir $(wildcard $(COMMON_DIR)/*64.c)) CSRC-y := $(filter-out llseek.c $(CSRC_LFS),$(CSRC-y)) CSRC-$(UCLIBC_HAS_LFS) += llseek.c $(CSRC_LFS) -CSRC-$(UCLIBC_HAS_SSP) += ssp.c +CSRC-$(if $(or $(UCLIBC_HAS_SSP),$(UCLIBC_HAS_FORTIFY)),y) += ssp.c CSRC-$(UCLIBC_LINUX_MODULE_24) += create_module.c query_module.c \ get_kernel_syms.c # we need these internally: fstatfs.c statfs.c diff --git a/libc/sysdeps/linux/common/ssp.c b/libc/sysdeps/linux/common/ssp.c index d81c706f4..df242cc69 100644 --- a/libc/sysdeps/linux/common/ssp.c +++ b/libc/sysdeps/linux/common/ssp.c @@ -87,6 +87,7 @@ void __stack_smash_handler(char func[], int damaged) } #endif +#ifdef __UCLIBC_HAS_SSP__ void __stack_chk_fail(void) attribute_noreturn __cold; void __stack_chk_fail(void) { @@ -101,8 +102,9 @@ void __stack_chk_fail(void) while(1) terminate(); } +#endif -void __chk_fail(void) attribute_noreturn; +#ifdef __UCLIBC_HAS_FORTIFY__ void __chk_fail(void) { static const char msg1[] = "buffer overflow detected: "; @@ -116,3 +118,5 @@ void __chk_fail(void) while(1) terminate(); } +libc_hidden_def(__chk_fail) +#endif -- cgit v1.2.3 From 117fbd4310fa600d0449d4268b4e6ee833471e1a Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 09:54:15 +0100 Subject: types.h: remove __ipc_pid_t Remove __ipc_pid_t, not needed internally, we do not support pre glibc-2.2 version of shmid_ds structure. Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/bits/types.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/libc/sysdeps/linux/common/bits/types.h b/libc/sysdeps/linux/common/bits/types.h index 24d0056fb..c4c10e2ff 100644 --- a/libc/sysdeps/linux/common/bits/types.h +++ b/libc/sysdeps/linux/common/bits/types.h @@ -200,11 +200,6 @@ __STD_TYPE __U32_TYPE __socklen_t; #undef __STD_TYPE -#ifdef _LIBC -/* Used in `struct shmid_ds'. */ -typedef __kernel_ipc_pid_t __ipc_pid_t; -#endif - /* Now add the thread types. */ #if defined __UCLIBC_HAS_THREADS__ && (defined __USE_POSIX199506 || defined __USE_UNIX98) # include -- cgit v1.2.3 From 51349317457d45038d68464a02e8ccd6a5d4ca8d Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 12:20:28 +0100 Subject: bits/kernel_stat.h: use the same guard on all archs Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/cris/bits/kernel_stat.h | 4 ++-- libc/sysdeps/linux/hppa/bits/kernel_stat.h | 4 ++-- libc/sysdeps/linux/ia64/bits/kernel_stat.h | 6 +++--- libc/sysdeps/linux/x86_64/bits/kernel_stat.h | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libc/sysdeps/linux/cris/bits/kernel_stat.h b/libc/sysdeps/linux/cris/bits/kernel_stat.h index b54f29210..ce22730fb 100644 --- a/libc/sysdeps/linux/cris/bits/kernel_stat.h +++ b/libc/sysdeps/linux/cris/bits/kernel_stat.h @@ -1,7 +1,7 @@ /* Taken from linux/include/asm-cris/stat.h */ -#ifndef _CRIS_STAT_H -#define _CRIS_STAT_H +#ifndef _BITS_STAT_STRUCT_H +#define _BITS_STAT_STRUCT_H #ifndef _LIBC #error bits/kernel_stat.h is for internal uClibc use only! diff --git a/libc/sysdeps/linux/hppa/bits/kernel_stat.h b/libc/sysdeps/linux/hppa/bits/kernel_stat.h index d33a7e720..c4432578f 100644 --- a/libc/sysdeps/linux/hppa/bits/kernel_stat.h +++ b/libc/sysdeps/linux/hppa/bits/kernel_stat.h @@ -1,8 +1,8 @@ /* Ripped from linux/include/asm-parisc/stat.h * and renamed 'struct stat' to 'struct kernel_stat' */ -#ifndef _PARISC_STAT_H -#define _PARISC_STAT_H +#ifndef _BITS_STAT_STRUCT_H +#define _BITS_STAT_STRUCT_H #ifndef _LIBC #error bits/kernel_stat.h is for internal uClibc use only! diff --git a/libc/sysdeps/linux/ia64/bits/kernel_stat.h b/libc/sysdeps/linux/ia64/bits/kernel_stat.h index 5af7e93a8..3d17d3912 100644 --- a/libc/sysdeps/linux/ia64/bits/kernel_stat.h +++ b/libc/sysdeps/linux/ia64/bits/kernel_stat.h @@ -1,8 +1,8 @@ /* Ripped from linux/include/asm-ia64/stat.h * and renamed 'struct stat' to 'struct kernel_stat' */ -#ifndef _ASM_IA64_STAT_H -#define _ASM_IA64_STAT_H +#ifndef _BITS_STAT_STRUCT_H +#define _BITS_STAT_STRUCT_H #ifndef _LIBC #error bits/kernel_stat.h is for internal uClibc use only! @@ -34,4 +34,4 @@ struct kernel_stat { /* ia64 stat64 is same as stat */ #define kernel_stat64 kernel_stat -#endif /* _ASM_IA64_STAT_H */ +#endif /* _BITS_STAT_STRUCT_H */ diff --git a/libc/sysdeps/linux/x86_64/bits/kernel_stat.h b/libc/sysdeps/linux/x86_64/bits/kernel_stat.h index 2c1deb0d9..b3a07f12e 100644 --- a/libc/sysdeps/linux/x86_64/bits/kernel_stat.h +++ b/libc/sysdeps/linux/x86_64/bits/kernel_stat.h @@ -1,8 +1,8 @@ /* Ripped from linux/include/asm-x86_64/stat.h * and renamed 'struct stat' to 'struct kernel_stat' */ -#ifndef _ASM_X86_64_STAT_H -#define _ASM_X86_64_STAT_H +#ifndef _BITS_STAT_STRUCT_H +#define _BITS_STAT_STRUCT_H #ifndef _LIBC #error bits/kernel_stat.h is for internal uClibc use only! -- cgit v1.2.3 From 41647059ec1945a258a9ee26638a1c0e4d181eaa Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 12:31:15 +0100 Subject: bits/kernel_stat.h: no need for _LIBC guard, the file is not installed on target Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/alpha/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/arm/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/avr32/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/bfin/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/cris/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/e1/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/frv/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/h8300/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/hppa/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/i386/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/ia64/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/m68k/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/microblaze/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/mips/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/nios2/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/powerpc/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/sh/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/sh64/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/sparc/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/v850/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/vax/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/x86_64/bits/kernel_stat.h | 4 ---- libc/sysdeps/linux/xtensa/bits/kernel_stat.h | 4 ---- 23 files changed, 92 deletions(-) diff --git a/libc/sysdeps/linux/alpha/bits/kernel_stat.h b/libc/sysdeps/linux/alpha/bits/kernel_stat.h index 8279a3915..e919b210d 100644 --- a/libc/sysdeps/linux/alpha/bits/kernel_stat.h +++ b/libc/sysdeps/linux/alpha/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/arm/bits/kernel_stat.h b/libc/sysdeps/linux/arm/bits/kernel_stat.h index 2ca63a223..7bd89f9ab 100644 --- a/libc/sysdeps/linux/arm/bits/kernel_stat.h +++ b/libc/sysdeps/linux/arm/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/avr32/bits/kernel_stat.h b/libc/sysdeps/linux/avr32/bits/kernel_stat.h index 8442c3c1c..d98c6cfef 100644 --- a/libc/sysdeps/linux/avr32/bits/kernel_stat.h +++ b/libc/sysdeps/linux/avr32/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* * This file provides struct stat, taken from kernel 2.6.4. Verified * to match kernel 2.6.22. diff --git a/libc/sysdeps/linux/bfin/bits/kernel_stat.h b/libc/sysdeps/linux/bfin/bits/kernel_stat.h index b1a3251e5..7700d6109 100644 --- a/libc/sysdeps/linux/bfin/bits/kernel_stat.h +++ b/libc/sysdeps/linux/bfin/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/cris/bits/kernel_stat.h b/libc/sysdeps/linux/cris/bits/kernel_stat.h index ce22730fb..619f35e9e 100644 --- a/libc/sysdeps/linux/cris/bits/kernel_stat.h +++ b/libc/sysdeps/linux/cris/bits/kernel_stat.h @@ -3,10 +3,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - struct kernel_stat { unsigned short st_dev; unsigned short __pad1; diff --git a/libc/sysdeps/linux/e1/bits/kernel_stat.h b/libc/sysdeps/linux/e1/bits/kernel_stat.h index 2b432cf52..99a6cba97 100644 --- a/libc/sysdeps/linux/e1/bits/kernel_stat.h +++ b/libc/sysdeps/linux/e1/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/frv/bits/kernel_stat.h b/libc/sysdeps/linux/frv/bits/kernel_stat.h index 634066df6..1cf521044 100644 --- a/libc/sysdeps/linux/frv/bits/kernel_stat.h +++ b/libc/sysdeps/linux/frv/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/h8300/bits/kernel_stat.h b/libc/sysdeps/linux/h8300/bits/kernel_stat.h index 2b95465b7..5f6c8ae50 100644 --- a/libc/sysdeps/linux/h8300/bits/kernel_stat.h +++ b/libc/sysdeps/linux/h8300/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/hppa/bits/kernel_stat.h b/libc/sysdeps/linux/hppa/bits/kernel_stat.h index c4432578f..097abfb40 100644 --- a/libc/sysdeps/linux/hppa/bits/kernel_stat.h +++ b/libc/sysdeps/linux/hppa/bits/kernel_stat.h @@ -4,10 +4,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - struct kernel_stat { unsigned int st_dev; /* dev_t is 32 bits on parisc */ ino_t st_ino; /* 32 bits */ diff --git a/libc/sysdeps/linux/i386/bits/kernel_stat.h b/libc/sysdeps/linux/i386/bits/kernel_stat.h index decbeb915..231a984b4 100644 --- a/libc/sysdeps/linux/i386/bits/kernel_stat.h +++ b/libc/sysdeps/linux/i386/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/ia64/bits/kernel_stat.h b/libc/sysdeps/linux/ia64/bits/kernel_stat.h index 3d17d3912..28abc4bf5 100644 --- a/libc/sysdeps/linux/ia64/bits/kernel_stat.h +++ b/libc/sysdeps/linux/ia64/bits/kernel_stat.h @@ -4,10 +4,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* * Modified 1998, 1999 * David Mosberger-Tang , Hewlett-Packard Co diff --git a/libc/sysdeps/linux/m68k/bits/kernel_stat.h b/libc/sysdeps/linux/m68k/bits/kernel_stat.h index 4cb06cc97..3911c9bbf 100644 --- a/libc/sysdeps/linux/m68k/bits/kernel_stat.h +++ b/libc/sysdeps/linux/m68k/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/microblaze/bits/kernel_stat.h b/libc/sysdeps/linux/microblaze/bits/kernel_stat.h index 2c5eb28af..c2695098d 100644 --- a/libc/sysdeps/linux/microblaze/bits/kernel_stat.h +++ b/libc/sysdeps/linux/microblaze/bits/kernel_stat.h @@ -3,10 +3,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - struct kernel_stat { unsigned long st_dev; /* Device. */ diff --git a/libc/sysdeps/linux/mips/bits/kernel_stat.h b/libc/sysdeps/linux/mips/bits/kernel_stat.h index dc3565acc..655c089e0 100644 --- a/libc/sysdeps/linux/mips/bits/kernel_stat.h +++ b/libc/sysdeps/linux/mips/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/nios2/bits/kernel_stat.h b/libc/sysdeps/linux/nios2/bits/kernel_stat.h index 2b432cf52..99a6cba97 100644 --- a/libc/sysdeps/linux/nios2/bits/kernel_stat.h +++ b/libc/sysdeps/linux/nios2/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/powerpc/bits/kernel_stat.h b/libc/sysdeps/linux/powerpc/bits/kernel_stat.h index d8a9bc2e2..579b5b4e2 100644 --- a/libc/sysdeps/linux/powerpc/bits/kernel_stat.h +++ b/libc/sysdeps/linux/powerpc/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/sh/bits/kernel_stat.h b/libc/sysdeps/linux/sh/bits/kernel_stat.h index 8e6ffb498..5b51b3cd3 100644 --- a/libc/sysdeps/linux/sh/bits/kernel_stat.h +++ b/libc/sysdeps/linux/sh/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/sh64/bits/kernel_stat.h b/libc/sysdeps/linux/sh64/bits/kernel_stat.h index 57c16f473..1a29433e1 100644 --- a/libc/sysdeps/linux/sh64/bits/kernel_stat.h +++ b/libc/sysdeps/linux/sh64/bits/kernel_stat.h @@ -3,10 +3,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - struct kernel_stat { unsigned short st_dev; unsigned short __pad1; diff --git a/libc/sysdeps/linux/sparc/bits/kernel_stat.h b/libc/sysdeps/linux/sparc/bits/kernel_stat.h index a9b5b534f..f09ae3734 100644 --- a/libc/sysdeps/linux/sparc/bits/kernel_stat.h +++ b/libc/sysdeps/linux/sparc/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/v850/bits/kernel_stat.h b/libc/sysdeps/linux/v850/bits/kernel_stat.h index a7c9a73bf..1b925ca77 100644 --- a/libc/sysdeps/linux/v850/bits/kernel_stat.h +++ b/libc/sysdeps/linux/v850/bits/kernel_stat.h @@ -3,10 +3,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - struct kernel_stat { __kernel_dev_t st_dev; diff --git a/libc/sysdeps/linux/vax/bits/kernel_stat.h b/libc/sysdeps/linux/vax/bits/kernel_stat.h index 4636a139c..a6da833c4 100644 --- a/libc/sysdeps/linux/vax/bits/kernel_stat.h +++ b/libc/sysdeps/linux/vax/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct stat should look like... It turns out each arch has a * different opinion on the subject... */ diff --git a/libc/sysdeps/linux/x86_64/bits/kernel_stat.h b/libc/sysdeps/linux/x86_64/bits/kernel_stat.h index b3a07f12e..e194a7f76 100644 --- a/libc/sysdeps/linux/x86_64/bits/kernel_stat.h +++ b/libc/sysdeps/linux/x86_64/bits/kernel_stat.h @@ -4,10 +4,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - struct kernel_stat { unsigned long st_dev; unsigned long st_ino; diff --git a/libc/sysdeps/linux/xtensa/bits/kernel_stat.h b/libc/sysdeps/linux/xtensa/bits/kernel_stat.h index 10a35a23a..5e4f5c4e5 100644 --- a/libc/sysdeps/linux/xtensa/bits/kernel_stat.h +++ b/libc/sysdeps/linux/xtensa/bits/kernel_stat.h @@ -1,10 +1,6 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - /* This file provides whatever this particular arch's kernel thinks * struct kernel_stat should look like... It turns out each arch has a * different opinion on the subject... */ -- cgit v1.2.3 From 369cc066a46fba5455be15e0403a7c8bcdd84c22 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 12:35:27 +0100 Subject: bits/statvfs.h: the common one is good for alpha and sparc Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/alpha/bits/statvfs.h | 96 ----------------------------- libc/sysdeps/linux/sparc/bits/statvfs.h | 106 -------------------------------- 2 files changed, 202 deletions(-) delete mode 100644 libc/sysdeps/linux/alpha/bits/statvfs.h delete mode 100644 libc/sysdeps/linux/sparc/bits/statvfs.h diff --git a/libc/sysdeps/linux/alpha/bits/statvfs.h b/libc/sysdeps/linux/alpha/bits/statvfs.h deleted file mode 100644 index d37d0ffcb..000000000 --- a/libc/sysdeps/linux/alpha/bits/statvfs.h +++ /dev/null @@ -1,96 +0,0 @@ -/* Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _SYS_STATVFS_H -# error "Never include directly; use instead." -#endif - -#include /* For __fsblkcnt_t and __fsfilcnt_t. */ - -struct statvfs - { - unsigned long int f_bsize; - unsigned long int f_frsize; -#ifndef __USE_FILE_OFFSET64 - __fsblkcnt_t f_blocks; - __fsblkcnt_t f_bfree; - __fsblkcnt_t f_bavail; - __fsfilcnt_t f_files; - __fsfilcnt_t f_ffree; - __fsfilcnt_t f_favail; -#else - __fsblkcnt64_t f_blocks; - __fsblkcnt64_t f_bfree; - __fsblkcnt64_t f_bavail; - __fsfilcnt64_t f_files; - __fsfilcnt64_t f_ffree; - __fsfilcnt64_t f_favail; -#endif - unsigned long int f_fsid; - unsigned long int f_flag; - unsigned long int f_namemax; - int __f_spare[6]; - }; - -#ifdef __USE_LARGEFILE64 -struct statvfs64 - { - unsigned long int f_bsize; - unsigned long int f_frsize; - __fsblkcnt64_t f_blocks; - __fsblkcnt64_t f_bfree; - __fsblkcnt64_t f_bavail; - __fsfilcnt64_t f_files; - __fsfilcnt64_t f_ffree; - __fsfilcnt64_t f_favail; - unsigned long int f_fsid; - unsigned long int f_flag; - unsigned long int f_namemax; - int __f_spare[6]; - }; -#endif - -/* Definitions for the flag in `f_flag'. These definitions should be - kept in sync which the definitions in . */ -enum -{ - ST_RDONLY = 1, /* Mount read-only. */ -#define ST_RDONLY ST_RDONLY - ST_NOSUID = 2, /* Ignore suid and sgid bits. */ -#define ST_NOSUID ST_NOSUID -#ifdef __USE_GNU - ST_NODEV = 4, /* Disallow access to device special files. */ -# define ST_NODEV ST_NODEV - ST_NOEXEC = 8, /* Disallow program execution. */ -# define ST_NOEXEC ST_NOEXEC - ST_SYNCHRONOUS = 16, /* Writes are synced at once. */ -# define ST_SYNCHRONOUS ST_SYNCHRONOUS - ST_MANDLOCK = 64, /* Allow mandatory locks on an FS. */ -# define ST_MANDLOCK ST_MANDLOCK - ST_WRITE = 128, /* Write on file/directory/symlink. */ -# define ST_WRITE ST_WRITE - ST_APPEND = 256, /* Append-only file. */ -# define ST_APPEND ST_APPEND - ST_IMMUTABLE = 512, /* Immutable file. */ -# define ST_IMMUTABLE ST_IMMUTABLE - ST_NOATIME = 1024, /* Do not update access times. */ -# define ST_NOATIME ST_NOATIME - ST_NODIRATIME /* Do not update directory access times. */ -# define ST_NODIRATIME ST_NODIRATIME -#endif /* Use GNU. */ -}; diff --git a/libc/sysdeps/linux/sparc/bits/statvfs.h b/libc/sysdeps/linux/sparc/bits/statvfs.h deleted file mode 100644 index 3dafcebf0..000000000 --- a/libc/sysdeps/linux/sparc/bits/statvfs.h +++ /dev/null @@ -1,106 +0,0 @@ -/* Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _SYS_STATVFS_H -# error "Never include directly; use instead." -#endif - -#include /* For __fsblkcnt_t and __fsfilcnt_t. */ - -#if __WORDSIZE == 32 -#define _STATVFSBUF_F_UNUSED -#endif - -struct statvfs - { - unsigned long int f_bsize; - unsigned long int f_frsize; -#ifndef __USE_FILE_OFFSET64 - __fsblkcnt_t f_blocks; - __fsblkcnt_t f_bfree; - __fsblkcnt_t f_bavail; - __fsfilcnt_t f_files; - __fsfilcnt_t f_ffree; - __fsfilcnt_t f_favail; -#else - __fsblkcnt64_t f_blocks; - __fsblkcnt64_t f_bfree; - __fsblkcnt64_t f_bavail; - __fsfilcnt64_t f_files; - __fsfilcnt64_t f_ffree; - __fsfilcnt64_t f_favail; -#endif - unsigned long int f_fsid; -#ifdef _STATVFSBUF_F_UNUSED - int __f_unused; -#endif - unsigned long int f_flag; - unsigned long int f_namemax; - int __f_spare[6]; - }; - -#ifdef __USE_LARGEFILE64 -struct statvfs64 - { - unsigned long int f_bsize; - unsigned long int f_frsize; - __fsblkcnt64_t f_blocks; - __fsblkcnt64_t f_bfree; - __fsblkcnt64_t f_bavail; - __fsfilcnt64_t f_files; - __fsfilcnt64_t f_ffree; - __fsfilcnt64_t f_favail; - unsigned long int f_fsid; -#ifdef _STATVFSBUF_F_UNUSED - int __f_unused; -#endif - unsigned long int f_flag; - unsigned long int f_namemax; - int __f_spare[6]; - }; -#endif - -/* Definitions for the flag in `f_flag'. These definitions should be - kept in sync which the definitions in . */ -enum -{ - ST_RDONLY = 1, /* Mount read-only. */ -#define ST_RDONLY ST_RDONLY - ST_NOSUID = 2, /* Ignore suid and sgid bits. */ -#define ST_NOSUID ST_NOSUID -#ifdef __USE_GNU - ST_NODEV = 4, /* Disallow access to device special files. */ -# define ST_NODEV ST_NODEV - ST_NOEXEC = 8, /* Disallow program execution. */ -# define ST_NOEXEC ST_NOEXEC - ST_SYNCHRONOUS = 16, /* Writes are synced at once. */ -# define ST_SYNCHRONOUS ST_SYNCHRONOUS - ST_MANDLOCK = 64, /* Allow mandatory locks on an FS. */ -# define ST_MANDLOCK ST_MANDLOCK - ST_WRITE = 128, /* Write on file/directory/symlink. */ -# define ST_WRITE ST_WRITE - ST_APPEND = 256, /* Append-only file. */ -# define ST_APPEND ST_APPEND - ST_IMMUTABLE = 512, /* Immutable file. */ -# define ST_IMMUTABLE ST_IMMUTABLE - ST_NOATIME = 1024, /* Do not update access times. */ -# define ST_NOATIME ST_NOATIME - ST_NODIRATIME /* Do not update directory access times. */ -# define ST_NODIRATIME ST_NODIRATIME -#endif /* Use GNU. */ -}; -- cgit v1.2.3 From 26b1a5e02bc9702cd16c36ee980ed6a1cde3315a Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 13:07:05 +0100 Subject: add bits/atomic.h for hppa Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/hppa/bits/atomic.h | 103 ++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 libc/sysdeps/linux/hppa/bits/atomic.h diff --git a/libc/sysdeps/linux/hppa/bits/atomic.h b/libc/sysdeps/linux/hppa/bits/atomic.h new file mode 100644 index 000000000..87aeb84a0 --- /dev/null +++ b/libc/sysdeps/linux/hppa/bits/atomic.h @@ -0,0 +1,103 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Carlos O'Donell , 2005. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + +#define ABORT_INSTRUCTION __asm__(__UCLIBC_ABORT_INSTRUCTION__) + +/* We need EFAULT, ENOSYS */ +#if !defined EFAULT && !defined ENOSYS +#define EFAULT 14 +#define ENOSYS 251 +#endif + +#ifndef _BITS_ATOMIC_H +#define _BITS_ATOMIC_H 1 + +typedef int8_t atomic8_t; +typedef uint8_t uatomic8_t; +typedef int_fast8_t atomic_fast8_t; +typedef uint_fast8_t uatomic_fast8_t; + +typedef int32_t atomic32_t; +typedef uint32_t uatomic32_t; +typedef int_fast32_t atomic_fast32_t; +typedef uint_fast32_t uatomic_fast32_t; + +typedef intptr_t atomicptr_t; +typedef uintptr_t uatomicptr_t; +typedef intmax_t atomic_max_t; +typedef uintmax_t uatomic_max_t; + +/* prev = *addr; + if (prev == old) + *addr = new; + return prev; */ + +/* Use the kernel atomic light weight syscalls on hppa */ +#define LWS "0xb0" +#define LWS_CAS "0" +/* Note r31 is the link register */ +#define LWS_CLOBBER "r1", "r26", "r25", "r24", "r23", "r22", "r21", "r20", "r28", "r31", "memory" +#define ASM_EAGAIN "11" + +#if __ASSUME_LWS_CAS +/* The only basic operation needed is compare and exchange. */ +# define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \ + ({ \ + volatile int lws_errno = EFAULT; \ + volatile int lws_ret = 0xdeadbeef; \ + __asm__ volatile( \ + "0: \n\t" \ + "copy %3, %%r26 \n\t" \ + "copy %4, %%r25 \n\t" \ + "copy %5, %%r24 \n\t" \ + "ble " LWS "(%%sr2, %%r0) \n\t" \ + "ldi " LWS_CAS ", %%r20 \n\t" \ + "cmpib,=,n " ASM_EAGAIN ",%%r21,0b \n\t" \ + "nop \n\t" \ + "stw %%r28, %0 \n\t" \ + "sub %%r0, %%r21, %%r21 \n\t" \ + "stw %%r21, %1 \n\t" \ + : "=m" (lws_ret), "=m" (lws_errno), "=m" (*mem) \ + : "r" (mem), "r" (oldval), "r" (newval) \ + : LWS_CLOBBER \ + ); \ + \ + if(lws_errno == EFAULT || lws_errno == ENOSYS) \ + ABORT_INSTRUCTION; \ + \ + lws_ret; \ + }) + +# define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \ + ({ \ + int ret; \ + ret = atomic_compare_and_exchange_val_acq(mem, newval, oldval); \ + /* Return 1 if it was already acquired */ \ + (ret != oldval); \ + }) +#else +# error __ASSUME_LWS_CAS is required to build uClibc. +#endif +/* __ASSUME_LWS_CAS */ + +#endif +/* _BITS_ATOMIC_H */ -- cgit v1.2.3 From 92895c04f3033834ee512942014a9e643ba579a5 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 13:10:41 +0100 Subject: bits/statvfs.h: update, adding ST_RELATIME Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/bits/statvfs.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libc/sysdeps/linux/common/bits/statvfs.h b/libc/sysdeps/linux/common/bits/statvfs.h index cca0871ac..84717c3d9 100644 --- a/libc/sysdeps/linux/common/bits/statvfs.h +++ b/libc/sysdeps/linux/common/bits/statvfs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,2000,2001,2002,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -101,7 +101,9 @@ enum # define ST_IMMUTABLE ST_IMMUTABLE ST_NOATIME = 1024, /* Do not update access times. */ # define ST_NOATIME ST_NOATIME - ST_NODIRATIME = 2048 /* Do not update directory access times. */ + ST_NODIRATIME = 2048, /* Do not update directory access times. */ # define ST_NODIRATIME ST_NODIRATIME + ST_RELATIME = 4096 /* Update atime relative to mtime/ctime. */ +# define ST_RELATIME ST_RELATIME #endif /* Use GNU. */ }; -- cgit v1.2.3 From 1dd9275091d6cbb14d6b149770fc90cef53577cf Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 13:32:30 +0100 Subject: remove trailing ';' from _syscallX() Signed-off-by: Peter S. Mazinger --- ldso/include/dl-syscall.h | 2 +- ldso/ldso/bfin/dl-syscalls.h | 12 ++++++------ libc/misc/sysvipc/msgq.c | 2 +- libc/misc/sysvipc/sem.c | 2 +- libc/misc/sysvipc/shm.c | 2 +- libc/sysdeps/linux/common/sigsuspend.c | 2 +- libc/sysdeps/linux/sparc/sigaction.c | 2 +- .../nptl/sysdeps/unix/sysv/linux/arm/pt-gettimeofday.c | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ldso/include/dl-syscall.h b/ldso/include/dl-syscall.h index 982bc9bf6..da3ac7f6f 100644 --- a/ldso/include/dl-syscall.h +++ b/ldso/include/dl-syscall.h @@ -95,7 +95,7 @@ static __always_inline _syscall0(gid_t, _dl_getegid) # define __NR_getpid __NR_getxpid #endif #define __NR__dl_getpid __NR_getpid -static __always_inline _syscall0(gid_t, _dl_getpid); +static __always_inline _syscall0(gid_t, _dl_getpid) #define __NR__dl_readlink __NR_readlink static __always_inline _syscall3(int, _dl_readlink, const char *, path, char *, buf, diff --git a/ldso/ldso/bfin/dl-syscalls.h b/ldso/ldso/bfin/dl-syscalls.h index 916d0f84e..f74cf1ad3 100644 --- a/ldso/ldso/bfin/dl-syscalls.h +++ b/ldso/ldso/bfin/dl-syscalls.h @@ -31,7 +31,7 @@ extern int _dl_errno; #if DYNAMIC_LOADER_IN_SIMULATOR #define __NR___syscall_mmap2 __NR_mmap2 static __inline__ _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr, - size_t, len, int, prot, int, flags, int, fd, off_t, offset); + size_t, len, int, prot, int, flags, int, fd, off_t, offset) /* Make sure we don't get another definition of _dl_mmap from the machine-independent code. */ @@ -155,7 +155,7 @@ _dl_mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset) static __always_inline unsigned long _dl_read(int fd, const void *buf, unsigned long count); static __always_inline _syscall3(__off_t, __syscall_lseek, int, fd, __off_t, offset, - int, whence); + int, whence) static __always_inline ssize_t _dl_pread(int fd, void *buf, size_t count, off_t offset) { @@ -178,7 +178,7 @@ _dl_pread(int fd, void *buf, size_t count, off_t offset) #else #define __NR___syscall_pread __NR_pread static __always_inline _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf, - size_t, count, off_t, offset_hi, off_t, offset_lo); + size_t, count, off_t, offset_hi, off_t, offset_lo) static __always_inline ssize_t _dl_pread(int fd, void *buf, size_t count, off_t offset) @@ -191,18 +191,18 @@ _dl_pread(int fd, void *buf, size_t count, off_t offset) #ifdef __NR_sram_alloc #define __NR__dl_sram_alloc __NR_sram_alloc static __always_inline _syscall2(__ptr_t, _dl_sram_alloc, - size_t, len, unsigned long, flags); + size_t, len, unsigned long, flags) #endif #ifdef __NR_sram_free #define __NR__dl_sram_free __NR_sram_free -static __always_inline _syscall1(int, _dl_sram_free, __ptr_t, addr); +static __always_inline _syscall1(int, _dl_sram_free, __ptr_t, addr) #endif #ifdef __NR_dma_memcpy #define __NR__dl_dma_memcpy __NR_dma_memcpy static __always_inline _syscall3(__ptr_t, _dl_dma_memcpy, - __ptr_t, dest, __ptr_t, src, size_t, len); + __ptr_t, dest, __ptr_t, src, size_t, len) #endif #define __UCLIBC_MMAP_HAS_6_ARGS__ diff --git a/libc/misc/sysvipc/msgq.c b/libc/misc/sysvipc/msgq.c index 27eb1ff92..185cd268b 100644 --- a/libc/misc/sysvipc/msgq.c +++ b/libc/misc/sysvipc/msgq.c @@ -12,7 +12,7 @@ #ifdef __NR_msgctl #define __NR___libc_msgctl __NR_msgctl -static __inline__ _syscall3(int, __libc_msgctl, int, msqid, int, cmd, struct msqid_ds *, buf); +static __inline__ _syscall3(int, __libc_msgctl, int, msqid, int, cmd, struct msqid_ds *, buf) #endif /* Message queue control operation. */ int msgctl(int msqid, int cmd, struct msqid_ds *buf) diff --git a/libc/misc/sysvipc/sem.c b/libc/misc/sysvipc/sem.c index e340216e9..cca4cdfcc 100644 --- a/libc/misc/sysvipc/sem.c +++ b/libc/misc/sysvipc/sem.c @@ -41,7 +41,7 @@ union semun { #ifdef __NR_semctl #define __NR___semctl __NR_semctl -static __inline__ _syscall4(int, __semctl, int, semid, int, semnum, int, cmd, void *, arg); +static __inline__ _syscall4(int, __semctl, int, semid, int, semnum, int, cmd, void *, arg) #endif int semctl(int semid, int semnum, int cmd, ...) diff --git a/libc/misc/sysvipc/shm.c b/libc/misc/sysvipc/shm.c index 4b7ea0753..27e871f27 100644 --- a/libc/misc/sysvipc/shm.c +++ b/libc/misc/sysvipc/shm.c @@ -55,7 +55,7 @@ void * shmat (int shmid, const void *shmaddr, int shmflg) /* Provide operations to control over shared memory segments. */ #ifdef __NR_shmctl #define __NR___libc_shmctl __NR_shmctl -static __inline__ _syscall3(int, __libc_shmctl, int, shmid, int, cmd, struct shmid_ds *, buf); +static __inline__ _syscall3(int, __libc_shmctl, int, shmid, int, cmd, struct shmid_ds *, buf) #endif int shmctl(int shmid, int cmd, struct shmid_ds *buf) { diff --git a/libc/sysdeps/linux/common/sigsuspend.c b/libc/sysdeps/linux/common/sigsuspend.c index 789eeda89..ded2aad5b 100644 --- a/libc/sysdeps/linux/common/sigsuspend.c +++ b/libc/sysdeps/linux/common/sigsuspend.c @@ -38,7 +38,7 @@ int sigsuspend (const sigset_t *set) return result; } # else -static inline _syscall2(int, __rt_sigsuspend, const sigset_t *, mask, size_t, size); +static inline _syscall2(int, __rt_sigsuspend, const sigset_t *, mask, size_t, size) int sigsuspend(const sigset_t * mask) { diff --git a/libc/sysdeps/linux/sparc/sigaction.c b/libc/sysdeps/linux/sparc/sigaction.c index a22ac40af..3e6f7e408 100644 --- a/libc/sysdeps/linux/sparc/sigaction.c +++ b/libc/sysdeps/linux/sparc/sigaction.c @@ -30,7 +30,7 @@ #include -_syscall5(int, rt_sigaction, int, a, int, b, int, c, int, d, int, e); +_syscall5(int, rt_sigaction, int, a, int, b, int, c, int, d, int, e) static void __rt_sigreturn_stub(void); static void __sigreturn_stub(void); diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/pt-gettimeofday.c b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/pt-gettimeofday.c index 08710f1c8..79faf54bf 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/pt-gettimeofday.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/pt-gettimeofday.c @@ -2,4 +2,4 @@ #include int gettimeofday (struct timeval *, struct timezone *) attribute_hidden; -_syscall2(int, gettimeofday, struct timeval *, tv, struct timezone *, tz); +_syscall2(int, gettimeofday, struct timeval *, tv, struct timezone *, tz) -- cgit v1.2.3 From 65e4d45a77ca147fe0988e2b3c452196c490a11c Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 13:36:36 +0100 Subject: disable _POSIX2_LOCALEDEF uClibc does not provide the localedef utility Signed-off-by: Peter S. Mazinger --- include/unistd.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/unistd.h b/include/unistd.h index 5d3a4cb8f..c421cb308 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -51,9 +51,11 @@ __BEGIN_DECLS Software Development Utilities Option. */ #define _POSIX2_SW_DEV 200112L +#if 0 /* uClibc does not provide the utility */ /* If defined, the implementation supports the creation of locales with the localedef utility. */ #define _POSIX2_LOCALEDEF 200112L +#endif /* X/Open version number to which the library conforms. It is selectable. */ #ifdef __USE_UNIX98 -- cgit v1.2.3 From 576b6864660aba3d65f0fb42b7aaeaaae3e6a478 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 14:18:15 +0100 Subject: _strtod.c: only strtod hidden version is needed Do not provide hidden strtod_l, wcstod and wcstod_l Signed-off-by: Peter S. Mazinger --- libc/stdlib/_strtod.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libc/stdlib/_strtod.c b/libc/stdlib/_strtod.c index dc5d55743..4e7965f9a 100644 --- a/libc/stdlib/_strtod.c +++ b/libc/stdlib/_strtod.c @@ -544,7 +544,6 @@ libc_hidden_def(__XL_NPP(strtof)) #define Wchar char #endif -libc_hidden_proto(__XL_NPP(strtod)) double __XL_NPP(strtod)(const Wchar *__restrict str, Wchar **__restrict endptr __LOCALE_PARAM ) { @@ -562,7 +561,9 @@ double __XL_NPP(strtod)(const Wchar *__restrict str, return y; #endif } -libc_hidden_def(__XL_NPP(strtod)) +#ifdef L_strtod +libc_hidden_def(strtod) +#endif #endif #endif -- cgit v1.2.3 From 1903a3babc27a717dcc2de743c3e70f673178b9f Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 14:45:04 +0100 Subject: stdlib.c: remove duplicate libc_hidden_proto for strtoul/strtoul_l Signed-off-by: Peter S. Mazinger --- libc/stdlib/stdlib.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c index 4d608eeac..1ed97abed 100644 --- a/libc/stdlib/stdlib.c +++ b/libc/stdlib/stdlib.c @@ -375,7 +375,6 @@ strong_alias(strtoll,strtoq) /**********************************************************************/ #if defined(L_strtoul) || defined(L_strtoul_l) -libc_hidden_proto(__XL_NPP(strtoul)) unsigned long __XL_NPP(strtoul)(const char * __restrict str, char ** __restrict endptr, int base __LOCALE_PARAM) -- cgit v1.2.3 From 7aea441c8a240bd5a0717ec09ae8efc4878cd377 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 14:48:45 +0100 Subject: move prototype for __drand48_iterate and __libc_drand48_data to stdlib.h Move them to a common header guarded by _LIBC Signed-off-by: Peter S. Mazinger --- include/stdlib.h | 7 +++++++ libc/stdlib/drand48-iter.c | 4 ---- libc/stdlib/drand48.c | 4 ---- libc/stdlib/erand48.c | 4 ---- libc/stdlib/erand48_r.c | 3 --- libc/stdlib/jrand48.c | 4 ---- libc/stdlib/jrand48_r.c | 3 --- libc/stdlib/lrand48.c | 4 ---- libc/stdlib/mrand48.c | 4 ---- libc/stdlib/nrand48.c | 4 ---- libc/stdlib/nrand48_r.c | 3 --- libc/stdlib/seed48.c | 4 ---- libc/stdlib/srand48.c | 4 ---- 13 files changed, 7 insertions(+), 45 deletions(-) diff --git a/include/stdlib.h b/include/stdlib.h index 00bba5f54..6afc321e6 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -908,6 +908,13 @@ libc_hidden_proto(arc4random_stir) extern void arc4random_addrandom(unsigned char *, int); #endif +#ifdef _LIBC +extern int __drand48_iterate (unsigned short int xsubi[3], struct drand48_data *buffer) attribute_hidden; + +/* Global state for non-reentrant functions. */ +extern struct drand48_data __libc_drand48_data attribute_hidden; +#endif + #endif /* don't just need malloc and calloc */ #undef __need_malloc_and_calloc diff --git a/libc/stdlib/drand48-iter.c b/libc/stdlib/drand48-iter.c index 221cbe08f..e0c1ce430 100644 --- a/libc/stdlib/drand48-iter.c +++ b/libc/stdlib/drand48-iter.c @@ -23,13 +23,9 @@ #include #include -/* Global state for non-reentrant functions. */ -struct drand48_data __libc_drand48_data attribute_hidden; - #ifdef __UCLIBC_MJN3_ONLY__ #warning turn int __drand48_iterate into void #endif /* __UCLIBC_MJN3_ONLY__ */ -int __drand48_iterate (unsigned short int xsubi[3], struct drand48_data *buffer) attribute_hidden; int __drand48_iterate (unsigned short int xsubi[3], struct drand48_data *buffer) { uint64_t X; diff --git a/libc/stdlib/drand48.c b/libc/stdlib/drand48.c index 8c9017b11..c53dcfbfc 100644 --- a/libc/stdlib/drand48.c +++ b/libc/stdlib/drand48.c @@ -19,10 +19,6 @@ #include - -/* Global state for non-reentrant functions. Defined in drand48-iter.c. */ -extern struct drand48_data __libc_drand48_data attribute_hidden; - double drand48 (void) { double result; diff --git a/libc/stdlib/erand48.c b/libc/stdlib/erand48.c index ee28d9635..f3603cde0 100644 --- a/libc/stdlib/erand48.c +++ b/libc/stdlib/erand48.c @@ -19,10 +19,6 @@ #include - -/* Global state for non-reentrant functions. Defined in drand48-iter.c. */ -extern struct drand48_data __libc_drand48_data attribute_hidden; - double erand48 (unsigned short int xsubi[3]) { double result; diff --git a/libc/stdlib/erand48_r.c b/libc/stdlib/erand48_r.c index e36e73eb2..bd40a3488 100644 --- a/libc/stdlib/erand48_r.c +++ b/libc/stdlib/erand48_r.c @@ -21,9 +21,6 @@ #include #include -extern int __drand48_iterate(unsigned short xsubi[3], - struct drand48_data *buffer) attribute_hidden; - int erand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, double *result) { union ieee754_double temp; diff --git a/libc/stdlib/jrand48.c b/libc/stdlib/jrand48.c index 163c5408e..8a06ced56 100644 --- a/libc/stdlib/jrand48.c +++ b/libc/stdlib/jrand48.c @@ -19,10 +19,6 @@ #include - -/* Global state for non-reentrant functions. Defined in drand48-iter.c. */ -extern struct drand48_data __libc_drand48_data attribute_hidden; - long int jrand48 (unsigned short int xsubi[3]) { long int result; diff --git a/libc/stdlib/jrand48_r.c b/libc/stdlib/jrand48_r.c index 24f7075f5..5652d1016 100644 --- a/libc/stdlib/jrand48_r.c +++ b/libc/stdlib/jrand48_r.c @@ -19,9 +19,6 @@ #include -extern int __drand48_iterate(unsigned short xsubi[3], - struct drand48_data *buffer) attribute_hidden; - int jrand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, long int *result) { /* Compute next state. */ diff --git a/libc/stdlib/lrand48.c b/libc/stdlib/lrand48.c index a0b15caff..915638b80 100644 --- a/libc/stdlib/lrand48.c +++ b/libc/stdlib/lrand48.c @@ -19,10 +19,6 @@ #include - -/* Global state for non-reentrant functions. Defined in drand48-iter.c. */ -extern struct drand48_data __libc_drand48_data attribute_hidden; - long int lrand48 (void) { long int result; diff --git a/libc/stdlib/mrand48.c b/libc/stdlib/mrand48.c index b209acd57..6f7cf734c 100644 --- a/libc/stdlib/mrand48.c +++ b/libc/stdlib/mrand48.c @@ -19,10 +19,6 @@ #include - -/* Global state for non-reentrant functions. Defined in drand48-iter.c. */ -extern struct drand48_data __libc_drand48_data attribute_hidden; - long int mrand48 (void) { long int result; diff --git a/libc/stdlib/nrand48.c b/libc/stdlib/nrand48.c index 97c197caa..5183484fa 100644 --- a/libc/stdlib/nrand48.c +++ b/libc/stdlib/nrand48.c @@ -19,10 +19,6 @@ #include - -/* Global state for non-reentrant functions. Defined in drand48-iter.c. */ -extern struct drand48_data __libc_drand48_data attribute_hidden; - long int nrand48 (unsigned short int xsubi[3]) { long int result; diff --git a/libc/stdlib/nrand48_r.c b/libc/stdlib/nrand48_r.c index 0710e90ef..b8ed0eb31 100644 --- a/libc/stdlib/nrand48_r.c +++ b/libc/stdlib/nrand48_r.c @@ -19,9 +19,6 @@ #include -extern int __drand48_iterate(unsigned short xsubi[3], - struct drand48_data *buffer) attribute_hidden; - int nrand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, long int *result) { /* Compute next state. */ diff --git a/libc/stdlib/seed48.c b/libc/stdlib/seed48.c index 9ff8a480a..a62dc2e64 100644 --- a/libc/stdlib/seed48.c +++ b/libc/stdlib/seed48.c @@ -19,10 +19,6 @@ #include - -/* Global state for non-reentrant functions. Defined in drand48-iter.c. */ -extern struct drand48_data __libc_drand48_data attribute_hidden; - unsigned short int * seed48 (unsigned short int seed16v[3]) { diff --git a/libc/stdlib/srand48.c b/libc/stdlib/srand48.c index 817d068c3..f55374371 100644 --- a/libc/stdlib/srand48.c +++ b/libc/stdlib/srand48.c @@ -19,10 +19,6 @@ #include - -/* Global state for non-reentrant functions. Defined in drand48-iter.c. */ -extern struct drand48_data __libc_drand48_data attribute_hidden; - void srand48 (long seedval) { srand48_r (seedval, &__libc_drand48_data); -- cgit v1.2.3 From d57b631e82529b2c880f5d7e4fbcd88042803f80 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 15:05:00 +0100 Subject: stdlib.h: move MB_CUR_MAX = 1 from wchar-stub.h Signed-off-by: Peter S. Mazinger --- include/stdlib.h | 4 +++- include/wchar-stub.h | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/stdlib.h b/include/stdlib.h index 6afc321e6..c533bd57a 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -143,9 +143,11 @@ __END_NAMESPACE_C99 extern size_t __ctype_get_mb_cur_max (void) __THROW __wur; #else #ifdef __UCLIBC_HAS_WCHAR__ -#define MB_CUR_MAX (_stdlib_mb_cur_max ()) +# define MB_CUR_MAX (_stdlib_mb_cur_max ()) extern size_t _stdlib_mb_cur_max (void) __THROW __wur; libc_hidden_proto(_stdlib_mb_cur_max) +#else +# define MB_CUR_MAX 1 #endif #endif diff --git a/include/wchar-stub.h b/include/wchar-stub.h index 0b0aa29aa..918c78dd4 100644 --- a/include/wchar-stub.h +++ b/include/wchar-stub.h @@ -7,7 +7,6 @@ #ifndef _WCHAR_H #define _WCHAR_H -#define MB_CUR_MAX 1 typedef unsigned int wint_t; #define WEOF (0xffffffffu) -- cgit v1.2.3 From cf67a3699e98c57b3a06e5dd4c7e70baa648db6a Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 15:06:17 +0100 Subject: fnmatch.c: use MB_CUR_MAX from stdlib.h included earlier Signed-off-by: Peter S. Mazinger --- libc/misc/fnmatch/fnmatch.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/libc/misc/fnmatch/fnmatch.c b/libc/misc/fnmatch/fnmatch.c index 0fa043bad..2874413ec 100644 --- a/libc/misc/fnmatch/fnmatch.c +++ b/libc/misc/fnmatch/fnmatch.c @@ -334,11 +334,6 @@ is_char_class (const wchar_t *wcs) # include "fnmatch_loop.c" # endif -#ifndef __UCLIBC_HAS_WCHAR__ -# undef MB_CUR_MAX -# define MB_CUR_MAX 1 -#endif - int fnmatch (const char *pattern, const char *string, int flags) { -- cgit v1.2.3 From 3fa004b7d2d9a3648aa95b093000259a123fa2d8 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 15:14:48 +0100 Subject: regcomp.c, aeabi_mb_cur_max.c: use unconditionally MB_CUR_MAX from stdlib.h Signed-off-by: Peter S. Mazinger --- libc/misc/regex/regcomp.c | 4 ---- libc/sysdeps/linux/arm/aeabi_mb_cur_max.c | 4 ---- 2 files changed, 8 deletions(-) diff --git a/libc/misc/regex/regcomp.c b/libc/misc/regex/regcomp.c index 8f2e18ce4..b25850ccd 100644 --- a/libc/misc/regex/regcomp.c +++ b/libc/misc/regex/regcomp.c @@ -819,11 +819,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len) dfa->state_table = calloc (sizeof (struct re_state_table_entry), table_size); dfa->state_hash_mask = table_size - 1; -#ifdef __UCLIBC_HAS_WCHAR__ dfa->mb_cur_max = MB_CUR_MAX; -#else - dfa->mb_cur_max = 1; -#endif #if 0 if (dfa->mb_cur_max == 6 && strcmp (_NL_CURRENT (LC_CTYPE, _NL_CTYPE_CODESET_NAME), "UTF-8") == 0) diff --git a/libc/sysdeps/linux/arm/aeabi_mb_cur_max.c b/libc/sysdeps/linux/arm/aeabi_mb_cur_max.c index f12309eaf..77e979a65 100644 --- a/libc/sysdeps/linux/arm/aeabi_mb_cur_max.c +++ b/libc/sysdeps/linux/arm/aeabi_mb_cur_max.c @@ -23,9 +23,5 @@ int __aeabi_MB_CUR_MAX (void) { -#ifdef __UCLIBC_HAS_WCHAR__ return MB_CUR_MAX; -#else - return 1; -#endif } -- cgit v1.2.3 From dad0315108b60d47af25aa46a7f11084c15d821f Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 15:19:10 +0100 Subject: arc4random.c, stdlib.h: get rid of hidden arc4random_stir The function is used only in one file, make an internal static version for this Signed-off-by: Peter S. Mazinger --- include/stdlib.h | 1 - libc/stdlib/arc4random.c | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/stdlib.h b/include/stdlib.h index c533bd57a..18657277a 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -906,7 +906,6 @@ extern int getloadavg (double __loadavg[], int __nelem) #include extern uint32_t arc4random(void); extern void arc4random_stir(void); -libc_hidden_proto(arc4random_stir) extern void arc4random_addrandom(unsigned char *, int); #endif diff --git a/libc/stdlib/arc4random.c b/libc/stdlib/arc4random.c index 592c51ed5..c7aed66b6 100644 --- a/libc/stdlib/arc4random.c +++ b/libc/stdlib/arc4random.c @@ -156,8 +156,8 @@ arc4_getword(struct arc4_stream *as) return val; } -void -arc4random_stir(void) +static void +__arc4random_stir(void) { if (!rs_initialized) { arc4_init(&rs); @@ -165,13 +165,13 @@ arc4random_stir(void) } arc4_stir(&rs); } -libc_hidden_def(arc4random_stir) +strong_alias(__arc4random_stir,arc4random_stir) void arc4random_addrandom(u_char *dat, int datlen) { if (!rs_initialized) - arc4random_stir(); + __arc4random_stir(); arc4_addrandom(&rs, dat, datlen); } @@ -179,7 +179,7 @@ uint32_t arc4random(void) { if (!rs_initialized) - arc4random_stir(); + __arc4random_stir(); return arc4_getword(&rs); } -- cgit v1.2.3 From 3ae11e90f822a766cc0b97d7f5eb12556685e8f0 Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Wed, 9 Mar 2011 15:14:37 +0100 Subject: Add C6X-specific sys/ptrace.h The debugger needs some C6X-specific ptrace operations to get information about the DSBT binaries; similar to what's done on FD-PIC targets. Signed-off-by: Bernd Schmidt --- libc/sysdeps/linux/c6x/sys/ptrace.h | 176 ++++++++++++++++++++++++++++++++++++ 1 file changed, 176 insertions(+) create mode 100644 libc/sysdeps/linux/c6x/sys/ptrace.h diff --git a/libc/sysdeps/linux/c6x/sys/ptrace.h b/libc/sysdeps/linux/c6x/sys/ptrace.h new file mode 100644 index 000000000..b8a7a49d5 --- /dev/null +++ b/libc/sysdeps/linux/c6x/sys/ptrace.h @@ -0,0 +1,176 @@ +/* `ptrace' debugger support interface. Linux version. + Copyright (C) 1996-1999,2000,2006,2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _SYS_PTRACE_H +#define _SYS_PTRACE_H 1 + +#include + +__BEGIN_DECLS + +/* Type of the REQUEST argument to `ptrace.' */ +enum __ptrace_request +{ + /* Indicate that the process making this request should be traced. + All signals received by this process can be intercepted by its + parent, and its parent can use the other `ptrace' requests. */ + PTRACE_TRACEME = 0, +#define PT_TRACE_ME PTRACE_TRACEME + + /* Return the word in the process's text space at address ADDR. */ + PTRACE_PEEKTEXT = 1, +#define PT_READ_I PTRACE_PEEKTEXT + + /* Return the word in the process's data space at address ADDR. */ + PTRACE_PEEKDATA = 2, +#define PT_READ_D PTRACE_PEEKDATA + + /* Return the word in the process's user area at offset ADDR. */ + PTRACE_PEEKUSER = 3, +#define PT_READ_U PTRACE_PEEKUSER + + /* Write the word DATA into the process's text space at address ADDR. */ + PTRACE_POKETEXT = 4, +#define PT_WRITE_I PTRACE_POKETEXT + + /* Write the word DATA into the process's data space at address ADDR. */ + PTRACE_POKEDATA = 5, +#define PT_WRITE_D PTRACE_POKEDATA + + /* Write the word DATA into the process's user area at offset ADDR. */ + PTRACE_POKEUSER = 6, +#define PT_WRITE_U PTRACE_POKEUSER + + /* Continue the process. */ + PTRACE_CONT = 7, +#define PT_CONTINUE PTRACE_CONT + + /* Kill the process. */ + PTRACE_KILL = 8, +#define PT_KILL PTRACE_KILL + + /* Single step the process. + This is not supported on all machines. */ + PTRACE_SINGLESTEP = 9, +#define PT_STEP PTRACE_SINGLESTEP + + /* Get all general purpose registers used by a processes. + This is not supported on all machines. */ + PTRACE_GETREGS = 12, +#define PT_GETREGS PTRACE_GETREGS + + /* Set all general purpose registers used by a processes. + This is not supported on all machines. */ + PTRACE_SETREGS = 13, +#define PT_SETREGS PTRACE_SETREGS + + /* Get all floating point registers used by a processes. + This is not supported on all machines. */ + PTRACE_GETFPREGS = 14, +#define PT_GETFPREGS PTRACE_GETFPREGS + + /* Set all floating point registers used by a processes. + This is not supported on all machines. */ + PTRACE_SETFPREGS = 15, +#define PT_SETFPREGS PTRACE_SETFPREGS + + /* Attach to a process that is already running. */ + PTRACE_ATTACH = 16, +#define PT_ATTACH PTRACE_ATTACH + + /* Detach from a process attached to with PTRACE_ATTACH. */ + PTRACE_DETACH = 17, +#define PT_DETACH PTRACE_DETACH + + /* Get all extended floating point registers used by a processes. + This is not supported on all machines. */ + PTRACE_GETFPXREGS = 18, +#define PT_GETFPXREGS PTRACE_GETFPXREGS + + /* Set all extended floating point registers used by a processes. + This is not supported on all machines. */ + PTRACE_SETFPXREGS = 19, +#define PT_SETFPXREGS PTRACE_SETFPXREGS + + /* Continue and stop at the next (return from) syscall. */ + PTRACE_SYSCALL = 24, +#define PT_SYSCALL PTRACE_SYSCALL + + /* Obtain the load map of the main program or the interpreter of the + ptraced process, depending on whether the addr argument is + (void*)0 or (void*)1, respectively. */ + PTRACE_GETDSBT = 31, +#define PT_GETDSBT PTRACE_GETDSBT + + /* Set ptrace filter options. */ + PTRACE_SETOPTIONS = 0x4200, +#define PT_SETOPTIONS PTRACE_SETOPTIONS + + /* Get last ptrace message. */ + PTRACE_GETEVENTMSG = 0x4201, +#define PT_GETEVENTMSG PTRACE_GETEVENTMSG + + /* Get siginfo for process. */ + PTRACE_GETSIGINFO = 0x4202, +#define PT_GETSIGINFO PTRACE_GETSIGINFO + + /* Set new siginfo for process. */ + PTRACE_SETSIGINFO = 0x4203 +#define PT_SETSIGINFO PTRACE_SETSIGINFO +}; + +#define PTRACE_GETDSBT_EXEC ((void*)0) /* [addr] request the executable loadmap */ +#define PTRACE_GETDSBT_INTERP ((void*)1) /* [addr] request the interpreter loadmap */ + +/* Options set using PTRACE_SETOPTIONS. */ +enum __ptrace_setoptions { + PTRACE_O_TRACESYSGOOD = 0x00000001, + PTRACE_O_TRACEFORK = 0x00000002, + PTRACE_O_TRACEVFORK = 0x00000004, + PTRACE_O_TRACECLONE = 0x00000008, + PTRACE_O_TRACEEXEC = 0x00000010, + PTRACE_O_TRACEVFORKDONE = 0x00000020, + PTRACE_O_TRACEEXIT = 0x00000040, + PTRACE_O_MASK = 0x0000007f +}; + +/* Wait extended result codes for the above trace options. */ +enum __ptrace_eventcodes { + PTRACE_EVENT_FORK = 1, + PTRACE_EVENT_VFORK = 2, + PTRACE_EVENT_CLONE = 3, + PTRACE_EVENT_EXEC = 4, + PTRACE_EVENT_VFORK_DONE = 5, + PTRACE_EVENT_EXIT = 6 +}; + +/* Perform process tracing functions. REQUEST is one of the values + above, and determines the action to be taken. + For all requests except PTRACE_TRACEME, PID specifies the process to be + traced. + + PID and the other arguments described above for the various requests should + appear (those that are used for the particular request) as: + pid_t PID, void *ADDR, int DATA, void *ADDR2 + after REQUEST. */ +extern long int ptrace (enum __ptrace_request __request, ...) __THROW; + +__END_DECLS + +#endif /* _SYS_PTRACE_H */ -- cgit v1.2.3 From cb96f5c1b34a36864b0da389599b95408cc9b4a2 Mon Sep 17 00:00:00 2001 From: Mark Salter Date: Thu, 9 Sep 2010 14:40:03 -0400 Subject: sunrpc: fix spurious fall-through Fix spurious fall-through. Signed-off-by: Mark Salter Signed-off-by: Bernd Schmidt --- libc/inet/rpc/clnt_tcp.c | 1 + libc/inet/rpc/clnt_udp.c | 1 + libc/inet/rpc/clnt_unix.c | 1 + 3 files changed, 3 insertions(+) diff --git a/libc/inet/rpc/clnt_tcp.c b/libc/inet/rpc/clnt_tcp.c index d01fc80d5..d8d7bb359 100644 --- a/libc/inet/rpc/clnt_tcp.c +++ b/libc/inet/rpc/clnt_tcp.c @@ -402,6 +402,7 @@ clnttcp_control (CLIENT *cl, int request, char *info) /* This will set the xid of the NEXT call */ *(u_long *)ct->ct_mcall = htonl (*(u_long *)info - 1); /* decrement by 1 as clnttcp_call() increments once */ + break; case CLGET_VERS: /* * This RELIES on the information that, in the call body, diff --git a/libc/inet/rpc/clnt_udp.c b/libc/inet/rpc/clnt_udp.c index fe8b7f8e6..aca3e337b 100644 --- a/libc/inet/rpc/clnt_udp.c +++ b/libc/inet/rpc/clnt_udp.c @@ -554,6 +554,7 @@ clntudp_control (CLIENT *cl, int request, char *info) /* This will set the xid of the NEXT call */ *(u_long *)cu->cu_outbuf = htonl(*(u_long *)info - 1); /* decrement by 1 as clntudp_call() increments once */ + break; case CLGET_VERS: /* * This RELIES on the information that, in the call body, diff --git a/libc/inet/rpc/clnt_unix.c b/libc/inet/rpc/clnt_unix.c index c7756f700..9870149e9 100644 --- a/libc/inet/rpc/clnt_unix.c +++ b/libc/inet/rpc/clnt_unix.c @@ -377,6 +377,7 @@ clntunix_control (CLIENT *cl, int request, char *info) /* This will set the xid of the NEXT call */ *(u_long *) ct->ct_mcall = htonl (*(u_long *)info - 1); /* decrement by 1 as clntunix_call() increments once */ + break; case CLGET_VERS: /* * This RELIES on the information that, in the call body, -- cgit v1.2.3 From 0c31aab44ec14a3c287ce766676d9a6f495a0751 Mon Sep 17 00:00:00 2001 From: Mark Salter Date: Sat, 5 Mar 2011 11:13:16 -0500 Subject: remove unused vfork.c Signed-off-by: Mark Salter Signed-off-by: Bernd Schmidt --- libc/sysdeps/linux/c6x/vfork.c | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 libc/sysdeps/linux/c6x/vfork.c diff --git a/libc/sysdeps/linux/c6x/vfork.c b/libc/sysdeps/linux/c6x/vfork.c deleted file mode 100644 index f19dcd464..000000000 --- a/libc/sysdeps/linux/c6x/vfork.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Port of uClibc for TMS320C6000 DSP architecture - * Copyright (C) 2005 Texas Instruments Incorporated - * Author of TMS320C6000 port: Aurelien Jacquiot - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Library General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License - * for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -#include -__asm__(" .text\n" - "vfork: \n" - " MVKL .S1 ___libc_vfork,A0\n" - " MVKH .S1 ___libc_vfork,A0\n" - " BNOP .S2X A0,5\n"); -- cgit v1.2.3 From 3992402e7a00ee4f617582c09215a855fb212bf9 Mon Sep 17 00:00:00 2001 From: Mark Salter Date: Sat, 5 Mar 2011 11:17:54 -0500 Subject: use clone syscall for vfork Signed-off-by: Mark Salter Signed-off-by: Bernd Schmidt --- libc/sysdeps/linux/c6x/_vfork.S | 93 +++++++++++++++++++++++------------------ 1 file changed, 52 insertions(+), 41 deletions(-) diff --git a/libc/sysdeps/linux/c6x/_vfork.S b/libc/sysdeps/linux/c6x/_vfork.S index 20cb6a52f..d64dc504d 100644 --- a/libc/sysdeps/linux/c6x/_vfork.S +++ b/libc/sysdeps/linux/c6x/_vfork.S @@ -1,55 +1,66 @@ - ; - ; Port of uClibc for TMS320C6000 DSP architecture - ; Copyright (C) 2004 Texas Instruments Incorporated - ; Author of TMS320C6000 port: Aurelien Jacquiot - ; - ; This program is free software; you can redistribute it and/or modify it - ; under the terms of the GNU Library General Public License as published by - ; the Free Software Foundation; either version 2 of the License, or (at your - ; option) any later version. - ; - ; This program is distributed in the hope that it will be useful, but WITHOUT - ; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - ; FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License - ; for more details. - ; - ; You should have received a copy of the GNU Library General Public License - ; along with this program; if not, write to the Free Software Foundation, - ; Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - ; +/* + * Port of uClibc for TMS320C6000 DSP architecture + * Copyright (C) 2004, 2011 Texas Instruments Incorporated + * Author of TMS320C6000 port: Aurelien Jacquiot + * + * Use clone syscall: Mark Salter + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License + * for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#define __ASSEMBLY__ -; .import __errno_location - .global __vfork +#include +#include +#include +#include +#define CLONE_FLAGS (CLONE_VFORK | CLONE_VM | SIGCHLD) + + .global __vfork __vfork: - MVK .S2 190,B0 ; __NR_vfork + MVK .S2 SYS_clone,B0 + || MVKL .S1 CLONE_FLAGS,A4 + MVKH .S1 CLONE_FLAGS,A4 + || MVK .L2 0,B4 #ifndef _TMS320C6400_PLUS - MVC .S2 CSR,B2 - CLR .S2 B2,0,0,B1 - MVC .S2 B1,CSR - MVC .S2 IFR,B1 - SET .S2 B1,6,6,B1 - MVC .S2 B1,ISR - MVC .S2 B2,CSR + MVC .S2 CSR,B2 + CLR .S2 B2,0,0,B1 + MVC .S2 B1,CSR + MVC .S2 IFR,B1 + SET .S2 B1,6,6,B1 + MVC .S2 B1,ISR + MVC .S2 B2,CSR NOP #else SWE #endif - MVK .S2 -4096,B4 - CMPGTU .L2X B4,A4,B2 ; check error - [B2] BNOP .S2 B3,5 + MVK .S2 -4096,B4 + CMPGTU .L2X B4,A4,B2 ; check error + [B2] BNOP .S2 B3,5 - NEG .S1 A4,A4 - STW .D2T1 A4,*B15--[2] - STW .D2T2 B3,*+B15[1] - CALLP .S2 __errno_location,B3 - LDW .D2T2 *+B15[1],B3 - LDW .D2T1 *++B15[2],A5 + NEG .S1 A4,A4 + STW .D2T1 A4,*B15--[2] + STW .D2T2 B3,*+B15[1] + CALLP .S2 __errno_location,B3 + LDW .D2T2 *+B15[1],B3 + LDW .D2T1 *++B15[2],A5 NOP 3 - BNOP .S2 B3,3 - STW .D1T1 A5,*A4 - MVK .L1 -1,A4 + BNOP .S2 B3,3 + STW .D1T1 A5,*A4 + MVK .L1 -1,A4 weak_alias(__vfork,vfork) libc_hidden_weak(vfork) -- cgit v1.2.3 From 5f98b70a92187756a2b76eaaf679958c36d59d00 Mon Sep 17 00:00:00 2001 From: Mark Salter Date: Sat, 5 Mar 2011 22:03:21 -0500 Subject: support generic kernel posix_types.h Signed-off-by: Mark Salter Signed-off-by: Bernd Schmidt --- libc/sysdeps/linux/c6x/bits/kernel_types.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/libc/sysdeps/linux/c6x/bits/kernel_types.h b/libc/sysdeps/linux/c6x/bits/kernel_types.h index 5dbd2c226..755730959 100644 --- a/libc/sysdeps/linux/c6x/bits/kernel_types.h +++ b/libc/sysdeps/linux/c6x/bits/kernel_types.h @@ -7,33 +7,33 @@ #ifndef __ASM_GENERIC_POSIX_TYPES_H #define __ASM_GENERIC_POSIX_TYPES_H -typedef unsigned short __kernel_dev_t; +typedef unsigned int __kernel_dev_t; typedef unsigned long __kernel_ino_t; -typedef unsigned short __kernel_mode_t; -typedef unsigned short __kernel_nlink_t; -typedef long __kernel_off_t; +typedef unsigned int __kernel_mode_t; +typedef unsigned long __kernel_nlink_t; typedef int __kernel_pid_t; -typedef unsigned short __kernel_ipc_pid_t; -typedef unsigned short __kernel_uid_t; -typedef unsigned short __kernel_gid_t; +typedef int __kernel_ipc_pid_t; +typedef unsigned int __kernel_uid_t; +typedef unsigned int __kernel_gid_t; +typedef long __kernel_suseconds_t; +typedef int __kernel_daddr_t; +typedef unsigned int __kernel_uid32_t; +typedef unsigned int __kernel_gid32_t; +typedef unsigned int __kernel_old_uid_t; +typedef unsigned int __kernel_old_gid_t; +typedef unsigned int __kernel_old_dev_t; typedef unsigned int __kernel_size_t; typedef int __kernel_ssize_t; typedef int __kernel_ptrdiff_t; +typedef long __kernel_off_t; +typedef long long __kernel_loff_t; typedef long __kernel_time_t; -typedef long __kernel_suseconds_t; typedef long __kernel_clock_t; typedef int __kernel_timer_t; typedef int __kernel_clockid_t; -typedef int __kernel_daddr_t; typedef char * __kernel_caddr_t; typedef unsigned short __kernel_uid16_t; typedef unsigned short __kernel_gid16_t; -typedef unsigned int __kernel_uid32_t; -typedef unsigned int __kernel_gid32_t; -typedef unsigned short __kernel_old_uid_t; -typedef unsigned short __kernel_old_gid_t; -typedef unsigned short __kernel_old_dev_t; -typedef long long __kernel_loff_t; typedef struct { #ifdef __USE_ALL -- cgit v1.2.3 From be36fa013e821e6fba87bfbc8bdf4f5e73b545cb Mon Sep 17 00:00:00 2001 From: Mark Salter Date: Sat, 5 Mar 2011 19:46:48 -0500 Subject: support c6x kernel using generic stat.h Signed-off-by: Ken Cox Signed-off-by: Mark Salter Signed-off-by: Bernd Schmidt --- libc/sysdeps/linux/c6x/bits/kernel_stat.h | 59 +++++----- libc/sysdeps/linux/c6x/bits/stat.h | 174 ------------------------------ 2 files changed, 28 insertions(+), 205 deletions(-) delete mode 100644 libc/sysdeps/linux/c6x/bits/stat.h diff --git a/libc/sysdeps/linux/c6x/bits/kernel_stat.h b/libc/sysdeps/linux/c6x/bits/kernel_stat.h index 9c0bfa640..f8381c703 100644 --- a/libc/sysdeps/linux/c6x/bits/kernel_stat.h +++ b/libc/sysdeps/linux/c6x/bits/kernel_stat.h @@ -6,46 +6,43 @@ * different opinion on the subject... */ struct kernel_stat { - unsigned short st_dev; - unsigned short __pad1; - unsigned long st_ino; - unsigned short st_mode; - unsigned short st_nlink; - unsigned short st_uid; - unsigned short st_gid; - unsigned short st_rdev; - unsigned short __pad2; - unsigned long st_size; - unsigned long st_blksize; - unsigned long st_blocks; + unsigned long st_dev; /* Device. */ + unsigned long st_ino; /* File serial number. */ + unsigned int st_mode; /* File mode. */ + unsigned int st_nlink; /* Link count. */ + unsigned int st_uid; /* User ID of the file's owner. */ + unsigned int st_gid; /* Group ID of the file's group. */ + unsigned long st_rdev; /* Device number, if device. */ + unsigned long __pad1; + long st_size; /* Size of file, in bytes. */ + int st_blksize; /* Optimal block size for I/O. */ + int __pad2; + long st_blocks; /* Number 512-byte blocks allocated. */ struct timespec st_atim; struct timespec st_mtim; struct timespec st_ctim; - unsigned long __unused4; - unsigned long __unused5; + unsigned int __unused4; + unsigned int __unused5; }; struct kernel_stat64 { - unsigned char __pad0[6]; - unsigned short st_dev; - unsigned char __pad1[2]; -#define _HAVE_STAT64___ST_INO - unsigned long __st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned long st_uid; - unsigned long st_gid; - unsigned char __pad2[6]; - unsigned short st_rdev; - unsigned char __pad3[2]; - __off64_t st_size; - unsigned long st_blksize; - unsigned long __pad4; /* future possible st_blocks high bits */ - unsigned long st_blocks; /* Number 512-byte blocks allocated. */ + unsigned long long st_dev; /* Device. */ + unsigned long long st_ino; /* File serial number. */ + unsigned int st_mode; /* File mode. */ + unsigned int st_nlink; /* Link count. */ + unsigned int st_uid; /* User ID of the file's owner. */ + unsigned int st_gid; /* Group ID of the file's group. */ + unsigned long long st_rdev; /* Device number, if device. */ + unsigned long long __pad1; + long long st_size; /* Size of file, in bytes. */ + int st_blksize; /* Optimal block size for I/O. */ + int __pad2; + long long st_blocks; /* Number 512-byte blocks allocated. */ struct timespec st_atim; struct timespec st_mtim; struct timespec st_ctim; - __off64_t st_ino; + unsigned int __unused4; + unsigned int __unused5; }; #endif /* _BITS_STAT_STRUCT_H */ diff --git a/libc/sysdeps/linux/c6x/bits/stat.h b/libc/sysdeps/linux/c6x/bits/stat.h deleted file mode 100644 index eba31245d..000000000 --- a/libc/sysdeps/linux/c6x/bits/stat.h +++ /dev/null @@ -1,174 +0,0 @@ -/* Copyright (C) 1992,95,96,97,98,99,2000,2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _SYS_STAT_H -# error "Never include directly; use instead." -#endif - -/* Versions of the `struct stat' data structure. */ -#define _STAT_VER_LINUX_OLD 1 -#define _STAT_VER_KERNEL 1 -#define _STAT_VER_SVR4 2 -#define _STAT_VER_LINUX 3 -#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */ - -/* Versions of the `xmknod' interface. */ -#define _MKNOD_VER_LINUX 1 -#define _MKNOD_VER_SVR4 2 -#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */ - - -struct stat - { - __dev_t st_dev; /* Device. */ - unsigned short int __pad1; -#ifndef __USE_FILE_OFFSET64 - __ino_t st_ino; /* File serial number. */ -#else - __ino_t __st_ino; /* 32bit file serial number. */ -#endif - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - unsigned short int __pad2; -#ifndef __USE_FILE_OFFSET64 - __off_t st_size; /* Size of file, in bytes. */ -#else - __off64_t st_size; /* Size of file, in bytes. */ -#endif - __blksize_t st_blksize; /* Optimal block size for I/O. */ - -#ifndef __USE_FILE_OFFSET64 - __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */ -#else - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#endif -#ifdef __USE_MISC - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif -#ifndef __USE_FILE_OFFSET64 - unsigned long __unused4; - unsigned long __unused5; -#else - __ino64_t st_ino; /* File serial number. */ -#endif - }; - -#ifdef __USE_LARGEFILE64 -struct stat64 - { - __dev_t st_dev; /* Device. */ - -#if __WORDSIZE == 64 - __ino64_t st_ino; /* File serial number. */ - __nlink_t st_nlink; /* Link count. */ - __mode_t st_mode; /* File mode. */ -#else - unsigned int __pad1; - __ino_t __st_ino; /* 32bit file serial number. */ - __mode_t st_mode; /* File mode. */ - __nlink_t st_nlink; /* Link count. */ -#endif - __uid_t st_uid; /* User ID of the file's owner. */ - __gid_t st_gid; /* Group ID of the file's group.*/ - __dev_t st_rdev; /* Device number, if device. */ - unsigned short int __pad2; - __off64_t st_size; /* Size of file, in bytes. */ - __blksize_t st_blksize; /* Optimal block size for I/O. */ - - __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */ -#ifdef __USE_MISC - /* Nanosecond resolution timestamps are stored in a format - equivalent to 'struct timespec'. This is the type used - whenever possible but the Unix namespace rules do not allow the - identifier 'timespec' to appear in the header. - Therefore we have to handle the use of this header in strictly - standard-compliant sources special. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ -# define st_atime st_atim.tv_sec /* Backward compatibility. */ -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#else - __time_t st_atime; /* Time of last access. */ - unsigned long int st_atimensec; /* Nscecs of last access. */ - __time_t st_mtime; /* Time of last modification. */ - unsigned long int st_mtimensec; /* Nsecs of last modification. */ - __time_t st_ctime; /* Time of last status change. */ - unsigned long int st_ctimensec; /* Nsecs of last status change. */ -#endif -#if __WORDSIZE == 64 - long int __unused[3]; -#else - __ino64_t st_ino; /* File serial number. */ -#endif - }; -#endif - -/* Tell code we have these members. */ -#define _STATBUF_ST_BLKSIZE -#define _STATBUF_ST_RDEV - -/* Encoding of the file mode. */ - -#define __S_IFMT 0170000 /* These bits determine file type. */ - -/* File types. */ -#define __S_IFDIR 0040000 /* Directory. */ -#define __S_IFCHR 0020000 /* Character device. */ -#define __S_IFBLK 0060000 /* Block device. */ -#define __S_IFREG 0100000 /* Regular file. */ -#define __S_IFIFO 0010000 /* FIFO. */ -#define __S_IFLNK 0120000 /* Symbolic link. */ -#define __S_IFSOCK 0140000 /* Socket. */ - -/* POSIX.1b objects. Note that these macros always evaluate to zero. But - they do it by enforcing the correct use of the macros. */ -#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) -#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) - -/* Protection bits. */ - -#define __S_ISUID 04000 /* Set user ID on execution. */ -#define __S_ISGID 02000 /* Set group ID on execution. */ -#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */ -#define __S_IREAD 0400 /* Read by owner. */ -#define __S_IWRITE 0200 /* Write by owner. */ -#define __S_IEXEC 0100 /* Execute by owner. */ -- cgit v1.2.3 From e5d4a571e1e8850b36bbfb246270b63dab0c2a3d Mon Sep 17 00:00:00 2001 From: Mark Salter Date: Sun, 6 Mar 2011 17:44:00 -0500 Subject: cleanup hardcoded syscall numbers Signed-off-by: Mark Salter Signed-off-by: Bernd Schmidt --- libc/sysdeps/linux/c6x/clone.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libc/sysdeps/linux/c6x/clone.S b/libc/sysdeps/linux/c6x/clone.S index 8d9da4b49..6fba5bb98 100644 --- a/libc/sysdeps/linux/c6x/clone.S +++ b/libc/sysdeps/linux/c6x/clone.S @@ -17,6 +17,7 @@ ; along with this program; if not, write to the Free Software Foundation, ; Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ; +#define __ASSEMBLY__ ; int _clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); @@ -50,7 +51,7 @@ __clone: || AND .D2 ~7,B4,B4 ; do the system call -|| MVK .S2 120,B0 ; __NR_clone +|| MVK .S2 __NR_clone,B0 || MV .L2 B5,B6 0: #ifndef _TMS320C6400_PLUS -- cgit v1.2.3 From 3b5e53eaf0c94051969974aab6c0e89bdb424f9c Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Wed, 9 Mar 2011 16:05:33 +0100 Subject: Add a missing macro to C6X syscalls.h. We need _syscall_noerr0 to fix compilation of getuid.c. Signed-off-by: Bernd Schmidt --- libc/sysdeps/linux/c6x/bits/syscalls.h | 1 + 1 file changed, 1 insertion(+) diff --git a/libc/sysdeps/linux/c6x/bits/syscalls.h b/libc/sysdeps/linux/c6x/bits/syscalls.h index 382ec5124..56a1667c3 100644 --- a/libc/sysdeps/linux/c6x/bits/syscalls.h +++ b/libc/sysdeps/linux/c6x/bits/syscalls.h @@ -167,6 +167,7 @@ type name(C_DECL_ARGS_##nargs(args)) { \ } #define _syscall0(args...) SYSCALL_FUNC(0, args) +#define _syscall_noerr0(args...) SYSCALL_NOERR_FUNC(0, args) #define _syscall1(args...) SYSCALL_FUNC(1, args) #define _syscall_noerr1(args...) SYSCALL_NOERR_FUNC(1, args) #define _syscall2(args...) SYSCALL_FUNC(2, args) -- cgit v1.2.3 From 935151992d9385c54a44033d5bf8102ff10fb50f Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Wed, 9 Mar 2011 16:06:59 +0100 Subject: Select ARCH_HAS_NO_MMU for C6X. Signed-off-by: Bernd Schmidt --- extra/Configs/Config.c6x | 1 + 1 file changed, 1 insertion(+) diff --git a/extra/Configs/Config.c6x b/extra/Configs/Config.c6x index 7b5b00528..96adfb398 100644 --- a/extra/Configs/Config.c6x +++ b/extra/Configs/Config.c6x @@ -10,6 +10,7 @@ config FORCE_OPTIONS_FOR_ARCH bool default y select ARCH_ANY_ENDIAN + select ARCH_HAS_NO_MMU choice prompt "Target Processor Type" -- cgit v1.2.3 From 98538deba691281535e3dc0839710b8630e02ac8 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 20:19:49 +0100 Subject: stdlib.c, _strtod.c, stdlib.h: remove unused hidden functions Signed-off-by: Peter S. Mazinger --- include/stdlib.h | 1 - libc/stdlib/_strtod.c | 2 -- libc/stdlib/stdlib.c | 27 ++++++--------------------- 3 files changed, 6 insertions(+), 24 deletions(-) diff --git a/include/stdlib.h b/include/stdlib.h index 18657277a..e9a8b84c2 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -165,7 +165,6 @@ libc_hidden_proto(atoi) /* Convert a string to a long integer. */ extern long int atol (__const char *__nptr) __THROW __attribute_pure__ __nonnull ((1)) __wur; -libc_hidden_proto(atol) __END_NAMESPACE_STD #if defined __USE_ISOC99 || defined __USE_MISC diff --git a/libc/stdlib/_strtod.c b/libc/stdlib/_strtod.c index 4e7965f9a..1d58258e7 100644 --- a/libc/stdlib/_strtod.c +++ b/libc/stdlib/_strtod.c @@ -581,7 +581,6 @@ libc_hidden_def(strtod) #define Wchar char #endif -libc_hidden_proto(__XL_NPP(strtold)) long double __XL_NPP(strtold) (const Wchar *str, Wchar **endptr __LOCALE_PARAM ) { #if FPMAX_TYPE == 3 @@ -598,7 +597,6 @@ long double __XL_NPP(strtold) (const Wchar *str, Wchar **endptr __LOCALE_PARAM return y; #endif } -libc_hidden_def(__XL_NPP(strtold)) #endif #endif diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c index 1ed97abed..cd9a0cac6 100644 --- a/libc/stdlib/stdlib.c +++ b/libc/stdlib/stdlib.c @@ -286,11 +286,11 @@ long atol(const char *nptr) { return strtol(nptr, (char **) NULL, 10); } -libc_hidden_def(atol) #if UINT_MAX == ULONG_MAX #undef atoi extern __typeof(atol) atoi; +/* the one in stdlib.h is not enough due to prototype mismatch */ libc_hidden_proto(atoi) strong_alias(atol,atoi) libc_hidden_def(atoi) @@ -339,10 +339,13 @@ strong_alias(strtol,strtoimax) #undef strtoll #endif extern __typeof(__XL_NPP(strtol)) __XL_NPP(strtoll); +/* the one in stdlib.h is not enough due to prototype mismatch */ +#ifdef L_strtol libc_hidden_proto(__XL_NPP(strtoll)) +#endif strong_alias(__XL_NPP(strtol),__XL_NPP(strtoll)) +#ifdef L_strtol libc_hidden_def(__XL_NPP(strtoll)) -#if !defined(L_strtol_l) strong_alias(strtol,strtoq) #endif #endif @@ -353,16 +356,14 @@ strong_alias(strtol,strtoq) #if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) -libc_hidden_proto(__XL_NPP(strtoll)) long long __XL_NPP(strtoll)(const char * __restrict str, char ** __restrict endptr, int base __LOCALE_PARAM) { return (long long) __XL_NPP(_stdlib_strto_ll)(str, endptr, base, 1 __LOCALE_ARG); } +#ifdef L_strtoll libc_hidden_def(__XL_NPP(strtoll)) - -#if !defined(L_strtoll_l) #if (ULLONG_MAX == UINTMAX_MAX) strong_alias(strtoll,strtoimax) #endif @@ -394,9 +395,7 @@ strong_alias(strtoul,strtoumax) #undef strtoull #endif extern __typeof(__XL_NPP(strtoul)) __XL_NPP(strtoull); -libc_hidden_proto(__XL_NPP(strtoull)) strong_alias(__XL_NPP(strtoul),__XL_NPP(strtoull)) -libc_hidden_def(__XL_NPP(strtoull)) #if !defined(L_strtoul_l) strong_alias(strtoul,strtouq) #endif @@ -409,14 +408,12 @@ strong_alias(strtoul,strtouq) #if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) -libc_hidden_proto(__XL_NPP(strtoull)) unsigned long long __XL_NPP(strtoull)(const char * __restrict str, char ** __restrict endptr, int base __LOCALE_PARAM) { return __XL_NPP(_stdlib_strto_ll)(str, endptr, base, 0 __LOCALE_ARG); } -libc_hidden_def(__XL_NPP(strtoull)) #if !defined(L_strtoull_l) #if (ULLONG_MAX == UINTMAX_MAX) @@ -1046,13 +1043,11 @@ size_t wcstombs(char * __restrict s, const wchar_t * __restrict pwcs, size_t n) /**********************************************************************/ #if defined(L_wcstol) || defined(L_wcstol_l) -libc_hidden_proto(__XL_NPP(wcstol)) long __XL_NPP(wcstol)(const wchar_t * __restrict str, wchar_t ** __restrict endptr, int base __LOCALE_PARAM) { return __XL_NPP(_stdlib_wcsto_l)(str, endptr, base, 1 __LOCALE_ARG); } -libc_hidden_def(__XL_NPP(wcstol)) #if (ULONG_MAX == UINTMAX_MAX) && !defined(L_wcstol_l) strong_alias(wcstol,wcstoimax) @@ -1065,9 +1060,7 @@ strong_alias(wcstol,wcstoimax) #undef wcstoll #endif extern __typeof(__XL_NPP(wcstol)) __XL_NPP(wcstoll); -libc_hidden_proto(__XL_NPP(wcstoll)) strong_alias(__XL_NPP(wcstol),__XL_NPP(wcstoll)) -libc_hidden_def(__XL_NPP(wcstoll)) #endif #endif @@ -1076,14 +1069,12 @@ libc_hidden_def(__XL_NPP(wcstoll)) #if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) -libc_hidden_proto(__XL_NPP(wcstoll)) long long __XL_NPP(wcstoll)(const wchar_t * __restrict str, wchar_t ** __restrict endptr, int base __LOCALE_PARAM) { return (long long) __XL_NPP(_stdlib_wcsto_ll)(str, endptr, base, 1 __LOCALE_ARG); } -libc_hidden_def(__XL_NPP(wcstoll)) #if !defined(L_wcstoll_l) #if (ULLONG_MAX == UINTMAX_MAX) @@ -1098,14 +1089,12 @@ strong_alias(wcstoll,wcstoq) /**********************************************************************/ #if defined(L_wcstoul) || defined(L_wcstoul_l) -libc_hidden_proto(__XL_NPP(wcstoul)) unsigned long __XL_NPP(wcstoul)(const wchar_t * __restrict str, wchar_t ** __restrict endptr, int base __LOCALE_PARAM) { return __XL_NPP(_stdlib_wcsto_l)(str, endptr, base, 0 __LOCALE_ARG); } -libc_hidden_def(__XL_NPP(wcstoul)) #if (ULONG_MAX == UINTMAX_MAX) && !defined(L_wcstoul_l) strong_alias(wcstoul,wcstoumax) @@ -1118,9 +1107,7 @@ strong_alias(wcstoul,wcstoumax) #undef wcstoull #endif extern __typeof(__XL_NPP(wcstoul)) __XL_NPP(wcstoull); -libc_hidden_proto(__XL_NPP(wcstoull)) strong_alias(__XL_NPP(wcstoul),__XL_NPP(wcstoull)) -libc_hidden_def(__XL_NPP(wcstoull)) #endif #endif @@ -1129,14 +1116,12 @@ libc_hidden_def(__XL_NPP(wcstoull)) #if defined(ULLONG_MAX) && (LLONG_MAX > LONG_MAX) -libc_hidden_proto(__XL_NPP(wcstoull)) unsigned long long __XL_NPP(wcstoull)(const wchar_t * __restrict str, wchar_t ** __restrict endptr, int base __LOCALE_PARAM) { return __XL_NPP(_stdlib_wcsto_ll)(str, endptr, base, 0 __LOCALE_ARG); } -libc_hidden_def(__XL_NPP(wcstoull)) #if !defined(L_wcstoull_l) #if (ULLONG_MAX == UINTMAX_MAX) -- cgit v1.2.3 From f4ec824864b8ea68af8953669f789656cc05143d Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 21:11:47 +0100 Subject: ctype.c, _collate.c, str[n]casecmp.c, strlcpy.c: remove unused hidden functions Signed-off-by: Peter S. Mazinger --- include/ctype.h | 1 - include/string.h | 1 - include/wchar.h | 5 ----- libc/misc/ctype/ctype.c | 1 - libc/string/_collate.c | 7 ++++--- libc/string/strcasecmp.c | 4 ++++ libc/string/strlcpy.c | 2 -- libc/string/strncasecmp.c | 4 ++++ 8 files changed, 12 insertions(+), 13 deletions(-) diff --git a/include/ctype.h b/include/ctype.h index dcfeb1b3e..6ad17a781 100644 --- a/include/ctype.h +++ b/include/ctype.h @@ -354,7 +354,6 @@ libc_hidden_proto(tolower_l) /* Return the uppercase version of C. */ /*extern int __toupper_l (int __c, __locale_t __l) __THROW; */ extern int toupper_l (int __c, __locale_t __l) __THROW; -libc_hidden_proto(toupper_l) # if __GNUC__ >= 2 && defined __OPTIMIZE__ && !defined __cplusplus # define tolower_l(c, locale) __tobody(c, tolower_l, (locale)->__ctype_tolower, (c, locale)) diff --git a/include/string.h b/include/string.h index c71a85c9f..6632e5f4a 100644 --- a/include/string.h +++ b/include/string.h @@ -124,7 +124,6 @@ libc_hidden_proto(strcoll) extern size_t strxfrm (char *__restrict __dest, __const char *__restrict __src, size_t __n) __THROW __nonnull ((2)); -libc_hidden_proto(strxfrm) __END_NAMESPACE_STD #if defined __USE_GNU && defined __UCLIBC_HAS_XLOCALE__ diff --git a/include/wchar.h b/include/wchar.h index 3795998a5..ddbb55912 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -170,12 +170,10 @@ __END_NAMESPACE_C99 #ifdef __USE_GNU /* Compare S1 and S2, ignoring case. */ extern int wcscasecmp (__const wchar_t *__s1, __const wchar_t *__s2) __THROW; -libc_hidden_proto(wcscasecmp) /* Compare no more than N chars of S1 and S2, ignoring case. */ extern int wcsncasecmp (__const wchar_t *__s1, __const wchar_t *__s2, size_t __n) __THROW; -libc_hidden_proto(wcsncasecmp) #ifdef __UCLIBC_HAS_XLOCALE__ /* Similar to the two functions above but take the information from @@ -184,11 +182,9 @@ libc_hidden_proto(wcsncasecmp) extern int wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, __locale_t __loc) __THROW; -libc_hidden_proto(wcscasecmp_l) extern int wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, size_t __n, __locale_t __loc) __THROW; -libc_hidden_proto(wcsncasecmp_l) #endif /* __UCLIBC_HAS_XLOCALE__ */ #endif @@ -202,7 +198,6 @@ libc_hidden_proto(wcscoll) `wcscoll' to the original strings. */ extern size_t wcsxfrm (wchar_t *__restrict __s1, __const wchar_t *__restrict __s2, size_t __n) __THROW; -libc_hidden_proto(wcsxfrm) __END_NAMESPACE_C99 #ifdef __USE_GNU diff --git a/libc/misc/ctype/ctype.c b/libc/misc/ctype/ctype.c index e46f66b58..54cd21e87 100644 --- a/libc/misc/ctype/ctype.c +++ b/libc/misc/ctype/ctype.c @@ -346,7 +346,6 @@ int toupper_l(int c, __locale_t l) #endif return __UCLIBC_CTYPE_IN_TO_DOMAIN(c) ? l->__ctype_toupper[c] : c; } -libc_hidden_def(toupper_l) /*remove after 0.9.31. See ctype.h for why. *weak_alias (toupper_l, __toupper_l) */ diff --git a/libc/string/_collate.c b/libc/string/_collate.c index 77d9eb62c..58faa5a84 100644 --- a/libc/string/_collate.c +++ b/libc/string/_collate.c @@ -62,7 +62,6 @@ size_t wcsxfrm(Wchar *__restrict ws1, const Wchar *__restrict ws2, size_t n) { return wcsxfrm_l(ws1, ws2, n, __UCLIBC_CURLOCALE ); } -libc_hidden_def(wcsxfrm) #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -541,7 +540,6 @@ libc_hidden_def(__XL_NPP(wcscoll)) extern size_t __wcslcpy(wchar_t *__restrict dst, const wchar_t *__restrict src, size_t n); -libc_hidden_proto(__XL_NPP(wcsxfrm)) size_t __XL_NPP(wcsxfrm)(wchar_t *__restrict ws1, const wchar_t *__restrict ws2, size_t n __LOCALE_PARAM ) { @@ -579,7 +577,9 @@ size_t __XL_NPP(wcsxfrm)(wchar_t *__restrict ws1, const wchar_t *__restrict ws2, } return count-1; } +#if defined L_strxfrm_l || defined L_wcsxfrm_l libc_hidden_def(__XL_NPP(wcsxfrm)) +#endif #else /* WANT_WIDE */ @@ -623,7 +623,6 @@ static size_t store(unsigned char *s, size_t count, size_t n, __uwchar_t weight) return r; } -libc_hidden_proto(__XL_NPP(strxfrm)) size_t __XL_NPP(strxfrm)(char *__restrict ws1, const char *__restrict ws2, size_t n __LOCALE_PARAM ) { @@ -661,7 +660,9 @@ size_t __XL_NPP(strxfrm)(char *__restrict ws1, const char *__restrict ws2, size_ } return count-1; } +#ifdef L_strxfrm_l libc_hidden_def(__XL_NPP(strxfrm)) +#endif #endif /* WANT_WIDE */ diff --git a/libc/string/strcasecmp.c b/libc/string/strcasecmp.c index 33e48fa22..8c95ac04b 100644 --- a/libc/string/strcasecmp.c +++ b/libc/string/strcasecmp.c @@ -31,7 +31,9 @@ int strcasecmp(register const Wchar *s1, register const Wchar *s2) { return strcasecmp_l(s1, s2, __UCLIBC_CURLOCALE); } +#ifndef WANT_WIDE libc_hidden_def(strcasecmp) +#endif #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -59,6 +61,8 @@ int __XL_NPP(strcasecmp)(register const Wchar *s1, register const Wchar *s2 return r; #endif } +#ifndef WANT_WIDE libc_hidden_def(__XL_NPP(strcasecmp)) +#endif #endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ diff --git a/libc/string/strlcpy.c b/libc/string/strlcpy.c index 0ccfc0e8a..049c92e0a 100644 --- a/libc/string/strlcpy.c +++ b/libc/string/strlcpy.c @@ -49,7 +49,6 @@ size_t Wstrlcpy(register Wchar *__restrict dst, #ifndef __UCLIBC_HAS_LOCALE__ strong_alias(__wcslcpy,wcsxfrm) -libc_hidden_def(wcsxfrm) #endif #else @@ -57,7 +56,6 @@ libc_hidden_def(wcsxfrm) libc_hidden_def(strlcpy) #ifndef __UCLIBC_HAS_LOCALE__ strong_alias(strlcpy,strxfrm) -libc_hidden_def(strxfrm) #endif #endif diff --git a/libc/string/strncasecmp.c b/libc/string/strncasecmp.c index 2af305e16..4de01143f 100644 --- a/libc/string/strncasecmp.c +++ b/libc/string/strncasecmp.c @@ -31,7 +31,9 @@ int strncasecmp(register const Wchar *s1, register const Wchar *s2, size_t n) { return strncasecmp_l(s1, s2, n, __UCLIBC_CURLOCALE); } +#ifndef WANT_WIDE libc_hidden_def(strncasecmp) +#endif #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -62,6 +64,8 @@ int __XL_NPP(strncasecmp)(register const Wchar *s1, register const Wchar *s2, return r; #endif } +#ifndef WANT_WIDE libc_hidden_def(__XL_NPP(strncasecmp)) +#endif #endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ -- cgit v1.2.3 From 1350fdff4b950d42771d6ea7b246e2d269e2bd72 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 21:30:53 +0100 Subject: wchar.h, _collate.c, strlcpy.c: use a common prototype of __wcslcpy Signed-off-by: Peter S. Mazinger --- include/wchar.h | 5 +++++ libc/string/_collate.c | 3 --- libc/string/strlcpy.c | 20 +++++--------------- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/include/wchar.h b/include/wchar.h index ddbb55912..0603089f1 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -783,6 +783,11 @@ libc_hidden_proto(wcsftime_l) # include #endif +#ifdef _LIBC +extern size_t __wcslcpy(wchar_t *__restrict dst, + const wchar_t *__restrict src, size_t n) attribute_hidden; +#endif + __END_DECLS #endif /* _WCHAR_H defined */ diff --git a/libc/string/_collate.c b/libc/string/_collate.c index 58faa5a84..be1951301 100644 --- a/libc/string/_collate.c +++ b/libc/string/_collate.c @@ -537,9 +537,6 @@ libc_hidden_def(__XL_NPP(wcscoll)) #ifdef WANT_WIDE -extern size_t __wcslcpy(wchar_t *__restrict dst, - const wchar_t *__restrict src, size_t n); - size_t __XL_NPP(wcsxfrm)(wchar_t *__restrict ws1, const wchar_t *__restrict ws2, size_t n __LOCALE_PARAM ) { diff --git a/libc/string/strlcpy.c b/libc/string/strlcpy.c index 049c92e0a..83787049a 100644 --- a/libc/string/strlcpy.c +++ b/libc/string/strlcpy.c @@ -9,19 +9,16 @@ #ifdef WANT_WIDE # define Wstrlcpy __wcslcpy +# define Wstrxfrm wcsxfrm #else # define Wstrlcpy strlcpy +# define Wstrxfrm strxfrm #endif /* OpenBSD function: * Copy at most n-1 chars from src to dst and nul-terminate dst. * Returns strlen(src), so truncation occurred if the return value is >= n. */ -#ifdef WANT_WIDE -size_t Wstrlcpy(register Wchar *__restrict dst, - register const Wchar *__restrict src, - size_t n) attribute_hidden; -#endif size_t Wstrlcpy(register Wchar *__restrict dst, register const Wchar *__restrict src, size_t n) @@ -45,17 +42,10 @@ size_t Wstrlcpy(register Wchar *__restrict dst, return src - src0; } -#ifdef WANT_WIDE - -#ifndef __UCLIBC_HAS_LOCALE__ -strong_alias(__wcslcpy,wcsxfrm) -#endif - -#else - +#ifndef WANT_WIDE libc_hidden_def(strlcpy) -#ifndef __UCLIBC_HAS_LOCALE__ -strong_alias(strlcpy,strxfrm) #endif +#ifndef __UCLIBC_HAS_LOCALE__ +strong_alias(Wstrlcpy,Wstrxfrm) #endif -- cgit v1.2.3 From 01b480ad1454ee3664ffcb8b3ecf0d89ccb7d56b Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 21:40:01 +0100 Subject: _collate.c: remove duplicated libc_hidden_proto() for strcoll*/wcscoll* Signed-off-by: Peter S. Mazinger --- libc/string/_collate.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libc/string/_collate.c b/libc/string/_collate.c index be1951301..def56d260 100644 --- a/libc/string/_collate.c +++ b/libc/string/_collate.c @@ -499,7 +499,6 @@ static void next_weight(col_state_t *cs, int pass __LOCALE_PARAM ) } while (1); } -libc_hidden_proto(__XL_NPP(wcscoll)) int __XL_NPP(wcscoll) (const Wchar *s0, const Wchar *s1 __LOCALE_PARAM ) { col_state_t ws[2]; -- cgit v1.2.3 From e60342da428076ae6d3097950a3c5454bab84160 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 21:55:39 +0100 Subject: memmem.c, string.h: remove unused hidden memmem It is used only by gen_collate, not included into libc. Signed-off-by: Peter S. Mazinger --- include/string.h | 1 - libc/string/generic/memmem.c | 1 - libc/string/memmem.c | 1 - 3 files changed, 3 deletions(-) diff --git a/include/string.h b/include/string.h index 6632e5f4a..cfd423b9f 100644 --- a/include/string.h +++ b/include/string.h @@ -256,7 +256,6 @@ libc_hidden_proto(strcasestr) extern void *memmem (__const void *__haystack, size_t __haystacklen, __const void *__needle, size_t __needlelen) __THROW __attribute_pure__ __nonnull ((1, 3)); -libc_hidden_proto(memmem) /* Copy N bytes of SRC to DEST, return pointer to bytes after the last written byte. */ diff --git a/libc/string/generic/memmem.c b/libc/string/generic/memmem.c index 0fccac77f..97384978b 100644 --- a/libc/string/generic/memmem.c +++ b/libc/string/generic/memmem.c @@ -48,5 +48,4 @@ void *memmem (const void *haystack, size_t haystack_len, return NULL; } -libc_hidden_def(memmem) #endif diff --git a/libc/string/memmem.c b/libc/string/memmem.c index f568a4261..1b3a0bab6 100644 --- a/libc/string/memmem.c +++ b/libc/string/memmem.c @@ -37,5 +37,4 @@ void *memmem(const void *haystack, size_t haystacklen, return NULL; } -libc_hidden_def(memmem) #endif -- cgit v1.2.3 From 3ec2f90152de3b11266bc0d3f4fa6a41b3c52374 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 22:37:05 +0100 Subject: frv/memset.S: add missing libc_hidden_def Signed-off-by: Peter S. Mazinger --- libc/string/frv/memset.S | 1 + 1 file changed, 1 insertion(+) diff --git a/libc/string/frv/memset.S b/libc/string/frv/memset.S index a3e76c491..bc0f80db0 100644 --- a/libc/string/frv/memset.S +++ b/libc/string/frv/memset.S @@ -155,3 +155,4 @@ memset: bralr .size memset, .-memset +libc_hidden_def(memset) -- cgit v1.2.3 From abd6c6c29f82ddcc7c86c67519b79d2381622ed9 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 9 Mar 2011 23:20:16 +0100 Subject: remove unused hidden functions Signed-off-by: Peter S. Mazinger --- include/stdio.h | 1 - include/string.h | 1 - include/wchar.h | 3 --- libc/stdio/_scanf.c | 1 - libc/stdio/fwprintf.c | 1 - libc/string/stpncpy.c | 4 ---- libc/string/strchr.c | 7 ++++--- libc/string/strchrnul.c | 2 ++ libc/string/strcpy.c | 4 +--- 9 files changed, 7 insertions(+), 17 deletions(-) diff --git a/include/stdio.h b/include/stdio.h index 3c86f256b..45d3e4991 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -450,7 +450,6 @@ libc_hidden_proto(vfscanf) marked with __THROW. */ extern int vscanf (__const char *__restrict __format, __gnuc_va_list __arg) __attribute__ ((__format__ (__scanf__, 1, 0))) __wur; -libc_hidden_proto(vscanf) /* Read formatted input from S into argument list ARG. */ extern int vsscanf (__const char *__restrict __s, diff --git a/include/string.h b/include/string.h index cfd423b9f..f11a7269c 100644 --- a/include/string.h +++ b/include/string.h @@ -447,7 +447,6 @@ extern char *__stpncpy (char *__restrict __dest, extern char *stpncpy (char *__restrict __dest, __const char *__restrict __src, size_t __n) __THROW __nonnull ((1, 2)); -libc_hidden_proto(stpncpy) # if 0 /* uClibc does not support strfry or memfrob. */ /* Sautee STRING briskly. */ diff --git a/include/wchar.h b/include/wchar.h index 0603089f1..53959e0cb 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -228,7 +228,6 @@ __BEGIN_NAMESPACE_C99 /* Find the first occurrence of WC in WCS. */ extern wchar_t *wcschr (__const wchar_t *__wcs, wchar_t __wc) __THROW __attribute_pure__; -libc_hidden_proto(wcschr) /* Find the last occurrence of WC in WCS. */ extern wchar_t *wcsrchr (__const wchar_t *__wcs, wchar_t __wc) __THROW __attribute_pure__; @@ -239,7 +238,6 @@ __END_NAMESPACE_C99 the closing NUL wide character in case C is not found in S. */ extern wchar_t *wcschrnul (__const wchar_t *__s, wchar_t __wc) __THROW __attribute_pure__; -libc_hidden_proto(wcschrnul) #endif __BEGIN_NAMESPACE_C99 @@ -544,7 +542,6 @@ extern int fwide (__FILE *__fp, int __mode) __THROW; extern int fwprintf (__FILE *__restrict __stream, __const wchar_t *__restrict __format, ...) /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */; -libc_hidden_proto(fwprintf) /* Write formatted output to stdout. This function is a possible cancellation point and therefore not diff --git a/libc/stdio/_scanf.c b/libc/stdio/_scanf.c index 1ad81cbe3..f38e72b5c 100644 --- a/libc/stdio/_scanf.c +++ b/libc/stdio/_scanf.c @@ -198,7 +198,6 @@ int vscanf(const char * __restrict format, va_list arg) { return vfscanf(stdin, format, arg); } -libc_hidden_def(vscanf) #endif /**********************************************************************/ diff --git a/libc/stdio/fwprintf.c b/libc/stdio/fwprintf.c index 2f2dddc10..954970867 100644 --- a/libc/stdio/fwprintf.c +++ b/libc/stdio/fwprintf.c @@ -21,4 +21,3 @@ int fwprintf(FILE * __restrict stream, const wchar_t * __restrict format, ...) return rv; } -libc_hidden_def(fwprintf) diff --git a/libc/string/stpncpy.c b/libc/string/stpncpy.c index 088145dea..50d83a131 100644 --- a/libc/string/stpncpy.c +++ b/libc/string/stpncpy.c @@ -27,7 +27,3 @@ Wchar *Wstpncpy(register Wchar * __restrict s1, } return s1 + (s2 - p); } - -#ifndef WANT_WIDE -libc_hidden_def(stpncpy) -#endif diff --git a/libc/string/strchr.c b/libc/string/strchr.c index 462b7b1f1..7ea477362 100644 --- a/libc/string/strchr.c +++ b/libc/string/strchr.c @@ -23,8 +23,9 @@ Wchar *Wstrchr(register const Wchar *s, Wint c) return NULL; } -libc_hidden_def(Wstrchr) - -#if !defined WANT_WIDE && defined __UCLIBC_SUSV3_LEGACY__ +#ifndef WANT_WIDE +libc_hidden_def(strchr) +# ifdef __UCLIBC_SUSV3_LEGACY__ weak_alias(strchr,index) +# endif #endif diff --git a/libc/string/strchrnul.c b/libc/string/strchrnul.c index d2d7df307..4751971bc 100644 --- a/libc/string/strchrnul.c +++ b/libc/string/strchrnul.c @@ -21,5 +21,7 @@ Wchar *Wstrchrnul(register const Wchar *s, Wint c) while (*++s && (*s != ((Wchar)c))); return (Wchar *) s; } +# ifndef WANT_WIDE libc_hidden_def(Wstrchrnul) +# endif #endif diff --git a/libc/string/strcpy.c b/libc/string/strcpy.c index bb5a16872..549360c22 100644 --- a/libc/string/strcpy.c +++ b/libc/string/strcpy.c @@ -22,8 +22,6 @@ Wchar *Wstrcpy(Wchar * __restrict s1, const Wchar * __restrict s2) return s1; } -#ifdef WANT_WIDE -/* wcscpy does not need libc_hidden_def */ -#else +#ifndef WANT_WIDE libc_hidden_def(strcpy) #endif -- cgit v1.2.3 From 25a349893513aa257718aa92c3e8755b9d89eb7e Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 10 Mar 2011 00:01:10 +0100 Subject: str[n]casecmp.c: fix hidden usage Provide visible str[n]casecmp[_l], wcs[n]casecmp[_l]. Signed-off-by: Peter S. Mazinger --- libc/string/strcasecmp.c | 2 +- libc/string/strncasecmp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/string/strcasecmp.c b/libc/string/strcasecmp.c index 8c95ac04b..f894e426e 100644 --- a/libc/string/strcasecmp.c +++ b/libc/string/strcasecmp.c @@ -61,7 +61,7 @@ int __XL_NPP(strcasecmp)(register const Wchar *s1, register const Wchar *s2 return r; #endif } -#ifndef WANT_WIDE +#if !defined WANT_WIDE || (defined WANT_WIDE && defined __UCLIBC_DO_XLOCALE) libc_hidden_def(__XL_NPP(strcasecmp)) #endif diff --git a/libc/string/strncasecmp.c b/libc/string/strncasecmp.c index 4de01143f..2eac47dd4 100644 --- a/libc/string/strncasecmp.c +++ b/libc/string/strncasecmp.c @@ -64,7 +64,7 @@ int __XL_NPP(strncasecmp)(register const Wchar *s1, register const Wchar *s2, return r; #endif } -#ifndef WANT_WIDE +#if !defined WANT_WIDE || (defined WANT_WIDE && defined __UCLIBC_DO_XLOCALE) libc_hidden_def(__XL_NPP(strncasecmp)) #endif -- cgit v1.2.3 From 5ab9845ea03ba2c356e58617daeab6b306959380 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 10 Mar 2011 00:49:01 +0100 Subject: time.c, wchar.h: remove unused hidden wcsftime Signed-off-by: Peter S. Mazinger --- include/wchar.h | 1 - libc/misc/time/time.c | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/wchar.h b/include/wchar.h index 53959e0cb..650c39975 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -754,7 +754,6 @@ __BEGIN_NAMESPACE_C99 extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize, __const wchar_t *__restrict __format, __const struct tm *__restrict __tp) __THROW; -libc_hidden_proto(wcsftime) __END_NAMESPACE_C99 # if defined __USE_GNU && defined __UCLIBC_HAS_XLOCALE__ diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c index 096c3b6b4..ccfe3444d 100644 --- a/libc/misc/time/time.c +++ b/libc/misc/time/time.c @@ -2455,11 +2455,9 @@ size_t wcsftime(wchar_t *__restrict s, size_t maxsize, { return wcsftime_l(s, maxsize, format, timeptr, __UCLIBC_CURLOCALE); } -libc_hidden_def(wcsftime) #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ -libc_hidden_proto(__XL_NPP(wcsftime)) size_t __XL_NPP(wcsftime)(wchar_t *__restrict s, size_t maxsize, const wchar_t *__restrict format, const struct tm *__restrict timeptr __LOCALE_PARAM ) @@ -2467,7 +2465,9 @@ size_t __XL_NPP(wcsftime)(wchar_t *__restrict s, size_t maxsize, #warning wcsftime always fails return 0; /* always fail */ } -libc_hidden_def(__XL_NPP(wcsftime)) +#ifdef L_wcsftime_l +libc_hidden_def(wcsftime_l) +#endif #endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ -- cgit v1.2.3 From 3e223e6c18912091bf75b77f9c7ae2ded0063037 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 10 Mar 2011 10:50:01 +0100 Subject: _wctype.c, wctype.h: remove unused isw* and wctype_l hidden functions Signed-off-by: Peter S. Mazinger --- include/wctype.h | 1 - libc/misc/wctype/_wctype.c | 23 ++++++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/include/wctype.h b/include/wctype.h index 7b697d2b0..79f36eb8c 100644 --- a/include/wctype.h +++ b/include/wctype.h @@ -305,7 +305,6 @@ extern int iswblank_l (wint_t __wc, __locale_t __locale) __THROW; by the string argument PROPERTY. */ extern wctype_t wctype_l (__const char *__property, __locale_t __locale) __THROW; -libc_hidden_proto(wctype_l) /* Determine whether the wide-character WC has the property described by DESC. */ diff --git a/libc/misc/wctype/_wctype.c b/libc/misc/wctype/_wctype.c index 296293ff3..89269f45e 100644 --- a/libc/misc/wctype/_wctype.c +++ b/libc/misc/wctype/_wctype.c @@ -140,28 +140,27 @@ enum { #ifdef __UCLIBC_DO_XLOCALE #define ISW_FUNC_BODY(NAME) \ -libc_hidden_proto(__PASTE3(isw,NAME,_l)) \ int __PASTE3(isw,NAME,_l) (wint_t wc, __locale_t l) \ { \ return iswctype_l(wc, __PASTE2(_CTYPE_is,NAME), l); \ -} \ -libc_hidden_def(__PASTE3(isw,NAME,_l)) +} #else /* __UCLIBC_DO_XLOCALE */ #define ISW_FUNC_BODY(NAME) \ -libc_hidden_proto(__PASTE2(isw,NAME)) \ int __PASTE2(isw,NAME) (wint_t wc) \ { \ return iswctype(wc, __PASTE2(_CTYPE_is,NAME)); \ -} \ -libc_hidden_def(__PASTE2(isw,NAME)) +} #endif /* __UCLIBC_DO_XLOCALE */ /**********************************************************************/ #if defined(L_iswalnum) || defined(L_iswalnum_l) ISW_FUNC_BODY(alnum); +# ifdef L_iswalnum +libc_hidden_def(iswalnum) +# endif #endif /**********************************************************************/ @@ -198,6 +197,9 @@ ISW_FUNC_BODY(graph); #if defined(L_iswlower) || defined(L_iswlower_l) ISW_FUNC_BODY(lower); +# ifdef L_iswlower +libc_hidden_def(iswlower) +# endif #endif /**********************************************************************/ @@ -216,12 +218,20 @@ ISW_FUNC_BODY(punct); #if defined(L_iswspace) || defined(L_iswspace_l) ISW_FUNC_BODY(space); +# ifdef L_iswspace +libc_hidden_def(iswspace) +# else +libc_hidden_def(iswspace_l) +# endif #endif /**********************************************************************/ #if defined(L_iswupper) || defined(L_iswupper_l) ISW_FUNC_BODY(upper); +# ifdef L_iswupper +libc_hidden_def(iswupper) +# endif #endif /**********************************************************************/ @@ -461,7 +471,6 @@ wctype_t wctype_l (const char *property, __locale_t locale) { return wctype(property); } -libc_hidden_def(wctype_l) #endif /**********************************************************************/ -- cgit v1.2.3 From 14b0a648ca751773fe28dd98f2c031bf6287e52a Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 10 Mar 2011 11:06:25 +0100 Subject: ctype.c, ctype.h: remove commented parts that were banned for removal after 0.9.31 Signed-off-by: Peter S. Mazinger --- include/ctype.h | 6 ------ libc/misc/ctype/ctype.c | 4 ---- 2 files changed, 10 deletions(-) diff --git a/include/ctype.h b/include/ctype.h index 6ad17a781..d09f0526b 100644 --- a/include/ctype.h +++ b/include/ctype.h @@ -345,21 +345,15 @@ libc_hidden_proto(isascii_l) # endif /* Return the lowercase version of C in locale L. */ -/* "ordinary" ctype.h has no __tolower, why we try to have it? - * remove after 0.9.31 - *extern int __tolower_l (int __c, __locale_t __l) __THROW; */ extern int tolower_l (int __c, __locale_t __l) __THROW; libc_hidden_proto(tolower_l) /* Return the uppercase version of C. */ -/*extern int __toupper_l (int __c, __locale_t __l) __THROW; */ extern int toupper_l (int __c, __locale_t __l) __THROW; # if __GNUC__ >= 2 && defined __OPTIMIZE__ && !defined __cplusplus # define tolower_l(c, locale) __tobody(c, tolower_l, (locale)->__ctype_tolower, (c, locale)) # define toupper_l(c, locale) __tobody(c, toupper_l, (locale)->__ctype_toupper, (c, locale)) -/*# define __tolower_l(c, locale) tolower_l((c), (locale)) */ -/*# define __toupper_l(c, locale) toupper_l((c), (locale)) */ # endif /* Optimizing gcc */ diff --git a/libc/misc/ctype/ctype.c b/libc/misc/ctype/ctype.c index 54cd21e87..1c40b244a 100644 --- a/libc/misc/ctype/ctype.c +++ b/libc/misc/ctype/ctype.c @@ -306,8 +306,6 @@ int tolower_l(int c, __locale_t l) return __UCLIBC_CTYPE_IN_TO_DOMAIN(c) ? l->__ctype_tolower[c] : c; } libc_hidden_def(tolower_l) -/*remove after 0.9.31. See ctype.h for why. - *weak_alias (tolower_l, __tolower_l) */ #endif /**********************************************************************/ @@ -346,8 +344,6 @@ int toupper_l(int c, __locale_t l) #endif return __UCLIBC_CTYPE_IN_TO_DOMAIN(c) ? l->__ctype_toupper[c] : c; } -/*remove after 0.9.31. See ctype.h for why. - *weak_alias (toupper_l, __toupper_l) */ #endif /**********************************************************************/ -- cgit v1.2.3 From fcde46eae5c16948c71f71d0b8fb82019f60f51f Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 10 Mar 2011 11:33:51 +0100 Subject: nanosleep.c: remove duplicated libc_hidden_proto Signed-off-by: Peter S. Mazinger --- libc/sysdeps/linux/common/nanosleep.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libc/sysdeps/linux/common/nanosleep.c b/libc/sysdeps/linux/common/nanosleep.c index 0be59c511..26ce4a6c5 100644 --- a/libc/sysdeps/linux/common/nanosleep.c +++ b/libc/sysdeps/linux/common/nanosleep.c @@ -36,6 +36,5 @@ int __libc_nanosleep(const struct timespec *req, struct timespec *rem) #endif } -libc_hidden_proto(nanosleep) weak_alias(__libc_nanosleep,nanosleep) libc_hidden_weak(nanosleep) -- cgit v1.2.3 From 24a14a0bb867f02ba87b498ee64e3ed6ce33b27a Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 10 Mar 2011 11:34:38 +0100 Subject: time.c, time.h: remove unused hidden strftime/strptime Signed-off-by: Peter S. Mazinger --- include/time.h | 2 -- libc/misc/time/time.c | 12 ++++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/include/time.h b/include/time.h index 7fcdf68e6..65071a908 100644 --- a/include/time.h +++ b/include/time.h @@ -207,7 +207,6 @@ extern time_t mktime (struct tm *__tp) __THROW; extern size_t strftime (char *__restrict __s, size_t __maxsize, __const char *__restrict __format, __const struct tm *__restrict __tp) __THROW; -libc_hidden_proto(strftime) __END_NAMESPACE_STD # ifdef __USE_XOPEN @@ -216,7 +215,6 @@ __END_NAMESPACE_STD extern char *strptime (__const char *__restrict __s, __const char *__restrict __fmt, struct tm *__tp) __THROW; -libc_hidden_proto(strptime) # endif #ifdef __UCLIBC_HAS_XLOCALE__ diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c index ccfe3444d..19d68e105 100644 --- a/libc/misc/time/time.c +++ b/libc/misc/time/time.c @@ -799,7 +799,6 @@ size_t strftime(char *__restrict s, size_t maxsize, { return strftime_l(s, maxsize, format, timeptr, __UCLIBC_CURLOCALE); } -libc_hidden_def(strftime) #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -999,7 +998,6 @@ static int load_field(int k, const struct tm *__restrict timeptr) #warning TODO: Check multibyte format string validity. #endif -libc_hidden_proto(__XL_NPP(strftime)) size_t __XL_NPP(strftime)(char *__restrict s, size_t maxsize, const char *__restrict format, const struct tm *__restrict timeptr __LOCALE_PARAM ) @@ -1291,7 +1289,9 @@ OUTPUT: } goto LOOP; } -libc_hidden_def(__XL_NPP(strftime)) +# ifdef L_strftime_l +libc_hidden_def(strftime_l) +# endif #endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -1314,7 +1314,6 @@ char *strptime(const char *__restrict buf, const char *__restrict format, { return strptime_l(buf, format, tm, __UCLIBC_CURLOCALE); } -libc_hidden_def(strptime) #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ @@ -1460,7 +1459,6 @@ static const unsigned char spec[] = { #define MAX_PUSH 4 -libc_hidden_proto(__XL_NPP(strptime)) char *__XL_NPP(strptime)(const char *__restrict buf, const char *__restrict format, struct tm *__restrict tm __LOCALE_PARAM) { @@ -1671,7 +1669,9 @@ LOOP: } return NULL; } -libc_hidden_def(__XL_NPP(strptime)) +# ifdef L_strptime_l +libc_hidden_def(strptime_l) +# endif #endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */ -- cgit v1.2.3 From e2cea9b9edabe885b9bf2586f9541ffb8fe93f3f Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 10 Mar 2011 11:43:07 +0100 Subject: missing prototype of __libc_drand48_data fixed Signed-off-by: Peter S. Mazinger --- libc/stdlib/drand48-iter.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libc/stdlib/drand48-iter.c b/libc/stdlib/drand48-iter.c index e0c1ce430..612cfd0d9 100644 --- a/libc/stdlib/drand48-iter.c +++ b/libc/stdlib/drand48-iter.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #ifdef __UCLIBC_MJN3_ONLY__ -- cgit v1.2.3 From c725e8ba5f049686ed7318d6b4710308677462c9 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 10 Mar 2011 12:59:15 +0100 Subject: Revert "missing prototype of __libc_drand48_data fixed" This reverts commit e2cea9b9edabe885b9bf2586f9541ffb8fe93f3f. Signed-off-by: Peter S. Mazinger --- libc/stdlib/drand48-iter.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libc/stdlib/drand48-iter.c b/libc/stdlib/drand48-iter.c index 612cfd0d9..e0c1ce430 100644 --- a/libc/stdlib/drand48-iter.c +++ b/libc/stdlib/drand48-iter.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #ifdef __UCLIBC_MJN3_ONLY__ -- cgit v1.2.3 From 6f633b7aef2af2801d059acda48b424fc12c71ac Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 10 Mar 2011 13:02:19 +0100 Subject: really fix missing __libc_drand48_data Signed-off-by: Peter S. Mazinger --- libc/stdlib/drand48-iter.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libc/stdlib/drand48-iter.c b/libc/stdlib/drand48-iter.c index e0c1ce430..7d705adca 100644 --- a/libc/stdlib/drand48-iter.c +++ b/libc/stdlib/drand48-iter.c @@ -21,8 +21,12 @@ #include #include #include +#include #include +/* Global state for non-reentrant functions. */ +struct drand48_data __libc_drand48_data; + #ifdef __UCLIBC_MJN3_ONLY__ #warning turn int __drand48_iterate into void #endif /* __UCLIBC_MJN3_ONLY__ */ -- cgit v1.2.3 From 6fb9aa575e35f59c224acd48006b9c7a7063099c Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 10 Mar 2011 13:13:26 +0100 Subject: add libc_hidden_proto for wcs[n]casecmp_l Signed-off-by: Peter S. Mazinger --- include/wchar.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/wchar.h b/include/wchar.h index 650c39975..3d477ba23 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -182,9 +182,11 @@ extern int wcsncasecmp (__const wchar_t *__s1, __const wchar_t *__s2, extern int wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, __locale_t __loc) __THROW; +libc_hidden_proto(wcscasecmp_l) extern int wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2, size_t __n, __locale_t __loc) __THROW; +libc_hidden_proto(wcsncasecmp_l) #endif /* __UCLIBC_HAS_XLOCALE__ */ #endif -- cgit v1.2.3 From 1b3f056d4aa2726f872f2ee85f3f391a784e19e4 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Thu, 10 Mar 2011 13:15:10 +0100 Subject: wctype.h: fix libc_hidden_proto for iswupper and add it for iswspace Old typo, became visible due to other changes. Signed-off-by: Peter S. Mazinger --- include/wctype.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/wctype.h b/include/wctype.h index 79f36eb8c..3ae682191 100644 --- a/include/wctype.h +++ b/include/wctype.h @@ -157,12 +157,13 @@ extern int iswpunct (wint_t __wc) __THROW; set of wide characters for which none of `iswalnum', `iswgraph', or `iswpunct' is true. */ extern int iswspace (wint_t __wc) __THROW; +libc_hidden_proto(iswspace) /* Test for any wide character that corresponds to an uppercase letter or is one of a locale-specific set of wide character for which none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ extern int iswupper (wint_t __wc) __THROW; -libc_hidden_proto(iswspace) +libc_hidden_proto(iswupper) /* Test for any wide character that corresponds to a hexadecimal-digit character equivalent to that performed be the functions described -- cgit v1.2.3 From e25a95a7a3c9f5bb3a38106422b12f83bf58d119 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Mon, 14 Mar 2011 22:45:33 -0700 Subject: arm/bits/atomic.h: Include common/bit/atomic.h for thumb1 This restores the behavior for thumb1 builds and yet uses the new atomic.h for arm and thumb2 modes. Signed-off-by: Khem Raj --- libc/sysdeps/linux/arm/bits/atomic.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libc/sysdeps/linux/arm/bits/atomic.h b/libc/sysdeps/linux/arm/bits/atomic.h index 07101fbe8..0b90330dd 100644 --- a/libc/sysdeps/linux/arm/bits/atomic.h +++ b/libc/sysdeps/linux/arm/bits/atomic.h @@ -16,6 +16,9 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#if defined __thumb__ && !defined __thumb2__ +#include_next +#else #include #include @@ -129,3 +132,5 @@ void __arm_link_error (void); #define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \ ({ __arm_link_error (); oldval; }) + +#endif -- cgit v1.2.3 From 2f9445814cb01b460a1426d41e05c738a4a37f86 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 16 Mar 2011 20:09:43 +0100 Subject: memalign: include sys/param.h for MAX libc/stdlib/malloc/memalign.c:22:1: warning: "MAX" redefined In file included from ./libpthread/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h:25, from ./include/bits/libc-lock.h:36, from ./include/bits/stdio-lock.h:23, from ./include/bits/uClibc_mutex.h:71, from libc/stdlib/malloc/malloc.h:135, from libc/stdlib/malloc/memalign.c:18: ./include/sys/param.h:75:1: warning: this is the location of the previous definition Signed-off-by: Bernhard Reutner-Fischer --- libc/stdlib/malloc/memalign.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libc/stdlib/malloc/memalign.c b/libc/stdlib/malloc/memalign.c index 6826d623a..5edd6e1cd 100644 --- a/libc/stdlib/malloc/memalign.c +++ b/libc/stdlib/malloc/memalign.c @@ -14,13 +14,12 @@ #include #include #include +#include /* MAX */ #include "malloc.h" #include "heap.h" -#define MAX(x,y) ((x) > (y) ? (x) : (y)) - /* ______________________ TOTAL _________________________ / \ -- cgit v1.2.3 From e172884f39f960ed3cf879fb66c6f4fc1846c42d Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 16 Mar 2011 20:11:13 +0100 Subject: release 0.9.32-rc3 Signed-off-by: Bernhard Reutner-Fischer --- Rules.mak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rules.mak b/Rules.mak index abf958b50..41124fb7b 100644 --- a/Rules.mak +++ b/Rules.mak @@ -106,7 +106,7 @@ export RUNTIME_PREFIX DEVEL_PREFIX KERNEL_HEADERS MULTILIB_DIR MAJOR_VERSION := 0 MINOR_VERSION := 9 SUBLEVEL := 32 -EXTRAVERSION :=-rc2-git +EXTRAVERSION :=-rc3 VERSION := $(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL) ABI_VERSION := $(MAJOR_VERSION) ifneq ($(EXTRAVERSION),) -- cgit v1.2.3 From 0c18923cbc0123a2c940cb659b765ad1b303974c Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 16 Mar 2011 20:20:32 +0100 Subject: bump version to 0.9.32-rc3-git Signed-off-by: Bernhard Reutner-Fischer --- Rules.mak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rules.mak b/Rules.mak index 41124fb7b..0aa684342 100644 --- a/Rules.mak +++ b/Rules.mak @@ -106,7 +106,7 @@ export RUNTIME_PREFIX DEVEL_PREFIX KERNEL_HEADERS MULTILIB_DIR MAJOR_VERSION := 0 MINOR_VERSION := 9 SUBLEVEL := 32 -EXTRAVERSION :=-rc3 +EXTRAVERSION :=-rc3-git VERSION := $(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL) ABI_VERSION := $(MAJOR_VERSION) ifneq ($(EXTRAVERSION),) -- cgit v1.2.3 From 251f2266bf24b1b396f59eef60d0acf41fdd02e4 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Fri, 18 Mar 2011 15:37:35 +0100 Subject: lutimes.c, stubs.c: fix compiling lutimes, if __NR_utimensat is not defined while there, provide stubs for functions depending on utimensat syscall. Reported-by: Sedat Dilek Signed-off-by: Peter S. Mazinger Signed-off-by: Khem Raj --- libc/sysdeps/linux/common/lutimes.c | 2 +- libc/sysdeps/linux/common/stubs.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libc/sysdeps/linux/common/lutimes.c b/libc/sysdeps/linux/common/lutimes.c index 0b4a8ea45..e01d40efd 100644 --- a/libc/sysdeps/linux/common/lutimes.c +++ b/libc/sysdeps/linux/common/lutimes.c @@ -12,7 +12,7 @@ #ifdef __NR_lutimes _syscall2(int, lutimes, const char *, file, const struct timeval *, tvp) -#else +#elif defined __NR_utimensat #include #include diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c index 8688e98a1..655c64001 100644 --- a/libc/sysdeps/linux/common/stubs.c +++ b/libc/sysdeps/linux/common/stubs.c @@ -172,6 +172,14 @@ make_stub(umount) make_stub(umount2) #endif +#ifndef __NR_utimensat +make_stub(futimens) +make_stub(utimensat) +# ifndef __NR_lutimes +make_stub(lutimes) +# endif +#endif + #ifndef __NR_vmsplice make_stub(vmsplice) #endif -- cgit v1.2.3 From 9b5df2295b4a3cfc63a15b6490f2b61dcf7c1be9 Mon Sep 17 00:00:00 2001 From: Thorsten Glaser Date: Sat, 26 Mar 2011 15:11:51 +0000 Subject: cris: add provide arch-specific vfork implementation vfork must be called with nothing at all on the stack, so implementing it via syscall() does not work. Signed-off-by: Thorsten Glaser Signed-off-by: Waldemar Brodkorb Signed-off-by: Mike Frysinger --- libc/sysdeps/linux/cris/Makefile.arch | 2 +- libc/sysdeps/linux/cris/vfork.S | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 libc/sysdeps/linux/cris/vfork.S diff --git a/libc/sysdeps/linux/cris/Makefile.arch b/libc/sysdeps/linux/cris/Makefile.arch index 43e191205..8a682b0b6 100644 --- a/libc/sysdeps/linux/cris/Makefile.arch +++ b/libc/sysdeps/linux/cris/Makefile.arch @@ -7,7 +7,7 @@ CSRC := __init_brk.c brk.c sbrk.c -SSRC := setjmp.S __longjmp.S clone.S sysdep.S syscall.S +SSRC := setjmp.S __longjmp.S clone.S sysdep.S syscall.S vfork.S ifeq ($(UNIFIED_SYSCALL),y) SSRC += __uClibc_syscall.S endif diff --git a/libc/sysdeps/linux/cris/vfork.S b/libc/sysdeps/linux/cris/vfork.S new file mode 100644 index 000000000..ea8a81d82 --- /dev/null +++ b/libc/sysdeps/linux/cris/vfork.S @@ -0,0 +1,30 @@ +/*- + * Copyright (c) 2011 + * Thorsten Glaser + * + * This file is available either under the terms and conditions of + * the MirOS Licence, or the same terms as klibc or uClibc. + */ + +#include "sysdep.h" + + .syntax no_register_prefix + +/* + * vfork is special, but PSEUDO() would probably work were it not broken; + * there must be nothing at all on the stack above the stack frame of the + * enclosing function + */ + +ENTRY(__vfork) + movu.w __NR_vfork,$r9 + break 13 + cmps.w -4096,$r10 + bhs 0f + nop + Ret + nop +PSEUDO_END(__vfork) + +weak_alias(__vfork,vfork) +libc_hidden_weak(vfork) -- cgit v1.2.3 From 85f4b028d767fc390a7b866d2f58d58be489242d Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Wed, 30 Mar 2011 04:51:22 -0700 Subject: utils/ldd: Check for returned pointer from strrchr not the value it holds Signed-off-by: Kevin Day Signed-off-by: Khem Raj --- utils/ldd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/ldd.c b/utils/ldd.c index 3858c815c..904075c23 100644 --- a/utils/ldd.c +++ b/utils/ldd.c @@ -553,7 +553,7 @@ static struct library *find_elf_interpreter(ElfW(Ehdr) *ehdr) interp_name = strdup(s); interp_dir = strdup(s); tmp = strrchr(interp_dir, '/'); - if (*tmp) + if (tmp) *tmp = '\0'; else { free(interp_dir); -- cgit v1.2.3