Browse Source

Merge remote-tracking branch 'origin/master' into prelink

* origin/master: (61 commits)
  fts: fix warning due to old-style function definition
  ldso_tls: fix compiler warning due to missing cast
  resolv: fix bug in res_init with ipv6 nameservers
  config: Fix passing defconfig args
  buildsys: pt-initfini.s depends on uClibc_config.h
  libdl: search for ELF_RTYPE_CLASS_DLSYM in dlsym()
  resolv: try next server on SERVFAIL
  getaddrinfo: allow numeric service without any hints
  bump version to 0.9.33-git
  nptl/pthread: Correct path for machine specific pt-initfini.c
  ctor/dtor nptl: Fix init and fini function compilation
  Rules.mak: Rearrange appending UCLIBC_EXTRA_CFLAGS to CFLAGS
  ARM: remove EABI/OABI selection
  ARM: detect BX availibility at build time
  ARM: #include <bits/arm_asm.h> where __USE_BX__ is used
  ARM: transform the EABI/OABI choice into a boolean
  ARM: remove sub-arch/variants selection from menuconfig
  ARM: introduce blind options to select & force THUMB mode
  ARM: reorder "Use BX" option
  Fix __libc_epoll_pwait compile failure on x86
  ...

Conflicts:
	ldso/libdl/libdl.c

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Carmelo Amoroso 13 years ago
parent
commit
7682323a3a
72 changed files with 613 additions and 579 deletions
  1. 1 0
      Makefile.help
  2. 4 4
      Makefile.in
  3. 2 2
      Makerules
  4. 9 29
      Rules.mak
  5. 16 111
      extra/Configs/Config.arm
  6. 3 1
      extra/Configs/Config.in
  7. 9 0
      include/sys/socket.h
  8. 7 0
      include/unistd.h
  9. 8 0
      ldso/include/dl-defs.h
  10. 1 0
      ldso/ldso/arm/dl-startup.h
  11. 3 0
      ldso/ldso/dl-elf.c
  12. 1 1
      ldso/ldso/dl-tls.c
  13. 3 0
      ldso/ldso/x86_64/dl-startup.h
  14. 12 4
      ldso/libdl/libdl.c
  15. 3 2
      libc/inet/Makefile.in
  16. 8 0
      libc/inet/accept4.c
  17. 0 7
      libc/inet/getaddrinfo.c
  18. 3 3
      libc/inet/resolv.c
  19. 42 0
      libc/inet/socketcalls.c
  20. 16 48
      libc/misc/fts/fts.c
  21. 18 7
      libc/misc/wordexp/wordexp.c
  22. 1 0
      libc/stdlib/__uc_malloc.c
  23. 7 2
      libc/sysdeps/linux/arm/Makefile.arch
  24. 8 1
      libc/sysdeps/linux/arm/bits/arm_asm.h
  25. 2 2
      libc/sysdeps/linux/arm/bits/huge_val.h
  26. 0 2
      libc/sysdeps/linux/arm/crtn.S
  27. 1 0
      libc/sysdeps/linux/arm/sysdep.h
  28. 0 0
      libc/sysdeps/linux/arm/unwind.h
  29. 0 2
      libc/sysdeps/linux/avr32/crtn.S
  30. 5 5
      libc/sysdeps/linux/common/Makefile.in
  31. 25 0
      libc/sysdeps/linux/common/bits/kernel-features.h
  32. 52 1
      libc/sysdeps/linux/common/epoll.c
  33. 2 1
      libc/sysdeps/linux/common/getcwd.c
  34. 2 2
      libc/sysdeps/linux/common/longjmp.c
  35. 16 0
      libc/sysdeps/linux/common/pipe2.c
  36. 106 0
      libc/sysdeps/linux/common/stubs.c
  37. 59 5
      libc/sysdeps/linux/common/sys/epoll.h
  38. 0 0
      libc/sysdeps/linux/common/unwind.h
  39. 0 2
      libc/sysdeps/linux/cris/crtn.S
  40. 0 2
      libc/sysdeps/linux/frv/crtn.S
  41. 0 2
      libc/sysdeps/linux/h8300/crtn.S
  42. 0 2
      libc/sysdeps/linux/i386/crtn.S
  43. 3 1
      libc/sysdeps/linux/i386/posix_fadvise64.S
  44. 0 2
      libc/sysdeps/linux/microblaze/crtn.S
  45. 0 15
      libc/sysdeps/linux/mips/crtn.S
  46. 0 2
      libc/sysdeps/linux/powerpc/crtn.S
  47. 2 2
      libc/sysdeps/linux/sh/Makefile.arch
  48. 0 2
      libc/sysdeps/linux/sh/crtn.S
  49. 0 56
      libc/sysdeps/linux/sh/longjmp.c
  50. 0 2
      libc/sysdeps/linux/sh64/crtn.S
  51. 0 2
      libc/sysdeps/linux/sparc/crtn.S
  52. 0 2
      libc/sysdeps/linux/v850/crtn.S
  53. 0 2
      libc/sysdeps/linux/vax/crtn.S
  54. 0 2
      libc/sysdeps/linux/x86_64/crtn.S
  55. 0 110
      libc/sysdeps/linux/x86_64/sys/epoll.h
  56. 1 1
      libm/Makefile.in
  57. 1 1
      libpthread/linuxthreads.old/cancel.c
  58. 1 1
      libpthread/linuxthreads.old/pthread.c
  59. 14 1
      libpthread/linuxthreads.old/wrapsyscall.c
  60. 1 1
      libpthread/linuxthreads.old_db/td_ta_delete.c
  61. 1 1
      libpthread/linuxthreads_db/td_ta_delete.c
  62. 3 0
      libpthread/nptl/.gitignore
  63. 3 3
      libpthread/nptl/ChangeLog
  64. 7 5
      libpthread/nptl/Makefile.in
  65. 1 1
      libpthread/nptl/pthreadP.h
  66. 35 9
      libpthread/nptl/sysdeps/pthread/Makefile.in
  67. 0 24
      libpthread/nptl/sysdeps/pthread/defs.awk
  68. 4 0
      libpthread/nptl/sysdeps/pthread/pt-initfini.c
  69. 1 1
      libpthread/nptl/sysdeps/pthread/pthread_once.c
  70. 16 16
      libpthread/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
  71. 48 48
      libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h
  72. 16 16
      libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h

+ 1 - 0
Makefile.help

@@ -60,4 +60,5 @@ help:
 	@echo '			  and the include dir (usually "/usr")'
 	@echo '			  and the include dir (usually "/usr")'
 	@echo '  MULTILIB_DIR=		- Directory component for libraries (default "lib").'
 	@echo '  MULTILIB_DIR=		- Directory component for libraries (default "lib").'
 	@echo '  UCLIBC_EXTRA_CFLAGS	- extra CFLAGS for compiling uClibc'
 	@echo '  UCLIBC_EXTRA_CFLAGS	- extra CFLAGS for compiling uClibc'
+	@echo '  UCLIBC_EXTRA_CPPFLAGS	- extra CPPFLAGS for compiling uClibc'
 
 

+ 4 - 4
Makefile.in

@@ -161,7 +161,7 @@ headers-y += $(target-headers-sysdep)
 headers: $(top_builddir)include/bits/uClibc_config.h | subdirs
 headers: $(top_builddir)include/bits/uClibc_config.h | subdirs
 subdirs: $(addprefix $(top_builddir),$(subdirs))
 subdirs: $(addprefix $(top_builddir),$(subdirs))
 pregen-headers: $(top_builddir)include/bits/sysnum.h $(pregen-headers-y)
 pregen-headers: $(top_builddir)include/bits/sysnum.h $(pregen-headers-y)
-pregen: pregen-headers
+pregen: headers pregen-headers
 	$(Q)$(if $(UCLIBC_HAS_LOCALE),$(MAKE) -C extra/locale locale_headers)
 	$(Q)$(if $(UCLIBC_HAS_LOCALE),$(MAKE) -C extra/locale locale_headers)
 
 
 $(top_builddir)include/bits/sysnum.h: $(top_srcdir)extra/scripts/gen_bits_syscall_h.sh | $(top_builddir)include/bits
 $(top_builddir)include/bits/sysnum.h: $(top_srcdir)extra/scripts/gen_bits_syscall_h.sh | $(top_builddir)include/bits
@@ -338,7 +338,7 @@ else
 endif
 endif
 ifeq ($(UCLIBC_HAS_BACKTRACE),y)
 ifeq ($(UCLIBC_HAS_BACKTRACE),y)
 # Add the AS_NEEDED entry for libubacktrace.so
 # Add the AS_NEEDED entry for libubacktrace.so
-	if [ -f $(top_builddir)lib/libc.so -a -f $(PREFIX)$(RUNTIME_PREFIX)$(MULTILIB_DIR)/$(SHARED_MAJORNAME) ] ; then \
+	if [ -f $(top_builddir)lib/libc.so -a -f $(PREFIX)$(RUNTIME_PREFIX)$(MULTILIB_DIR)/$(SHARED_LIBNAME) ] ; then \
 		echo "GROUP ( $(UBACKTRACE_ASNEEDED) )" >> $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libc.so; \
 		echo "GROUP ( $(UBACKTRACE_ASNEEDED) )" >> $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libc.so; \
 	fi
 	fi
 endif
 endif
@@ -448,8 +448,8 @@ allnoconfig: $(top_builddir)extra/config/conf
 	$(Q)$(top_builddir)extra/config/conf -n extra/Configs/Config.in
 	$(Q)$(top_builddir)extra/config/conf -n extra/Configs/Config.in
 
 
 defconfig: $(top_builddir)extra/config/conf
 defconfig: $(top_builddir)extra/config/conf
-	$(Q)$(top_builddir)extra/config/conf -d extra/Configs/Config.in \
-		-D extra/Configs/defconfigs/$(ARCH)
+	$(Q)$(top_builddir)extra/config/conf \
+		-D extra/Configs/defconfigs/$(ARCH) extra/Configs/Config.in
 
 
 menuconfig-clean-y:
 menuconfig-clean-y:
 	$(Q)$(MAKE) -C extra/config CLEAN_extra/config
 	$(Q)$(MAKE) -C extra/config CLEAN_extra/config

+ 2 - 2
Makerules

@@ -233,12 +233,12 @@ cmd_compile.c = $(CC) -c $< -o $@ $(CFLAGS) \
 	$(CFLAGS-$(notdir $<)) \
 	$(CFLAGS-$(notdir $<)) \
 	$(CFLAGS-$(notdir $@)) \
 	$(CFLAGS-$(notdir $@)) \
 	$(CFLAGS_gen.dep)
 	$(CFLAGS_gen.dep)
-cmd_compile.i = $(cmd_compile.c:-c=-E -dD $(EXTRA_CPPFLAGS))
+cmd_compile.i = $(cmd_compile.c:-c=-E -dD) $(UCLIBC_EXTRA_CPPFLAGS)
 cmd_compile.s = $(cmd_compile.c:-c=-S)
 cmd_compile.s = $(cmd_compile.c:-c=-S)
 cmd_compile.u = $(CC) $^ $(DEPS-$(notdir $@)) -o $@ $(CFLAGS) $(CFLAGS-$(notdir $(^D))) $(CFLAGS-$(notdir $@)) $(CFLAGS_gen.dep)
 cmd_compile.u = $(CC) $^ $(DEPS-$(notdir $@)) -o $@ $(CFLAGS) $(CFLAGS-$(notdir $(^D))) $(CFLAGS-$(notdir $@)) $(CFLAGS_gen.dep)
 cmd_compile.S = $(filter-out -std=gnu99, $(cmd_compile.c)) -D__ASSEMBLER__ $(ASFLAGS) $(ARCH_ASFLAGS) $(ASFLAGS-$(suffix $@)) $(ASFLAGS-$(notdir $<)) $(ASFLAGS-$(notdir $@))
 cmd_compile.S = $(filter-out -std=gnu99, $(cmd_compile.c)) -D__ASSEMBLER__ $(ASFLAGS) $(ARCH_ASFLAGS) $(ASFLAGS-$(suffix $@)) $(ASFLAGS-$(notdir $<)) $(ASFLAGS-$(notdir $@))
 cmd_compile.m = $(cmd_compile.c) -DL_$(patsubst %$(suffix $(notdir $@)),%,$(notdir $@))
 cmd_compile.m = $(cmd_compile.c) -DL_$(patsubst %$(suffix $(notdir $@)),%,$(notdir $@))
-cmd_compile.mi= $(cmd_compile.m:-c=-E -dD $(EXTRA_CPPFLAGS))
+cmd_compile.mi= $(cmd_compile.m:-c=-E -dD) $(UCLIBC_EXTRA_CPPFLAGS)
 
 
 cmd_compile-m = $(CC) $^ -c -o $@ $(CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(notdir $(@D))) $(CFLAGS-$(notdir $@)) $(sort $(foreach d,$(^:$(top_srcdir)=),$(collect_multi_flags)))
 cmd_compile-m = $(CC) $^ -c -o $@ $(CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(notdir $(@D))) $(CFLAGS-$(notdir $@)) $(sort $(foreach d,$(^:$(top_srcdir)=),$(collect_multi_flags)))
 cmd_strip     = $(STRIPTOOL) $(STRIP_FLAGS) $^
 cmd_strip     = $(STRIPTOOL) $(STRIP_FLAGS) $^

+ 9 - 29
Rules.mak

@@ -105,8 +105,8 @@ export RUNTIME_PREFIX DEVEL_PREFIX KERNEL_HEADERS MULTILIB_DIR
 # Now config hard core
 # Now config hard core
 MAJOR_VERSION := 0
 MAJOR_VERSION := 0
 MINOR_VERSION := 9
 MINOR_VERSION := 9
-SUBLEVEL      := 32
-EXTRAVERSION  :=-rc3-git
+SUBLEVEL      := 33
+EXTRAVERSION  :=-git
 VERSION       := $(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL)
 VERSION       := $(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL)
 ABI_VERSION   := $(MAJOR_VERSION)
 ABI_VERSION   := $(MAJOR_VERSION)
 ifneq ($(EXTRAVERSION),)
 ifneq ($(EXTRAVERSION),)
@@ -186,6 +186,7 @@ OPTIMIZATION+=$(call check_gcc,-Os,-O2)
 OPTIMIZATION+=$(call check_gcc,-funit-at-a-time,)
 OPTIMIZATION+=$(call check_gcc,-funit-at-a-time,)
 # shrinks code by about 0.1%
 # shrinks code by about 0.1%
 OPTIMIZATION+=$(call check_gcc,-fmerge-all-constants)
 OPTIMIZATION+=$(call check_gcc,-fmerge-all-constants)
+OPTIMIZATION+=$(call check_gcc,-fstrict-aliasing)
 
 
 GCC_MAJOR_VER?=$(shell $(CC) -dumpversion | cut -d . -f 1)
 GCC_MAJOR_VER?=$(shell $(CC) -dumpversion | cut -d . -f 1)
 #GCC_MINOR_VER?=$(shell $(CC) -dumpversion | cut -d . -f 2)
 #GCC_MINOR_VER?=$(shell $(CC) -dumpversion | cut -d . -f 2)
@@ -332,28 +333,9 @@ ifeq ($(TARGET_ARCH),sparc)
 endif
 endif
 
 
 ifeq ($(TARGET_ARCH),arm)
 ifeq ($(TARGET_ARCH),arm)
-	OPTIMIZATION+=-fstrict-aliasing
 	CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN)+=-mlittle-endian
 	CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN)+=-mlittle-endian
 	CPU_CFLAGS-$(ARCH_BIG_ENDIAN)+=-mbig-endian
 	CPU_CFLAGS-$(ARCH_BIG_ENDIAN)+=-mbig-endian
-	CPU_CFLAGS-$(CONFIG_GENERIC_ARM)+=
-	CPU_CFLAGS-$(CONFIG_ARM610)+=-mtune=arm610 -march=armv3
-	CPU_CFLAGS-$(CONFIG_ARM710)+=-mtune=arm710 -march=armv3
-	CPU_CFLAGS-$(CONFIG_ARM7TDMI)+=-mtune=arm7tdmi -march=armv4t
-	CPU_CFLAGS-$(CONFIG_ARM720T)+=-mtune=arm7tdmi -march=armv4t
-	CPU_CFLAGS-$(CONFIG_ARM920T)+=-mtune=arm9tdmi -march=armv4t
-	CPU_CFLAGS-$(CONFIG_ARM922T)+=-mtune=arm9tdmi -march=armv4t
-	CPU_CFLAGS-$(CONFIG_ARM926T)+=-mtune=arm9e -march=armv5te
-	CPU_CFLAGS-$(CONFIG_ARM10T)+=-mtune=arm10tdmi -march=armv5t
-	CPU_CFLAGS-$(CONFIG_ARM1136JF_S)+=-mtune=arm1136jf-s -march=armv6
-	CPU_CFLAGS-$(CONFIG_ARM1176JZ_S)+=-mtune=arm1176jz-s -march=armv6
-	CPU_CFLAGS-$(CONFIG_ARM1176JZF_S)+=-mtune=arm1176jzf-s -march=armv6
-	CPU_CFLAGS-$(CONFIG_ARM_SA110)+=-mtune=strongarm110 -march=armv4
-	CPU_CFLAGS-$(CONFIG_ARM_SA1100)+=-mtune=strongarm1100 -march=armv4
-	CPU_CFLAGS-$(CONFIG_ARM_XSCALE)+=$(call check_gcc,-mtune=xscale,-mtune=strongarm110)
-	CPU_CFLAGS-$(CONFIG_ARM_XSCALE)+=-march=armv5te -Wa,-mcpu=xscale
- 	CPU_CFLAGS-$(CONFIG_ARM_IWMMXT)+=-march=iwmmxt -Wa,-mcpu=iwmmxt -mabi=iwmmxt
- 	CPU_CFLAGS-$(CONFIG_ARM_CORTEX_M3)+=-mcpu=cortex-m3 -mthumb
- 	CPU_CFLAGS-$(CONFIG_ARM_CORTEX_M1)+=-mcpu=cortex-m1 -mthumb
+	CPU_CFLAGS-$(COMPILE_IN_THUMB_MODE)+=-mthumb
 endif
 endif
 
 
 ifeq ($(TARGET_ARCH),mips)
 ifeq ($(TARGET_ARCH),mips)
@@ -385,7 +367,6 @@ ifeq ($(TARGET_ARCH),nios)
 endif
 endif
 
 
 ifeq ($(TARGET_ARCH),sh)
 ifeq ($(TARGET_ARCH),sh)
-	OPTIMIZATION+=-fstrict-aliasing
 	OPTIMIZATION+= $(call check_gcc,-mprefergot,)
 	OPTIMIZATION+= $(call check_gcc,-mprefergot,)
 	CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN)+=-ml
 	CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN)+=-ml
 	CPU_CFLAGS-$(ARCH_BIG_ENDIAN)+=-mb
 	CPU_CFLAGS-$(ARCH_BIG_ENDIAN)+=-mb
