Index: Makefile.in =================================================================== --- Makefile.in (.../tags/uClibc_0_9_30) (revision 24173) +++ Makefile.in (.../branches/uClibc_0_9_30) (revision 24173) @@ -159,7 +159,7 @@ @$(disp_gen) $(Q)set -e; \ cd $(top_builddir); \ - tmp=`mktemp include/bits/sysnum.h.XXXXXX 2>/dev/null`; \ + tmp=`mktemp include/bits/sysnum.h.XXXXXX 2>/dev/null || true`; \ [ -z "$$tmp" ] && tmp='include/bits/sysnum.h.new'; \ KERNEL_HEADERS="${KERNEL_HEADERS}" top_builddir=. CC="$(CC) $(CPU_CFLAGS)" $(SHELL) extra/scripts/gen_bits_syscall_h.sh > $$tmp; \ if cmp include/bits/sysnum.h $$tmp >/dev/null 2>&1; then \ @@ -167,6 +167,15 @@ else \ mv -f $$tmp include/bits/sysnum.h; \ fi + @# Ugly linux specific hack.. + $(Q)if grep -q __NR_ $@; then true; else \ + rm -f $@; \ + echo "ERROR: Could not generate syscalls."; \ + echo "Make sure that you have proper kernel headers."; \ + echo "Your .config in KERNEL_HEADERS=\"\" was set to:"; \ + echo "${KERNEL_HEADERS}"; \ + exit 1; \ + fi $(LOCAL_INSTALL_PATH): $(Q)$(MAKE) PREFIX=$(shell pwd)/ RUNTIME_PREFIX=./ \ @@ -315,7 +324,13 @@ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/sys/inotify.h $(RM) $(PREFIX)$(DEVEL_PREFIX)include/sys/perm.h $(RM) $(PREFIX)$(DEVEL_PREFIX)include/sys/personality.h + $(RM) $(PREFIX)$(DEVEL_PREFIX)include/sys/prctl.h + $(RM) $(PREFIX)$(DEVEL_PREFIX)include/sys/reboot.h + $(RM) $(PREFIX)$(DEVEL_PREFIX)include/sys/sendfile.h + $(RM) $(PREFIX)$(DEVEL_PREFIX)include/sys/fsuid.h $(RM) $(PREFIX)$(DEVEL_PREFIX)include/sys/signalfd.h + $(RM) $(PREFIX)$(DEVEL_PREFIX)include/sys/swap.h + $(RM) $(PREFIX)$(DEVEL_PREFIX)include/sys/sysctl.h endif ifneq ($(UCLIBC_SV4_DEPRECATED),y) # Remove ustat.h since deprecated SV4 support was disabled upon request Index: include/sys/sysinfo.h =================================================================== --- include/sys/sysinfo.h (.../tags/uClibc_0_9_30) (revision 24173) +++ include/sys/sysinfo.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -48,7 +48,7 @@ /* Returns information on overall system statistics. */ extern int sysinfo (struct sysinfo *__info) __THROW; - +#if 0 /* Return number of configured processors. */ extern int get_nprocs_conf (void) __THROW; @@ -61,6 +61,7 @@ /* Return number of available physical pages of memory in the system. */ extern long int get_avphys_pages (void) __THROW; +#endif __END_DECLS Index: include/sys/mman.h =================================================================== --- include/sys/mman.h (.../tags/uClibc_0_9_30) (revision 24173) +++ include/sys/mman.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -157,11 +157,13 @@ extern void *mremap (void *__addr, size_t __old_len, size_t __new_len, int __flags, ...) __THROW; +#ifdef __UCLIBC_LINUX_SPECIFIC__ /* Remap arbitrary pages of a shared backing store within an existing VMA. */ extern int remap_file_pages (void *__start, size_t __size, int __prot, size_t __pgoff, int __flags) __THROW; #endif +#endif /* Open shared memory segment. */ Index: include/sched.h =================================================================== --- include/sched.h (.../tags/uClibc_0_9_30) (revision 24173) +++ include/sched.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -63,7 +63,7 @@ extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __THROW; -#ifdef __USE_GNU +#if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__ /* Access macros for `cpu_set'. */ #define CPU_SETSIZE __CPU_SETSIZE #define CPU_SET(cpu, cpusetp) __CPU_SET (cpu, cpusetp) Index: include/unistd.h =================================================================== --- include/unistd.h (.../tags/uClibc_0_9_30) (revision 24173) +++ include/unistd.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -869,10 +869,12 @@ __THROW __nonnull ((1)) __wur; #endif +#if defined __UCLIBC_LINUX_SPECIFIC__ /* Revoke access permissions to all processes currently communicating with the control terminal, and then send a SIGHUP signal to the process group of the control terminal. */ extern int vhangup (void) __THROW; +#endif #if 0 /* Revoke the access of all descriptors currently open on FILE. */ Index: extra/locale/gen_wc8bit.c =================================================================== --- extra/locale/gen_wc8bit.c (.../tags/uClibc_0_9_30) (revision 24173) +++ extra/locale/gen_wc8bit.c (.../branches/uClibc_0_9_30) (revision 24173) @@ -219,8 +219,8 @@ fprintf(out, "\t{ /* %.*s */", n, s0); } - memset(&csd[numsets],sizeof(charset_data),0); - memset(xi, sizeof(xi), 0); + memset(&csd[numsets], 0, sizeof(charset_data)); + memset(xi, 0, sizeof(xi)); { unsigned long c, wc; int lines; Index: libnsl/Makefile.in =================================================================== --- libnsl/Makefile.in (.../tags/uClibc_0_9_30) (revision 24173) +++ libnsl/Makefile.in (.../branches/uClibc_0_9_30) (revision 24173) @@ -8,6 +8,11 @@ CFLAGS-libnsl := -DNOT_IN_libc -DIS_IN_libnsl $(SSP_ALL_CFLAGS) LDFLAGS-libnsl.so := $(LDFLAGS) +ifdef ASNEEDED +ifeq ($(UCLIBC_HAS_SSP),y) +LDFLAGS-libnsl.so += -Wl,--no-as-needed -lc -Wl,--as-needed +endif +endif LIBS-libnsl.so := $(LIBS) Index: ldso/ldso/ldso.c =================================================================== --- ldso/ldso/ldso.c (.../tags/uClibc_0_9_30) (revision 24173) +++ ldso/ldso/ldso.c (.../branches/uClibc_0_9_30) (revision 24173) @@ -67,6 +67,7 @@ unsigned long attribute_hidden _dl_skip_args = 0; const char *_dl_progname = UCLIBC_LDSO; /* The name of the executable being run */ #include "dl-startup.c" +#include "dl-symbols.c" #include "dl-array.c" /* Forward function declarations */ static int _dl_suid_ok(void); Index: ldso/ldso/dl-elf.c =================================================================== --- ldso/ldso/dl-elf.c (.../tags/uClibc_0_9_30) (revision 24173) +++ ldso/ldso/dl-elf.c (.../branches/uClibc_0_9_30) (revision 24173) @@ -928,29 +928,3 @@ { __dl_parse_dynamic_info(dpnt, dynamic_info, debug_addr, load_off); } - -/* we want this in ldso.so and libdl.a but nowhere else */ -#ifdef __USE_GNU -#if defined IS_IN_rtld || (defined IS_IN_libdl && ! defined SHARED) -extern __typeof(dl_iterate_phdr) __dl_iterate_phdr; -int -__dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info, size_t size, void *data), void *data) -{ - struct elf_resolve *l; - struct dl_phdr_info info; - int ret = 0; - - for (l = _dl_loaded_modules; l != NULL; l = l->next) { - info.dlpi_addr = l->loadaddr; - info.dlpi_name = l->libname; - info.dlpi_phdr = l->ppnt; - info.dlpi_phnum = l->n_phent; - ret = callback (&info, sizeof (struct dl_phdr_info), data); - if (ret) - break; - } - return ret; -} -strong_alias(__dl_iterate_phdr, dl_iterate_phdr) -#endif -#endif Index: ldso/ldso/dl-hash.c =================================================================== --- ldso/ldso/dl-hash.c (.../tags/uClibc_0_9_30) (revision 24173) +++ ldso/ldso/dl-hash.c (.../branches/uClibc_0_9_30) (revision 24173) @@ -32,15 +32,7 @@ /* Various symbol table handling functions, including symbol lookup */ - /* - * This is the start of the linked list that describes all of the files present - * in the system with pointers to all of the symbol, string, and hash tables, - * as well as all of the other good stuff in the binary. - */ -struct elf_resolve *_dl_loaded_modules = NULL; - -/* * This is the list of modules that are loaded when the image is first * started. As we add more via dlopen, they get added into other * chains. Index: ldso/ldso/dl-symbols.c =================================================================== --- ldso/ldso/dl-symbols.c (.../tags/uClibc_0_9_30) (revision 0) +++ ldso/ldso/dl-symbols.c (.../branches/uClibc_0_9_30) (revision 24173) @@ -0,0 +1,21 @@ +/* + * This contains all symbols shared between + * dynamic linker ld.so and into static libc + * + * Copyright (c) 2008 STMicroelectronics Ltd + * Author: Carmelo Amoroso + * + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + * + */ + +/* + * This is the start of the linked list that describes all of the files present + * in the system with pointers to all of the symbol, string, and hash tables, + * as well as all of the other good stuff in the binary. + */ +#include + +struct elf_resolve *_dl_loaded_modules = NULL; + Index: libresolv/Makefile.in =================================================================== --- libresolv/Makefile.in (.../tags/uClibc_0_9_30) (revision 24173) +++ libresolv/Makefile.in (.../branches/uClibc_0_9_30) (revision 24173) @@ -8,6 +8,11 @@ CFLAGS-libresolv := -DNOT_IN_libc -DIS_IN_libresolv $(SSP_ALL_CFLAGS) LDFLAGS-libresolv.so := $(LDFLAGS) +ifdef ASNEEDED +ifeq ($(UCLIBC_HAS_SSP),y) +LDFLAGS-libresolv.so += -Wl,--no-as-needed -lc -Wl,--as-needed +endif +endif LIBS-libresolv.so := $(LIBS) Index: libc/inet/ifaddrs.c =================================================================== --- libc/inet/ifaddrs.c (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/inet/ifaddrs.c (.../branches/uClibc_0_9_30) (revision 24173) @@ -330,7 +330,7 @@ that a RTM_NEWADDR index is not known to this map. */ static int internal_function -map_newlink (int index, struct ifaddrs_storage *ifas, int *map, int max) +map_newlink (int idx, struct ifaddrs_storage *ifas, int *map, int max) { int i; @@ -338,12 +338,12 @@ { if (map[i] == -1) { - map[i] = index; + map[i] = idx; if (i > 0) ifas[i - 1].ifa.ifa_next = &ifas[i].ifa; return i; } - else if (map[i] == index) + else if (map[i] == idx) return i; } /* This should never be reached. If this will be reached, we have Index: libc/sysdeps/linux/arm/crt1.S =================================================================== --- libc/sysdeps/linux/arm/crt1.S (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/sysdeps/linux/arm/crt1.S (.../branches/uClibc_0_9_30) (revision 24173) @@ -238,7 +238,11 @@ #ifdef __PIC__ .L_GOT: +#ifdef __thumb__ + .word _GLOBAL_OFFSET_TABLE_-(.L_GOT_OFF+4) +#else /* __thumb2__ */ .word _GLOBAL_OFFSET_TABLE_-(.L_GOT_OFF+8) +#endif .word _fini(GOT) .word _init(GOT) .word main(GOT) Index: libc/sysdeps/linux/arm/bits/fcntl.h =================================================================== --- libc/sysdeps/linux/arm/bits/fcntl.h (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/sysdeps/linux/arm/bits/fcntl.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -189,7 +189,7 @@ #endif -#ifdef __USE_GNU +#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 @@ -212,7 +212,7 @@ __BEGIN_DECLS -#ifdef __USE_GNU +#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) Index: libc/sysdeps/linux/powerpc/bits/fcntl.h =================================================================== --- libc/sysdeps/linux/powerpc/bits/fcntl.h (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/sysdeps/linux/powerpc/bits/fcntl.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -189,7 +189,7 @@ #endif -#ifdef __USE_GNU +#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 @@ -212,7 +212,7 @@ __BEGIN_DECLS -#ifdef __USE_GNU +#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) Index: libc/sysdeps/linux/sh64/bits/fcntl.h =================================================================== --- libc/sysdeps/linux/sh64/bits/fcntl.h (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/sysdeps/linux/sh64/bits/fcntl.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -164,7 +164,7 @@ #endif -#ifdef __USE_GNU +#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 @@ -187,7 +187,7 @@ __BEGIN_DECLS -#ifdef __USE_GNU +#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) Index: libc/sysdeps/linux/alpha/bits/fcntl.h =================================================================== --- libc/sysdeps/linux/alpha/bits/fcntl.h (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/sysdeps/linux/alpha/bits/fcntl.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -159,7 +159,6 @@ }; #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 @@ -181,7 +180,7 @@ #endif -#ifdef __USE_GNU +#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 @@ -204,7 +203,7 @@ __BEGIN_DECLS -#ifdef __USE_GNU +#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) Index: libc/sysdeps/linux/m68k/bits/fcntl.h =================================================================== --- libc/sysdeps/linux/m68k/bits/fcntl.h (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/sysdeps/linux/m68k/bits/fcntl.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -185,7 +185,7 @@ #endif -#ifdef __USE_GNU +#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 @@ -208,7 +208,7 @@ __BEGIN_DECLS -#ifdef __USE_GNU +#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) Index: libc/sysdeps/linux/i960/bits/fcntl.h =================================================================== --- libc/sysdeps/linux/i960/bits/fcntl.h (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/sysdeps/linux/i960/bits/fcntl.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -182,7 +182,7 @@ #endif -#ifdef __USE_GNU +#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 @@ -205,7 +205,7 @@ __BEGIN_DECLS -#ifdef __USE_GNU +#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) Index: libc/sysdeps/linux/microblaze/bits/fcntl.h =================================================================== --- libc/sysdeps/linux/microblaze/bits/fcntl.h (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/sysdeps/linux/microblaze/bits/fcntl.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -182,7 +182,7 @@ #endif -#ifdef __USE_GNU +#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 @@ -205,7 +205,7 @@ __BEGIN_DECLS -#ifdef __USE_GNU +#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) Index: libc/sysdeps/linux/hppa/bits/fcntl.h =================================================================== --- libc/sysdeps/linux/hppa/bits/fcntl.h (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/sysdeps/linux/hppa/bits/fcntl.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -176,7 +176,7 @@ #endif -#ifdef __USE_GNU +#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 @@ -199,7 +199,7 @@ __BEGIN_DECLS -#ifdef __USE_GNU +#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) Index: libc/sysdeps/linux/i386/bits/fcntl.h =================================================================== --- libc/sysdeps/linux/i386/bits/fcntl.h (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/sysdeps/linux/i386/bits/fcntl.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -189,7 +189,7 @@ #endif -#ifdef __USE_GNU +#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 @@ -212,7 +212,7 @@ __BEGIN_DECLS -#ifdef __USE_GNU +#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) Index: libc/sysdeps/linux/nios2/bits/fcntl.h =================================================================== --- libc/sysdeps/linux/nios2/bits/fcntl.h (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/sysdeps/linux/nios2/bits/fcntl.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -185,7 +185,7 @@ #endif -#ifdef __USE_GNU +#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 @@ -208,7 +208,7 @@ __BEGIN_DECLS -#ifdef __USE_GNU +#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) Index: libc/sysdeps/linux/frv/bits/fcntl.h =================================================================== --- libc/sysdeps/linux/frv/bits/fcntl.h (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/sysdeps/linux/frv/bits/fcntl.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -164,7 +164,7 @@ #endif -#ifdef __USE_GNU +#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 @@ -187,7 +187,7 @@ __BEGIN_DECLS -#ifdef __USE_GNU +#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) Index: libc/sysdeps/linux/avr32/bits/fcntl.h =================================================================== --- libc/sysdeps/linux/avr32/bits/fcntl.h (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/sysdeps/linux/avr32/bits/fcntl.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -167,8 +167,8 @@ # define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */ #endif -#ifdef __USE_GNU +#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 Index: libc/sysdeps/linux/vax/bits/fcntl.h =================================================================== --- libc/sysdeps/linux/vax/bits/fcntl.h (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/sysdeps/linux/vax/bits/fcntl.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -162,7 +162,7 @@ #endif -#ifdef __USE_GNU +#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 @@ -185,7 +185,7 @@ __BEGIN_DECLS -#ifdef __USE_GNU +#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) Index: libc/sysdeps/linux/x86_64/bits/fcntl.h =================================================================== --- libc/sysdeps/linux/x86_64/bits/fcntl.h (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/sysdeps/linux/x86_64/bits/fcntl.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -203,7 +203,7 @@ #endif -#ifdef __USE_GNU +#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 @@ -226,7 +226,7 @@ __BEGIN_DECLS -#ifdef __USE_GNU +#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) Index: libc/sysdeps/linux/cris/bits/fcntl.h =================================================================== --- libc/sysdeps/linux/cris/bits/fcntl.h (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/sysdeps/linux/cris/bits/fcntl.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -186,7 +186,7 @@ #endif -#ifdef __USE_GNU +#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 @@ -209,7 +209,7 @@ __BEGIN_DECLS -#ifdef __USE_GNU +#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) Index: libc/sysdeps/linux/h8300/bits/fcntl.h =================================================================== --- libc/sysdeps/linux/h8300/bits/fcntl.h (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/sysdeps/linux/h8300/bits/fcntl.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -182,7 +182,7 @@ #endif -#ifdef __USE_GNU +#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 @@ -205,7 +205,7 @@ __BEGIN_DECLS -#ifdef __USE_GNU +#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) Index: libc/sysdeps/linux/v850/bits/fcntl.h =================================================================== --- libc/sysdeps/linux/v850/bits/fcntl.h (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/sysdeps/linux/v850/bits/fcntl.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -182,7 +182,7 @@ #endif -#ifdef __USE_GNU +#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 @@ -205,7 +205,7 @@ __BEGIN_DECLS -#ifdef __USE_GNU +#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) Index: libc/sysdeps/linux/xtensa/bits/fcntl.h =================================================================== --- libc/sysdeps/linux/xtensa/bits/fcntl.h (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/sysdeps/linux/xtensa/bits/fcntl.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -186,7 +186,7 @@ #endif -#ifdef __USE_GNU +#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 @@ -209,7 +209,7 @@ __BEGIN_DECLS -#ifdef __USE_GNU +#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) Index: libc/sysdeps/linux/ia64/bits/fcntl.h =================================================================== --- libc/sysdeps/linux/ia64/bits/fcntl.h (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/sysdeps/linux/ia64/bits/fcntl.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -161,7 +161,6 @@ }; #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 @@ -183,7 +182,7 @@ #endif -#ifdef __USE_GNU +#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 @@ -206,7 +205,7 @@ __BEGIN_DECLS -#ifdef __USE_GNU +#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) Index: libc/sysdeps/linux/e1/bits/fcntl.h =================================================================== --- libc/sysdeps/linux/e1/bits/fcntl.h (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/sysdeps/linux/e1/bits/fcntl.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -182,7 +182,7 @@ #endif -#ifdef __USE_GNU +#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 @@ -205,7 +205,7 @@ __BEGIN_DECLS -#ifdef __USE_GNU +#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) @@ -231,4 +231,4 @@ #endif __END_DECLS - +#endif /* LINUX_SPECIFIC */ Index: libc/sysdeps/linux/mips/bits/fcntl.h =================================================================== --- libc/sysdeps/linux/mips/bits/fcntl.h (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/sysdeps/linux/mips/bits/fcntl.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -209,7 +209,7 @@ #endif -#ifdef __USE_GNU +#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 @@ -232,7 +232,7 @@ __BEGIN_DECLS -#ifdef __USE_GNU +#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) Index: libc/sysdeps/linux/nios/bits/fcntl.h =================================================================== --- libc/sysdeps/linux/nios/bits/fcntl.h (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/sysdeps/linux/nios/bits/fcntl.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -185,7 +185,7 @@ #endif -#ifdef __USE_GNU +#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 @@ -208,7 +208,7 @@ __BEGIN_DECLS -#ifdef __USE_GNU +#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) Index: libc/sysdeps/linux/sparc/bits/fcntl.h =================================================================== --- libc/sysdeps/linux/sparc/bits/fcntl.h (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/sysdeps/linux/sparc/bits/fcntl.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -208,7 +208,7 @@ #endif -#ifdef __USE_GNU +#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 @@ -231,7 +231,7 @@ __BEGIN_DECLS -#ifdef __USE_GNU +#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) Index: libc/sysdeps/linux/sh/bits/fcntl.h =================================================================== --- libc/sysdeps/linux/sh/bits/fcntl.h (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/sysdeps/linux/sh/bits/fcntl.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -189,7 +189,7 @@ #endif -#ifdef __USE_GNU +#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 @@ -212,7 +212,7 @@ __BEGIN_DECLS -#ifdef __USE_GNU +#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) Index: libc/sysdeps/linux/bfin/bits/fcntl.h =================================================================== --- libc/sysdeps/linux/bfin/bits/fcntl.h (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/sysdeps/linux/bfin/bits/fcntl.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -185,7 +185,7 @@ #endif -#ifdef __USE_GNU +#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 @@ -208,7 +208,7 @@ __BEGIN_DECLS -#ifdef __USE_GNU +#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) Index: libc/misc/Makefile.in =================================================================== --- libc/misc/Makefile.in (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/misc/Makefile.in (.../branches/uClibc_0_9_30) (revision 24173) @@ -12,6 +12,7 @@ include $(top_srcdir)libc/misc/ctype/Makefile.in include $(top_srcdir)libc/misc/dirent/Makefile.in include $(top_srcdir)libc/misc/error/Makefile.in +include $(top_srcdir)libc/misc/elf/Makefile.in include $(top_srcdir)libc/misc/file/Makefile.in include $(top_srcdir)libc/misc/fnmatch/Makefile.in include $(top_srcdir)libc/misc/ftw/Makefile.in Index: libc/misc/internals/__uClibc_main.c =================================================================== --- libc/misc/internals/__uClibc_main.c (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/misc/internals/__uClibc_main.c (.../branches/uClibc_0_9_30) (revision 24173) @@ -72,6 +72,11 @@ # endif # endif +/* + * Needed to initialize _dl_phdr when statically linked + */ + +void internal_function _dl_aux_init (ElfW(auxv_t) *av); #endif /* !SHARED */ /* @@ -114,9 +119,8 @@ #endif /* - * Declare the __environ global variable and create a strong alias environ. - * Note: Apparently we must initialize __environ to ensure that the strong - * environ symbol is also included. + * Declare the __environ global variable and create a weak alias environ. + * This must be initialized; we cannot have a weak alias into bss. */ char **__environ = 0; weak_alias(__environ, environ) @@ -310,7 +314,13 @@ } aux_dat += 2; } +#ifndef SHARED + /* Get the program headers (_dl_phdr) from the aux vector + It will be used into __libc_setup_tls. */ + + _dl_aux_init (auxvt); #endif +#endif /* We need to initialize uClibc. If we are dynamically linked this * may have already been completed by the shared lib loader. We call Index: libc/misc/wchar/wchar.c =================================================================== --- libc/misc/wchar/wchar.c (.../tags/uClibc_0_9_30) (revision 24173) +++ libc/misc/wchar/wchar.c (.../branches/uClibc_0_9_30) (revision 24173) @@ -1246,7 +1246,7 @@ "\x08\xec""UCS-4\x00" /* always BE */ "\x0a\xec""UCS-4BE\x00" "\x0a\xed""UCS-4LE\x00" - "\x09\fe4""UTF-32\x00" /* platform endian with BOM */ + "\x09\xe4""UTF-32\x00" /* platform endian with BOM */ "\x0b\xe4""UTF-32BE\x00" "\x0b\xe5""UTF-32LE\x00" "\x08\xe2""UCS-2\x00" /* always BE */ Index: libc/misc/elf/Makefile.in =================================================================== --- libc/misc/elf/Makefile.in (.../tags/uClibc_0_9_30) (revision 0) +++ libc/misc/elf/Makefile.in (.../branches/uClibc_0_9_30) (revision 24173) @@ -0,0 +1,20 @@ +# Copyright (C) 2008 STMicroelectronics Ltd. +# Author: Carmelo Amoroso + +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +# + +libc_a_CSRC = dl-support.c dl-core.c dl-iterate-phdr.c +CFLAGS-dl-iterate-phdr.c=-D_GNU_SOURCE -I$(top_srcdir)ldso/ldso/$(TARGET_ARCH) -I$(top_srcdir)ldso/include +CFLAGS-dl-core.c=-I$(top_srcdir)ldso/ldso/$(TARGET_ARCH) -I$(top_srcdir)ldso/include + +MISC_ELF_OUT:=$(top_builddir)libc/misc/elf +MISC_ELF_OBJ:=$(patsubst %.c,$(MISC_ELF_OUT)/%.o,$(libc_a_CSRC)) + +libc-static-y += $(MISC_ELF_OBJ) +libc-shared-y += $(MISC_ELF_OUT)/dl-iterate-phdr.oS + +objclean-y+= misc_elf_objclean + +misc_elf_objclean: + $(RM) $(MISC_ELF_OUT)/*.{o,os,oS} Index: libc/misc/elf/dl-core.c =================================================================== --- libc/misc/elf/dl-core.c (.../tags/uClibc_0_9_30) (revision 0) +++ libc/misc/elf/dl-core.c (.../branches/uClibc_0_9_30) (revision 24173) @@ -0,0 +1,20 @@ +/* + * This contains all symbols and functions to support + * dynamic linking into static libc. + + * Copyright (c) 2008 STMicroelectronics Ltd + * Author: Carmelo Amoroso + * + * Based on draft work by Peter S. Mazinger + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + * + */ + +#ifdef SHARED +#error "This file is not suitable for linking into dynamic libc" +#else +/* Include ldso symbols and functions used into static libc */ +#include "../../../ldso/ldso/dl-symbols.c" +#endif + Index: libc/misc/elf/dl-iterate-phdr.c =================================================================== --- libc/misc/elf/dl-iterate-phdr.c (.../tags/uClibc_0_9_30) (revision 0) +++ libc/misc/elf/dl-iterate-phdr.c (.../branches/uClibc_0_9_30) (revision 24173) @@ -0,0 +1,76 @@ +/* Get loaded objects program headers. + + Based on GNU C library (file: libc/elf/dl-iteratephdr.c) + + Copyright (C) 2001,2002,2003,2004,2006,2007 Free Software Foundation, Inc. + Contributed by Jakub Jelinek , 2001. + + Copyright (C) 2008 STMicroelectronics Ltd. + Author: Carmelo Amoroso + + Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +*/ + + +#include +#include + +/* we want this in libc but nowhere else */ +#ifdef __USE_GNU + +extern __typeof(dl_iterate_phdr) __dl_iterate_phdr; + +hidden_proto(__dl_iterate_phdr) +int +__dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info, size_t size, void *data), void *data) +{ + struct elf_resolve *l; + struct dl_phdr_info info; + int ret = 0; + + for (l = _dl_loaded_modules; l != NULL; l = l->next) { + info.dlpi_addr = l->loadaddr; + info.dlpi_name = l->libname; + info.dlpi_phdr = l->ppnt; + info.dlpi_phnum = l->n_phent; + ret = callback (&info, sizeof (struct dl_phdr_info), data); + if (ret) + break; + } + return ret; +} +hidden_def (__dl_iterate_phdr) + +# ifdef SHARED + +weak_alias(__dl_iterate_phdr, dl_iterate_phdr) + +# else + +/* dl-support.c defines these and initializes them early on. */ +extern ElfW(Phdr) *_dl_phdr; +extern size_t _dl_phnum; + +int +dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info, + size_t size, void *data), void *data) +{ + if (_dl_phnum != 0) + { + /* This entry describes this statically-linked program itself. */ + struct dl_phdr_info info; + int ret; + info.dlpi_addr = 0; + info.dlpi_name = ""; + info.dlpi_phdr = _dl_phdr; + info.dlpi_phnum = _dl_phnum; + ret = (*callback) (&info, sizeof (struct dl_phdr_info), data); + if (ret) + return ret; + } + /* Then invoke callback on loaded modules, if any */ + return __dl_iterate_phdr (callback, data); +} + +# endif +#endif Index: libc/misc/elf/dl-support.c =================================================================== --- libc/misc/elf/dl-support.c (.../tags/uClibc_0_9_30) (revision 0) +++ libc/misc/elf/dl-support.c (.../branches/uClibc_0_9_30) (revision 24173) @@ -0,0 +1,29 @@ +/* + * Support for dynamic linking code in static libc. + * Copyright (C) 1996-2002, 2003, 2004, 2005 Free Software Foundation, Inc. + * + * Partially based on GNU C Library (file: libc/elf/dl-support.c) + * + * Copyright (C) 2008 STMicroelectronics Ltd. + * Author: Carmelo Amoroso + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + * + */ + +#include +#include + +ElfW(Phdr) *_dl_phdr; +size_t _dl_phnum; + +void +internal_function +_dl_aux_init (ElfW(auxv_t) *av) +{ + /* Get the program headers base address from the aux vect */ + _dl_phdr = (ElfW(Phdr) *) av[AT_PHDR].a_un.a_val; + + /* Get the number of program headers from the aux vect */ + _dl_phnum = (size_t) av[AT_PHNUM].a_un.a_val; +} Index: libc/misc/elf/Makefile =================================================================== --- libc/misc/elf/Makefile (.../tags/uClibc_0_9_30) (revision 0) +++ libc/misc/elf/Makefile (.../branches/uClibc_0_9_30) (revision 24173) @@ -0,0 +1,12 @@ +# Copyright (C) 2008 STMicroelectronics Ltd. +# Author: Carmelo Amoroso + +# 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.in +include $(top_srcdir)Makerules Index: libpthread/linuxthreads.old/sysdeps/mips/pt-machine.h =================================================================== --- libpthread/linuxthreads.old/sysdeps/mips/pt-machine.h (.../tags/uClibc_0_9_30) (revision 24173) +++ libpthread/linuxthreads.old/sysdeps/mips/pt-machine.h (.../branches/uClibc_0_9_30) (revision 24173) @@ -25,40 +25,13 @@ #define _PT_MACHINE_H 1 #include +#include +#include #ifndef PT_EI # define PT_EI __extern_always_inline #endif -/* Copyright (C) 2000, 2002 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Maciej W. Rozycki , 2000. */ -static __inline__ int -__NTH (_test_and_set (int *p, int v)) -{ - int r, t; - - __asm__ __volatile__ - ("/* Inline test and set */\n" - "1:\n\t" - ".set push\n\t" - ".set mips2\n\t" - "ll %0,%3\n\t" - "move %1,%4\n\t" - "beq %0,%4,2f\n\t" - "sc %1,%2\n\t" - ".set pop\n\t" - "beqz %1,1b\n" - "2:\n\t" - "/* End test and set */" - : "=&r" (r), "=&r" (t), "=m" (*p) - : "m" (*p), "r" (v) - : "memory"); - - return r; -} - - /* Spinlock implementation; required. */ PT_EI long int @@ -86,12 +59,22 @@ ("/* Inline compare & swap */\n" "1:\n\t" ".set push\n\t" +#if _MIPS_SIM == _ABIO32 ".set mips2\n\t" +#endif +#if _MIPS_SIM == _ABI64 + "lld %1,%5\n\t" +#else "ll %1,%5\n\t" +#endif "move %0,$0\n\t" "bne %1,%3,2f\n\t" "move %0,%4\n\t" +#if _MIPS_SIM == _ABI64 + "scd %0,%2\n\t" +#else "sc %0,%2\n\t" +#endif ".set pop\n\t" "beqz %0,1b\n" "2:\n\t"