summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author"Steven J. Hill" <sjhill@realitydiluted.com>2005-07-30 02:56:45 +0000
committer"Steven J. Hill" <sjhill@realitydiluted.com>2005-07-30 02:56:45 +0000
commitceec7a232c0719f1e36e60e8f2f7edb2af9d79c9 (patch)
tree074610a301f84733094d33cddca78eb23e8c1306
parent92ac94812b84cef7d9bddfffd0446721a7a6ee06 (diff)
downloaduClibc-alpine-ceec7a232c0719f1e36e60e8f2f7edb2af9d79c9.tar.bz2
uClibc-alpine-ceec7a232c0719f1e36e60e8f2f7edb2af9d79c9.tar.xz
Last of the merges along with latest changes for NPTL. Nothing much
new on the NPTL stuff other than cleaning a few things up.
-rw-r--r--Makefile44
-rw-r--r--Rules.mak85
-rw-r--r--extra/Configs/Config.in50
-rw-r--r--include/features.h8
-rw-r--r--include/string.h210
-rw-r--r--include/unistd.h4
-rw-r--r--ldso/Makefile3
-rw-r--r--ldso/include/ldso.h20
-rw-r--r--ldso/ldso/Makefile12
-rw-r--r--libc/Makefile17
-rw-r--r--libc/inet/resolv.c1
-rw-r--r--libc/sysdeps/linux/common/bits/siginfo.h29
-rw-r--r--libc/sysdeps/linux/mips/Makefile23
-rw-r--r--libc/sysdeps/linux/mips/bits/siginfo.h29
-rw-r--r--libc/sysdeps/linux/mips/sgidefs.h45
-rw-r--r--libc/sysdeps/linux/mips/sys/asm.h29
-rw-r--r--libc/sysdeps/linux/mips/sys/regdef.h8
-rw-r--r--libc/sysdeps/linux/mips/sysdep.h640
-rw-r--r--libpthread/Makefile34
-rw-r--r--libpthread/linuxthreads/Makefile2
-rw-r--r--libpthread/linuxthreads_db/Makefile7
21 files changed, 506 insertions, 794 deletions
diff --git a/Makefile b/Makefile
index 33459d888..85496113c 100644
--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,7 @@ noconfig_targets := menuconfig config oldconfig randconfig \
defconfig allyesconfig allnoconfig clean distclean \
release tags TAGS
TOPDIR=./
--include Rules.mak
+include Rules.mak
DIRS = ldso libc libcrypt libresolv libnsl libutil libm libpthread librt
ifeq ($(strip $(UCLIBC_HAS_GETTEXT_AWARENESS)),y)
@@ -42,9 +42,9 @@ all: headers pregen subdirs shared finished
shared: subdirs
ifeq ($(strip $(HAVE_SHARED)),y)
- @echo
- @echo Building shared libraries ...
- @echo
+ $(SECHO)
+ $(SECHO) Building shared libraries ...
+ $(SECHO)
@$(MAKE) -C libc shared
@$(MAKE) -C ldso shared
@$(MAKE) -C libcrypt shared
@@ -58,15 +58,15 @@ ifeq ($(strip $(UCLIBC_HAS_GETTEXT_AWARENESS)),y)
@$(MAKE) -C libintl shared
endif
else
- @echo
- @echo Not building shared libraries ...
- @echo
+ $(SECHO)
+ $(SECHO) Not building shared libraries ...
+ $(SECHO)
endif
finished: shared
- @echo
- @echo Finally finished compiling ...
- @echo
+ $(SECHO)
+ $(SECHO) Finally finished compiling ...
+ $(SECHO)
include/bits/uClibc_config.h: .config
@if [ ! -x ./extra/config/conf ] ; then \
@@ -81,12 +81,16 @@ include/bits/uClibc_config.h: .config
# in order to generate the headers correctly :(. That
# means we can't use the $(HOSTCC) in order to get the
# correct output.
-headers: include/bits/uClibc_config.h
ifeq ($(strip $(ARCH_HAS_MMU)),y)
- @set -x; ./extra/scripts/fix_includes.sh -k $(KERNEL_SOURCE) -t $(TARGET_ARCH)
+export header_extra_args =
else
- @set -x; ./extra/scripts/fix_includes.sh -k $(KERNEL_SOURCE) -t $(TARGET_ARCH) -n
+export header_extra_args = -n
endif
+headers: include/bits/uClibc_config.h
+ @$(SHELL_SET_X); \
+ ./extra/scripts/fix_includes.sh \
+ -k $(KERNEL_SOURCE) -t $(TARGET_ARCH) \
+ $(header_extra_args)
@cd include/bits; \
set -e; \
for i in `ls ../../libc/sysdeps/linux/common/bits/*.h` ; do \
@@ -108,7 +112,8 @@ endif
done; \
fi
@cd $(TOPDIR); \
- set -x -e; \
+ set -e; \
+ $(SHELL_SET_X); \
TOPDIR=. CC="$(CC)" /bin/sh extra/scripts/gen_bits_syscall_h.sh > include/bits/sysnum.h.new; \
if cmp include/bits/sysnum.h include/bits/sysnum.h.new >/dev/null 2>&1; then \
$(RM) include/bits/sysnum.h.new; \
@@ -169,7 +174,7 @@ install_dev:
$(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib
$(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include
-$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/
- tar -chf - include | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX);
+ tar -chf - include | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX)
ifneq ($(strip $(UCLIBC_HAS_FLOATS)),y)
# Remove floating point related headers since float support is disabled.
$(RM) $(PREFIX)$(DEVEL_PREFIX)include/complex.h
@@ -260,7 +265,8 @@ ifeq ($(strip $(HAVE_SHARED)),y)
$(PREFIX)$(RUNTIME_PREFIX)lib
cp -dRf lib/*.so.* $(PREFIX)$(RUNTIME_PREFIX)lib
@if [ -x lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so ] ; then \
- set -x -e; \
+ set -e; \
+ $(SHELL_SET_X); \
$(INSTALL) -m 755 lib/ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \
$(PREFIX)$(RUNTIME_PREFIX)lib; \
fi;
@@ -284,9 +290,9 @@ install_utils: utils
#endif
finished2:
- @echo
- @echo Finished installing ...
- @echo
+ $(SECHO)
+ $(SECHO) Finished installing ...
+ $(SECHO)
else # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
diff --git a/Rules.mak b/Rules.mak
index 4dd47bd65..94c7a7a78 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -89,8 +89,23 @@ CROSS=$(subst ",, $(strip $(CROSS_COMPILER_PREFIX)))
endif
# A nifty macro to make testing gcc features easier
-check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
+check_gcc=$(shell \
+ if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
then echo "$(1)"; else echo "$(2)"; fi)
+check_as=$(shell \
+ if $(CC) -Wa,$(1) -Wa,-Z -c -o /dev/null -xassembler /dev/null > /dev/null 2>&1; \
+ then echo "-Wa,$(1)"; fi)
+
+# Setup some shortcuts so that silent mode is silent like it should be
+ifeq ($(subst s,,$(MAKEFLAGS)),$(MAKEFLAGS))
+export MAKE_IS_SILENT=n
+SECHO=@echo
+SHELL_SET_X=set -x
+else
+export MAKE_IS_SILENT=y
+SECHO=-@false
+SHELL_SET_X=set +x
+endif
# Make certain these contain a final "/", but no "//"s.
TARGET_ARCH:=$(shell grep -s ^TARGET_ARCH $(TOPDIR)/.config | sed -e 's/^TARGET_ARCH=//' -e 's/"//g')
@@ -98,15 +113,11 @@ RUNTIME_PREFIX:=$(strip $(subst //,/, $(subst ,/, $(subst ",, $(strip $(RUNTIME_
DEVEL_PREFIX:=$(strip $(subst //,/, $(subst ,/, $(subst ",, $(strip $(DEVEL_PREFIX))))))
export RUNTIME_PREFIX DEVEL_PREFIX
-ARFLAGS:=r
+ARFLAGS:=cr
OPTIMIZATION:=
PICFLAG:=-fPIC
-
-PIEFLAG:=$(call check_gcc,-fPIE,)
-ifeq ($(strip $(PIEFLAG)),-fPIE)
-LDPIEFLAG:=$(shell $(LD) --help | grep -q pie && echo "-Wl,-pie")
-endif
+PIEFLAG_NAME:=-fPIE
# Some nice CPU specific optimizations
ifeq ($(strip $(TARGET_ARCH)),i386)
@@ -142,7 +153,7 @@ ifeq ($(strip $(TARGET_ARCH)),arm)
CPU_CFLAGS-$(CONFIG_ARM720T)+=-mtune=arm7tdmi -march=armv4
CPU_CFLAGS-$(CONFIG_ARM920T)+=-mtune=arm9tdmi -march=armv4
CPU_CFLAGS-$(CONFIG_ARM922T)+=-mtune=arm9tdmi -march=armv4
- CPU_CFLAGS-$(CONFIG_ARM926T)+=-mtune=arm9tdmi -march=armv4
+ CPU_CFLAGS-$(CONFIG_ARM926T)+=-mtune=arm9tdmi -march=armv5
CPU_CFLAGS-$(CONFIG_ARM1136JF_S)+=-mtune=arm1136jf-s -march=armv6
CPU_CFLAGS-$(CONFIG_ARM_SA110)+=-mtune=strongarm110 -march=armv4
CPU_CFLAGS-$(CONFIG_ARM_SA1100)+=-mtune=strongarm1100 -march=armv4
@@ -197,7 +208,7 @@ ifeq ($(strip $(TARGET_ARCH)),cris)
CPU_LDFLAGS-$(CONFIG_CRIS)+=-mcrislinux
CPU_CFLAGS-$(CONFIG_CRIS)+=-mlinux
PICFLAG:=-fpic
- PIEFLAG:=$(call check_gcc,-fpie,)
+ PIEFLAG_NAME:=-fpie
endif
ifeq ($(strip $(TARGET_ARCH)),powerpc)
@@ -205,28 +216,29 @@ ifeq ($(strip $(TARGET_ARCH)),powerpc)
# enough. Therefore use -fpic which will reduce code size and generates
# faster code.
PICFLAG:=-fpic
- PIEFLAG:=$(call check_gcc,-fpie,)
+ PIEFLAG_NAME:=-fpie
endif
ifeq ($(strip $(TARGET_ARCH)),frv)
CPU_LDFLAGS-$(CONFIG_FRV)+=-melf32frvfd
CPU_CFLAGS-$(CONFIG_FRV)+=-mfdpic
- PICFLAG=-fPIC -DPIC
- # Using -pie causes the program to have an interpreter, which is
- # forbidden, so we must make do with -shared. Unfortunately,
- # -shared by itself would get us global function descriptors
- # and calls through PLTs, dynamic resolution of symbols, etc,
- # which would break as well, but -Bsymbolic comes to the rescue.
- LDPIEFLAG=-shared -Bsymbolic
UCLIBC_LDSO=ld.so.1
endif
+# Keep the check_gcc from being needlessly executed
+ifndef PIEFLAG
+ifneq ($(UCLIBC_BUILD_PIE),y)
+export PIEFLAG:=
+else
+export PIEFLAG:=$(call check_gcc,$(PIEFLAG_NAME),)
+endif
+endif
+
# Use '-Os' optimization if available, else use -O2, allow Config to override
OPTIMIZATION+=$(call check_gcc,-Os,-O2)
# Use the gcc 3.4 -funit-at-a-time optimization when available
OPTIMIZATION+=$(call check_gcc,-funit-at-a-time,)
-
# Add a bunch of extra pedantic annoyingly strict checks
XWARNINGS=$(subst ",, $(strip $(WARNINGS))) -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
XARCH_CFLAGS=$(subst ",, $(strip $(ARCH_CFLAGS)))
@@ -246,32 +258,28 @@ ifeq ($(strip $(TARGET_ARCH)),arm)
endif
endif
-ifneq ($(UCLIBC_BUILD_PIE),y)
-PIEFLAG=
-LDPIEFLAG=
-endif
-
-SSP_DISABLE_FLAGS=$(call check_gcc,-fno-stack-protector,)
+SSP_DISABLE_FLAGS:=$(call check_gcc,-fno-stack-protector,)
ifeq ($(UCLIBC_BUILD_SSP),y)
-SSP_CFLAGS=$(call check_gcc,-fno-stack-protector-all,)
+SSP_CFLAGS:=$(call check_gcc,-fno-stack-protector-all,)
SSP_CFLAGS+=$(call check_gcc,-fstack-protector,)
-SSP_ALL_CFLAGS=$(call check_gcc,-fstack-protector-all,)
+SSP_ALL_CFLAGS:=$(call check_gcc,-fstack-protector-all,)
else
-SSP_CFLAGS=$(SSP_DISABLE_FLAGS)
+SSP_CFLAGS:=$(SSP_DISABLE_FLAGS)
endif
# Some nice CFLAGS to work with
-CFLAGS=$(XWARNINGS) $(OPTIMIZATION) $(XARCH_CFLAGS) $(CPU_CFLAGS) $(SSP_CFLAGS) \
+CFLAGS:=$(XWARNINGS) $(CPU_CFLAGS) $(SSP_CFLAGS) \
-fno-builtin -nostdinc -D_LIBC -I$(TOPDIR)include -I.
+LDFLAGS_NOSTRIP:=$(CPU_LDFLAGS-y) -shared --warn-common --warn-once -z combreloc -z defs
ifeq ($(DODEBUG),y)
#CFLAGS += -g3
- CFLAGS = $(XWARNINGS) -O0 -g3 $(CPU_CFLAGS) $(SSP_CFLAGS) \
- -fno-builtin -nostdinc -D_LIBC -I$(TOPDIR)include -I.
- LDFLAGS:= $(CPU_LDFLAGS-y) -shared --warn-common --warn-once -z combreloc
+ CFLAGS += -O0 -g3
+ LDFLAGS := $(LDFLAGS_NOSTRIP)
STRIPTOOL:= true -Since_we_are_debugging
else
- LDFLAGS := $(CPU_LDFLAGS-y) -s -shared --warn-common --warn-once -z combreloc
+ CFLAGS += $(OPTIMIZATION) $(XARCH_CFLAGS)
+ LDFLAGS := $(LDFLAGS_NOSTRIP) -s
endif
#
@@ -325,11 +333,20 @@ ifeq ($(DOPIC),y)
CFLAGS += $(PICFLAG)
endif
+ifeq ($(DL_FINI_CRT_COMPAT),y)
+CFLAGS += -D_DL_FINI_CRT_COMPAT
+endif
+
+# Keep the check_as from being needlessly executed
ASFLAGS = $(CFLAGS)
+ifndef ASFLAGS_NOEXEC
ifeq ($(UCLIBC_BUILD_NOEXECSTACK),y)
-check_as_noexecstack=$(shell if $(LD) --help | grep -q "z noexecstack"; then echo "-Wa,--noexecstack"; fi)
-ASFLAGS += $(check_as_noexecstack)
+export ASFLAGS_NOEXEC := $(call check_as,--noexecstack)
+else
+export ASFLAGS_NOEXEC :=
+endif
endif
+ASFLAGS += $(ASFLAGS_NOEXEC)
LIBGCC_CFLAGS ?= $(CFLAGS) $(CPU_CFLAGS-y)
LIBGCC:=$(shell $(CC) $(LIBGCC_CFLAGS) -print-libgcc-file-name)
diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in
index e71eeb296..cac37b058 100644
--- a/extra/Configs/Config.in
+++ b/extra/Configs/Config.in
@@ -249,7 +249,7 @@ config LDSO_PRELOAD_FILE_SUPPORT
config LDSO_BASE_FILENAME
string "Shared library loader naming prefix"
- depends on LDSO_CACHE_SUPPORT || LDSO_PRELOAD_FILE_SUPPORT
+ depends on BUILD_UCLIBC_LDSO && (LDSO_CACHE_SUPPORT || LDSO_PRELOAD_FILE_SUPPORT)
default "ld.so"
help
If you wish to support both uClibc and glibc on the same system, it
@@ -264,6 +264,26 @@ config LDSO_BASE_FILENAME
WARNING: Changing the default prefix could cause problems with
binutils' ld !
+config LDSO_RUNPATH
+ bool "Enable ELF RUNPATH tag support"
+ depends on BUILD_UCLIBC_LDSO
+ default y
+ help
+ ELF's may have dynamic RPATH/RUNPATH tags. These tags list paths
+ which extend the library search paths. They are really only useful
+ if a package installs libraries in non standard locations and
+ ld.so.conf support is disabled.
+
+ Usage of RUNPATH tags is not too common, so disabling this feature
+ should be safe for most people.
+
+config DL_FINI_CRT_COMPAT
+ bool "uClibc 0.9.27 compatibility"
+ default n
+ help
+ Allows to update a 0.9.27 based system to new crt/fini handling.
+ After rebuilding all apps, this option can be disabled.
+
config UCLIBC_CTOR_DTOR
bool "Support global constructors and destructors"
default y
@@ -787,10 +807,11 @@ config UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS
config UCLIBC_HAS_SCANF_GLIBC_A_FLAG
- bool "Support glibc's 'a' flag for scanf string conversions"
+ bool "Support glibc's 'a' flag for scanf string conversions (not implemented)"
default n
help
NOTE!!! Currently Not Implemented!!! Just A Place Holder!! NOTE!!!
+ NOTE!!! Conflicts with an ANSI/ISO C99 scanf flag!! NOTE!!!
Answer Y to enable support for glibc's 'a' flag for the scanf string
conversions '%s', '%[', '%ls', '%l[', and '%S'. This is used to
@@ -863,6 +884,16 @@ config UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8
endchoice
+config UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT
+ bool "Attemt to shutdown stdio subsystem when abort() is called."
+ default n
+ help
+ ANSI/ISO C99 requires abort() to be asyn-signal-safe. So there was a behavioral
+ change made in SUSv3. Previously, abort() was required to have the affect of
+ fclose() on all open streams. The wording has been changed to "may" from "shall".
+
+ Most people will answer N.
+
config UCLIBC_HAS_STDIO_GETC_MACRO
bool "Provide a macro version of getc()"
depends !UCLIBC_HAS_STDIO_BUFSIZ_NONE
@@ -1142,12 +1173,12 @@ config UCLIBC_BUILD_PIE
bool "Build utilities as ET_DYN/PIE executables"
depends on UCLIBC_SECURITY
depends on HAVE_SHARED
- depends on TARGET_i386 || TARGET_powerpc || TARGET_mips || TARGET_frv
+ depends on TARGET_arm || TARGET_frv || TARGET_i386 || TARGET_mips || TARGET_powerpc
select FORCE_SHAREABLE_TEXT_SEGMENTS if BUILD_UCLIBC_LDSO
default y
help
If you answer Y here, ldd and iconv are built as ET_DYN/PIE executables.
- It requires gcc-3.4 and binutils-2.15 or later.
+ It requires gcc-3.4 and binutils-2.15 (for arm 2.16) or later.
More about ET_DYN/PIE binaries on <http://pax.grsecurity.net/> .
WARNING: This option also enables FORCE_SHAREABLE_TEXT_SEGMENTS, so all
libraries have to be built with -fPIC or -fpic, and all assembler
@@ -1263,6 +1294,7 @@ config CROSS_COMPILER_PREFIX
config DODEBUG
bool "Build uClibc with debugging symbols"
+ select PTHREADS_DEBUG_SUPPORT if UCLIBC_HAS_THREADS
default n
help
Say Y here if you wish to compile uClibc with debugging symbols.
@@ -1273,6 +1305,16 @@ config DODEBUG
Otherwise, answer N.
+config DODEBUG_PT
+ bool "Build pthread with debugging output"
+ depends on UCLIBC_HAS_THREADS
+ default n
+ help
+ Enable debug output in libpthread. This is only useful when doing
+ development in libpthread itself.
+
+ Otherwise, answer N.
+
config DOASSERTS
bool "Build uClibc with run-time assertion testing"
default n
diff --git a/include/features.h b/include/features.h
index 339a320ba..5189c9d7d 100644
--- a/include/features.h
+++ b/include/features.h
@@ -367,7 +367,7 @@ uClibc was built without large file support enabled.
/* Some nice features only work properly with ELF */
#if defined _LIBC
-# if defined __HAVE_ELF__
+#if defined __HAVE_ELF__
/* Define ALIASNAME as a weak alias for NAME. */
# define weak_alias(name, aliasname) _weak_alias (name, aliasname)
# define _weak_alias(name, aliasname) \
@@ -389,8 +389,8 @@ uClibc was built without large file support enabled.
asm (".section " ".gnu.warning." #symbol "\n\t.previous"); \
static const char __evoke_link_warning_##symbol[] \
__attribute__ ((unused, section (".gnu.warning." #symbol "\n\t#"))) = msg;
-# endif
-# else /* !defined __HAVE_ELF__ */
+#endif
+#else /* !defined __HAVE_ELF__ */
# define strong_alias(name, aliasname) _strong_alias (name, aliasname)
# define weak_alias(name, aliasname) _strong_alias (name, aliasname)
# define _strong_alias(name, aliasname) \
@@ -399,7 +399,7 @@ uClibc was built without large file support enabled.
# define link_warning(symbol, msg) \
asm (".stabs \"" msg "\",30,0,0,0\n\t" \
".stabs \"" #symbol "\",1,0,0,0\n");
-# endif
+#endif
#ifndef weak_function
/* If we do not have the __attribute__ ((weak)) syntax, there is no way we
diff --git a/include/string.h b/include/string.h
index 35e98a805..224bb8621 100644
--- a/include/string.h
+++ b/include/string.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1993, 1995-2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1993, 1995-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
@@ -36,11 +36,12 @@ __BEGIN_DECLS
__BEGIN_NAMESPACE_STD
/* Copy N bytes of SRC to DEST. */
extern void *memcpy (void *__restrict __dest,
- __const void *__restrict __src, size_t __n) __THROW;
+ __const void *__restrict __src, size_t __n)
+ __THROW __nonnull ((1, 2));
/* Copy N bytes of SRC to DEST, guaranteeing
correct behavior for overlapping strings. */
extern void *memmove (void *__dest, __const void *__src, size_t __n)
- __THROW;
+ __THROW __nonnull ((1, 2));
__END_NAMESPACE_STD
/* Copy no more than N bytes of SRC to DEST, stopping when C is found.
@@ -49,62 +50,65 @@ __END_NAMESPACE_STD
#if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN
extern void *memccpy (void *__restrict __dest, __const void *__restrict __src,
int __c, size_t __n)
- __THROW;
+ __THROW __nonnull ((1, 2));
#endif /* SVID. */
__BEGIN_NAMESPACE_STD
/* Set N bytes of S to C. */
-extern void *memset (void *__s, int __c, size_t __n) __THROW;
+extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
/* Compare N bytes of S1 and S2. */
extern int memcmp (__const void *__s1, __const void *__s2, size_t __n)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1, 2));
/* Search N bytes of S for C. */
extern void *memchr (__const void *__s, int __c, size_t __n)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1));
__END_NAMESPACE_STD
#ifdef __USE_GNU
/* Search in S for C. This is similar to `memchr' but there is no
length limit. */
-extern void *rawmemchr (__const void *__s, int __c) __THROW __attribute_pure__;
+extern void *rawmemchr (__const void *__s, int __c)
+ __THROW __attribute_pure__ __nonnull ((1));
/* Search N bytes of S for the final occurrence of C. */
extern void *memrchr (__const void *__s, int __c, size_t __n)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1));
#endif
__BEGIN_NAMESPACE_STD
/* Copy SRC to DEST. */
extern char *strcpy (char *__restrict __dest, __const char *__restrict __src)
- __THROW;
+ __THROW __nonnull ((1, 2));
/* Copy no more than N characters of SRC to DEST. */
extern char *strncpy (char *__restrict __dest,
- __const char *__restrict __src, size_t __n) __THROW;
+ __const char *__restrict __src, size_t __n)
+ __THROW __nonnull ((1, 2));
/* Append SRC onto DEST. */
extern char *strcat (char *__restrict __dest, __const char *__restrict __src)
- __THROW;
+ __THROW __nonnull ((1, 2));
/* Append no more than N characters from SRC onto DEST. */
extern char *strncat (char *__restrict __dest, __const char *__restrict __src,
- size_t __n) __THROW;
+ size_t __n) __THROW __nonnull ((1, 2));
/* Compare S1 and S2. */
extern int strcmp (__const char *__s1, __const char *__s2)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1, 2));
/* Compare N characters of S1 and S2. */
extern int strncmp (__const char *__s1, __const char *__s2, size_t __n)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1, 2));
/* Compare the collated forms of S1 and S2. */
extern int strcoll (__const char *__s1, __const char *__s2)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1, 2));
/* Put a transformation of SRC into no more than N bytes of DEST. */
extern size_t strxfrm (char *__restrict __dest,
- __const char *__restrict __src, size_t __n) __THROW;
+ __const char *__restrict __src, size_t __n)
+ __THROW __nonnull ((2));
__END_NAMESPACE_STD
#ifdef __UCLIBC_HAS_XLOCALE__
@@ -116,22 +120,23 @@ __END_NAMESPACE_STD
/* Compare the collated forms of S1 and S2 using rules from L. */
extern int strcoll_l (__const char *__s1, __const char *__s2, __locale_t __l)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1, 2, 3));
extern int __strcoll_l (__const char *__s1, __const char *__s2, __locale_t __l)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1, 2, 3));
/* Put a transformation of SRC into no more than N bytes of DEST. */
extern size_t strxfrm_l (char *__dest, __const char *__src, size_t __n,
- __locale_t __l) __THROW;
+ __locale_t __l) __THROW __nonnull ((2, 4));
extern size_t __strxfrm_l (char *__dest, __const char *__src, size_t __n,
- __locale_t __l) __THROW;
+ __locale_t __l) __THROW __nonnull ((2, 4));
#endif
-#endif
+#endif /* __UCLIBC_HAS_XLOCALE__ */
#if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
/* Duplicate S, returning an identical malloc'd string. */
-extern char *strdup (__const char *__s) __THROW __attribute_malloc__;
+extern char *strdup (__const char *__s)
+ __THROW __attribute_malloc__ __nonnull ((1));
#endif
/* Return a malloc'd copy of at most N bytes of STRING. The
@@ -139,7 +144,7 @@ extern char *strdup (__const char *__s) __THROW __attribute_malloc__;
appears before STRING[N]. */
#if defined __USE_GNU
extern char *strndup (__const char *__string, size_t __n)
- __THROW __attribute_malloc__;
+ __THROW __attribute_malloc__ __nonnull ((1));
#endif
#if defined __USE_GNU && defined __GNUC__
@@ -167,53 +172,58 @@ extern char *strndup (__const char *__string, size_t __n)
__BEGIN_NAMESPACE_STD
/* Find the first occurrence of C in S. */
-extern char *strchr (__const char *__s, int __c) __THROW __attribute_pure__;
+extern char *strchr (__const char *__s, int __c)
+ __THROW __attribute_pure__ __nonnull ((1));
/* Find the last occurrence of C in S. */
-extern char *strrchr (__const char *__s, int __c) __THROW __attribute_pure__;
+extern char *strrchr (__const char *__s, int __c)
+ __THROW __attribute_pure__ __nonnull ((1));
__END_NAMESPACE_STD
#ifdef __USE_GNU
/* This function is similar to `strchr'. But it returns a pointer to
the closing NUL byte in case C is not found in S. */
-extern char *strchrnul (__const char *__s, int __c) __THROW __attribute_pure__;
+extern char *strchrnul (__const char *__s, int __c)
+ __THROW __attribute_pure__ __nonnull ((1));
#endif
__BEGIN_NAMESPACE_STD
/* Return the length of the initial segment of S which
consists entirely of characters not in REJECT. */
extern size_t strcspn (__const char *__s, __const char *__reject)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1, 2));
/* Return the length of the initial segment of S which
consists entirely of characters in ACCEPT. */
extern size_t strspn (__const char *__s, __const char *__accept)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1, 2));
/* Find the first occurrence in S of any character in ACCEPT. */
extern char *strpbrk (__const char *__s, __const char *__accept)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1, 2));
/* Find the first occurrence of NEEDLE in HAYSTACK. */
extern char *strstr (__const char *__haystack, __const char *__needle)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1, 2));
/* Divide S into tokens separated by characters in DELIM. */
extern char *strtok (char *__restrict __s, __const char *__restrict __delim)
- __THROW;
+ __THROW __nonnull ((2));
__END_NAMESPACE_STD
/* Divide S into tokens separated by characters in DELIM. Information
passed between calls are stored in SAVE_PTR. */
extern char *__strtok_r (char *__restrict __s,
__const char *__restrict __delim,
- char **__restrict __save_ptr) __THROW;
+ char **__restrict __save_ptr)
+ __THROW __nonnull ((2, 3));
#if defined __USE_POSIX || defined __USE_MISC
extern char *strtok_r (char *__restrict __s, __const char *__restrict __delim,
- char **__restrict __save_ptr) __THROW;
+ char **__restrict __save_ptr)
+ __THROW __nonnull ((2, 3));
#endif
#ifdef __USE_GNU
/* Similar to `strstr' but this function ignores the case of both strings. */
extern char *strcasestr (__const char *__haystack, __const char *__needle)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1, 2));
#endif
#ifdef __USE_GNU
@@ -222,27 +232,30 @@ extern char *strcasestr (__const char *__haystack, __const char *__needle)
HAYSTACK is HAYSTACKLEN bytes long. */
extern void *memmem (__const void *__haystack, size_t __haystacklen,
__const void *__needle, size_t __needlelen)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1, 3));
/* Copy N bytes of SRC to DEST, return pointer to bytes after the
last written byte. */
extern void *__mempcpy (void *__restrict __dest,
- __const void *__restrict __src, size_t __n) __THROW;
+ __const void *__restrict __src, size_t __n)
+ __THROW __nonnull ((1, 2));
extern void *mempcpy (void *__restrict __dest,
- __const void *__restrict __src, size_t __n) __THROW;
+ __const void *__restrict __src, size_t __n)
+ __THROW __nonnull ((1, 2));
#endif
__BEGIN_NAMESPACE_STD
/* Return the length of S. */
-extern size_t strlen (__const char *__s) __THROW __attribute_pure__;
+extern size_t strlen (__const char *__s)
+ __THROW __attribute_pure__ __nonnull ((1));
__END_NAMESPACE_STD
#ifdef __USE_GNU
/* Find the length of STRING, but scan at most MAXLEN characters.
If no '\0' terminator is found in that many characters, return MAXLEN. */
extern size_t strnlen (__const char *__string, size_t __maxlen)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1));
#endif
@@ -250,55 +263,66 @@ __BEGIN_NAMESPACE_STD
/* Return a string describing the meaning of the `errno' code in ERRNUM. */
extern char *strerror (int __errnum) __THROW;
__END_NAMESPACE_STD
+
+extern char *__glibc_strerror_r (int __errnum, char *__buf, size_t __buflen)
+ __THROW __nonnull ((2));
+extern int __xpg_strerror_r (int __errnum, char *__buf, size_t __buflen)
+ __THROW __nonnull ((2));
+
#if defined __USE_XOPEN2K || defined __USE_MISC
-/* Reentrant version of `strerror'. If a temporary buffer is required, at
- most BUFLEN bytes of BUF will be used. */
-/* extern char *strerror_r (int __errnum, char *__buf, size_t __buflen) __THROW; */
-
-/* uClibc Note: glibc's strerror_r is different from that specified in SUSv3.
- * So we try to compensate based on feature macros. */
-extern char *_glibc_strerror_r (int __errnum, char *__buf, size_t __buflen) __THROW;
-extern int _susv3_strerror_r (int __errnum, char *__buf, size_t buflen) __THROW;
-
-#if defined(__USE_XOPEN2K) && !defined(__USE_GNU)
-# ifdef __REDIRECT
-extern int __REDIRECT (strerror_r,
- (int __errnum, char *__buf, size_t buflen) __THROW,
- _susv3_strerror_r);
-# else
-# define strerror_r _susv3_strerror_r
-# endif
-#else /* defined(__USE_XOPEN2K) && !defined(__USE_GNU) */
-# ifdef __REDIRECT
-extern char *__REDIRECT (strerror_r,
- (int __errnum, char *__buf, size_t buflen) __THROW,
- _glibc_strerror_r);
+/* Reentrant version of `strerror'.
+ There are 2 flavors of `strerror_r', GNU which returns the string
+ and may or may not use the supplied temporary buffer and POSIX one
+ which fills the string into the buffer.
+ To use the POSIX version, -D_XOPEN_SOURCE=600 or -D_POSIX_C_SOURCE=200112L
+ without -D_GNU_SOURCE is needed, otherwise the GNU version is
+ preferred. */
+# if defined __USE_XOPEN2K && !defined __USE_GNU
+/* Fill BUF with a string describing the meaning of the `errno' code in
+ ERRNUM. */
+# ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH (strerror_r,
+ (int __errnum, char *__buf, size_t __buflen),
+ __xpg_strerror_r) __nonnull ((2));
+# else
+# define strerror_r __xpg_strerror_r
+# endif
# else
-# define strerror_r _glibc_strerror_r
+/* If a temporary buffer is required, at most BUFLEN bytes of BUF will be
+ used. */
+# ifdef __REDIRECT_NTH
+extern char * __REDIRECT_NTH (strerror_r,
+ (int __errnum, char *__buf, size_t __buflen),
+ __glibc_strerror_r) __nonnull ((2));
+# else
+# define strerror_r __glibc_strerror_r
+# endif
# endif
-#endif /* defined(__USE_XOPEN2K) && !defined(__USE_GNU) */
#endif
/* We define this function always since `bzero' is sometimes needed when
the namespace rules does not allow this. */
-extern void __bzero (void *__s, size_t __n) __THROW;
+extern void __bzero (void *__s, size_t __n) __THROW __nonnull ((1));
#ifdef __USE_BSD
/* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
-extern void bcopy (__const void *__src, void *__dest, size_t __n) __THROW;
+extern void bcopy (__const void *__src, void *__dest, size_t __n)
+ __THROW __nonnull ((1, 2));
/* Set N bytes of S to 0. */
-extern void bzero (void *__s, size_t __n) __THROW;
+extern void bzero (void *__s, size_t __n) __THROW __nonnull ((1));
/* Compare N bytes of S1 and S2 (same as memcmp). */
extern int bcmp (__const void *__s1, __const void *__s2, size_t __n)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1, 2));
/* Find the first occurrence of C in S (same as strchr). */
-extern char *index (__const char *__s, int __c) __THROW __attribute_pure__;
+extern char *index (__const char *__s, int __c)
+ __THROW __attribute_pure__ __nonnull ((1));
/* Find the last occurrence of C in S (same as strrchr). */
-extern char *rindex (__const char *__s, int __c) __THROW __attribute_pure__;
+extern char *rindex (__const char *__s, int __c)
+ __THROW __attribute_pure__ __nonnull ((1));
/* 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. */
@@ -316,11 +340,11 @@ __extension__ extern int ffsll (long long int __ll)
/* Compare S1 and S2, ignoring case. */
extern int strcasecmp (__const char *__s1, __const char *__s2)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1, 2));
/* Compare no more than N chars of S1 and S2, ignoring case. */
extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1, 2));
#endif /* Use BSD. */
#ifdef __UCLIBC_HAS_XLOCALE__
@@ -328,50 +352,66 @@ extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n)
/* Again versions of a few functions which use the given locale instead
of the global one. */
extern int strcasecmp_l (__const char *__s1, __const char *__s2,
- __locale_t __loc) __THROW __attribute_pure__;
+ __locale_t __loc)
+ __THROW __attribute_pure__ __nonnull ((1, 2, 3));
extern int __strcasecmp_l (__const char *__s1, __const char *__s2,
- __locale_t __loc) __THROW __attribute_pure__;
+ __locale_t __loc)
+ __THROW __attribute_pure__ __nonnull ((1, 2, 3));
extern int strncasecmp_l (__const char *__s1, __const char *__s2,
size_t __n, __locale_t __loc)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1, 2, 4));
extern int __strncasecmp_l (__const char *__s1, __const char *__s2,
size_t __n, __locale_t __loc)
- __THROW __attribute_pure__;
-#endif
+ __THROW __attribute_pure__ __nonnull ((1, 2, 4));
#endif
+#endif /* __UCLIBC_HAS_XLOCALE__ */
#ifdef __USE_BSD
/* Return the next DELIM-delimited token from *STRINGP,
terminating it with a '\0', and update *STRINGP to point past it. */
extern char *strsep (char **__restrict __stringp,
- __const char *__restrict __delim) __THROW;
+ __const char *__restrict __delim)
+ __THROW __nonnull ((1, 2));
#endif
#ifdef __USE_GNU
+/* Compare S1 and S2 as strings holding name & indices/version numbers. */
+extern int strverscmp (__const char *__s1, __const char *__s2)
+ __THROW __attribute_pure__ __nonnull ((1, 2));
/* Return a string describing the meaning of the signal number in SIG. */
extern char *strsignal (int __sig) __THROW;
/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */
extern char *__stpcpy (char *__restrict __dest, __const char *__restrict __src)
- __THROW;
+ __THROW __nonnull ((1, 2));
extern char *stpcpy (char *__restrict __dest, __const char *__restrict __src)
- __THROW;
+ __THROW __nonnull ((1, 2));
/* Copy no more than N characters of SRC to DEST, returning the address of
the last character written into DEST. */
extern char *__stpncpy (char *__restrict __dest,
- __const char *__restrict __src, size_t __n) __THROW;
+ __const char *__restrict __src, size_t __n)
+ __THROW __nonnull ((1, 2));
extern char *stpncpy (char *__restrict __dest,
- __const char *__restrict __src, size_t __n) __THROW;
+ __const char *__restrict __src, size_t __n)
+ __THROW __nonnull ((1, 2));
+
+#if 0 /* uClibc does not support strfry or memfrob. */
+/* Sautee STRING briskly. */
+extern char *strfry (char *__string) __THROW __nonnull ((1));
+
+/* Frobnicate N bytes of S. */
+extern void *memfrob (void *__s, size_t __n) __THROW __nonnull ((1));
+#endif
# ifndef basename
/* Return the file name within directory of FILENAME. We don't
declare the function if the `basename' macro is available (defined
in <libgen.h>) which makes the XPG version of this function
available. */
-extern char *basename (__const char *__filename) __THROW;
+extern char *basename (__const char *__filename) __THROW __nonnull ((1));
# endif
#endif
@@ -379,9 +419,9 @@ extern char *basename (__const char *__filename) __THROW;
#ifdef __USE_BSD
/* Two OpenBSD extension functions. */
extern size_t strlcat(char *__restrict dst, const char *__restrict src,
- size_t n) __THROW;
+ size_t n) __THROW __nonnull ((1, 2));
extern size_t strlcpy(char *__restrict dst, const char *__restrict src,
- size_t n) __THROW;
+ size_t n) __THROW __nonnull ((1, 2));
#endif
__END_DECLS
diff --git a/include/unistd.h b/include/unistd.h
index dfe06c5b2..ab8e4b31a 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -635,11 +635,7 @@ extern int setresgid (__gid_t __egid, __gid_t __rgid, __gid_t __sgid);
/* Clone the calling process, creating an exact copy.
Return -1 for errors, 0 to the new process,
and the process ID of the new process to the old process. */
-#ifdef __PTHREADS_NATIVE__
-extern __pid_t __fork (void) __THROW;
-#else
extern __pid_t fork (void) __THROW;
-#endif
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
/* Clone the calling process, but without copying the whole address space.
diff --git a/ldso/Makefile b/ldso/Makefile
index afbe5d08a..f0d1ca56d 100644
--- a/ldso/Makefile
+++ b/ldso/Makefile
@@ -35,7 +35,7 @@ ldso libdl shared:
echo "Skipping $@ target"
endif
-HEADERS = $(patsubst %, include/%, elf.h dl-startup.h dl-syscalls.h dl-sysdep.h)
+HEADERS = $(patsubst %, include/%, elf.h dl-startup.h dl-syscalls.h dl-sysdep.h dl-debug.h)
headers: $(HEADERS) include/dl-progname.h
include/dl-progname.h:
echo "const char *_dl_progname=\""$(UCLIBC_LDSO)"\";" \
@@ -47,6 +47,7 @@ $(HEADERS):
$(LN) -fs ../ldso/$(TARGET_ARCH)/dl-startup.h include/
$(LN) -fs ../ldso/$(TARGET_ARCH)/dl-syscalls.h include/
$(LN) -fs ../ldso/$(TARGET_ARCH)/dl-sysdep.h include/
+ $(LN) -fs ../ldso/$(TARGET_ARCH)/dl-debug.h include/
clean:
set -e ; for d in $(DIRS) ; do $(MAKE) -C $$d $@ ; done
diff --git a/ldso/include/ldso.h b/ldso/include/ldso.h
index ba28baa3e..db3fe054c 100644
--- a/ldso/include/ldso.h
+++ b/ldso/include/ldso.h
@@ -55,9 +55,21 @@ extern char *_dl_debug_detail;
extern char *_dl_debug_nofixups;
extern char *_dl_debug_bindings;
extern int _dl_debug_file;
+# define __dl_debug_dprint(fmt, args...) \
+ _dl_dprintf(_dl_debug_file, "%s:%i: " fmt, __FUNCTION__, __LINE__, ## args);
+# define _dl_if_debug_dprint(fmt, args...) \
+ do { if (_dl_debug) __dl_debug_dprint(fmt, ## args); } while (0)
#else
-#define _dl_debug_file 2
-#endif
+# define _dl_debug_dprint(fmt, args...)
+# define _dl_if_debug_dprint(fmt, args...)
+# define _dl_debug_file 2
+#endif /* __SUPPORT_LD_DEBUG__ */
+
+#ifdef __SUPPORT_LD_DEBUG_EARLY__
+# define _dl_debug_early(fmt, args...) __dl_debug_dprint(fmt, ## args)
+#else
+# define _dl_debug_early(fmt, args...)
+#endif /* __SUPPORT_LD_DEBUG_EARLY__ */
#ifndef NULL
#define NULL ((void *) 0)
@@ -70,8 +82,6 @@ extern char *_dl_strdup(const char *string);
extern void _dl_dprintf(int, const char *, ...);
extern void _dl_get_ready_to_run(struct elf_resolve *tpnt, unsigned long load_addr,
- Elf32_auxv_t auxvt[AT_EGID + 1], char **envp, char **argv);
-
+ ElfW(auxv_t) auxvt[AT_EGID + 1], char **envp, char **argv);
#endif /* _LDSO_H_ */
-
diff --git a/ldso/ldso/Makefile b/ldso/ldso/Makefile
index fc828e83b..78af3cb5f 100644
--- a/ldso/ldso/Makefile
+++ b/ldso/ldso/Makefile
@@ -24,15 +24,19 @@ LDSO_FULLNAME=ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
# reset to initial (disabling predefined CFLAGS)
ASFLAGS=
ifeq ($(UCLIBC_BUILD_NOEXECSTACK),y)
-ASFLAGS+=$(check_as_noexecstack)
+ASFLAGS+=$(call check_as,--noexecstack)
endif
XXFLAGS=$(XWARNINGS) $(SSP_DISABLE_FLAGS)
+ifeq ($(DL_FINI_CRT_COMPAT),y)
+XXFLAGS+=-D_DL_FINI_CRT_COMPAT
+endif
+
ifeq ($(DODEBUG),y)
# Not really much point in including debugging info, since gdb
# can't really debug ldso, since gdb requires help from ldso to
# debug things....
-XXFLAGS+=-Os #-g3
+XXFLAGS+=-Os -g
else
XXFLAGS+=$(OPTIMIZATION)
endif
@@ -93,8 +97,8 @@ $(AOBJS): %.o : %.S
$(CC) $(XXFLAGS) $(ASFLAGS) -c $< -o $@
$(STRIPTOOL) -x -R .note -R .comment $*.o
-ldso.o: $(CSRC) dl-elf.c dl-hash.c dl-startup.c \
- $(TARGET_ARCH)/dl-startup.h
+ldso.o: $(CSRC) dl-elf.c dl-hash.c dl-startup.c dl-debug.c \
+ $(TARGET_ARCH)/*.h $(TARGET_ARCH)/*.c $(TOPDIR)ldso/include/*.h
clean:
$(RM) $(UCLIBC_LDSO)* $(OBJS) $(LDSO_FULLNAME)* core *.o *.a *.s *.i ldso.h *~
diff --git a/libc/Makefile b/libc/Makefile
index fc31a2cbb..dcd51bb1b 100644
--- a/libc/Makefile
+++ b/libc/Makefile
@@ -52,7 +52,8 @@ all: halfclean $(LIBNAME_TARGET) $(DO_SHARED)
# the wildcard will be evaluated when `make` is run instead of when the make
# target is evaluated. That means if you run `rm obj.* ; make`, the wildcard
# will evaluate to no files :(.
-$(LIBNAME) ar-target: subdirs
+$(LIBNAME) shared_$(LIBNAME) ar-target: subdirs
+ $(RM) $(LIBNAME) shared_$(LIBNAME)
objs=`cat obj.*` ; \
$(AR) $(ARFLAGS) $(LIBNAME) $$objs && \
$(AR) dN 2 $(LIBNAME) $$objs && \
@@ -61,11 +62,15 @@ $(LIBNAME) ar-target: subdirs
obj.string.generic obj.string.$(TARGET_ARCH) obj.string \
obj.sysdeps.common obj.sysdeps.$(TARGET_ARCH) ; do \
if [ -e $$objfile ] ; then \
- echo $(AR) $(ARFLAGS) $(LIBNAME) $$objfile ; \
+ if [ "$(MAKE_IS_SILENT)" = "n" ] ; then \
+ echo $(AR) $(ARFLAGS) $(LIBNAME) $$objfile ; \
+ fi ; \
objs=`cat $$objfile` ; \
fi ; \
$(AR) $(ARFLAGS) $(LIBNAME) $$objs || exit 1 ; \
done
+ cp $(LIBNAME) shared_$(LIBNAME)
+ $(AR) $(ARFLAGS) $(LIBNAME) misc/internals/static.o
$(RANLIB) $(LIBNAME)
$(LIBNAME_TARGET): $(LIBNAME)
@@ -73,11 +78,11 @@ $(LIBNAME_TARGET): $(LIBNAME)
$(RM) $(TOPDIR)lib/$(LIBNAME)
$(INSTALL) -m 644 $(LIBNAME) $(TOPDIR)lib
-shared: $(LIBNAME)
+shared: shared_$(LIBNAME)
$(LD) $(LDFLAGS) $(VERSION_SCRIPT) -soname=$(SHARED_MAJORNAME) -o $(SHARED_FULLNAME) \
- --whole-archive $(LIBNAME) \
+ --whole-archive shared_$(LIBNAME) \
$(TOPDIR)libc/misc/internals/interp.o --no-whole-archive \
- -init __uClibc_init $(LIBGCC) $(LDADD_LIBFLOAT)
+ -init __uClibc_init $(TOPDIR)lib/ld-uClibc.so.0 $(LIBGCC) $(LDADD_LIBFLOAT)
@true #$(RM) -r tmp
$(INSTALL) -d $(TOPDIR)lib
$(RM) $(TOPDIR)lib/$(SHARED_FULLNAME)
@@ -86,7 +91,7 @@ shared: $(LIBNAME)
$(LN) -sf $(SHARED_FULLNAME) $(TOPDIR)lib/$(SHARED_MAJORNAME)
halfclean:
- @$(RM) $(LIBNAME) uClibc_config.h
+ @$(RM) $(LIBNAME) shared_$(LIBNAME) uClibc_config.h
@$(RM) $(SHARED_FULLNAME) $(SHARED_MAJORNAME) uClibc-0.* libc.so*
tags:
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index 798a3f5d4..5e82c95d6 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -1157,6 +1157,7 @@ void res_close( void )
#endif
+
#ifdef L_res_query
#ifndef MIN
diff --git a/libc/sysdeps/linux/common/bits/siginfo.h b/libc/sysdeps/linux/common/bits/siginfo.h
index 4ce319dc9..03c1c11fc 100644
--- a/libc/sysdeps/linux/common/bits/siginfo.h
+++ b/libc/sysdeps/linux/common/bits/siginfo.h
@@ -1,5 +1,5 @@
-/* siginfo_t, sigevent and constants. Linux version.
- Copyright (C) 1997-2002, 2003 Free Software Foundation, Inc.
+/* siginfo_t, sigevent and constants. Linux/SPARC version.
+ Copyright (C) 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
@@ -69,9 +69,8 @@ typedef struct siginfo
/* POSIX.1b timers. */
struct
{
- int si_tid; /* Timer ID. */
- int si_overrun; /* Overrun count. */
- sigval_t si_sigval; /* Signal value. */
+ unsigned int _timer1;
+ unsigned int _timer2;
} _timer;
/* POSIX.1b signals. */
@@ -111,8 +110,8 @@ typedef struct siginfo
/* X/Open requires some more fields with fixed names. */
# define si_pid _sifields._kill.si_pid
# define si_uid _sifields._kill.si_uid
-# define si_timerid _sifields._timer.si_tid
-# define si_overrun _sifields._timer.si_overrun
+# define si_timer1 _sifields._timer._timer1
+# define si_timer2 _sifields._timer._timer2
# define si_status _sifields._sigchld.si_status
# define si_utime _sifields._sigchld.si_utime
# define si_stime _sifields._sigchld.si_stime
@@ -270,6 +269,9 @@ enum
# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 3)
# endif
+/* Forward declaration of the `pthread_attr_t' type. */
+struct __pthread_attr_s;
+
typedef struct sigevent
{
sigval_t sigev_value;
@@ -280,14 +282,10 @@ typedef struct sigevent
{
int _pad[__SIGEV_PAD_SIZE];
- /* When SIGEV_SIGNAL and SIGEV_THREAD_ID set, LWP ID of the
- thread to receive the signal. */
- __pid_t _tid;
-
struct
{
- void (*_function) (sigval_t); /* Function to start. */
- void *_attribute; /* Really pthread_attr_t. */
+ void (*_function) (sigval_t); /* Function to start. */
+ struct __pthread_attr_s *_attribute; /* Really pthread_attr_t. */
} _sigev_thread;
} _sigev_un;
} sigevent_t;
@@ -303,11 +301,8 @@ enum
# define SIGEV_SIGNAL SIGEV_SIGNAL
SIGEV_NONE, /* Other notification: meaningless. */
# define SIGEV_NONE SIGEV_NONE
- SIGEV_THREAD, /* Deliver via thread creation. */
+ SIGEV_THREAD /* Deliver via thread creation. */
# define SIGEV_THREAD SIGEV_THREAD
-
- SIGEV_THREAD_ID = 4 /* Send signal to specific thread. */
-#define SIGEV_THREAD_ID SIGEV_THREAD_ID
};
#endif /* have _SIGNAL_H. */
diff --git a/libc/sysdeps/linux/mips/Makefile b/libc/sysdeps/linux/mips/Makefile
index bd905441a..caa332dd6 100644
--- a/libc/sysdeps/linux/mips/Makefile
+++ b/libc/sysdeps/linux/mips/Makefile
@@ -19,8 +19,9 @@
TOPDIR=../../../../
include $(TOPDIR)Rules.mak
-CRT0_SRC = crt0.S
-CRT0_OBJ = crt1.o
+CRT_SRC = crt1.S
+CRT_OBJ = crt1.o
+SCRT_OBJ = $(patsubst %,S%, $(CRT_OBJ))
CTOR_TARGETS=$(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o
SSRC=bsd-_setjmp.S bsd-setjmp.S setjmp.S clone.S syscall.S pipe.S
@@ -30,23 +31,25 @@ CSRC=__longjmp.c brk.c setjmp_aux.c mmap.c __syscall_error.c \
cacheflush.c pread_write.c sysmips.c _test_and_set.c #sigaction.c
COBJS=$(patsubst %.c,%.o, $(CSRC))
-OBJS=$(SOBJS) $(MOBJ) $(COBJS)
+OBJS=$(SOBJS) $(COBJS)
OBJ_LIST=../../../obj.sysdeps.$(TARGET_ARCH)
all: $(OBJ_LIST)
-$(OBJ_LIST): $(OBJS) $(CRT0_OBJ) $(CTOR_TARGETS)
+$(OBJ_LIST): $(OBJS) $(CRT_OBJ) $(SCRT_OBJ) $(CTOR_TARGETS)
echo $(patsubst %, sysdeps/linux/$(TARGET_ARCH)/%, $(OBJS)) > $(OBJ_LIST)
$(INSTALL) -d $(TOPDIR)lib/
- cp $(CRT0_OBJ) $(TOPDIR)lib/
- $(LN) -fs $(CRT0_OBJ) $(TOPDIR)/lib/crt0.o
- $(LN) -fs $(CRT0_OBJ) $(TOPDIR)/lib/Scrt1.o
+ cp $(CRT_OBJ) $(SCRT_OBJ) $(TOPDIR)lib/
-$(CRT0_OBJ): $(CRT0_SRC)
+$(CRT_OBJ): $(CRT_SRC)
$(CC) $(ASFLAGS) -DL_$* $< -c -o $*.o
$(STRIPTOOL) -x -R .note -R .comment $*.o
+$(SCRT_OBJ): $(CRT_SRC)
+ $(CC) $(ASFLAGS) $(PIEFLAG) -DL_$* $< -c -o $*.o
+ $(STRIPTOOL) -x -R .note -R .comment $*.o
+
$(SOBJS): %.o : %.S
$(CC) $(ASFLAGS) -c $< -o $@
$(STRIPTOOL) -x -R .note -R .comment $*.o
@@ -55,7 +58,6 @@ $(COBJS): %.o : %.c
$(CC) $(CFLAGS) -c $< -o $@
$(STRIPTOOL) -x -R .note -R .comment $*.o
-
ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
crti.o: crti.S
$(CC) $(ASFLAGS) -c crti.S -o crti.o
@@ -81,8 +83,10 @@ endif
headers:
$(LN) -fs ../libc/sysdeps/linux/mips/sgidefs.h $(TOPDIR)/include/
+# $(LN) -fs ../libc/sysdeps/linux/mips/regdef.h $(TOPDIR)/include/
$(LN) -fs ../libc/sysdeps/linux/mips/fpu_control.h $(TOPDIR)/include/
cp sysdep.h $(TOPDIR)/include/
+ cp sysdep-nptl.h $(TOPDIR)/include/
clean:
$(RM) *.[oa] *~ core
@@ -90,3 +94,4 @@ clean:
$(RM) $(TOPDIR)/include/fpu_control.h
$(RM) $(TOPDIR)/include/sgidefs.h
$(RM) $(TOPDIR)/include/sysdep.h
+ $(RM) $(TOPDIR)/include/sysdep-nptl.h
diff --git a/libc/sysdeps/linux/mips/bits/siginfo.h b/libc/sysdeps/linux/mips/bits/siginfo.h
index 787e36513..565fa86b1 100644
--- a/libc/sysdeps/linux/mips/bits/siginfo.h
+++ b/libc/sysdeps/linux/mips/bits/siginfo.h
@@ -1,6 +1,5 @@
/* siginfo_t, sigevent and constants. Linux/MIPS version.
- Copyright (C) 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
+ 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
@@ -23,8 +22,6 @@
# error "Never include this file directly. Use <signal.h> instead"
#endif
-#include <bits/wordsize.h>
-
#if (!defined __have_sigval_t \
&& (defined _SIGNAL_H || defined __need_siginfo_t \
|| defined __need_sigevent_t))
@@ -42,13 +39,8 @@ typedef union sigval
&& (defined _SIGNAL_H || defined __need_siginfo_t))
# define __have_siginfo_t 1
-# define __SI_MAX_SIZE 128
-# if __WORDSIZE == 64
-# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 4)
-# else
-# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3)
-# endif
-
+# define __SI_MAX_SIZE 128
+# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3)
typedef struct siginfo
{
@@ -56,8 +48,6 @@ typedef struct siginfo
int si_code; /* Signal code. */
int si_errno; /* If non-zero, an errno value associated with
this signal, as defined in <errno.h>. */
- int __pad0[__SI_MAX_SIZE / sizeof (int) - __SI_PAD_SIZE - 3];
- /* Explicit padding. */
union
{
@@ -159,7 +149,7 @@ enum
# define ILL_ILLOPN ILL_ILLOPN
ILL_ILLADR, /* Illegal addressing mode. */
# define ILL_ILLADR ILL_ILLADR
- ILL_ILLTRP, /* Illegal trap. */
+ ILL_ILLTRP, /* Illegal trap. */
# define ILL_ILLTRP ILL_ILLTRP
ILL_PRVOPC, /* Privileged opcode. */
# define ILL_PRVOPC ILL_PRVOPC
@@ -283,8 +273,8 @@ typedef struct sigevent
struct
{
- void (*_function) (sigval_t); /* Function to start. */
- void *_attribute; /* Really pthread_attr_t. */
+ void (*_function) (sigval_t); /* Function to start. */
+ struct __pthread_attr_s *_attribute; /* Really pthread_attr_t. */
} _sigev_thread;
} _sigev_un;
} sigevent_t;
@@ -300,11 +290,10 @@ enum
# define SIGEV_SIGNAL SIGEV_SIGNAL
SIGEV_NONE, /* Other notification: meaningless. */
# define SIGEV_NONE SIGEV_NONE
- SIGEV_THREAD, /* Deliver via thread creation. */
+ SIGEV_CALLBACK, /* Deliver via thread creation. */
+# define SIGEV_CALLBACK SIGEV_CALLBACK
+ SIGEV_THREAD /* Deliver via thread creation. */
# define SIGEV_THREAD SIGEV_THREAD
-
- SIGEV_THREAD_ID = 4 /* Send signal to specific thread. */
-#define SIGEV_THREAD_ID SIGEV_THREAD_ID
};
#endif /* have _SIGNAL_H. */
diff --git a/libc/sysdeps/linux/mips/sgidefs.h b/libc/sysdeps/linux/mips/sgidefs.h
index 1d4893501..74509fdbd 100644
--- a/libc/sysdeps/linux/mips/sgidefs.h
+++ b/libc/sysdeps/linux/mips/sgidefs.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ralf Baechle <ralf@gnu.org>.
@@ -21,6 +21,27 @@
#define _SGIDEFS_H 1
/*
+ * A crude hack to stop <asm/sgidefs.h>
+ */
+#undef __ASM_SGIDEFS_H
+#define __ASM_SGIDEFS_H
+
+/*
+ * And remove any damage it might have already done
+ */
+#undef _MIPS_ISA_MIPS1
+#undef _MIPS_ISA_MIPS2
+#undef _MIPS_ISA_MIPS3
+#undef _MIPS_ISA_MIPS4
+#undef _MIPS_ISA_MIPS5
+#undef _MIPS_ISA_MIPS32
+#undef _MIPS_ISA_MIPS64
+
+#undef _MIPS_SIM_ABI32
+#undef _MIPS_SIM_NABI32
+#undef _MIPS_SIM_ABI64
+
+/*
* Definitions for the ISA level
*/
#define _MIPS_ISA_MIPS1 1
@@ -33,14 +54,20 @@
/*
* Subprogram calling convention
- *
- * At the moment only _MIPS_SIM_ABI32 is in use. This will change rsn.
- * Until GCC 2.8.0 is released don't rely on this definitions because the
- * 64bit code is essentially using the 32bit interface model just with
- * 64bit registers.
*/
-#define _MIPS_SIM_ABI32 1
-#define _MIPS_SIM_NABI32 2
-#define _MIPS_SIM_ABI64 3
+#ifndef _ABIO32
+# define _ABIO32 1
+#endif
+#define _MIPS_SIM_ABI32 _ABIO32
+
+#ifndef _ABIN32
+# define _ABIN32 2
+#endif
+#define _MIPS_SIM_NABI32 _ABIN32
+
+#ifndef _ABI64
+# define _ABI64 3
+#endif
+#define _MIPS_SIM_ABI64 _ABI64
#endif /* sgidefs.h */
diff --git a/libc/sysdeps/linux/mips/sys/asm.h b/libc/sysdeps/linux/mips/sys/asm.h
index b590802fd..e961f3694 100644
--- a/libc/sysdeps/linux/mips/sys/asm.h
+++ b/libc/sysdeps/linux/mips/sys/asm.h
@@ -1,5 +1,4 @@
-/* Copyright (C) 1997, 1998, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ralf Baechle <ralf@gnu.org>.
@@ -38,11 +37,11 @@
* 64 bit address space isn't used yet, so we may use the R3000 32 bit
* defines for now.
*/
-#if _MIPS_SIM == _ABIO32 || _MIPS_SIM == _ABIN32
+#if (_MIPS_SIM == _MIPS_SIM_ABI32) || (_MIPS_SIM == _MIPS_SIM_NABI32)
# define PTR .word
# define PTRSIZE 4
# define PTRLOG 2
-#elif _MIPS_SIM == _ABI64
+#elif (_MIPS_SIM == _MIPS_SIM_ABI64)
# define PTR .dword
# define PTRSIZE 8
# define PTRLOG 3
@@ -51,7 +50,7 @@
/*
* PIC specific declarations
*/
-#if _MIPS_SIM == _ABIO32
+#if (_MIPS_SIM == _MIPS_SIM_ABI32)
# ifdef __PIC__
# define CPRESTORE(register) \
.cprestore register
@@ -98,7 +97,7 @@ l: \
# define SETUP_GPX64_L(cp_reg, ra_save, l)
# define RESTORE_GP64
# define USE_ALT_CP(a)
-#else /* _MIPS_SIM == _ABI64 || _MIPS_SIM == _ABIN32 */
+#else /* (_MIPS_SIM == _MIPS_SIM_ABI64) || (_MIPS_SIM == _MIPS_SIM_NABI32) */
/*
* For callee-saved gp calling convention:
*/
@@ -132,15 +131,15 @@ l: \
/* Use alternate register for context pointer. */
# define USE_ALT_CP(reg) \
.cplocal reg
-#endif /* _MIPS_SIM != _ABIO32 */
+#endif /* _MIPS_SIM != _MIPS_SIM_ABI32 */
/*
* Stack Frame Definitions
*/
-#if _MIPS_SIM == _ABIO32
+#if (_MIPS_SIM == _MIPS_SIM_ABI32)
# define NARGSAVE 4 /* Space for 4 argument registers must be allocated. */
#endif
-#if _MIPS_SIM == _ABI64 || _MIPS_SIM == _ABIN32
+#if (_MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32)
# define NARGSAVE 0 /* No caller responsibilities. */
#endif
@@ -288,7 +287,7 @@ symbol = value
/*
* Stack alignment
*/
-#if _MIPS_SIM == _ABI64 || _MIPS_SIM == _ABIN32
+#if (_MIPS_SIM == _MIPS_SIM_ABI64) || (_MIPS_SIM == _MIPS_SIM_NABI32)
# define ALSZ 15
# define ALMASK ~15
#else
@@ -299,7 +298,7 @@ symbol = value
/*
* Size of a register
*/
-#if _MIPS_SIM == _ABI64 || _MIPS_SIM == _ABIN32
+#if (_MIPS_SIM == _MIPS_SIM_ABI64) || (_MIPS_SIM == _MIPS_SIM_NABI32)
# define SZREG 8
#else
# define SZREG 4
@@ -390,7 +389,7 @@ symbol = value
/*
* How to add/sub/load/store/shift pointers.
*/
-#if (_MIPS_SIM == _ABIO32 && _MIPS_SZPTR == 32)
+#if (_MIPS_SIM == _MIPS_SIM_ABI32 && _MIPS_SZPTR == 32)
# define PTR_ADD add
# define PTR_ADDI addi
# define PTR_ADDU addu
@@ -412,7 +411,7 @@ symbol = value
# define PTR_SCALESHIFT 2
#endif
-#if _MIPS_SIM == _ABIN32
+#if _MIPS_SIM == _MIPS_SIM_NABI32
# define PTR_ADD add
# define PTR_ADDI addi
# define PTR_ADDU add /* no u */
@@ -434,8 +433,8 @@ symbol = value
# define PTR_SCALESHIFT 2
#endif
-#if (_MIPS_SIM == _ABIO32 && _MIPS_SZPTR == 64 /* o64??? */) \
- || _MIPS_SIM == _ABI64
+#if (_MIPS_SIM == _MIPS_SIM_ABI32 && _MIPS_SZPTR == 64 /* o64??? */) \
+ || _MIPS_SIM == _MIPS_SIM_ABI64
# define PTR_ADD dadd
# define PTR_ADDI daddi
# define PTR_ADDU daddu
diff --git a/libc/sysdeps/linux/mips/sys/regdef.h b/libc/sysdeps/linux/mips/sys/regdef.h
index 8fb898a2d..2d94130af 100644
--- a/libc/sysdeps/linux/mips/sys/regdef.h
+++ b/libc/sysdeps/linux/mips/sys/regdef.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ralf Baechle <ralf@gnu.org>.
@@ -33,7 +33,7 @@
#define a1 $5
#define a2 $6
#define a3 $7
-#if _MIPS_SIM != _ABIO32
+#if _MIPS_SIM != _MIPS_SIM_ABI32
#define a4 $8
#define a5 $9
#define a6 $10
@@ -46,7 +46,7 @@
#define ta1 a5
#define ta2 a6
#define ta3 a7
-#else /* if _MIPS_SIM == _ABIO32 */
+#else /* if _MIPS_SIM == _MIPS_SIM_ABI32 */
#define t0 $8 /* caller saved */
#define t1 $9
#define t2 $10
@@ -59,7 +59,7 @@
#define ta1 t5
#define ta2 t6
#define ta3 t7
-#endif /* _MIPS_SIM == _ABIO32 */
+#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
#define s0 $16 /* callee saved */
#define s1 $17
#define s2 $18
diff --git a/libc/sysdeps/linux/mips/sysdep.h b/libc/sysdeps/linux/mips/sysdep.h
index 0a92afd71..da8eacded 100644
--- a/libc/sysdeps/linux/mips/sysdep.h
+++ b/libc/sysdeps/linux/mips/sysdep.h
@@ -1,548 +1,132 @@
-/* Copyright (C) 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
+/* Copyright (C) 1991, 1992 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 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
- Lesser General Public License for more details.
+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; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+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., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
-#ifndef _LINUX_MIPS_MIPS32_SYSDEP_H
-#define _LINUX_MIPS_MIPS32_SYSDEP_H 1
-
-/* There is some commonality. */
-/* NPTL - start sysdeps/unix/mips32/sysdep.h */
-
-/* NPTL - start sysdeps/unix/mips/sysdep.h */
-
-#include <sgidefs.h>
-/* NPTL - start sysdeps/unix/sysdep.h */
+#include <sys/syscall.h>
+#include <features.h>
-/* NPTL - start sysdeps/generic/sysdep.h */
-/* Define a macro we can use to construct the asm name for a C symbol. */
-#ifdef NO_UNDERSCORES
-#ifdef __STDC__
-#define C_LABEL(name) name##:
-#else
-#define C_LABEL(name) name/**/:
-#endif
-#else
+/* Not that using a `PASTE' macro loses. */
#ifdef __STDC__
-#define C_LABEL(name) _##name##:
-#else
-#define C_LABEL(name) _/**/name/**/:
-#endif
-#endif
-
-#ifdef __ASSEMBLER__
-/* Mark the end of function named SYM. This is used on some platforms
- to generate correct debugging information. */
-#ifndef END
-#define END(sym)
-#endif
-
-#ifndef JUMPTARGET
-#define JUMPTARGET(sym) sym
-#endif
-/* Makros to generate eh_frame unwind information. */
-# ifdef HAVE_ASM_CFI_DIRECTIVES
-# define cfi_startproc .cfi_startproc
-# define cfi_endproc .cfi_endproc
-# define cfi_def_cfa(reg, off) .cfi_def_cfa reg, off
-# define cfi_def_cfa_register(reg) .cfi_def_cfa_register reg
-# define cfi_def_cfa_offset(off) .cfi_def_cfa_offset off
-# define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off
-# define cfi_offset(reg, off) .cfi_offset reg, off
-# define cfi_rel_offset(reg, off) .cfi_rel_offset reg, off
-# define cfi_register(r1, r2) .cfi_register r1, r2
-# define cfi_return_column(reg) .cfi_return_column reg
-# define cfi_restore(reg) .cfi_restore reg
-# define cfi_undefined(reg) .cfi_undefined reg
-# define cfi_remember_state .cfi_remember_state
-# define cfi_restore_state .cfi_restore_state
-# define cfi_window_save .cfi_window_save
-# else
-# define cfi_startproc
-# define cfi_endproc
-# define cfi_def_cfa(reg, off)
-# define cfi_def_cfa_register(reg)
-# define cfi_def_cfa_offset(off)
-# define cfi_adjust_cfa_offset(off)
-# define cfi_offset(reg, off)
-# define cfi_rel_offset(reg, off)
-# define cfi_register(r1, r2)
-# define cfi_return_column(reg)
-# define cfi_restore(reg)
-# define cfi_undefined(reg)
-# define cfi_remember_state
-# define cfi_restore_state
-# define cfi_window_save
-# endif
-
-#else /* ! ASSEMBLER */
-# ifdef HAVE_ASM_CFI_DIRECTIVES
-# define CFI_STRINGIFY(Name) CFI_STRINGIFY2 (Name)
-# define CFI_STRINGIFY2(Name) #Name
-# define CFI_STARTPROC ".cfi_startproc"
-# define CFI_ENDPROC ".cfi_endproc"
-# define CFI_DEF_CFA(reg, off) \
- ".cfi_def_cfa " CFI_STRINGIFY(reg) "," CFI_STRINGIFY(off)
-# define CFI_DEF_CFA_REGISTER(reg) \
- ".cfi_def_cfa_register " CFI_STRINGIFY(reg)
-# define CFI_DEF_CFA_OFFSET(off) \
- ".cfi_def_cfa_offset " CFI_STRINGIFY(off)
-# define CFI_ADJUST_CFA_OFFSET(off) \
- ".cfi_adjust_cfa_offset " CFI_STRINGIFY(off)
-# define CFI_OFFSET(reg, off) \
- ".cfi_offset " CFI_STRINGIFY(reg) "," CFI_STRINGIFY(off)
-# define CFI_REL_OFFSET(reg, off) \
- ".cfi_rel_offset " CFI_STRINGIFY(reg) "," CFI_STRINGIFY(off)
-# define CFI_REGISTER(r1, r2) \
- ".cfi_register " CFI_STRINGIFY(r1) "," CFI_STRINGIFY(r2)
-# define CFI_RETURN_COLUMN(reg) \
- ".cfi_return_column " CFI_STRINGIFY(reg)
-# define CFI_RESTORE(reg) \
- ".cfi_restore " CFI_STRINGIFY(reg)
-# define CFI_UNDEFINED(reg) \
- ".cfi_undefined " CFI_STRINGIFY(reg)
-# define CFI_REMEMBER_STATE \
- ".cfi_remember_state"
-# define CFI_RESTORE_STATE \
- ".cfi_restore_state"
-# define CFI_WINDOW_SAVE \
- ".cfi_window_save"
-# else
-# define CFI_STARTPROC
-# define CFI_ENDPROC
-# define CFI_DEF_CFA(reg, off)
-# define CFI_DEF_CFA_REGISTER(reg)
-# define CFI_DEF_CFA_OFFSET(off)
-# define CFI_ADJUST_CFA_OFFSET(off)
-# define CFI_OFFSET(reg, off)
-# define CFI_REL_OFFSET(reg, off)
-# define CFI_REGISTER(r1, r2)
-# define CFI_RETURN_COLUMN(reg)
-# define CFI_RESTORE(reg)
-# define CFI_UNDEFINED(reg)
-# define CFI_REMEMBER_STATE
-# define CFI_RESTORE_STATE
-# define CFI_WINDOW_SAVE
-# endif
-
-#endif /* __ASSEMBLER__ */
-/* NPTL - end sysdeps/generic/sysdep.h */
+#ifdef __ELF__
-#include <sys/syscall.h>
-#define HAVE_SYSCALLS
+#define SYSCALL_WEAK_ALIAS(alias,orig) \
+ .weak alias; \
+ alias=__libc_##orig
-/* Note that using a `PASTE' macro loses. */
-#ifdef __STDC__
-#define SYSCALL__(name, args) PSEUDO (__##name, name, args)
-#else
-#define SYSCALL__(name, args) PSEUDO (__/**/name, name, args)
-#endif
-#define SYSCALL(name, args) PSEUDO (name, name, args)
+/*
+#ifdef _POSIX_THREADS
+*/
+
+#if 1
+
+#ifdef PTHREAD_KERNEL
+
+/* Use the regular ELF conventions about underscores, and provide the
+ weak symbol, as required */
+#define SYSCALL__(name,args) PSEUDO (__machdep_sys_##name, name, args) \
+.weak machdep_sys_##name; \
+ machdep_sys_##name = __machdep_sys_##name; \
+.type __machdep_sys_##name,@function; \
+.type machdep_sys_##name,@function; \
+.L__machdep_sys_##name##end: .size __machdep_sys_##name,.L__machdep_sys_##name##end - __machdep_sys_##name
+
+#define SYSCALL(name,args) PSEUDO (__machdep_sys_##name, name, args) \
+.weak machdep_sys_##name; \
+ machdep_sys_##name = __machdep_sys_##name; \
+.type __machdep_sys_##name,@function; \
+.type machdep_sys_##name,@function; \
+.L__machdep_sys_##name##end: .size __machdep_sys_##name,.L__machdep_sys_##name##end - __machdep_sys_##name
+
+#else /* PTHREAD_KERNEL */
+
+/* Use the regular ELF conventions about underscores, and provide the
+ weak symbol, as required */
+#define SYSCALL__(name,args) PSEUDO (__libc_##name, name, args) \
+.weak __##name; \
+.weak name; \
+ __##name = __libc_##name; \
+ name = __libc_##name; \
+.type __libc_##name,@function; \
+.type name,@function; \
+.type __##name,@function; \
+.L__libc_##name##end: .size __libc_##name,.L__libc_##name##end - __libc_##name
+
+#define SYSCALL(name,args) PSEUDO (__libc_##name, name, args) \
+.weak name; \
+ name = __libc_##name; \
+.type __libc_##name,@function; \
+.type name,@function; \
+.L__libc_##name##end: .size __libc_##name,.L__libc_##name##end - __libc_##name
+
+#endif /* PTHREAD_KERNEL */
+
+#else /* _POSIX_THREADS */
+
+/* Use the regular ELF conventions about underscores, and provide the
+ weak symbol, as required */
+#define SYSCALL__(name,args) PSEUDO (__libc_##name, name, args) \
+.weak name; \
+ __##name = __libc_##name; \
+ name = __libc_##name; \
+.type __libc_##name,@function; \
+.type name,@function; \
+.type __##name,@function; \
+.L__libc_##name##end: .size __libc_##name,.L__libc_##name##end - __libc_##name
+
+#define SYSCALL(name,args) PSEUDO (__libc_##name, name, args) \
+ name = __libc_##name; \
+.type __libc_##name,@function; \
+.type name,@function; \
+.L__libc_##name##end: .size __libc_##name,.L__libc_##name##end - __libc_##name
+
+#endif /* _POSIX_THREADS */
+
+#else /* __ELF__ */
+
+#define SYSCALL_WEAK_ALIAS(alias,orig)
+
+/* Regular a.out definition */
+#define SYSCALL__(name,args) PSEUDO (__##name, name, args)
+#define SYSCALL(name,args) PSEUDO (name, name, args)
+
+#endif /* __ELF__ */
+
+#else /* __STDC__ */
+
+#define SYSCALL__(name,args) PSEUDO (__/**/name, name, args)
+#define SYSCALL(name,args) PSEUDO (name, name, args)
+
+#endif /* __STDC__ */
/* Machine-dependent sysdep.h files are expected to define the macro
PSEUDO (function_name, syscall_name) to emit assembly code to define the
C-callable function FUNCTION_NAME to do system call SYSCALL_NAME.
- r0 and r1 are the system call outputs. MOVE(x, y) should be defined as
- an instruction such that "MOVE(r1, r0)" works. ret should be defined
+ r0 and r1 are the system call outputs. movl should be defined as
+ an instruction such that "movl r1, r0" works. ret should be defined
as the return instruction. */
-#if 0
-/*
- * NPTL - these are defined in 'include/bits/syscalls.h' and
- * 'include/bits/sysnum.h'.
- */
-#ifdef __STDC__
-#define SYS_ify(syscall_name) SYS_##syscall_name
-#else
-#define SYS_ify(syscall_name) SYS_/**/syscall_name
-#endif
-#endif
-
-/* Terminate a system call named SYM. This is used on some platforms
- to generate correct debugging information. */
-#ifndef PSEUDO_END
-#define PSEUDO_END(sym)
-#endif
-#ifndef PSEUDO_END_NOERRNO
-#define PSEUDO_END_NOERRNO(sym) PSEUDO_END(sym)
-#endif
-#ifndef PSEUDO_END_ERRVAL
-#define PSEUDO_END_ERRVAL(sym) PSEUDO_END(sym)
-#endif
-
-/* Wrappers around system calls should normally inline the system call code.
- But sometimes it is not possible or implemented and we use this code. */
-#define INLINE_SYSCALL(name, nr, args...) __syscall_##name (args)
-/* NPTL - end sysdeps/unix/sysdep.h */
-
-#ifdef __ASSEMBLER__
-
-#include <regdef.h>
-
-#define ENTRY(name) \
- .globl name; \
- .align 2; \
- .ent name,0; \
- name##:
-
-#undef END
-#define END(function) \
- .end function; \
- .size function,.-function
-
-#define ret j ra ; nop
-
-#undef PSEUDO_END
-#define PSEUDO_END(sym) .end sym; .size sym,.-sym
-
-#define PSEUDO_NOERRNO(name, syscall_name, args) \
- .align 2; \
- ENTRY(name) \
- .set noreorder; \
- li v0, SYS_ify(syscall_name); \
- syscall
-
-#undef PSEUDO_END_NOERRNO
-#define PSEUDO_END_NOERRNO(sym) .end sym; .size sym,.-sym
-#define ret_NOERRNO ret
-
-#define PSEUDO_ERRVAL(name, syscall_name, args) \
- .align 2; \
- ENTRY(name) \
- .set noreorder; \
- li v0, SYS_ify(syscall_name); \
- syscall
-
-#undef PSEUDO_END_ERRVAL
-#define PSEUDO_END_ERRVAL(sym) .end sym; .size sym,.-sym
-
-#define ret_ERRVAL ret
-
-#define r0 v0
-#define r1 v1
-/* The mips move insn is d,s. */
-#define MOVE(x,y) move y , x
-
-#if _MIPS_SIM == _ABIO32
-# define L(label) $L ## label
-#else
-# define L(label) .L ## label
+#if !defined(HAVE_GNU_LD) && !defined (__ELF__)
+#define ___errno _errno
#endif
-#endif
-/* NPTL - end sysdeps/unix/mips/sysdep.h */
-
-/* Note that while it's better structurally, going back to call __syscall_error
- can make things confusing if you're debugging---it looks like it's jumping
- backwards into the previous fn. */
-#ifdef __PIC__
-#define PSEUDO(name, syscall_name, args) \
- .align 2; \
- 99: la t9,__syscall_error; \
- jr t9; \
- ENTRY(name) \
- .set noreorder; \
- .cpload t9; \
- li v0, SYS_ify(syscall_name); \
- syscall; \
- .set reorder; \
- bne a3, zero, 99b; \
-L(syse1):
-#else
-#define PSEUDO(name, syscall_name, args) \
- .set noreorder; \
- .align 2; \
- 99: j __syscall_error; \
- nop; \
- ENTRY(name) \
- .set noreorder; \
- li v0, SYS_ify(syscall_name); \
- syscall; \
- .set reorder; \
- bne a3, zero, 99b; \
-L(syse1):
-#endif
-/* NPTL - end sysdeps/unix/mips32/sysdep.h */
-
-/* For Linux we can use the system call table in the header file
- /usr/include/asm/unistd.h
- of the kernel. But these symbols do not follow the SYS_* syntax
- so we have to redefine the `SYS_ify' macro here. */
-#undef SYS_ify
-#ifdef __STDC__
-# define SYS_ify(syscall_name) __NR_##syscall_name
-#else
-# define SYS_ify(syscall_name) __NR_/**/syscall_name
-#endif
-
-#ifdef __ASSEMBLER__
+#define HAVE_SYSCALLS
-/* We don't want the label for the error handler to be visible in the symbol
- table when we define it here. */
-#ifdef __PIC__
-# define SYSCALL_ERROR_LABEL 99b
+#ifdef __PTHREADS_NATIVE__
+#include <sysdep-nptl.h>
#endif
-
-#else /* ! __ASSEMBLER__ */
-
-/* Define a macro which expands into the inline wrapper code for a system
- call. */
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...) \
- ({ INTERNAL_SYSCALL_DECL(err); \
- long result_var = INTERNAL_SYSCALL (name, err, nr, args); \
- if ( INTERNAL_SYSCALL_ERROR_P (result_var, err) ) \
- { \
- result_var = -1L; \
- } \
- result_var; })
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) long err
-
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err) ((long) (err))
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err) (val)
-
-#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...) \
- internal_syscall##nr (, "li\t$2, %2\t\t\t# " #name "\n\t", \
- "i" (SYS_ify (name)), err, args)
-
-#undef INTERNAL_SYSCALL_NCS
-#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \
- internal_syscall##nr (= number, , "r" (__v0), err, args)
-
-#define internal_syscall0(ncs_init, cs_init, input, err, dummy...) \
-({ \
- long _sys_result; \
- \
- { \
- register long __v0 asm("$2") ncs_init; \
- register long __a3 asm("$7"); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- cs_init \
- "syscall\n\t" \
- ".set reorder" \
- : "=r" (__v0), "=r" (__a3) \
- : input \
- : __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
- } \
- _sys_result; \
-})
-
-#define internal_syscall1(ncs_init, cs_init, input, err, arg1) \
-({ \
- long _sys_result; \
- \
- { \
- register long __v0 asm("$2") ncs_init; \
- register long __a0 asm("$4") = (long) arg1; \
- register long __a3 asm("$7"); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- cs_init \
- "syscall\n\t" \
- ".set reorder" \
- : "=r" (__v0), "=r" (__a3) \
- : input, "r" (__a0) \
- : __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
- } \
- _sys_result; \
-})
-
-#define internal_syscall2(ncs_init, cs_init, input, err, arg1, arg2) \
-({ \
- long _sys_result; \
- \
- { \
- register long __v0 asm("$2") ncs_init; \
- register long __a0 asm("$4") = (long) arg1; \
- register long __a1 asm("$5") = (long) arg2; \
- register long __a3 asm("$7"); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- cs_init \
- "syscall\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "=r" (__a3) \
- : input, "r" (__a0), "r" (__a1) \
- : __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
- } \
- _sys_result; \
-})
-
-#define internal_syscall3(ncs_init, cs_init, input, err, arg1, arg2, arg3)\
-({ \
- long _sys_result; \
- \
- { \
- register long __v0 asm("$2") ncs_init; \
- register long __a0 asm("$4") = (long) arg1; \
- register long __a1 asm("$5") = (long) arg2; \
- register long __a2 asm("$6") = (long) arg3; \
- register long __a3 asm("$7"); \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- cs_init \
- "syscall\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "=r" (__a3) \
- : input, "r" (__a0), "r" (__a1), "r" (__a2) \
- : __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
- } \
- _sys_result; \
-})
-
-#define internal_syscall4(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4)\
-({ \
- long _sys_result; \
- \
- { \
- register long __v0 asm("$2") ncs_init; \
- register long __a0 asm("$4") = (long) arg1; \
- register long __a1 asm("$5") = (long) arg2; \
- register long __a2 asm("$6") = (long) arg3; \
- register long __a3 asm("$7") = (long) arg4; \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- cs_init \
- "syscall\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "+r" (__a3) \
- : input, "r" (__a0), "r" (__a1), "r" (__a2) \
- : __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
- } \
- _sys_result; \
-})
-
-/* We need to use a frame pointer for the functions in which we
- adjust $sp around the syscall, or debug information and unwind
- information will be $sp relative and thus wrong during the syscall. As
- of GCC 3.4.3, this is sufficient. */
-#define FORCE_FRAME_POINTER alloca (4)
-
-#define internal_syscall5(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5)\
-({ \
- long _sys_result; \
- \
- FORCE_FRAME_POINTER; \
- { \
- register long __v0 asm("$2") ncs_init; \
- register long __a0 asm("$4") = (long) arg1; \
- register long __a1 asm("$5") = (long) arg2; \
- register long __a2 asm("$6") = (long) arg3; \
- register long __a3 asm("$7") = (long) arg4; \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- "subu\t$29, 32\n\t" \
- "sw\t%6, 16($29)\n\t" \
- cs_init \
- "syscall\n\t" \
- "addiu\t$29, 32\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "+r" (__a3) \
- : input, "r" (__a0), "r" (__a1), "r" (__a2), \
- "r" ((long)arg5) \
- : __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
- } \
- _sys_result; \
-})
-
-#define internal_syscall6(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5, arg6)\
-({ \
- long _sys_result; \
- \
- FORCE_FRAME_POINTER; \
- { \
- register long __v0 asm("$2") ncs_init; \
- register long __a0 asm("$4") = (long) arg1; \
- register long __a1 asm("$5") = (long) arg2; \
- register long __a2 asm("$6") = (long) arg3; \
- register long __a3 asm("$7") = (long) arg4; \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- "subu\t$29, 32\n\t" \
- "sw\t%6, 16($29)\n\t" \
- "sw\t%7, 20($29)\n\t" \
- cs_init \
- "syscall\n\t" \
- "addiu\t$29, 32\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "+r" (__a3) \
- : input, "r" (__a0), "r" (__a1), "r" (__a2), \
- "r" ((long)arg5), "r" ((long)arg6) \
- : __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
- } \
- _sys_result; \
-})
-
-#define internal_syscall7(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5, arg6, arg7)\
-({ \
- long _sys_result; \
- \
- FORCE_FRAME_POINTER; \
- { \
- register long __v0 asm("$2") ncs_init; \
- register long __a0 asm("$4") = (long) arg1; \
- register long __a1 asm("$5") = (long) arg2; \
- register long __a2 asm("$6") = (long) arg3; \
- register long __a3 asm("$7") = (long) arg4; \
- __asm__ volatile ( \
- ".set\tnoreorder\n\t" \
- "subu\t$29, 32\n\t" \
- "sw\t%6, 16($29)\n\t" \
- "sw\t%7, 20($29)\n\t" \
- "sw\t%8, 24($29)\n\t" \
- cs_init \
- "syscall\n\t" \
- "addiu\t$29, 32\n\t" \
- ".set\treorder" \
- : "=r" (__v0), "+r" (__a3) \
- : input, "r" (__a0), "r" (__a1), "r" (__a2), \
- "r" ((long)arg5), "r" ((long)arg6), "r" ((long)arg7) \
- : __SYSCALL_CLOBBERS); \
- err = __a3; \
- _sys_result = __v0; \
- } \
- _sys_result; \
-})
-
-#define __SYSCALL_CLOBBERS "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", \
- "$14", "$15", "$24", "$25", "memory"
-
-#endif /* __ASSEMBLER__ */
-
-#endif /* linux/mips/mips32/sysdep.h */
diff --git a/libpthread/Makefile b/libpthread/Makefile
index 2d689edcc..a7317dc4e 100644
--- a/libpthread/Makefile
+++ b/libpthread/Makefile
@@ -22,8 +22,6 @@ ifeq ($(strip $(PTHREADS_NATIVE)),y)
include nptl/Rules.mak
endif
-CFLAGS+=$(SSP_ALL_CFLAGS)
-
#
# Adjust the soname version to avoid namespace collisions with glibc's
# libpthread library.
@@ -43,29 +41,12 @@ ifeq ($(strip $(PTHREADS_NATIVE)),y)
else
DIRS+=linuxthreads
endif
- LDFLAGS_THREAD:= $(CPU_LDFLAGS-y) -shared --warn-common --warn-once -z combreloc -z defs
-ifeq ($(UCLIBC_BUILD_RELRO),y)
- LDFLAGS_THREAD+=-z relro
-endif
-ifeq ($(UCLIBC_BUILD_NOW),y)
- LDFLAGS_THREAD+=-z now
-endif
ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
ifeq ($(strip $(PTHREADS_NATIVE)),y)
DIRS+=nptl_db
else
DIRS+=linuxthreads_db
endif
- LDFLAGS_THREAD_DB:= $(CPU_LDFLAGS-y) -shared --warn-common --warn-once -z combreloc
-endif
-ifeq ($(DODEBUG),n)
- LDFLAGS_THREAD_DB+=-s
-ifeq ($(UCLIBC_BUILD_RELRO),y)
- LDFLAGS_THREAD_DB+=-z relro
-endif
-ifeq ($(UCLIBC_BUILD_NOW),y)
- LDFLAGS_THREAD_DB+=-z now
-endif
endif
endif
@@ -74,7 +55,14 @@ ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
SHARED_END_FILES = $(LIBGCC_DIR)crtendS.o $(TOPDIR)lib/crtn.o
endif
-ALL_SUBDIRS = linuxthreads linuxthreads_db nptl nptl_db
+ifeq ($(strip $(PTHREADS_NATIVE)),y)
+ALL_SUBDIRS = nptl nptl_db
+else
+ALL_SUBDIRS = linuxthreads linuxthreads_db
+endif
+
+# Remove any -z defs since this lib will have undefined symbols
+LIBTHREAD_DB_LDFLAGS := $(subst -z defs,,$(LDFLAGS))
all: $(LIBPTHREAD) $(LIBTHREAD_DB)
@@ -102,13 +90,13 @@ $(OBJ): Makefile
shared: all
ifeq ($(strip $(UCLIBC_HAS_THREADS)),y)
ifeq ($(strip $(PTHREADS_NATIVE)),y)
- $(LD) $(LDFLAGS_THREAD) -soname=$(LIBPTHREAD_SHARED).$(MAJOR_VERSION) \
+ $(LD) $(LDFLAGS_NOSTRIP) -soname=$(LIBPTHREAD_SHARED).$(MAJOR_VERSION) \
-o $(LIBPTHREAD_SHARED_FULLNAME) $(SHARED_START_FILES) --whole-archive $(LIBPTHREAD_SHARED_ARCHIVE) \
--no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \
-L$(TOPDIR)lib -lc -ldl $(LDADD_LIBFLOAT) $(LIBGCC) \
$(SHARED_END_FILES)
else
- $(LD) $(LDFLAGS_THREAD) -soname=$(LIBPTHREAD_SHARED).$(MAJOR_VERSION) \
+ $(LD) $(LDFLAGS_NOSTRIP) -soname=$(LIBPTHREAD_SHARED).$(MAJOR_VERSION) \
-o $(LIBPTHREAD_SHARED_FULLNAME) $(SHARED_START_FILES) --whole-archive $(LIBPTHREAD) \
--no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \
-L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC) \
@@ -124,7 +112,7 @@ endif
$(TOPDIR)lib/$(LIBPTHREAD_SHARED).$(MAJOR_VERSION)
endif
ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
- $(LD) $(LDFLAGS_THREAD_DB) -soname=$(LIBTHREAD_DB_SHARED).1 \
+ $(LD) $(LIBTHREAD_DB_LDFLAGS) --warn-unresolved-symbols -soname=$(LIBTHREAD_DB_SHARED).1 \
-o $(LIBTHREAD_DB_SHARED_FULLNAME) --whole-archive $(LIBTHREAD_DB) \
--no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \
-L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC)
diff --git a/libpthread/linuxthreads/Makefile b/libpthread/linuxthreads/Makefile
index cca65d51c..2f66fab21 100644
--- a/libpthread/linuxthreads/Makefile
+++ b/libpthread/linuxthreads/Makefile
@@ -39,9 +39,9 @@ CFLAGS :=$(CFLAGS:-O0=-O1)
# set up system dependencies include dirs (NOTE: order matters!)
-PTDIR = $(TOPDIR)libpthread/linuxthreads/
SYSDEPINC = -I$(PTDIR)sysdeps/pthread \
-I$(PTDIR)sysdeps/$(TARGET_ARCH) \
+ -I$(PTDIR)sysdeps \
-I$(TOPDIR)libc/sysdeps/linux/$(TARGET_ARCH)
CFLAGS += $(SYSDEPINC)
diff --git a/libpthread/linuxthreads_db/Makefile b/libpthread/linuxthreads_db/Makefile
index 66015be12..debfb9bc7 100644
--- a/libpthread/linuxthreads_db/Makefile
+++ b/libpthread/linuxthreads_db/Makefile
@@ -29,9 +29,12 @@ SYSDEPS_DIR:=$(TARGET_ARCH)
endif
# set up system dependencies include dirs (NOTE: order matters!)
-PTDIR = $(TOPDIR)libpthread/linuxthreads/
-SYSDEPINC = -I$(PTDIR)sysdeps/pthread \
+SYSDEPINC = -I$(PTDIR)sysdeps/unix/sysv/linux \
+ -I$(PTDIR)sysdeps/pthread \
+ -I$(PTDIR)sysdeps/unix/sysv \
+ -I$(PTDIR)sysdeps/unix/unix \
-I$(PTDIR)sysdeps/$(TARGET_ARCH) \
+ -I$(PTDIR)sysdeps \
-I$(TOPDIR)libc/sysdeps/linux/$(TARGET_ARCH)
#CFLAGS += $(SSP_ALL_CFLAGS)
CFLAGS += $(SYSDEPINC) -DLIBPTHREAD_SO="\"libpthread.so.$(MAJOR_VERSION)\""