@@ -401,7 +382,6 @@ endif
 endif
 endif
 
 
 ifeq ($(TARGET_ARCH),sh64)
 ifeq ($(TARGET_ARCH),sh64)
-	OPTIMIZATION+=-fstrict-aliasing
 	CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN):=-ml
 	CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN):=-ml
 	CPU_CFLAGS-$(ARCH_BIG_ENDIAN):=-mb
 	CPU_CFLAGS-$(ARCH_BIG_ENDIAN):=-mb
 	CPU_CFLAGS-$(CONFIG_SH5)+=-m5-32media
 	CPU_CFLAGS-$(CONFIG_SH5)+=-m5-32media
@@ -546,10 +526,10 @@ endif
 endif
 endif
 
 
 # Add a bunch of extra pedantic annoyingly strict checks
 # Add a bunch of extra pedantic annoyingly strict checks
-XWARNINGS=$(call qstrip,$(WARNINGS)) 
+XWARNINGS=$(call qstrip,$(WARNINGS))
 XWARNINGS+=$(foreach w,\
 XWARNINGS+=$(foreach w,\
 	-Wstrict-prototypes \
 	-Wstrict-prototypes \
-	-fno-strict-aliasing \
+	-Wstrict-aliasing \
 	, $(call check_gcc,$(w),))
 	, $(call check_gcc,$(w),))
 ifeq ($(EXTRA_WARNINGS),y)
 ifeq ($(EXTRA_WARNINGS),y)
 XWARNINGS+=$(foreach w,\
 XWARNINGS+=$(foreach w,\
@@ -587,9 +567,6 @@ CFLAGS := -include $(top_srcdir)include/libc-symbols.h \
 	-nostdinc -I$(top_builddir)include -I$(top_srcdir)include -I. \
 	-nostdinc -I$(top_builddir)include -I$(top_srcdir)include -I. \
 	-I$(top_srcdir)libc/sysdeps/linux \
 	-I$(top_srcdir)libc/sysdeps/linux \
 	-I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)
 	-I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)
-ifneq ($(strip $(UCLIBC_EXTRA_CFLAGS)),"")
-CFLAGS += $(call qstrip,$(UCLIBC_EXTRA_CFLAGS))
-endif
 
 
 # We need this to be checked within libc-symbols.h
 # We need this to be checked within libc-symbols.h
 ifneq ($(HAVE_SHARED),y)
 ifneq ($(HAVE_SHARED),y)
@@ -635,6 +612,9 @@ LDFLAGS += -Wl,-s
 else
 else
 STRIPTOOL := true -Stripping_disabled
 STRIPTOOL := true -Stripping_disabled
 endif
 endif
+ifneq ($(strip $(UCLIBC_EXTRA_CFLAGS)),"")
+CFLAGS += $(call qstrip,$(UCLIBC_EXTRA_CFLAGS))
+endif
 
 
 ifeq ($(DOMULTI),y)
 ifeq ($(DOMULTI),y)
 # we try to compile all sources at once into an object (IMA), but
 # we try to compile all sources at once into an object (IMA), but

+ 16 - 111
extra/Configs/Config.arm

@@ -12,122 +12,27 @@ config FORCE_OPTIONS_FOR_ARCH
 	default y
 	default y
 	select ARCH_ANY_ENDIAN
 	select ARCH_ANY_ENDIAN
 
 
-choice
-	prompt "Target ABI"
-	default CONFIG_ARM_EABI
+config CONFIG_ARM_EABI
+	bool "Build for EABI"
 	help
 	help
-	  If you choose "EABI" here, functions and constants required by the
-	  ARM EABI will be built into the library.  You should choose "EABI"
+	  If you say 'y' here, functions and constants required by the
+	  ARM EABI will be built into the library.  You should say 'y'
 	  if your compiler uses the ARM EABI, in which case you will also
 	  if your compiler uses the ARM EABI, in which case you will also
-	  need a kernel supporting the EABI system call interface, or "OABI"
-	  for a compiler using the old Linux ABI.
-
-config CONFIG_ARM_OABI
-	bool "OABI"
+	  need a kernel supporting the EABI system call interface.
 
 
-config CONFIG_ARM_EABI
-	bool "EABI"
+	  If you say 'n' here, then the library will be built for the
+	  old Linux ABI.
 
 
-endchoice
+config COMPILE_IN_THUMB_MODE
+	bool "Build using Thumb mode"
+	select USE_BX
+	help
+	  Say 'y' here to force building uClibc in thumb mode.
+	  Say 'n' to use your compiler's default mode.
 
 
 config USE_BX
 config USE_BX
 	bool "Use BX in function return"
 	bool "Use BX in function return"
-	default y
-	depends on !CONFIG_GENERIC_ARM && !CONFIG_ARM610 && !CONFIG_ARM710
-	help
-	  Use BX instruction for THUMB aware architectures.
-
-choice
-	prompt "Target Processor Type"
-	default CONFIG_GENERIC_ARM
 	help
 	help
-	  This is the processor type of your CPU. This information is used for
-	  optimizing purposes.  To build a library that will run on all ARMCPU
-	  types (albeit not optimally fast), you can specify "Generic Arm" here.
-	  If you pick anything other than "Generic Arm", there is no guarantee 
-	  that uClibc will even run on anything other than the selected
-	  processor type.
-
-	  Here are the settings recommended for greatest speed:
-	  - "Generic Arm" select this if your compiler is already setup to
-	    optimize things properly, or if you want to run on pretty much
-	    everything, or you just don't much care.
-	  - For anything else, pick the ARM core type that best matches the
-	    cpu you will be using on your device.
-
-	  If you don't know what to do, choose "Generic Arm".
-
-config CONFIG_GENERIC_ARM
-	bool "Generic Arm"
-
-config CONFIG_ARM610
-	bool "Arm 610"
-	select ARCH_HAS_MMU
-
-config CONFIG_ARM710
-	bool "Arm 710"
-	select ARCH_HAS_MMU
-
-config CONFIG_ARM7TDMI
-	bool "Arm 7TDMI"
-	select ARCH_HAS_NO_MMU
-
-config CONFIG_ARM720T
-	bool "Arm 720T"
-	select ARCH_HAS_MMU
-
-config CONFIG_ARM920T
-	bool "Arm 920T"
-	select ARCH_HAS_MMU
-
-config CONFIG_ARM922T
-	bool "Arm 922T"
-	select ARCH_HAS_MMU
-
-config CONFIG_ARM926T
-	bool "Arm 926T"
-	select ARCH_HAS_MMU
-
-config CONFIG_ARM10T
-	bool "Arm 10T"
-	select ARCH_HAS_MMU
-
-config CONFIG_ARM1136JF_S
-	bool "Arm 1136JF-S"
-	select ARCH_HAS_MMU
-
-config CONFIG_ARM1176JZ_S
-	bool "Arm 1176JZ-S"
-	select ARCH_HAS_MMU
-
-config CONFIG_ARM1176JZF_S
-	bool "Arm 1176JZF-S"
-	select ARCH_HAS_MMU
-
-config CONFIG_ARM_CORTEX_M3
-	bool "Arm Cortex-M3"
-	select ARCH_HAS_NO_MMU
-	select USE_BX
-
-config CONFIG_ARM_CORTEX_M1
-	bool "Arm Cortex-M1"
-	select ARCH_HAS_NO_MMU
-	select USE_BX
-
-config CONFIG_ARM_SA110
-	bool "Intel StrongArm SA-110"
-	select ARCH_HAS_MMU
-
-config CONFIG_ARM_SA1100
-	bool "Intel StrongArm SA-1100"
-	select ARCH_HAS_MMU
-
-config CONFIG_ARM_XSCALE
-	bool "Intel Xscale"
-	select ARCH_HAS_MMU
-
-config CONFIG_ARM_IWMMXT
-	bool "Intel Xscale With WMMX PXA27x"
-	select ARCH_HAS_MMU
-
-endchoice
+	  Say 'y' to use BX to return from functions on your thumb-aware
+	  processor. Say 'y' if you need to use interworking. Say 'n' if not.
+	  It is safe to say 'y' even if you're not doing interworking.

+ 3 - 1
extra/Configs/Config.in

@@ -942,8 +942,10 @@ config UCLIBC_LINUX_SPECIFIC
 	bool "Linux specific functions"
 	bool "Linux specific functions"
 	default y
 	default y
 	help
 	help
+	  accept4(),
 	  capget(), capset(), fstatfs(), inotify_*(), ioperm(), iopl(),
 	  capget(), capset(), fstatfs(), inotify_*(), ioperm(), iopl(),
-	  madvise(), modify_ldt(), personality(), prctl()/arch_prctl(),
+	  madvise(), modify_ldt(), pipe2(), personality(),
+	  prctl()/arch_prctl(),
 	  ppoll(), readahead(), reboot(), remap_file_pages(),
 	  ppoll(), readahead(), reboot(), remap_file_pages(),
 	  sched_getaffinity(), sched_setaffinity(), sendfile(),
 	  sched_getaffinity(), sched_setaffinity(), sendfile(),
 	  setfsgid(), setfsuid(), setresuid(),
 	  setfsgid(), setfsuid(), setresuid(),

+ 9 - 0
include/sys/socket.h

@@ -227,6 +227,15 @@ extern int accept (int __fd, __SOCKADDR_ARG __addr,
 		   socklen_t *__restrict __addr_len);
 		   socklen_t *__restrict __addr_len);
 libc_hidden_proto(accept)
 libc_hidden_proto(accept)
 
 
+#if defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU
+/* Similar to 'accept' but takes an additional parameter to specify flags.
+
+   This function is a cancellation point and therefore not marked with
+   __THROW.  */
+extern int accept4 (int __fd, __SOCKADDR_ARG __addr,
+		    socklen_t *__restrict __addr_len, int __flags);
+#endif
+
 /* Shut down all or part of the connection open on socket FD.
 /* Shut down all or part of the connection open on socket FD.
    HOW determines what to shut down:
    HOW determines what to shut down:
      SHUT_RD   = No more receptions;
      SHUT_RD   = No more receptions;

+ 7 - 0
include/unistd.h

@@ -389,6 +389,13 @@ extern ssize_t pwrite64 (int __fd, __const void *__buf, size_t __n,
 extern int pipe (int __pipedes[2]) __THROW __wur;
 extern int pipe (int __pipedes[2]) __THROW __wur;
 libc_hidden_proto(pipe)
 libc_hidden_proto(pipe)
 
 
+#if defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU
+/* Same as pipe but apply flags passed in FLAGS to the new file
+   descriptors.  */
+extern int pipe2 (int __pipedes[2], int __flags) __THROW __wur;
+libc_hidden_proto(pipe2)
+#endif
+
 /* Schedule an alarm.  In SECONDS seconds, the process will get a SIGALRM.
 /* Schedule an alarm.  In SECONDS seconds, the process will get a SIGALRM.
    If SECONDS is zero, any currently scheduled alarm will be cancelled.
    If SECONDS is zero, any currently scheduled alarm will be cancelled.
    The function returns the number of seconds remaining until the last
    The function returns the number of seconds remaining until the last

+ 8 - 0
ldso/include/dl-defs.h

@@ -179,6 +179,14 @@ typedef struct {
 #define DL_LOOKUP_ADDRESS(ADDRESS) (ADDRESS)
 #define DL_LOOKUP_ADDRESS(ADDRESS) (ADDRESS)
 #endif
 #endif
 
 
+/* On some architectures dladdr can't use st_size of all symbols this way.  */
+#define DL_ADDR_SYM_MATCH(SYM_ADDR, SYM, MATCHSYM, ADDR)				\
+  ((ADDR) >= (SYM_ADDR)													\
+   && ((((SYM)->st_shndx == SHN_UNDEF || (SYM)->st_size == 0)			\
+        && (ADDR) == (SYM_ADDR))										\
+       || (ADDR) < (SYM_ADDR) + (SYM)->st_size)							\
+   && (!(MATCHSYM) || MATCHSYM < (SYM_ADDR)))
+
 /* Use this macro to convert a pointer to a function's entry point to
 /* Use this macro to convert a pointer to a function's entry point to
  * a pointer to function.  The pointer is assumed to have already been
  * a pointer to function.  The pointer is assumed to have already been
  * relocated.  LOADADDR is passed because it may contain additional
  * relocated.  LOADADDR is passed because it may contain additional

+ 1 - 0
ldso/ldso/arm/dl-startup.h

@@ -7,6 +7,7 @@
  */
  */
 
 
 #include <features.h>
 #include <features.h>
+#include <bits/arm_asm.h>
 
 
 #if !defined(__thumb__)
 #if !defined(__thumb__)
 __asm__(
 __asm__(

+ 3 - 0
ldso/ldso/dl-elf.c

@@ -718,6 +718,9 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure,
 				DL_UPDATE_LOADADDR_HDR(lib_loadaddr,
 				DL_UPDATE_LOADADDR_HDR(lib_loadaddr,
 						       new_addr + (ppnt->p_vaddr & ADDR_ALIGN),
 						       new_addr + (ppnt->p_vaddr & ADDR_ALIGN),
 						       ppnt);
 						       ppnt);
+				/* This has invalidated all pointers into the previously readonly segment.
+				   Update any them to point into the remapped segment.  */
+				_dl_parse_dynamic_info(dpnt, dynamic_info, NULL, lib_loadaddr);
 #endif
 #endif
 			}
 			}
 		}
 		}

+ 1 - 1
ldso/ldso/dl-tls.c

@@ -1025,7 +1025,7 @@ init_tls (void)
 
 
 	/* And finally install it for the main thread.  If ld.so itself uses
 	/* And finally install it for the main thread.  If ld.so itself uses
 	   TLS we know the thread pointer was initialized earlier.  */
 	   TLS we know the thread pointer was initialized earlier.  */
-	const char *lossage = TLS_INIT_TP (tcbp, USE___THREAD);
+	const char *lossage = (char *)TLS_INIT_TP (tcbp, USE___THREAD);
 	if(__builtin_expect (lossage != NULL, 0)) {
 	if(__builtin_expect (lossage != NULL, 0)) {
 		_dl_debug_early("cannot set up thread-local storage: %s\n", lossage);
 		_dl_debug_early("cannot set up thread-local storage: %s\n", lossage);
 		_dl_exit(30);
 		_dl_exit(30);

+ 3 - 0
ldso/ldso/x86_64/dl-startup.h

@@ -58,6 +58,9 @@ void PERFORM_BOOTSTRAP_RELOC(ELF_RELOC *rpnt, ElfW(Addr) *reloc_addr,
 		case R_X86_64_TPOFF64:
 		case R_X86_64_TPOFF64:
 			*reloc_addr = sym->st_value + rpnt->r_addend - symbol_addr;
 			*reloc_addr = sym->st_value + rpnt->r_addend - symbol_addr;
 			break;
 			break;
+/*TODO:		case R_X86_64_RELATIVE:
+			*reloc_addr = load_addr + rpnt->r_addend;
+			break; */
 		default:
 		default:
 			_dl_exit(1);
 			_dl_exit(1);
 	}
 	}

+ 12 - 4
ldso/libdl/libdl.c

@@ -706,12 +706,12 @@ void *dlsym(void *vhandle, const char *name)
 	tpnt = NULL;
 	tpnt = NULL;
 	if (handle == _dl_symbol_tables)
 	if (handle == _dl_symbol_tables)
 		tpnt = handle->dyn; /* Only search RTLD_GLOBAL objs if global object */
 		tpnt = handle->dyn; /* Only search RTLD_GLOBAL objs if global object */
-	ret = _dl_find_hash(name2, &handle->dyn->symbol_scope, tpnt, 0, &sym_ref);
+	ret = _dl_find_hash(name2, &handle->dyn->symbol_scope, tpnt, ELF_RTYPE_CLASS_DLSYM, &sym_ref);
 
 
 #if defined(USE_TLS) && USE_TLS && defined SHARED
 #if defined(USE_TLS) && USE_TLS && defined SHARED
 	if (sym_ref.sym && (ELF_ST_TYPE(sym_ref.sym->st_info) == STT_TLS) && (sym_ref.tpnt)) {
 	if (sym_ref.sym && (ELF_ST_TYPE(sym_ref.sym->st_info) == STT_TLS) && (sym_ref.tpnt)) {
 		/* The found symbol is a thread-local storage variable.
 		/* The found symbol is a thread-local storage variable.
-		Return the address for to the current thread.  */
+		Return its address for the current thread.  */
 		ret = _dl_tls_symaddr ((struct link_map *)sym_ref.tpnt, (Elf32_Addr)ret);
 		ret = _dl_tls_symaddr ((struct link_map *)sym_ref.tpnt, (Elf32_Addr)ret);
 	}
 	}
 #endif
 #endif
@@ -1118,7 +1118,11 @@ int dladdr(const void *__address, Dl_info * __info)
 					ElfW(Addr) symbol_addr;
 					ElfW(Addr) symbol_addr;
 
 
 					symbol_addr = (ElfW(Addr)) DL_RELOC_ADDR(pelf->loadaddr, symtab[si].st_value);
 					symbol_addr = (ElfW(Addr)) DL_RELOC_ADDR(pelf->loadaddr, symtab[si].st_value);
-					if (symbol_addr <= (ElfW(Addr))__address && (!sf || sa < symbol_addr)) {
+					if ((symtab[si].st_shndx != SHN_UNDEF
+						 || symtab[si].st_value != 0)
+						&& ELF_ST_TYPE(symtab[si].st_info) != STT_TLS
+						&& DL_ADDR_SYM_MATCH(symbol_addr, &symtab[si], sa,
+											 (ElfW(Addr)) __address)) {
 						sa = symbol_addr;
 						sa = symbol_addr;
 						sn = si;
 						sn = si;
 						sf = 1;
 						sf = 1;
@@ -1134,7 +1138,11 @@ int dladdr(const void *__address, Dl_info * __info)
 				ElfW(Addr) symbol_addr;
 				ElfW(Addr) symbol_addr;
 
 
 				symbol_addr = (ElfW(Addr)) DL_RELOC_ADDR(pelf->loadaddr, symtab[si].st_value);
 				symbol_addr = (ElfW(Addr)) DL_RELOC_ADDR(pelf->loadaddr, symtab[si].st_value);
-				if (symbol_addr <= (ElfW(Addr))__address && (!sf || sa < symbol_addr)) {
+				if ((symtab[si].st_shndx != SHN_UNDEF
+					 || symtab[si].st_value != 0)
+					&& ELF_ST_TYPE(symtab[si].st_info) != STT_TLS
+					&& DL_ADDR_SYM_MATCH(symbol_addr, &symtab[si], sa,
+										 (ElfW(Addr)) __address)) {
 					sa = symbol_addr;
 					sa = symbol_addr;
 					sn = si;
 					sn = si;
 					sf = 1;
 					sf = 1;

+ 3 - 2
libc/inet/Makefile.in

@@ -44,11 +44,12 @@ CSRC-$(findstring y,$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6)) += \
 ## CSRC-y += encodep.c decodep.c formquery.c
 ## CSRC-y += encodep.c decodep.c formquery.c
 
 
 # multi source socketcalls.c
 # multi source socketcalls.c
-socketcalls_CSRC += \
+socketcalls_CSRC-y += \
 	accept.c bind.c connect.c getpeername.c getsockname.c \
 	accept.c bind.c connect.c getpeername.c getsockname.c \
 	getsockopt.c listen.c recv.c recvfrom.c recvmsg.c send.c sendmsg.c \
 	getsockopt.c listen.c recv.c recvfrom.c recvmsg.c send.c sendmsg.c \
 	sendto.c setsockopt.c shutdown.c socket.c socketpair.c
 	sendto.c setsockopt.c shutdown.c socket.c socketpair.c
-CSRC-$(UCLIBC_HAS_SOCKET) += $(socketcalls_CSRC) opensock.c
+socketcalls_CSRC-$(UCLIBC_LINUX_SPECIFIC) += accept4.c
+CSRC-$(UCLIBC_HAS_SOCKET) += $(socketcalls_CSRC-y) opensock.c
 
 
 CSRC-$(findstring y,$(UCLIBC_HAS_SOCKET)$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6)) += ethers.c ether_addr.c
 CSRC-$(findstring y,$(UCLIBC_HAS_SOCKET)$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6)) += ethers.c ether_addr.c
 
 

+ 8 - 0
libc/inet/accept4.c

@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_accept4
+#include "socketcalls.c"

+ 0 - 7
libc/inet/getaddrinfo.c

@@ -820,13 +820,6 @@ getaddrinfo(const char *name, const char *service,
 			if (hints->ai_flags & AI_NUMERICSERV)
 			if (hints->ai_flags & AI_NUMERICSERV)
 				return EAI_NONAME;
 				return EAI_NONAME;
 			gaih_service.num = -1;
 			gaih_service.num = -1;
-		} else {
-			/*
-			 * Can't specify a numerical socket unless a protocol
-			 * family was given.
-			 */
-			if (hints->ai_socktype == 0 && hints->ai_protocol == 0)
-				return EAI_SERVICE;
 		}
 		}
 		pservice = &gaih_service;
 		pservice = &gaih_service;
 	} else
 	} else

+ 3 - 3
libc/inet/resolv.c

@@ -1461,7 +1461,7 @@ int attribute_hidden __dns_lookup(const char *name,
 		/* bug 660 says we treat negative response as an error
 		/* bug 660 says we treat negative response as an error
 		 * and retry, which is, eh, an error. :)
 		 * and retry, which is, eh, an error. :)
 		 * We were incurring long delays because of this. */
 		 * We were incurring long delays because of this. */
-		if (h.rcode == NXDOMAIN) {
+		if (h.rcode == NXDOMAIN || h.rcode == SERVFAIL) {
 			/* if possible, try next search domain */
 			/* if possible, try next search domain */
 			if (!ends_with_dot) {
 			if (!ends_with_dot) {
 				DPRINTF("variant:%d sdomains:%d\n", variant, sdomains);
 				DPRINTF("variant:%d sdomains:%d\n", variant, sdomains);
@@ -2964,7 +2964,7 @@ int res_init(void)
 		if (__nameserver[i].sa.sa_family == AF_INET6
 		if (__nameserver[i].sa.sa_family == AF_INET6
 		 && m < ARRAY_SIZE(rp->_u._ext.nsaddrs)
 		 && m < ARRAY_SIZE(rp->_u._ext.nsaddrs)
 		) {
 		) {
-			struct sockaddr_in6 *sa6 = malloc(sizeof(sa6));
+			struct sockaddr_in6 *sa6 = malloc(sizeof(*sa6));
 			if (sa6) {
 			if (sa6) {
 				*sa6 = __nameserver[i].sa6; /* struct copy */
 				*sa6 = __nameserver[i].sa6; /* struct copy */
 				rp->_u._ext.nsaddrs[m] = sa6;
 				rp->_u._ext.nsaddrs[m] = sa6;
@@ -2981,7 +2981,7 @@ int res_init(void)
 
 
 #else /* IPv6 only */
 #else /* IPv6 only */
 	while (m < ARRAY_SIZE(rp->_u._ext.nsaddrs) && i < __nameservers) {
 	while (m < ARRAY_SIZE(rp->_u._ext.nsaddrs) && i < __nameservers) {
-		struct sockaddr_in6 *sa6 = malloc(sizeof(sa6));
+		struct sockaddr_in6 *sa6 = malloc(sizeof(*sa6));
 		if (sa6) {
 		if (sa6) {
 			*sa6 = __nameserver[i].sa6; /* struct copy */
 			*sa6 = __nameserver[i].sa6; /* struct copy */
 			rp->_u._ext.nsaddrs[m] = sa6;
 			rp->_u._ext.nsaddrs[m] = sa6;

+ 42 - 0
libc/inet/socketcalls.c

@@ -31,6 +31,7 @@ extern int __socketcall(int call, unsigned long *args) attribute_hidden;
 #define SYS_GETSOCKOPT  15
 #define SYS_GETSOCKOPT  15
 #define SYS_SENDMSG     16
 #define SYS_SENDMSG     16
 #define SYS_RECVMSG     17
 #define SYS_RECVMSG     17
+#define SYS_ACCEPT4     18
 #endif
 #endif
 
 
 #ifdef __UCLIBC_HAS_THREADS_NATIVE__
 #ifdef __UCLIBC_HAS_THREADS_NATIVE__
@@ -82,6 +83,46 @@ weak_alias(__libc_accept,accept)
 libc_hidden_weak(accept)
 libc_hidden_weak(accept)
 #endif
 #endif
 
 
+#ifdef L_accept4
+#ifdef __NR_accept4
+# define __NR___sys_accept4  __NR_accept4
+static _syscall4(int, __sys_accept4, int, fd, struct sockaddr *, addr, socklen_t *, addrlen, int, flags)
+int accept4(int fd, struct sockaddr *addr, socklen_t * addrlen, int flags)
+{
+	if (SINGLE_THREAD_P)
+		return __sys_accept4(fd, addr, addrlen, flags);
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+	else {
+		int oldtype = LIBC_CANCEL_ASYNC ();
+		int result = __sys_accept4(fd, addr, addrlen, flags);
+		LIBC_CANCEL_RESET (oldtype);
+		return result;
+	}
+#endif
+}
+#elif defined(__NR_socketcall)
+int accept4(int fd, struct sockaddr *addr, socklen_t *addrlen, int flags)
+{
+	unsigned long args[4];
+
+	args[0] = fd;
+	args[1] = (unsigned long) addr;
+	args[2] = (unsigned long) addrlen;
+	args[3] = flags;
+	if (SINGLE_THREAD_P)
+		return __socketcall(SYS_ACCEPT4, args);
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+	else {
+		int oldtype = LIBC_CANCEL_ASYNC ();
+		int result = __socketcall(SYS_ACCEPT4, args);
+		LIBC_CANCEL_RESET (oldtype);
+		return result;
+	}
+#endif
+}
+#endif
+#endif
+
 #ifdef L_bind
 #ifdef L_bind
 #ifdef __NR_bind
 #ifdef __NR_bind
 _syscall3(int, bind, int, sockfd, const struct sockaddr *, myaddr, socklen_t, addrlen)
 _syscall3(int, bind, int, sockfd, const struct sockaddr *, myaddr, socklen_t, addrlen)
@@ -560,3 +601,4 @@ int socketpair(int family, int type, int protocol, int sockvec[2])
 }
 }
 #endif
 #endif
 #endif
 #endif
+

+ 16 - 48
libc/misc/fts/fts.c

@@ -87,10 +87,8 @@ static int      fts_safe_changedir (FTS *, FTSENT *, int, const char *)
 #define	BREAD		3		/* fts_read */
 #define	BREAD		3		/* fts_read */
 
 
 FTS *
 FTS *
-fts_open(argv, options, compar)
-	char * const *argv;
-	register int options;
-	int (*compar) (const FTSENT **, const FTSENT **);
+fts_open( char * const *argv, register int options,
+		int (*compar) (const FTSENT **, const FTSENT **))
 {
 {
 	register FTS *sp;
 	register FTS *sp;
 	register FTSENT *p, *root;
 	register FTSENT *p, *root;
@@ -204,9 +202,7 @@ mem1:	free(sp);
 
 
 static void
 static void
 internal_function
 internal_function
-fts_load(sp, p)
-	FTS *sp;
-	register FTSENT *p;
+fts_load(FTS *sp, register FTSENT *p)
 {
 {
 	register int len;
 	register int len;
 	register char *cp;
 	register char *cp;
@@ -230,8 +226,7 @@ fts_load(sp, p)
 }
 }
 
 
 int
 int
-fts_close(sp)
-	FTS *sp;
+fts_close(FTS *sp)
 {
 {
 	register FTSENT *freep, *p;
 	register FTSENT *freep, *p;
 	int saved_errno;
 	int saved_errno;
@@ -284,8 +279,7 @@ fts_close(sp)
 	    ? p->fts_pathlen - 1 : p->fts_pathlen)
 	    ? p->fts_pathlen - 1 : p->fts_pathlen)
 
 
 FTSENT *
 FTSENT *
-fts_read(sp)
-	register FTS *sp;
+fts_read(register FTS *sp)
 {
 {
 	register FTSENT *p, *tmp;
 	register FTSENT *p, *tmp;
 	register int instr;
 	register int instr;
@@ -481,10 +475,7 @@ name:		t = sp->fts_path + NAPPEND(p->fts_parent);
  */
  */
 /* ARGSUSED */
 /* ARGSUSED */
 int
 int
-fts_set(sp, p, instr)
-	FTS *sp;
-	FTSENT *p;
-	int instr;
+fts_set(FTS *sp, FTSENT *p, int instr)
 {
 {
 	if (instr != 0 && instr != FTS_AGAIN && instr != FTS_FOLLOW &&
 	if (instr != 0 && instr != FTS_AGAIN && instr != FTS_FOLLOW &&
 	    instr != FTS_NOINSTR && instr != FTS_SKIP) {
 	    instr != FTS_NOINSTR && instr != FTS_SKIP) {
@@ -496,9 +487,7 @@ fts_set(sp, p, instr)
 }
 }
 
 
 FTSENT *
 FTSENT *
-fts_children(sp, instr)
-	register FTS *sp;
-	int instr;
+fts_children(register FTS *sp, int instr)
 {
 {
 	register FTSENT *p;
 	register FTSENT *p;
 	int fd;
 	int fd;
@@ -579,9 +568,7 @@ fts_children(sp, instr)
  */
  */
 static FTSENT *
 static FTSENT *
 internal_function
 internal_function
-fts_build(sp, type)
-	register FTS *sp;
-	int type;
+fts_build(register FTS *sp, int type)
 {
 {
 	register struct dirent *dp;
 	register struct dirent *dp;
 	register FTSENT *p, *head;
 	register FTSENT *p, *head;
@@ -851,10 +838,7 @@ mem1:				saved_errno = errno;
 
 
 static u_short
 static u_short
 internal_function
 internal_function
-fts_stat(sp, p, follow)
-	FTS *sp;
-	register FTSENT *p;
-	int follow;
+fts_stat(FTS *sp, register FTSENT *p, int follow)
 {
 {
 	register FTSENT *t;
 	register FTSENT *t;
 	register dev_t dev;
 	register dev_t dev;
@@ -935,10 +919,7 @@ err:		memset(sbp, 0, sizeof(struct stat));
 
 
 static FTSENT *
 static FTSENT *
 internal_function
 internal_function
-fts_sort(sp, head, nitems)
-	FTS *sp;
-	FTSENT *head;
-	register int nitems;
+fts_sort(FTS *sp, FTSENT *head, register int nitems)
 {
 {
 	register FTSENT **ap, *p;
 	register FTSENT **ap, *p;
 
 
@@ -973,10 +954,7 @@ fts_sort(sp, head, nitems)
 
 
 static FTSENT *
 static FTSENT *
 internal_function
 internal_function
-fts_alloc(sp, name, namelen)
-	FTS *sp;
-	const char *name;
-	size_t namelen;
+fts_alloc(FTS *sp, const char *name, size_t namelen)
 {
 {
 	register FTSENT *p;
 	register FTSENT *p;
 	size_t len;
 	size_t len;
@@ -1013,8 +991,7 @@ fts_alloc(sp, name, namelen)
 
 
 static void
 static void
 internal_function
 internal_function
-fts_lfree(head)
-	register FTSENT *head;
+fts_lfree(register FTSENT *head)
 {
 {
 	register FTSENT *p;
 	register FTSENT *p;
 
 
@@ -1033,9 +1010,7 @@ fts_lfree(head)
  */
  */
 static int
 static int
 internal_function
 internal_function
-fts_palloc(sp, more)
-	FTS *sp;
-	size_t more;
+fts_palloc(FTS *sp, size_t more)
 {
 {
 	char *p;
 	char *p;
 
 
@@ -1067,9 +1042,7 @@ fts_palloc(sp, more)
  */
  */
 static void
 static void
 internal_function
 internal_function
-fts_padjust(sp, head)
-	FTS *sp;
-	FTSENT *head;
+fts_padjust(FTS *sp, FTSENT *head)
 {
 {
 	FTSENT *p;
 	FTSENT *p;
 	char *addr = sp->fts_path;
 	char *addr = sp->fts_path;
@@ -1094,8 +1067,7 @@ fts_padjust(sp, head)
 
 
 static size_t
 static size_t
 internal_function
 internal_function
-fts_maxarglen(argv)
-	char * const *argv;
+fts_maxarglen(char * const *argv)
 {
 {
 	size_t len, max;
 	size_t len, max;
 
 
@@ -1112,11 +1084,7 @@ fts_maxarglen(argv)
  */
  */
 static int
 static int
 internal_function
 internal_function
-fts_safe_changedir(sp, p, fd, path)
-	FTS *sp;
-	FTSENT *p;
-	int fd;
-	const char *path;
+fts_safe_changedir(FTS *sp, FTSENT *p, int fd, const char *path)
 {
 {
 	int ret, oerrno, newfd;
 	int ret, oerrno, newfd;
 	struct stat64 sb;
 	struct stat64 sb;

+ 18 - 7
libc/misc/wordexp/wordexp.c

@@ -20,6 +20,7 @@
    Boston, MA 02111-1307, USA.  */
    Boston, MA 02111-1307, USA.  */
 
 
 #include <features.h>
 #include <features.h>
+#include <bits/kernel-features.h>
 #include <sys/types.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <sys/wait.h>
 #include <fcntl.h>
 #include <fcntl.h>
@@ -757,16 +758,21 @@ exec_comm_child(char *comm, int *fildes, int showerr, int noexec)
 
 
 	/* Redirect output.  */
 	/* Redirect output.  */
 	fd = fildes[1];
 	fd = fildes[1];
-	if (fd != 1) {
-		dup2(fd, 1);
+	if (likely(fd != STDOUT_FILENO)) {
+		dup2(fd, STDOUT_FILENO);
 		close(fd);
 		close(fd);
 	}
 	}
-
+#if defined O_CLOEXEC && defined __UCLIBC_LINUX_SPECIFIC__ && defined __ASSUME_PIPE2
+	else {
+		/* Reset the close-on-exec flag (if necessary).  */
+		fcntl (fd, F_SETFD, 0);
+	}
+#endif
 	/* Redirect stderr to /dev/null if we have to.  */
 	/* Redirect stderr to /dev/null if we have to.  */
 	if (showerr == 0) {
 	if (showerr == 0) {
-		close(2);
+		close(STDERR_FILENO);
 		fd = open(_PATH_DEVNULL, O_WRONLY);
 		fd = open(_PATH_DEVNULL, O_WRONLY);
-		if (fd >= 0 && fd != 2) {
+		if (fd >= 0 && fd != STDERR_FILENO) {
 			dup2(fd, 2);
 			dup2(fd, 2);
 			close(fd);
 			close(fd);
 		}
 		}
@@ -802,10 +808,15 @@ exec_comm(char *comm, char **word, size_t * word_length,
 	/* Don't fork() unless necessary */
 	/* Don't fork() unless necessary */
 	if (!comm || !*comm)
 	if (!comm || !*comm)
 		return 0;
 		return 0;
-
-	if (pipe(fildes))
+#if defined O_CLOEXEC && defined __UCLIBC_LINUX_SPECIFIC__ && defined __ASSUME_PIPE2
+	if (pipe2(fildes, O_CLOEXEC) < 0)
 		/* Bad */
 		/* Bad */
 		return WRDE_NOSPACE;
 		return WRDE_NOSPACE;
+#else
+	if (pipe(fildes) < 0)
+		/* Bad */
+		return WRDE_NOSPACE;
+#endif
 
 
 	if ((pid = fork()) < 0) {
 	if ((pid = fork()) < 0) {
 		/* Bad */
 		/* Bad */

+ 1 - 0
libc/stdlib/__uc_malloc.c

@@ -39,6 +39,7 @@ void *__uc_malloc(size_t size)
 			return p;
 			return p;
 		if (!__uc_malloc_failed)
 		if (!__uc_malloc_failed)
 			_exit(1);
 			_exit(1);
+		free(p);
 		__uc_malloc_failed(size);
 		__uc_malloc_failed(size);
 	}
 	}
 }
 }

+ 7 - 2
libc/sysdeps/linux/arm/Makefile.arch

@@ -24,7 +24,12 @@ ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),y)
 CSRC += posix_fadvise.c posix_fadvise64.c
 CSRC += posix_fadvise.c posix_fadvise64.c
 endif
 endif
 
 
-ifeq ($(CONFIG_ARM_EABI),y)
+# Is our compiler set up for EABI ?
+IS_EABI:=$(shell $(CC) $(CFLAGS) -x c - -E -dM </dev/null 2>/dev/null \
+                 |sed -r -e '/^\#[[:space:]]*define[[:space:]]+__ARM_EABI__([[:space:]]+1)?$$/!d; s/.+/y/;' \
+          )
+
+ifeq ($(IS_EABI),y)
 CSRC += aeabi_assert.c aeabi_atexit.c aeabi_errno_addr.c \
 CSRC += aeabi_assert.c aeabi_atexit.c aeabi_errno_addr.c \
 	aeabi_localeconv.c aeabi_memclr.c aeabi_memcpy.c \
 	aeabi_localeconv.c aeabi_memclr.c aeabi_memcpy.c \
 	aeabi_memmove.c aeabi_memset.c find_exidx.c
 	aeabi_memmove.c aeabi_memset.c find_exidx.c
@@ -37,7 +42,7 @@ else
 CSRC += syscall.c
 CSRC += syscall.c
 endif
 endif
 
 
-ifeq ($(CONFIG_ARM_EABI),y)
+ifeq ($(IS_EABI),y)
 libc-static-y += $(ARCH_OUT)/aeabi_lcsts.o $(ARCH_OUT)/aeabi_math.o \
 libc-static-y += $(ARCH_OUT)/aeabi_lcsts.o $(ARCH_OUT)/aeabi_math.o \
 	$(ARCH_OUT)/aeabi_sighandlers.o
 	$(ARCH_OUT)/aeabi_sighandlers.o
 libc-nonshared-y += $(ARCH_OUT)/aeabi_lcsts.os $(ARCH_OUT)/aeabi_math.os \
 libc-nonshared-y += $(ARCH_OUT)/aeabi_lcsts.os $(ARCH_OUT)/aeabi_math.os \

+ 8 - 1
libc/sysdeps/linux/arm/bits/arm_asm.h

@@ -24,5 +24,12 @@
 #define THUMB1_ONLY 1
 #define THUMB1_ONLY 1
 #endif
 #endif
 
 
-#endif /* _ARM_ASM_H */
+#if defined(__USE_BX__)
+# if (   defined (__ARM_ARCH_2__)  || defined (__ARM_ARCH_3__) \
+      || defined (__ARM_ARCH_3M__) || defined (__ARM_ARCH_4__) \
+     )
+#  error Use of BX was requested, but is not available on the target processor.
+# endif /* ARCH level */
+#endif /* __USE_BX__ */
 
 
+#endif /* _ARM_ASM_H */

+ 2 - 2
libc/sysdeps/linux/arm/bits/huge_val.h

@@ -32,7 +32,7 @@
 # define HUGE_VAL (__extension__ 0x1.0p2047)
 # define HUGE_VAL (__extension__ 0x1.0p2047)
 #elif defined __GNUC__
 #elif defined __GNUC__
 
 
-#ifndef __CONFIG_ARM_EABI__
+#ifndef __ARM_EABI__
 # define HUGE_VAL \
 # define HUGE_VAL \
   (__extension__							      \
   (__extension__							      \
    ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; })   \
    ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; })   \
@@ -50,7 +50,7 @@
 
 
 typedef union { unsigned char __c[8]; double __d; } __huge_val_t;
 typedef union { unsigned char __c[8]; double __d; } __huge_val_t;
 
 
-#ifndef __CONFIG_ARM_EABI__
+#ifndef __ARM_EABI__
 # if __BYTE_ORDER == __BIG_ENDIAN
 # if __BYTE_ORDER == __BIG_ENDIAN
 #  define __HUGE_VAL_bytes	{ 0, 0, 0, 0, 0x7f, 0xf0, 0, 0 }
 #  define __HUGE_VAL_bytes	{ 0, 0, 0, 0, 0x7f, 0xf0, 0, 0 }
 # endif
 # endif

+ 0 - 2
libc/sysdeps/linux/arm/crtn.S

@@ -15,7 +15,6 @@
 	.arm
 	.arm
 	ldmdb	fp, {r4, r5, r6, r7, r8, r9, sl, fp, sp, pc}
 	ldmdb	fp, {r4, r5, r6, r7, r8, r9, sl, fp, sp, pc}
 #endif
 #endif
-	.size	_init, .-_init
 	
 	
 	.section .fini
 	.section .fini
 	.global	_fini
 	.global	_fini
@@ -29,7 +28,6 @@
 	.arm
 	.arm
 	ldmdb	fp, {r4, r5, r6, r7, r8, r9, sl, fp, sp, pc}
 	ldmdb	fp, {r4, r5, r6, r7, r8, r9, sl, fp, sp, pc}
 #endif
 #endif
-	.size	_fini, .-_fini
 	
 	
 	@ In fact this is modified to 3.4.4
 	@ In fact this is modified to 3.4.4
 	.ident	"GCC: (GNU) 3.3.2 20031005 (Debian prerelease)"
 	.ident	"GCC: (GNU) 3.3.2 20031005 (Debian prerelease)"

+ 1 - 0
libc/sysdeps/linux/arm/sysdep.h

@@ -21,6 +21,7 @@
 #define _LINUX_ARM_SYSDEP_H 1
 #define _LINUX_ARM_SYSDEP_H 1
 
 
 #include <common/sysdep.h>
 #include <common/sysdep.h>
+#include <bits/arm_asm.h>
 
 
 #include <sys/syscall.h>
 #include <sys/syscall.h>
 /* For Linux we can use the system call table in the header file
 /* For Linux we can use the system call table in the header file

+ 0 - 0
libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind.h → libc/sysdeps/linux/arm/unwind.h


+ 0 - 2
libc/sysdeps/linux/avr32/crtn.S

@@ -4,11 +4,9 @@
 	.global	_init
 	.global	_init
 	.type	_init, @function
 	.type	_init, @function
 	ldm	sp++, r6, pc
 	ldm	sp++, r6, pc
-	.size	_init, . - _init
 
 
 	.section .fini
 	.section .fini
 	.align	2
 	.align	2
 	.global _fini
 	.global _fini
 	.type	_fini, @function
 	.type	_fini, @function
 	ldm	sp++, r6, pc
 	ldm	sp++, r6, pc
-	.size	_fini, . - _fini

+ 5 - 5
libc/sysdeps/linux/common/Makefile.in

@@ -19,14 +19,14 @@ CSRC-$(UCLIBC_LINUX_MODULE_24) += create_module.c query_module.c \
 	get_kernel_syms.c
 	get_kernel_syms.c
 # we need these internally: fstatfs.c statfs.c
 # we need these internally: fstatfs.c statfs.c
 CSRC-$(UCLIBC_LINUX_SPECIFIC) += capget.c capset.c inotify.c ioperm.c iopl.c \
 CSRC-$(UCLIBC_LINUX_SPECIFIC) += capget.c capset.c inotify.c ioperm.c iopl.c \
-	madvise.c modify_ldt.c personality.c ppoll.c prctl.c readahead.c reboot.c \
+	modify_ldt.c pipe2.c personality.c ppoll.c prctl.c \
+	readahead.c reboot.c \
 	remap_file_pages.c sched_getaffinity.c sched_setaffinity.c \
 	remap_file_pages.c sched_getaffinity.c sched_setaffinity.c \
 	sendfile64.c sendfile.c setfsgid.c setfsuid.c setresuid.c \
 	sendfile64.c sendfile.c setfsgid.c setfsuid.c setresuid.c \
 	splice.c vmsplice.c tee.c signalfd.c swapoff.c swapon.c \
 	splice.c vmsplice.c tee.c signalfd.c swapoff.c swapon.c \
 	sync_file_range.c sysctl.c sysinfo.c timerfd.c uselib.c vhangup.c
 	sync_file_range.c sysctl.c sysinfo.c timerfd.c uselib.c vhangup.c
-ifeq ($(UCLIBC_LINUX_SPECIFIC)$(UCLIBC_HAS_THREADS_NATIVE),yy)
-CSRC-y += madvise.c
-endif
+# NPTL needs these internally: madvise.c
+CSRC-$(findstring y,$(UCLIBC_LINUX_SPECIFIC)$(UCLIBC_HAS_THREADS_NATIVE)) += madvise.c
 ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
 ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
 CSRC- += fork.c getpid.c raise.c open.c close.c read.c write.c
 CSRC- += fork.c getpid.c raise.c open.c close.c read.c write.c
 CSRC- += $(if $(findstring =arm=,=$(TARGET_ARCH)=),vfork.c)
 CSRC- += $(if $(findstring =arm=,=$(TARGET_ARCH)=),vfork.c)
@@ -52,7 +52,7 @@ CSRC-$(UCLIBC_HAS_XATTR) += xattr.c
 CSRC-$(UCLIBC_HAS_PROFILING) += noophooks.c #pcprofile.c
 CSRC-$(UCLIBC_HAS_PROFILING) += noophooks.c #pcprofile.c
 CSRC-$(UCLIBC_SV4_DEPRECATED) += ustat.c
 CSRC-$(UCLIBC_SV4_DEPRECATED) += ustat.c
 CSRC- += $(if $(findstring =c6x=,=$(TARGET_ARCH)=),vfork.c)
 CSRC- += $(if $(findstring =c6x=,=$(TARGET_ARCH)=),vfork.c)
-CSRC- += $(if $(findstring =sh=,=$(TARGET_ARCH)=),longjmp.c vfork.c)
+CSRC- += $(if $(findstring =sh=,=$(TARGET_ARCH)=),vfork.c)
 CSRC- += $(if $(findstring =sparc=,=$(TARGET_ARCH)=),vfork.c)
 CSRC- += $(if $(findstring =sparc=,=$(TARGET_ARCH)=),vfork.c)
 CSRC- += $(if $(findstring =i386=,=$(TARGET_ARCH)=),vfork.c)
 CSRC- += $(if $(findstring =i386=,=$(TARGET_ARCH)=),vfork.c)
 
 

+ 25 - 0
libc/sysdeps/linux/common/bits/kernel-features.h

@@ -309,6 +309,19 @@
 # define __ASSUME_O_CLOEXEC 1
 # define __ASSUME_O_CLOEXEC 1
 #endif
 #endif
 
 
+/* Support for various CLOEXEC and NONBLOCK flags was added for x86,
+ *    x86-64, PPC, IA-64, and SPARC in 2.6.27.  */
+#if __LINUX_KERNEL_VERSION >= 0x02061b \
+    && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \
+        || defined __ia64__ || defined __sparc__ || defined __s390__)
+/* # define __ASSUME_SOCK_CLOEXEC  1 */
+/* # define __ASSUME_IN_NONBLOCK   1 */
+# define __ASSUME_PIPE2         1
+/* # define __ASSUME_EVENTFD2      1 */
+/* # define __ASSUME_SIGNALFD4     1 */
+#endif
+
+
 /* These features were surely available with 2.4.12.  */
 /* These features were surely available with 2.4.12.  */
 #if __LINUX_KERNEL_VERSION >= 132108 && defined __mc68000__
 #if __LINUX_KERNEL_VERSION >= 132108 && defined __mc68000__
 # define __ASSUME_MMAP2_SYSCALL		1
 # define __ASSUME_MMAP2_SYSCALL		1
@@ -454,6 +467,18 @@
 #define __ASSUME_IEEE_RAISE_EXCEPTION	1
 #define __ASSUME_IEEE_RAISE_EXCEPTION	1
 #endif
 #endif
 
 
+/* Support for the accept4 syscall was added in 2.6.28.  */
+#if __LINUX_KERNEL_VERSION >= 0x02061c \
+    && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \
+        || defined __sparc__ || defined __s390__)
+# define __ASSUME_ACCEPT4       1
+#endif
+
+/* Support for the accept4 syscall for alpha was added after 2.6.33-rc1.  */
+#if __LINUX_KERNEL_VERSION >= 0x020621 && defined __alpha__
+# define __ASSUME_ACCEPT4       1
+#endif
+
 /* Support for the FUTEX_CLOCK_REALTIME flag was added in 2.6.29.  */
 /* Support for the FUTEX_CLOCK_REALTIME flag was added in 2.6.29.  */
 #if __LINUX_KERNEL_VERSION >= 0x02061d
 #if __LINUX_KERNEL_VERSION >= 0x02061d
 # define __ASSUME_FUTEX_CLOCK_REALTIME	1
 # define __ASSUME_FUTEX_CLOCK_REALTIME	1

+ 52 - 1
libc/sysdeps/linux/common/epoll.c

@@ -9,6 +9,11 @@
 
 
 #include <sys/syscall.h>
 #include <sys/syscall.h>
 #include <sys/epoll.h>
 #include <sys/epoll.h>
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+# include <sysdep-cancel.h>
+#else
+# define SINGLE_THREAD_P 1
+#endif
 
 
 /*
 /*
  * epoll_create()
  * epoll_create()
@@ -17,6 +22,13 @@
 _syscall1(int, epoll_create, int, size)
 _syscall1(int, epoll_create, int, size)
 #endif
 #endif
 
 
+/*
+ * epoll_create1()
+ */
+#ifdef __NR_epoll_create1
+_syscall1(int, epoll_create1, int, flags)
+#endif
+
 /*
 /*
  * epoll_ctl()
  * epoll_ctl()
  */
  */
@@ -28,5 +40,44 @@ _syscall4(int,epoll_ctl, int, epfd, int, op, int, fd, struct epoll_event *, even
  * epoll_wait()
  * epoll_wait()
  */
  */
 #ifdef __NR_epoll_wait
 #ifdef __NR_epoll_wait
-_syscall4(int, epoll_wait, int, epfd, struct epoll_event *, events, int, maxevents, int, timeout)
+extern __typeof(epoll_wait) __libc_epoll_wait;
+int __libc_epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout)
+{
+	if (SINGLE_THREAD_P)
+		return INLINE_SYSCALL(epoll_wait, 4, epfd, events, maxevents, timeout);
+# ifdef __UCLIBC_HAS_THREADS_NATIVE__
+	else {
+		int oldtype = LIBC_CANCEL_ASYNC ();
+		int result = INLINE_SYSCALL(epoll_wait, 4, epfd, events, maxevents, timeout);
+		LIBC_CANCEL_RESET (oldtype);
+		return result;
+	}
+# endif
+}
+weak_alias(__libc_epoll_wait, epoll_wait)
+#endif
+
+/*
+ * epoll_pwait()
+ */
+#ifdef __NR_epoll_pwait
+# include <signal.h>
+
+extern __typeof(epoll_pwait) __libc_epoll_pwait;
+int __libc_epoll_pwait(int epfd, struct epoll_event *events, int maxevents,
+						int timeout, const sigset_t *set)
+{
+    int nsig = _NSIG / 8;
+	if (SINGLE_THREAD_P)
+		return INLINE_SYSCALL(epoll_pwait, 6, epfd, events, maxevents, timeout, set, nsig);
+# ifdef __UCLIBC_HAS_THREADS_NATIVE__
+	else {
+		int oldtype = LIBC_CANCEL_ASYNC ();
+		int result = INLINE_SYSCALL(epoll_pwait, 6, epfd, events, maxevents, timeout, set, nsig);
+		LIBC_CANCEL_RESET (oldtype);
+		return result;
+	}
+# endif
+}
+weak_alias(__libc_epoll_pwait, epoll_pwait)
 #endif
 #endif

+ 2 - 1
libc/sysdeps/linux/common/getcwd.c

@@ -69,7 +69,7 @@ static char *search_dir(dev_t this_dev, ino_t this_ino, char *path_buf, int path
 	slen++;
 	slen++;
 
 
 	dp = opendir(path_buf);
 	dp = opendir(path_buf);
-	if (dp == 0) {
+	if (!dp) {
 	    goto oops;
 	    goto oops;
 	}
 	}
 
 
@@ -78,6 +78,7 @@ static char *search_dir(dev_t this_dev, ino_t this_ino, char *path_buf, int path
 		if (slow_search || this_ino == d->d_ino) {
 		if (slow_search || this_ino == d->d_ino) {
 # endif
 # endif
 			if (slen + strlen(d->d_name) > path_size) {
 			if (slen + strlen(d->d_name) > path_size) {
+			    closedir(dp);
 			    goto oops;
 			    goto oops;
 			}
 			}
 			strcpy(ptr + 1, d->d_name);
 			strcpy(ptr + 1, d->d_name);

+ 2 - 2
libc/sysdeps/linux/common/longjmp.c

@@ -24,7 +24,7 @@
 extern void __longjmp (__jmp_buf __env, int __val) attribute_noreturn;
 extern void __longjmp (__jmp_buf __env, int __val) attribute_noreturn;
 libc_hidden_proto(__longjmp)
 libc_hidden_proto(__longjmp)
 
 
-#if 0
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
 extern void _longjmp_unwind (jmp_buf env, int val);
 extern void _longjmp_unwind (jmp_buf env, int val);
 #endif
 #endif
 
 
@@ -34,7 +34,7 @@ extern __typeof(longjmp) __libc_longjmp attribute_noreturn;
    call there to return VAL, or 1 if VAL is 0.  */
    call there to return VAL, or 1 if VAL is 0.  */
 void __libc_longjmp (sigjmp_buf env, int val)
 void __libc_longjmp (sigjmp_buf env, int val)
 {
 {
-#if 0
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
   /* Perform any cleanups needed by the frames being unwound.  */
   /* Perform any cleanups needed by the frames being unwound.  */
   _longjmp_unwind (env, val);
   _longjmp_unwind (env, val);
 #endif
 #endif

+ 16 - 0
libc/sysdeps/linux/common/pipe2.c

@@ -0,0 +1,16 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * pipe2() for uClibc
+ *
+ * Copyright (C) 2011 Bernhard Reutner-Fischer <uclibc@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <sys/syscall.h>
+#include <unistd.h>
+
+#ifdef __NR_pipe2
+_syscall2(int, pipe2, int *, filedes, int, flags)
+libc_hidden_def(pipe2)
+#endif

+ 106 - 0
libc/sysdeps/linux/common/stubs.c

@@ -31,10 +31,48 @@ static int enosys_stub(void)
 # undef __NR_sync_file_range
 # undef __NR_sync_file_range
 #endif
 #endif
 
 
+#ifndef __UCLIBC_LINUX_SPECIFIC__
+# undef __NR_pipe2
+#endif
+
+#ifndef __UCLIBC_HAS_SOCKET__
+# undef __NR_accept
+# undef __NR_accept4
+# undef __NR_bind
+# undef __NR_connect
+# undef __NR_getpeername
+# undef __NR_getsockname
+# undef __NR_getsockopt
+# undef __NR_listen
+# undef __NR_recv
+# undef __NR_recvfrom
+# undef __NR_recvmsg
+# undef __NR_send
+# undef __NR_sendmsg
+# undef __NR_sendto
+# undef __NR_setsockopt
+# undef __NR_shutdown
+# undef __NR_socket
+# undef __NR_socketcall
+# undef __NR_socketpair
+#endif
+
+#if !defined __NR_accept && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__
+make_stub(accept)
+#endif
+
+#if !defined __NR_accept4 && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__
+make_stub(accept4)
+#endif
+
 #ifndef __NR_bdflush
 #ifndef __NR_bdflush
 make_stub(bdflush)
 make_stub(bdflush)
 #endif
 #endif
 
 
+#if !defined __NR_bind && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__
+make_stub(bind)
+#endif
+
 #ifndef __NR_capget
 #ifndef __NR_capget
 make_stub(capget)
 make_stub(capget)
 #endif
 #endif
@@ -43,6 +81,10 @@ make_stub(capget)
 make_stub(capset)
 make_stub(capset)
 #endif
 #endif
 
 
+#if !defined __NR_connect && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__
+make_stub(connect)
+#endif
+
 #ifndef __NR_create_module
 #ifndef __NR_create_module
 make_stub(create_module)
 make_stub(create_module)
 #endif
 #endif
@@ -91,10 +133,22 @@ make_stub(fsetxattr)
 make_stub(get_kernel_syms)
 make_stub(get_kernel_syms)
 #endif
 #endif
 
 
+#if !defined __NR_getpeername && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__
+make_stub(getpeername)
+#endif
+
 #if !defined(__NR_getpgrp) && (defined(__NR_getpgid) && (defined(__NR_getpid) || defined(__NR_getxpid)))
 #if !defined(__NR_getpgrp) && (defined(__NR_getpgid) && (defined(__NR_getpid) || defined(__NR_getxpid)))
 make_stub(getpgrp)
 make_stub(getpgrp)
 #endif
 #endif
 
 
+#if !defined __NR_getsockname && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__
+make_stub(getsockname)
+#endif
+
+#if !defined __NR_getsockopt && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__
+make_stub(getsockopt)
+#endif
+
 #ifndef __NR_getxattr
 #ifndef __NR_getxattr
 make_stub(getxattr)
 make_stub(getxattr)
 #endif
 #endif
@@ -107,6 +161,10 @@ make_stub(init_module)
 make_stub(lgetxattr)
 make_stub(lgetxattr)
 #endif
 #endif
 
 
+#if !defined __NR_listen && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__
+make_stub(listen)
+#endif
+
 #ifndef __NR_listxattr
 #ifndef __NR_listxattr
 make_stub(listxattr)
 make_stub(listxattr)
 #endif
 #endif
@@ -123,6 +181,10 @@ make_stub(lremovexattr)
 make_stub(lsetxattr)
 make_stub(lsetxattr)
 #endif
 #endif
 
 
+#ifndef __NR_pipe2
+make_stub(pipe2)
+#endif
+
 #ifndef __NR_pivot_root
 #ifndef __NR_pivot_root
 make_stub(pivot_root)
 make_stub(pivot_root)
 #endif
 #endif
@@ -131,6 +193,18 @@ make_stub(pivot_root)
 make_stub(query_module)
 make_stub(query_module)
 #endif
 #endif
 
 
+#if !defined __NR_recv && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__
+make_stub(recv)
+#endif
+
+#if !defined __NR_recvfrom && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__
+make_stub(recvfrom)
+#endif
+
+#if !defined __NR_recvmsg && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__
+make_stub(recvmsg)
+#endif
+
 #ifndef __NR_removexattr
 #ifndef __NR_removexattr
 make_stub(removexattr)
 make_stub(removexattr)
 #endif
 #endif
@@ -143,14 +217,46 @@ make_stub(sched_getaffinity)
 make_stub(sched_setaffinity)
 make_stub(sched_setaffinity)
 #endif
 #endif
 
 
+#if !defined __NR_send && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__
+make_stub(send)
+#endif
+
+#if !defined __NR_sendmsg && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__
+make_stub(sendmsg)
+#endif
+
+#if !defined __NR_sendto && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__
+make_stub(sendto)
+#endif
+
+#if !defined __NR_setsockopt && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__
+make_stub(setsockopt)
+#endif
+
 #ifndef __NR_setxattr
 #ifndef __NR_setxattr
 make_stub(setxattr)
 make_stub(setxattr)
 #endif
 #endif
 
 
+#if !defined __NR_shutdown && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__
+make_stub(shutdown)
+#endif
+
 #if !defined(__NR_signalfd4) && !defined(__NR_signalfd)
 #if !defined(__NR_signalfd4) && !defined(__NR_signalfd)
 make_stub(signalfd)
 make_stub(signalfd)
 #endif
 #endif
 
 
+#if !defined __NR_socket && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__
+make_stub(socket)
+#endif
+
+#if !defined __NR_socketcall && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__
+make_stub(socketcall)
+#endif
+
+#if !defined __NR_socketpair && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__
+make_stub(socketpair)
+#endif
+
 #ifndef __NR_rt_sigtimedwait
 #ifndef __NR_rt_sigtimedwait
 make_stub(sigtimedwait)
 make_stub(sigtimedwait)
 make_stub(sigwaitinfo)
 make_stub(sigwaitinfo)

+ 59 - 5
libc/sysdeps/linux/common/sys/epoll.h

@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    This file is part of the GNU C Library.
 
 
    The GNU C Library is free software; you can redistribute it and/or
    The GNU C Library is free software; you can redistribute it and/or
@@ -22,6 +22,42 @@
 #include <stdint.h>
 #include <stdint.h>
 #include <sys/types.h>
 #include <sys/types.h>
 
 
+/* Get __sigset_t.  */
+#include <bits/sigset.h>
+
+#ifndef __sigset_t_defined
+# define __sigset_t_defined
+typedef __sigset_t sigset_t;
+#endif
+
+
+/* Flags to be passed to epoll_create1.  */
+
+enum
+  {
+#if defined __alpha__
+    EPOLL_CLOEXEC = 010000000,
+# define EPOLL_CLOEXEC EPOLL_CLOEXEC
+    EPOLL_NONBLOCK = 04
+# define EPOLL_NONBLOCK EPOLL_NONBLOCK
+#else
+# if defined __sparc__
+    EPOLL_CLOEXEC = 020000000,
+# else
+    EPOLL_CLOEXEC = 02000000,
+# endif
+# define EPOLL_CLOEXEC EPOLL_CLOEXEC
+# if defined __mips__
+    EPOLL_NONBLOCK = 0200
+# elif defined __sparc__
+    EPOLL_NONBLOCK = 040000
+# else
+    EPOLL_NONBLOCK = 04000
+# endif
+#define EPOLL_NONBLOCK EPOLL_NONBLOCK
+#endif
+  };
+
 
 
 enum EPOLL_EVENTS
 enum EPOLL_EVENTS
   {
   {
@@ -55,9 +91,9 @@ enum EPOLL_EVENTS
 
 
 
 
 /* Valid opcodes ( "op" parameter ) to issue to epoll_ctl().  */
 /* Valid opcodes ( "op" parameter ) to issue to epoll_ctl().  */
-#define EPOLL_CTL_ADD 1	/* Add a file decriptor to the interface.  */
-#define EPOLL_CTL_DEL 2	/* Remove a file decriptor from the interface.  */
-#define EPOLL_CTL_MOD 3	/* Change file decriptor epoll_event structure.  */
+#define EPOLL_CTL_ADD 1	/* Add a file descriptor to the interface.  */
+#define EPOLL_CTL_DEL 2	/* Remove a file descriptor from the interface.  */
+#define EPOLL_CTL_MOD 3	/* Change file descriptor epoll_event structure.  */
 
 
 
 
 typedef union epoll_data
 typedef union epoll_data
@@ -72,7 +108,11 @@ struct epoll_event
 {
 {
   uint32_t events;	/* Epoll events */
   uint32_t events;	/* Epoll events */
   epoll_data_t data;	/* User data variable */
   epoll_data_t data;	/* User data variable */
-};
+}
+#if defined __x86_64__
+__attribute__((packed))
+#endif
+;
 
 
 
 
 __BEGIN_DECLS
 __BEGIN_DECLS
@@ -83,6 +123,10 @@ __BEGIN_DECLS
    returned by epoll_create() should be closed with close().  */
    returned by epoll_create() should be closed with close().  */
 extern int epoll_create (int __size) __THROW;
 extern int epoll_create (int __size) __THROW;
 
 
+/* Same as epoll_create but with a FLAGS parameter.  The unused SIZE
+   parameter has been dropped.  */
+extern int epoll_create1 (int __flags) __THROW;
+
 
 
 /* Manipulate an epoll instance "epfd". Returns 0 in case of success,
 /* Manipulate an epoll instance "epfd". Returns 0 in case of success,
    -1 in case of error ( the "errno" variable will contain the
    -1 in case of error ( the "errno" variable will contain the
@@ -107,6 +151,16 @@ extern int epoll_ctl (int __epfd, int __op, int __fd,
 extern int epoll_wait (int __epfd, struct epoll_event *__events,
 extern int epoll_wait (int __epfd, struct epoll_event *__events,
 		       int __maxevents, int __timeout);
 		       int __maxevents, int __timeout);
 
 
+
+/* Same as epoll_wait, but the thread's signal mask is temporarily
+   and atomically replaced with the one provided as parameter.
+
+   This function is a cancellation point and therefore not marked with
+   __THROW.  */
+extern int epoll_pwait (int __epfd, struct epoll_event *__events,
+			int __maxevents, int __timeout,
+			__const __sigset_t *__ss);
+
 __END_DECLS
 __END_DECLS
 
 
 #endif /* sys/epoll.h */
 #endif /* sys/epoll.h */

+ 0 - 0
libpthread/nptl/sysdeps/generic/unwind.h → libc/sysdeps/linux/common/unwind.h


+ 0 - 2
libc/sysdeps/linux/cris/crtn.S

@@ -9,7 +9,6 @@
 	move.d	[$sp+],$r1
 	move.d	[$sp+],$r1
 	Ret
 	Ret
 	nop
 	nop
-	.size	_init, .-_init
 
 
 	.section	.fini
 	.section	.fini
 	.align	1
 	.align	1
@@ -20,4 +19,3 @@
 	move.d	[$sp+],$r1
 	move.d	[$sp+],$r1
 	Ret
 	Ret
 	nop
 	nop
-	.size	_fini, .-_fini

+ 0 - 2
libc/sysdeps/linux/frv/crtn.S

@@ -32,7 +32,6 @@ Cambridge, MA 02139, USA.  */
 	ld @(sp,gr0), fp
 	ld @(sp,gr0), fp
 	addi sp,#16,sp
 	addi sp,#16,sp
 	jmpl @(gr5,gr0)
 	jmpl @(gr5,gr0)
-	.size	_init, .-_init
 	
 	
 	.section .fini,"x"
 	.section .fini,"x"
 	.globl _fini
 	.globl _fini
@@ -41,4 +40,3 @@ Cambridge, MA 02139, USA.  */
 	ld @(sp,gr0), fp
 	ld @(sp,gr0), fp
 	addi sp,#16,sp
 	addi sp,#16,sp
 	jmpl @(gr5,gr0)
 	jmpl @(gr5,gr0)
-	.size	_fini, .-_fini

+ 0 - 2
libc/sysdeps/linux/h8300/crtn.S

@@ -14,7 +14,6 @@
 ; #NO_APP
 ; #NO_APP
 	mov.l	@er7+,er6
 	mov.l	@er7+,er6
 	rts
 	rts
-	.size	__init, .-__init
 ; #APP
 ; #APP
 
 
 	.section .fini
 	.section .fini
@@ -24,7 +23,6 @@
 ; #NO_APP
 ; #NO_APP
 	mov.l	@er7+,er6
 	mov.l	@er7+,er6
 	rts
 	rts
-	.size	__fini, .-__fini
 ; #APP
 ; #APP
 
 
 	.end
 	.end

+ 0 - 2
libc/sysdeps/linux/i386/crtn.S

@@ -6,7 +6,6 @@
 	popl	%ebx
 	popl	%ebx
 	popl	%ebp
 	popl	%ebp
 	ret
 	ret
-.size _init,.-_init
 
 
 
 
 
 
@@ -16,7 +15,6 @@
 	popl	%ebx
 	popl	%ebx
 	popl	%ebp
 	popl	%ebp
 	ret
 	ret
-.size _fini,.-_fini
 
 
 
 
 
 

+ 3 - 1
libc/sysdeps/linux/i386/posix_fadvise64.S

@@ -22,7 +22,7 @@
 #include <bits/errno.h>
 #include <bits/errno.h>
 #include <sys/syscall.h>
 #include <sys/syscall.h>
 
 
-#if defined __NR_fadvise64_64
+#if defined __NR_fadvise64_64 || defined __NR_fadvise64
 
 
 /* Was named __libc_posix_fadvise64 for some inexplicable reason.
 /* Was named __libc_posix_fadvise64 for some inexplicable reason.
 ** google says only uclibc has *__libc*_posix_fadviseXXX,
 ** google says only uclibc has *__libc*_posix_fadviseXXX,
@@ -35,6 +35,7 @@
 .global posix_fadvise64
 .global posix_fadvise64
 .type   posix_fadvise64,%function
 .type   posix_fadvise64,%function
 posix_fadvise64:
 posix_fadvise64:
+#if defined __NR_fadvise64_64
 	/* Save regs  */
 	/* Save regs  */
 	pushl	%ebp
 	pushl	%ebp
 	pushl	%ebx
 	pushl	%ebx
@@ -91,6 +92,7 @@ overflow:
 
 
 	/* Returns 0 on success, else an error code.  */
 	/* Returns 0 on success, else an error code.  */
 	negl	%eax
 	negl	%eax
+#endif
 
 
 	/* Successful; return the syscall's value.  */
 	/* Successful; return the syscall's value.  */
 	ret
 	ret

+ 0 - 2
libc/sysdeps/linux/microblaze/crtn.S

@@ -26,7 +26,6 @@
 
 
 	.end	_init
 	.end	_init
 $Lfe2:
 $Lfe2:
-	.size	_init,$Lfe2-_init
 
 
 	.section .fini
 	.section .fini
 	.align	2
 	.align	2
@@ -40,6 +39,5 @@ $Lfe2:
 
 
 	.end	_fini
 	.end	_fini
 $Lfe3:
 $Lfe3:
-	.size	_fini,$Lfe3-_fini
 
 
 /*@TRAILER_BEGINS*/
 /*@TRAILER_BEGINS*/

+ 0 - 15
libc/sysdeps/linux/mips/crtn.S

@@ -10,7 +10,6 @@
 #NO_APP
 #NO_APP
 	.align	2
 	.align	2
 	.globl	_init
 	.globl	_init
-	.ent	_init
 	.type	_init, @function
 	.type	_init, @function
 #NO_APP
 #NO_APP
 	lw	$31,28($sp)
 	lw	$31,28($sp)
@@ -22,14 +21,12 @@
 	.set	macro
 	.set	macro
 	.set	reorder
 	.set	reorder
 
 
-	.end	_init
 #APP
 #APP
 	
 	
 	.section .fini
 	.section .fini
 #NO_APP
 #NO_APP
 	.align	2
 	.align	2
 	.globl	_fini
 	.globl	_fini
-	.ent	_fini
 	.type	_fini, @function
 	.type	_fini, @function
 #NO_APP
 #NO_APP
 	lw	$31,28($sp)
 	lw	$31,28($sp)
@@ -41,7 +38,6 @@
 	.set	macro
 	.set	macro
 	.set	reorder
 	.set	reorder
 
 
-	.end	_fini
 #APP
 #APP
 	
 	
 	.ident	"GCC: (GNU) 3.3.2"
 	.ident	"GCC: (GNU) 3.3.2"
@@ -54,10 +50,8 @@
 	
 	
 	.section .init
 	.section .init
 #NO_APP
 #NO_APP
-	.align	2
 	.align	3
 	.align	3
 	.globl	_init
 	.globl	_init
-	.ent	_init
 	.type	_init, @function
 	.type	_init, @function
 #NO_APP
 #NO_APP
 	ld	$31,8($sp)
 	ld	$31,8($sp)
@@ -68,16 +62,12 @@
 	addiu	$sp,$sp,16
 	addiu	$sp,$sp,16
 	.set	macro
 	.set	macro
 	.set	reorder
 	.set	reorder
-
-	.end	_init
 #APP
 #APP
 	
 	
 	.section .fini
 	.section .fini
 #NO_APP
 #NO_APP
-	.align	2
 	.align	3
 	.align	3
 	.globl	_fini
 	.globl	_fini
-	.ent	_fini
 	.type	_fini, @function
 	.type	_fini, @function
 #NO_APP
 #NO_APP
 	ld	$31,8($sp)
 	ld	$31,8($sp)
@@ -89,7 +79,6 @@
 	.set	macro
 	.set	macro
 	.set	reorder
 	.set	reorder
 
 
-	.end	_fini
 #APP
 #APP
 	
 	
 	.ident	"GCC: (GNU) 3.4.3"
 	.ident	"GCC: (GNU) 3.4.3"
@@ -105,7 +94,6 @@
 #NO_APP
 #NO_APP
 	.align	2
 	.align	2
 	.globl	_init
 	.globl	_init
-	.ent	_init
 	.type	_init, @function
 	.type	_init, @function
 #NO_APP
 #NO_APP
 	ld	$31,24($sp)
 	ld	$31,24($sp)
@@ -118,14 +106,12 @@
 	.set	macro
 	.set	macro
 	.set	reorder
 	.set	reorder
 
 
-	.end	_init
 #APP
 #APP
 	
 	
 	.section .fini
 	.section .fini
 #NO_APP
 #NO_APP
 	.align	2
 	.align	2
 	.globl	_fini
 	.globl	_fini
-	.ent	_fini
 	.type	_fini, @function
 	.type	_fini, @function
 #NO_APP
 #NO_APP
 	ld	$31,24($sp)
 	ld	$31,24($sp)
@@ -138,7 +124,6 @@
 	.set	macro
 	.set	macro
 	.set	reorder
 	.set	reorder
 
 
-	.end	_fini
 #APP
 #APP
 	
 	
 	.ident	"GCC: (GNU) 3.3.2"
 	.ident	"GCC: (GNU) 3.3.2"

+ 0 - 2
libc/sysdeps/linux/powerpc/crtn.S

@@ -9,7 +9,6 @@
 	addi 1,1,32
 	addi 1,1,32
 	mtlr 0
 	mtlr 0
 	blr
 	blr
-	.size	_init, .-_init
 	
 	
 	.section .fini
 	.section .fini
 	.align 2
 	.align 2
@@ -20,4 +19,3 @@
 	addi 1,1,32
 	addi 1,1,32
 	mtlr 0
 	mtlr 0
 	blr
 	blr
-	.size	_fini, .-_fini

+ 2 - 2
libc/sysdeps/linux/sh/Makefile.arch

@@ -7,6 +7,6 @@
 #
 #
 
 
 CSRC := \
 CSRC := \
-	mmap.c pipe.c __init_brk.c brk.c sbrk.c pread_write.c longjmp.c cacheflush.c
+	mmap.c pipe.c __init_brk.c brk.c sbrk.c pread_write.c cacheflush.c
 
 
-SSRC := setjmp.S __longjmp.S ___fpscr_values.S
+SSRC := setjmp.S __longjmp.S ___fpscr_values.S vfork.S

+ 0 - 2
libc/sysdeps/linux/sh/crtn.S

@@ -15,7 +15,6 @@
 	.align 2
 	.align 2
 .L6:
 .L6:
 .L7:
 .L7:
-	.size	_init, .-_init
 	
 	
 	.section .fini
 	.section .fini
 	.hidden  _fini
 	.hidden  _fini
@@ -31,6 +30,5 @@
 	.align 2
 	.align 2
 .L11:
 .L11:
 .L12:
 .L12:
-	.size	_fini, .-_fini
 	
 	
 	.ident	"GCC: (GNU) 3.3.2"
 	.ident	"GCC: (GNU) 3.3.2"

+ 0 - 56
libc/sysdeps/linux/sh/longjmp.c

@@ -1,56 +0,0 @@
-/* Copyright (C) 1991, 92, 94, 95, 97, 98, 2000 Free Software Foundation, Inc.
-   Copyright (C) 2001 Hewlett-Packard Australia
-
- This program is free software; you can redistribute it and/or modify it under
- the terms of the GNU Library General Public License as published by the Free
- Software Foundation; either version 2 of the License, or (at your option) any
- later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
- details.
-
- You should have received a copy of the GNU Library General Public License
- along with this program; if not, write to the Free Software Foundation, Inc.,
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Derived in part from the Linux-8086 C library, the GNU C Library, and several
- other sundry sources.  Files within this library are copyright by their
- respective copyright holders.
-*/
-
-#include <stddef.h>
-#include <setjmp.h>
-#include <signal.h>
-
-libc_hidden_proto(sigprocmask)
-
-extern int __longjmp(char *env, int val);
-libc_hidden_proto(__longjmp)
-
-extern void _longjmp_unwind (jmp_buf env, int val);
-
-
-/* Set the signal mask to the one specified in ENV, and jump
-   to the position specified in ENV, causing the setjmp
-   call there to return VAL, or 1 if VAL is 0.  */
-void __libc_siglongjmp (sigjmp_buf env, int val)
-{
-  /* Perform any cleanups needed by the frames being unwound.  */
-
-  _longjmp_unwind (env, val);
-
-  if (env[0].__mask_was_saved)
-    /* Restore the saved signal mask.  */
-    (void) sigprocmask (SIG_SETMASK, &env[0].__saved_mask,
-			  (sigset_t *) NULL);
-
-  /* Call the machine-dependent function to restore machine state.  */
-  __longjmp ((char *) env[0].__jmpbuf, val ?: 1);
-}
-
-__asm__(".weak longjmp; longjmp = __libc_siglongjmp");
-__asm__(".weak _longjmp; _longjmp = __libc_siglongjmp");
-__asm__(".weak siglongjmp; siglongjmp = __libc_siglongjmp");
-strong_alias(__libc_siglongjmp, __libc_longjmp)

+ 0 - 2
libc/sysdeps/linux/sh64/crtn.S

@@ -14,7 +14,6 @@
 	ptabs	r18, tr0
 	ptabs	r18, tr0
 	addi.l	r15, 16, r15
 	addi.l	r15, 16, r15
 	blink	tr0, r63
 	blink	tr0, r63
-	.size	_init, .-_init
 	
 	
 	.section .fini
 	.section .fini
 	.hidden  _fini
 	.hidden  _fini
@@ -28,6 +27,5 @@
 	ptabs	r18, tr0
 	ptabs	r18, tr0
 	addi.l	r15, 16, r15
 	addi.l	r15, 16, r15
 	blink	tr0, r63
 	blink	tr0, r63
-	.size	_fini, .-_fini
 	
 	
 	.ident	"GCC: (GNU) 3.3.2"
 	.ident	"GCC: (GNU) 3.3.2"

+ 0 - 2
libc/sysdeps/linux/sparc/crtn.S

@@ -7,7 +7,6 @@
 	.proc	020
 	.proc	020
 	ret
 	ret
 	restore
 	restore
-	.size	_init, .-_init
 	
 	
 	.section .fini
 	.section .fini
 	.align 4
 	.align 4
@@ -16,4 +15,3 @@
 	.proc	020
 	.proc	020
 	ret
 	ret
 	restore
 	restore
-	.size	_fini, .-_fini

+ 0 - 2
libc/sysdeps/linux/v850/crtn.S

@@ -8,7 +8,6 @@
 	.type	__init, @function
 	.type	__init, @function
 #NO_APP
 #NO_APP
 	jr __return_r31
 	jr __return_r31
-	.size	__init, .-__init
 #APP
 #APP
 	
 	
 	.section .fini
 	.section .fini
@@ -18,7 +17,6 @@
 	.type	__fini, @function
 	.type	__fini, @function
 #NO_APP
 #NO_APP
 	jr __return_r31
 	jr __return_r31
-	.size	__fini, .-__fini
 #APP
 #APP
 	
 	
 	.ident	"GCC: (GNU) 3.3.2"
 	.ident	"GCC: (GNU) 3.3.2"

+ 0 - 2
libc/sysdeps/linux/vax/crtn.S

@@ -9,7 +9,6 @@ __gnu_compiled_c:
 	.type	 _init,@function
 	.type	 _init,@function
 	ret
 	ret
 .Lfe2:
 .Lfe2:
-	.size	 _init,.Lfe2-_init
 
 
 	.section .fini
 	.section .fini
 	.align 1
 	.align 1
@@ -17,5 +16,4 @@ __gnu_compiled_c:
 	.type	 _fini,@function
 	.type	 _fini,@function
 	ret
 	ret
 .Lfe3:
 .Lfe3:
-	.size	 _fini,.Lfe3-_fini
 	.ident	"GCC: (GNU) 2.95.2 19991024 (release) (Linux/VAX CVS)"
 	.ident	"GCC: (GNU) 2.95.2 19991024 (release) (Linux/VAX CVS)"

+ 0 - 2
libc/sysdeps/linux/x86_64/crtn.S

@@ -7,7 +7,6 @@
 .type    _init, %function
 .type    _init, %function
 	addq $8, %rsp
 	addq $8, %rsp
 	ret
 	ret
-.size _init,.-_init
 
 
 
 
 .section .fini
 .section .fini
@@ -15,4 +14,3 @@
 .type    _fini, %function
 .type    _fini, %function
 	addq $8, %rsp
 	addq $8, %rsp
 	ret
 	ret
-.size _fini, .-_fini

+ 0 - 110
libc/sysdeps/linux/x86_64/sys/epoll.h

@@ -1,110 +0,0 @@
-/* Copyright (C) 2002,2003,2004,2005,2006 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#ifndef	_SYS_EPOLL_H
-#define	_SYS_EPOLL_H	1
-
-#include <stdint.h>
-#include <sys/types.h>
-
-
-enum EPOLL_EVENTS
-  {
-    EPOLLIN = 0x001,
-#define EPOLLIN EPOLLIN
-    EPOLLPRI = 0x002,
-#define EPOLLPRI EPOLLPRI
-    EPOLLOUT = 0x004,
-#define EPOLLOUT EPOLLOUT
-    EPOLLRDNORM = 0x040,
-#define EPOLLRDNORM EPOLLRDNORM
-    EPOLLRDBAND = 0x080,
-#define EPOLLRDBAND EPOLLRDBAND
-    EPOLLWRNORM = 0x100,
-#define EPOLLWRNORM EPOLLWRNORM
-    EPOLLWRBAND = 0x200,
-#define EPOLLWRBAND EPOLLWRBAND
-    EPOLLMSG = 0x400,
-#define EPOLLMSG EPOLLMSG
-    EPOLLERR = 0x008,
-#define EPOLLERR EPOLLERR
-    EPOLLHUP = 0x010,
-#define EPOLLHUP EPOLLHUP
-    EPOLLONESHOT = (1 << 30),
-#define EPOLLONESHOT EPOLLONESHOT
-    EPOLLET = (1 << 31)
-#define EPOLLET EPOLLET
-  };
-
-
-/* Valid opcodes ( "op" parameter ) to issue to epoll_ctl().  */
-#define EPOLL_CTL_ADD 1	/* Add a file decriptor to the interface.  */
-#define EPOLL_CTL_DEL 2	/* Remove a file decriptor from the interface.  */
-#define EPOLL_CTL_MOD 3	/* Change file decriptor epoll_event structure.  */
-
-
-typedef union epoll_data
-{
-  void *ptr;
-  int fd;
-  uint32_t u32;
-  uint64_t u64;
-} epoll_data_t;
-
-struct epoll_event
-{
-  uint32_t events;	/* Epoll events */
-  epoll_data_t data;	/* User data variable */
-} __attribute__ ((__packed__));
-
-
-__BEGIN_DECLS
-
-/* Creates an epoll instance.  Returns an fd for the new instance.
-   The "size" parameter is a hint specifying the number of file
-   descriptors to be associated with the new instance.  The fd
-   returned by epoll_create() should be closed with close().  */
-extern int epoll_create (int __size) __THROW;
-
-
-/* Manipulate an epoll instance "epfd". Returns 0 in case of success,
-   -1 in case of error ( the "errno" variable will contain the
-   specific error code ) The "op" parameter is one of the EPOLL_CTL_*
-   constants defined above. The "fd" parameter is the target of the
-   operation. The "event" parameter describes which events the caller
-   is interested in and any associated user data.  */
-extern int epoll_ctl (int __epfd, int __op, int __fd,
-		      struct epoll_event *__event) __THROW;
-
-
-/* Wait for events on an epoll instance "epfd". Returns the number of
-   triggered events returned in "events" buffer. Or -1 in case of
-   error with the "errno" variable set to the specific error code. The
-   "events" parameter is a buffer that will contain triggered
-   events. The "maxevents" is the maximum number of events to be
-   returned ( usually size of "events" ). The "timeout" parameter
-   specifies the maximum wait time in milliseconds (-1 == infinite).
-
-   This function is a cancellation point and therefore not marked with
-   __THROW.  */
-extern int epoll_wait (int __epfd, struct epoll_event *__events,
-		       int __maxevents, int __timeout);
-
-__END_DECLS
-
-#endif /* sys/epoll.h */

+ 1 - 1
libm/Makefile.in

@@ -20,7 +20,7 @@
 # by Erik Andersen <andersen@codepoet.org>
 # by Erik Andersen <andersen@codepoet.org>
 #
 #
 
 
-subdirs += libm
+subdirs += libm libm/$(TARGET_ARCH)
 
 
 CFLAGS-libm := -DNOT_IN_libc -DIS_IN_libm $(SSP_ALL_CFLAGS)
 CFLAGS-libm := -DNOT_IN_libc -DIS_IN_libm $(SSP_ALL_CFLAGS)
 CFLAGS-libm += -D_IEEE_LIBM
 CFLAGS-libm += -D_IEEE_LIBM

+ 1 - 1
libpthread/linuxthreads.old/cancel.c

@@ -213,7 +213,7 @@ void __pthread_perform_cleanup(char *currentframe)
 }
 }
 
 
 #ifndef __PIC__
 #ifndef __PIC__
-/* We need a hook to force the cancelation wrappers to be linked in when
+/* We need a hook to force the cancellation wrappers to be linked in when
    static libpthread is used.  */
    static libpthread is used.  */
 extern const char __pthread_provide_wrappers;
 extern const char __pthread_provide_wrappers;
 static const char *const __pthread_require_wrappers =
 static const char *const __pthread_require_wrappers =

+ 1 - 1
libpthread/linuxthreads.old/pthread.c

@@ -1159,7 +1159,7 @@ void __pthread_message(char * fmt, ...)
 
 
 
 
 #ifndef __PIC__
 #ifndef __PIC__
-/* We need a hook to force the cancelation wrappers to be linked in when
+/* We need a hook to force the cancellation wrappers to be linked in when
    static libpthread is used.  */
    static libpthread is used.  */
 extern const char __pthread_provide_wrappers;
 extern const char __pthread_provide_wrappers;
 static const char *const __pthread_require_wrappers =
 static const char *const __pthread_require_wrappers =

+ 14 - 1
libpthread/linuxthreads.old/wrapsyscall.c

@@ -1,4 +1,4 @@
-/* Wrapper arpund system calls to provide cancelation points.
+/* Wrapper arpund system calls to provide cancellation points.
    Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
    Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -227,3 +227,16 @@ CANCELABLE_SYSCALL (ssize_t, sendto, (int fd, const __ptr_t buf, size_t n,
 				      socklen_t addr_len),
 				      socklen_t addr_len),
 		    (fd, buf, n, flags, addr, addr_len))
 		    (fd, buf, n, flags, addr, addr_len))
 #endif /* __UCLIBC_HAS_SOCKET__ */
 #endif /* __UCLIBC_HAS_SOCKET__ */
+
+#ifdef  __UCLIBC_HAS_EPOLL__
+# ifdef __NR_epoll_wait
+CANCELABLE_SYSCALL (int, epoll_wait, (int epfd, struct epoll_event *events, int maxevents, int timeout),
+		    (epfd, events, maxevents, timeout))
+# endif
+# ifdef __NR_epoll_pwait
+#  include <signal.h>
+CANCELABLE_SYSCALL (int, epoll_pwait, (int epfd, struct epoll_event *events, int maxevents, int timeout,
+				       const sigset_t *set),
+		    (epfd, events, maxevents, timeout, set))
+# endif
+#endif

+ 1 - 1
libpthread/linuxthreads.old_db/td_ta_delete.c

@@ -45,7 +45,7 @@ td_ta_delete (td_thragent_t *ta)
 	runp = runp->next;
 	runp = runp->next;
 
 
       if (runp->next == NULL)
       if (runp->next == NULL)
-	/* It's not a valid decriptor since it is not in the list.  */
+	/* It's not a valid descriptor since it is not in the list.  */
 	return TD_BADTA;
 	return TD_BADTA;
 
 
       runp->next = runp->next->next;
       runp->next = runp->next->next;

+ 1 - 1
libpthread/linuxthreads_db/td_ta_delete.c

@@ -45,7 +45,7 @@ td_ta_delete (td_thragent_t *ta)
 	runp = runp->next;
 	runp = runp->next;
 
 
       if (runp->next == NULL)
       if (runp->next == NULL)
-	/* It's not a valid decriptor since it is not in the list.  */
+	/* It's not a valid descriptor since it is not in the list.  */
 	return TD_BADTA;
 	return TD_BADTA;
 
 
       runp->next = runp->next->next;
       runp->next = runp->next->next;

+ 3 - 0
libpthread/nptl/.gitignore

@@ -18,6 +18,9 @@ sysdeps/unix/sysv/linux/lowlevelrobustlock.h
 sysdeps/unix/sysv/linux/structsem.h
 sysdeps/unix/sysv/linux/structsem.h
 sysdeps/unix/sysv/linux/unwindbuf.h
 sysdeps/unix/sysv/linux/unwindbuf.h
 sysdeps/unix/sysv/linux/pthread-pi-defines.h
 sysdeps/unix/sysv/linux/pthread-pi-defines.h
+sysdeps/pthread/crt[in].S
+sysdeps/pthread/defs.h
+sysdeps/pthread/pt-initfini.s
 #
 #
 # symlinks
 # symlinks
 #
 #

+ 3 - 3
libpthread/nptl/ChangeLog

@@ -6717,7 +6717,7 @@
 
 
 2003-07-15  Ulrich Drepper  <drepper@redhat.com>
 2003-07-15  Ulrich Drepper  <drepper@redhat.com>
 
 
-	* tst-tcancel-wrappers.sh: lseek and llseek are not cancelation points.
+	* tst-tcancel-wrappers.sh: lseek and llseek are not cancellation points.
 
 
 2003-07-14  Ulrich Drepper  <drepper@redhat.com>
 2003-07-14  Ulrich Drepper  <drepper@redhat.com>
 
 
@@ -10308,7 +10308,7 @@
 
 
 	* sysdeps/unix/sysv/linux/i386/sysdep-cancel.h: Define
 	* sysdeps/unix/sysv/linux/i386/sysdep-cancel.h: Define
 	SINGLE_THREAD_P.  If in libc or libpthread examine multiple_thread
 	SINGLE_THREAD_P.  If in libc or libpthread examine multiple_thread
-	member of thread decriptor, otherwise return unconditionally 1.
+	member of thread descriptor, otherwise return unconditionally 1.
 
 
 2002-12-14  Ulrich Drepper  <drepper@redhat.com>
 2002-12-14  Ulrich Drepper  <drepper@redhat.com>
 
 
@@ -10990,7 +10990,7 @@
 	the static TLS block.
 	the static TLS block.
 	(allocate_stack): Call _dl_allocate_tls_init for user-provided stack.
 	(allocate_stack): Call _dl_allocate_tls_init for user-provided stack.
 
 
-	* cancellation.c: Renamed from cancelation.c.
+	* cancellation.c: Renamed from cancellation.c.
 	* Makefile: Adjust accordingly.
 	* Makefile: Adjust accordingly.
 	* pthreadP.h (CANCELLATION_P): Renamed from CANCELATION_P.
 	* pthreadP.h (CANCELLATION_P): Renamed from CANCELATION_P.
 	* cleanup_defer.c: Use CANCELLATION_P.
 	* cleanup_defer.c: Use CANCELLATION_P.

+ 7 - 5
libpthread/nptl/Makefile.in

@@ -63,9 +63,11 @@ librt-a-y += $(librt_OBJS)
 endif
 endif
 librt-so-y += $(librt_OBJS:.o=.oS) $(librt-pt-shared-only-routines-y:.o=.oS)
 librt-so-y += $(librt_OBJS:.o=.oS) $(librt-pt-shared-only-routines-y:.o=.oS)
 
 
-ifneq ($(UCLIBC_CTOR_DTOR),y)
-START_FILE-libpthread.so := $(top_builddir)/libpthread/nptl/sysdeps/pthread/crti.o $(SHARED_START_FILES)
-END_FILE-libpthread.so := $(SHARED_END_FILES) $(top_builddir)/libpthread/nptl/sysdeps/pthread/crtn.o
+ifeq ($(UCLIBC_CTOR_DTOR),y)
+START_FILE-libpthread.so := $(top_builddir)libpthread/nptl/sysdeps/pthread/pt-crti.o
+END_FILE-libpthread.so := $(top_builddir)libpthread/nptl/sysdeps/pthread/pt-crtn.o
+LDFLAGS-libpthread.so += -nostartfiles
+$(top_builddir)lib/libpthread.so: | $(START_FILE-libpthread.so) $(END_FILE-libpthread.so)
 endif
 endif
 
 
 libpthread_FULL_NAME := libpthread-$(VERSION).so
 libpthread_FULL_NAME := libpthread-$(VERSION).so
@@ -137,9 +139,9 @@ CLEAN_libpthread/nptl:
 	$(do_rm) $(addprefix $(libpthread_OUT)/*., o os oS a)
 	$(do_rm) $(addprefix $(libpthread_OUT)/*., o os oS a)
 
 
 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
-LDFLAGS-libpthread.so := $(LDFLAGS_NOSTRIP) -Wl,-z,defs
+LDFLAGS-libpthread.so += $(LDFLAGS_NOSTRIP) -Wl,-z,defs
 else
 else
-LDFLAGS-libpthread.so := $(LDFLAGS)
+LDFLAGS-libpthread.so += $(LDFLAGS)
 endif
 endif
 
 
 LDFLAGS-libpthread.so += $(top_builddir)lib/$(UCLIBC_LDSO_NAME)-$(VERSION).so $(top_builddir)lib/libdl-$(VERSION).so \
 LDFLAGS-libpthread.so += $(top_builddir)lib/$(UCLIBC_LDSO_NAME)-$(VERSION).so $(top_builddir)lib/libdl-$(VERSION).so \

+ 1 - 1
libpthread/nptl/pthreadP.h

@@ -312,7 +312,7 @@ __do_cancel (void)
 # define LIBC_CANCEL_HANDLED()	/* Nothing.  */
 # define LIBC_CANCEL_HANDLED()	/* Nothing.  */
 #endif
 #endif
 
 
-/* The signal used for asynchronous cancelation.  */
+/* The signal used for asynchronous cancellation.  */
 #define SIGCANCEL	__SIGRTMIN
 #define SIGCANCEL	__SIGRTMIN
 
 
 
 

+ 35 - 9
libpthread/nptl/sysdeps/pthread/Makefile.in

@@ -67,22 +67,48 @@ librt-pt-shared-only-routines-y = rt-unwind-resume.c
 
 
 ifeq ($(UCLIBC_CTOR_DTOR),y)
 ifeq ($(UCLIBC_CTOR_DTOR),y)
 CFLAGS-OMIT-pt-initfini.c = $(CFLAGS-pthread)
 CFLAGS-OMIT-pt-initfini.c = $(CFLAGS-pthread)
-CFLAGS-pt-initfini.c = -S -g0 -fPIC -fno-inline-functions	\
+CFLAGS-pt-initfini.c = -S -g0 $(PICFLAG) -fno-inline-functions	\
 			$(call check_gcc,-fno-unit-at-a-time,)	\
 			$(call check_gcc,-fno-unit-at-a-time,)	\
+			$(SSP_DISABLE_FLAGS) \
 			-finhibit-size-directive			\
 			-finhibit-size-directive			\
+			-fno-asynchronous-unwind-tables -fno-unwind-tables \
 			$(patsubst -f%,-fno-%,$(call check_gcc,-fexceptions,))
 			$(patsubst -f%,-fno-%,$(call check_gcc,-fexceptions,))
-ASFLAGS-crti.S = -g0
-ASFLAGS-crtn.S = -g0
 
 
-$(libpthread_pthread_OUT)/pt-initfini.s: $(libpthread_pthread_DIR)/pt-initfini.c
+#ASFLAGS += $(PICFLAG) -I$(top_srcdir)include -I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)
+ifneq ($(wildcard $(libpthread_pthread_DIR)/../unix/sysv/linux/$(TARGET_ARCH)/pt-initfini.c),)
+PTHREAD_INITFINI := $(libpthread_pthread_DIR)/../unix/sysv/linux/$(TARGET_ARCH)/pt-initfini.c
+else
+PTHREAD_INITFINI := $(libpthread_pthread_DIR)/pt-initfini.c
+endif
+
+ASFLAGS-pt-crti.S =  $(PICFLAG)
+ASFLAGS-pt-crtn.S =  $(PICFLAG)
+
+$(libpthread_pthread_OUT)/pt-crti.o: $(libpthread_pthread_OUT)/pt-crti.S
+	$(compile.S)
+
+$(libpthread_pthread_OUT)/pt-crtn.o: $(libpthread_pthread_OUT)/pt-crtn.S
+	$(compile.S)
+
+$(libpthread_pthread_OUT)/pt-initfini.s: $(PTHREAD_INITFINI) | $(top_builddir)include/bits/uClibc_config.h
 	$(compile.c)
 	$(compile.c)
-	$(do_sed) '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
-		$(do_awk) $(libpthread_pthread_DIR)/defs.awk > $(libpthread_pthread_OUT)/defs.h
+$(libpthread_pthread_OUT)/defs.h: $(PTHREAD_INITFINI)
+	$(do_sed) -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
+		$(AWK) -f $(top_srcdir)extra/scripts/defs.awk > $@.tmp
+	$(Q)mv $@.tmp $@
 
 
-$(libpthread_pthread_OUT)/crti.S $(libpthread_pthread_OUT)/crtn.S: $(libpthread_pthread_OUT)/pt-initfini.s
-	$(do_sed) -e '1,/@HEADER_ENDS/p' \
+$(libpthread_pthread_OUT)/pt-crti.S: $(libpthread_pthread_OUT)/pt-initfini.s $(libpthread_pthread_OUT)/defs.h
+	$(do_sed) -n -e '/[ 	]*\.file/d' \
+		-e '1,/@HEADER_ENDS/p' \
 		-e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \
 		-e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \
-		-e '/@TRAILER_BEGINS/,$$p' $< > $@
+		-e '/@TRAILER_BEGINS/,$$p' $< > $@.tmp
+	$(Q)mv $@.tmp $@
+$(libpthread_pthread_OUT)/pt-crtn.S: $(libpthread_pthread_OUT)/pt-initfini.s $(libpthread_pthread_OUT)/defs.h
+	$(do_sed) -n -e '/[ 	]*\.file/d' \
+		-e '1,/@HEADER_ENDS/p' \
+		-e '/@_.*_EPILOG_BEGINS/,/@_.*_EPILOG_ENDS/p' \
+		-e '/@TRAILER_BEGINS/,$$p' $< > $@.tmp
+	$(Q)mv $@.tmp $@
 endif
 endif
 # It would have been easier to just add dummy files that include the real
 # It would have been easier to just add dummy files that include the real
 # impl, but ok.
 # impl, but ok.

+ 0 - 24
libpthread/nptl/sysdeps/pthread/defs.awk

@@ -1,24 +0,0 @@
-/^[ 	]*\.endp/	 { need_endp = 1 }
-/^[ 	]*\.end/	 { need_end = 1 }
-/^[ 	]*\.align/ { if($2 > max) max = $2; }
-
-END {
-    if(need_endp)
-    {
-	print "#define END_INIT .endp _init";
-	print "#define END_FINI .endp _fini";
-    } else if(need_end)
-    {
-	print "#define END_INIT .end _init";
-	print "#define END_FINI .end _fini";
-    }
-    else
-    {
-	print "#define END_INIT";
-	print "#define END_FINI";
-    }
-    if(max)
-	print "#define ALIGN .align", max;
-    else
-	print "#define ALIGN";
-}

+ 4 - 0
libpthread/nptl/sysdeps/pthread/pt-initfini.c

@@ -44,6 +44,10 @@
 
 
 /* Embed an #include to pull in the alignment and .end directives. */
 /* Embed an #include to pull in the alignment and .end directives. */
 __asm__ ("\n#include \"defs.h\"");
 __asm__ ("\n#include \"defs.h\"");
+__asm__ ("\n#if defined __i686 && defined __ASSEMBLER__");
+__asm__ ("\n#undef __i686");
+__asm__ ("\n#define __i686 __i686");
+__asm__ ("\n#endif");
 
 
 /* The initial common code ends here. */
 /* The initial common code ends here. */
 __asm__ ("\n/*@HEADER_ENDS*/");
 __asm__ ("\n/*@HEADER_ENDS*/");

+ 1 - 1
libpthread/nptl/sysdeps/pthread/pthread_once.c

@@ -38,7 +38,7 @@ __pthread_once (
       lll_lock (once_lock, LLL_PRIVATE);
       lll_lock (once_lock, LLL_PRIVATE);
 
 
       /* XXX This implementation is not complete.  It doesn't take
       /* XXX This implementation is not complete.  It doesn't take
-	 cancelation and fork into account.  */
+	 cancellation and fork into account.  */
       if (*once_control == PTHREAD_ONCE_INIT)
       if (*once_control == PTHREAD_ONCE_INIT)
 	{
 	{
 	  init_routine ();
 	  init_routine ();

+ 16 - 16
libpthread/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h

@@ -336,7 +336,7 @@ LLL_STUB_UNWIND_INFO_END
     })
     })
 
 
 #define lll_robust_lock(futex, id, private) \
 #define lll_robust_lock(futex, id, private) \
-  ({ int __result, ignore1, ignore2;					      \
+  ({ int __ret, ignore1, ignore2;					      \
      __asm__ __volatile__ (LOCK_INSTR "cmpxchgl %1, %2\n\t"			      \
      __asm__ __volatile__ (LOCK_INSTR "cmpxchgl %1, %2\n\t"			      \
 		       "jnz _L_robust_lock_%=\n\t"			      \
 		       "jnz _L_robust_lock_%=\n\t"			      \
 		       ".subsection 1\n\t"				      \
 		       ".subsection 1\n\t"				      \
@@ -350,11 +350,11 @@ LLL_STUB_UNWIND_INFO_END
 		       ".previous\n"					      \
 		       ".previous\n"					      \
 		       LLL_STUB_UNWIND_INFO_4				      \
 		       LLL_STUB_UNWIND_INFO_4				      \
 		       "18:"						      \
 		       "18:"						      \
-		       : "=a" (__result), "=c" (ignore1), "=m" (futex),	      \
+		       : "=a" (__ret), "=c" (ignore1), "=m" (futex),	      \
 			 "=&d" (ignore2)				      \
 			 "=&d" (ignore2)				      \
 		       : "0" (0), "1" (id), "m" (futex), "g" ((int) (private))\
 		       : "0" (0), "1" (id), "m" (futex), "g" ((int) (private))\
 		       : "memory");					      \
 		       : "memory");					      \
-     __result; })
+     __ret; })
 
 
 
 
 /* Special version of lll_lock which causes the unlock function to
 /* Special version of lll_lock which causes the unlock function to
@@ -383,7 +383,7 @@ LLL_STUB_UNWIND_INFO_END
 
 
 
 
 #define lll_robust_cond_lock(futex, id, private) \
 #define lll_robust_cond_lock(futex, id, private) \
-  ({ int __result, ignore1, ignore2;					      \
+  ({ int __ret, ignore1, ignore2;					      \
      __asm__ __volatile__ (LOCK_INSTR "cmpxchgl %1, %2\n\t"			      \
      __asm__ __volatile__ (LOCK_INSTR "cmpxchgl %1, %2\n\t"			      \
 		       "jnz _L_robust_cond_lock_%=\n\t"			      \
 		       "jnz _L_robust_cond_lock_%=\n\t"			      \
 		       ".subsection 1\n\t"				      \
 		       ".subsection 1\n\t"				      \
@@ -397,16 +397,16 @@ LLL_STUB_UNWIND_INFO_END
 		       ".previous\n"					      \
 		       ".previous\n"					      \
 		       LLL_STUB_UNWIND_INFO_4				      \
 		       LLL_STUB_UNWIND_INFO_4				      \
 		       "18:"						      \
 		       "18:"						      \
-		       : "=a" (__result), "=c" (ignore1), "=m" (futex),	      \
+		       : "=a" (__ret), "=c" (ignore1), "=m" (futex),	      \
 			 "=&d" (ignore2)				      \
 			 "=&d" (ignore2)				      \
 		       : "0" (0), "1" (id | FUTEX_WAITERS), "m" (futex),      \
 		       : "0" (0), "1" (id | FUTEX_WAITERS), "m" (futex),      \
 			 "g" ((int) (private))				      \
 			 "g" ((int) (private))				      \
 		       : "memory");					      \
 		       : "memory");					      \
-     __result; })
+     __ret; })
 
 
 
 
 #define lll_timedlock(futex, timeout, private) \
 #define lll_timedlock(futex, timeout, private) \
-  ({ int __result, ignore1, ignore2, ignore3;				      \
+  ({ int __ret, ignore1, ignore2, ignore3;				      \
      __asm__ __volatile__ (LOCK_INSTR "cmpxchgl %1, %3\n\t"			      \
      __asm__ __volatile__ (LOCK_INSTR "cmpxchgl %1, %3\n\t"			      \
 		       "jnz _L_timedlock_%=\n\t"			      \
 		       "jnz _L_timedlock_%=\n\t"			      \
 		       ".subsection 1\n\t"				      \
 		       ".subsection 1\n\t"				      \
@@ -420,16 +420,16 @@ LLL_STUB_UNWIND_INFO_END
 		       ".previous\n"					      \
 		       ".previous\n"					      \
 		       LLL_STUB_UNWIND_INFO_4				      \
 		       LLL_STUB_UNWIND_INFO_4				      \
 		       "18:"						      \
 		       "18:"						      \
-		       : "=a" (__result), "=c" (ignore1), "=&d" (ignore2),      \
+		       : "=a" (__ret), "=c" (ignore1), "=&d" (ignore2),      \
 			 "=m" (futex), "=S" (ignore3)			      \
 			 "=m" (futex), "=S" (ignore3)			      \
 		       : "0" (0), "1" (1), "m" (futex), "m" (timeout),	      \
 		       : "0" (0), "1" (1), "m" (futex), "m" (timeout),	      \
 			 "4" ((int) (private))				      \
 			 "4" ((int) (private))				      \
 		       : "memory");					      \
 		       : "memory");					      \
-     __result; })
+     __ret; })
 
 
 
 
 #define lll_robust_timedlock(futex, timeout, id, private) \
 #define lll_robust_timedlock(futex, timeout, id, private) \
-  ({ int __result, ignore1, ignore2, ignore3;				      \
+  ({ int __ret, ignore1, ignore2, ignore3;				      \
      __asm__ __volatile__ (LOCK_INSTR "cmpxchgl %1, %3\n\t"			      \
      __asm__ __volatile__ (LOCK_INSTR "cmpxchgl %1, %3\n\t"			      \
 		       "jnz _L_robust_timedlock_%=\n\t"			      \
 		       "jnz _L_robust_timedlock_%=\n\t"			      \
 		       ".subsection 1\n\t"				      \
 		       ".subsection 1\n\t"				      \
@@ -443,12 +443,12 @@ LLL_STUB_UNWIND_INFO_END
 		       ".previous\n"					      \
 		       ".previous\n"					      \
 		       LLL_STUB_UNWIND_INFO_4				      \
 		       LLL_STUB_UNWIND_INFO_4				      \
 		       "18:"						      \
 		       "18:"						      \
-		       : "=a" (__result), "=c" (ignore1), "=&d" (ignore2),      \
+		       : "=a" (__ret), "=c" (ignore1), "=&d" (ignore2),      \
 			 "=m" (futex), "=S" (ignore3)			      \
 			 "=m" (futex), "=S" (ignore3)			      \
 		       : "0" (0), "1" (id), "m" (futex), "m" (timeout),	      \
 		       : "0" (0), "1" (id), "m" (futex), "m" (timeout),	      \
 			 "4" ((int) (private))				      \
 			 "4" ((int) (private))				      \
 		       : "memory");					      \
 		       : "memory");					      \
-     __result; })
+     __ret; })
 
 
 #if defined NOT_IN_libc || defined UP
 #if defined NOT_IN_libc || defined UP
 # define __lll_unlock_asm LOCK_INSTR "subl $1, %0\n\t"
 # define __lll_unlock_asm LOCK_INSTR "subl $1, %0\n\t"
@@ -570,15 +570,15 @@ extern int __lll_timedwait_tid (int *tid, const struct timespec *abstime)
      __attribute__ ((regparm (2))) attribute_hidden;
      __attribute__ ((regparm (2))) attribute_hidden;
 #define lll_timedwait_tid(tid, abstime) \
 #define lll_timedwait_tid(tid, abstime) \
   ({									      \
   ({									      \
-    int __result = 0;							      \
+    int __ret = 0;							      \
     if (tid != 0)							      \
     if (tid != 0)							      \
       {									      \
       {									      \
 	if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)	      \
 	if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)	      \
-	  __result = EINVAL;						      \
+	  __ret = EINVAL;						      \
 	else								      \
 	else								      \
-	  __result = __lll_timedwait_tid (&tid, abstime);		      \
+	  __ret = __lll_timedwait_tid (&tid, abstime);		      \
       }									      \
       }									      \
-    __result; })
+    __ret; })
 
 
 #endif  /* !__ASSEMBLER__ */
 #endif  /* !__ASSEMBLER__ */
 
 

+ 48 - 48
libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h

@@ -98,7 +98,7 @@ extern int __lll_unlock_wake_private (int *__futex) attribute_hidden;
 extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden;
 extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden;
 
 
 #define lll_trylock(futex) \
 #define lll_trylock(futex) \
-  ({ unsigned char __result; \
+  ({ unsigned char __ret; \
      __asm__ __volatile__ ("\
      __asm__ __volatile__ ("\
 	.align 2\n\
 	.align 2\n\
 	mova 1f,r0\n\
 	mova 1f,r0\n\
@@ -112,15 +112,15 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden;
      1: mov r1,r15\n\
      1: mov r1,r15\n\
 	mov #-1,%0\n\
 	mov #-1,%0\n\
 	negc %0,%0"\
 	negc %0,%0"\
-	: "=r" (__result) \
+	: "=r" (__ret) \
 	: "r" (&(futex)), \
 	: "r" (&(futex)), \
 	  "r" (LLL_LOCK_INITIALIZER_LOCKED), \
 	  "r" (LLL_LOCK_INITIALIZER_LOCKED), \
 	  "r" (LLL_LOCK_INITIALIZER) \
 	  "r" (LLL_LOCK_INITIALIZER) \
 	: "r0", "r1", "r2", "t", "memory"); \
 	: "r0", "r1", "r2", "t", "memory"); \
-     __result; })
+     __ret; })
 
 
 #define lll_robust_trylock(futex, id)	\
 #define lll_robust_trylock(futex, id)	\
-  ({ unsigned char __result; \
+  ({ unsigned char __ret; \
      __asm__ __volatile__ ("\
      __asm__ __volatile__ ("\
 	.align 2\n\
 	.align 2\n\
 	mova 1f,r0\n\
 	mova 1f,r0\n\
@@ -134,15 +134,15 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden;
      1: mov r1,r15\n\
      1: mov r1,r15\n\
 	mov #-1,%0\n\
 	mov #-1,%0\n\
 	negc %0,%0"\
 	negc %0,%0"\
-	: "=r" (__result) \
+	: "=r" (__ret) \
 	: "r" (&(futex)), \
 	: "r" (&(futex)), \
 	  "r" (id), \
 	  "r" (id), \
 	  "r" (LLL_LOCK_INITIALIZER) \
 	  "r" (LLL_LOCK_INITIALIZER) \
 	: "r0", "r1", "r2", "t", "memory"); \
 	: "r0", "r1", "r2", "t", "memory"); \
-     __result; })
+     __ret; })
 
 
 #define lll_cond_trylock(futex) \
 #define lll_cond_trylock(futex) \
-  ({ unsigned char __result; \
+  ({ unsigned char __ret; \
      __asm__ __volatile__ ("\
      __asm__ __volatile__ ("\
 	.align 2\n\
 	.align 2\n\
 	mova 1f,r0\n\
 	mova 1f,r0\n\
@@ -156,15 +156,15 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden;
      1: mov r1,r15\n\
      1: mov r1,r15\n\
 	mov #-1,%0\n\
 	mov #-1,%0\n\
 	negc %0,%0"\
 	negc %0,%0"\
-	: "=r" (__result) \
+	: "=r" (__ret) \
 	: "r" (&(futex)), \
 	: "r" (&(futex)), \
 	  "r" (LLL_LOCK_INITIALIZER_WAITERS), \
 	  "r" (LLL_LOCK_INITIALIZER_WAITERS), \
 	  "r" (LLL_LOCK_INITIALIZER) \
 	  "r" (LLL_LOCK_INITIALIZER) \
 	: "r0", "r1", "r2", "t", "memory"); \
 	: "r0", "r1", "r2", "t", "memory"); \
-     __result; })
+     __ret; })
 
 
 #define lll_lock(futex, private) \
 #define lll_lock(futex, private) \
-  (void) ({ int __result, *__futex = &(futex); \
+  (void) ({ int __ret, *__futex = &(futex); \
 	    __asm__ __volatile__ ("\
 	    __asm__ __volatile__ ("\
 		.align 2\n\
 		.align 2\n\
 		mova 1f,r0\n\
 		mova 1f,r0\n\
@@ -176,20 +176,20 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden;
 		bf 1f\n\
 		bf 1f\n\
 		mov.l %1,@%2\n\
 		mov.l %1,@%2\n\
 	     1: mov r1,r15"\
 	     1: mov r1,r15"\
-		: "=&r" (__result) : "r" (1), "r" (__futex) \
+		: "=&r" (__ret) : "r" (1), "r" (__futex) \
 		: "r0", "r1", "t", "memory"); \
 		: "r0", "r1", "t", "memory"); \
-	    if (__result) \
+	    if (__ret) \
 	      { \
 	      { \
 		if (__builtin_constant_p (private) \
 		if (__builtin_constant_p (private) \
 		    && (private) == LLL_PRIVATE) \
 		    && (private) == LLL_PRIVATE) \
-		  __lll_lock_wait_private (__result, __futex); \
+		  __lll_lock_wait_private (__ret, __futex); \
 	        else \
 	        else \
-		  __lll_lock_wait (__result, __futex, (private));	\
+		  __lll_lock_wait (__ret, __futex, (private));	\
 	      } \
 	      } \
     })
     })
 
 
 #define lll_robust_lock(futex, id, private) \
 #define lll_robust_lock(futex, id, private) \
-  ({ int __result, *__futex = &(futex); \
+  ({ int __ret, *__futex = &(futex); \
      __asm__ __volatile__ ("\
      __asm__ __volatile__ ("\
 	.align 2\n\
 	.align 2\n\
 	mova 1f,r0\n\
 	mova 1f,r0\n\
@@ -201,16 +201,16 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden;
 	bf 1f\n\
 	bf 1f\n\
 	mov.l %1,@%2\n\
 	mov.l %1,@%2\n\
       1: mov r1,r15"\
       1: mov r1,r15"\
-	: "=&r" (__result) : "r" (id), "r" (__futex) \
+	: "=&r" (__ret) : "r" (id), "r" (__futex) \
 	: "r0", "r1", "t", "memory"); \
 	: "r0", "r1", "t", "memory"); \
-     if (__result) \
-       __result = __lll_robust_lock_wait (__result, __futex, private); \
-     __result; })
+     if (__ret) \
+       __ret = __lll_robust_lock_wait (__ret, __futex, private); \
+     __ret; })
 
 
 /* Special version of lll_mutex_lock which causes the unlock function to
 /* Special version of lll_mutex_lock which causes the unlock function to
    always wakeup waiters.  */
    always wakeup waiters.  */
 #define lll_cond_lock(futex, private) \
 #define lll_cond_lock(futex, private) \
-  (void) ({ int __result, *__futex = &(futex); \
+  (void) ({ int __ret, *__futex = &(futex); \
 	    __asm__ __volatile__ ("\
 	    __asm__ __volatile__ ("\
 		.align 2\n\
 		.align 2\n\
 		mova 1f,r0\n\
 		mova 1f,r0\n\
@@ -222,13 +222,13 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden;
 		bf 1f\n\
 		bf 1f\n\
 		mov.l %1,@%2\n\
 		mov.l %1,@%2\n\
 	     1: mov r1,r15"\
 	     1: mov r1,r15"\
-		: "=&r" (__result) : "r" (2), "r" (__futex) \
+		: "=&r" (__ret) : "r" (2), "r" (__futex) \
 		: "r0", "r1", "t", "memory"); \
 		: "r0", "r1", "t", "memory"); \
-	    if (__result) \
-	      __lll_lock_wait (__result, __futex, private); })
+	    if (__ret) \
+	      __lll_lock_wait (__ret, __futex, private); })
 
 
 #define lll_robust_cond_lock(futex, id, private) \
 #define lll_robust_cond_lock(futex, id, private) \
-  ({ int __result, *__futex = &(futex); \
+  ({ int __ret, *__futex = &(futex); \
      __asm__ __volatile__ ("\
      __asm__ __volatile__ ("\
 	.align 2\n\
 	.align 2\n\
 	mova 1f,r0\n\
 	mova 1f,r0\n\
@@ -240,14 +240,14 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden;
 	bf 1f\n\
 	bf 1f\n\
 	mov.l %1,@%2\n\
 	mov.l %1,@%2\n\
      1: mov r1,r15"\
      1: mov r1,r15"\
-	: "=&r" (__result) : "r" (id | FUTEX_WAITERS), "r" (__futex) \
+	: "=&r" (__ret) : "r" (id | FUTEX_WAITERS), "r" (__futex) \
 	: "r0", "r1", "t", "memory"); \
 	: "r0", "r1", "t", "memory"); \
-      if (__result) \
-	__result = __lll_robust_lock_wait (__result, __futex, private); \
-      __result; })
+      if (__ret) \
+	__ret = __lll_robust_lock_wait (__ret, __futex, private); \
+      __ret; })
 
 
 #define lll_timedlock(futex, timeout, private) \
 #define lll_timedlock(futex, timeout, private) \
-  ({ int __result, *__futex = &(futex); \
+  ({ int __ret, *__futex = &(futex); \
      __asm__ __volatile__ ("\
      __asm__ __volatile__ ("\
 	.align 2\n\
 	.align 2\n\
 	mova 1f,r0\n\
 	mova 1f,r0\n\
@@ -259,14 +259,14 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden;
 	bf 1f\n\
 	bf 1f\n\
 	mov.l %1,@%2\n\
 	mov.l %1,@%2\n\
      1: mov r1,r15"\
      1: mov r1,r15"\
-	: "=&r" (__result) : "r" (1), "r" (__futex) \
+	: "=&r" (__ret) : "r" (1), "r" (__futex) \
 	: "r0", "r1", "t", "memory"); \
 	: "r0", "r1", "t", "memory"); \
-    if (__result) \
-      __result = __lll_timedlock_wait (__result, __futex, timeout, private); \
-    __result; })
+    if (__ret) \
+      __ret = __lll_timedlock_wait (__ret, __futex, timeout, private); \
+    __ret; })
 
 
 #define lll_robust_timedlock(futex, timeout, id, private) \
 #define lll_robust_timedlock(futex, timeout, id, private) \
-  ({ int __result, *__futex = &(futex); \
+  ({ int __ret, *__futex = &(futex); \
      __asm__ __volatile__ ("\
      __asm__ __volatile__ ("\
 	.align 2\n\
 	.align 2\n\
 	mova 1f,r0\n\
 	mova 1f,r0\n\
@@ -278,15 +278,15 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden;
 	bf 1f\n\
 	bf 1f\n\
 	mov.l %1,@%2\n\
 	mov.l %1,@%2\n\
      1: mov r1,r15"\
      1: mov r1,r15"\
-	: "=&r" (__result) : "r" (id), "r" (__futex) \
+	: "=&r" (__ret) : "r" (id), "r" (__futex) \
 	: "r0", "r1", "t", "memory"); \
 	: "r0", "r1", "t", "memory"); \
-    if (__result) \
-      __result = __lll_robust_timedlock_wait (__result, __futex, \
+    if (__ret) \
+      __ret = __lll_robust_timedlock_wait (__ret, __futex, \
 					      timeout, private); \
 					      timeout, private); \
-    __result; })
+    __ret; })
 
 
 #define lll_unlock(futex, private) \
 #define lll_unlock(futex, private) \
-  (void) ({ int __result, *__futex = &(futex); \
+  (void) ({ int __ret, *__futex = &(futex); \
 	    __asm__ __volatile__ ("\
 	    __asm__ __volatile__ ("\
 		.align 2\n\
 		.align 2\n\
 		mova 1f,r0\n\
 		mova 1f,r0\n\
@@ -296,9 +296,9 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden;
 		add #-1,%0\n\
 		add #-1,%0\n\
 		mov.l %0,@%1\n\
 		mov.l %0,@%1\n\
 	     1: mov r1,r15"\
 	     1: mov r1,r15"\
-		: "=&r" (__result) : "r" (__futex) \
+		: "=&r" (__ret) : "r" (__futex) \
 		: "r0", "r1", "memory"); \
 		: "r0", "r1", "memory"); \
-	    if (__result) \
+	    if (__ret) \
 	      { \
 	      { \
 		if (__builtin_constant_p (private) \
 		if (__builtin_constant_p (private) \
 		    && (private) == LLL_PRIVATE) \
 		    && (private) == LLL_PRIVATE) \
@@ -309,7 +309,7 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden;
     })
     })
 
 
 #define lll_robust_unlock(futex, private) \
 #define lll_robust_unlock(futex, private) \
-  (void) ({ int __result, *__futex = &(futex); \
+  (void) ({ int __ret, *__futex = &(futex); \
 	    __asm__ __volatile__ ("\
 	    __asm__ __volatile__ ("\
 		.align 2\n\
 		.align 2\n\
 		mova 1f,r0\n\
 		mova 1f,r0\n\
@@ -319,9 +319,9 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden;
 		and %2,%0\n\
 		and %2,%0\n\
 		mov.l %0,@%1\n\
 		mov.l %0,@%1\n\
 	     1: mov r1,r15"\
 	     1: mov r1,r15"\
-		: "=&r" (__result) : "r" (__futex), "r" (FUTEX_WAITERS) \
+		: "=&r" (__ret) : "r" (__futex), "r" (FUTEX_WAITERS) \
 		: "r0", "r1", "memory");	\
 		: "r0", "r1", "memory");	\
-	    if (__result) \
+	    if (__ret) \
 	      __lll_unlock_wake (__futex, private); })
 	      __lll_unlock_wake (__futex, private); })
 
 
 #define lll_robust_dead(futex, private)		       \
 #define lll_robust_dead(futex, private)		       \
@@ -405,15 +405,15 @@ extern int __lll_timedwait_tid (int *tid, const struct timespec *abstime)
      attribute_hidden;
      attribute_hidden;
 #define lll_timedwait_tid(tid, abstime) \
 #define lll_timedwait_tid(tid, abstime) \
   ({									      \
   ({									      \
-    int __result = 0;							      \
+    int __ret = 0;							      \
     if (tid != 0)							      \
     if (tid != 0)							      \
       {									      \
       {									      \
 	if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)	      \
 	if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)	      \
-	  __result = EINVAL;						      \
+	  __ret = EINVAL;						      \
 	else								      \
 	else								      \
-	  __result = __lll_timedwait_tid (&tid, abstime);		      \
+	  __ret = __lll_timedwait_tid (&tid, abstime);		      \
       }									      \
       }									      \
-    __result; })
+    __ret; })
 
 
 #endif  /* !__ASSEMBLER__ */
 #endif  /* !__ASSEMBLER__ */
 
 

+ 16 - 16
libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h

@@ -332,7 +332,7 @@ LLL_STUB_UNWIND_INFO_END
     })									      \
     })									      \
 
 
 #define lll_robust_lock(futex, id, private) \
 #define lll_robust_lock(futex, id, private) \
-  ({ int result, ignore1, ignore2;					      \
+  ({ int __ret, ignore1, ignore2;					      \
     __asm__ __volatile__ (LOCK_INSTR "cmpxchgl %4, %2\n\t"			      \
     __asm__ __volatile__ (LOCK_INSTR "cmpxchgl %4, %2\n\t"			      \
 		      "jnz 1f\n\t"					      \
 		      "jnz 1f\n\t"					      \
 		      ".subsection 1\n\t"				      \
 		      ".subsection 1\n\t"				      \
@@ -348,10 +348,10 @@ LLL_STUB_UNWIND_INFO_END
 		      LLL_STUB_UNWIND_INFO_5				      \
 		      LLL_STUB_UNWIND_INFO_5				      \
 		      "24:"						      \
 		      "24:"						      \
 		      : "=S" (ignore1), "=D" (ignore2), "=m" (futex),	      \
 		      : "=S" (ignore1), "=D" (ignore2), "=m" (futex),	      \
-			"=a" (result)					      \
+			"=a" (__ret)					      \
 		      : "1" (id), "m" (futex), "3" (0), "0" (private)	      \
 		      : "1" (id), "m" (futex), "3" (0), "0" (private)	      \
 		      : "cx", "r11", "cc", "memory");			      \
 		      : "cx", "r11", "cc", "memory");			      \
-    result; })
+    __ret; })
 
 
 #define lll_cond_lock(futex, private) \
 #define lll_cond_lock(futex, private) \
   (void)								      \
   (void)								      \
@@ -377,7 +377,7 @@ LLL_STUB_UNWIND_INFO_END
     })
     })
 
 
 #define lll_robust_cond_lock(futex, id, private) \
 #define lll_robust_cond_lock(futex, id, private) \
-  ({ int result, ignore1, ignore2;					      \
+  ({ int __ret, ignore1, ignore2;					      \
     __asm__ __volatile__ (LOCK_INSTR "cmpxchgl %4, %2\n\t"			      \
     __asm__ __volatile__ (LOCK_INSTR "cmpxchgl %4, %2\n\t"			      \
 		      "jnz 1f\n\t"					      \
 		      "jnz 1f\n\t"					      \
 		      ".subsection 1\n\t"				      \
 		      ".subsection 1\n\t"				      \
@@ -393,14 +393,14 @@ LLL_STUB_UNWIND_INFO_END
 		      LLL_STUB_UNWIND_INFO_5				      \
 		      LLL_STUB_UNWIND_INFO_5				      \
 		      "24:"						      \
 		      "24:"						      \
 		      : "=S" (ignore1), "=D" (ignore2), "=m" (futex),	      \
 		      : "=S" (ignore1), "=D" (ignore2), "=m" (futex),	      \
-			"=a" (result)					      \
+			"=a" (__ret)					      \
 		      : "1" (id | FUTEX_WAITERS), "m" (futex), "3" (0),	      \
 		      : "1" (id | FUTEX_WAITERS), "m" (futex), "3" (0),	      \
 			"0" (private)					      \
 			"0" (private)					      \
 		      : "cx", "r11", "cc", "memory");			      \
 		      : "cx", "r11", "cc", "memory");			      \
-    result; })
+    __ret; })
 
 
 #define lll_timedlock(futex, timeout, private) \
 #define lll_timedlock(futex, timeout, private) \
-  ({ int result, ignore1, ignore2, ignore3;				      \
+  ({ int __ret, ignore1, ignore2, ignore3;				      \
      __asm__ __volatile__ (LOCK_INSTR "cmpxchgl %1, %4\n\t"			      \
      __asm__ __volatile__ (LOCK_INSTR "cmpxchgl %1, %4\n\t"			      \
 		       "jnz 1f\n\t"					      \
 		       "jnz 1f\n\t"					      \
 		       ".subsection 1\n\t"				      \
 		       ".subsection 1\n\t"				      \
@@ -416,15 +416,15 @@ LLL_STUB_UNWIND_INFO_END
 		       ".previous\n"					      \
 		       ".previous\n"					      \
 		       LLL_STUB_UNWIND_INFO_6				      \
 		       LLL_STUB_UNWIND_INFO_6				      \
 		       "24:"						      \
 		       "24:"						      \
-		       : "=a" (result), "=D" (ignore1), "=S" (ignore2),	      \
+		       : "=a" (__ret), "=D" (ignore1), "=S" (ignore2),	      \
 			 "=&d" (ignore3), "=m" (futex)			      \
 			 "=&d" (ignore3), "=m" (futex)			      \
 		       : "0" (0), "1" (1), "m" (futex), "m" (timeout),	      \
 		       : "0" (0), "1" (1), "m" (futex), "m" (timeout),	      \
 			 "2" (private)					      \
 			 "2" (private)					      \
 		       : "memory", "cx", "cc", "r10", "r11");		      \
 		       : "memory", "cx", "cc", "r10", "r11");		      \
-     result; })
+     __ret; })
 
 
 #define lll_robust_timedlock(futex, timeout, id, private) \
 #define lll_robust_timedlock(futex, timeout, id, private) \
-  ({ int result, ignore1, ignore2, ignore3;				      \
+  ({ int __ret, ignore1, ignore2, ignore3;				      \
      __asm__ __volatile__ (LOCK_INSTR "cmpxchgl %1, %4\n\t"			      \
      __asm__ __volatile__ (LOCK_INSTR "cmpxchgl %1, %4\n\t"			      \
 		       "jnz 1f\n\t"					      \
 		       "jnz 1f\n\t"					      \
 		       ".subsection 1\n\t"				      \
 		       ".subsection 1\n\t"				      \
@@ -440,12 +440,12 @@ LLL_STUB_UNWIND_INFO_END
 		       ".previous\n"					      \
 		       ".previous\n"					      \
 		       LLL_STUB_UNWIND_INFO_6				      \
 		       LLL_STUB_UNWIND_INFO_6				      \
 		       "24:"						      \
 		       "24:"						      \
-		       : "=a" (result), "=D" (ignore1), "=S" (ignore2),       \
+		       : "=a" (__ret), "=D" (ignore1), "=S" (ignore2),       \
 			 "=&d" (ignore3), "=m" (futex)			      \
 			 "=&d" (ignore3), "=m" (futex)			      \
 		       : "0" (0), "1" (id), "m" (futex), "m" (timeout),	      \
 		       : "0" (0), "1" (id), "m" (futex), "m" (timeout),	      \
 			 "2" (private)					      \
 			 "2" (private)					      \
 		       : "memory", "cx", "cc", "r10", "r11");		      \
 		       : "memory", "cx", "cc", "r10", "r11");		      \
-     result; })
+     __ret; })
 
 
 #if defined NOT_IN_libc || defined UP
 #if defined NOT_IN_libc || defined UP
 # define __lll_unlock_asm_start LOCK_INSTR "decl %0\n\t"		      \
 # define __lll_unlock_asm_start LOCK_INSTR "decl %0\n\t"		      \
@@ -583,15 +583,15 @@ extern int __lll_timedwait_tid (int *tid, const struct timespec *abstime)
      attribute_hidden;
      attribute_hidden;
 #define lll_timedwait_tid(tid, abstime) \
 #define lll_timedwait_tid(tid, abstime) \
   ({									      \
   ({									      \
-    int __result = 0;							      \
+    int __ret = 0;							      \
     if (tid != 0)							      \
     if (tid != 0)							      \
       {									      \
       {									      \
 	if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)	      \
 	if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)	      \
-	  __result = EINVAL;						      \
+	  __ret = EINVAL;						      \
 	else								      \
 	else								      \
-	  __result = __lll_timedwait_tid (&tid, abstime);		      \
+	  __ret = __lll_timedwait_tid (&tid, abstime);		      \
       }									      \
       }									      \
-    __result; })
+    __ret; })
 
 
 #endif  /* !__ASSEMBLER__ */
 #endif  /* !__ASSEMBLER__ */