devel
Threads by month
- ----- 2025 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
March 2015
- 4 participants
- 32 discussions

uClibc-ng - small C library for embedded systems branch master updated. 18f2dcaa53b7c34625d9bb2cc7c4a89d60d6b375
by wbx@helium.waldemar-brodkorb.de 31 Mar '15
by wbx@helium.waldemar-brodkorb.de 31 Mar '15
31 Mar '15
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".
The branch, master has been updated
via 18f2dcaa53b7c34625d9bb2cc7c4a89d60d6b375 (commit)
from 09db993c96d83bf43bc972edc9ed78d134ef9608 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 18f2dcaa53b7c34625d9bb2cc7c4a89d60d6b375
Author: Waldemar Brodkorb <wbx(a)openadk.org>
Date: Tue Mar 31 13:56:17 2015 -0500
we need -fPIC for the new test for m68k binutils problem
-----------------------------------------------------------------------
Summary of changes:
test/misc/Makefile.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/test/misc/Makefile.in b/test/misc/Makefile.in
index d78b276..09ff5c3 100644
--- a/test/misc/Makefile.in
+++ b/test/misc/Makefile.in
@@ -45,3 +45,4 @@ CFLAGS_bug-glob2 = -fPIC
CFLAGS_opendir-tst1 = -fPIC
CFLAGS_tst-inotify = -fPIC
CFLAGS_tst-utmp = -fPIC
+CFLAGS_tst-utmpx = -fPIC
hooks/post-receive
--
uClibc-ng - small C library for embedded systems
1
0

uClibc-ng - small C library for embedded systems branch master updated. 09db993c96d83bf43bc972edc9ed78d134ef9608
by wbx@helium.waldemar-brodkorb.de 30 Mar '15
by wbx@helium.waldemar-brodkorb.de 30 Mar '15
30 Mar '15
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".
The branch, master has been updated
via 09db993c96d83bf43bc972edc9ed78d134ef9608 (commit)
from 0c5a5b1aa93ee051556d487b68352cec0c3e1a96 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 09db993c96d83bf43bc972edc9ed78d134ef9608
Author: Waldemar Brodkorb <wbx(a)openadk.org>
Date: Mon Mar 30 03:48:56 2015 -0500
remove sh64 support
No real hardware available. The project for sh64 with sh5 seems
dead since 10 years.
-----------------------------------------------------------------------
Summary of changes:
Rules.mak | 6 -
extra/Configs/Config.in | 8 -
extra/Configs/Config.sh64 | 33 --
extra/Configs/defconfigs/sh64/defconfig | 1 -
ldso/ldso/sh64/dl-debug.h | 79 -----
ldso/ldso/sh64/dl-startup.h | 118 -------
ldso/ldso/sh64/dl-syscalls.h | 18 -
ldso/ldso/sh64/dl-sysdep.h | 168 ----------
ldso/ldso/sh64/elfinterp.c | 345 --------------------
ldso/ldso/sh64/resolve.S | 95 ------
libc/string/sh64/Makefile | 13 -
libc/string/sh64/memcpy.S | 205 ------------
libc/string/sh64/memset.S | 97 ------
libc/string/sh64/strcpy.S | 102 ------
libc/string/sh64/strlen.S | 63 ----
libc/sysdeps/linux/sh64/Makefile | 15 -
libc/sysdeps/linux/sh64/Makefile.arch | 10 -
libc/sysdeps/linux/sh64/__init_brk.c | 26 --
libc/sysdeps/linux/sh64/__longjmp.S | 140 --------
libc/sysdeps/linux/sh64/bits/endian.h | 20 --
libc/sysdeps/linux/sh64/bits/fcntl.h | 218 -------------
libc/sysdeps/linux/sh64/bits/kernel_stat.h | 55 ----
libc/sysdeps/linux/sh64/bits/kernel_types.h | 58 ----
libc/sysdeps/linux/sh64/bits/setjmp.h | 46 ---
libc/sysdeps/linux/sh64/bits/shm.h | 102 ------
libc/sysdeps/linux/sh64/bits/stackinfo.h | 27 --
libc/sysdeps/linux/sh64/bits/syscalls.h | 126 -------
.../sysdeps/linux/sh64/bits/uClibc_arch_features.h | 47 ---
libc/sysdeps/linux/sh64/bits/wordsize.h | 12 -
libc/sysdeps/linux/sh64/brk.c | 27 --
libc/sysdeps/linux/sh64/crt1.S | 82 -----
libc/sysdeps/linux/sh64/crti.S | 42 ---
libc/sysdeps/linux/sh64/crtn.S | 31 --
libc/sysdeps/linux/sh64/sbrk.c | 25 --
libc/sysdeps/linux/sh64/setjmp.S | 139 --------
libc/sysdeps/linux/sh64/sys/procfs.h | 125 -------
libc/sysdeps/linux/sh64/sys/ucontext.h | 204 ------------
libc/sysdeps/linux/sh64/syscall.c | 24 --
libpthread/linuxthreads/sysdeps/sh64/Makefile.arch | 30 --
libpthread/linuxthreads/sysdeps/sh64/pt-machine.c | 46 ---
libpthread/linuxthreads/sysdeps/sh64/pt-machine.h | 38 ---
41 files changed, 3066 deletions(-)
delete mode 100644 extra/Configs/Config.sh64
delete mode 100644 extra/Configs/defconfigs/sh64/defconfig
delete mode 100644 ldso/ldso/sh64/dl-debug.h
delete mode 100644 ldso/ldso/sh64/dl-startup.h
delete mode 100644 ldso/ldso/sh64/dl-syscalls.h
delete mode 100644 ldso/ldso/sh64/dl-sysdep.h
delete mode 100644 ldso/ldso/sh64/elfinterp.c
delete mode 100644 ldso/ldso/sh64/resolve.S
delete mode 100644 libc/string/sh64/Makefile
delete mode 100644 libc/string/sh64/memcpy.S
delete mode 100644 libc/string/sh64/memset.S
delete mode 100644 libc/string/sh64/strcpy.S
delete mode 100644 libc/string/sh64/strlen.S
delete mode 100644 libc/sysdeps/linux/sh64/Makefile
delete mode 100644 libc/sysdeps/linux/sh64/Makefile.arch
delete mode 100644 libc/sysdeps/linux/sh64/__init_brk.c
delete mode 100644 libc/sysdeps/linux/sh64/__longjmp.S
delete mode 100644 libc/sysdeps/linux/sh64/bits/endian.h
delete mode 100644 libc/sysdeps/linux/sh64/bits/fcntl.h
delete mode 100644 libc/sysdeps/linux/sh64/bits/kernel_stat.h
delete mode 100644 libc/sysdeps/linux/sh64/bits/kernel_types.h
delete mode 100644 libc/sysdeps/linux/sh64/bits/setjmp.h
delete mode 100644 libc/sysdeps/linux/sh64/bits/shm.h
delete mode 100644 libc/sysdeps/linux/sh64/bits/stackinfo.h
delete mode 100644 libc/sysdeps/linux/sh64/bits/syscalls.h
delete mode 100644 libc/sysdeps/linux/sh64/bits/uClibc_arch_features.h
delete mode 100644 libc/sysdeps/linux/sh64/bits/wordsize.h
delete mode 100644 libc/sysdeps/linux/sh64/brk.c
delete mode 100644 libc/sysdeps/linux/sh64/crt1.S
delete mode 100644 libc/sysdeps/linux/sh64/crti.S
delete mode 100644 libc/sysdeps/linux/sh64/crtn.S
delete mode 100644 libc/sysdeps/linux/sh64/sbrk.c
delete mode 100644 libc/sysdeps/linux/sh64/setjmp.S
delete mode 100644 libc/sysdeps/linux/sh64/sys/procfs.h
delete mode 100644 libc/sysdeps/linux/sh64/sys/ucontext.h
delete mode 100644 libc/sysdeps/linux/sh64/syscall.c
delete mode 100644 libpthread/linuxthreads/sysdeps/sh64/Makefile.arch
delete mode 100644 libpthread/linuxthreads/sysdeps/sh64/pt-machine.c
delete mode 100644 libpthread/linuxthreads/sysdeps/sh64/pt-machine.h
diff --git a/Rules.mak b/Rules.mak
index d13604f..d93a77e 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -415,12 +415,6 @@ else
endif
endif
-ifeq ($(TARGET_ARCH),sh64)
- CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN):=-ml
- CPU_CFLAGS-$(ARCH_BIG_ENDIAN):=-mb
- CPU_CFLAGS-$(CONFIG_SH5)+=-m5-32media
-endif
-
ifeq ($(TARGET_ARCH),h8300)
SYMBOL_PREFIX=_
CPU_LDFLAGS-$(CONFIG_H8300H)+= -Wl,-ms8300h
diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in
index 794d663..371259f 100644
--- a/extra/Configs/Config.in
+++ b/extra/Configs/Config.in
@@ -34,7 +34,6 @@ choice
default TARGET_nios2 if DESIRED_TARGET_ARCH = "nios2"
default TARGET_powerpc if DESIRED_TARGET_ARCH = "powerpc"
default TARGET_sh if DESIRED_TARGET_ARCH = "sh"
- default TARGET_sh64 if DESIRED_TARGET_ARCH = "sh64"
default TARGET_sparc if DESIRED_TARGET_ARCH = "sparc"
default TARGET_v850 if DESIRED_TARGET_ARCH = "v850"
default TARGET_x86_64 if DESIRED_TARGET_ARCH = "x86_64"
@@ -104,9 +103,6 @@ config TARGET_powerpc
config TARGET_sh
bool "superh"
-config TARGET_sh64
- bool "sh64"
-
config TARGET_sparc
bool "sparc"
@@ -196,10 +192,6 @@ if TARGET_sh
source "extra/Configs/Config.sh"
endif
-if TARGET_sh64
-source "extra/Configs/Config.sh64"
-endif
-
if TARGET_sparc
source "extra/Configs/Config.sparc"
endif
diff --git a/extra/Configs/Config.sh64 b/extra/Configs/Config.sh64
deleted file mode 100644
index a617510..0000000
--- a/extra/Configs/Config.sh64
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see extra/config/Kconfig-language.txt
-#
-
-config TARGET_ARCH
- string
- default "sh64"
-
-config FORCE_OPTIONS_FOR_ARCH
- bool
- default y
- select ARCH_ANY_ENDIAN
- select ARCH_HAS_DEPRECATED_SYSCALLS
-
-choice
- prompt "Target Processor Type"
- default CONFIG_SH5
- help
- This is the processor type of your CPU. This information is used for
- optimizing purposes, as well as to determine if your CPU has an MMU,
- an FPU, etc. If you pick the wrong CPU type, there is no guarantee
- that uClibc will work at all....
-
- Here are the available choices:
- - "SH5" SuperH SH-5 101, 103
-
-config CONFIG_SH5
- select ARCH_HAS_MMU
- select UCLIBC_HAS_LFS
- bool "SH5"
-
-endchoice
diff --git a/extra/Configs/defconfigs/sh64/defconfig b/extra/Configs/defconfigs/sh64/defconfig
deleted file mode 100644
index 4f23a54..0000000
--- a/extra/Configs/defconfigs/sh64/defconfig
+++ /dev/null
@@ -1 +0,0 @@
-TARGET_sh64=y
diff --git a/ldso/ldso/sh64/dl-debug.h b/ldso/ldso/sh64/dl-debug.h
deleted file mode 100644
index 6d861e5..0000000
--- a/ldso/ldso/sh64/dl-debug.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* vi: set sw=8 ts=8: */
-/*
- * ldso/ldso/sh64/elfinterp.c
- *
- * SuperH (sh64) ELF shared library loader suppport
- *
- * Copyright (C) 2003, 2004, 2005 Paul Mundt <lethal(a)linux-sh.org>
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. The name of the above contributors may not be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-static const char * const _dl_reltypes_tab[] = {
- /* SHcompact relocs */
- [0] = "R_SH_NONE", "R_SH_DIR32",
- "R_SH_REL32", "R_SH_DIR8WPN",
- [4] = "R_SH_IND12W", "R_SH_DIR8WPL",
- "R_SH_DIR8WPZ", "R_SH_DIR8BP",
- [8] = "R_SH_DIR8W", "R_SH_DIR8L",
- [25] = "R_SH_SWITCH16", "R_SH_SWITCH32",
- "R_SH_USES", "R_SH_COUNT",
- [29] = "R_SH_ALIGN", "R_SH_CODE",
- "R_SH_DATA", "R_SH_LABEL",
- [33] = "R_SH_SWITCH8", "R_SH_GNU_VTINHERIT",
- "R_SH_GNU_VTENTRY",
- [160] = "R_SH_GOT32", "R_SH_PLT32",
- "R_SH_COPY", "R_SH_GLOB_DAT",
- [164] = "R_SH_JMP_SLOT", "R_SH_RELATIVE",
- "R_SH_GOTOFF", "R_SH_GOTPC",
-
- /* SHmedia relocs */
- [45] = "R_SH_DIR5U", "R_SH_DIR6U",
- "R_SH_DIR6S", "R_SH_DIR10S",
- [49] = "R_SH_DIR10SW", "R_SH_DIR10SL",
- "R_SH_DIR10SQ",
- [169] = "R_SH_GOT_LOW16", "R_SH_GOT_MEDLOW16",
- "R_SH_GOT_MEDHI16", "R_SH_GOT_HI16",
- [173] = "R_SH_GOTPLT_LOW16", "R_SH_GOTPLT_MEDLOW16",
- "R_SH_GOTPLT_MEDHI16", "R_SH_GOTPLT_HI16",
- [177] = "R_SH_PLT_LOW16", "R_SH_PLT_MEDLOW16",
- "R_SH_PLT_MEDHI16", "R_SH_PLT_HI16",
- [181] = "R_SH_GOTOFF_LOW16", "R_SH_GOTOFF_MEDLOW16",
- "R_SH_GOTOFF_MEDHI16", "R_SH_GOTOFF_HI16",
- [185] = "R_SH_GOTPC_LOW16", "R_SH_GOTPC_MEDLOW16",
- "R_SH_GOTPC_MEDHI16", "R_SH_GOTPC_HI16",
- [189] = "R_SH_GOT10BY4", "R_SH_GOTPLT10BY4",
- "R_SH_GOT10BY8", "R_SH_GOTPLT10BY8",
- [193] = "R_SH_COPY64", "R_SH_GLOB_DAT64",
- "R_SH_JMP_SLOT64", "R_SH_RELATIVE64",
- [197] = "R_SH_RELATIVE_LOW16", "R_SH_RELATIVE_MEDLOW16",
- "R_SH_RELATIVE_MEDHI16","R_SH_RELATIVE_HI16",
- [242] = "R_SH_SHMEDIA_CODE", "R_SH_PT_16",
- "R_SH_IMMS16", "R_SH_IMMU16",
- [246] = "R_SH_IMM_LOW16", "R_SH_IMM_LOW16_PCREL",
- "R_SH_IMM_MEDLOW16", "R_SH_IMM_MEDLOW16_PCREL",
- [250] = "R_SH_IMM_MEDHI16", "R_SH_IMM_MEDHI16_PCREL",
- "R_SH_IMM_HI16", "R_SH_IMM_HI16_PCREL",
- [254] = "R_SH_64", "R_SH_64_PCREL",
-};
diff --git a/ldso/ldso/sh64/dl-startup.h b/ldso/ldso/sh64/dl-startup.h
deleted file mode 100644
index 9dac5ef..0000000
--- a/ldso/ldso/sh64/dl-startup.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* Any assembly language/system dependent hacks needed to setup boot1.c so it
- * will work as expected and cope with whatever platform specific wierdness is
- * needed for this architecture.
- */
-
-__asm__("" \
-" .section .text..SHmedia32,\"ax\"\n" \
-" .globl _start\n" \
-" .type _start, @function\n" \
-" .hidden _start\n" \
-" .align 5\n" \
-"_start:\n" \
-" ! Set r12 to point to GOT\n" \
-" movi (((datalabel _GLOBAL_OFFSET_TABLE_-(.LZZZ3-.)) >> 16) & 0xffff), r12\n" \
-" shori ((datalabel _GLOBAL_OFFSET_TABLE_-(.LZZZ3-.)) & 0xffff), r12\n" \
-".LZZZ3:\n" \
-" ptrel/u r12, tr0\n" \
-" gettr tr0, r12 ! GOT address\n" \
-" add r18, r63, r11 ! save return address - needed?\n" \
-" add r15, r63, r2 ! arg = stack pointer\n" \
-" pt _dl_start, tr0 ! should work even if PIC\n" \
-" blink tr0, r18 ! call _dl_start - user EP is in r2\n" \
-" add r2, r63, r28\n" \
-" movi (((_dl_fini@GOT) >> 16) & 0xffff), r1\n" \
-" shori ((_dl_fini@GOT) & 0xffff), r1\n" \
-" ldx.l r1, r12, r2\n" \
-" add r11, r63, r18\n" \
-" ptabs/l r28, tr0\n" \
-" blink tr0, r63\n" \
-" .size _start,.-_start\n"
-" .previous\n"
-);
-
-/*
- * Get a pointer to the argv array. On many platforms this can be just
- * the address of the first argument, on other platforms we need to
- * do something a little more subtle here.
- */
-#define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long *)ARGS)+1)
-
-/*
- * Here is a macro to perform a relocation. This is only used when
- * bootstrapping the dynamic loader. RELP is the relocation that we
- * are performing, REL is the pointer to the address we are relocating.
- * SYMBOL is the symbol involved in the relocation, and LOAD is the
- * load address.
- */
-
-#include <elf.h>
-
-#define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD,SYMTAB) \
- const unsigned int r_type = ELF_R_TYPE((RELP)->r_info); \
- int lsb = !!((SYMTAB)->st_other & STO_SH5_ISA32); \
- \
- switch (r_type) { \
- case R_SH_REL32: \
- *(REL) = (SYMBOL) + (RELP)->r_addend \
- - (unsigned long)(REL); \
- break; \
- case R_SH_DIR32: \
- case R_SH_GLOB_DAT: \
- case R_SH_JMP_SLOT: \
- *(REL) = ((SYMBOL) + (RELP)->r_addend) | lsb; \
- break; \
- case R_SH_RELATIVE: \
- *(REL) = (LOAD) + (RELP)->r_addend; \
- break; \
- case R_SH_RELATIVE_LOW16: \
- case R_SH_RELATIVE_MEDLOW16: \
- { \
- unsigned long word, value; \
- \
- word = (unsigned long)(REL) & ~0x3fffc00; \
- value = (LOAD) + (RELP)->r_addend; \
- \
- if (r_type == R_SH_RELATIVE_MEDLOW16) \
- value >>= 16; \
- \
- word |= (value & 0xffff) << 10; \
- *(REL) = word; \
- break; \
- } \
- case R_SH_IMM_LOW16: \
- case R_SH_IMM_MEDLOW16: \
- { \
- unsigned long word, value; \
- \
- word = (unsigned long)(REL) & ~0x3fffc00; \
- value = ((SYMBOL) + (RELP)->r_addend) | lsb; \
- \
- if (r_type == R_SH_IMM_MEDLOW16) \
- value >>= 16; \
- \
- word |= (value & 0xffff) << 10; \
- *(REL) = word; \
- break; \
- } \
- case R_SH_IMM_LOW16_PCREL: \
- case R_SH_IMM_MEDLOW16_PCREL: \
- { \
- unsigned long word, value; \
- \
- word = (unsigned long)(REL) & ~0x3fffc00; \
- value = (SYMBOL) + (RELP)->r_addend \
- - (unsigned long)(REL); \
- \
- if (r_type == R_SH_IMM_MEDLOW16_PCREL) \
- value >>= 16; \
- \
- word |= (value & 0xffff) << 10; \
- *(REL) = word; \
- break; \
- } \
- case R_SH_NONE: \
- break; \
- default: \
- _dl_exit(1); \
- }
diff --git a/ldso/ldso/sh64/dl-syscalls.h b/ldso/ldso/sh64/dl-syscalls.h
deleted file mode 100644
index 2ea4bb7..0000000
--- a/ldso/ldso/sh64/dl-syscalls.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#undef __syscall_return
-#define __syscall_return(type, res) \
-do { \
- /* \
- * Note: when returning from kernel the return value is in r9 \
- * \
- * This prevents conflicts between return value and arg1 \
- * when dispatching signal handler, in other words makes \
- * life easier in the system call epilogue (see entry.S) \
- */ \
- register unsigned long __sr2 __asm__ ("r2") = res; \
- if ((unsigned long)(res) >= (unsigned long)(-125)) { \
- _dl_errno = -(res); \
- __sr2 = -1; \
- } \
- return (type)(__sr2); \
-} while (0)
-
diff --git a/ldso/ldso/sh64/dl-sysdep.h b/ldso/ldso/sh64/dl-sysdep.h
deleted file mode 100644
index 0434139..0000000
--- a/ldso/ldso/sh64/dl-sysdep.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/* vi: set sw=8 ts=8: */
-/*
- * Various assembly language/system dependent hacks that are required
- * so that we can minimize the amount of platform specific code.
- */
-
-/* Define this if the system uses RELOCA. */
-#define ELF_USES_RELOCA
-#include <elf.h>
-/*
- * Initialization sequence for a GOT.
- */
-#define INIT_GOT(GOT_BASE,MODULE) \
-{ \
- GOT_BASE[2] = (unsigned long)_dl_linux_resolve; \
- GOT_BASE[1] = (unsigned long)(MODULE); \
-}
-
-/* Here we define the magic numbers that this dynamic loader should accept */
-#define MAGIC1 EM_SH
-#undef MAGIC2
-
-/* Used for error messages */
-#define ELF_TARGET "sh64"
-
-/* Need bootstrap relocations */
-#define ARCH_NEEDS_BOOTSTRAP_RELOCS
-
-struct elf_resolve;
-extern unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry);
-
-/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry or
- TLS variable, so undefined references should not be allowed to
- define the value.
- ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
- of the main executable's symbols, as for a COPY reloc. */
-#define elf_machine_type_class(type) \
- ((((type) == R_SH_JMP_SLOT) * ELF_RTYPE_CLASS_PLT) \
- | (((type) == R_SH_COPY) * ELF_RTYPE_CLASS_COPY))
-
-/* Return the link-time address of _DYNAMIC. Conveniently, this is the
- first element of the GOT. This must be inlined in a function which
- uses global data. */
-static __always_inline Elf32_Addr elf_machine_dynamic(void)
-{
- register Elf32_Addr *got;
-
- /*
- * The toolchain adds 32768 to the GOT address, we compensate for
- * that in the movi/sub pair.
- *
- * XXX: If this is cleaned up in the toolchain, we can end up
- * saving 2 instructions and subsequently free up r1 from the
- * clobber list..
- */
- __asm__ (
- "movi\t(((datalabel _GLOBAL_OFFSET_TABLE_-(.LZZZ1-.)) >> 16) & 0xffff), r2\n\t"
- "shori\t((datalabel _GLOBAL_OFFSET_TABLE_-(.LZZZ1-.)) & 0xffff), r2\n\t"
- ".LZZZ1:\tptrel/u r2, tr0\n\t"
- "movi\t32768, r1\n\t"
- "gettr\ttr0, r2\n\t"
- "sub\tr2, r1, %0\n\t"
- : "=r" (got)
- : /* no inputs */
- : "r1", "r2", "tr0"
- );
-
- return *got;
-}
-
-/* Return the run-time load address of the shared object. */
-static __always_inline Elf32_Addr elf_machine_load_address(void)
-{
- Elf32_Addr addr;
-
- __asm__ (
- "movi\t(((datalabel _GLOBAL_OFFSET_TABLE_-(.LZZZ2-.)) >> 16) & 0xffff), r0\n\t"
- "shori\t((datalabel _GLOBAL_OFFSET_TABLE_-(.LZZZ2-.)) & 0xffff), r0\n\t"
- ".LZZZ2:\tptrel/u r0, tr0\n\t"
- "movi\t(((_dl_start@GOTOFF) >> 16) & 0xffff), r2\n\t"
- "shori\t((_dl_start@GOTOFF) & 0xffff), r2\n\t"
- "gettr\ttr0, r0\n\t"
- "add\tr2, r0, r2\n\t"
- "movi\t(((_dl_start@GOT) >> 16) & 0xffff), r1\n\t"
- "shori\t((_dl_start@GOT) & 0xffff), r1\n\t"
- "ldx.l\tr1, r0, r1\n\t"
- "sub\tr2, r1, %0\n\t"
- : "=r" (addr)
- : /* no inputs */
- : "r0", "r1", "r2", "tr0"
- );
-
- return addr;
-}
-
-/*
- * XXX: As we don't need to worry about r25 clobbering, we could probably
- * get away with inlining {st,ld}{x,}.l and friends here instead and
- * forego gcc's idea of code generation.
- */
-#define COPY_UNALIGNED_WORD(swp, twp, align) \
-{ \
- void *__s = (swp), *__t = (twp); \
- unsigned char *__s1 = __s, *__t1 = __t; \
- unsigned short *__s2 = __s, *__t2 = __t; \
- unsigned long *__s4 = __s, *__t4 = __t; \
- \
- switch ((align)) { \
- case 0: \
- *__t4 = *__s4; \
- break; \
- case 2: \
- *__t2++ = *__s2++; \
- *__t2 = *__s2; \
- break; \
- default: \
- *__t1++ = *__s1++; \
- *__t1++ = *__s1++; \
- *__t1++ = *__s1++; \
- *__t1 = *__s1; \
- break; \
- } \
-}
-
-static __always_inline void
-elf_machine_relative(Elf32_Addr load_off, const Elf32_Addr rel_addr,
- Elf32_Word relative_count)
-{
- Elf32_Addr value, word;
- Elf32_Rela *rpnt = (void *)rel_addr;
- int reloc_type = ELF_R_TYPE(rpnt->r_info);
-
- do {
- Elf32_Addr *const reloc_addr =
- (void *)(load_off + rpnt->r_offset);
- int align = (int)reloc_addr & 3;
-
- switch (reloc_type) {
- case R_SH_RELATIVE_LOW16:
- COPY_UNALIGNED_WORD(reloc_addr, &word, align);
- word &= ~0x3fffc00;
- value = (rpnt->r_addend + load_off);
- word |= (value & 0xffff) << 10;
- COPY_UNALIGNED_WORD(&word, reloc_addr, align);
- break;
- case R_SH_RELATIVE_MEDLOW16:
- COPY_UNALIGNED_WORD(reloc_addr, &word, align);
- word &= ~0x3fffc00;
- value = (rpnt->r_addend + load_off) >> 16;
- word |= (value & 0xffff) << 10;
- COPY_UNALIGNED_WORD(&word, reloc_addr, align);
- break;
- default:
- if (rpnt->r_addend) {
- value = load_off + rpnt->r_addend;
- } else {
- COPY_UNALIGNED_WORD(reloc_addr, &value, align);
- value += load_off;
- }
-
- COPY_UNALIGNED_WORD(&value, reloc_addr, align);
- break;
- }
-
- rpnt++;
- } while (--relative_count);
-#undef COPY_UNALIGNED_WORD
-}
diff --git a/ldso/ldso/sh64/elfinterp.c b/ldso/ldso/sh64/elfinterp.c
deleted file mode 100644
index 3a59bc4..0000000
--- a/ldso/ldso/sh64/elfinterp.c
+++ /dev/null
@@ -1,345 +0,0 @@
-/* vi: set sw=8 ts=8: */
-/*
- * ldso/ldso/sh64/elfinterp.c
- *
- * SuperH (sh64) ELF shared library loader suppport
- *
- * Copyright (C) 2003, 2004, 2005 Paul Mundt <lethal(a)linux-sh.org>
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. The name of the above contributors may not be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* Program to load an ELF binary on a linux system, and run it.
- References to symbols in sharable libraries can be resolved by either
- an ELF sharable library or a linux style of shared library. */
-
-/* Disclaimer: I have never seen any AT&T source code for SVr4, nor have
- I ever taken any courses on internals. This program was developed using
- information available through the book "UNIX SYSTEM V RELEASE 4,
- Programmers guide: Ansi C and Programming Support Tools", which did
- a more than adequate job of explaining everything required to get this
- working. */
-
-#include "ldso.h"
-
-extern int _dl_linux_resolve(void);
-
-unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
-{
- ELF_RELOC *this_reloc;
- char *strtab;
- ElfW(Sym) *symtab;
- int symtab_index;
- char *rel_addr;
- char *new_addr;
- char **got_addr;
- unsigned long instr_addr;
- char *symname;
-
- rel_addr = (char *)tpnt->dynamic_info[DT_JMPREL];
-
- this_reloc = (ELF_RELOC *)(intptr_t)(rel_addr + reloc_entry);
- symtab_index = ELF_R_SYM(this_reloc->r_info);
-
- symtab = (ElfW(Sym) *)(intptr_t)tpnt->dynamic_info[DT_SYMTAB];
- strtab = (char *)tpnt->dynamic_info[DT_STRTAB];
- symname = strtab + symtab[symtab_index].st_name;
-
- /* Address of jump instruction to fix up */
- instr_addr = ((unsigned long)this_reloc->r_offset +
- (unsigned long)tpnt->loadaddr);
- got_addr = (char **)instr_addr;
-
-
- /* Get the address of the GOT entry */
- new_addr = _dl_find_hash(symname, &_dl_loaded_modules->symbol_scope, tpnt, ELF_RTYPE_CLASS_PLT, NULL);
- if (unlikely(!new_addr)) {
- _dl_dprintf(2, "%s: can't resolve symbol '%s'\n",
- _dl_progname, symname);
- _dl_exit(1);
- }
-
-#ifdef __SUPPORT_LD_DEBUG__
- if ((unsigned long)got_addr < 0x20000000) {
- if (_dl_debug_bindings) {
- _dl_dprintf(_dl_debug_file, "\nresolve function: %s",
- symname);
-
- if (_dl_debug_detail)
- _dl_dprintf(_dl_debug_file,
- "\n\tpatched %x ==> %x @ %x\n",
- *got_addr, new_addr, got_addr);
- }
- }
-
- if (!_dl_debug_nofixups)
- *got_addr = new_addr;
-#else
- *got_addr = new_addr;
-#endif
-
- return (unsigned long)new_addr;
-}
-
-static int _dl_parse(struct elf_resolve *tpnt, struct r_scope_elem *scope,
- unsigned long rel_addr, unsigned long rel_size,
- int (*reloc_fnc)(struct elf_resolve *tpnt,
- struct r_scope_elem *scope,
- ELF_RELOC *rpnt, ElfW(Sym) *symtab,
- char *strtab))
-{
- unsigned int i;
- char *strtab;
- ElfW(Sym) *symtab;
- ELF_RELOC *rpnt;
- int symtab_index;
-
- /* Now parse the relocation information */
- rpnt = (ELF_RELOC *)(intptr_t)rel_addr;
- rel_size = rel_size / sizeof(ELF_RELOC);
-
- symtab = (ElfW(Sym) *)(intptr_t)tpnt->dynamic_info[DT_SYMTAB];
- strtab = (char *)tpnt->dynamic_info[DT_STRTAB];
-
- for (i = 0; i < rel_size; i++, rpnt++) {
- int res;
-
- symtab_index = ELF_R_SYM(rpnt->r_info);
- debug_sym(symtab,strtab,symtab_index);
- debug_reloc(symtab,strtab,rpnt);
-
- res = reloc_fnc (tpnt, scope, rpnt, symtab, strtab);
- if (res == 0)
- continue;
-
- _dl_dprintf(2, "\n%s: ",_dl_progname);
-
- if (symtab_index)
- _dl_dprintf(2, "symbol '%s': ",
- strtab + symtab[symtab_index].st_name);
-
- if (unlikely(res < 0)) {
- int reloc_type = ELF_R_TYPE(rpnt->r_info);
-
- _dl_dprintf(2, "can't handle reloc type "
-#ifdef __SUPPORT_LD_DEBUG__
- "%s\n", _dl_reltypes(reloc_type)
-#else
- "%x\n", reloc_type
-#endif
- );
-
- _dl_exit(-res);
- }
- if (unlikely(res > 0)) {
- _dl_dprintf(2, "can't resolve symbol\n");
-
- return res;
- }
- }
-
- return 0;
-}
-
-static int _dl_do_reloc(struct elf_resolve *tpnt,struct r_scope_elem *scope,
- ELF_RELOC *rpnt, ElfW(Sym) *symtab, char *strtab)
-{
- int reloc_type;
- int symtab_index, lsb;
- char *symname;
- unsigned long *reloc_addr;
- unsigned long symbol_addr;
-#ifdef __SUPPORT_LD_DEBUG__
- unsigned long old_val;
-#endif
- struct symbol_ref sym_ref;
-
- reloc_type = ELF_R_TYPE(rpnt->r_info);
- symtab_index = ELF_R_SYM(rpnt->r_info);
- symbol_addr = 0;
- lsb = !!(symtab[symtab_index].st_other & STO_SH5_ISA32);
- sym_ref.sym = &symtab[symtab_index];
- sym_ref.tpnt = NULL;
- symname = strtab + symtab[symtab_index].st_name;
- reloc_addr = (unsigned long *)(intptr_t)
- (tpnt->loadaddr + (unsigned long)rpnt->r_offset);
-
- if (symtab_index) {
- int stb;
-
- symbol_addr = (unsigned long)_dl_find_hash(symname, scope, tpnt,
- elf_machine_type_class(reloc_type), &sym_ref);
-
- /*
- * We want to allow undefined references to weak symbols - this
- * might have been intentional. We should not be linking local
- * symbols here, so all bases should be covered.
- */
- stb = ELF_ST_BIND(symtab[symtab_index].st_info);
-
- if (stb != STB_WEAK && !symbol_addr) {
- _dl_dprintf (2, "%s: can't resolve symbol '%s'\n",
- _dl_progname, symname);
- _dl_exit (1);
- }
- if (_dl_trace_prelink) {
- _dl_debug_lookup (symname, tpnt, &symtab[symtab_index],
- &sym_ref, elf_machine_type_class(reloc_type));
- }
- }
-
-#ifdef __SUPPORT_LD_DEBUG__
- old_val = *reloc_addr;
-#endif
-
- switch (reloc_type) {
- case R_SH_NONE:
- break;
- case R_SH_COPY:
- _dl_memcpy((char *)reloc_addr,
- (char *)symbol_addr, symtab[symtab_index].st_size);
- break;
- case R_SH_DIR32:
- case R_SH_GLOB_DAT:
- case R_SH_JMP_SLOT:
- *reloc_addr = (symbol_addr + rpnt->r_addend) | lsb;
- break;
- case R_SH_REL32:
- *reloc_addr = symbol_addr + rpnt->r_addend -
- (unsigned long)reloc_addr;
- break;
- case R_SH_RELATIVE:
- *reloc_addr = (unsigned long)tpnt->loadaddr + rpnt->r_addend;
- break;
- case R_SH_RELATIVE_LOW16:
- case R_SH_RELATIVE_MEDLOW16:
- {
- unsigned long word, value;
-
- word = (unsigned long)reloc_addr & ~0x3fffc00;
- value = (unsigned long)tpnt->loadaddr + rpnt->r_addend;
-
- if (reloc_type == R_SH_RELATIVE_MEDLOW16)
- value >>= 16;
-
- word |= (value & 0xffff) << 10;
- *reloc_addr = word;
-
- break;
- }
- case R_SH_IMM_LOW16:
- case R_SH_IMM_MEDLOW16:
- {
- unsigned long word, value;
-
- word = (unsigned long)reloc_addr & ~0x3fffc00;
- value = (symbol_addr + rpnt->r_addend) | lsb;
-
- if (reloc_type == R_SH_IMM_MEDLOW16)
- value >>= 16;
-
- word |= (value & 0xffff) << 10;
- *reloc_addr = word;
-
- break;
- }
- case R_SH_IMM_LOW16_PCREL:
- case R_SH_IMM_MEDLOW16_PCREL:
- {
- unsigned long word, value;
-
- word = (unsigned long)reloc_addr & ~0x3fffc00;
- value = symbol_addr + rpnt->r_addend -
- (unsigned long)reloc_addr;
-
- if (reloc_type == R_SH_IMM_MEDLOW16_PCREL)
- value >>= 16;
-
- word |= (value & 0xffff) << 10;
- *reloc_addr = word;
-
- break;
- }
- default:
- return -1; /*call _dl_exit(1) */
- }
-
-#ifdef __SUPPORT_LD_DEBUG__
- if (_dl_debug_reloc && _dl_debug_detail)
- _dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x\n",
- old_val, *reloc_addr, reloc_addr);
-#endif
-
- return 0;
-}
-
-static int _dl_do_lazy_reloc(struct elf_resolve *tpnt, struct r_scope_elem *scope,
- ELF_RELOC *rpnt, ElfW(Sym) *symtab, char *strtab)
-{
- int reloc_type, symtab_index, lsb;
- unsigned long *reloc_addr;
-#ifdef __SUPPORT_LD_DEBUG__
- unsigned long old_val;
-#endif
-
- reloc_type = ELF_R_TYPE(rpnt->r_info);
- symtab_index = ELF_R_SYM(rpnt->r_info);
- lsb = !!(symtab[symtab_index].st_other & STO_SH5_ISA32);
- reloc_addr = (unsigned long *)(intptr_t)
- (tpnt->loadaddr + (unsigned long)rpnt->r_offset);
-
-#ifdef __SUPPORT_LD_DEBUG__
- old_val = *reloc_addr;
-#endif
-
- switch (reloc_type) {
- case R_SH_NONE:
- break;
- case R_SH_JMP_SLOT:
- *reloc_addr += (unsigned long)tpnt->loadaddr | lsb;
- break;
- default:
- return -1; /*call _dl_exit(1) */
- }
-
-#ifdef __SUPPORT_LD_DEBUG__
- if (_dl_debug_reloc && _dl_debug_detail)
- _dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x\n",
- old_val, *reloc_addr, reloc_addr);
-#endif
-
- return 0;
-}
-
-void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt,
- unsigned long rel_addr, unsigned long rel_size)
-{
- (void)_dl_parse(rpnt->dyn, NULL, rel_addr, rel_size, _dl_do_lazy_reloc);
-}
-
-int _dl_parse_relocation_information(struct dyn_elf *rpnt,
- struct r_scope_elem *scope, unsigned long rel_addr, unsigned long rel_size)
-{
- return _dl_parse(rpnt->dyn, scope, rel_addr, rel_size, _dl_do_reloc);
-}
diff --git a/ldso/ldso/sh64/resolve.S b/ldso/ldso/sh64/resolve.S
deleted file mode 100644
index ca915d2..0000000
--- a/ldso/ldso/sh64/resolve.S
+++ /dev/null
@@ -1,95 +0,0 @@
-/* vi: set sw=8 ts=8: */
-/*
- * ldso/ldso/sh64/resolve.S
- *
- * SuperH (sh64) dynamic resolver support
- *
- * Copyright (C) 2003 Paul Mundt <lethal(a)linux-sh.org>
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. The name of the above contributors may not be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
- .section .text..SHmedia32,"ax"
- .globl _dl_linux_resolver
- .globl _dl_linux_resolve
- .type _dl_linux_resolve, @function
-
- .balign 16
-_dl_linux_resolve:
- addi r15, -72, r15 ! make room on the stack
- pt _dl_linux_resolver, tr0
- st.q r15, 0, r2 ! save regs
- st.q r15, 8, r3
- st.q r15, 16, r4
- st.q r15, 24, r5
- st.q r15, 32, r6
- st.q r15, 40, r7
- st.q r15, 48, r8
- st.q r15, 56, r9
- st.q r15, 64, r18
-
-#ifdef HAVE_FPU
- addi r15, -48, r15 ! make room for FP regs
- fst.d r15, 0, dr0 ! save FP regs
- fst.d r15, 8, dr2
- fst.d r15, 16, dr4
- fst.d r15, 24, dr6
- fst.d r15, 32, dr8
- fst.d r15, 40, dr10
-#endif
-
- /*
- * Args for _dl_linux_resolver(), set in r17/r21 by PLT code
- */
-
- add r17, r63, r2 ! link map address
- add r21, r63, r3 ! GOT offset
- blink tr0, r18 ! call _dl_linux_resolver()
- ptabs/l r2, tr0 ! save result = addr of function called
-
-#ifdef HAVE_FPU
- fld.d r15, 0, dr0 ! restore FP regs
- fld.d r15, 8, dr2
- fld.d r15, 16, dr4
- fld.d r15, 24, dr6
- fld.d r15, 32, dr8
- fld.d r15, 40, dr10
- addi r15, 48, r15
-#endif
-
- ld.q r15, 0, r2 ! restore regs
- ld.q r15, 8, r3
- ld.q r15, 16, r4
- ld.q r15, 24, r5
- ld.q r15, 32, r6
- ld.q r15, 40, r7
- ld.q r15, 48, r8
- ld.q r15, 56, r9
- ld.q r15, 64, r18
-
- addi r15, 72, r15
- blink tr0, r63 ! jump to function address
-
- .size _dl_linux_resolve, . - _dl_linux_resolve
-
diff --git a/libc/string/sh64/Makefile b/libc/string/sh64/Makefile
deleted file mode 100644
index 0a95346..0000000
--- a/libc/string/sh64/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-# Makefile for uClibc
-#
-# Copyright (C) 2000-2005 Erik Andersen <andersen(a)uclibc.org>
-#
-# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-#
-
-top_srcdir:=../../../
-top_builddir:=../../../
-all: objs
-include $(top_builddir)Rules.mak
-include ../Makefile.in
-include $(top_srcdir)Makerules
diff --git a/libc/string/sh64/memcpy.S b/libc/string/sh64/memcpy.S
deleted file mode 100644
index 470784e..0000000
--- a/libc/string/sh64/memcpy.S
+++ /dev/null
@@ -1,205 +0,0 @@
-/* Cloned and hacked for uClibc by Paul Mundt, December 2003 */
-/* Modified by SuperH, Inc. September 2003 */
-!
-! Fast SH memcpy
-!
-! by Toshiyasu Morita (tm(a)netcom.com)
-! hacked by J"orn Rernnecke (joern.rennecke(a)superh.com) ("o for o-umlaut)
-! SH5 code Copyright 2002 SuperH Ltd.
-!
-! Entry: ARG0: destination pointer
-! ARG1: source pointer
-! ARG2: byte count
-!
-! Exit: RESULT: destination pointer
-! any other registers in the range r0-r7: trashed
-!
-! Notes: Usually one wants to do small reads and write a longword, but
-! unfortunately it is difficult in some cases to concatanate bytes
-! into a longword on the SH, so this does a longword read and small
-! writes.
-!
-! This implementation makes two assumptions about how it is called:
-!
-! 1.: If the byte count is nonzero, the address of the last byte to be
-! copied is unsigned greater than the address of the first byte to
-! be copied. This could be easily swapped for a signed comparison,
-! but the algorithm used needs some comparison.
-!
-! 2.: When there are two or three bytes in the last word of an 11-or-more
-! bytes memory chunk to b copied, the rest of the word can be read
-! without side effects.
-! This could be easily changed by increasing the minumum size of
-! a fast memcpy and the amount subtracted from r7 before L_2l_loop be 2,
-! however, this would cost a few extra cyles on average.
-! For SHmedia, the assumption is that any quadword can be read in its
-! enirety if at least one byte is included in the copy.
-!
-
-#include <features.h>
-
- .section .text..SHmedia32,"ax"
- .globl memcpy
- .type memcpy, @function
- .align 5
-
-memcpy:
-
-#define LDUAQ(P,O,D0,D1) ldlo.q P,O,D0; ldhi.q P,O+7,D1
-#define STUAQ(P,O,D0,D1) stlo.q P,O,D0; sthi.q P,O+7,D1
-#define LDUAL(P,O,D0,D1) ldlo.l P,O,D0; ldhi.l P,O+3,D1
-#define STUAL(P,O,D0,D1) stlo.l P,O,D0; sthi.l P,O+3,D1
-
- ld.b r3,0,r63
- pta/l Large,tr0
- movi 25,r0
- bgeu/u r4,r0,tr0
- nsb r4,r0
- shlli r0,5,r0
- movi (L1-L0+63*32 + 1) & 0xffff,r1
- sub r1, r0, r0
-L0: ptrel r0,tr0
- add r2,r4,r5
- ptabs r18,tr1
- add r3,r4,r6
- blink tr0,r63
-
-/* Rearranged to make cut2 safe */
- .balign 8
-L4_7: /* 4..7 byte memcpy cntd. */
- stlo.l r2, 0, r0
- or r6, r7, r6
- sthi.l r5, -1, r6
- stlo.l r5, -4, r6
- blink tr1,r63
-
- .balign 8
-L1: /* 0 byte memcpy */
- nop
- blink tr1,r63
- nop
- nop
- nop
- nop
-
-L2_3: /* 2 or 3 byte memcpy cntd. */
- st.b r5,-1,r6
- blink tr1,r63
-
- /* 1 byte memcpy */
- ld.b r3,0,r0
- st.b r2,0,r0
- blink tr1,r63
-
-L8_15: /* 8..15 byte memcpy cntd. */
- stlo.q r2, 0, r0
- or r6, r7, r6
- sthi.q r5, -1, r6
- stlo.q r5, -8, r6
- blink tr1,r63
-
- /* 2 or 3 byte memcpy */
- ld.b r3,0,r0
- ld.b r2,0,r63
- ld.b r3,1,r1
- st.b r2,0,r0
- pta/l L2_3,tr0
- ld.b r6,-1,r6
- st.b r2,1,r1
- blink tr0, r63
-
- /* 4 .. 7 byte memcpy */
- LDUAL (r3, 0, r0, r1)
- pta L4_7, tr0
- ldlo.l r6, -4, r7
- or r0, r1, r0
- sthi.l r2, 3, r0
- ldhi.l r6, -1, r6
- blink tr0, r63
-
- /* 8 .. 15 byte memcpy */
- LDUAQ (r3, 0, r0, r1)
- pta L8_15, tr0
- ldlo.q r6, -8, r7
- or r0, r1, r0
- sthi.q r2, 7, r0
- ldhi.q r6, -1, r6
- blink tr0, r63
-
- /* 16 .. 24 byte memcpy */
- LDUAQ (r3, 0, r0, r1)
- LDUAQ (r3, 8, r8, r9)
- or r0, r1, r0
- sthi.q r2, 7, r0
- or r8, r9, r8
- sthi.q r2, 15, r8
- ldlo.q r6, -8, r7
- ldhi.q r6, -1, r6
- stlo.q r2, 8, r8
- stlo.q r2, 0, r0
- or r6, r7, r6
- sthi.q r5, -1, r6
- stlo.q r5, -8, r6
- blink tr1,r63
-
-Large:
- ld.b r2, 0, r63
- pta/l Loop_ua, tr1
- ori r3, -8, r7
- sub r2, r7, r22
- sub r3, r2, r6
- add r2, r4, r5
- ldlo.q r3, 0, r0
- addi r5, -16, r5
- movi 64+8, r27 /* could subtract r7 from that. */
- stlo.q r2, 0, r0
- sthi.q r2, 7, r0
- ldx.q r22, r6, r0
- bgtu/l r27, r4, tr1
-
- addi r5, -48, r27
- pta/l Loop_line, tr0
- addi r6, 64, r36
- addi r6, -24, r19
- addi r6, -16, r20
- addi r6, -8, r21
-
-Loop_line:
- ldx.q r22, r36, r63
- alloco r22, 32
- addi r22, 32, r22
- ldx.q r22, r19, r23
- sthi.q r22, -25, r0
- ldx.q r22, r20, r24
- ldx.q r22, r21, r25
- stlo.q r22, -32, r0
- ldx.q r22, r6, r0
- sthi.q r22, -17, r23
- sthi.q r22, -9, r24
- sthi.q r22, -1, r25
- stlo.q r22, -24, r23
- stlo.q r22, -16, r24
- stlo.q r22, -8, r25
- bgeu r27, r22, tr0
-
-Loop_ua:
- addi r22, 8, r22
- sthi.q r22, -1, r0
- stlo.q r22, -8, r0
- ldx.q r22, r6, r0
- bgtu/l r5, r22, tr1
-
- add r3, r4, r7
- ldlo.q r7, -8, r1
- sthi.q r22, 7, r0
- ldhi.q r7, -1, r7
- ptabs r18,tr1
- stlo.q r22, 0, r0
- or r1, r7, r1
- sthi.q r5, 15, r1
- stlo.q r5, 8, r1
- blink tr1, r63
-
- .size memcpy,.-memcpy
-
-libc_hidden_def(memcpy)
diff --git a/libc/string/sh64/memset.S b/libc/string/sh64/memset.S
deleted file mode 100644
index 1b8812c..0000000
--- a/libc/string/sh64/memset.S
+++ /dev/null
@@ -1,97 +0,0 @@
-/* Cloned and hacked for uClibc by Paul Mundt, December 2003 */
-/* Modified by SuperH, Inc. September 2003 */
-!
-! Fast SH memset
-!
-! by Toshiyasu Morita (tm(a)netcom.com)
-!
-! SH5 code by J"orn Rennecke (joern.rennecke(a)superh.com)
-! Copyright 2002 SuperH Ltd.
-!
-
-#include <features.h>
-#include <endian.h>
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define SHHI shlld
-#define SHLO shlrd
-#else
-#define SHHI shlrd
-#define SHLO shlld
-#endif
-
- .section .text..SHmedia32,"ax"
- .globl memset
- .type memset, @function
-
- .align 5
-
-memset:
- pta/l multiquad, tr0
- andi r2, 7, r22
- ptabs r18, tr2
- mshflo.b r3,r3,r3
- add r4, r22, r23
- mperm.w r3, r63, r3 /* Fill pattern now in every byte of r3 */
-
- movi 8, r9
- bgtu/u r23, r9, tr0 /* multiquad */
-
- beqi/u r4, 0, tr2 /* Return with size 0 - ensures no mem accesses */
- ldlo.q r2, 0, r7
- shlli r4, 2, r4
- movi -1, r8
- SHHI r8, r4, r8
- SHHI r8, r4, r8
- mcmv r7, r8, r3
- stlo.q r2, 0, r3
- blink tr2, r63
-
-multiquad:
- pta/l lastquad, tr0
- stlo.q r2, 0, r3
- shlri r23, 3, r24
- add r2, r4, r5
- beqi/u r24, 1, tr0 /* lastquad */
- pta/l loop, tr1
- sub r2, r22, r25
- andi r5, -8, r20 /* calculate end address and */
- addi r20, -7*8, r8 /* loop end address; This might overflow, so we need
- to use a different test before we start the loop
- */
- bge/u r24, r9, tr1 /* loop */
- st.q r25, 8, r3
- st.q r20, -8, r3
- shlri r24, 1, r24
- beqi/u r24, 1, tr0 /* lastquad */
- st.q r25, 16, r3
- st.q r20, -16, r3
- beqi/u r24, 2, tr0 /* lastquad */
- st.q r25, 24, r3
- st.q r20, -24, r3
-lastquad:
- sthi.q r5, -1, r3
- blink tr2,r63
-
-loop:
-!!! alloco r25, 32 /* QQQ comment out for short-term fix to SHUK #3895.
- QQQ commenting out is locically correct, but sub-optimal
- QQQ Sean McGoogan - 4th April 2003. */
- st.q r25, 8, r3
- st.q r25, 16, r3
- st.q r25, 24, r3
- st.q r25, 32, r3
- addi r25, 32, r25
- bgeu/l r8, r25, tr1 /* loop */
-
- st.q r20, -40, r3
- st.q r20, -32, r3
- st.q r20, -24, r3
- st.q r20, -16, r3
- st.q r20, -8, r3
- sthi.q r5, -1, r3
- blink tr2,r63
-
- .size memset,.-memset
-
-libc_hidden_def(memset)
diff --git a/libc/string/sh64/strcpy.S b/libc/string/sh64/strcpy.S
deleted file mode 100644
index f317707..0000000
--- a/libc/string/sh64/strcpy.S
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Cloned and hacked for uClibc by Paul Mundt, December 2003 */
-/* Modified by SuperH, Inc. September 2003 */
-! Entry: arg0: destination
-! arg1: source
-! Exit: result: destination
-!
-! SH5 code Copyright 2002 SuperH Ltd.
-
-#include <features.h>
-#include <endian.h>
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define SHHI shlld
-#define SHLO shlrd
-#else
-#define SHHI shlrd
-#define SHLO shlld
-#endif
-
- .section .text..SHmedia32,"ax"
- .globl strcpy
- .type strcpy, @function
- .align 5
-
-strcpy:
-
- pta/l shortstring,tr1
- ldlo.q r3,0,r4
- ptabs r18,tr4
- shlli r3,3,r7
- addi r2, 8, r0
- mcmpeq.b r4,r63,r6
- SHHI r6,r7,r6
- bnei/u r6,0,tr1 /* shortstring */
- pta/l no_lddst, tr2
- ori r3,-8,r23
- sub r2, r23, r0
- sub r3, r2, r21
- addi r21, 8, r20
- ldx.q r0, r21, r5
- pta/l loop, tr0
- ori r2,-8,r22
- mcmpeq.b r5, r63, r6
- bgt/u r22, r23, tr2 /* no_lddst */
-
- /* r22 < r23 : Need to do a load from the destination. */
- /* r22 == r23 : Doesn't actually need to load from destination, */
- /* but still can be handled here. */
- ldlo.q r2, 0, r9
- movi -1, r8
- SHLO r8, r7, r8
- mcmv r4, r8, r9
- stlo.q r2, 0, r9
- beqi/l r6, 0, tr0 /* loop */
-
- add r5, r63, r4
- addi r0, 8, r0
- blink tr1, r63 /* shortstring */
-no_lddst:
- /* r22 > r23: note that for r22 == r23 the sthi.q would clobber */
- /* bytes before the destination region. */
- stlo.q r2, 0, r4
- SHHI r4, r7, r4
- sthi.q r0, -1, r4
- beqi/l r6, 0, tr0 /* loop */
-
- add r5, r63, r4
- addi r0, 8, r0
-shortstring:
-#if __BYTE_ORDER != __LITTLE_ENDIAN
- pta/l shortstring2,tr1
- byterev r4,r4
-#endif
-shortstring2:
- st.b r0,-8,r4
- andi r4,0xff,r5
- shlri r4,8,r4
- addi r0,1,r0
- bnei/l r5,0,tr1
- blink tr4,r63 /* return */
-
- .balign 8
-loop:
- stlo.q r0, 0, r5
- ldx.q r0, r20, r4
- addi r0, 16, r0
- sthi.q r0, -9, r5
- mcmpeq.b r4, r63, r6
- bnei/u r6, 0, tr1 /* shortstring */
- ldx.q r0, r21, r5
- stlo.q r0, -8, r4
- sthi.q r0, -1, r4
- mcmpeq.b r5, r63, r6
- beqi/l r6, 0, tr0 /* loop */
-
- add r5, r63, r4
- addi r0, 8, r0
- blink tr1, r63 /* shortstring */
-
- .size strcpy,.-strcpy
-
-libc_hidden_def(strcpy)
diff --git a/libc/string/sh64/strlen.S b/libc/string/sh64/strlen.S
deleted file mode 100644
index 18f4164..0000000
--- a/libc/string/sh64/strlen.S
+++ /dev/null
@@ -1,63 +0,0 @@
-/* vi: set sw=8 ts=8: */
-/*
- * libc/string/sh64/strlen.S
- *
- * Simplistic strlen() implementation for SHmedia.
- *
- * Copyright (C) 2003 Paul Mundt <lethal(a)linux-sh.org>
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. The name of the above contributors may not be
- * used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <features.h>
-
- .section .text..SHmedia32,"ax"
- .globl strlen
- .type strlen,@function
-
- .balign 16
-strlen:
- ptabs r18, tr4
-
- /*
- * Note: We could easily deal with the NULL case here with a simple
- * sanity check, though it seems that the behavior we want is to fault
- * in the event that r2 == NULL, so we don't bother.
- */
-/* beqi r2, 0, tr4 */ ! Sanity check
-
- movi -1, r0
- pta/l loop, tr0
-loop:
- ld.b r2, 0, r1
- addi r2, 1, r2
- addi r0, 1, r0
- bnei/l r1, 0, tr0
-
- or r0, r63, r2
- blink tr4, r63
-
- .size strlen,.-strlen
-
-libc_hidden_def(strlen)
diff --git a/libc/sysdeps/linux/sh64/Makefile b/libc/sysdeps/linux/sh64/Makefile
deleted file mode 100644
index ecbf142..0000000
--- a/libc/sysdeps/linux/sh64/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-# Makefile for uClibc
-#
-# Copyright (C) 2001 SuperH (UK) Ltd.
-# Copyright (C) 2003 Paul Mundt <lethal(a)linux-sh.org>
-#
-# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-
-top_srcdir=../../../../
-top_builddir=../../../../
-all: objs
-include $(top_builddir)Rules.mak
-include Makefile.arch
-include $(top_srcdir)Makerules
-TOPDIR=../../../../
-include $(TOPDIR)Rules.mak
diff --git a/libc/sysdeps/linux/sh64/Makefile.arch b/libc/sysdeps/linux/sh64/Makefile.arch
deleted file mode 100644
index 02fcd0b..0000000
--- a/libc/sysdeps/linux/sh64/Makefile.arch
+++ /dev/null
@@ -1,10 +0,0 @@
-# Makefile for uClibc
-#
-# Copyright (C) 2008 Paul Mundt <lethal(a)linux-sh.org>
-#
-# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-#
-
-CSRC-y := __init_brk.c brk.c sbrk.c syscall.c
-
-SSRC-y := setjmp.S __longjmp.S
diff --git a/libc/sysdeps/linux/sh64/__init_brk.c b/libc/sysdeps/linux/sh64/__init_brk.c
deleted file mode 100644
index 8a41eb3..0000000
--- a/libc/sysdeps/linux/sh64/__init_brk.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* From libc-5.3.12 */
-
-#include <errno.h>
-#include <unistd.h>
-#include <sys/syscall.h>
-
-void * __curbrk attribute_hidden = 0;
-
-#define __NR__brk __NR_brk
-attribute_hidden _syscall1(void *, _brk, void *, ptr)
-
-extern int __init_brk (void) attribute_hidden;
-int
-__init_brk (void)
-{
- if (__curbrk == 0)
- {
- __curbrk = _brk(0);
- if (__curbrk == 0)
- {
- __set_errno(ENOMEM);
- return -1;
- }
- }
- return 0;
-}
diff --git a/libc/sysdeps/linux/sh64/__longjmp.S b/libc/sysdeps/linux/sh64/__longjmp.S
deleted file mode 100644
index 84343d1..0000000
--- a/libc/sysdeps/linux/sh64/__longjmp.S
+++ /dev/null
@@ -1,140 +0,0 @@
-/* __longjmp for SH-5.
- Copyright (C) 1999, 2000 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- see <http://www.gnu.org/licenses/>. */
-
-
-#define _SETJMP_H
-#define _ASM
-#include <bits/setjmp.h>
-
-
-#define INTEGER(reg,offset) ld.q r2, offset*8, reg
-#define DOUBLE(reg,offset) fld.d r2, offset*8, reg
-
-
- .file "__longjmp.S"
-
- .section .text64,"xa"
- .align 2
-
- .global __longjmp
- .type __longjmp,@function
-
-__longjmp:
- /*
- * extern void __longjmp(jmp_buf env, int val);
- *
- * r2 == env
- * r3 == val
- * r4 == temporary
- */
-
- /* callee-save registers R10-R16 */
- INTEGER(r10, __SETJMP_INT(0))
- INTEGER(r11, __SETJMP_INT(1))
- INTEGER(r12, __SETJMP_INT(2))
- INTEGER(r13, __SETJMP_INT(3))
- INTEGER(r14, __SETJMP_INT(4))
- INTEGER(r15, __SETJMP_INT(5))
- INTEGER(r16, __SETJMP_INT(6))
-
- /* callee-save registers R28-R35 */
- INTEGER(r28, __SETJMP_INT(7))
- INTEGER(r29, __SETJMP_INT(8))
- INTEGER(r30, __SETJMP_INT(9))
- INTEGER(r31, __SETJMP_INT(10))
- INTEGER(r32, __SETJMP_INT(11))
- INTEGER(r33, __SETJMP_INT(12))
- INTEGER(r34, __SETJMP_INT(13))
- INTEGER(r35, __SETJMP_INT(14))
-
- /* callee-save registers R44-R59 */
- INTEGER(r44, __SETJMP_INT(15))
- INTEGER(r45, __SETJMP_INT(16))
- INTEGER(r46, __SETJMP_INT(17))
- INTEGER(r47, __SETJMP_INT(18))
- INTEGER(r48, __SETJMP_INT(19))
- INTEGER(r49, __SETJMP_INT(20))
- INTEGER(r50, __SETJMP_INT(21))
- INTEGER(r51, __SETJMP_INT(22))
- INTEGER(r52, __SETJMP_INT(23))
- INTEGER(r53, __SETJMP_INT(24))
- INTEGER(r54, __SETJMP_INT(25))
- INTEGER(r55, __SETJMP_INT(26))
- INTEGER(r56, __SETJMP_INT(27))
- INTEGER(r57, __SETJMP_INT(28))
- INTEGER(r58, __SETJMP_INT(29))
- INTEGER(r59, __SETJMP_INT(30))
-
- #if __SETJMP_NUM_INT != 31
- #error __SETJMP_NUM_INT does agree with expected value
- #endif
-
-#if __SETJMP_NUM_DBL > 0
- /* callee-save registers FR12-FR15 */
- DOUBLE(d12, __SETJMP_DBL(0))
- DOUBLE(d14, __SETJMP_DBL(1))
-
- /* callee-save registers FR36-FR63 */
- DOUBLE(d36, __SETJMP_DBL(2))
- DOUBLE(d38, __SETJMP_DBL(3))
- DOUBLE(d40, __SETJMP_DBL(4))
- DOUBLE(d42, __SETJMP_DBL(5))
- DOUBLE(d44, __SETJMP_DBL(6))
- DOUBLE(d46, __SETJMP_DBL(7))
- DOUBLE(d48, __SETJMP_DBL(8))
- DOUBLE(d50, __SETJMP_DBL(9))
- DOUBLE(d52, __SETJMP_DBL(10))
- DOUBLE(d54, __SETJMP_DBL(11))
- DOUBLE(d56, __SETJMP_DBL(12))
- DOUBLE(d58, __SETJMP_DBL(13))
- DOUBLE(d60, __SETJMP_DBL(14))
- DOUBLE(d62, __SETJMP_DBL(15))
-
- #if __SETJMP_NUM_DBL != 16
- #error __SETJMP_NUM_DBL does agree with expected value
- #endif
-
-#endif /* __SETJMP_NUM_DBL > 0 */
-
- /* callee-save registers TR5-TR7 */
- INTEGER(r4, __SETJMP_TRG(0))
- ptabs r4, tr5
- INTEGER(r4, __SETJMP_TRG(1))
- ptabs r4, tr6
- INTEGER(r4, __SETJMP_TRG(2))
- ptabs r4, tr7
-
- #if __SETJMP_NUM_TRG != 3
- #error __SETJMP_NUM_TRG does agree with expected value
- #endif
-
- /* restore Linkage Register (LR) for __longjmp return */
- INTEGER(r18, __SETJMP_LR)
- ptabs/l r18, tr0
-
- /*
- * must ensure __longjmp() never returns 0.
- * if 'val' == 0, then return 1.
- */
- cmpeq r3, r63, r2 /* r2 = (r3==0) ? 1 : 0; */
- add.l r3, r2, r2 /* return value */
-
- /* return to caller */
- blink tr0, r63
-
-libc_hidden_def(__longjmp)
diff --git a/libc/sysdeps/linux/sh64/bits/endian.h b/libc/sysdeps/linux/sh64/bits/endian.h
deleted file mode 100644
index ae7e3bb..0000000
--- a/libc/sysdeps/linux/sh64/bits/endian.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * libc/sysdeps/linux/sh64/bits/endian.h
- *
- * Copyright (C) 2003 Paul Mundt
- *
- * This file is subject to the terms and conditions of the GNU Lesser
- * General Public License. See the file COPYING.LIB in the main
- * directory of this archive for more details.
- */
-
-#ifndef _ENDIAN_H
-# error "Never use <bits/endian.h> directly; include <endian.h> instead."
-#endif
-
-#ifdef __LITTLE_ENDIAN__
-# define __BYTE_ORDER __LITTLE_ENDIAN
-#else
-# define __BYTE_ORDER __BIG_ENDIAN
-#endif
-
diff --git a/libc/sysdeps/linux/sh64/bits/fcntl.h b/libc/sysdeps/linux/sh64/bits/fcntl.h
deleted file mode 100644
index b319e8b..0000000
--- a/libc/sysdeps/linux/sh64/bits/fcntl.h
+++ /dev/null
@@ -1,218 +0,0 @@
-/* O_*, F_*, FD_* bit values for Linux.
- Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef _FCNTL_H
-# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
-#endif
-
-
-#include <sys/types.h>
-
-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
- located on an ext2 file system */
-#define O_ACCMODE 0003
-#define O_RDONLY 00
-#define O_WRONLY 01
-#define O_RDWR 02
-#define O_CREAT 0100 /* not fcntl */
-#define O_EXCL 0200 /* not fcntl */
-#define O_NOCTTY 0400 /* not fcntl */
-#define O_TRUNC 01000 /* not fcntl */
-#define O_APPEND 02000
-#define O_NONBLOCK 04000
-#define O_NDELAY O_NONBLOCK
-#define O_SYNC 010000
-#define O_FSYNC O_SYNC
-#define O_ASYNC 020000
-
-#ifdef __USE_GNU
-# define O_DIRECT 040000 /* Direct disk access. */
-# define O_DIRECTORY 0200000 /* Must be a directory. */
-# define O_NOFOLLOW 0400000 /* Do not follow links. */
-# define O_NOATIME 01000000 /* Do not set atime. */
-# define O_CLOEXEC 02000000 /* set close_on_exec */
-#endif
-
-/* For now Linux has synchronisity options for data and read operations.
- We define the symbols here but let them do the same as O_SYNC since
- this is a superset. */
-#if defined __USE_POSIX199309 || defined __USE_UNIX98
-# define O_DSYNC O_SYNC /* Synchronize data. */
-# define O_RSYNC O_SYNC /* Synchronize read operations. */
-#endif
-
-#ifdef __USE_LARGEFILE64
-# define O_LARGEFILE 0100000
-#endif
-
-/* Values for the second argument to `fcntl'. */
-#define F_DUPFD 0 /* Duplicate file descriptor. */
-#define F_GETFD 1 /* Get file descriptor flags. */
-#define F_SETFD 2 /* Set file descriptor flags. */
-#define F_GETFL 3 /* Get file status flags. */
-#define F_SETFL 4 /* Set file status flags. */
-#ifndef __USE_FILE_OFFSET64
-# define F_GETLK 5 /* Get record locking info. */
-# define F_SETLK 6 /* Set record locking info (non-blocking). */
-# define F_SETLKW 7 /* Set record locking info (blocking). */
-#else
-# define F_GETLK F_GETLK64 /* Get record locking info. */
-# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/
-# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */
-#endif
-#define F_GETLK64 12 /* Get record locking info. */
-#define F_SETLK64 13 /* Set record locking info (non-blocking). */
-#define F_SETLKW64 14 /* Set record locking info (blocking). */
-
-#if defined __USE_BSD || defined __USE_XOPEN2K
-# define F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */
-# define F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETSIG 10 /* Set number of signal to be sent. */
-# define F_GETSIG 11 /* Get number of signal to be sent. */
-#endif
-
-#ifdef __USE_GNU
-# define F_SETLEASE 1024 /* Set a lease. */
-# define F_GETLEASE 1025 /* Enquire what lease is active. */
-# define F_NOTIFY 1026 /* Request notfications on a directory. */
-# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with
- close-on-exit set on new fd. */
-# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */
-# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */
-#endif
-
-/* For F_[GET|SET]FL. */
-#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
-
-/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
-#define F_RDLCK 0 /* Read lock. */
-#define F_WRLCK 1 /* Write lock. */
-#define F_UNLCK 2 /* Remove lock. */
-
-/* For old implementation of bsd flock(). */
-#define F_EXLCK 4 /* or 3 */
-#define F_SHLCK 8 /* or 4 */
-
-#ifdef __USE_BSD
-/* Operations for bsd flock(), also used by the kernel implementation. */
-# define LOCK_SH 1 /* shared lock */
-# define LOCK_EX 2 /* exclusive lock */
-# define LOCK_NB 4 /* or'd with one of the above to prevent
- blocking */
-# define LOCK_UN 8 /* remove lock */
-#endif
-
-struct flock
- {
- short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
- short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
-#ifndef __USE_FILE_OFFSET64
- __off_t l_start; /* Offset where the lock begins. */
- __off_t l_len; /* Size of the locked area; zero means until EOF. */
-#else
- __off64_t l_start; /* Offset where the lock begins. */
- __off64_t l_len; /* Size of the locked area; zero means until EOF. */
-#endif
- __pid_t l_pid; /* Process holding the lock. */
- };
-
-#ifdef __USE_LARGEFILE64
-struct flock64
- {
- short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
- short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
- __off64_t l_start; /* Offset where the lock begins. */
- __off64_t l_len; /* Size of the locked area; zero means until EOF. */
- __pid_t l_pid; /* Process holding the lock. */
- };
-#endif
-
-/* Define some more compatibility macros to be backward compatible with
- BSD systems which did not managed to hide these kernel macros. */
-#ifdef __USE_BSD
-# define FAPPEND O_APPEND
-# define FFSYNC O_FSYNC
-# define FASYNC O_ASYNC
-# define FNONBLOCK O_NONBLOCK
-# define FNDELAY O_NDELAY
-#endif /* Use BSD. */
-
-/* Advise to `posix_fadvise'. */
-#ifdef __USE_XOPEN2K
-# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
-# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
-# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
-# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
-# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
-#endif
-
-
-#if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__
-/* Flags for SYNC_FILE_RANGE. */
-# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages
- in the range before performing the
- write. */
-# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those
- dirty pages in the range which are
- not presently under writeback. */
-# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
- the range after performing the
- write. */
-
-/* Flags for SPLICE and VMSPLICE. */
-# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
-# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing
- (but we may still block on the fd
- we splice from/to). */
-# define SPLICE_F_MORE 4 /* Expect more data. */
-# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */
-#endif
-
-__BEGIN_DECLS
-
-#if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__
-
-/* Provide kernel hint to read ahead. */
-extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
- __THROW;
-
-
-/* Selective file content synch'ing. */
-extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
- unsigned int __flags);
-
-/* Splice address range into a pipe. */
-extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
- size_t __count, unsigned int __flags);
-
-/* Splice two files together. */
-extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
- __off64_t *__offout, size_t __len,
- unsigned int __flags);
-
-/* In-kernel implementation of tee for pipe buffers. */
-extern ssize_t tee (int __fdin, int __fdout, size_t __len,
- unsigned int __flags);
-
-#endif
-__END_DECLS
-
diff --git a/libc/sysdeps/linux/sh64/bits/kernel_stat.h b/libc/sysdeps/linux/sh64/bits/kernel_stat.h
deleted file mode 100644
index 1a29433..0000000
--- a/libc/sysdeps/linux/sh64/bits/kernel_stat.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Stat structure for Linux/sh64 */
-
-#ifndef _BITS_STAT_STRUCT_H
-#define _BITS_STAT_STRUCT_H
-
-struct kernel_stat {
- unsigned short st_dev;
- unsigned short __pad1;
- unsigned long st_ino;
- unsigned short st_mode;
- unsigned short st_nlink;
- unsigned short st_uid;
- unsigned short st_gid;
- unsigned short st_rdev;
- unsigned short __pad2;
- unsigned long st_size;
- unsigned long st_blksize;
- unsigned long st_blocks;
- struct timespec st_atim;
- struct timespec st_mtim;
- struct timespec st_ctim;
- unsigned long __unused4;
- unsigned long __unused5;
-};
-
-struct kernel_stat64 {
- unsigned short st_dev;
- unsigned char __pad0[10];
-
- unsigned long st_ino;
- unsigned int st_mode;
- unsigned int st_nlink;
-
- unsigned long st_uid;
- unsigned long st_gid;
-
- unsigned short st_rdev;
- unsigned char __pad3[10];
-
- long long st_size;
- unsigned long st_blksize;
-
- unsigned long st_blocks; /* Number 512-byte blocks allocated. */
- unsigned long __pad4; /* future possible st_blocks high bits */
-
- struct timespec st_atim;
- struct timespec st_mtim;
- struct timespec st_ctim;
-
- unsigned long __unused1;
- unsigned long __unused2;
-};
-
-#endif /* _BITS_STAT_STRUCT_H */
-
diff --git a/libc/sysdeps/linux/sh64/bits/kernel_types.h b/libc/sysdeps/linux/sh64/bits/kernel_types.h
deleted file mode 100644
index 8cc6c61..0000000
--- a/libc/sysdeps/linux/sh64/bits/kernel_types.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * sysdeps/linux/sh64/bits/kernel_types.h
- *
- * Copyright (C) 2000, 2001 Paolo Alberelli
- * Copyright (C) 2003 Paul Mundt
- *
- * This file is subject to the terms and conditions of the GNU Lesser
- * General Public License. See the file COPYING.LIB in the main
- * directory of this archive for more details.
- */
-
-/*
- * Note that we use the exact same include guard #define names
- * as asm/posix_types.h. This will avoid gratuitous conflicts
- * with the posix_types.h kernel header, and will ensure that
- * our private content, and not the kernel header, will win.
- * -Erik
- */
-#ifndef __ASM_SH64_POSIX_TYPES_H
-#define __ASM_SH64_POSIX_TYPES_H
-
-typedef unsigned short __kernel_dev_t;
-typedef unsigned long __kernel_ino_t;
-typedef unsigned short __kernel_mode_t;
-typedef unsigned short __kernel_nlink_t;
-typedef long __kernel_off_t;
-typedef int __kernel_pid_t;
-typedef unsigned short __kernel_ipc_pid_t;
-typedef unsigned short __kernel_uid_t;
-typedef unsigned short __kernel_gid_t;
-typedef long unsigned int __kernel_size_t;
-typedef int __kernel_ssize_t;
-typedef int __kernel_ptrdiff_t;
-typedef long __kernel_time_t;
-typedef long __kernel_suseconds_t;
-typedef long __kernel_clock_t;
-typedef int __kernel_daddr_t;
-typedef char * __kernel_caddr_t;
-typedef unsigned short __kernel_uid16_t;
-typedef unsigned short __kernel_gid16_t;
-typedef unsigned int __kernel_uid32_t;
-typedef unsigned int __kernel_gid32_t;
-typedef unsigned short __kernel_old_uid_t;
-typedef unsigned short __kernel_old_gid_t;
-typedef __kernel_dev_t __kernel_old_dev_t;
-typedef long __kernel_long_t;
-typedef unsigned long __kernel_ulong_t;
-typedef long long __kernel_loff_t;
-
-typedef struct {
-#ifdef __USE_ALL
- int val[2];
-#else
- int __val[2];
-#endif
-} __kernel_fsid_t;
-
-#endif /* __ASM_SH64_POSIX_TYPES_H */
diff --git a/libc/sysdeps/linux/sh64/bits/setjmp.h b/libc/sysdeps/linux/sh64/bits/setjmp.h
deleted file mode 100644
index 5d13b88..0000000
--- a/libc/sysdeps/linux/sh64/bits/setjmp.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-/* Define the machine-dependent type `jmp_buf'. SH-5 version. */
-#ifndef _BITS_SETJMP_H
-#define _BITS_SETJMP_H 1
-
-#if !defined _SETJMP_H && !defined _PTHREAD_H
-# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
-#endif
-
-#define __SETJMP_NUM_INT 31 /* number of integer registers to save */
-#define __SETJMP_NUM_DBL 0 /* 16 */ /* number of double registers to save */
-#define __SETJMP_NUM_TRG 3 /* number of traget registers to save */
-
-#define __SETJMP_INT(x) (x)
-#define __SETJMP_DBL(x) (__SETJMP_NUM_INT+(x))
-#define __SETJMP_TRG(x) (__SETJMP_NUM_INT+__SETJMP_NUM_DBL+(x))
-#define __SETJMP_LR (__SETJMP_NUM_INT+__SETJMP_NUM_DBL+__SETJMP_NUM_TRG)
-
-typedef struct
- {
- /* Callee-saved registers. */
- unsigned long long __ints[__SETJMP_NUM_INT]; /* integer registers */
-#if __SETJMP_NUM_DBL > 0
- unsigned long long __dbls[__SETJMP_NUM_DBL]; /* double registers */
-#endif
- unsigned long long __trgs[__SETJMP_NUM_TRG]; /* traget registers */
- unsigned long long __lr; /* linkage register */
- } __jmp_buf[1];
-
-#endif /* bits/setjmp.h */
diff --git a/libc/sysdeps/linux/sh64/bits/shm.h b/libc/sysdeps/linux/sh64/bits/shm.h
deleted file mode 100644
index 274f36a..0000000
--- a/libc/sysdeps/linux/sh64/bits/shm.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Copyright (C) 1995,1996,1997,2000,2002,2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- 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, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef _SYS_SHM_H
-# error "Never include <bits/shm.h> directly; use <sys/shm.h> instead."
-#endif
-
-#include <bits/types.h>
-
-/* Permission flag for shmget. */
-#define SHM_R 0400 /* or S_IRUGO from <linux/stat.h> */
-#define SHM_W 0200 /* or S_IWUGO from <linux/stat.h> */
-
-/* Flags for `shmat'. */
-#define SHM_RDONLY 010000 /* attach read-only else read-write */
-#define SHM_RND 020000 /* round attach address to SHMLBA */
-#define SHM_REMAP 040000 /* take-over region on attach */
-
-/* Commands for `shmctl'. */
-#define SHM_LOCK 11 /* lock segment (root only) */
-#define SHM_UNLOCK 12 /* unlock segment (root only) */
-
-__BEGIN_DECLS
-
-/* Segment low boundary address multiple. */
-#define SHMLBA (__getpagesize() << 2)
-extern int __getpagesize (void) __THROW __attribute__ ((__const__));
-
-
-/* Type to count number of attaches. */
-typedef unsigned long int shmatt_t;
-
-/* Data structure describing a set of semaphores. */
-struct shmid_ds
- {
- struct ipc_perm shm_perm; /* operation permission struct */
- size_t shm_segsz; /* size of segment in bytes */
- __time_t shm_atime; /* time of last shmat() */
- unsigned long int __unused1;
- __time_t shm_dtime; /* time of last shmdt() */
- unsigned long int __unused2;
- __time_t shm_ctime; /* time of last change by shmctl() */
- unsigned long int __unused3;
- __pid_t shm_cpid; /* pid of creator */
- __pid_t shm_lpid; /* pid of last shmop */
- shmatt_t shm_nattch; /* number of current attaches */
- unsigned long int __unused4;
- unsigned long int __unused5;
- };
-
-#ifdef __USE_MISC
-
-/* ipcs ctl commands */
-# define SHM_STAT 13
-# define SHM_INFO 14
-
-/* shm_mode upper byte flags */
-# define SHM_DEST 01000 /* segment will be destroyed on last detach */
-# define SHM_LOCKED 02000 /* segment will not be swapped */
-# define SHM_HUGETLB 04000 /* segment is mapped via hugetlb */
-# define SHM_NORESERVE 010000 /* don't check for reservations */
-
-struct shminfo
- {
- unsigned long int shmmax;
- unsigned long int shmmin;
- unsigned long int shmmni;
- unsigned long int shmseg;
- unsigned long int shmall;
- unsigned long int __unused1;
- unsigned long int __unused2;
- unsigned long int __unused3;
- unsigned long int __unused4;
- };
-
-struct shm_info
- {
- int used_ids;
- unsigned long int shm_tot; /* total allocated shm */
- unsigned long int shm_rss; /* total resident shm */
- unsigned long int shm_swp; /* total swapped shm */
- unsigned long int swap_attempts;
- unsigned long int swap_successes;
- };
-
-#endif /* __USE_MISC */
-
-__END_DECLS
diff --git a/libc/sysdeps/linux/sh64/bits/stackinfo.h b/libc/sysdeps/linux/sh64/bits/stackinfo.h
deleted file mode 100644
index c52e7d7..0000000
--- a/libc/sysdeps/linux/sh64/bits/stackinfo.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-/* This file contains a bit of information about the stack allocation
- of the processor. */
-
-#ifndef _STACKINFO_H
-#define _STACKINFO_H 1
-
-/* On SH the stack grows down. */
-#define _STACK_GROWS_DOWN 1
-
-#endif /* stackinfo.h */
diff --git a/libc/sysdeps/linux/sh64/bits/syscalls.h b/libc/sysdeps/linux/sh64/bits/syscalls.h
deleted file mode 100644
index 84877d0..0000000
--- a/libc/sysdeps/linux/sh64/bits/syscalls.h
+++ /dev/null
@@ -1,126 +0,0 @@
-#ifndef _BITS_SYSCALLS_H
-#define _BITS_SYSCALLS_H
-#ifndef _SYSCALL_H
-# error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead."
-#endif
-
-#ifndef __ASSEMBLER__
-
-#include <errno.h>
-
-#define SYS_ify(syscall_name) (__NR_##syscall_name)
-
-/* user-visible error numbers are in the range -1 - -125: see <asm-sh64/errno.h> */
-#define __syscall_return(type, res) \
-do { \
- /* Note: when returning from kernel the return value is in r9 \
- ** This prevents conflicts between return value and arg1 \
- ** when dispatching signal handler, in other words makes \
- ** life easier in the system call epilogue (see entry.S) \
- */ \
- register unsigned long __sr2 __asm__ ("r2") = res; \
- if ((unsigned long)(res) >= (unsigned long)(-125)) { \
- errno = -(res); \
- __sr2 = -1; \
- } \
- return (type) (__sr2); \
-} while (0)
-
-/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
-
-#define _syscall0(type,name) \
-type name(void) \
-{ \
-register unsigned long __sc0 __asm__ ("r9") = ((0x10 << 16) | __NR_##name); \
-__asm__ __volatile__ ("trapa %1" \
- : "=r" (__sc0) \
- : "r" (__sc0) ); \
-__syscall_return(type,__sc0); \
-}
-
-#define _syscall1(type,name,type1,arg1) \
-type name(type1 arg1) \
-{ \
-register unsigned long __sc0 __asm__ ("r9") = ((0x11 << 16) | __NR_##name); \
-register unsigned long __sc2 __asm__ ("r2") = (unsigned long) arg1; \
-__asm__ __volatile__ ("trapa %1" \
- : "=r" (__sc0) \
- : "r" (__sc0), "r" (__sc2)); \
-__syscall_return(type,__sc0); \
-}
-
-#define _syscall2(type,name,type1,arg1,type2,arg2) \
-type name(type1 arg1,type2 arg2) \
-{ \
-register unsigned long __sc0 __asm__ ("r9") = ((0x12 << 16) | __NR_##name); \
-register unsigned long __sc2 __asm__ ("r2") = (unsigned long) arg1; \
-register unsigned long __sc3 __asm__ ("r3") = (unsigned long) arg2; \
-__asm__ __volatile__ ("trapa %1" \
- : "=r" (__sc0) \
- : "r" (__sc0), "r" (__sc2), "r" (__sc3) ); \
-__syscall_return(type,__sc0); \
-}
-
-#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
-type name(type1 arg1,type2 arg2,type3 arg3) \
-{ \
-register unsigned long __sc0 __asm__ ("r9") = ((0x13 << 16) | __NR_##name); \
-register unsigned long __sc2 __asm__ ("r2") = (unsigned long) arg1; \
-register unsigned long __sc3 __asm__ ("r3") = (unsigned long) arg2; \
-register unsigned long __sc4 __asm__ ("r4") = (unsigned long) arg3; \
-__asm__ __volatile__ ("trapa %1" \
- : "=r" (__sc0) \
- : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4) ); \
-__syscall_return(type,__sc0); \
-}
-
-#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
-type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
-{ \
-register unsigned long __sc0 __asm__ ("r9") = ((0x14 << 16) | __NR_##name); \
-register unsigned long __sc2 __asm__ ("r2") = (unsigned long) arg1; \
-register unsigned long __sc3 __asm__ ("r3") = (unsigned long) arg2; \
-register unsigned long __sc4 __asm__ ("r4") = (unsigned long) arg3; \
-register unsigned long __sc5 __asm__ ("r5") = (unsigned long) arg4; \
-__asm__ __volatile__ ("trapa %1" \
- : "=r" (__sc0) \
- : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4), "r" (__sc5) );\
-__syscall_return(type,__sc0); \
-}
-
-#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
-type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
-{ \
-register unsigned long __sc0 __asm__ ("r9") = ((0x15 << 16) | __NR_##name); \
-register unsigned long __sc2 __asm__ ("r2") = (unsigned long) arg1; \
-register unsigned long __sc3 __asm__ ("r3") = (unsigned long) arg2; \
-register unsigned long __sc4 __asm__ ("r4") = (unsigned long) arg3; \
-register unsigned long __sc5 __asm__ ("r5") = (unsigned long) arg4; \
-register unsigned long __sc6 __asm__ ("r6") = (unsigned long) arg5; \
-__asm__ __volatile__ ("trapa %1" \
- : "=r" (__sc0) \
- : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4), "r" (__sc5), \
- "r" (__sc6)); \
-__syscall_return(type,__sc0); \
-}
-
-#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5, type6, arg6) \
-type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) \
-{ \
-register unsigned long __sc0 __asm__ ("r9") = ((0x16 << 16) | __NR_##name); \
-register unsigned long __sc2 __asm__ ("r2") = (unsigned long) arg1; \
-register unsigned long __sc3 __asm__ ("r3") = (unsigned long) arg2; \
-register unsigned long __sc4 __asm__ ("r4") = (unsigned long) arg3; \
-register unsigned long __sc5 __asm__ ("r5") = (unsigned long) arg4; \
-register unsigned long __sc6 __asm__ ("r6") = (unsigned long) arg5; \
-register unsigned long __sc7 __asm__ ("r7") = (unsigned long) arg6; \
-__asm__ __volatile__ ("trapa %1" \
- : "=r" (__sc0) \
- : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4), "r" (__sc5), \
- "r" (__sc6), "r" (__sc7)); \
-__syscall_return(type,__sc0); \
-}
-
-#endif /* __ASSEMBLER__ */
-#endif /* _BITS_SYSCALLS_H */
-
diff --git a/libc/sysdeps/linux/sh64/bits/uClibc_arch_features.h b/libc/sysdeps/linux/sh64/bits/uClibc_arch_features.h
deleted file mode 100644
index 001c5c2..0000000
--- a/libc/sysdeps/linux/sh64/bits/uClibc_arch_features.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Track misc arch-specific features that aren't config options
- */
-
-#ifndef _BITS_UCLIBC_ARCH_FEATURES_H
-#define _BITS_UCLIBC_ARCH_FEATURES_H
-
-/* instruction used when calling abort() to kill yourself */
-#define __UCLIBC_ABORT_INSTRUCTION__ "movi 0x10, r9; shori 0xff, r9; trapa r9"
-
-/* can your target use syscall6() for mmap ? */
-#undef __UCLIBC_MMAP_HAS_6_ARGS__
-
-/* does your target align 64bit values in register pairs ? (32bit arches only) */
-#undef __UCLIBC_SYSCALL_ALIGN_64BIT__
-
-/* does your target have a broken create_module() ? */
-#undef __UCLIBC_BROKEN_CREATE_MODULE__
-
-/* does your target have to worry about older [gs]etrlimit() ? */
-#undef __UCLIBC_HANDLE_OLDER_RLIMIT__
-
-/* does your target have an asm .set ? */
-#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
-
-/* define if target doesn't like .global */
-#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__
-
-/* define if target supports .weak */
-#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__
-
-/* define if target supports .weakext */
-#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__
-
-/* needed probably only for ppc64 */
-#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__
-
-/* define if target supports CFI pseudo ops */
-#undef __UCLIBC_HAVE_ASM_CFI_DIRECTIVES__
-
-/* define if target supports IEEE signed zero floats */
-#define __UCLIBC_HAVE_SIGNED_ZERO__
-
-/* only weird assemblers generally need this */
-#undef __UCLIBC_ASM_LINE_SEP__
-
-#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */
diff --git a/libc/sysdeps/linux/sh64/bits/wordsize.h b/libc/sysdeps/linux/sh64/bits/wordsize.h
deleted file mode 100644
index 7c2723b..0000000
--- a/libc/sysdeps/linux/sh64/bits/wordsize.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * libc/sysdeps/linux/sh64/bits/wordsize.h
- *
- * Copyright (C) 2003 Paul Mundt
- *
- * This file is subject to the terms and conditions of the GNU Lesser
- * General Public License. See the file COPYING.LIB in the main
- * directory of this archive for more details.
- */
-
-#define __WORDSIZE 32
-
diff --git a/libc/sysdeps/linux/sh64/brk.c b/libc/sysdeps/linux/sh64/brk.c
deleted file mode 100644
index a98cd54..0000000
--- a/libc/sysdeps/linux/sh64/brk.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* From libc-5.3.12 */
-/*
- * Copyright (C) 2000-2006 Erik Andersen <andersen(a)uclibc.org>
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- */
-
-#include <errno.h>
-#include <unistd.h>
-#include <sys/syscall.h>
-
-extern void * __curbrk attribute_hidden;
-extern int __init_brk (void) attribute_hidden;
-extern void *_brk(void *ptr) attribute_hidden;
-
-int brk(void * end_data_seg)
-{
- if (__init_brk () == 0)
- {
- __curbrk = _brk(end_data_seg);
- if (__curbrk == end_data_seg)
- return 0;
- __set_errno(ENOMEM);
- }
- return -1;
-}
-libc_hidden_def(brk)
diff --git a/libc/sysdeps/linux/sh64/crt1.S b/libc/sysdeps/linux/sh64/crt1.S
deleted file mode 100644
index 6cc3773..0000000
--- a/libc/sysdeps/linux/sh64/crt1.S
+++ /dev/null
@@ -1,82 +0,0 @@
-/* Startup code for SH5 & ELF.
- Copyright (C) 1999 Free Software Foundation, Inc.
- Copyright (C) 2001 Hewlett-Packard Australia
-
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- see <http://www.gnu.org/licenses/>. */
-
-/* This is the canonical entry point, usually the first thing in the text
- segment.
-
- At this entry point, most registers' values are unspecified, except:
-
- sp The stack contains the arguments and environment:
- 0(sp) argc
- 4(sp) argv[0]
- ...
- (4*argc)(sp) NULL
- (4*(argc+1))(sp) envp[0]
- ...
- NULL
-*/
-
- .file "crt1.S"
-
- .globl _start
- .type _start,%function
- .type main,%function
-
- .section .text64,"xa"
- .align 2 /* 2^2 = 4 */
-
-_start:
- /* __uClibc_main (main, argc, argv, init, fini) */
- movi __main, r18
- or r2, r63, r18
-
- /* Pop argc off the stack and save a pointer to argv */
- ld.l r15, 0, r3 /* argc */
- addi r15, 4, r4 /* argv */
-
- movi _init, r5
- movi _fini, r6
-
- /* call main() */
- movi __uClibc_main, r17
- ptabs/l r17, tr0
- blink tr0, r18
-
- /* should never get here....*/
- movi abort, r17
- ptabs/l r17, tr0
- blink tr0, r63 /* call abort() => (r63) do not come back ... */
-
-/*
- * The following is a stub to stop the GNU toolchain
- * from calling its C-RTL initialization routines.
- */
-__main:
- movi main, r18
- ptabs/l r18, tr0
- blink tr0, r63
-
-/* Define a symbol for the first piece of initialized data. */
- .data
- .globl __data_start
-__data_start:
- .long 0
- .weak data_start
- data_start = __data_start
diff --git a/libc/sysdeps/linux/sh64/crti.S b/libc/sysdeps/linux/sh64/crti.S
deleted file mode 100644
index 597be36..0000000
--- a/libc/sysdeps/linux/sh64/crti.S
+++ /dev/null
@@ -1,42 +0,0 @@
- .file "initfini.c"
- .section .text..SHmedia32,"ax"
- .little
-
- .section .init
- .hidden _init
- .align 2
- .global _init
- .type _init, @function
-_init:
- addi.l r15, -16, r15
- st.l r15, 4, r12
- movi (((datalabel _GLOBAL_OFFSET_TABLE_-(.LPCS0-.)) >> 16) & 65535), r12
- shori ((datalabel _GLOBAL_OFFSET_TABLE_-(.LPCS0-.)) & 65535), r12
- .LPCS0: ptrel/u r12, tr0
- st.l r15, 8, r14
- st.l r15, 12, r18
- add.l r15, r63, r14
- gettr tr0, r12
-
- .align 2
-
-
- .section .fini
- .hidden _fini
- .align 2
- .global _fini
- .type _fini, @function
-_fini:
- addi.l r15, -16, r15
- st.l r15, 4, r12
- movi (((datalabel _GLOBAL_OFFSET_TABLE_-(.LPCS1-.)) >> 16) & 65535), r12
- shori ((datalabel _GLOBAL_OFFSET_TABLE_-(.LPCS1-.)) & 65535), r12
- .LPCS1: ptrel/u r12, tr0
- st.l r15, 8, r14
- st.l r15, 12, r18
- add.l r15, r63, r14
- gettr tr0, r12
- .align 2
-
-
- .ident "GCC: (GNU) 3.3.2"
diff --git a/libc/sysdeps/linux/sh64/crtn.S b/libc/sysdeps/linux/sh64/crtn.S
deleted file mode 100644
index 501fe91..0000000
--- a/libc/sysdeps/linux/sh64/crtn.S
+++ /dev/null
@@ -1,31 +0,0 @@
- .file "initfini.c"
- .section .text..SHmedia32,"ax"
- .little
-
- .section .init
- .hidden _init
- .align 2
- .global _init
- .type _init, @function
- add.l r14, r63, r15
- ld.l r15, 12, r18
- ld.l r15, 4, r12
- ld.l r15, 8, r14
- ptabs r18, tr0
- addi.l r15, 16, r15
- blink tr0, r63
-
- .section .fini
- .hidden _fini
- .align 2
- .global _fini
- .type _fini, @function
- add.l r14, r63, r15
- ld.l r15, 12, r18
- ld.l r15, 4, r12
- ld.l r15, 8, r14
- ptabs r18, tr0
- addi.l r15, 16, r15
- blink tr0, r63
-
- .ident "GCC: (GNU) 3.3.2"
diff --git a/libc/sysdeps/linux/sh64/sbrk.c b/libc/sysdeps/linux/sh64/sbrk.c
deleted file mode 100644
index 2dc719a..0000000
--- a/libc/sysdeps/linux/sh64/sbrk.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* From libc-5.3.12 */
-
-#include <errno.h>
-#include <unistd.h>
-#include <sys/syscall.h>
-
-extern void * __curbrk attribute_hidden;
-extern int __init_brk (void) attribute_hidden;
-extern void *_brk(void *ptr) attribute_hidden;
-
-void *
-sbrk(intptr_t increment)
-{
- if (__init_brk () == 0)
- {
- char * tmp = (char*)__curbrk+increment;
- __curbrk = _brk(tmp);
- if (__curbrk == tmp)
- return tmp-increment;
- __set_errno(ENOMEM);
- return ((void *) -1);
- }
- return ((void *) -1);
-}
-libc_hidden_def(sbrk)
diff --git a/libc/sysdeps/linux/sh64/setjmp.S b/libc/sysdeps/linux/sh64/setjmp.S
deleted file mode 100644
index f81961c..0000000
--- a/libc/sysdeps/linux/sh64/setjmp.S
+++ /dev/null
@@ -1,139 +0,0 @@
-/* setjmp for SH-5.
- Copyright (C) 2001 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- see <http://www.gnu.org/licenses/>. */
-
-
-#define _SETJMP_H
-#define _ASM
-#include <bits/setjmp.h>
-
-
-#define INTEGER(reg,offset) st.q r2, offset*8, reg
-#define DOUBLE(reg,offset) fst.d r2, offset*8, reg
-
-
- .file "setjmp.S"
-
- .section .text64,"xa"
- .align 2
-
- .global __sigsetjmp
- .type __sigsetjmp,@function
-
-__sigsetjmp:
- /*
- * extern int __sigsetjmp(jmp_buf env, int savemask);
- *
- * r2 == env
- * r3 == savemask
- * r4 == temporary
- */
-
- /* callee-save registers R10-R16 */
- INTEGER(r10, __SETJMP_INT(0))
- INTEGER(r11, __SETJMP_INT(1))
- INTEGER(r12, __SETJMP_INT(2))
- INTEGER(r13, __SETJMP_INT(3))
- INTEGER(r14, __SETJMP_INT(4))
- INTEGER(r15, __SETJMP_INT(5))
- INTEGER(r16, __SETJMP_INT(6))
-
- /* callee-save registers R28-R35 */
- INTEGER(r28, __SETJMP_INT(7))
- INTEGER(r29, __SETJMP_INT(8))
- INTEGER(r30, __SETJMP_INT(9))
- INTEGER(r31, __SETJMP_INT(10))
- INTEGER(r32, __SETJMP_INT(11))
- INTEGER(r33, __SETJMP_INT(12))
- INTEGER(r34, __SETJMP_INT(13))
- INTEGER(r35, __SETJMP_INT(14))
-
- /* callee-save registers R44-R59 */
- INTEGER(r44, __SETJMP_INT(15))
- INTEGER(r45, __SETJMP_INT(16))
- INTEGER(r46, __SETJMP_INT(17))
- INTEGER(r47, __SETJMP_INT(18))
- INTEGER(r48, __SETJMP_INT(19))
- INTEGER(r49, __SETJMP_INT(20))
- INTEGER(r50, __SETJMP_INT(21))
- INTEGER(r51, __SETJMP_INT(22))
- INTEGER(r52, __SETJMP_INT(23))
- INTEGER(r53, __SETJMP_INT(24))
- INTEGER(r54, __SETJMP_INT(25))
- INTEGER(r55, __SETJMP_INT(26))
- INTEGER(r56, __SETJMP_INT(27))
- INTEGER(r57, __SETJMP_INT(28))
- INTEGER(r58, __SETJMP_INT(29))
- INTEGER(r59, __SETJMP_INT(30))
-
- #if __SETJMP_NUM_INT != 31
- #error __SETJMP_NUM_INT does agree with expected value
- #endif
-
-#if __SETJMP_NUM_DBL > 0
- /* callee-save registers FR12-FR15 */
- DOUBLE(d12, __SETJMP_DBL(0))
- DOUBLE(d14, __SETJMP_DBL(1))
-
- /* callee-save registers FR36-FR63 */
- DOUBLE(d36, __SETJMP_DBL(2))
- DOUBLE(d38, __SETJMP_DBL(3))
- DOUBLE(d40, __SETJMP_DBL(4))
- DOUBLE(d42, __SETJMP_DBL(5))
- DOUBLE(d44, __SETJMP_DBL(6))
- DOUBLE(d46, __SETJMP_DBL(7))
- DOUBLE(d48, __SETJMP_DBL(8))
- DOUBLE(d50, __SETJMP_DBL(9))
- DOUBLE(d52, __SETJMP_DBL(10))
- DOUBLE(d54, __SETJMP_DBL(11))
- DOUBLE(d56, __SETJMP_DBL(12))
- DOUBLE(d58, __SETJMP_DBL(13))
- DOUBLE(d60, __SETJMP_DBL(14))
- DOUBLE(d62, __SETJMP_DBL(15))
-
- #if __SETJMP_NUM_DBL != 16
- #error __SETJMP_NUM_DBL does agree with expected value
- #endif
-
-#endif /* __SETJMP_NUM_DBL > 0 */
-
- /* callee-save registers TR5-TR7 */
- gettr tr5, r4
- INTEGER(r4, __SETJMP_TRG(0))
- gettr tr6, r4
- INTEGER(r4, __SETJMP_TRG(1))
- gettr tr7, r4
- INTEGER(r4, __SETJMP_TRG(2))
-
- #if __SETJMP_NUM_TRG != 3
- #error __SETJMP_NUM_TRG does agree with expected value
- #endif
-
- /* save Linkage Register (LR) for longjmp return */
- INTEGER(r18, __SETJMP_LR)
-
- /*
- * return a value of zero if call is __sigsetjmp().
- * This is so that caller of setjmp() knows
- * we have retruned via setjmp, and not via longjmp.
- * R0 is the result register.
- */
-
- ptabs/l r18, tr0 /* return to caller */
- movi 0, r2 /* return value */
- blink tr0, r63
-
diff --git a/libc/sysdeps/linux/sh64/sys/procfs.h b/libc/sysdeps/linux/sh64/sys/procfs.h
deleted file mode 100644
index 5fc4c57..0000000
--- a/libc/sysdeps/linux/sh64/sys/procfs.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/* Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef _SYS_PROCFS_H
-#define _SYS_PROCFS_H 1
-
-/* This is somehow modelled after the file of the same name on SysVr4
- systems. It provides a definition of the core file format for ELF
- used on Linux. */
-
-#include <features.h>
-#include <signal.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/ucontext.h>
-#include <sys/user.h>
-
-__BEGIN_DECLS
-
-/*
- * ELF register definitions...
- */
-typedef unsigned long elf_greg_t;
-
-#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
-typedef elf_greg_t elf_gregset_t[ELF_NGREG];
-
-typedef struct user_fpu_struct elf_fpregset_t;
-
-struct elf_siginfo
- {
- int si_signo; /* Signal number. */
- int si_code; /* Extra code. */
- int si_errno; /* Errno. */
- };
-
-
-/* Definitions to generate Intel SVR4-like core files. These mostly
- have the same names as the SVR4 types with "elf_" tacked on the
- front to prevent clashes with linux definitions, and the typedef
- forms have been avoided. This is mostly like the SVR4 structure,
- but more Linuxy, with things that Linux does not support and which
- gdb doesn't really use excluded. Fields present but not used are
- marked with "XXX". */
-struct elf_prstatus
- {
-#if 0
- long int pr_flags; /* XXX Process flags. */
- short int pr_why; /* XXX Reason for process halt. */
- short int pr_what; /* XXX More detailed reason. */
-#endif
- struct elf_siginfo pr_info; /* Info associated with signal. */
- short int pr_cursig; /* Current signal. */
- unsigned long int pr_sigpend; /* Set of pending signals. */
- unsigned long int pr_sighold; /* Set of held signals. */
-#if 0
- struct sigaltstack pr_altstack; /* Alternate stack info. */
- struct sigaction pr_action; /* Signal action for current sig. */
-#endif
- __pid_t pr_pid;
- __pid_t pr_ppid;
- __pid_t pr_pgrp;
- __pid_t pr_sid;
- struct timeval pr_utime; /* User time. */
- struct timeval pr_stime; /* System time. */
- struct timeval pr_cutime; /* Cumulative user time. */
- struct timeval pr_cstime; /* Cumulative system time. */
-#if 0
- long int pr_instr; /* Current instruction. */
-#endif
- elf_gregset_t pr_reg; /* GP registers. */
- int pr_fpvalid; /* True if math copro being used. */
- };
-
-
-#define ELF_PRARGSZ (80) /* Number of chars for args */
-
-struct elf_prpsinfo
- {
- char pr_state; /* Numeric process state. */
- char pr_sname; /* Char for pr_state. */
- char pr_zomb; /* Zombie. */
- char pr_nice; /* Nice val. */
- unsigned long int pr_flag; /* Flags. */
- long pr_uid;
- long pr_gid;
- int pr_pid, pr_ppid, pr_pgrp, pr_sid;
- /* Lots missing */
- char pr_fname[16]; /* Filename of executable. */
- char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */
- };
-
-
-/* Addresses. */
-typedef void *psaddr_t;
-
-/* Register sets. Linux has different names. */
-typedef elf_gregset_t prgregset_t;
-typedef elf_fpregset_t prfpregset_t;
-
-/* We don't have any differences between processes and threads,
- therefore habe only ine PID type. */
-typedef __pid_t lwpid_t;
-
-
-typedef struct elf_prstatus prstatus_t;
-typedef struct elf_prpsinfo prpsinfo_t;
-
-__END_DECLS
-
-#endif /* sys/procfs.h */
diff --git a/libc/sysdeps/linux/sh64/sys/ucontext.h b/libc/sysdeps/linux/sh64/sys/ucontext.h
deleted file mode 100644
index 7369559..0000000
--- a/libc/sysdeps/linux/sh64/sys/ucontext.h
+++ /dev/null
@@ -1,204 +0,0 @@
-/* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- see <http://www.gnu.org/licenses/>. */
-
-/* Where is System V/SH ABI? */
-
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H 1
-
-#include <features.h>
-#include <signal.h>
-
-/* We need the signal context definitions even if they are not used
- included in <signal.h>. */
-#include <bits/sigcontext.h>
-
-
-typedef long long greg_t;
-
-/* Number of general registers. */
-#define NGREG 64
-
-/* Container for all general registers. */
-typedef greg_t gregset_t[NGREG];
-
-#ifdef __USE_GNU
-/* Number of each register is the `gregset_t' array. */
-enum
-{
- R0 = 0,
-#define R0 R0
- R1 = 1,
-#define R1 R1
- R2 = 2,
-#define R2 R2
- R3 = 3,
-#define R3 R3
- R4 = 4,
-#define R4 R4
- R5 = 5,
-#define R5 R5
- R6 = 6,
-#define R6 R6
- R7 = 7,
-#define R7 R7
- R8 = 8,
-#define R8 R8
- R9 = 9,
-#define R9 R9
- R10 = 10,
-#define R10 R10
- R11 = 11,
-#define R11 R11
- R12 = 12,
-#define R12 R12
- R13 = 13,
-#define R13 R13
- R14 = 14,
-#define R14 R14
- R15 = 15,
-#define R15 R15
- R16 = 16,
-#define R16 R16
- R17 = 17,
-#define R17 R17
- R18 = 18,
-#define R18 R18
- R19 = 19,
-#define R19 R19
- R20 = 20,
-#define R20 R20
- R21 = 21,
-#define R21 R21
- R22 = 22,
-#define R22 R22
- R23 = 23,
-#define R23 R23
- R24 = 24,
-#define R24 R24
- R25 = 25,
-#define R25 R25
- R26 = 26,
-#define R26 R26
- R27 = 27,
-#define R27 R27
- R28 = 28,
-#define R28 R28
- R29 = 29,
-#define R29 R29
- R30 = 30,
-#define R30 R30
- R31 = 31,
-#define R31 R31
- R32 = 32,
-#define R32 R32
- R33 = 33,
-#define R33 R33
- R34 = 34,
-#define R34 R34
- R35 = 35,
-#define R35 R35
- R36 = 36,
-#define R36 R36
- R37 = 37,
-#define R37 R37
- R38 = 38,
-#define R38 R38
- R39 = 39,
-#define R39 R39
- R40 = 40,
-#define R40 R40
- R41 = 41,
-#define R41 R41
- R42 = 42,
-#define R42 R42
- R43 = 43,
-#define R43 R43
- R44 = 44,
-#define R44 R44
- R45 = 45,
-#define R45 R45
- R46 = 46,
-#define R46 R46
- R47 = 47,
-#define R47 R47
- R48 = 48,
-#define R48 R48
- R49 = 49,
-#define R49 R49
- R50 = 50,
-#define R50 R50
- R51 = 51,
-#define R51 R51
- R52 = 52,
-#define R52 R52
- R53 = 53,
-#define R53 R53
- R54 = 54,
-#define R54 R54
- R55 = 55,
-#define R55 R55
- R56 = 56,
-#define R56 R56
- R57 = 57,
-#define R57 R57
- R58 = 58,
-#define R58 R58
- R59 = 59,
-#define R59 R59
- R60 = 60,
-#define R60 R60
- R61 = 61,
-#define R61 R61
- R62 = 62,
-#define R62 R62
- R63 = 63,
-#define R63 R63
-};
-#endif
-
-typedef int freg_t;
-
-/* Number of FPU registers. */
-#define NFPREG 32
-
-/* Structure to describe FPU registers. */
-typedef freg_t fpregset_t[NFPREG];
-
-/* Context to describe whole processor state. */
-typedef struct
- {
- gregset_t gregs;
- fpregset_t fpregs;
- unsigned long long sc_tregs[8];
- unsigned long long sc_pc;
- unsigned long long sc_sr;
- unsigned long long sc_fpscr;
-
- } mcontext_t;
-
-/* Userlevel context. */
-typedef struct ucontext
- {
- unsigned long int uc_flags;
- struct ucontext *uc_link;
- stack_t uc_stack;
- mcontext_t uc_mcontext;
- __sigset_t uc_sigmask;
- } ucontext_t;
-
-#endif /* sys/ucontext.h */
diff --git a/libc/sysdeps/linux/sh64/syscall.c b/libc/sysdeps/linux/sh64/syscall.c
deleted file mode 100644
index a6c55eb..0000000
--- a/libc/sysdeps/linux/sh64/syscall.c
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-#include <features.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/syscall.h>
-
-long syscall(long sysnum,
- long arg1, long arg2, long arg3,
- long arg4, long arg5, long arg6)
-{
-register long __sc0 __asm__ ("r9") = ((0x16 << 16) | sysnum);
-register long __sc2 __asm__ ("r2") = (long) arg1;
-register long __sc3 __asm__ ("r3") = (long) arg2;
-register long __sc4 __asm__ ("r4") = (long) arg3;
-register long __sc5 __asm__ ("r5") = (long) arg4;
-register long __sc6 __asm__ ("r6") = (long) arg5;
-register long __sc7 __asm__ ("r7") = (long) arg6;
-__asm__ __volatile__ ("trapa %1" \
- : "=r" (__sc0) \
- : "r" (__sc0), "r" (__sc2), "r" (__sc3), "r" (__sc4), "r" (__sc5), \
- "r" (__sc6), "r" (__sc7));
-__syscall_return(long,__sc0);
-}
diff --git a/libpthread/linuxthreads/sysdeps/sh64/Makefile.arch b/libpthread/linuxthreads/sysdeps/sh64/Makefile.arch
deleted file mode 100644
index 3fbb53b..0000000
--- a/libpthread/linuxthreads/sysdeps/sh64/Makefile.arch
+++ /dev/null
@@ -1,30 +0,0 @@
-# Makefile for uClibc
-#
-# Copyright (C) 2003 Paul Mundt <lethal(a)linux-sh.org>
-# Copyright (C) 2000-2008 Erik Andersen <andersen(a)uclibc.org>
-#
-# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-#
-
-libpthread_ARCH_DIR:=$(top_srcdir)libpthread/linuxthreads/sysdeps/sh64
-libpthread_ARCH_OUT:=$(top_builddir)libpthread/linuxthreads/sysdeps/sh64
-
-libpthread_ARCH_SRC:=$(wildcard $(libpthread_ARCH_DIR)/*.c)
-libpthread_ARCH_OBJ:=$(patsubst $(libpthread_ARCH_DIR)/%.c,$(libpthread_ARCH_OUT)/%.o,$(libpthread_ARCH_SRC))
-
-libpthread-a-y+=$(libpthread_ARCH_OBJ)
-libpthread-so-y+=$(libpthread_ARCH_OBJ:.o=.os)
-
-libpthread-multi-y+=$(libpthread_ARCH_SRC)
-
-objclean-y += CLEAN_$($(top_builddir),,$(libpthread_ARCH_OUT))
-
-# We need to build as SHcompact for tas..
-$(libpthread_ARCH_OBJ): %.o : %.c
- $(compile.c:32media=compact)
-
-$(libpthread_ARCH_OBJ:.o=.os): %.os : %.c
- $(compile.c:32media=compact)
-
-CLEAN_$($(top_builddir),,$(libpthread_ARCH_OUT)):
- $(do_rm) $(addprefix $(libpthread_ARCH_OUT)/*., o os)
diff --git a/libpthread/linuxthreads/sysdeps/sh64/pt-machine.c b/libpthread/linuxthreads/sysdeps/sh64/pt-machine.c
deleted file mode 100644
index 1c187c8..0000000
--- a/libpthread/linuxthreads/sysdeps/sh64/pt-machine.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Cloned for uClibc by Paul Mundt, December 2003 */
-/* Modified by SuperH, Inc. September 2003 */
-
-/* Machine-dependent pthreads configuration and inline functions.
- SH5 version.
- Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Niibe Yutaka <gniibe(a)m17n.org>.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- see <http://www.gnu.org/licenses/>. */
-
-#include "pt-machine.h"
-
-/* Spinlock implementation; required. */
-
-/* The SH5 does not have a suitable test-and-set instruction (SWAP only
- operates on an aligned quad word). So we use the SH4 version instead.
- This must be seperately compiled in SHcompact mode, so it cannot be
- inline. */
-
-long int testandset (int *spinlock)
-{
- int ret;
-
- __asm__ __volatile__(
- "tas.b @%1\n\t"
- "movt %0"
- : "=r" (ret)
- : "r" (spinlock)
- : "memory", "cc");
-
- return (ret == 0);
-}
-
diff --git a/libpthread/linuxthreads/sysdeps/sh64/pt-machine.h b/libpthread/linuxthreads/sysdeps/sh64/pt-machine.h
deleted file mode 100644
index 9b1fc74..0000000
--- a/libpthread/linuxthreads/sysdeps/sh64/pt-machine.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Cloned for uClibc by Paul Mundt, December 2003 */
-/* Modified by SuperH, Inc. September 2003 */
-
-/* Machine-dependent pthreads configuration and inline functions.
- SuperH version.
- Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Niibe Yutaka <gniibe(a)m17n.org>.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- see <http://www.gnu.org/licenses/>. */
-
-#ifndef _PT_MACHINE_H
-#define _PT_MACHINE_H 1
-
-#include <features.h>
-
-#ifndef PT_EI
-# define PT_EI __extern_always_inline
-#endif
-
-/* Get some notion of the current stack. Need not be exactly the top
- of the stack, just something somewhere in the current frame. */
-#define CURRENT_STACK_FRAME stack_pointer
-register char * stack_pointer __asm__ ("r15");
-
-#endif /* pt-machine.h */
hooks/post-receive
--
uClibc-ng - small C library for embedded systems
1
0

uClibc-ng - small C library for embedded systems branch master updated. 0c5a5b1aa93ee051556d487b68352cec0c3e1a96
by wbx@helium.waldemar-brodkorb.de 29 Mar '15
by wbx@helium.waldemar-brodkorb.de 29 Mar '15
29 Mar '15
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".
The branch, master has been updated
via 0c5a5b1aa93ee051556d487b68352cec0c3e1a96 (commit)
from 9385c07ed05b36b12417fc01a37d10ed5908244e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 0c5a5b1aa93ee051556d487b68352cec0c3e1a96
Author: Waldemar Brodkorb <wbx(a)openadk.org>
Date: Sun Mar 29 16:22:30 2015 -0500
Revert "gcc 4.9.x produces some calls to abort()"
This reverts commit 8d73c06c7a78745a50dc8683fd117aeacd71a04b.
Fixed in a better way by Bernhard in uClibc.
-----------------------------------------------------------------------
Summary of changes:
ldso/ldso/Makefile.in | 8 --------
1 file changed, 8 deletions(-)
diff --git a/ldso/ldso/Makefile.in b/ldso/ldso/Makefile.in
index 56f4a45..e0d0a09 100644
--- a/ldso/ldso/Makefile.in
+++ b/ldso/ldso/Makefile.in
@@ -27,14 +27,6 @@ CFLAGS-$(DODEBUG)-ldso/ldso := -O2 -g
CFLAGS-ldso.c := -DLDSO_ELFINTERP=\"$(TARGET_ARCH)/elfinterp.c\"
-# avoid ld.so linking error since gcc 4.9.x: undefined reference to abort
-ifeq ($(TARGET_ARCH),xtensa)
-CFLAGS-ldso.c += -fno-delete-null-pointer-checks
-endif
-ifeq ($(TARGET_ARCH),sh)
-CFLAGS-ldso.c += -fno-delete-null-pointer-checks
-endif
-
LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-$(UCLIBC_LDSO_NAME).so := -Wl,--dsbt-index=1
ifneq ($(SUPPORT_LD_DEBUG),y)
LDFLAGS-$(UCLIBC_LDSO_NAME).so := $(LDFLAGS)
hooks/post-receive
--
uClibc-ng - small C library for embedded systems
1
0

uClibc-ng - small C library for embedded systems branch master updated. 9385c07ed05b36b12417fc01a37d10ed5908244e
by wbx@helium.waldemar-brodkorb.de 29 Mar '15
by wbx@helium.waldemar-brodkorb.de 29 Mar '15
29 Mar '15
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".
The branch, master has been updated
via 9385c07ed05b36b12417fc01a37d10ed5908244e (commit)
from 045f3557b1d2390a59e2a55ece191dc35d3e95b4 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 9385c07ed05b36b12417fc01a37d10ed5908244e
Author: Waldemar Brodkorb <wbx(a)openadk.org>
Date: Sun Mar 29 16:20:54 2015 -0500
gcc 4.4 does not have __builtin_unreachable
For avr32 we still use gcc 4.4 compiler, so exlude the usage
of __builtin_unreachable here.
-----------------------------------------------------------------------
Summary of changes:
ldso/include/dl-syscall.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ldso/include/dl-syscall.h b/ldso/include/dl-syscall.h
index 4749d7a..0acd2ba 100644
--- a/ldso/include/dl-syscall.h
+++ b/ldso/include/dl-syscall.h
@@ -51,7 +51,7 @@ extern int _dl_errno;
static __always_inline attribute_noreturn __cold void _dl_exit(int status)
{
INLINE_SYSCALL(_dl_exit, 1, status);
-#if defined __GNUC__
+#if defined __GNUC__ && !__GNUC_PREREQ (4, 4)
__builtin_unreachable(); /* shut up warning: 'noreturn' function does return*/
#else
while (1);
hooks/post-receive
--
uClibc-ng - small C library for embedded systems
1
0

uClibc-ng - small C library for embedded systems branch 1.0 updated. v1.0.1-54-gcd5f927
by wbx@helium.waldemar-brodkorb.de 29 Mar '15
by wbx@helium.waldemar-brodkorb.de 29 Mar '15
29 Mar '15
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".
The branch, 1.0 has been updated
via cd5f92704e1e17bbc0c15d197f3bc236c7dc9bf2 (commit)
via 24946289317ea23bb0d1814cca0a499a905f7d6f (commit)
via d3c60fc490d714d7610a91555cec67952409b189 (commit)
via 70bafe7e4d52f6dafbb5888009c9b601cdbc3743 (commit)
via 8fde02feb2f8a36934308012d89fa6614967b2dc (commit)
via cc8d7d062e2db0a1ed3973e6af38cd1938ba74d7 (commit)
via 560f416794403be952e850756d7e8b23e8fa92ac (commit)
via cf80a7fc2db30364ac98be40483e599c2c243e87 (commit)
via 8836d184d4da65e8959210bc7b768e628b0273fb (commit)
via fc673e14203e1c9aea353d99ff89a17d46b2ad93 (commit)
via 2c8a7766681b704e710f51c0817534e3f9a952d1 (commit)
via 9e552e6a2d836698834d2bf887dbf1806172729f (commit)
via 6f363f69221a6b40ef0f88631cd8d675465eb63d (commit)
via 6ff9c31abc14f207265ab214370982ecb3bfe428 (commit)
via 2b33716c08cc506e57115e34b5fe11d8d5477398 (commit)
via 40effcf4c1e9a2fb9169d9189bdc9b1c888f9345 (commit)
via 730db44f0824f505a31822e250b9f04b9f8e7a1b (commit)
via 272e4fa4d38440d5c01259fce7d74f8c0a9d300f (commit)
via c846358a61434e6cb9b1f73bc35df0e5404f52d2 (commit)
via 6cba32e6e9a1910ea0a5277fd39484047094e478 (commit)
via 97c9f52239301c81c021b8be187ac07ddf33496d (commit)
via d0f60a600bafc3f6dfc844418d310cf6a4e38c92 (commit)
via 4da43e9f2e4f2f7593427003e37b87287c7b16cf (commit)
via eee76e42f32f90af4e64a254810fcb767297fecf (commit)
via 9277fe13156a6ff2b055fe8a58d2863115c36b6a (commit)
via 63729418992d5f63965a88fa2ac3570e3d270479 (commit)
via 09ff424905d5de0b2a21a3960d9756a90b07ba26 (commit)
via 534f44d53146457b3ca686c47efb9207543b88e1 (commit)
via bf6f1313132a3d99d645ea8b6661c23d68235278 (commit)
via 5c3661fda947c1bc5e597be081c355b51c595794 (commit)
via bfb988452cc66ddf93f69a199c50ea1c14e9ccb7 (commit)
via 9faa7e94b824e1dc5fd9ce1b6f16c1b3f13c601a (commit)
via fdebbe2044653c5c84172524ed6e036d38716d88 (commit)
via 74e49a5e545576f1436a510495e2e8a682b0db4d (commit)
via 39206e01eb5d27b61410a05f2ccf6051a305db02 (commit)
via be61486447ab447ac24892845af92489fe0b7148 (commit)
via 85cfbc035370d2a3715ea9de3e590ba83fae52d1 (commit)
via 6c4538905e65ceb203f59aaa9a61728e81c6bc0a (commit)
via 78e6494c2cf677d170a5c4ce0f46d152d478abc0 (commit)
via 5d3c0cc2aa60da804c9c981ffd5edcd2f02f1977 (commit)
via 6f4d5a7f53ee7f277b31bbff638bbccecf22f66f (commit)
via 8d15cd677df7e5bc6a1a01e482a33ecc2d271337 (commit)
via 75d9bf2dc57f89532a25ab9942b8bea468585199 (commit)
via f334556476cd9c33d3a9d8df9af0dfae798dc9ae (commit)
via 8ee422cffbfd3e2a16265fe6680a8dde2f5e58fe (commit)
via 21cbb6fe887a30f0777521ec10f0d0d9c2a7da7e (commit)
via 8c66e0a6c7987cda9df8c88e84b3d50d573c1dbb (commit)
via c3ddc18409b71db9e2fc863a7ff94a89b3c316ce (commit)
from ad2bffbf1926051ef333f9899344f6bddf2c03cf (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit cd5f92704e1e17bbc0c15d197f3bc236c7dc9bf2
Merge: ad2bffb 2494628
Author: Waldemar Brodkorb <wbx(a)openadk.org>
Date: Sun Mar 29 04:50:56 2015 -0500
merge uClibc git master
-----------------------------------------------------------------------
Summary of changes:
Makefile.in | 2 +
Makerules | 9 +-
extra/Configs/Config.in | 29 +-
extra/Configs/Config.in.arch | 2 +-
extra/Configs/defconfigs/arc/arcv2_defconfig | 2 +-
extra/Configs/defconfigs/arc/defconfig | 2 +-
extra/scripts/gen_bits_syscall_h.sh | 1 +
include/atomic.h | 235 +++++++-
include/complex.h | 2 +
include/dlfcn.h | 6 +-
include/fcntl.h | 2 +-
include/iconv.h | 4 +-
include/internal/utmp.h | 92 ++++
include/malloc.h | 4 +
include/math.h | 2 +
include/pty.h | 1 +
include/setjmp.h | 19 +-
include/spawn.h | 24 +-
include/stdio.h | 51 +-
include/stdlib.h | 8 +-
include/sys/cdefs.h | 24 +-
include/sys/sysmacros.h | 29 +-
include/sys/wait.h | 18 +-
include/ucontext.h | 6 +-
include/unistd.h | 75 +--
include/utmp.h | 2 +-
include/wchar.h | 8 +-
ldso/include/dl-syscall.h | 10 +-
ldso/ldso/arc/elfinterp.c | 4 +
ldso/ldso/sh/dl-syscalls.h | 2 +-
libc/inet/resolv.c | 6 +-
libc/misc/utmp/Makefile.in | 4 +-
libc/misc/utmp/utent.c | 312 +++++------
libc/misc/utmp/utxent.c | 109 ----
libc/misc/utmp/wtent.c | 59 --
libc/stdio/_fpmaxtostr.h | 22 +-
libc/stdio/_vfprintf.c | 15 -
libc/stdlib/Makefile.in | 4 +-
libc/stdlib/malloc-standard/free.c | 6 +-
libc/stdlib/malloc-standard/malloc.c | 5 +-
libc/stdlib/malloc-standard/memalign.c | 2 +-
libc/stdlib/malloc-standard/realloc.c | 2 +-
libc/string/strverscmp.c | 69 +--
libc/sysdeps/linux/arc/sigaction.c | 3 +-
libc/sysdeps/linux/arc/sys/procfs.h | 7 +-
libc/sysdeps/linux/arm/Makefile.arch | 4 +-
libc/sysdeps/linux/common/Makefile.in | 1 +
libc/sysdeps/linux/common/bits/kernel-features.h | 5 +
libc/sysdeps/linux/common/bits/mathcalls.h | 23 +
libc/sysdeps/linux/common/bits/utmp.h | 4 +-
libc/sysdeps/linux/common/bits/utmpx.h | 2 +-
libc/sysdeps/linux/common/getrandom.c | 14 +
libc/sysdeps/linux/common/getrusage.c | 1 +
.../aeabi_unwind_cpp_pr1.c => common/makedev.c} | 31 +-
libc/sysdeps/linux/common/stubs.c | 4 +
libc/sysdeps/linux/common/sys/random.h | 33 ++
libc/sysdeps/linux/mips/bits/mathdef.h | 7 +-
libc/sysdeps/linux/mips/bits/wordsize.h | 3 +
libc/sysdeps/linux/powerpc/bits/wordsize.h | 2 +-
libc/sysdeps/linux/sh/bits/atomic.h | 12 +-
libc/sysdeps/linux/sh/bits/syscalls.h | 2 +-
libc/sysdeps/linux/sparc/bits/wordsize.h | 1 +
libc/sysdeps/linux/x86_64/bits/wordsize.h | 9 +-
libcrypt/sha256.c | 18 +-
libcrypt/sha512.c | 18 +-
libm/Makefile.in | 41 +-
libm/float_wrappers.c | 62 ++-
libm/ldouble_wrappers.c | 73 ++-
libm/s_fdim.c | 17 +-
libm/s_fmax.c | 6 +-
libm/s_fmin.c | 6 +-
libm/s_nextafter.c | 4 +-
libpthread/linuxthreads.old/semaphore.h | 4 +-
.../linuxthreads.old/sysdeps/pthread/pthread.h | 36 +-
libpthread/linuxthreads/semaphore.h | 4 +-
libpthread/linuxthreads/sysdeps/pthread/pthread.h | 36 +-
libpthread/nptl/Makefile.in | 2 +-
libpthread/nptl/pthread_atfork.c | 12 +-
libpthread/nptl/semaphore.h | 4 +-
libpthread/nptl/sysdeps/pthread/pthread.h | 64 +--
.../nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h | 2 +-
librt/Makefile.in | 3 +
libutil/Makefile.in | 8 +
libutil/forkpty.c | 3 -
libutil/login.c | 6 +-
libutil/login_tty.c | 1 -
libutil/logout.c | 8 +-
libutil/logwtmp.c | 23 +-
libutil/openpty.c | 1 -
test/.gitignore | 3 +
test/README | 3 +
test/Test.mak | 5 +-
test/math/compile_test.c | 20 +-
test/math/libm-test.inc | 62 +--
test/misc/Makefile.in | 8 +
test/misc/tst-scandir.c | 2 +-
test/misc/tst-utmp.c | 15 +
test/misc/tst-utmpx.c | 2 +
test/silly/Makefile.in | 3 +
test/silly/hello.c | 2 +-
.../silly/tst-atomic-long.c | 16 +-
test/silly/tst-atomic.c | 573 ++++++++++++++++++++
test/stdlib/Makefile.in | 3 +
test/stdlib/testarc4random.c | 2 -
104 files changed, 1824 insertions(+), 815 deletions(-)
create mode 100644 include/internal/utmp.h
delete mode 100644 libc/misc/utmp/utxent.c
delete mode 100644 libc/misc/utmp/wtent.c
create mode 100644 libc/sysdeps/linux/common/getrandom.c
copy libc/sysdeps/linux/{arm/aeabi_unwind_cpp_pr1.c => common/makedev.c} (51%)
create mode 100644 libc/sysdeps/linux/common/sys/random.h
create mode 100644 test/misc/tst-utmpx.c
copy libc/sysdeps/linux/sparc/jmpbuf-offsets.h => test/silly/tst-atomic-long.c (75%)
create mode 100644 test/silly/tst-atomic.c
diff --git a/Makefile.in b/Makefile.in
index b4bc4b2..e764493 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -294,6 +294,7 @@ HEADERS_RM-$(UCLIBC_HAS_THREADS) += *thread*.h semaphore.h \
bits/initspin.h
HEADERS_RM-$(UCLIBC_HAS_THREADS_NATIVE) += atomic.h bits/atomic.h
HEADERS_RM-$(UCLIBC_HAS_OBSTACK) += obstack.h
+HEADERS_RM-$(UCLIBC_HAS_UTMP) += bits/utmp.h utmp.h
HEADERS_RM-$(UCLIBC_HAS_UTMPX) += bits/utmpx.h utmpx.h
HEADERS_RM-$(UCLIBC_HAS_WCHAR) += wchar.h wctype.h
HEADERS_RM-$(UCLIBC_HAS_WORDEXP) += wordexp.h
@@ -310,6 +311,7 @@ HEADERS_RM-$(UCLIBC_LINUX_SPECIFIC) += \
sys/perm.h \
sys/personality.h \
sys/prctl.h \
+ sys/random.h \
sys/reboot.h \
sys/sendfile.h \
bits/signalfd.h \
diff --git a/Makerules b/Makerules
index 1596988..fd6bb19 100644
--- a/Makerules
+++ b/Makerules
@@ -30,6 +30,8 @@ objs: all_objs
define add_IS_IN_lib
ifneq ($(strip $(2)),)
__add_IS_IN_lib := $(2)
+__add_IS_IN_lib += $(2:.o=.i) $(2:.os=.i) $(2:.oS=.i)
+__add_IS_IN_lib += $(2:.o=.s) $(2:.os=.s) $(2:.oS=.s)
$$(__add_IS_IN_lib): CFLAGS-for-library-members:=$(CFLAGS-$(1)) -DIN_LIB=$(word 1,$(subst /, ,$(1)))
endif
endef
@@ -326,9 +328,10 @@ cmd_hcompile.o = $(HOSTCC) $(filter-out $(PHONY),$<) $(DEPS-$(notdir $@)) -c -o
define create-lds
$(Q)$(RM) $@.lds
- $(Q)$(CC) -nostdlib -nostartfiles -shared -Wl,-z,combreloc \
- -Wl,-z,relro -Wl,--hash-style=gnu -Wl,-z,defs \
- -Wl,--verbose 2>&1 | LC_ALL=C \
+ $(Q)$(CC) $(LDFLAG-fuse-ld) $(CPU_LDFLAGS-y) \
+ -nostdlib -nostartfiles -shared -Wl,-z,combreloc \
+ -Wl,-z,relro $(CFLAG_-Wl--hash-style=gnu) -Wl,-z,defs \
+ -x c /dev/null -Wl,--verbose 2>&1 | LC_ALL=C \
$(SED) -e '/^=========/,/^=========/!d;/^=========/d' \
-e 's/^\([ ]*\)\. = .* + SIZEOF_HEADERS;/&\n\1$(SYMBOL_PREFIX)_begin = . - SIZEOF_HEADERS;/' > $@.lds
endef
diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in
index 18b3237..3c2add6 100644
--- a/extra/Configs/Config.in
+++ b/extra/Configs/Config.in
@@ -718,6 +718,25 @@ config COMPAT_ATEXIT
Enable this option if you want to update from 0.9.28 to git/0.9.29,
else you will be missing atexit() until you rebuild all apps.
+config UCLIBC_HAS_UTMPX
+ bool "utmpx based support for tracking login/logouts to/from the system"
+ help
+ Answer y to enable support for accessing user accounting database.
+ It can be used to track all login/logout to the system.
+
+config UCLIBC_HAS_UTMP
+ bool "utmp support (XPG2 compat, SVr4 compat)"
+ depends on UCLIBC_HAS_UTMPX
+ help
+ Answer y to enable legacy SVID support for accessing
+ user accounting database:
+ getutent(), getutid(), getutline(), pututline(),
+ setutent(), endutent(), utmpname() in utmp.h
+ It can be used to track all login/logout to the system.
+
+ If unsure, answer N and use corresponding POSIX functions
+ from utmpx.h
+
config UCLIBC_SUSV2_LEGACY
bool "Enable SuSv2 LEGACY functions"
help
@@ -1043,7 +1062,7 @@ config UCLIBC_LINUX_SPECIFIC
help
accept4(), bdflush(),
capget(), capset(), eventfd(), fallocate(),
- fstatfs(), inotify_*(), ioperm(), iopl(),
+ fstatfs(), getrandom(), inotify_*(), ioperm(), iopl(),
madvise(), modify_ldt(), pipe2(), personality(),
prctl()/arch_prctl(), pivot_root(), modify_ldt(),
ppoll(), readahead(), reboot(), remap_file_pages(),
@@ -2060,14 +2079,6 @@ config UCLIBC_HAS_GNU_GLOB
Most people will answer N.
-config UCLIBC_HAS_UTMPX
- bool "utmpx based support for tracking login/logouts to/from the system"
- help
- Answer y to enable support for accessing user accounting database.
- It can be used to track all login/logout to the system.
-
- If unsure, just answer N.
-
endmenu
diff --git a/extra/Configs/Config.in.arch b/extra/Configs/Config.in.arch
index 68e03bf..0dae84b 100644
--- a/extra/Configs/Config.in.arch
+++ b/extra/Configs/Config.in.arch
@@ -191,7 +191,7 @@ config UCLIBC_HAS_FENV
config UCLIBC_HAS_LONG_DOUBLE_MATH
bool "Enable long double support"
depends on DO_C99_MATH
- depends on TARGET_i386 || TARGET_m68k || TARGET_sparc || TARGET_x86_64 || TARGET_powerpc || TARGET_sh || TARGET_microblaze || TARGET_xtensa
+ depends on TARGET_aarch64 || TARGET_alpha || TARGET_i386 || TARGET_ia64 || TARGET_m68k || TARGET_powerpc || TARGET_s390 || TARGET_sparc || TARGET_tile || TARGET_x86_64
default y
help
If you want the uClibc math library to contain the full set of C99
diff --git a/extra/Configs/defconfigs/arc/arcv2_defconfig b/extra/Configs/defconfigs/arc/arcv2_defconfig
index d3a7dc7..7c4694e 100644
--- a/extra/Configs/defconfigs/arc/arcv2_defconfig
+++ b/extra/Configs/defconfigs/arc/arcv2_defconfig
@@ -7,7 +7,7 @@ KERNEL_HEADERS="%KERNEL_HEADERS%"
# LDSO_CACHE_SUPPORT is not set
LDSO_RUNPATH=y
# LDSO_SAFE_RUNPATH is not set
-LINUXTHREADS_OLD=y
+UCLIBC_HAS_THREADS_NATIVE=y
PTHREADS_DEBUG_SUPPORT=y
UCLIBC_HAS_OBSTACK=y
UCLIBC_SUSV2_LEGACY=y
diff --git a/extra/Configs/defconfigs/arc/defconfig b/extra/Configs/defconfigs/arc/defconfig
index 490bc22..eebb115 100644
--- a/extra/Configs/defconfigs/arc/defconfig
+++ b/extra/Configs/defconfigs/arc/defconfig
@@ -6,7 +6,7 @@ KERNEL_HEADERS="%KERNEL_HEADERS%"
# LDSO_CACHE_SUPPORT is not set
LDSO_RUNPATH=y
# LDSO_SAFE_RUNPATH is not set
-LINUXTHREADS_OLD=y
+UCLIBC_HAS_THREADS_NATIVE=y
PTHREADS_DEBUG_SUPPORT=y
UCLIBC_HAS_OBSTACK=y
UCLIBC_SUSV2_LEGACY=y
diff --git a/extra/scripts/gen_bits_syscall_h.sh b/extra/scripts/gen_bits_syscall_h.sh
index c44cd8f..bfd06b8 100755
--- a/extra/scripts/gen_bits_syscall_h.sh
+++ b/extra/scripts/gen_bits_syscall_h.sh
@@ -23,6 +23,7 @@ fi
case $CC in
*icc*) CC_SYSNUM_ARGS="-dM" ;;
+*clang*) CC_SYSNUM_ARGS="-dM" ;;
*) CC_SYSNUM_ARGS="-dN" ;;
esac
diff --git a/include/atomic.h b/include/atomic.h
index 307704c..3680d87 100644
--- a/include/atomic.h
+++ b/include/atomic.h
@@ -1,5 +1,5 @@
/* Internal macros for atomic operations for GNU C Library.
- Copyright (C) 2002-2006, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper(a)redhat.com>, 2002.
@@ -32,7 +32,7 @@
the multi-thread case. The interfaces have the prefix
"catomic_".
- - support functions like barriers. They also have the preifx
+ - support functions like barriers. They also have the prefix
"atomic_".
Architectures must provide a few lowlevel macros (the compare
@@ -198,8 +198,12 @@
/* Add VALUE to *MEM and return the old value of *MEM. */
-#ifndef atomic_exchange_and_add
-# define atomic_exchange_and_add(mem, value) \
+#ifndef atomic_exchange_and_add_acq
+# ifdef atomic_exchange_and_add
+# define atomic_exchange_and_add_acq(mem, value) \
+ atomic_exchange_and_add (mem, value)
+# else
+# define atomic_exchange_and_add_acq(mem, value) \
({ __typeof (*(mem)) __atg6_oldval; \
__typeof (mem) __atg6_memp = (mem); \
__typeof (*(mem)) __atg6_value = (value); \
@@ -213,8 +217,18 @@
__atg6_oldval), 0)); \
\
__atg6_oldval; })
+# endif
#endif
+#ifndef atomic_exchange_and_add_rel
+# define atomic_exchange_and_add_rel(mem, value) \
+ atomic_exchange_and_add_acq(mem, value)
+#endif
+
+#ifndef atomic_exchange_and_add
+# define atomic_exchange_and_add(mem, value) \
+ atomic_exchange_and_add_acq(mem, value)
+#endif
#ifndef catomic_exchange_and_add
# define catomic_exchange_and_add(mem, value) \
@@ -528,6 +542,219 @@
({ __typeof (x) __x; __asm__ ("" : "=r" (__x) : "0" (x)); __x; })
#endif
+/* This is equal to 1 iff the architecture supports 64b atomic operations. */
+#define __HAVE_64B_ATOMICS 0 /* TODO: not yet used - Add these to arch bits! */
+#ifndef __HAVE_64B_ATOMICS
+#error Unable to determine if 64-bit atomics are present.
+#endif
+
+/* The following functions are a subset of the atomic operations provided by
+ C11. Usually, a function named atomic_OP_MO(args) is equivalent to C11's
+ atomic_OP_explicit(args, memory_order_MO); exceptions noted below. */
+
+/* Each arch can request to use compiler built-ins for C11 atomics. If it
+ does, all atomics will be based on these. */
+#if 0 /* not yet used USE_ATOMIC_COMPILER_BUILTINS */
+
+/* We require 32b atomic operations; some archs also support 64b atomic
+ operations. */
+void __atomic_link_error (void);
+# if __HAVE_64B_ATOMICS == 1
+# define __atomic_check_size(mem) \
+ if ((sizeof (*mem) != 4) && (sizeof (*mem) != 8)) \
+ __atomic_link_error ();
+# else
+# define __atomic_check_size(mem) \
+ if (sizeof (*mem) != 4) \
+ __atomic_link_error ();
+# endif
+
+# define atomic_thread_fence_acquire() \
+ __atomic_thread_fence (__ATOMIC_ACQUIRE)
+# define atomic_thread_fence_release() \
+ __atomic_thread_fence (__ATOMIC_RELEASE)
+# define atomic_thread_fence_seq_cst() \
+ __atomic_thread_fence (__ATOMIC_SEQ_CST)
+
+# define atomic_load_relaxed(mem) \
+ ({ __atomic_check_size((mem)); __atomic_load_n ((mem), __ATOMIC_RELAXED); })
+# define atomic_load_acquire(mem) \
+ ({ __atomic_check_size((mem)); __atomic_load_n ((mem), __ATOMIC_ACQUIRE); })
+
+# define atomic_store_relaxed(mem, val) \
+ do { \
+ __atomic_check_size((mem)); \
+ __atomic_store_n ((mem), (val), __ATOMIC_RELAXED); \
+ } while (0)
+# define atomic_store_release(mem, val) \
+ do { \
+ __atomic_check_size((mem)); \
+ __atomic_store_n ((mem), (val), __ATOMIC_RELEASE); \
+ } while (0)
+
+/* On failure, this CAS has memory_order_relaxed semantics. */
+# define atomic_compare_exchange_weak_relaxed(mem, expected, desired) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_compare_exchange_n ((mem), (expected), (desired), 1, \
+ __ATOMIC_RELAXED, __ATOMIC_RELAXED); })
+# define atomic_compare_exchange_weak_acquire(mem, expected, desired) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_compare_exchange_n ((mem), (expected), (desired), 1, \
+ __ATOMIC_ACQUIRE, __ATOMIC_RELAXED); })
+# define atomic_compare_exchange_weak_release(mem, expected, desired) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_compare_exchange_n ((mem), (expected), (desired), 1, \
+ __ATOMIC_RELEASE, __ATOMIC_RELAXED); })
+
+# define atomic_exchange_acquire(mem, desired) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_exchange_n ((mem), (desired), __ATOMIC_ACQUIRE); })
+# define atomic_exchange_release(mem, desired) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_exchange_n ((mem), (desired), __ATOMIC_RELEASE); })
+
+# define atomic_fetch_add_relaxed(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_add ((mem), (operand), __ATOMIC_RELAXED); })
+# define atomic_fetch_add_acquire(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_add ((mem), (operand), __ATOMIC_ACQUIRE); })
+# define atomic_fetch_add_release(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_add ((mem), (operand), __ATOMIC_RELEASE); })
+# define atomic_fetch_add_acq_rel(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_add ((mem), (operand), __ATOMIC_ACQ_REL); })
+
+# define atomic_fetch_and_acquire(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_and ((mem), (operand), __ATOMIC_ACQUIRE); })
+
+# define atomic_fetch_or_relaxed(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_or ((mem), (operand), __ATOMIC_RELAXED); })
+# define atomic_fetch_or_acquire(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_or ((mem), (operand), __ATOMIC_ACQUIRE); })
+
+#else /* !USE_ATOMIC_COMPILER_BUILTINS */
+
+/* By default, we assume that read, write, and full barriers are equivalent
+ to acquire, release, and seq_cst barriers. Archs for which this does not
+ hold have to provide custom definitions of the fences. */
+# ifndef atomic_thread_fence_acquire
+# define atomic_thread_fence_acquire() atomic_read_barrier ()
+# endif
+# ifndef atomic_thread_fence_release
+# define atomic_thread_fence_release() atomic_write_barrier ()
+# endif
+# ifndef atomic_thread_fence_seq_cst
+# define atomic_thread_fence_seq_cst() atomic_full_barrier ()
+# endif
+
+# ifndef atomic_load_relaxed
+# define atomic_load_relaxed(mem) \
+ ({ __typeof (*(mem)) __atg100_val; \
+ __asm__ ("" : "=r" (__atg100_val) : "0" (*(mem))); \
+ __atg100_val; })
+# endif
+# ifndef atomic_load_acquire
+# define atomic_load_acquire(mem) \
+ ({ __typeof (*(mem)) __atg101_val = atomic_load_relaxed (mem); \
+ atomic_thread_fence_acquire (); \
+ __atg101_val; })
+# endif
+
+# ifndef atomic_store_relaxed
+/* XXX Use inline asm here? */
+# define atomic_store_relaxed(mem, val) do { *(mem) = (val); } while (0)
+# endif
+# ifndef atomic_store_release
+# define atomic_store_release(mem, val) \
+ do { \
+ atomic_thread_fence_release (); \
+ atomic_store_relaxed ((mem), (val)); \
+ } while (0)
+# endif
+
+/* On failure, this CAS has memory_order_relaxed semantics. */
+/* XXX This potentially has one branch more than necessary, but archs
+ currently do not define a CAS that returns both the previous value and
+ the success flag. */
+# ifndef atomic_compare_exchange_weak_acquire
+# define atomic_compare_exchange_weak_acquire(mem, expected, desired) \
+ ({ __typeof (*(expected)) __atg102_expected = *(expected); \
+ *(expected) = \
+ atomic_compare_and_exchange_val_acq ((mem), (desired), *(expected)); \
+ *(expected) == __atg102_expected; })
+# endif
+# ifndef atomic_compare_exchange_weak_relaxed
+/* XXX Fall back to CAS with acquire MO because archs do not define a weaker
+ CAS. */
+# define atomic_compare_exchange_weak_relaxed(mem, expected, desired) \
+ atomic_compare_exchange_weak_acquire ((mem), (expected), (desired))
+# endif
+# ifndef atomic_compare_exchange_weak_release
+# define atomic_compare_exchange_weak_release(mem, expected, desired) \
+ ({ __typeof (*(expected)) __atg103_expected = *(expected); \
+ *(expected) = \
+ atomic_compare_and_exchange_val_rel ((mem), (desired), *(expected)); \
+ *(expected) == __atg103_expected; })
+# endif
+
+# ifndef atomic_exchange_acquire
+# define atomic_exchange_acquire(mem, val) \
+ atomic_exchange_acq ((mem), (val))
+# endif
+# ifndef atomic_exchange_release
+# define atomic_exchange_release(mem, val) \
+ atomic_exchange_rel ((mem), (val))
+# endif
+
+# ifndef atomic_fetch_add_acquire
+# define atomic_fetch_add_acquire(mem, operand) \
+ atomic_exchange_and_add_acq ((mem), (operand))
+# endif
+# ifndef atomic_fetch_add_relaxed
+/* XXX Fall back to acquire MO because the MO semantics of
+ atomic_exchange_and_add are not documented; the generic version falls back
+ to atomic_exchange_and_add_acq if atomic_exchange_and_add is not defined,
+ and vice versa. */
+# define atomic_fetch_add_relaxed(mem, operand) \
+ atomic_fetch_add_acquire ((mem), (operand))
+# endif
+# ifndef atomic_fetch_add_release
+# define atomic_fetch_add_release(mem, operand) \
+ atomic_exchange_and_add_rel ((mem), (operand))
+# endif
+# ifndef atomic_fetch_add_acq_rel
+# define atomic_fetch_add_acq_rel(mem, operand) \
+ ({ atomic_thread_fence_release (); \
+ atomic_exchange_and_add_acq ((mem), (operand)); })
+# endif
+
+/* XXX The default for atomic_and_val has acquire semantics, but this is not
+ documented. */
+# ifndef atomic_fetch_and_acquire
+# define atomic_fetch_and_acquire(mem, operand) \
+ atomic_and_val ((mem), (operand))
+# endif
+
+/* XXX The default for atomic_or_val has acquire semantics, but this is not
+ documented. */
+# ifndef atomic_fetch_or_acquire
+# define atomic_fetch_or_acquire(mem, operand) \
+ atomic_or_val ((mem), (operand))
+# endif
+/* XXX Fall back to acquire MO because archs do not define a weaker
+ atomic_or_val. */
+# ifndef atomic_fetch_or_relaxed
+# define atomic_fetch_or_relaxed(mem, operand) \
+ atomic_fetch_or_acquire ((mem), (operand))
+# endif
+
+#endif /* !USE_ATOMIC_COMPILER_BUILTINS */
+
#ifndef atomic_delay
# define atomic_delay() do { /* nothing */ } while (0)
diff --git a/include/complex.h b/include/complex.h
index 91efc0d..ed7e502 100644
--- a/include/complex.h
+++ b/include/complex.h
@@ -79,6 +79,7 @@ __BEGIN_DECLS
#endif
#include <bits/cmathcalls.h>
#undef _Mdouble_
+#undef _Mfloat_
#undef __MATH_PRECNAME
/* And the long double versions. It is non-critical to define them
@@ -97,6 +98,7 @@ __BEGIN_DECLS
# include <bits/cmathcalls.h>
#endif
#undef _Mdouble_
+#undef _Mlong_double_
#undef __MATH_PRECNAME
#undef __MATHDECL_1
#undef __MATHDECL
diff --git a/include/dlfcn.h b/include/dlfcn.h
index 41d0d6f..241ec54 100644
--- a/include/dlfcn.h
+++ b/include/dlfcn.h
@@ -55,11 +55,11 @@ __BEGIN_DECLS
/* Open the shared object FILE and map it in; return a handle that can be
passed to `dlsym' to get symbol values from it. */
-extern void *dlopen (const char *__file, int __mode) __THROW;
+extern void *dlopen (const char *__file, int __mode) __THROWNL;
/* Unmap and close a shared object opened by `dlopen'.
The handle cannot be used again after calling `dlclose'. */
-extern int dlclose (void *__handle) __THROW __nonnull ((1));
+extern int dlclose (void *__handle) __THROWNL __nonnull ((1));
/* Find the run-time address in the shared object HANDLE refers to
of the symbol called NAME. */
@@ -68,7 +68,7 @@ extern void *dlsym (void *__restrict __handle,
#if 0 /*def __USE_GNU*/
/* Like `dlopen', but request object to be allocated in a new namespace. */
-extern void *dlmopen (Lmid_t __nsid, const char *__file, int __mode) __THROW;
+extern void *dlmopen (Lmid_t __nsid, const char *__file, int __mode) __THROWNL;
/* Find the run-time address in the shared object HANDLE refers to
of the symbol called NAME with VERSION. */
diff --git a/include/fcntl.h b/include/fcntl.h
index 04fc2c0..11000dd 100644
--- a/include/fcntl.h
+++ b/include/fcntl.h
@@ -221,7 +221,7 @@ extern int posix_fadvise64 (int __fd, __off64_t __offset, __off64_t __len,
/* Reserve storage for the data of the file associated with FD.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
# ifndef __USE_FILE_OFFSET64
extern int posix_fallocate (int __fd, __off_t __offset, __off_t __len);
diff --git a/include/iconv.h b/include/iconv.h
index d850de5..5ab4c6c 100644
--- a/include/iconv.h
+++ b/include/iconv.h
@@ -36,7 +36,7 @@ typedef void *iconv_t;
/* Allocate descriptor for code conversion from codeset FROMCODE to
codeset TOCODE.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern iconv_t iconv_open (const char *__tocode, const char *__fromcode);
@@ -50,7 +50,7 @@ extern size_t iconv (iconv_t __cd, char **__restrict __inbuf,
/* Free resources allocated for descriptor CD for code conversion.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int iconv_close (iconv_t __cd);
diff --git a/include/internal/utmp.h b/include/internal/utmp.h
new file mode 100644
index 0000000..49f96b4
--- /dev/null
+++ b/include/internal/utmp.h
@@ -0,0 +1,92 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * internal helper for utmp and utmpx handling
+ *
+ * Copyright (C) 2015 by Bernhard Reutner-Fischer
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ */
+#ifndef __INTERNAL_UTMP_H
+#define __INTERNAL_UTMP_H
+
+#include <utmpx.h>
+#include <utmp.h>
+
+/* Note: _PATH_UTMPX == _PATH_UTMP */
+
+#if (defined __UCLIBC_HAS_UTMPX__ && defined __UCLIBC_HAS_UTMP__) \
+ || !defined __UCLIBC_HAS_UTMP__
+/* implement the X and alias the non-X */
+# define __set_unlocked __setutxent_unlocked
+# define set setutxent
+# define __get_unlocked __getutxent_unlocked
+# define get getutxent
+# define end endutxent
+# define __getid_unlocked __getutxid_unlocked
+# define getid getutxid
+# define getline getutxline
+# define putline pututxline
+# define name utmpxname
+# define updw updwtmpx
+# define UT utmpx
+# ifndef __DEFAULT_PATH_UTMP
+# define __DEFAULT_PATH_UTMP _PATH_UTMPX
+# endif
+# if defined __UCLIBC_HAS_UTMP__
+# define other(n,a) strong_alias_untyped(n,a)
+# else
+# define other(n,a) /* nothing */
+# endif
+#elif defined __UCLIBC_HAS_UTMP__
+# define __set_unlocked __setutent_unlocked
+# define set setutent
+# define __get_unlocked __getutent_unlocked
+# define get getutent
+# define end endutent
+# define __getid_unlocked __getutid_unlocked
+# define getid getutid
+# define getline getutline
+# define putline pututline
+# define name utmpname
+# define updw updwtmp
+# define UT utmp
+# ifndef __DEFAULT_PATH_UTMP
+# define __DEFAULT_PATH_UTMP _PATH_UTMP
+# endif
+# define other(n,a) /* nothing */
+#else
+#error You are supposed to either have UTMP or UTMPX or both here
+#endif
+
+/* not used in libc_hidden_proto(setutxent) */
+/* not used in libc_hidden_proto(endutxent) */
+/* not used in libc_hidden_proto(getutxent) */
+/* not used in libc_hidden_proto(getutxid) */
+/* not used in libc_hidden_proto(getutxline) */
+/* not used in libc_hidden_proto(pututxline) */
+/* not used in libc_hidden_proto(utmpxname) */
+/* not used in libc_hidden_proto(updwtmpx) */
+
+/* not used in libc_hidden_proto(setutent) */
+/* not used in libc_hidden_proto(endutent) */
+/* not used in libc_hidden_proto(getutent) */
+/* not used in libc_hidden_proto(getutid) */
+/* not used in libc_hidden_proto(getutline) */
+/* not used in libc_hidden_proto(pututline) */
+/* not used in libc_hidden_proto(utmpname) */
+/* not used in libc_hidden_proto(updwtmp) */
+
+#ifdef IS_IN_libutil
+# if (defined __UCLIBC_HAS_UTMPX__ && defined __UCLIBC_HAS_UTMP__) \
+ || !defined __UCLIBC_HAS_UTMP__
+ /* monkey-patch to use the POSIX interface */
+# define setutent setutxent
+# define getutline getutxline
+# define pututline pututxline
+# define endutent endutxent
+# define updwtmp updwtmpx
+# endif
+#endif /* IS_IN_libutil */
+
+#endif /* __INTERNAL_UTMP_H */
+
diff --git a/include/malloc.h b/include/malloc.h
index 3209fb0..a289c93 100644
--- a/include/malloc.h
+++ b/include/malloc.h
@@ -132,6 +132,7 @@ extern __malloc_ptr_t valloc __MALLOC_P ((size_t __size)) __attribute_malloc__;
#ifdef __MALLOC_STANDARD__
+# ifdef __USE_SVID
/* SVID2/XPG mallinfo structure */
struct mallinfo {
int arena; /* total space allocated from system */
@@ -149,10 +150,13 @@ struct mallinfo {
/* Returns a copy of the updated current mallinfo. */
extern struct mallinfo mallinfo __MALLOC_P ((void));
libc_hidden_proto(mallinfo)
+# endif /* __USE_SVID */
+# ifdef __USE_GNU
/* Release all but __pad bytes of freed top-most memory back to the
system. Return 1 if successful, else 0. */
extern int malloc_trim(size_t pad);
+# endif /* __USE_GNU */
#include <stdio.h>
/* Prints brief summary statistics to the specified file.
diff --git a/include/math.h b/include/math.h
index 40dd90e..c79af3f 100644
--- a/include/math.h
+++ b/include/math.h
@@ -131,6 +131,7 @@ __BEGIN_DECLS
# undef _Mdouble_
# undef _Mdouble_BEGIN_NAMESPACE
# undef _Mdouble_END_NAMESPACE
+# undef _Mfloat_
# undef __MATH_PRECNAME
# undef __MATH_maybe_libm_hidden_proto
@@ -178,6 +179,7 @@ extern long double __REDIRECT_NTH (nexttowardl, (long double __x, long double __
# undef _Mdouble_
# undef _Mdouble_BEGIN_NAMESPACE
# undef _Mdouble_END_NAMESPACE
+# undef _Mlong_double_
# undef __MATH_PRECNAME
# undef __MATH_maybe_libm_hidden_proto
diff --git a/include/pty.h b/include/pty.h
index 26c3011..f23a260 100644
--- a/include/pty.h
+++ b/include/pty.h
@@ -32,6 +32,7 @@ __BEGIN_DECLS
ends in AMASTER and ASLAVE. */
extern int openpty (int *__amaster, int *__aslave, char *__name,
struct termios *__termp, struct winsize *__winp) __THROW;
+libutil_hidden_proto(openpty)
/* Create child process and establish the slave pseudo terminal as the
child's controlling terminal. */
diff --git a/include/setjmp.h b/include/setjmp.h
index c950137..71c1d35 100644
--- a/include/setjmp.h
+++ b/include/setjmp.h
@@ -49,19 +49,20 @@ typedef struct __jmp_buf_tag jmp_buf[1];
/* Store the calling environment in ENV, also saving the signal mask.
Return 0. */
-extern int setjmp (jmp_buf __env) __THROW;
+extern int setjmp (jmp_buf __env) __THROWNL;
__END_NAMESPACE_STD
/* Store the calling environment in ENV, also saving the
signal mask if SAVEMASK is nonzero. Return 0.
This is the internal name for `sigsetjmp'. */
-extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) __THROW;
+extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask)
+ __THROWNL;
#ifndef __FAVOR_BSD
/* Store the calling environment in ENV, not saving the signal mask.
Return 0. */
-extern int _setjmp (struct __jmp_buf_tag __env[1]) __THROW;
+extern int _setjmp (struct __jmp_buf_tag __env[1]) __THROWNL;
/* Do not save the signal mask. This is equivalent to the `_setjmp'
BSD function. */
@@ -79,7 +80,7 @@ __BEGIN_NAMESPACE_STD
/* Jump to the environment saved in ENV, making the
`setjmp' call there return VAL, or 1 if VAL is 0. */
extern void longjmp (struct __jmp_buf_tag __env[1], int __val)
- __THROW __attribute__ ((__noreturn__));
+ __THROWNL __attribute__ ((__noreturn__));
__END_NAMESPACE_STD
@@ -88,7 +89,7 @@ __END_NAMESPACE_STD
the signal mask. But it is how ENV was saved that determines whether
`longjmp' restores the mask; `_longjmp' is just an alias. */
extern void _longjmp (struct __jmp_buf_tag __env[1], int __val)
- __THROW __attribute__ ((__noreturn__));
+ __THROWNL __attribute__ ((__noreturn__));
#endif
@@ -107,16 +108,16 @@ typedef struct __jmp_buf_tag sigjmp_buf[1];
Restore the signal mask if that sigsetjmp call saved it.
This is just an alias `longjmp'. */
extern void siglongjmp (sigjmp_buf __env, int __val)
- __THROW __attribute__ ((__noreturn__));
+ __THROWNL __attribute__ ((__noreturn__));
#endif /* Use POSIX. */
__END_DECLS
#ifdef _LIBC
-extern void __longjmp(__jmp_buf __env, int __val) attribute_noreturn;
+extern void __longjmp(__jmp_buf __env, int __val) __THROWNL attribute_noreturn;
libc_hidden_proto(__longjmp)
-extern __typeof(longjmp) __libc_longjmp attribute_noreturn;
-extern __typeof(siglongjmp) __libc_siglongjmp attribute_noreturn;
+extern __typeof(longjmp) __libc_longjmp __THROWNL attribute_noreturn;
+extern __typeof(siglongjmp) __libc_siglongjmp __THROWNL attribute_noreturn;
extern void _longjmp_unwind(jmp_buf __env, int __val);
libc_hidden_proto(_longjmp_unwind)
extern int __sigjmp_save(sigjmp_buf __env, int __savemask) attribute_hidden;
diff --git a/include/spawn.h b/include/spawn.h
index 95fff35..3de375b 100644
--- a/include/spawn.h
+++ b/include/spawn.h
@@ -66,15 +66,6 @@ typedef struct
# define POSIX_SPAWN_USEVFORK 0x40
#endif
-
-#define __POSIX_SPAWN_MASK (POSIX_SPAWN_RESETIDS \
- | POSIX_SPAWN_SETPGROUP \
- | POSIX_SPAWN_SETSIGDEF \
- | POSIX_SPAWN_SETSIGMASK \
- | POSIX_SPAWN_SETSCHEDPARAM \
- | POSIX_SPAWN_SETSCHEDULER \
- | POSIX_SPAWN_USEVFORK)
-
__BEGIN_DECLS
/* Spawn a new process executing PATH with the attributes describes in *ATTRP.
@@ -170,12 +161,27 @@ static inline
int posix_spawnattr_setflags (posix_spawnattr_t *_attr,
short int __flags)
{
+#ifdef POSIX_SPAWN_USEVFORK
+# define __POSIX_SPAWN_USEVFORK POSIX_SPAWN_USEVFORK
+#else
+# define __POSIX_SPAWN_USEVFORK 0
+#endif
+#define __POSIX_SPAWN_MASK (POSIX_SPAWN_RESETIDS \
+ | POSIX_SPAWN_SETPGROUP \
+ | POSIX_SPAWN_SETSIGDEF \
+ | POSIX_SPAWN_SETSIGMASK \
+ | POSIX_SPAWN_SETSCHEDPARAM \
+ | POSIX_SPAWN_SETSCHEDULER \
+ | __POSIX_SPAWN_USEVFORK)
+
/* Check no invalid bits are set. */
if (__flags & ~__POSIX_SPAWN_MASK)
return EINVAL;
_attr->__flags = __flags;
return 0;
+#undef __POSIX_SPAWN_USEVFORK
+#undef __POSIX_SPAWN_MASK
}
/* Get process group ID from the attribute structure. */
diff --git a/include/stdio.h b/include/stdio.h
index 75c1464..9aae5ab 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -157,7 +157,7 @@ libc_hidden_proto(renameat)
__BEGIN_NAMESPACE_STD
/* Create a temporary file and open it read/write.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
#ifndef __USE_FILE_OFFSET64
extern FILE *tmpfile (void) __wur;
@@ -345,8 +345,8 @@ extern int printf (const char *__restrict __format, ...);
libc_hidden_proto(printf)
/* Write formatted output to S. */
extern int sprintf (char *__restrict __s,
- const char *__restrict __format, ...)
- __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
+ const char *__restrict __format, ...) __THROWNL
+ __attribute__ ((__format__ (__printf__, 2, 3)));
libc_hidden_proto(sprintf)
/* Write formatted output to S from argument list ARG.
@@ -363,8 +363,8 @@ libc_hidden_proto(vfprintf)
extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
/* Write formatted output to S from argument list ARG. */
extern int vsprintf (char *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg)
- __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
+ __gnuc_va_list __arg) __THROWNL
+ __attribute__ ((__format__ (__printf__, 2, 0)));
__END_NAMESPACE_STD
#if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
@@ -372,12 +372,12 @@ __BEGIN_NAMESPACE_C99
/* Maximum chars of output to write in MAXLEN. */
extern int snprintf (char *__restrict __s, size_t __maxlen,
const char *__restrict __format, ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
+ __THROWNL __attribute__ ((__format__ (__printf__, 3, 4)));
libc_hidden_proto(snprintf)
extern int vsnprintf (char *__restrict __s, size_t __maxlen,
const char *__restrict __format, __gnuc_va_list __arg)
- __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
+ __THROWNL __attribute__ ((__format__ (__printf__, 3, 0)));
libc_hidden_proto(vsnprintf)
__END_NAMESPACE_C99
#endif
@@ -387,26 +387,24 @@ __END_NAMESPACE_C99
Store the address of the string in *PTR. */
extern int vasprintf (char **__restrict __ptr, const char *__restrict __f,
__gnuc_va_list __arg)
- __THROW __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
+ __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
libc_hidden_proto(vasprintf)
#if 0 /* uClibc: disabled */
extern int __asprintf (char **__restrict __ptr,
const char *__restrict __fmt, ...)
- __THROW __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
+ __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
#endif
extern int asprintf (char **__restrict __ptr,
const char *__restrict __fmt, ...)
- __THROW __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
+ __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
libc_hidden_proto(asprintf)
#endif
#ifdef __USE_XOPEN2K8
/* Write formatted output to a file descriptor.
- These functions are not part of POSIX and therefore no official
- cancellation point. But due to similarity with an POSIX interface
- or due to the implementation they are cancellation points and
- therefore not marked with __THROW. */
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
extern int vdprintf (int __fd, const char *__restrict __fmt,
__gnuc_va_list __arg)
__attribute__ ((__format__ (__printf__, 2, 0)));
@@ -570,12 +568,21 @@ extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
__wur;
libc_hidden_proto(fgets)
+#if !defined __USE_ISOC11 \
+ || (defined __cplusplus && __cplusplus <= 201103L)
/* Get a newline-terminated string from stdin, removing the newline.
DO NOT USE THIS FUNCTION!! There is no limit on how much it will read.
+ The function has been officially removed in ISO C11. This opportunity
+ is used to also remove it from the GNU feature list. It is now only
+ available when explicitly using an old ISO C, Unix, or POSIX standard.
+ GCC defines _GNU_SOURCE when building C++ code and the function is still
+ in C++11, so it is also available for C++.
+
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern char *gets (char *__s) __wur;
+extern char *gets (char *__s) __wur __attribute_deprecated__;
+#endif
__END_NAMESPACE_STD
#ifdef __USE_GNU
@@ -628,21 +635,21 @@ libc_hidden_proto(getline)
__BEGIN_NAMESPACE_STD
/* Write a string to STREAM.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int fputs (const char *__restrict __s, FILE *__restrict __stream);
libc_hidden_proto(fputs)
/* Write a string, followed by a newline, to stdout.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int puts (const char *__s);
/* Push a character back onto the input buffer of STREAM.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int ungetc (int __c, FILE *__stream);
libc_hidden_proto(ungetc)
@@ -650,14 +657,14 @@ libc_hidden_proto(ungetc)
/* Read chunks of generic data from STREAM.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern size_t fread (void *__restrict __ptr, size_t __size,
size_t __n, FILE *__restrict __stream) __wur;
libc_hidden_proto(fread)
/* Write chunks of generic data to STREAM.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern size_t fwrite (const void *__restrict __ptr, size_t __size,
size_t __n, FILE *__restrict __s) __wur;
@@ -860,11 +867,11 @@ struct obstack; /* See <obstack.h>. */
/* Write formatted output to an obstack. */
extern int obstack_printf (struct obstack *__restrict __obstack,
const char *__restrict __format, ...)
- __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
+ __THROWNL __attribute__ ((__format__ (__printf__, 2, 3)));
extern int obstack_vprintf (struct obstack *__restrict __obstack,
const char *__restrict __format,
__gnuc_va_list __args)
- __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
+ __THROWNL __attribute__ ((__format__ (__printf__, 2, 0)));
libc_hidden_proto(obstack_vprintf)
#endif /* USE_GNU && UCLIBC_HAS_OBSTACK. */
diff --git a/include/stdlib.h b/include/stdlib.h
index b2d7020..809256d 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -38,7 +38,7 @@ __BEGIN_DECLS
#ifndef __need_malloc_and_calloc
#define _STDLIB_H 1
-#if defined __USE_XOPEN && !defined _SYS_WAIT_H
+#if (defined __USE_XOPEN || defined __USE_XOPEN2K8) && !defined _SYS_WAIT_H
/* XPG requires a few symbols from <sys/wait.h> being defined. */
# include <bits/waitflags.h>
# include <bits/waitstatus.h>
@@ -486,11 +486,11 @@ extern int lcong48_r (unsigned short int __param[7],
__BEGIN_NAMESPACE_STD
/* Allocate SIZE bytes of memory. */
extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur;
-/* We want the malloc symbols overridable at runtime
- * libc_hidden_proto(malloc) */
+/* We want the malloc symbol overridable at runtime, do not hide it! */
/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */
extern void *calloc (size_t __nmemb, size_t __size)
__THROW __attribute_malloc__ __wur;
+/* We want the calloc symbol overridable at runtime, do not hide it! */
__END_NAMESPACE_STD
#endif
@@ -503,8 +503,10 @@ __BEGIN_NAMESPACE_STD
between objects pointed by the old and new pointers. */
extern void *realloc (void *__ptr, size_t __size)
__THROW __wur;
+/* We want the realloc symbol overridable at runtime, do not hide it! */
/* Free a block allocated by `malloc', `realloc' or `calloc'. */
extern void free (void *__ptr) __THROW;
+/* We want the free symbol overridable at runtime, do not hide it! */
__END_NAMESPACE_STD
#if 0 /*def __USE_MISC*/
diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h
index 6f81b6a..4da981f 100644
--- a/include/sys/cdefs.h
+++ b/include/sys/cdefs.h
@@ -37,20 +37,33 @@
#ifdef __GNUC__
+/* All functions, except those with callbacks or those that
+ synchronize memory, are leaf functions. */
+# if __GNUC_PREREQ (4, 6) && !defined _LIBC
+# define __LEAF , __leaf__
+# define __LEAF_ATTR __attribute__ ((__leaf__))
+# else
+# define __LEAF
+# define __LEAF_ATTR
+# endif
+
/* GCC can always grok prototypes. For C++ programs we add throw()
to help it optimize the function calls. But this works only with
gcc 2.8.x and egcs. For gcc 3.2 and up we even mark C functions
as non-throwing using a function attribute since programs can use
the -fexceptions options for C code as well. */
# if !defined __cplusplus && __GNUC_PREREQ (3, 3)
-# define __THROW __attribute__ ((__nothrow__))
-# define __NTH(fct) __attribute__ ((__nothrow__)) fct
+# define __THROW __attribute__ ((__nothrow__ __LEAF))
+# define __THROWNL __attribute__ ((__nothrow__))
+# define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct
# else
# if defined __cplusplus && __GNUC_PREREQ (2,8)
# define __THROW throw ()
-# define __NTH(fct) fct throw ()
+# define __THROWNL throw ()
+# define __NTH(fct) __LEAF_ATTR fct throw ()
# else
# define __THROW
+# define __THROWNL
# define __NTH(fct) fct
# endif
# endif
@@ -60,6 +73,7 @@
# define __inline /* No inline functions. */
# define __THROW
+# define __THROWNL
# define __NTH(fct) fct
#endif /* GCC. */
@@ -165,9 +179,13 @@
# ifdef __cplusplus
# define __REDIRECT_NTH(name, proto, alias) \
name proto __THROW __asm__ (__ASMNAME (#alias))
+# define __REDIRECT_NTHNL(name, proto, alias) \
+ name proto __THROWNL __asm__ (__ASMNAME (#alias))
# else
# define __REDIRECT_NTH(name, proto, alias) \
name proto __asm__ (__ASMNAME (#alias)) __THROW
+# define __REDIRECT_NTHNL(name, proto, alias) \
+ name proto __asm__ (__ASMNAME (#alias)) __THROWNL
# endif
# define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname)
# define __ASMNAME2(prefix, cname) __STRING (prefix) cname
diff --git a/include/sys/sysmacros.h b/include/sys/sysmacros.h
index 7a5635e..3addb75 100644
--- a/include/sys/sysmacros.h
+++ b/include/sys/sysmacros.h
@@ -21,35 +21,39 @@
#include <features.h>
+__BEGIN_DECLS
+
/* If the compiler does not know long long it is out of luck. We are
not going to hack weird hacks to support the dev_t representation
they need. */
-#if 1 /*def __GLIBC_HAVE_LONG_LONG uClibc note: always enable */
+
__extension__
-static __inline unsigned int gnu_dev_major (unsigned long long int __dev)
- __THROW;
+extern unsigned int gnu_dev_major (unsigned long long int __dev)
+ __THROW __attribute__ ((__const__));
+libc_hidden_proto(gnu_dev_major)
__extension__
-static __inline unsigned int gnu_dev_minor (unsigned long long int __dev)
- __THROW;
+extern unsigned int gnu_dev_minor (unsigned long long int __dev)
+ __THROW __attribute__ ((__const__));
+libc_hidden_proto(gnu_dev_minor)
__extension__
-static __inline unsigned long long int gnu_dev_makedev (unsigned int __major,
+extern unsigned long long int gnu_dev_makedev (unsigned int __major,
unsigned int __minor)
- __THROW;
+ __THROW __attribute__ ((__const__));
-# if defined __GNUC__ && __GNUC__ >= 2
-__extension__ static __inline unsigned int
+# ifdef __USE_EXTERN_INLINES
+__extension__ __extern_inline __attribute__ ((__const__)) unsigned int
__NTH (gnu_dev_major (unsigned long long int __dev))
{
return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff);
}
-__extension__ static __inline unsigned int
+__extension__ __extern_inline __attribute__ ((__const__)) unsigned int
__NTH (gnu_dev_minor (unsigned long long int __dev))
{
return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff);
}
-__extension__ static __inline unsigned long long int
+__extension__ __extern_inline __attribute__ ((__const__)) unsigned long long int
__NTH (gnu_dev_makedev (unsigned int __major, unsigned int __minor))
{
return ((__minor & 0xff) | ((__major & 0xfff) << 8)
@@ -57,12 +61,11 @@ __NTH (gnu_dev_makedev (unsigned int __major, unsigned int __minor))
| (((unsigned long long int) (__major & ~0xfff)) << 32));
}
# endif
-
+__END_DECLS
/* Access the functions with their traditional names. */
# define major(dev) gnu_dev_major (dev)
# define minor(dev) gnu_dev_minor (dev)
# define makedev(maj, min) gnu_dev_makedev (maj, min)
-#endif
#endif /* sys/sysmacros.h */
diff --git a/include/sys/wait.h b/include/sys/wait.h
index b3c2b97..f7a420b 100644
--- a/include/sys/wait.h
+++ b/include/sys/wait.h
@@ -28,10 +28,9 @@
__BEGIN_DECLS
#include <signal.h>
-#include <sys/resource.h>
/* These macros could also be defined in <stdlib.h>. */
-#if !defined _STDLIB_H || !defined __USE_XOPEN
+#if !defined _STDLIB_H || (!defined __USE_XOPEN && !defined __USE_XOPEN2K8)
/* This will define the `W*' macros for the flag
bits to `waitpid', `wait3', and `wait4'. */
# include <bits/waitflags.h>
@@ -97,7 +96,7 @@ typedef union
#endif
/* The following values are used by the `waitid' function. */
-#if defined __USE_SVID || defined __USE_XOPEN
+#if defined __USE_SVID || defined __USE_XOPEN || defined __USE_XOPEN2K8
typedef enum
{
P_ALL, /* Wait for any child. */
@@ -141,9 +140,15 @@ extern __typeof(waitpid) __waitpid_nocancel attribute_hidden;
libc_hidden_proto(waitpid)
#endif
-#if defined __USE_SVID || defined __USE_XOPEN
+#if defined __USE_SVID || defined __USE_XOPEN || defined __USE_XOPEN2K8
+# ifndef __id_t_defined
+# include <bits/types.h>
+ typedef __id_t id_t;
+# define __id_t_defined
+# endif
# define __need_siginfo_t
# include <bits/siginfo.h>
+
/* Wait for a childing matching IDTYPE and ID to change the status and
place appropriate information in *INFOP.
If IDTYPE is P_PID, match any process whose process ID is ID.
@@ -160,19 +165,20 @@ extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop,
#endif
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+struct rusage;
/* Wait for a child to exit. When one does, put its status in *STAT_LOC and
return its process ID. For errors return (pid_t) -1. If USAGE is not
nil, store information about the child's resource usage there. If the
WUNTRACED bit is set in OPTIONS, return status for stopped children;
otherwise don't. */
extern __pid_t wait3 (__WAIT_STATUS __stat_loc, int __options,
- struct rusage * __usage) __THROW;
+ struct rusage * __usage) __THROWNL;
#endif
#ifdef __USE_BSD
/* PID is like waitpid. Other args are like wait3. */
extern __pid_t wait4 (__pid_t __pid, __WAIT_STATUS __stat_loc, int __options,
- struct rusage *__usage) __THROW;
+ struct rusage *__usage) __THROWNL;
#endif /* Use BSD. */
#ifdef _LIBC
diff --git a/include/ucontext.h b/include/ucontext.h
index f11db77..4ce114e 100644
--- a/include/ucontext.h
+++ b/include/ucontext.h
@@ -31,15 +31,15 @@
__BEGIN_DECLS
/* Get user context and store it in variable pointed to by UCP. */
-extern int getcontext (ucontext_t *__ucp) __THROW;
+extern int getcontext (ucontext_t *__ucp) __THROWNL;
/* Set user context from information of variable pointed to by UCP. */
-extern int setcontext (const ucontext_t *__ucp) __THROW;
+extern int setcontext (const ucontext_t *__ucp) __THROWNL;
/* Save current context in context variable pointed to by OUCP and set
context from variable pointed to by UCP. */
extern int swapcontext (ucontext_t *__restrict __oucp,
- const ucontext_t *__restrict __ucp) __THROW;
+ const ucontext_t *__restrict __ucp) __THROWNL;
/* Manipulate user context UCP to continue with calling functions FUNC
and the ARGC-1 parameters following ARGC when the context is used
diff --git a/include/unistd.h b/include/unistd.h
index 967e058..3793d2d 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -206,7 +206,7 @@ __BEGIN_DECLS
#include <bits/uClibc_posix_opt.h>
/* Get the environment definitions from Unix98. */
-#ifdef __USE_UNIX98
+#if defined __USE_UNIX98 || defined __USE_XOPEN2K
# include <bits/environments.h>
#endif
@@ -266,7 +266,7 @@ typedef __pid_t pid_t;
# endif
#endif /* X/Open */
-#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
# ifndef __intptr_t_defined
typedef __intptr_t intptr_t;
# define __intptr_t_defined
@@ -387,7 +387,7 @@ extern __typeof(write) __write_nocancel attribute_hidden;
libc_hidden_proto(write)
#endif
-#ifdef __USE_UNIX98
+#if defined __USE_UNIX98 || defined __USE_XOPEN2K8
# ifndef __USE_FILE_OFFSET64
/* Read NBYTES into BUF from FD at the given position OFFSET without
changing the file pointer. Return the number read, -1 for errors
@@ -469,8 +469,9 @@ libc_hidden_proto(alarm)
extern unsigned int sleep (unsigned int __seconds);
libc_hidden_proto(sleep)
-#if (defined __USE_BSD || defined __USE_XOPEN_EXTENDED) \
- && defined __UCLIBC_SUSV3_LEGACY__
+#if (defined __USE_BSD \
+ || (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) \
+ ) && defined __UCLIBC_SUSV3_LEGACY__
/* Set an alarm to go off (generating a SIGALRM signal) in VALUE
microseconds. If INTERVAL is nonzero, when the alarm goes off, the
timer is reset to go off every INTERVAL microseconds thereafter.
@@ -500,7 +501,7 @@ extern int chown (const char *__file, __uid_t __owner, __gid_t __group)
__THROW __nonnull ((1)) __wur;
libc_hidden_proto(chown)
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
/* Change the owner and group of the file that FD is open on. */
extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __THROW __wur;
@@ -525,7 +526,7 @@ libc_hidden_proto(fchownat)
extern int chdir (const char *__path) __THROW __nonnull ((1)) __wur;
libc_hidden_proto(chdir)
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
/* Change the process's working directory to the one FD is open on. */
extern int fchdir (int __fd) __THROW __wur;
libc_hidden_proto(fchdir)
@@ -548,7 +549,7 @@ libc_hidden_proto(getcwd)
extern char *get_current_dir_name (void) __THROW;
#endif
-#if 0 /*defined __USE_BSD || defined __USE_XOPEN_EXTENDED*/
+#if 0 /*defined __USE_BSD || (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8)*/
/* Put the absolute pathname of the current working directory in BUF.
If successful, return BUF. If not, put an error message in
BUF and return NULL. BUF should be at least PATH_MAX bytes long. */
@@ -581,52 +582,53 @@ extern char **environ;
/* Replace the current process, executing PATH with arguments ARGV and
environment ENVP. ARGV and ENVP are terminated by NULL pointers. */
extern int execve (const char *__path, char *const __argv[],
- char *const __envp[]) __THROW __nonnull ((1));
+ char *const __envp[]) __THROW __nonnull ((1, 2));
libc_hidden_proto(execve)
#if 0 /*def __USE_XOPEN2K8*/
/* Execute the file FD refers to, overlaying the running program image.
ARGV and ENVP are passed to the new program, as for `execve'. */
extern int fexecve (int __fd, char *const __argv[], char *const __envp[])
- __THROW;
+ __THROW __nonnull ((2));
#endif
/* Execute PATH with arguments ARGV and environment from `environ'. */
extern int execv (const char *__path, char *const __argv[])
- __THROW __nonnull ((1));
+ __THROW __nonnull ((1, 2));
libc_hidden_proto(execv)
/* Execute PATH with all arguments after PATH until a NULL pointer,
and the argument after that for environment. */
extern int execle (const char *__path, const char *__arg, ...)
- __THROW __nonnull ((1));
+ __THROW __nonnull ((1, 2));
libc_hidden_proto(execle)
/* Execute PATH with all arguments after PATH until
a NULL pointer and environment from `environ'. */
extern int execl (const char *__path, const char *__arg, ...)
- __THROW __nonnull ((1));
+ __THROW __nonnull ((1, 2));
libc_hidden_proto(execl)
/* Execute FILE, searching in the `PATH' environment variable if it contains
no slashes, with arguments ARGV and environment from `environ'. */
extern int execvp (const char *__file, char *const __argv[])
- __THROW __nonnull ((1));
+ __THROW __nonnull ((1, 2));
libc_hidden_proto(execvp)
/* Execute FILE, searching in the `PATH' environment variable if
it contains no slashes, with all arguments after FILE until a
NULL pointer and environment from `environ'. */
extern int execlp (const char *__file, const char *__arg, ...)
- __THROW __nonnull ((1));
+ __THROW __nonnull ((1, 2));
libc_hidden_proto(execlp)
#ifdef __USE_GNU
/* Execute FILE, searching in the `PATH' environment variable if it contains
no slashes, with arguments ARGV and environment from a pointer */
-extern int execvpe (__const char *__file, char *__const __argv[], char *__const __envp[])
- __THROW __nonnull ((1));
+extern int execvpe (const char *__file, char *const __argv[],
+ char *const __envp[])
+ __THROW __nonnull ((1, 2));
libc_hidden_proto(execvpe)
#endif
@@ -685,7 +687,7 @@ extern __pid_t __REDIRECT_NTH (getpgrp, (__pid_t __pid), __getpgid);
/* Get the process group ID of process PID. */
extern __pid_t __getpgid (__pid_t __pid) __THROW;
-#ifdef __USE_XOPEN_EXTENDED
+#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
extern __pid_t getpgid (__pid_t __pid) __THROW;
#endif
@@ -731,7 +733,7 @@ extern int __REDIRECT_NTH (setpgrp, (__pid_t __pid, __pid_t __pgrp), setpgid);
extern __pid_t setsid (void) __THROW;
libc_hidden_proto(setsid)
-#ifdef __USE_XOPEN_EXTENDED
+#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
/* Return the session ID of the given process. */
extern __pid_t getsid (__pid_t __pid) __THROW;
libc_hidden_proto(getsid)
@@ -768,37 +770,37 @@ extern int group_member (__gid_t __gid) __THROW;
If the calling process is the super-user, set the real
and effective user IDs, and the saved set-user-ID to UID;
if not, the effective user ID is set to UID. */
-extern int setuid (__uid_t __uid) __THROW;
+extern int setuid (__uid_t __uid) __THROW __wur;
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
/* Set the real user ID of the calling process to RUID,
and the effective user ID of the calling process to EUID. */
-extern int setreuid (__uid_t __ruid, __uid_t __euid) __THROW;
+extern int setreuid (__uid_t __ruid, __uid_t __euid) __THROW __wur;
libc_hidden_proto(setreuid)
#endif
#if defined __USE_BSD || defined __USE_XOPEN2K
/* Set the effective user ID of the calling process to UID. */
-extern int seteuid (__uid_t __uid) __THROW;
+extern int seteuid (__uid_t __uid) __THROW __wur;
libc_hidden_proto(seteuid)
-#endif /* Use BSD. */
+#endif
/* Set the group ID of the calling process to GID.
If the calling process is the super-user, set the real
and effective group IDs, and the saved set-group-ID to GID;
if not, the effective group ID is set to GID. */
-extern int setgid (__gid_t __gid) __THROW;
+extern int setgid (__gid_t __gid) __THROW __wur;
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
/* Set the real group ID of the calling process to RGID,
and the effective group ID of the calling process to EGID. */
-extern int setregid (__gid_t __rgid, __gid_t __egid) __THROW;
+extern int setregid (__gid_t __rgid, __gid_t __egid) __THROW __wur;
libc_hidden_proto(setregid)
#endif
#if defined __USE_BSD || defined __USE_XOPEN2K
/* Set the effective group ID of the calling process to GID. */
-extern int setegid (__gid_t __gid) __THROW;
+extern int setegid (__gid_t __gid) __THROW __wur;
#endif /* Use BSD. */
#ifdef __USE_GNU
@@ -816,14 +818,14 @@ extern int getresgid (__gid_t *__rgid, __gid_t *__egid, __gid_t *__sgid)
/* Set the real user ID, effective user ID, and saved-set user ID,
of the calling process to RUID, EUID, and SUID, respectively. */
extern int setresuid (__uid_t __ruid, __uid_t __euid, __uid_t __suid)
- __THROW;
+ __THROW __wur;
libc_hidden_proto(setresuid)
#endif
/* Set the real group ID, effective group ID, and saved-set group ID,
of the calling process to RGID, EGID, and SGID, respectively. */
extern int setresgid (__gid_t __rgid, __gid_t __egid, __gid_t __sgid)
- __THROW;
+ __THROW __wur;
libc_hidden_proto(setresgid)
#endif
@@ -832,7 +834,7 @@ libc_hidden_proto(setresgid)
/* Clone the calling process, creating an exact copy.
Return -1 for errors, 0 to the new process,
and the process ID of the new process to the old process. */
-extern __pid_t fork (void) __THROW;
+extern __pid_t fork (void) __THROWNL;
# ifdef _LIBC
# ifdef __UCLIBC_HAS_THREADS__
extern __typeof(fork) __libc_fork;
@@ -903,7 +905,7 @@ extern ssize_t readlink (const char *__restrict __path,
char *__restrict __buf, size_t __len)
__THROW __nonnull ((1, 2)) __wur;
libc_hidden_proto(readlink)
-#endif /* Use BSD. */
+#endif /* Use POSIX.1-2001. */
#ifdef __USE_ATFILE
/* Like symlink but a relative path in TO is interpreted relative to TOFD. */
@@ -944,7 +946,7 @@ extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __THROW;
/* Return the login name of the user.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern char *getlogin (void);
libc_hidden_proto(getlogin)
@@ -953,7 +955,7 @@ libc_hidden_proto(getlogin)
If it cannot be determined or some other error occurred, return the error
code. Otherwise return 0.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int getlogin_r (char *__name, size_t __name_len) __nonnull ((1));
#endif
@@ -974,7 +976,7 @@ extern int setlogin (const char *__name) __THROW __nonnull ((1));
#endif
-#if defined __USE_BSD || defined __USE_UNIX98
+#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K
/* Put the name of the current host in no more than LEN bytes of NAME.
The result is null-terminated if LEN is large enough for the full
name and the terminator. */
@@ -1071,6 +1073,11 @@ extern char *getpass (const char *__prompt) __nonnull ((1));
extern int fsync (int __fd);
#endif /* Use BSD || X/Open || Unix98. */
+#if 0 /*def __USE_GNU */
+/* Make all changes done to all files on the file system associated
+ * with FD actually appear on disk. */
+extern int syncfs (int __fd) __THROW;
+#endif
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
@@ -1263,7 +1270,7 @@ extern void swab (const void *__restrict __from, void *__restrict __to,
/* The Single Unix specification demands this prototype to be here.
It is also found in <stdio.h>. */
-#ifdef __USE_XOPEN
+#if defined __USE_XOPEN && !defined __USE_XOPEN2K
/* Return the name of the controlling terminal. */
extern char *ctermid (char *__s) __THROW;
#endif
diff --git a/include/utmp.h b/include/utmp.h
index 2908e33..8ecbb54 100644
--- a/include/utmp.h
+++ b/include/utmp.h
@@ -40,7 +40,7 @@ __BEGIN_DECLS
/* Make FD be the controlling terminal, stdin, stdout, and stderr;
then close FD. Returns 0 on success, nonzero on error. */
extern int login_tty (int __fd) __THROW;
-
+libutil_hidden_proto(login_tty)
/* Write the given entry into utmp and wtmp. */
extern void login (const struct utmp *__entry) __THROW;
diff --git a/include/wchar.h b/include/wchar.h
index 4ddd258..67f44b7 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -660,7 +660,7 @@ extern wint_t putwc (wchar_t __wc, __FILE *__stream);
/* Write a character to stdout.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern wint_t putwchar (wchar_t __wc);
@@ -668,14 +668,14 @@ extern wint_t putwchar (wchar_t __wc);
/* Get a newline-terminated wide character string of finite length
from STREAM.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n,
__FILE *__restrict __stream);
/* Write a string to STREAM.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int fputws (const wchar_t *__restrict __ws,
__FILE *__restrict __stream);
@@ -684,7 +684,7 @@ libc_hidden_proto(fputws)
/* Push a character back onto the input buffer of STREAM.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern wint_t ungetwc (wint_t __wc, __FILE *__stream);
libc_hidden_proto(ungetwc)
diff --git a/ldso/include/dl-syscall.h b/ldso/include/dl-syscall.h
index ac4c57e..4749d7a 100644
--- a/ldso/include/dl-syscall.h
+++ b/ldso/include/dl-syscall.h
@@ -48,7 +48,15 @@ extern int _dl_errno;
dynamic linking at all, so we cannot return any error codes.
We just punt if there is an error. */
#define __NR__dl_exit __NR_exit
-static __always_inline _syscall1(void, _dl_exit, int, status)
+static __always_inline attribute_noreturn __cold void _dl_exit(int status)
+{
+ INLINE_SYSCALL(_dl_exit, 1, status);
+#if defined __GNUC__
+ __builtin_unreachable(); /* shut up warning: 'noreturn' function does return*/
+#else
+ while (1);
+#endif
+}
#define __NR__dl_close __NR_close
static __always_inline _syscall1(int, _dl_close, int, fd)
diff --git a/ldso/ldso/arc/elfinterp.c b/ldso/ldso/arc/elfinterp.c
index 7c31d3a..2f0cf7f 100644
--- a/ldso/ldso/arc/elfinterp.c
+++ b/ldso/ldso/arc/elfinterp.c
@@ -144,6 +144,8 @@ _dl_do_reloc(struct elf_resolve *tpnt, struct r_scope_elem *scope,
#endif
switch (reloc_type) {
+ case R_ARC_NONE:
+ break;
case R_ARC_32:
*reloc_addr += symbol_addr + rpnt->r_addend;
break;
@@ -202,6 +204,8 @@ _dl_do_lazy_reloc(struct elf_resolve *tpnt, struct r_scope_elem *scope,
#endif
switch (reloc_type) {
+ case R_ARC_NONE:
+ break;
case R_ARC_JMP_SLOT:
*reloc_addr += tpnt->loadaddr;
break;
diff --git a/ldso/ldso/sh/dl-syscalls.h b/ldso/ldso/sh/dl-syscalls.h
index f9f13c7..b99a9b5 100644
--- a/ldso/ldso/sh/dl-syscalls.h
+++ b/ldso/ldso/sh/dl-syscalls.h
@@ -1,4 +1,4 @@
-#if __GNUC_PREREQ (4, 1)
+#if __GNUC_PREREQ (4, 1) && !__GNUC_PREREQ (4, 9)
#warning !!! gcc 4.1 and later have problems with __always_inline so redefined as inline
# ifdef __always_inline
# undef __always_inline
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index cfc1eee..31e6381 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -1615,9 +1615,13 @@ int __read_etc_hosts_r(
#endif
;
int ret = HOST_NOT_FOUND;
+ /* make sure pointer is aligned */
+ int i = ALIGN_BUFFER_OFFSET(buf);
+ buf += i;
+ buflen -= i;
*h_errnop = NETDB_INTERNAL;
- if (buflen < aliaslen
+ if (/* (ssize_t)buflen < 0 || */ buflen < aliaslen
|| (buflen - aliaslen) < BUFSZ + 1)
return ERANGE;
if (parser == NULL)
diff --git a/libc/misc/utmp/Makefile.in b/libc/misc/utmp/Makefile.in
index 535efb1..6c54ade 100644
--- a/libc/misc/utmp/Makefile.in
+++ b/libc/misc/utmp/Makefile.in
@@ -7,8 +7,8 @@
subdirs += libc/misc/utmp
-CSRC-y := utent.c wtent.c
-CSRC-$(UCLIBC_HAS_UTMPX) += utxent.c
+CSRC-y :=
+CSRC-$(if $(findstring y,$(UCLIBC_HAS_UTMP)$(UCLIBC_HAS_UTMPX)),y) += utent.c
MISC_UTMP_DIR := $(top_srcdir)libc/misc/utmp
MISC_UTMP_OUT := $(top_builddir)libc/misc/utmp
diff --git a/libc/misc/utmp/utent.c b/libc/misc/utmp/utent.c
index a35bb2b..3671bb0 100644
--- a/libc/misc/utmp/utent.c
+++ b/libc/misc/utmp/utent.c
@@ -1,3 +1,4 @@
+/* vi: set sw=4 ts=4: */
/* utent.c <ndf(a)linux.mit.edu> */
/* Let it be known that this is very possibly the worst standard ever. HP-UX
does one thing, someone else does another, linux another... If anyone
@@ -18,230 +19,211 @@
#include <paths.h>
#include <errno.h>
#include <string.h>
-#include <utmp.h>
-#ifdef __UCLIBC_HAS_UTMPX__
-# include <utmpx.h>
-#endif
+#include "internal/utmp.h"
#include <not-cancel.h>
-
#include <bits/uClibc_mutex.h>
+
__UCLIBC_MUTEX_STATIC(utmplock, PTHREAD_MUTEX_INITIALIZER);
/* Some global crap */
static int static_fd = -1;
-static struct utmp static_utmp;
-static const char default_file_name[] = _PATH_UTMP;
-static const char *static_ut_name = default_file_name;
+static struct UT static_utmp;
+static const char default_file[] = __DEFAULT_PATH_UTMP;
+static const char *current_file = default_file;
/* This function must be called with the LOCK held */
-static void __setutent_unlocked(void)
+static void __set_unlocked(void)
{
- if (static_fd < 0) {
- static_fd = open_not_cancel_2(static_ut_name, O_RDWR | O_CLOEXEC);
if (static_fd < 0) {
- static_fd = open_not_cancel_2(static_ut_name, O_RDONLY | O_CLOEXEC);
- if (static_fd < 0) {
- return; /* static_fd remains < 0 */
- }
- }
+ static_fd = open_not_cancel_2(current_file, O_RDWR | O_CLOEXEC);
+ if (static_fd < 0) {
+ static_fd = open_not_cancel_2(current_file, O_RDONLY | O_CLOEXEC);
+ if (static_fd < 0) {
+ return; /* static_fd remains < 0 */
+ }
+ }
#ifndef __ASSUME_O_CLOEXEC
- /* Make sure the file will be closed on exec() */
- fcntl_not_cancel(static_fd, F_SETFD, FD_CLOEXEC);
+ /* Make sure the file will be closed on exec() */
+ fcntl_not_cancel(static_fd, F_SETFD, FD_CLOEXEC);
#endif
- return;
- }
- lseek(static_fd, 0, SEEK_SET);
+ return;
+ }
+ lseek(static_fd, 0, SEEK_SET);
}
#if defined __UCLIBC_HAS_THREADS__
-static void __setutent(void)
+void set(void)
{
- __UCLIBC_MUTEX_LOCK(utmplock);
- __setutent_unlocked();
- __UCLIBC_MUTEX_UNLOCK(utmplock);
+ __UCLIBC_MUTEX_LOCK(utmplock);
+ __set_unlocked();
+ __UCLIBC_MUTEX_UNLOCK(utmplock);
}
#else
-static void __setutent(void);
-strong_alias(__setutent_unlocked,__setutent)
-#endif
-strong_alias(__setutent,setutent)
-
-#ifdef __UCLIBC_HAS_UTMPX__
-strong_alias(__setutent,setutxent)
+strong_alias(__set_unlocked,set)
#endif
+/* not used in libc_hidden_def(set) */
+other(setutxent,setutent)
/* This function must be called with the LOCK held */
-static struct utmp *__getutent_unlocked(void)
+static struct UT *__get_unlocked(void)
{
- if (static_fd < 0) {
- __setutent();
if (static_fd < 0) {
- return NULL;
+ __set_unlocked();
+ if (static_fd < 0)
+ return NULL;
}
- }
- if (read_not_cancel(static_fd, &static_utmp, sizeof(static_utmp)) == sizeof(static_utmp)) {
- return &static_utmp;
- }
+ if (read_not_cancel(static_fd, &static_utmp,
+ sizeof(static_utmp)) == sizeof(static_utmp)) {
+ return &static_utmp;
+ }
- return NULL;
+ return NULL;
}
#if defined __UCLIBC_HAS_THREADS__
-static struct utmp *__getutent(void)
+struct UT *get(void)
{
- struct utmp *ret;
+ struct UT *ret;
- __UCLIBC_MUTEX_LOCK(utmplock);
- ret = __getutent_unlocked();
- __UCLIBC_MUTEX_UNLOCK(utmplock);
- return ret;
+ __UCLIBC_MUTEX_LOCK(utmplock);
+ ret = __get_unlocked();
+ __UCLIBC_MUTEX_UNLOCK(utmplock);
+ return ret;
}
#else
-static struct utmp *__getutent(void);
-strong_alias(__getutent_unlocked,__getutent)
+strong_alias(__get_unlocked,get)
#endif
-strong_alias(__getutent,getutent)
+/* not used in libc_hidden_def(get) */
+other(getutxent,getutent)
-#ifdef __UCLIBC_HAS_UTMPX__
-struct utmpx *getutxent(void)
+void end(void)
{
- return (struct utmpx *) __getutent ();
-}
-#endif
-
-static void __endutent(void)
-{
- __UCLIBC_MUTEX_LOCK(utmplock);
- if (static_fd >= 0)
- close_not_cancel_no_status(static_fd);
- static_fd = -1;
- __UCLIBC_MUTEX_UNLOCK(utmplock);
+ __UCLIBC_MUTEX_LOCK(utmplock);
+ if (static_fd >= 0)
+ close_not_cancel_no_status(static_fd);
+ static_fd = -1;
+ __UCLIBC_MUTEX_UNLOCK(utmplock);
}
-strong_alias(__endutent,endutent)
-
-#ifdef __UCLIBC_HAS_UTMPX__
-strong_alias(__endutent,endutxent)
-#endif
+/* not used in libc_hidden_def(end) */
+other(endutxent,endutent)
/* This function must be called with the LOCK held */
-static struct utmp *__getutid_unlocked(const struct utmp *utmp_entry)
+static struct UT *__getid_unlocked(const struct UT *utmp_entry)
{
- struct utmp *lutmp;
- unsigned type;
-
- /* We use the fact that constants we are interested in are: */
- /* RUN_LVL=1, ... OLD_TIME=4; INIT_PROCESS=5, ... USER_PROCESS=8 */
- type = utmp_entry->ut_type - 1;
- type /= 4;
-
- while ((lutmp = __getutent_unlocked()) != NULL) {
- if (type == 0 && lutmp->ut_type == utmp_entry->ut_type) {
- /* one of RUN_LVL, BOOT_TIME, NEW_TIME, OLD_TIME */
- return lutmp;
+ struct UT *lutmp;
+ unsigned type;
+
+ /* We use the fact that constants we are interested in are: */
+ /* RUN_LVL=1, ... OLD_TIME=4; INIT_PROCESS=5, ... USER_PROCESS=8 */
+ type = utmp_entry->ut_type - 1;
+ type /= 4;
+
+ while ((lutmp = __get_unlocked()) != NULL) {
+ if (type == 0 && lutmp->ut_type == utmp_entry->ut_type) {
+ /* one of RUN_LVL, BOOT_TIME, NEW_TIME, OLD_TIME */
+ return lutmp;
+ }
+ if (type == 1
+ && strncmp(lutmp->ut_id, utmp_entry->ut_id,
+ sizeof(lutmp->ut_id)) == 0) {
+ /* INIT_PROCESS, LOGIN_PROCESS, USER_PROCESS, DEAD_PROCESS */
+ return lutmp;
+ }
}
- if (type == 1 && strncmp(lutmp->ut_id, utmp_entry->ut_id, sizeof(lutmp->ut_id)) == 0) {
- /* INIT_PROCESS, LOGIN_PROCESS, USER_PROCESS, DEAD_PROCESS */
- return lutmp;
- }
- }
- return NULL;
+ return NULL;
}
#if defined __UCLIBC_HAS_THREADS__
-static struct utmp *__getutid(const struct utmp *utmp_entry)
+struct UT *getid(const struct UT *utmp_entry)
{
- struct utmp *ret;
+ struct UT *ret;
- __UCLIBC_MUTEX_LOCK(utmplock);
- ret = __getutid_unlocked(utmp_entry);
- __UCLIBC_MUTEX_UNLOCK(utmplock);
- return ret;
+ __UCLIBC_MUTEX_LOCK(utmplock);
+ ret = __getid_unlocked(utmp_entry);
+ __UCLIBC_MUTEX_UNLOCK(utmplock);
+ return ret;
}
#else
-static struct utmp *__getutid(const struct utmp *utmp_entry);
-strong_alias(__getutid_unlocked,__getutid)
-#endif
-strong_alias(__getutid,getutid)
-
-#ifdef __UCLIBC_HAS_UTMPX__
-struct utmpx *getutxid(const struct utmpx *utmp_entry)
-{
- return (struct utmpx *) __getutid ((const struct utmp *) utmp_entry);
-}
+strong_alias(__getid_unlocked,getid)
#endif
+/* not used in libc_hidden_def(getid) */
+other(getutxid,getutid)
-static struct utmp *__getutline(const struct utmp *utmp_entry)
+struct UT *getline(const struct UT *utmp_entry)
{
- struct utmp *lutmp;
-
- __UCLIBC_MUTEX_LOCK(utmplock);
- while ((lutmp = __getutent_unlocked()) != NULL) {
- if (lutmp->ut_type == USER_PROCESS || lutmp->ut_type == LOGIN_PROCESS) {
- if (strncmp(lutmp->ut_line, utmp_entry->ut_line, sizeof(lutmp->ut_line)) == 0) {
- break;
- }
+ struct UT *lutmp;
+
+ __UCLIBC_MUTEX_LOCK(utmplock);
+ while ((lutmp = __get_unlocked()) != NULL) {
+ if (lutmp->ut_type == USER_PROCESS || lutmp->ut_type == LOGIN_PROCESS) {
+ if (strncmp(lutmp->ut_line, utmp_entry->ut_line,
+ sizeof(lutmp->ut_line)) == 0) {
+ break;
+ }
+ }
}
- }
- __UCLIBC_MUTEX_UNLOCK(utmplock);
- return lutmp;
+ __UCLIBC_MUTEX_UNLOCK(utmplock);
+ return lutmp;
}
-strong_alias(__getutline,getutline)
+/* libc_hidden_def(getline) */
+other(getutxline,getutline)
-#ifdef __UCLIBC_HAS_UTMPX__
-struct utmpx *getutxline(const struct utmpx *utmp_entry)
+struct UT *putline(const struct UT *utmp_entry)
{
- return (struct utmpx *) __getutline ((const struct utmp *) utmp_entry);
+ __UCLIBC_MUTEX_LOCK(utmplock);
+ /* Ignore the return value. That way, if they've already positioned
+ the file pointer where they want it, everything will work out. */
+ lseek(static_fd, (off_t) - sizeof(struct UT), SEEK_CUR);
+
+ if (__getid_unlocked(utmp_entry) != NULL)
+ lseek(static_fd, (off_t) - sizeof(struct UT), SEEK_CUR);
+ else
+ lseek(static_fd, (off_t) 0, SEEK_END);
+ if (write(static_fd, utmp_entry, sizeof(struct UT))
+ != sizeof(struct UT))
+ utmp_entry = NULL;
+
+ __UCLIBC_MUTEX_UNLOCK(utmplock);
+ return (struct UT *)utmp_entry;
}
-#endif
+/* not used in libc_hidden_def(putline) */
+other(pututxline,pututline)
-static struct utmp *__pututline(const struct utmp *utmp_entry)
+int name(const char *new_file)
{
- __UCLIBC_MUTEX_LOCK(utmplock);
- /* Ignore the return value. That way, if they've already positioned
- the file pointer where they want it, everything will work out. */
- lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR);
-
- if (__getutid_unlocked(utmp_entry) != NULL)
- lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR);
- else
- lseek(static_fd, (off_t) 0, SEEK_END);
- if (write(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp))
- utmp_entry = NULL;
-
- __UCLIBC_MUTEX_UNLOCK(utmplock);
- return (struct utmp *)utmp_entry;
-}
-strong_alias(__pututline,pututline)
+ __UCLIBC_MUTEX_LOCK(utmplock);
+ if (new_file != NULL) {
+ if (current_file != default_file)
+ free((char *)current_file);
+ current_file = strdup(new_file);
+ if (current_file == NULL) {
+ /* We should probably whine about out-of-memory
+ * errors here... Instead just reset to the default */
+ current_file = default_file;
+ }
+ }
-#ifdef __UCLIBC_HAS_UTMPX__
-struct utmpx *pututxline (const struct utmpx *utmp_entry)
-{
- return (struct utmpx *) __pututline ((const struct utmp *) utmp_entry);
+ if (static_fd >= 0) {
+ close_not_cancel_no_status(static_fd);
+ static_fd = -1;
+ }
+ __UCLIBC_MUTEX_UNLOCK(utmplock);
+ return 0; /* or maybe return -(current_file != new_file)? */
}
-#endif
+/* not used in libc_hidden_def(name) */
+other(utmpxname,utmpname)
-static int __utmpname(const char *new_ut_name)
+void updw(const char *wtmp_file, const struct UT *lutmp)
{
- __UCLIBC_MUTEX_LOCK(utmplock);
- if (new_ut_name != NULL) {
- if (static_ut_name != default_file_name)
- free((char *)static_ut_name);
- static_ut_name = strdup(new_ut_name);
- if (static_ut_name == NULL) {
- /* We should probably whine about out-of-memory
- * errors here... Instead just reset to the default */
- static_ut_name = default_file_name;
+ int fd;
+
+ fd = open_not_cancel_2(wtmp_file, O_APPEND | O_WRONLY);
+ if (fd >= 0) {
+ if (lockf(fd, F_LOCK, 0) == 0) {
+ write_not_cancel(fd, lutmp, sizeof(struct UT));
+ lockf(fd, F_ULOCK, 0);
+ close_not_cancel_no_status(fd);
+ }
}
- }
-
- if (static_fd >= 0) {
- close_not_cancel_no_status(static_fd);
- static_fd = -1;
- }
- __UCLIBC_MUTEX_UNLOCK(utmplock);
- return 0; /* or maybe return -(static_ut_name != new_ut_name)? */
}
-strong_alias(__utmpname,utmpname)
-
-#ifdef __UCLIBC_HAS_UTMPX__
-strong_alias(__utmpname,utmpxname)
-#endif
+/* not used in libc_hidden_def(updw) */
+other(updwtmpx,updwtmp)
diff --git a/libc/misc/utmp/utxent.c b/libc/misc/utmp/utxent.c
deleted file mode 100644
index 71157cc..0000000
--- a/libc/misc/utmp/utxent.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * utexent.c : Support for accessing user accounting database.
- * Copyright (C) 2010 STMicroelectronics Ltd.
- *
- * Author: Salvatore Cro <salvatore.cro(a)st.com>
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- *
- */
-
-#include <features.h>
-#include <string.h>
-#include <utmpx.h>
-#include <utmp.h>
-
-#if 0 /* moved to utent.c */
-void setutxent(void)
-{
- setutent ();
-}
-
-void endutxent(void)
-{
- endutent ();
-}
-
-struct utmpx *getutxent(void)
-{
- return (struct utmpx *) getutent ();
-}
-
-struct utmpx *getutxid(const struct utmpx *utmp_entry)
-{
- return (struct utmpx *) getutid ((const struct utmp *) utmp_entry);
-}
-
-struct utmpx *getutxline(const struct utmpx *utmp_entry)
-{
- return (struct utmpx *) getutline ((const struct utmp *) utmp_entry);
-}
-
-struct utmpx *pututxline (const struct utmpx *utmp_entry)
-{
- return (struct utmpx *) pututline ((const struct utmp *) utmp_entry);
-}
-
-int utmpxname (const char *new_ut_name)
-{
- return utmpname (new_ut_name);
-}
-
-/* moved to wtent.c */
-void updwtmpx (const char *wtmpx_file, const struct utmpx *utmpx)
-{
- updwtmp (wtmpx_file, (const struct utmp *) utmpx);
-}
-#endif
-
-/* Copy the information in UTMPX to UTMP. */
-void getutmp (const struct utmpx *utmpx, struct utmp *utmp)
-{
-#if _HAVE_UT_TYPE - 0
- utmp->ut_type = utmpx->ut_type;
-#endif
-#if _HAVE_UT_PID - 0
- utmp->ut_pid = utmpx->ut_pid;
-#endif
- memcpy (utmp->ut_line, utmpx->ut_line, sizeof (utmp->ut_line));
- memcpy (utmp->ut_user, utmpx->ut_user, sizeof (utmp->ut_user));
-#if _HAVE_UT_ID - 0
- memcpy (utmp->ut_id, utmpx->ut_id, sizeof (utmp->ut_id));
-#endif
-#if _HAVE_UT_HOST - 0
- memcpy (utmp->ut_host, utmpx->ut_host, sizeof (utmp->ut_host));
-#endif
-#if _HAVE_UT_TV - 0
- utmp->ut_tv.tv_sec = utmpx->ut_tv.tv_sec;
- utmp->ut_tv.tv_usec = utmpx->ut_tv.tv_usec;
-#else
- utmp->ut_time = utmpx->ut_time;
-#endif
-}
-
-/* Copy the information in UTMP to UTMPX. */
-void getutmpx (const struct utmp *utmp, struct utmpx *utmpx)
-{
- memset (utmpx, 0, sizeof (struct utmpx));
-
-#if _HAVE_UT_TYPE - 0
- utmpx->ut_type = utmp->ut_type;
-#endif
-#if _HAVE_UT_PID - 0
- utmpx->ut_pid = utmp->ut_pid;
-#endif
- memcpy (utmpx->ut_line, utmp->ut_line, sizeof (utmp->ut_line));
- memcpy (utmpx->ut_user, utmp->ut_user, sizeof (utmp->ut_user));
-#if _HAVE_UT_ID - 0
- memcpy (utmpx->ut_id, utmp->ut_id, sizeof (utmp->ut_id));
-#endif
-#if _HAVE_UT_HOST - 0
- memcpy (utmpx->ut_host, utmp->ut_host, sizeof (utmp->ut_host));
-#endif
-#if _HAVE_UT_TV - 0
- utmpx->ut_tv.tv_sec = utmp->ut_tv.tv_sec;
- utmpx->ut_tv.tv_usec = utmp->ut_tv.tv_usec;
-#else
- utmpx->ut_time = utmp->ut_time;
-#endif
-}
diff --git a/libc/misc/utmp/wtent.c b/libc/misc/utmp/wtent.c
deleted file mode 100644
index 9b3ad50..0000000
--- a/libc/misc/utmp/wtent.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2000-2006 Erik Andersen <andersen(a)uclibc.org>
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- */
-
-/* wtmp support rubbish (i.e. complete crap) */
-
-#include <string.h>
-#include <sys/time.h>
-#include <time.h>
-#include <unistd.h>
-#include <utmp.h>
-#ifdef __UCLIBC_HAS_UTMPX__
-# include <utmpx.h>
-#endif
-#include <fcntl.h>
-#include <sys/file.h>
-#include <not-cancel.h>
-
-#if 0
-/* This is enabled in uClibc/libutil/logwtmp.c */
-void logwtmp (const char *line, const char *name, const char *host)
-{
- struct utmp lutmp;
- memset(&lutmp, 0, sizeof(lutmp));
-
- lutmp.ut_type = (name && *name) ? USER_PROCESS : DEAD_PROCESS;
- lutmp.ut_pid = getpid();
- strncpy(lutmp.ut_line, line, sizeof(lutmp.ut_line)-1);
- strncpy(lutmp.ut_name, name, sizeof(lutmp.ut_name)-1);
- strncpy(lutmp.ut_host, host, sizeof(lutmp.ut_host)-1);
- gettimeofday(&(lutmp.ut_tv), NULL);
-
- updwtmp(_PATH_WTMP, &lutmp);
-}
-#endif
-
-static void __updwtmp(const char *wtmp_file, const struct utmp *lutmp)
-{
- int fd;
-
- fd = open_not_cancel_2(wtmp_file, O_APPEND | O_WRONLY);
- if (fd >= 0) {
- if (lockf(fd, F_LOCK, 0) == 0) {
- write_not_cancel(fd, lutmp, sizeof(struct utmp));
- lockf(fd, F_ULOCK, 0);
- close_not_cancel_no_status(fd);
- }
- }
-}
-strong_alias(__updwtmp,updwtmp)
-
-#ifdef __UCLIBC_HAS_UTMPX__
-void updwtmpx (const char *wtmpx_file, const struct utmpx *utmpx)
-{
- __updwtmp (wtmpx_file, (const struct utmp *) utmpx);
-}
-#endif
diff --git a/libc/stdio/_fpmaxtostr.h b/libc/stdio/_fpmaxtostr.h
index b4e7321..7694629 100644
--- a/libc/stdio/_fpmaxtostr.h
+++ b/libc/stdio/_fpmaxtostr.h
@@ -11,39 +11,39 @@
#define _FPMAXTOSTR_H 1
#include <features.h>
-#ifdef __UCLIBC_HAS_FLOATS__
-
#define __need_size_t
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <printf.h>
#include <sys/types.h>
-#include <float.h>
-#include <bits/uClibc_fpmax.h>
+
+#ifdef __UCLIBC_HAS_FLOATS__
+# include <float.h>
+# include <bits/uClibc_fpmax.h>
/* WARNING: Adjust _fp_out_wide() in _vfprintf.c if this changes! */
/* With 32 bit ints, we can get 9 decimal digits per block. */
-#define DIGITS_PER_BLOCK 9
+# define DIGITS_PER_BLOCK 9
-#define NUM_DIGIT_BLOCKS ((DECIMAL_DIG+DIGITS_PER_BLOCK-1)/DIGITS_PER_BLOCK)
+# define NUM_DIGIT_BLOCKS ((DECIMAL_DIG+DIGITS_PER_BLOCK-1)/DIGITS_PER_BLOCK)
/* WARNING: Adjust _fp_out_wide() in _vfprintf.c if this changes! */
/* extra space for '-', '.', 'e+###', and nul */
-#define BUF_SIZE ( 3 + NUM_DIGIT_BLOCKS * DIGITS_PER_BLOCK )
+# define BUF_SIZE ( 3 + NUM_DIGIT_BLOCKS * DIGITS_PER_BLOCK )
/* psm: why do these internals differ? */
-#ifdef __USE_OLD_VFPRINTF__
+# ifdef __USE_OLD_VFPRINTF__
typedef void (__fp_outfunc_t)(FILE *fp, intptr_t type, intptr_t len, intptr_t buf);
extern size_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info,
__fp_outfunc_t fp_outfunc) attribute_hidden;
-#else
+# else
typedef size_t (__fp_outfunc_t)(FILE *fp, intptr_t type, intptr_t len, intptr_t buf);
extern ssize_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info,
__fp_outfunc_t fp_outfunc) attribute_hidden;
-#endif
+# endif
-#endif /* __UCLIBC_HAS_FLOATS__ */
+# endif /* __UCLIBC_HAS_FLOATS__ */
#endif /* _FPMAXTOSTR_H */
diff --git a/libc/stdio/_vfprintf.c b/libc/stdio/_vfprintf.c
index 01ee218..a795f49 100644
--- a/libc/stdio/_vfprintf.c
+++ b/libc/stdio/_vfprintf.c
@@ -121,18 +121,6 @@
#error Apparently, LONG_LONG_MAX is defined but LLONG_MAX is not. You need to fix your toolchain headers to support the standard macros for (unsigned) long long.
#endif
-/**********************************************************************/
-/* These provide some control over printf's feature set */
-
-/* Now controlled by uClibc_config.h. */
-/* #define __UCLIBC_HAS_FLOATS__ 1 */
-
-/* Now controlled by uClibc_config.h. */
-/* #define __UCLIBC_HAS_PRINTF_M_SPEC__ */
-
-
-/**********************************************************************/
-
#include "_fpmaxtostr.h"
#undef __STDIO_HAS_VSNPRINTF
@@ -142,9 +130,6 @@
/**********************************************************************/
-/* Now controlled by uClibc_config.h. */
-/* #define __UCLIBC_HAS_GLIBC_CUSTOM_PRINTF__ */
-
#ifdef __UCLIBC_MJN3_ONLY__
# ifdef L_register_printf_function
/* emit only once */
diff --git a/libc/stdlib/Makefile.in b/libc/stdlib/Makefile.in
index 880de78..071f911 100644
--- a/libc/stdlib/Makefile.in
+++ b/libc/stdlib/Makefile.in
@@ -61,7 +61,6 @@ CSRC-$(if $(findstring yyy,$(UCLIBC_HAS_FLOATS)$(UCLIBC_HAS_WCHAR)$(UCLIBC_HAS_X
# multi source _atexit.c
CSRC-y += __cxa_atexit.c __cxa_finalize.c __exit_handler.c exit.c on_exit.c
-CSRC-$(COMPAT_ATEXIT) += old_atexit.c
STDLIB_DIR := $(top_srcdir)libc/stdlib
STDLIB_OUT := $(top_builddir)libc/stdlib
@@ -71,11 +70,12 @@ STDLIB_OBJ := $(patsubst %.c,$(STDLIB_OUT)/%.o,$(CSRC-y))
libc-y += $(STDLIB_OBJ)
libc-static-y += $(STDLIB_OUT)/atexit.o $(STDLIB_OUT)/system.o
+libc-static-$(COMPAT_ATEXIT) += $(STDLIB_OUT)/old_atexit.o
libc-shared-y += $(STDLIB_OUT)/system.oS
# this should always be the PIC version, because it could be used in shared libs
libc-nonshared-y += $(STDLIB_OUT)/atexit.os
-
+libc-nonshared-$(COMPAT_ATEXIT) += $(STDLIB_OUT)/old_atexit.os
libc-nomulti-y += $(STDLIB_OUT)/labs.o $(STDLIB_OUT)/atol.o $(STDLIB_OUT)/_stdlib_strto_l.o $(STDLIB_OUT)/_stdlib_strto_ll.o
libc-nomulti-$(UCLIBC_HAS_XLOCALE) += $(STDLIB_OUT)/_stdlib_strto_l_l.o $(STDLIB_OUT)/_stdlib_strto_ll_l.o
diff --git a/libc/stdlib/malloc-standard/free.c b/libc/stdlib/malloc-standard/free.c
index 39e54d6..8b7a81f 100644
--- a/libc/stdlib/malloc-standard/free.c
+++ b/libc/stdlib/malloc-standard/free.c
@@ -104,9 +104,13 @@ static int __malloc_trim(size_t pad, mstate av)
*/
int malloc_trim(size_t pad)
{
+ int r;
+ __MALLOC_LOCK;
mstate av = get_malloc_state();
__malloc_consolidate(av);
- return __malloc_trim(pad, av);
+ r = __malloc_trim(pad, av);
+ __MALLOC_UNLOCK;
+ return r;
}
/*
diff --git a/libc/stdlib/malloc-standard/malloc.c b/libc/stdlib/malloc-standard/malloc.c
index 2abb5bb..fd33b50 100644
--- a/libc/stdlib/malloc-standard/malloc.c
+++ b/libc/stdlib/malloc-standard/malloc.c
@@ -832,8 +832,6 @@ void* malloc(size_t bytes)
}
#endif
- __MALLOC_LOCK;
- av = get_malloc_state();
/*
Convert request size to internal form by adding (sizeof(size_t)) bytes
overhead plus possibly more to obtain necessary alignment and/or
@@ -845,6 +843,9 @@ void* malloc(size_t bytes)
checked_request2size(bytes, nb);
+ __MALLOC_LOCK;
+ av = get_malloc_state();
+
/*
Bypass search if no frees yet
*/
diff --git a/libc/stdlib/malloc-standard/memalign.c b/libc/stdlib/malloc-standard/memalign.c
index 6303c1d..e9ae5a7 100644
--- a/libc/stdlib/malloc-standard/memalign.c
+++ b/libc/stdlib/malloc-standard/memalign.c
@@ -52,8 +52,8 @@ void* memalign(size_t alignment, size_t bytes)
alignment = a;
}
- __MALLOC_LOCK;
checked_request2size(bytes, nb);
+ __MALLOC_LOCK;
/* Strategy: find a spot within that chunk that meets the alignment
* request, and then possibly free the leading and trailing space. */
diff --git a/libc/stdlib/malloc-standard/realloc.c b/libc/stdlib/malloc-standard/realloc.c
index e060b70..e49d111 100644
--- a/libc/stdlib/malloc-standard/realloc.c
+++ b/libc/stdlib/malloc-standard/realloc.c
@@ -54,9 +54,9 @@ void* realloc(void* oldmem, size_t bytes)
return NULL;
}
+ checked_request2size(bytes, nb);
__MALLOC_LOCK;
av = get_malloc_state();
- checked_request2size(bytes, nb);
oldp = mem2chunk(oldmem);
oldsize = chunksize(oldp);
diff --git a/libc/string/strverscmp.c b/libc/string/strverscmp.c
index 714f4ed..7818a91 100644
--- a/libc/string/strverscmp.c
+++ b/libc/string/strverscmp.c
@@ -1,13 +1,8 @@
-/* GNU's strverscmp() function, taken from glibc 2.3.2 sources
- */
-
/* Compare strings while treating digits characters numerically.
- Copyright (C) 1997, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jean-Fran�ois Bignolles <bignolle(a)ecoledoc.ibp.fr>, 1997.
- Derived work for uClibc by Hai Zaar, Codefidence Ltd <haizaar(a)codefidence.com>
-
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
@@ -22,63 +17,54 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#include <stdint.h>
#include <string.h>
#include <ctype.h>
-#include <stdint.h>
-
/* states: S_N: normal, S_I: comparing integral part, S_F: comparing
- fractional parts, S_Z: idem but with leading Zeroes only */
+ fractionnal parts, S_Z: idem but with leading Zeroes only */
#define S_N 0x0
-#define S_I 0x4
-#define S_F 0x8
-#define S_Z 0xC
+#define S_I 0x3
+#define S_F 0x6
+#define S_Z 0x9
/* result_type: CMP: return diff; LEN: compare using len_diff/diff */
#define CMP 2
#define LEN 3
-/* using more efficient isdigit() */
-#undef isdigit
-#define isdigit(a) ((unsigned)((a) - '0') <= 9)
/* Compare S1 and S2 as strings holding indices/version numbers,
returning less than, equal to or greater than zero if S1 is less than,
equal to or greater than S2 (for more info, see the texinfo doc).
*/
+
int strverscmp (const char *s1, const char *s2)
{
const unsigned char *p1 = (const unsigned char *) s1;
const unsigned char *p2 = (const unsigned char *) s2;
- unsigned char c1, c2;
- int state;
- int diff;
- /* Symbol(s) 0 [1-9] others (padding)
- Transition (10) 0 (01) d (00) x (11) - */
+ /* Symbol(s) 0 [1-9] others
+ Transition (10) 0 (01) d (00) x */
static const uint8_t next_state[] =
{
- /* state x d 0 - */
- /* S_N */ S_N, S_I, S_Z, S_N,
- /* S_I */ S_N, S_I, S_I, S_I,
- /* S_F */ S_N, S_F, S_F, S_F,
- /* S_Z */ S_N, S_F, S_Z, S_Z
+ /* state x d 0 */
+ /* S_N */ S_N, S_I, S_Z,
+ /* S_I */ S_N, S_I, S_I,
+ /* S_F */ S_N, S_F, S_F,
+ /* S_Z */ S_N, S_F, S_Z
};
static const int8_t result_type[] =
{
- /* state x/x x/d x/0 x/- d/x d/d d/0 d/-
- 0/x 0/d 0/0 0/- -/x -/d -/0 -/- */
-
- /* S_N */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
- CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
- /* S_I */ CMP, -1, -1, CMP, +1, LEN, LEN, CMP,
- +1, LEN, LEN, CMP, CMP, CMP, CMP, CMP,
- /* S_F */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
- CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
- /* S_Z */ CMP, +1, +1, CMP, -1, CMP, CMP, CMP,
- -1, CMP, CMP, CMP
+ /* state x/x x/d x/0 d/x d/d d/0 0/x 0/d 0/0 */
+
+ /* S_N */ CMP, CMP, CMP, CMP, LEN, CMP, CMP, CMP, CMP,
+ /* S_I */ CMP, -1, -1, +1, LEN, LEN, +1, LEN, LEN,
+ /* S_F */ CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
+ /* S_Z */ CMP, +1, +1, -1, CMP, CMP, -1, CMP, CMP
};
+ unsigned char c1, c2;
+ int state, diff;
if (p1 == p2)
return 0;
@@ -86,17 +72,20 @@ int strverscmp (const char *s1, const char *s2)
c1 = *p1++;
c2 = *p2++;
/* Hint: '0' is a digit too. */
- state = S_N | ((c1 == '0') + (isdigit (c1) != 0));
+ state = S_N + ((c1 == '0') + (isdigit (c1) != 0));
- while ((diff = c1 - c2) == 0 && c1 != '\0')
+ while ((diff = c1 - c2) == 0)
{
+ if (c1 == '\0')
+ return diff;
+
state = next_state[state];
c1 = *p1++;
c2 = *p2++;
- state |= (c1 == '0') + (isdigit (c1) != 0);
+ state += (c1 == '0') + (isdigit (c1) != 0);
}
- state = result_type[state << 2 | (((c2 == '0') + (isdigit (c2) != 0)))];
+ state = result_type[state * 3 + (((c2 == '0') + (isdigit (c2) != 0)))];
switch (state)
{
diff --git a/libc/sysdeps/linux/arc/sigaction.c b/libc/sysdeps/linux/arc/sigaction.c
index 4a4c9e2..67ca38a 100644
--- a/libc/sysdeps/linux/arc/sigaction.c
+++ b/libc/sysdeps/linux/arc/sigaction.c
@@ -13,7 +13,8 @@
/*
* Default sigretrun stub if user doesn't specify SA_RESTORER
*/
-static void __default_rt_sa_restorer(void)
+static void attribute_optimize("Os") __attribute_noinline__
+__default_rt_sa_restorer(void)
{
INTERNAL_SYSCALL_NCS(__NR_rt_sigreturn, , 0);
}
diff --git a/libc/sysdeps/linux/arc/sys/procfs.h b/libc/sysdeps/linux/arc/sys/procfs.h
index a9e375b..a474303 100755
--- a/libc/sysdeps/linux/arc/sys/procfs.h
+++ b/libc/sysdeps/linux/arc/sys/procfs.h
@@ -20,17 +20,14 @@
#include <sys/time.h>
#include <sys/types.h>
#include <sys/user.h>
+#include <asm/ptrace.h>
__BEGIN_DECLS
/* Type for a general-purpose register. */
typedef unsigned long elf_greg_t;
-/* And the whole bunch of them. We could have used `struct
- user_regs' directly in the typedef, but tradition says that
- the register set is an array, which does have some peculiar
- semantics, so leave it that way. */
-#define ELF_NGREG 40
+#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
typedef elf_greg_t elf_gregset_t[ELF_NGREG];
typedef struct { } elf_fpregset_t;
diff --git a/libc/sysdeps/linux/arm/Makefile.arch b/libc/sysdeps/linux/arm/Makefile.arch
index 3054273..cda3db2 100644
--- a/libc/sysdeps/linux/arm/Makefile.arch
+++ b/libc/sysdeps/linux/arm/Makefile.arch
@@ -13,7 +13,9 @@ SSRC-y := \
vfork.S clone.S
SSRC-$(UCLIBC_HAS_LFS) += mmap64.S
-SSRC-$(UCLIBC_HAS_THREADS_NATIVE) += libc-aeabi_read_tp.S libc-thumb_atomics.S
+SSRC-$(UCLIBC_HAS_THREADS_NATIVE) += libc-thumb_atomics.S
+libc-nonshared-$(UCLIBC_HAS_THREADS_NATIVE) += $(ARCH_OUT)/libc-aeabi_read_tp.os
+libc-static-$(UCLIBC_HAS_THREADS_NATIVE) += $(ARCH_OUT)/libc-aeabi_read_tp.o
CSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += makecontext.c
SSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += getcontext.S setcontext.S swapcontext.S
diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in
index 8ee956b..8252598 100644
--- a/libc/sysdeps/linux/common/Makefile.in
+++ b/libc/sysdeps/linux/common/Makefile.in
@@ -27,6 +27,7 @@ CSRC-$(UCLIBC_LINUX_SPECIFIC) += \
eventfd.c \
eventfd_read.c \
eventfd_write.c \
+ getrandom.c \
inotify.c \
ioperm.c \
iopl.c \
diff --git a/libc/sysdeps/linux/common/bits/kernel-features.h b/libc/sysdeps/linux/common/bits/kernel-features.h
index 6184c2b..708bb49 100644
--- a/libc/sysdeps/linux/common/bits/kernel-features.h
+++ b/libc/sysdeps/linux/common/bits/kernel-features.h
@@ -507,3 +507,8 @@
#if defined __x86_64__ && __LINUX_KERNEL_VERSION >= 0x030100
# define __ASSUME_GETCPU_SYSCALL 1
#endif
+
+/* getrandom syscall (widely) appeared around 4.0.0 */
+#if __LINUX_KERNEL_VERSION >= 0x040000
+# define __ASSUME_GETRANDOM_SYSCALL 1
+#endif
diff --git a/libc/sysdeps/linux/common/bits/mathcalls.h b/libc/sysdeps/linux/common/bits/mathcalls.h
index 4270273..3d7e34f 100644
--- a/libc/sysdeps/linux/common/bits/mathcalls.h
+++ b/libc/sysdeps/linux/common/bits/mathcalls.h
@@ -74,8 +74,22 @@ __MATHCALLI (atan2,, (_Mdouble_ __y, _Mdouble_ __x))
/* Cosine of X. */
__MATHCALLI (cos,, (_Mdouble_ __x))
+# if defined _LIBC && defined _Mlong_double_
+libm_hidden_proto(cosl)
+# endif
+# if defined _LIBC && defined _Mfloat_
+libm_hidden_proto(cosf)
+# endif
+
/* Sine of X. */
__MATHCALLI (sin,, (_Mdouble_ __x))
+# if defined _LIBC && defined _Mlong_double_
+libm_hidden_proto(sinl)
+# endif
+# if defined _LIBC && defined _Mfloat_
+libm_hidden_proto(sinf)
+# endif
+
/* Tangent of X. */
__MATHCALLI (tan,, (_Mdouble_ __x))
@@ -111,6 +125,9 @@ __END_NAMESPACE_C99
_Mdouble_BEGIN_NAMESPACE
/* Exponential function of X. */
__MATHCALLI (exp,, (_Mdouble_ __x))
+# if defined _LIBC && defined _Mlong_double_
+libm_hidden_proto(expl)
+# endif
/* Break VALUE into a normalized fraction and an integral power of 2. */
__MATHCALLI (frexp,, (_Mdouble_ __x, int *__exponent))
@@ -173,6 +190,9 @@ _Mdouble_END_NAMESPACE
__BEGIN_NAMESPACE_C99
/* Return `sqrt(X*X + Y*Y)'. */
__MATHCALLI (hypot,, (_Mdouble_ __x, _Mdouble_ __y))
+# if defined _LIBC && defined _Mlong_double_
+libm_hidden_proto(hypotl)
+# endif
__END_NAMESPACE_C99
#endif
@@ -300,6 +320,9 @@ __MATHCALLI (rint,, (_Mdouble_ __x))
/* Return X + epsilon if X < Y, X - epsilon if X > Y. */
__MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__))
+# if defined _LIBC && defined _Mlong_double_
+libm_hidden_proto(nextafterl)
+# endif
# if defined __USE_ISOC99 && !defined __LDBL_COMPAT
# ifndef _Mdouble_is_float_
__MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__))
diff --git a/libc/sysdeps/linux/common/bits/utmp.h b/libc/sysdeps/linux/common/bits/utmp.h
index c13380a..6ece31e 100644
--- a/libc/sysdeps/linux/common/bits/utmp.h
+++ b/libc/sysdeps/linux/common/bits/utmp.h
@@ -36,7 +36,7 @@
previous logins. */
struct lastlog
{
-#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
+#ifdef __WORDSIZE_TIME64_COMPAT32
int32_t ll_time;
#else
__time_t ll_time;
@@ -69,7 +69,7 @@ struct utmp
/* The ut_session and ut_tv fields must be the same size when compiled
32- and 64-bit. This allows data files and shared memory to be
shared between 32- and 64-bit applications. */
-#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
+#ifdef __WORDSIZE_TIME64_COMPAT32
int32_t ut_session; /* Session ID, used for windowing. */
struct
{
diff --git a/libc/sysdeps/linux/common/bits/utmpx.h b/libc/sysdeps/linux/common/bits/utmpx.h
index 87626f0..815fc90 100644
--- a/libc/sysdeps/linux/common/bits/utmpx.h
+++ b/libc/sysdeps/linux/common/bits/utmpx.h
@@ -66,7 +66,7 @@ struct utmpx
/* The fields ut_session and ut_tv must be the same size when compiled
32- and 64-bit. This allows files and shared memory to be shared
between 32- and 64-bit applications. */
-#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
+#ifdef __WORDSIZE_TIME64_COMPAT32
__int32_t ut_session; /* Session ID, used for windowing. */
struct
{
diff --git a/libc/sysdeps/linux/common/getrandom.c b/libc/sysdeps/linux/common/getrandom.c
new file mode 100644
index 0000000..d33d522
--- /dev/null
+++ b/libc/sysdeps/linux/common/getrandom.c
@@ -0,0 +1,14 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * getrandom() for uClibc
+ *
+ * Copyright (C) 2015 Bernhard Reutner-Fischer
+ *
+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
+ */
+
+#include <sys/syscall.h>
+#include <sys/random.h>
+#ifdef __NR_getrandom
+_syscall3(int, getrandom, void *, buf, size_t, buflen, unsigned int, flags)
+#endif
diff --git a/libc/sysdeps/linux/common/getrusage.c b/libc/sysdeps/linux/common/getrusage.c
index 3e719f2..fb7614b 100644
--- a/libc/sysdeps/linux/common/getrusage.c
+++ b/libc/sysdeps/linux/common/getrusage.c
@@ -10,4 +10,5 @@
#include <sys/syscall.h>
#include <unistd.h>
#include <wait.h>
+#include <sys/resource.h>
_syscall2(int, getrusage, __rusage_who_t, who, struct rusage *, usage)
diff --git a/libc/sysdeps/linux/arm/aeabi_unwind_cpp_pr1.c b/libc/sysdeps/linux/common/makedev.c
similarity index 51%
copy from libc/sysdeps/linux/arm/aeabi_unwind_cpp_pr1.c
copy to libc/sysdeps/linux/common/makedev.c
index a5cd73f..d776167 100644
--- a/libc/sysdeps/linux/arm/aeabi_unwind_cpp_pr1.c
+++ b/libc/sysdeps/linux/common/makedev.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Definitions of functions to access `dev_t' values.
+ Copyright (C) 2003-2015 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
@@ -15,25 +16,27 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Because some objects in ld.so and libc.so are built with
- -fexceptions, we end up with references to this personality
- routine. However, these libraries are not linked against
- libgcc_eh.a, so we need a dummy definition. This routine will
- never actually be called. */
+#include <endian.h>
+#include <sys/sysmacros.h>
-#include <stdlib.h>
-
-attribute_hidden void __aeabi_unwind_cpp_pr0 (void);
-attribute_hidden void __aeabi_unwind_cpp_pr0 (void)
+unsigned int
+gnu_dev_major (unsigned long long int dev)
{
+ return ((dev >> 8) & 0xfff) | ((unsigned int) (dev >> 32) & ~0xfff);
}
+libc_hidden_def(gnu_dev_major)
-attribute_hidden void __aeabi_unwind_cpp_pr1 (void);
-attribute_hidden void __aeabi_unwind_cpp_pr1 (void)
+unsigned int
+gnu_dev_minor (unsigned long long int dev)
{
+ return (dev & 0xff) | ((unsigned int) (dev >> 12) & ~0xff);
}
+libc_hidden_def(gnu_dev_minor)
-attribute_hidden void __aeabi_unwind_cpp_pr2 (void);
-attribute_hidden void __aeabi_unwind_cpp_pr2 (void)
+unsigned long long int
+gnu_dev_makedev (unsigned int major, unsigned int minor)
{
+ return ((minor & 0xff) | ((major & 0xfff) << 8)
+ | (((unsigned long long int) (minor & ~0xff)) << 12)
+ | (((unsigned long long int) (major & ~0xfff)) << 32));
}
diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c
index 2c50307..19a3371 100644
--- a/libc/sysdeps/linux/common/stubs.c
+++ b/libc/sysdeps/linux/common/stubs.c
@@ -157,6 +157,10 @@ make_stub(getpeername)
make_stub(getpgrp)
#endif
+#if !defined __NR_getrandom && defined __UCLIBC_LINUX_SPECIFIC__
+make_stub(getrandom)
+#endif
+
#if !defined __NR_getsockname && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
make_stub(getsockname)
#endif
diff --git a/libc/sysdeps/linux/common/sys/random.h b/libc/sysdeps/linux/common/sys/random.h
new file mode 100644
index 0000000..42f8025
--- /dev/null
+++ b/libc/sysdeps/linux/common/sys/random.h
@@ -0,0 +1,33 @@
+/* Copyright (C) 2015 Bernhard Reutner-Fischer
+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
+*/
+
+#ifndef _SYS_RANDOM_H
+#define _SYS_RANDOM_H 1
+#include <features.h>
+
+__BEGIN_DECLS
+
+#if defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU
+# if 0 /*def __ASSUME_GETRANDOM_SYSCALL */
+# include <linux/random.h>
+# else
+# undef GRND_NONBLOCK
+# undef GRND_RANDOM
+/*
+ * Flags for getrandom(2)
+ *
+ * GRND_NONBLOCK Don't block and return EAGAIN instead
+ * GRND_RANDOM Use the /dev/random pool instead of /dev/urandom
+ */
+# define GRND_NONBLOCK 0x0001
+# define GRND_RANDOM 0x0002
+# endif
+/* FIXME: aren't there a couple of __restrict and const missing ? */
+extern int getrandom(void *__buf, size_t count, unsigned int flags)
+ __nonnull ((1)) __wur;
+#endif
+
+__END_DECLS
+
+#endif /* sys/random.h */
diff --git a/libc/sysdeps/linux/mips/bits/mathdef.h b/libc/sysdeps/linux/mips/bits/mathdef.h
index 1c636a1..6afe20d 100644
--- a/libc/sysdeps/linux/mips/bits/mathdef.h
+++ b/libc/sysdeps/linux/mips/bits/mathdef.h
@@ -25,10 +25,9 @@
#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
# define _MATH_H_MATHDEF 1
-/* Normally, there is no long double type and the `float' and `double'
- expressions are evaluated as `double'. */
-typedef double float_t; /* `float' expressions are evaluated as
- `double'. */
+/* MIPS has both `float' and `double' arithmetic. */
+typedef float float_t; /* `float' expressions are evaluated as
+ `float'. */
typedef double double_t; /* `double' expressions are evaluated as
`double'. */
diff --git a/libc/sysdeps/linux/mips/bits/wordsize.h b/libc/sysdeps/linux/mips/bits/wordsize.h
index 39e1506..fe13080 100644
--- a/libc/sysdeps/linux/mips/bits/wordsize.h
+++ b/libc/sysdeps/linux/mips/bits/wordsize.h
@@ -16,3 +16,6 @@
<http://www.gnu.org/licenses/>. */
#define __WORDSIZE _MIPS_SZPTR
+#if _MIPS_SIM == _ABI64
+# define __WORDSIZE_TIME64_COMPAT32 1
+#endif
diff --git a/libc/sysdeps/linux/powerpc/bits/wordsize.h b/libc/sysdeps/linux/powerpc/bits/wordsize.h
index cf93423..3e8a1e0 100644
--- a/libc/sysdeps/linux/powerpc/bits/wordsize.h
+++ b/libc/sysdeps/linux/powerpc/bits/wordsize.h
@@ -2,7 +2,7 @@
#if defined __powerpc64__
# define __WORDSIZE 64
-# define __WORDSIZE_COMPAT32 1
+# define __WORDSIZE_TIME64_COMPAT32 1
#else
# define __WORDSIZE 32
#endif
diff --git a/libc/sysdeps/linux/sh/bits/atomic.h b/libc/sysdeps/linux/sh/bits/atomic.h
index 745c85c..18ae9ea 100644
--- a/libc/sysdeps/linux/sh/bits/atomic.h
+++ b/libc/sysdeps/linux/sh/bits/atomic.h
@@ -68,6 +68,12 @@ typedef uintmax_t uatomic_max_t;
r1: saved stack pointer
*/
+#if __GNUC_PREREQ (4, 7)
+# define rNOSP "u"
+#else
+# define rNOSP "r"
+#endif
+
/* Avoid having lots of different versions of compare and exchange,
by having this one complicated version. Parameters:
bwl: b, w or l for 8, 16 and 32 bit versions.
@@ -94,7 +100,7 @@ typedef uintmax_t uatomic_max_t;
movt %0\n\
.endif\n" \
: "=&r" (__arch_result) \
- : "r" (mem), "r" (newval), "r" (oldval) \
+ : rNOSP (mem), rNOSP (newval), rNOSP (oldval) \
: "r0", "r1", "t", "memory"); \
__arch_result; })
@@ -150,7 +156,7 @@ typedef uintmax_t uatomic_max_t;
mov." #bwl " %1,@%2\n\
1: mov r1,r15" \
: "=&r" (old), "=&r"(new) \
- : "r" (mem), "r" (value) \
+ : rNOSP (mem), rNOSP (value) \
: "r0", "r1", "memory"); \
})
@@ -194,7 +200,7 @@ typedef uintmax_t uatomic_max_t;
mov." #bwl " %0,@%1\n\
1: mov r1,r15" \
: "=&r" (__new) \
- : "r" (mem), "r" (__value) \
+ : rNOSP (mem), rNOSP (__value) \
: "r0", "r1", "memory"); \
__new; \
})
diff --git a/libc/sysdeps/linux/sh/bits/syscalls.h b/libc/sysdeps/linux/sh/bits/syscalls.h
index b308276..efd423e 100644
--- a/libc/sysdeps/linux/sh/bits/syscalls.h
+++ b/libc/sysdeps/linux/sh/bits/syscalls.h
@@ -122,7 +122,7 @@
__asm__ __volatile__ (SYSCALL_INST_STR##nr SYSCALL_INST_PAD \
: "=z" (resultvar) \
: "r" (r3) ASMFMT_##nr \
- : "memory" \
+ : "memory", "t" \
); \
(int) resultvar; \
}) \
diff --git a/libc/sysdeps/linux/sparc/bits/wordsize.h b/libc/sysdeps/linux/sparc/bits/wordsize.h
index c0e600e..aa15dbc 100644
--- a/libc/sysdeps/linux/sparc/bits/wordsize.h
+++ b/libc/sysdeps/linux/sparc/bits/wordsize.h
@@ -2,6 +2,7 @@
#if defined __arch64__ || defined __sparcv9
# define __WORDSIZE 64
+# define __WORDSIZE_TIME64_COMPAT32 1
#else
# define __WORDSIZE 32
#endif
diff --git a/libc/sysdeps/linux/x86_64/bits/wordsize.h b/libc/sysdeps/linux/x86_64/bits/wordsize.h
index e555241..9db982c 100644
--- a/libc/sysdeps/linux/x86_64/bits/wordsize.h
+++ b/libc/sysdeps/linux/x86_64/bits/wordsize.h
@@ -1,9 +1,12 @@
/* Determine the wordsize from the preprocessor defines. */
-#if defined __x86_64__
+#if defined __x86_64__ && !defined __ILP32__
# define __WORDSIZE 64
-/* This makes /var/run/utmp compatible with 32-bit environment: */
-# define __WORDSIZE_COMPAT32 1
#else
# define __WORDSIZE 32
#endif
+
+#ifdef __x86_64__
+/* This makes /var/run/utmp compatible with 32-bit environment: */
+# define __WORDSIZE_TIME64_COMPAT32 1
+#endif
diff --git a/libcrypt/sha256.c b/libcrypt/sha256.c
index 6bc2d8b..3e12b5c 100644
--- a/libcrypt/sha256.c
+++ b/libcrypt/sha256.c
@@ -108,12 +108,12 @@ sha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx)
uint32_t h_save = h;
/* Operators defined in FIPS 180-2:4.1.2. */
-#define Ch(x, y, z) ((x & y) ^ (~x & z))
-#define Maj(x, y, z) ((x & y) ^ (x & z) ^ (y & z))
-#define S0(x) (CYCLIC (x, 2) ^ CYCLIC (x, 13) ^ CYCLIC (x, 22))
-#define S1(x) (CYCLIC (x, 6) ^ CYCLIC (x, 11) ^ CYCLIC (x, 25))
-#define R0(x) (CYCLIC (x, 7) ^ CYCLIC (x, 18) ^ (x >> 3))
-#define R1(x) (CYCLIC (x, 17) ^ CYCLIC (x, 19) ^ (x >> 10))
+#define _Ch(x, y, z) ((x & y) ^ (~x & z))
+#define _Maj(x, y, z) ((x & y) ^ (x & z) ^ (y & z))
+#define _S0(x) (CYCLIC (x, 2) ^ CYCLIC (x, 13) ^ CYCLIC (x, 22))
+#define _S1(x) (CYCLIC (x, 6) ^ CYCLIC (x, 11) ^ CYCLIC (x, 25))
+#define _R0(x) (CYCLIC (x, 7) ^ CYCLIC (x, 18) ^ (x >> 3))
+#define _R1(x) (CYCLIC (x, 17) ^ CYCLIC (x, 19) ^ (x >> 10))
/* It is unfortunate that C does not provide an operator for
cyclic rotation. Hope the C compiler is smart enough. */
@@ -126,13 +126,13 @@ sha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx)
++words;
}
for (unsigned int t = 16; t < 64; ++t)
- W[t] = R1 (W[t - 2]) + W[t - 7] + R0 (W[t - 15]) + W[t - 16];
+ W[t] = _R1 (W[t - 2]) + W[t - 7] + _R0 (W[t - 15]) + W[t - 16];
/* The actual computation according to FIPS 180-2:6.2.2 step 3. */
for (unsigned int t = 0; t < 64; ++t)
{
- uint32_t T1 = h + S1 (e) + Ch (e, f, g) + K[t] + W[t];
- uint32_t T2 = S0 (a) + Maj (a, b, c);
+ uint32_t T1 = h + _S1 (e) + _Ch (e, f, g) + K[t] + W[t];
+ uint32_t T2 = _S0 (a) + _Maj (a, b, c);
h = g;
g = f;
f = e;
diff --git a/libcrypt/sha512.c b/libcrypt/sha512.c
index 079caee..b2e36a3 100644
--- a/libcrypt/sha512.c
+++ b/libcrypt/sha512.c
@@ -139,12 +139,12 @@ sha512_process_block (const void *buffer, size_t len, struct sha512_ctx *ctx)
uint64_t h_save = h;
/* Operators defined in FIPS 180-2:4.1.2. */
-#define Ch(x, y, z) ((x & y) ^ (~x & z))
-#define Maj(x, y, z) ((x & y) ^ (x & z) ^ (y & z))
-#define S0(x) (CYCLIC (x, 28) ^ CYCLIC (x, 34) ^ CYCLIC (x, 39))
-#define S1(x) (CYCLIC (x, 14) ^ CYCLIC (x, 18) ^ CYCLIC (x, 41))
-#define R0(x) (CYCLIC (x, 1) ^ CYCLIC (x, 8) ^ (x >> 7))
-#define R1(x) (CYCLIC (x, 19) ^ CYCLIC (x, 61) ^ (x >> 6))
+#define _Ch(x, y, z) ((x & y) ^ (~x & z))
+#define _Maj(x, y, z) ((x & y) ^ (x & z) ^ (y & z))
+#define _S0(x) (CYCLIC (x, 28) ^ CYCLIC (x, 34) ^ CYCLIC (x, 39))
+#define _S1(x) (CYCLIC (x, 14) ^ CYCLIC (x, 18) ^ CYCLIC (x, 41))
+#define _R0(x) (CYCLIC (x, 1) ^ CYCLIC (x, 8) ^ (x >> 7))
+#define _R1(x) (CYCLIC (x, 19) ^ CYCLIC (x, 61) ^ (x >> 6))
/* It is unfortunate that C does not provide an operator for
cyclic rotation. Hope the C compiler is smart enough. */
@@ -157,13 +157,13 @@ sha512_process_block (const void *buffer, size_t len, struct sha512_ctx *ctx)
++words;
}
for (unsigned int t = 16; t < 80; ++t)
- W[t] = R1 (W[t - 2]) + W[t - 7] + R0 (W[t - 15]) + W[t - 16];
+ W[t] = _R1 (W[t - 2]) + W[t - 7] + _R0 (W[t - 15]) + W[t - 16];
/* The actual computation according to FIPS 180-2:6.3.2 step 3. */
for (unsigned int t = 0; t < 80; ++t)
{
- uint64_t T1 = h + S1 (e) + Ch (e, f, g) + K[t] + W[t];
- uint64_t T2 = S0 (a) + Maj (a, b, c);
+ uint64_t T1 = h + _S1 (e) + _Ch (e, f, g) + K[t] + W[t];
+ uint64_t T2 = _S0 (a) + _Maj (a, b, c);
h = g;
g = f;
f = e;
diff --git a/libm/Makefile.in b/libm/Makefile.in
index 7511706..d886cdb 100644
--- a/libm/Makefile.in
+++ b/libm/Makefile.in
@@ -75,9 +75,6 @@ libm_CSRC := \
s_remquo.c w_exp2.c \
cexp.c sincos.c
-# Not implemented [yet?], see comment in float_wrappers.c:
-# fdimf.o fmaf.o fmaxf.o fminf.o
-# nearbyintf.o remquof.o scalblnf.o tgammaf.o
FL_MOBJ := \
acosf.o \
acoshf.o \
@@ -98,7 +95,11 @@ FL_MOBJ := \
expf.o \
expm1f.o \
fabsf.o \
+ fdimf.o \
floorf.o \
+ fmaf.o \
+ fmaxf.o \
+ fminf.o \
fmodf.o \
frexpf.o \
gammaf.o \
@@ -116,11 +117,14 @@ FL_MOBJ := \
lrintf.o \
lroundf.o \
modff.o \
+ nearbyintf.o \
+ nexttowardf.o \
powf.o \
remainderf.o \
+ remquof.o \
rintf.o \
roundf.o \
- scalbf.o \
+ scalblnf.o \
scalbnf.o \
significandf.o \
sinf.o \
@@ -128,9 +132,24 @@ FL_MOBJ := \
sqrtf.o \
tanf.o \
tanhf.o \
+ tgammaf.o \
truncf.o \
-# Not implemented [yet?]: nexttowardl.o
+ifeq ($(UCLIBC_SUSV3_LEGACY),y)
+FL_MOBJ += scalbf.o
+endif
+
+# Do not (yet?) implement the float variants of bessel functions
+ifeq (not-yet-implemented-$(DO_XSI_MATH),y)
+FL_MOBJ += \
+ j0f.o \
+ j1f.o \
+ jnf.o \
+ y0f.o \
+ y1f.o \
+ ynf.o
+endif
+
LD_MOBJ := \
__finitel.o \
__fpclassifyl.o \
@@ -180,6 +199,7 @@ LD_MOBJ := \
modfl.o \
nearbyintl.o \
nextafterl.o \
+ nexttowardl.o \
powl.o \
remainderl.o \
remquol.o \
@@ -196,6 +216,17 @@ LD_MOBJ := \
tgammal.o \
truncl.o \
+# Do not (yet?) implement the long double variants of bessel functions
+ifeq (not-yet-implemented-$(DO_XSI_MATH),y)
+LD_MOBJ += \
+ j0l.o \
+ j1l.o \
+ jnl.o \
+ y0l.o \
+ y1l.o \
+ ynl.o
+endif
+
else
# This list of math functions was taken from POSIX/IEEE 1003.1b-1993
diff --git a/libm/float_wrappers.c b/libm/float_wrappers.c
index 82b7963..105486e 100644
--- a/libm/float_wrappers.c
+++ b/libm/float_wrappers.c
@@ -38,19 +38,14 @@ long long func##f (float x) \
return func((double)x); \
}
-
-/* For the time being, do _NOT_ implement these functions
- * that are defined by SuSv3 [because we don't need them
- * and nobody asked to include them] */
-#undef L_fdimf /*float fdimf(float, float);*/
-#undef L_fmaf /*float fmaf(float, float, float);*/
-#undef L_fmaxf /*float fmaxf(float, float);*/
-#undef L_fminf /*float fminf(float, float);*/
-#undef L_nearbyintf /*float nearbyintf(float);*/
-#undef L_nexttowardf /*float nexttowardf(float, long double);*/
-#undef L_remquof /*float remquof(float, float, int *);*/
-#undef L_scalblnf /*float scalblnf(float, long);*/
-#undef L_tgammaf /*float tgammaf(float);*/
+#ifndef __DO_XSI_MATH__
+# undef L_j0f /* float j0f(float x); */
+# undef L_j1f /* float j1f(float x); */
+# undef L_jnf /* float jnf(int n, float x); */
+# undef L_y0f /* float y0f(float x); */
+# undef L_y1f /* float y1f(float x); */
+# undef L_ynf /* float ynf(int n, float x); */
+#endif
/* Implement the following, as defined by SuSv3 */
#if 0
@@ -155,6 +150,7 @@ float copysignf (float x, float y)
#ifdef L_cosf
WRAPPER1(cos)
+libm_hidden_def(cosf)
#endif
#ifdef L_coshf
@@ -242,6 +238,21 @@ float hypotf (float x, float y)
int_WRAPPER1(ilogb)
#endif
+#ifdef L_j0f
+WRAPPER1(j0)
+#endif
+
+#ifdef L_j1f
+WRAPPER1(j1)
+#endif
+
+#ifdef L_jnf
+float jnf(int n, float x)
+{
+ return (float) jn(n, (double)x);
+}
+#endif
+
#ifdef L_ldexpf
float ldexpf (float x, int _exp)
{
@@ -306,7 +317,7 @@ WRAPPER1(nearbyint)
#ifdef L_nexttowardf
float nexttowardf (float x, long double y)
{
- return (float) nexttoward( (double)x, (double)y );
+ return (float) nexttoward( (double)x, (long double)y );
}
#endif
@@ -355,6 +366,7 @@ float scalbnf (float x, int _exp)
#ifdef L_sinf
WRAPPER1(sin)
+libm_hidden_def(sinf)
#endif
#ifdef L_sinhf
@@ -381,13 +393,6 @@ WRAPPER1(tgamma)
WRAPPER1(trunc)
#endif
-#ifdef L_fmaf
-float fmaf (float x, float y, float z)
-{
- return (float) fma( (double)x, (double)y, (double)z );
-}
-#endif
-
#if defined L_scalbf && defined __UCLIBC_SUSV3_LEGACY__
float scalbf (float x, float y)
{
@@ -402,3 +407,18 @@ WRAPPER1(gamma)
#ifdef L_significandf
WRAPPER1(significand)
#endif
+
+#ifdef L_y0f
+WRAPPER1(y0)
+#endif
+
+#ifdef L_y1f
+WRAPPER1(y1)
+#endif
+
+#ifdef L_ynf
+float ynf(int n, float x)
+{
+ return (float) yn(n, (double)x);
+}
+#endif
diff --git a/libm/ldouble_wrappers.c b/libm/ldouble_wrappers.c
index 118a78f..840293f 100644
--- a/libm/ldouble_wrappers.c
+++ b/libm/ldouble_wrappers.c
@@ -16,32 +16,42 @@
#include "math.h"
#include <complex.h>
-#define WRAPPER1(func) \
+#if !defined __NO_LONG_DOUBLE_MATH
+# define WRAPPER1(func) \
long double func##l(long double x) \
{ \
return (long double) func((double) x); \
}
-#define WRAPPER2(func) \
+# define WRAPPER2(func) \
long double func##l(long double x, long double y) \
{ \
return (long double) func((double) x, (double) y); \
}
-#define int_WRAPPER1(func) \
+# define int_WRAPPER1(func) \
int func##l(long double x) \
{ \
return func((double) x); \
}
-#define long_WRAPPER1(func) \
+# define long_WRAPPER1(func) \
long func##l(long double x) \
{ \
return func((double) x); \
}
-#define long_long_WRAPPER1(func) \
+# define long_long_WRAPPER1(func) \
long long func##l(long double x) \
{ \
return func((double) x); \
}
+#ifndef __DO_XSI_MATH__
+# undef L_j0l /* long double j0l(long double x); */
+# undef L_j1l /* long double j1l(long double x); */
+# undef L_jnl /* long double jnl(int n, long double x); */
+# undef L_y0l /* long double y0l(long double x); */
+# undef L_y1l /* long double y1l(long double x); */
+# undef L_ynl /* long double ynl(int n, long double x); */
+#endif
+
/* Implement the following, as defined by SuSv3 */
#if 0
long double acoshl(long double);
@@ -156,6 +166,7 @@ WRAPPER1(cosh)
#ifdef L_cosl
WRAPPER1(cos)
+libm_hidden_def(cosl)
#endif
#ifdef L_erfcl
@@ -172,6 +183,7 @@ WRAPPER1(exp2)
#ifdef L_expl
WRAPPER1(exp)
+libm_hidden_def(expl)
#endif
#ifdef L_expm1l
@@ -222,12 +234,28 @@ WRAPPER1(gamma)
#ifdef L_hypotl
WRAPPER2(hypot)
+libm_hidden_def(hypotl)
#endif
#ifdef L_ilogbl
int_WRAPPER1(ilogb)
#endif
+#ifdef L_j0l
+ WRAPPER1(j0)
+#endif
+
+#ifdef L_j1l
+ WRAPPER1(j1)
+#endif
+
+#ifdef L_jnl
+long double jnl(int n, long double x)
+{
+ return (long double) jn(n, (double)x);
+}
+#endif
+
#ifdef L_ldexpl
long double ldexpl (long double x, int ex)
{
@@ -291,12 +319,18 @@ WRAPPER1(nearbyint)
#ifdef L_nextafterl
WRAPPER2(nextafter)
+libm_hidden_def(nextafterl)
#endif
-/* Disabled in Makefile.in */
-#if 0 /* def L_nexttowardl */
-WRAPPER2(nexttoward)
-libm_hidden_def(nexttowardl)
+#ifdef L_nexttowardl
+# if 0 /* TODO */
+strong_alias(nextafterl, nexttowardl)
+# else
+long double nexttowardl(long double x, long double y)
+{
+ return nextafterl(x, y);
+}
+#endif
#endif
#ifdef L_powl
@@ -344,6 +378,7 @@ WRAPPER1(sinh)
#ifdef L_sinl
WRAPPER1(sin)
+libm_hidden_def(sinl)
#endif
#ifdef L_sqrtl
@@ -370,6 +405,22 @@ WRAPPER1(trunc)
WRAPPER1(significand)
#endif
+#ifdef L_y0l
+WRAPPER1(y0)
+#endif
+
+#ifdef L_y1l
+WRAPPER1(y1)
+#endif
+
+#ifdef L_ynl
+long double ynl(int n, long double x)
+{
+ return (long double) yn(n, (double)x);
+}
+#endif
+
+
#if defined __DO_C99_MATH__ && !defined __NO_LONG_DOUBLE_MATH
# ifdef L___fpclassifyl
@@ -397,4 +448,6 @@ int_WRAPPER1(__isinf)
libm_hidden_def(__isinfl)
# endif
-#endif
+#endif /* __DO_C99_MATH__ */
+
+#endif /* __NO_LONG_DOUBLE_MATH */
diff --git a/libm/s_fdim.c b/libm/s_fdim.c
index 6249219..6ed695c 100644
--- a/libm/s_fdim.c
+++ b/libm/s_fdim.c
@@ -6,13 +6,22 @@
#include "math.h"
#include "math_private.h"
+#include <errno.h>
double fdim(double x, double y)
{
- int c = __fpclassify(x);
- if (c == FP_NAN || c == FP_INFINITE)
- return HUGE_VAL;
+ int cx = __fpclassify(x); /* need both NAN and INF */
+ int cy = __fpclassify(y); /* need both NAN and INF */
+ if (cx == FP_NAN || cy == NAN)
+ return x - y;
- return x > y ? x - y : 0.0;
+ if (x <= y)
+ return .0;
+
+ double z = x - y;
+ if (isinf(z) && cx != FP_INFINITE && cy != FP_INFINITE)
+ __set_errno(ERANGE);
+
+ return z;
}
libm_hidden_def(fdim)
diff --git a/libm/s_fmax.c b/libm/s_fmax.c
index 21dfaa9..5f29ad8 100644
--- a/libm/s_fmax.c
+++ b/libm/s_fmax.c
@@ -9,10 +9,10 @@
double fmax(double x, double y)
{
- if (__fpclassify(x) == FP_NAN)
- return x;
- if (__fpclassify(y) == FP_NAN)
+ if (isnan(x))
return y;
+ if (isnan(y))
+ return x;
return x > y ? x : y;
}
diff --git a/libm/s_fmin.c b/libm/s_fmin.c
index 674d9a5..a549678 100644
--- a/libm/s_fmin.c
+++ b/libm/s_fmin.c
@@ -9,10 +9,10 @@
double fmin(double x, double y)
{
- if (__fpclassify(x) == FP_NAN)
- return x;
- if (__fpclassify(y) == FP_NAN)
+ if (isnan(x))
return y;
+ if (isnan(y))
+ return x;
return x < y ? x : y;
}
diff --git a/libm/s_nextafter.c b/libm/s_nextafter.c
index ee4621c..73a8ab2 100644
--- a/libm/s_nextafter.c
+++ b/libm/s_nextafter.c
@@ -32,7 +32,7 @@ double nextafter(double x, double y)
if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) || /* x is nan */
((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0)) /* y is nan */
return x+y;
- if(x==y) return x; /* x=y, return x */
+ if(x==y) return y; /* x=y, return y */
if((ix|lx)==0) { /* x == 0 */
INSERT_WORDS(x,hy&0x80000000,1); /* return +-minsubnormal */
y = x*x;
@@ -68,3 +68,5 @@ double nextafter(double x, double y)
return x;
}
libm_hidden_def(nextafter)
+strong_alias_untyped(nextafter, nexttoward)
+libm_hidden_def(nexttoward)
diff --git a/libpthread/linuxthreads.old/semaphore.h b/libpthread/linuxthreads.old/semaphore.h
index 9a9b72c..3924a47 100644
--- a/libpthread/linuxthreads.old/semaphore.h
+++ b/libpthread/linuxthreads.old/semaphore.h
@@ -82,10 +82,10 @@ extern int sem_timedwait (sem_t *__restrict __sem,
#endif
/* Test whether SEM is posted. */
-extern int sem_trywait (sem_t *__sem) __THROW;
+extern int sem_trywait (sem_t *__sem) __THROWNL;
/* Post SEM. */
-extern int sem_post (sem_t *__sem) __THROW;
+extern int sem_post (sem_t *__sem) __THROWNL;
/* Get current value of SEM and store it in *SVAL. */
extern int sem_getvalue (sem_t *__restrict __sem, int *__restrict __sval)
diff --git a/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h b/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h
index 46c1010..879bcea 100644
--- a/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h
+++ b/libpthread/linuxthreads.old/sysdeps/pthread/pthread.h
@@ -163,7 +163,7 @@ enum
extern int pthread_create (pthread_t *__restrict __threadp,
const pthread_attr_t *__restrict __attr,
void *(*__start_routine) (void *),
- void *__restrict __arg) __THROW;
+ void *__restrict __arg) __THROWNL;
/* Obtain the identifier of the current thread. */
extern pthread_t pthread_self (void) __THROW;
@@ -340,20 +340,20 @@ extern int pthread_mutex_init (pthread_mutex_t *__restrict __mutex,
extern int pthread_mutex_destroy (pthread_mutex_t *__mutex) __THROW;
/* Try to lock MUTEX. */
-extern int pthread_mutex_trylock (pthread_mutex_t *__mutex) __THROW;
+extern int pthread_mutex_trylock (pthread_mutex_t *__mutex) __THROWNL;
/* Wait until lock for MUTEX becomes available and lock it. */
-extern int pthread_mutex_lock (pthread_mutex_t *__mutex) __THROW;
+extern int pthread_mutex_lock (pthread_mutex_t *__mutex) __THROWNL;
#ifdef __USE_XOPEN2K
/* Wait until lock becomes available, or specified time passes. */
extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
const struct timespec *__restrict
- __abstime) __THROW;
+ __abstime) __THROWNL;
#endif
/* Unlock MUTEX. */
-extern int pthread_mutex_unlock (pthread_mutex_t *__mutex) __THROW;
+extern int pthread_mutex_unlock (pthread_mutex_t *__mutex) __THROWNL;
/* Functions for handling mutex attributes. */
@@ -401,11 +401,11 @@ extern int pthread_cond_destroy (pthread_cond_t *__cond) __THROW;
libpthread_hidden_proto(pthread_cond_destroy)
/* Wake up one thread waiting for condition variable COND. */
-extern int pthread_cond_signal (pthread_cond_t *__cond) __THROW;
+extern int pthread_cond_signal (pthread_cond_t *__cond) __THROWNL;
libpthread_hidden_proto(pthread_cond_signal)
/* Wake up all threads waiting for condition variables COND. */
-extern int pthread_cond_broadcast (pthread_cond_t *__cond) __THROW;
+extern int pthread_cond_broadcast (pthread_cond_t *__cond) __THROWNL;
libpthread_hidden_proto(pthread_cond_broadcast)
/* Wait for condition variable COND to be signaled or broadcast.
@@ -457,33 +457,33 @@ extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock,
extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock) __THROW;
/* Acquire read lock for RWLOCK. */
-extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock) __THROW;
+extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock) __THROWNL;
/* Try to acquire read lock for RWLOCK. */
-extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock) __THROW;
+extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock) __THROWNL;
# ifdef __USE_XOPEN2K
/* Try to acquire read lock for RWLOCK or return after specfied time. */
extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
const struct timespec *__restrict
- __abstime) __THROW;
+ __abstime) __THROWNL;
# endif
/* Acquire write lock for RWLOCK. */
-extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock) __THROW;
+extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock) __THROWNL;
/* Try to acquire write lock for RWLOCK. */
-extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock) __THROW;
+extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock) __THROWNL;
# ifdef __USE_XOPEN2K
/* Try to acquire write lock for RWLOCK or return after specfied time. */
extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
const struct timespec *__restrict
- __abstime) __THROW;
+ __abstime) __THROWNL;
# endif
/* Unlock RWLOCK. */
-extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock) __THROW;
+extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock) __THROWNL;
/* Functions for handling read-write lock attributes. */
@@ -528,13 +528,13 @@ extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared)
extern int pthread_spin_destroy (pthread_spinlock_t *__lock) __THROW;
/* Wait until spinlock LOCK is retrieved. */
-extern int pthread_spin_lock (pthread_spinlock_t *__lock) __THROW;
+extern int pthread_spin_lock (pthread_spinlock_t *__lock) __THROWNL;
/* Try to lock spinlock LOCK. */
-extern int pthread_spin_trylock (pthread_spinlock_t *__lock) __THROW;
+extern int pthread_spin_trylock (pthread_spinlock_t *__lock) __THROWNL;
/* Release spinlock LOCK. */
-extern int pthread_spin_unlock (pthread_spinlock_t *__lock) __THROW;
+extern int pthread_spin_unlock (pthread_spinlock_t *__lock) __THROWNL;
/* Barriers are a also a new feature in 1003.1j-2000. */
@@ -556,7 +556,7 @@ extern int pthread_barrierattr_getpshared (const pthread_barrierattr_t *
extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr,
int __pshared) __THROW;
-extern int pthread_barrier_wait (pthread_barrier_t *__barrier) __THROW;
+extern int pthread_barrier_wait (pthread_barrier_t *__barrier) __THROWNL;
#endif
#endif
diff --git a/libpthread/linuxthreads/semaphore.h b/libpthread/linuxthreads/semaphore.h
index 7f3dbad..7ab772b 100644
--- a/libpthread/linuxthreads/semaphore.h
+++ b/libpthread/linuxthreads/semaphore.h
@@ -82,10 +82,10 @@ extern int sem_timedwait (sem_t *__restrict __sem,
#endif
/* Test whether SEM is posted. */
-extern int sem_trywait (sem_t *__sem) __THROW;
+extern int sem_trywait (sem_t *__sem) __THROWNL;
/* Post SEM. */
-extern int sem_post (sem_t *__sem) __THROW;
+extern int sem_post (sem_t *__sem) __THROWNL;
/* Get current value of SEM and store it in *SVAL. */
extern int sem_getvalue (sem_t *__restrict __sem, int *__restrict __sval)
diff --git a/libpthread/linuxthreads/sysdeps/pthread/pthread.h b/libpthread/linuxthreads/sysdeps/pthread/pthread.h
index 94ed95c..df01c11 100644
--- a/libpthread/linuxthreads/sysdeps/pthread/pthread.h
+++ b/libpthread/linuxthreads/sysdeps/pthread/pthread.h
@@ -163,7 +163,7 @@ enum
extern int pthread_create (pthread_t *__restrict __threadp,
const pthread_attr_t *__restrict __attr,
void *(*__start_routine) (void *),
- void *__restrict __arg) __THROW;
+ void *__restrict __arg) __THROWNL;
/* Obtain the identifier of the current thread. */
extern pthread_t pthread_self (void) __THROW;
@@ -331,20 +331,20 @@ extern int pthread_mutex_init (pthread_mutex_t *__restrict __mutex,
extern int pthread_mutex_destroy (pthread_mutex_t *__mutex) __THROW;
/* Try to lock MUTEX. */
-extern int pthread_mutex_trylock (pthread_mutex_t *__mutex) __THROW;
+extern int pthread_mutex_trylock (pthread_mutex_t *__mutex) __THROWNL;
/* Wait until lock for MUTEX becomes available and lock it. */
-extern int pthread_mutex_lock (pthread_mutex_t *__mutex) __THROW;
+extern int pthread_mutex_lock (pthread_mutex_t *__mutex) __THROWNL;
#ifdef __USE_XOPEN2K
/* Wait until lock becomes available, or specified time passes. */
extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
const struct timespec *__restrict
- __abstime) __THROW;
+ __abstime) __THROWNL;
#endif
/* Unlock MUTEX. */
-extern int pthread_mutex_unlock (pthread_mutex_t *__mutex) __THROW;
+extern int pthread_mutex_unlock (pthread_mutex_t *__mutex) __THROWNL;
/* Functions for handling mutex attributes. */
@@ -390,10 +390,10 @@ extern int pthread_cond_init (pthread_cond_t *__restrict __cond,
extern int pthread_cond_destroy (pthread_cond_t *__cond) __THROW;
/* Wake up one thread waiting for condition variable COND. */
-extern int pthread_cond_signal (pthread_cond_t *__cond) __THROW;
+extern int pthread_cond_signal (pthread_cond_t *__cond) __THROWNL;
/* Wake up all threads waiting for condition variables COND. */
-extern int pthread_cond_broadcast (pthread_cond_t *__cond) __THROW;
+extern int pthread_cond_broadcast (pthread_cond_t *__cond) __THROWNL;
/* Wait for condition variable COND to be signaled or broadcast.
MUTEX is assumed to be locked before. */
@@ -440,33 +440,33 @@ extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock,
extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock) __THROW;
/* Acquire read lock for RWLOCK. */
-extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock) __THROW;
+extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock) __THROWNL;
/* Try to acquire read lock for RWLOCK. */
-extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock) __THROW;
+extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock) __THROWNL;
# ifdef __USE_XOPEN2K
/* Try to acquire read lock for RWLOCK or return after specfied time. */
extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
const struct timespec *__restrict
- __abstime) __THROW;
+ __abstime) __THROWNL;
# endif
/* Acquire write lock for RWLOCK. */
-extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock) __THROW;
+extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock) __THROWNL;
/* Try to acquire write lock for RWLOCK. */
-extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock) __THROW;
+extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock) __THROWNL;
# ifdef __USE_XOPEN2K
/* Try to acquire write lock for RWLOCK or return after specfied time. */
extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
const struct timespec *__restrict
- __abstime) __THROW;
+ __abstime) __THROWNL;
# endif
/* Unlock RWLOCK. */
-extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock) __THROW;
+extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock) __THROWNL;
/* Functions for handling read-write lock attributes. */
@@ -508,13 +508,13 @@ extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared)
extern int pthread_spin_destroy (pthread_spinlock_t *__lock) __THROW;
/* Wait until spinlock LOCK is retrieved. */
-extern int pthread_spin_lock (pthread_spinlock_t *__lock) __THROW;
+extern int pthread_spin_lock (pthread_spinlock_t *__lock) __THROWNL;
/* Try to lock spinlock LOCK. */
-extern int pthread_spin_trylock (pthread_spinlock_t *__lock) __THROW;
+extern int pthread_spin_trylock (pthread_spinlock_t *__lock) __THROWNL;
/* Release spinlock LOCK. */
-extern int pthread_spin_unlock (pthread_spinlock_t *__lock) __THROW;
+extern int pthread_spin_unlock (pthread_spinlock_t *__lock) __THROWNL;
/* Barriers are a also a new feature in 1003.1j-2000. */
@@ -536,7 +536,7 @@ extern int pthread_barrierattr_getpshared (const pthread_barrierattr_t *
extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr,
int __pshared) __THROW;
-extern int pthread_barrier_wait (pthread_barrier_t *__barrier) __THROW;
+extern int pthread_barrier_wait (pthread_barrier_t *__barrier) __THROWNL;
#endif
diff --git a/libpthread/nptl/Makefile.in b/libpthread/nptl/Makefile.in
index cdf07cf..0a981cd 100644
--- a/libpthread/nptl/Makefile.in
+++ b/libpthread/nptl/Makefile.in
@@ -21,7 +21,7 @@ libpthread-routines- += allocatestack.c # dummy included by pthread_create.c
libpthread-routines- += pthread_mutex_getprioceiling.c pthread_mutex_setprioceiling.c # XXX: delete those or use them!
libpthread-routines-$(UCLIBC_HAS_RESOLVER_SUPPORT) += res.c
libpthread-routines-$(UCLIBC_SUSV4_LEGACY) += pthread_getconcurrency.c \
- pthread_setconcurrency
+ pthread_setconcurrency.c
libpthread_CSRC = $(filter-out $(libpthread-routines-) \
$(libc-shared-routines-y) \
$(libc-static-routines-y) \
diff --git a/libpthread/nptl/pthread_atfork.c b/libpthread/nptl/pthread_atfork.c
index 3c12cd4..39ac3e2 100644
--- a/libpthread/nptl/pthread_atfork.c
+++ b/libpthread/nptl/pthread_atfork.c
@@ -37,13 +37,17 @@
#include <fork.h>
/* This is defined by newer gcc version unique for each module. */
-extern void *__dso_handle __attribute__ ((__weak__));
- //,__visibility__ ("hidden")));
+extern void *__dso_handle __attribute__ ((__weak__,
+ __visibility__ ("hidden")));
/* Hide the symbol so that no definition but the one locally in the
executable or DSO is used. */
int
+#ifndef __pthread_atfork
+/* Don't mark the compatibility function as hidden. */
+attribute_hidden
+#endif
__pthread_atfork (
void (*prepare) (void),
void (*parent) (void),
@@ -52,4 +56,8 @@ __pthread_atfork (
return __register_atfork (prepare, parent, child,
&__dso_handle == NULL ? NULL : __dso_handle);
}
+#ifndef __pthread_atfork
+extern int pthread_atfork (void (*prepare) (void), void (*parent) (void),
+ void (*child) (void)) attribute_hidden;
strong_alias (__pthread_atfork, pthread_atfork)
+#endif
diff --git a/libpthread/nptl/semaphore.h b/libpthread/nptl/semaphore.h
index aa0f929..c7f195b 100644
--- a/libpthread/nptl/semaphore.h
+++ b/libpthread/nptl/semaphore.h
@@ -63,10 +63,10 @@ extern int sem_timedwait (sem_t *__restrict __sem,
#endif
/* Test whether SEM is posted. */
-extern int sem_trywait (sem_t *__sem) __THROW;
+extern int sem_trywait (sem_t *__sem) __THROWNL;
/* Post SEM. */
-extern int sem_post (sem_t *__sem) __THROW;
+extern int sem_post (sem_t *__sem) __THROWNL;
/* Get current value of SEM and store it in *SVAL. */
extern int sem_getvalue (sem_t *__restrict __sem, int *__restrict __sval)
diff --git a/libpthread/nptl/sysdeps/pthread/pthread.h b/libpthread/nptl/sysdeps/pthread/pthread.h
index 896fb1b..4103a06 100644
--- a/libpthread/nptl/sysdeps/pthread/pthread.h
+++ b/libpthread/nptl/sysdeps/pthread/pthread.h
@@ -229,7 +229,7 @@ __BEGIN_DECLS
extern int pthread_create (pthread_t *__restrict __newthread,
const pthread_attr_t *__restrict __attr,
void *(*__start_routine) (void *),
- void *__restrict __arg) __THROW __nonnull ((1, 3));
+ void *__restrict __arg) __THROWNL __nonnull ((1, 3));
/* Terminate calling thread.
@@ -271,7 +271,8 @@ extern int pthread_detach (pthread_t __th) __THROW;
extern pthread_t pthread_self (void) __THROW __attribute__ ((__const__));
/* Compare two thread identifiers. */
-extern int pthread_equal (pthread_t __thread1, pthread_t __thread2) __THROW;
+extern int pthread_equal (pthread_t __thread1, pthread_t __thread2)
+ __THROW __attribute__ ((__const__));
/* Thread attribute handling. */
@@ -308,8 +309,7 @@ extern int pthread_attr_setguardsize (pthread_attr_t *__attr,
/* Return in *PARAM the scheduling parameters of *ATTR. */
-extern int pthread_attr_getschedparam (const pthread_attr_t *__restrict
- __attr,
+extern int pthread_attr_getschedparam (const pthread_attr_t *__restrict __attr,
struct sched_param *__restrict __param)
__THROW __nonnull ((1, 2));
@@ -643,9 +643,9 @@ __pthread_cleanup_routine (struct __pthread_cleanup_frame *__frame)
__pthread_unwind_buf_t __cancel_buf; \
void (*__cancel_routine) (void *) = (routine); \
void *__cancel_arg = (arg); \
- int not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \
+ int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \
__cancel_buf.__cancel_jmp_buf, 0); \
- if (__builtin_expect (not_first_call, 0)) \
+ if (__builtin_expect (__not_first_call, 0)) \
{ \
__cancel_routine (__cancel_arg); \
__pthread_unwind_next (&__cancel_buf); \
@@ -678,9 +678,9 @@ extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf)
__pthread_unwind_buf_t __cancel_buf; \
void (*__cancel_routine) (void *) = (routine); \
void *__cancel_arg = (arg); \
- int not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \
+ int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \
__cancel_buf.__cancel_jmp_buf, 0); \
- if (__builtin_expect (not_first_call, 0)) \
+ if (__builtin_expect (__not_first_call, 0)) \
{ \
__cancel_routine (__cancel_arg); \
__pthread_unwind_next (&__cancel_buf); \
@@ -717,7 +717,7 @@ extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf)
/* Function used in the macros. */
struct __jmp_buf_tag;
-extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROW;
+extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROWNL;
/* Mutex handling. */
@@ -733,22 +733,22 @@ extern int pthread_mutex_destroy (pthread_mutex_t *__mutex)
/* Try locking a mutex. */
extern int pthread_mutex_trylock (pthread_mutex_t *__mutex)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
/* Lock a mutex. */
extern int pthread_mutex_lock (pthread_mutex_t *__mutex)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
#ifdef __USE_XOPEN2K
/* Wait until lock becomes available, or specified time passes. */
extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
const struct timespec *__restrict
- __abstime) __THROW __nonnull ((1, 2));
+ __abstime) __THROWNL __nonnull ((1, 2));
#endif
/* Unlock a mutex. */
extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
/* Get the priority ceiling of MUTEX. */
@@ -872,37 +872,37 @@ extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock)
/* Acquire read lock for RWLOCK. */
extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
/* Try to acquire read lock for RWLOCK. */
extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
# ifdef __USE_XOPEN2K
/* Try to acquire read lock for RWLOCK or return after specfied time. */
extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
const struct timespec *__restrict
- __abstime) __THROW __nonnull ((1, 2));
+ __abstime) __THROWNL __nonnull ((1, 2));
# endif
/* Acquire write lock for RWLOCK. */
extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
/* Try to acquire write lock for RWLOCK. */
extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
# ifdef __USE_XOPEN2K
/* Try to acquire write lock for RWLOCK or return after specfied time. */
extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
const struct timespec *__restrict
- __abstime) __THROW __nonnull ((1, 2));
+ __abstime) __THROWNL __nonnull ((1, 2));
# endif
/* Unlock RWLOCK. */
extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
/* Functions for handling read-write lock attributes. */
@@ -943,8 +943,8 @@ extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr,
/* Initialize condition variable COND using attributes ATTR, or use
the default values if later is NULL. */
extern int pthread_cond_init (pthread_cond_t *__restrict __cond,
- const pthread_condattr_t *__restrict
- __cond_attr) __THROW __nonnull ((1));
+ const pthread_condattr_t *__restrict __cond_attr)
+ __THROW __nonnull ((1));
/* Destroy condition variable COND. */
extern int pthread_cond_destroy (pthread_cond_t *__cond)
@@ -952,11 +952,11 @@ extern int pthread_cond_destroy (pthread_cond_t *__cond)
/* Wake up one thread waiting for condition variable COND. */
extern int pthread_cond_signal (pthread_cond_t *__cond)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
/* Wake up all threads waiting for condition variables COND. */
extern int pthread_cond_broadcast (pthread_cond_t *__cond)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
/* Wait for condition variable COND to be signaled or broadcast.
MUTEX is assumed to be locked before.
@@ -976,8 +976,8 @@ extern int pthread_cond_wait (pthread_cond_t *__restrict __cond,
__THROW. */
extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
pthread_mutex_t *__restrict __mutex,
- const struct timespec *__restrict
- __abstime) __nonnull ((1, 2, 3));
+ const struct timespec *__restrict __abstime)
+ __nonnull ((1, 2, 3));
/* Functions for handling condition variable attributes. */
@@ -1000,13 +1000,13 @@ extern int pthread_condattr_setpshared (pthread_condattr_t *__attr,
int __pshared) __THROW __nonnull ((1));
#ifdef __USE_XOPEN2K
-/* Get the clock selected for the conditon variable attribute ATTR. */
+/* Get the clock selected for the condition variable attribute ATTR. */
extern int pthread_condattr_getclock (const pthread_condattr_t *
__restrict __attr,
__clockid_t *__restrict __clock_id)
__THROW __nonnull ((1, 2));
-/* Set the clock selected for the conditon variable attribute ATTR. */
+/* Set the clock selected for the condition variable attribute ATTR. */
extern int pthread_condattr_setclock (pthread_condattr_t *__attr,
__clockid_t __clock_id)
__THROW __nonnull ((1));
@@ -1027,15 +1027,15 @@ extern int pthread_spin_destroy (pthread_spinlock_t *__lock)
/* Wait until spinlock LOCK is retrieved. */
extern int pthread_spin_lock (pthread_spinlock_t *__lock)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
/* Try to lock spinlock LOCK. */
extern int pthread_spin_trylock (pthread_spinlock_t *__lock)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
/* Release spinlock LOCK. */
extern int pthread_spin_unlock (pthread_spinlock_t *__lock)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
/* Functions to handle barriers. */
@@ -1053,7 +1053,7 @@ extern int pthread_barrier_destroy (pthread_barrier_t *__barrier)
/* Wait on barrier BARRIER. */
extern int pthread_barrier_wait (pthread_barrier_t *__barrier)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
/* Initialize barrier attribute ATTR. */
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h
index 0b635d3..a9652bb 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h
@@ -358,7 +358,7 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden;
register unsigned long __r5 __asm__ ("r5") \
= __lll_private_flag (FUTEX_WAIT, private); \
register unsigned long __r6 __asm__ ("r6") = (unsigned long) (val); \
- register unsigned long __r7 __asm__ ("r7") = (timeout); \
+ register unsigned long __r7 __asm__ ("r7") = (unsigned long) (timeout); \
__asm__ __volatile__ (SYSCALL_WITH_INST_PAD \
: "=z" (__status) \
: "r" (__r3), "r" (__r4), "r" (__r5), \
diff --git a/librt/Makefile.in b/librt/Makefile.in
index 8555e94..fbbf5b4 100644
--- a/librt/Makefile.in
+++ b/librt/Makefile.in
@@ -15,6 +15,9 @@ LIBS-librt.so := $(LIBS)
ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
LIBS-librt.so += $(top_builddir)lib/libdl.so $(top_builddir)lib/libpthread.so
endif
+START_FILE-librt.so := $(SHARED_START_FILES)
+END_FILE-librt.so := $(SHARED_END_FILES)
+
librt_FULL_NAME := librt-$(VERSION).so
diff --git a/libutil/Makefile.in b/libutil/Makefile.in
index f904fc7..98b178e 100644
--- a/libutil/Makefile.in
+++ b/libutil/Makefile.in
@@ -27,6 +27,14 @@ ifneq ($(UCLIBC_HAS_PTY),y)
libutil_SRC := $(filter-out $(libutil_DIR)/openpty.c $(libutil_DIR)/forkpty.c \
,$(libutil_SRC))
endif
+ifeq ($(UCLIBC_HAS_UTMP)$(UCLIBC_HAS_UTMPX),)
+libutil_SRC := $(filter-out \
+ $(libutil_DIR)/logwtmp.c \
+ $(libutil_DIR)/login.c \
+ $(libutil_DIR)/logout.c \
+ ,$(libutil_SRC))
+endif
+
libutil_OBJ := $(patsubst $(libutil_DIR)/%.c,$(libutil_OUT)/%.o,$(libutil_SRC))
ifeq ($(DOPIC),y)
diff --git a/libutil/forkpty.c b/libutil/forkpty.c
index ec490f0..2464333 100644
--- a/libutil/forkpty.c
+++ b/libutil/forkpty.c
@@ -22,9 +22,6 @@
#include <utmp.h>
#include <pty.h>
-libutil_hidden_proto(openpty)
-libutil_hidden_proto(login_tty)
-
int
forkpty (int *amaster, char *name, struct termios *termp, struct winsize *winp)
{
diff --git a/libutil/login.c b/libutil/login.c
index 4007e4c..971997d 100644
--- a/libutil/login.c
+++ b/libutil/login.c
@@ -3,7 +3,7 @@
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
-#include <utmp.h>
+#include "internal/utmp.h"
/* Write the given entry into utmp and wtmp.
* Note: the match in utmp is done against ut_id field,
@@ -11,7 +11,7 @@
*/
void login(const struct utmp *entry)
{
- struct utmp copy;
+ struct UT copy;
char tty_name[sizeof(copy.ut_line) + 6];
int fd;
@@ -20,7 +20,7 @@ void login(const struct utmp *entry)
// (if there is such a field) with the value USER_PROCESS,
// and fills the field ut->ut_pid (if there is such a field)
// with the process ID of the calling process.
- copy = *entry;
+ copy = *((const struct UT *)(entry));
#if _HAVE_UT_TYPE - 0
copy.ut_type = USER_PROCESS;
#endif
diff --git a/libutil/login_tty.c b/libutil/login_tty.c
index 3979adc..3665858 100644
--- a/libutil/login_tty.c
+++ b/libutil/login_tty.c
@@ -36,7 +36,6 @@
#include <fcntl.h>
#include <utmp.h>
-libutil_hidden_proto(login_tty)
int login_tty(int fd)
{
(void) setsid();
diff --git a/libutil/logout.c b/libutil/logout.c
index 9c7440b..0181e23 100644
--- a/libutil/logout.c
+++ b/libutil/logout.c
@@ -18,14 +18,14 @@
#include <errno.h>
#include <string.h>
-#include <utmp.h>
#include <sys/time.h>
+#include "internal/utmp.h"
int
logout (const char *line)
{
- struct utmp tmp;
- struct utmp *ut;
+ struct UT tmp;
+ struct UT *ut;
int result = 0;
/* if (utmpname (_PATH_UTMP) == -1) return 0; - why?
@@ -50,7 +50,7 @@ logout (const char *line)
memset (ut->ut_host, 0, sizeof ut->ut_host);
#endif
#if _HAVE_UT_TV - 0
-# if !defined __WORDSIZE_COMPAT32 || __WORDSIZE_COMPAT32 == 0
+# if !defined __WORDSIZE_TIME64_COMPAT32
gettimeofday (&ut->ut_tv, NULL);
# else
{
diff --git a/libutil/logwtmp.c b/libutil/logwtmp.c
index 2a6f28a..99b772f 100644
--- a/libutil/logwtmp.c
+++ b/libutil/logwtmp.c
@@ -9,13 +9,13 @@
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
-#include <utmp.h>
#include <fcntl.h>
#include <sys/file.h>
+#include "internal/utmp.h"
void logwtmp(const char *line, const char *name, const char *host)
{
- struct utmp lutmp;
+ struct UT lutmp;
memset(&lutmp, 0, sizeof(lutmp));
lutmp.ut_type = (name && *name) ? USER_PROCESS : DEAD_PROCESS;
@@ -23,7 +23,7 @@ void logwtmp(const char *line, const char *name, const char *host)
strncpy(lutmp.ut_line, line, sizeof(lutmp.ut_line)-1);
strncpy(lutmp.ut_name, name, sizeof(lutmp.ut_name)-1);
strncpy(lutmp.ut_host, host, sizeof(lutmp.ut_host)-1);
-#if !defined __WORDSIZE_COMPAT32 || __WORDSIZE_COMPAT32 == 0
+#if !defined __WORDSIZE_TIME64_COMPAT32
gettimeofday(&lutmp.ut_tv, NULL);
#else
{
@@ -36,20 +36,3 @@ void logwtmp(const char *line, const char *name, const char *host)
updwtmp(_PATH_WTMP, &lutmp);
}
-
-#if 0
-/* This is enabled in uClibc/libc/misc/utmp/wtent.c */
-void updwtmp(const char *wtmp_file, const struct utmp *lutmp)
-{
- int fd;
-
- fd = open(wtmp_file, O_APPEND | O_WRONLY);
- if (fd >= 0) {
- if (lockf(fd, F_LOCK, 0) == 0) {
- write(fd, lutmp, sizeof(*lutmp));
- lockf(fd, F_ULOCK, 0);
- close(fd);
- }
- }
-}
-#endif
diff --git a/libutil/openpty.c b/libutil/openpty.c
index bd8b8d9..848dc8d 100644
--- a/libutil/openpty.c
+++ b/libutil/openpty.c
@@ -84,7 +84,6 @@ pts_name (int fd, char **pts, size_t buf_len)
/* Create pseudo tty master slave pair and set terminal attributes
according to TERMP and WINP. Return handles for both ends in
AMASTER and ASLAVE, and return the name of the slave end in NAME. */
-libutil_hidden_proto(openpty)
int
openpty (int *amaster, int *aslave, char *name, struct termios *termp,
struct winsize *winp)
diff --git a/test/.gitignore b/test/.gitignore
index 5944f0a..0d19285 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -163,6 +163,7 @@ misc/tst-seekdir
misc/tst-statfs
misc/tst-statvfs
misc/tst-utmp
+misc/tst-utmpx
mmap/mmap
mmap/mmap2
mmap/mmap64
@@ -262,6 +263,8 @@ signal/tst-sigset
signal/tst-sigsimple
silly/hello
silly/tiny
+silly/tst-atomic
+silly/tst-atomic-long
stat/memcmp-stat
stat/stat
stat/stat64
diff --git a/test/README b/test/README
index 28225b0..723ce6e 100644
--- a/test/README
+++ b/test/README
@@ -29,6 +29,9 @@ The following make variables may help you in testing:
So, to just run the uClibc tests, try this:
make check UCLIBC_ONLY=1
+You can pass the following 2 environment variables to "make run":
+ - make run SIMULATOR_uclibc=qemu-sh4 SIMULATOR_glibc=qemu-x86_64
+
If you need to test just a subset of all test, delete subdirectories
you do not need.
diff --git a/test/Test.mak b/test/Test.mak
index ee43a0f..a56a201 100644
--- a/test/Test.mak
+++ b/test/Test.mak
@@ -69,7 +69,7 @@ endef
define exec_test
$(showtest)
$(Q)\
- $(WRAPPER) $(WRAPPER_$(tst_src_name)) \
+ $(SIMULATOR) $(WRAPPER) $(WRAPPER_$(tst_src_name)) \
./$(binary_name) $(OPTS) $(OPTS_$(tst_src_name)) > "$(binary_name).out" 2>&1 ; \
ret=$$? ; \
expected_ret="$(RET_$(tst_src_name))" ; \
@@ -85,6 +85,9 @@ endef
test check all: run
run: $(RUN_TARGETS)
+
+$(addsuffix .exe,$(U_TARGETS)): SIMULATOR:=$(SIMULATOR_uclibc)
+$(addsuffix .exe,$(G_TARGETS)): SIMULATOR:=$(SIMULATOR_glibc)
$(RUN_TARGETS):
$(exec_test)
$(diff_test)
diff --git a/test/math/compile_test.c b/test/math/compile_test.c
index ab8c40c..aedfde6 100644
--- a/test/math/compile_test.c
+++ b/test/math/compile_test.c
@@ -22,11 +22,11 @@ r += exp2f(float_x);
r += expf(float_x);
r += expm1f(float_x);
r += fabsf(float_x);
-/*r += fdimf(float_x, float_x); - uclibc does not have it (yet?) */
+r += fdimf(float_x, float_x);
r += floorf(float_x);
-/*r += fmaf(float_x, float_x, float_x); - uclibc does not have it (yet?) */
-/*r += fmaxf(float_x, float_x); - uclibc does not have it (yet?) */
-/*r += fminf(float_x, float_x); - uclibc does not have it (yet?) */
+r += fmaf(float_x, float_x, float_x);
+r += fmaxf(float_x, float_x);
+r += fminf(float_x, float_x);
r += fmodf(float_x, float_x);
r += frexpf(float_x, &int_x);
r += gammaf(float_x);
@@ -44,17 +44,17 @@ r += logf(float_x);
r += lrintf(float_x);
r += lroundf(float_x);
r += modff(float_x, &float_x);
-/*r += nearbyintf(float_x); - uclibc does not have it (yet?) */
-/*r += nexttowardf(float_x, long_double_x); - uclibc does not have it (yet?) */
+r += nearbyintf(float_x);
+r += nexttowardf(float_x, long_double_x);
r += powf(float_x, float_x);
r += remainderf(float_x, float_x);
-/*r += remquof(float_x, float_x, &int_x); - uclibc does not have it (yet?) */
+r += remquof(float_x, float_x, &int_x);
r += rintf(float_x);
r += roundf(float_x);
#ifdef __UCLIBC_SUSV3_LEGACY__
r += scalbf(float_x, float_x);
#endif
-/*r += scalblnf(float_x, long_x); - uclibc does not have it (yet?) */
+r += scalblnf(float_x, long_x);
r += scalbnf(float_x, int_x);
r += significandf(float_x);
r += sinf(float_x);
@@ -62,7 +62,7 @@ r += sinhf(float_x);
r += sqrtf(float_x);
r += tanf(float_x);
r += tanhf(float_x);
-/*r += tgammaf(float_x); - uclibc does not have it (yet?) */
+r += tgammaf(float_x);
r += truncf(float_x);
return r;
}
@@ -116,7 +116,7 @@ r += lroundl(long_double_x);
r += modfl(long_double_x, &long_double_x);
r += nearbyintl(long_double_x);
r += nextafterl(long_double_x, long_double_x);
-/* r += nexttowardl(long_double_x, long_double_x); - uclibc doesn't provide this [yet?] */
+r += nexttowardl(long_double_x, long_double_x);
r += powl(long_double_x, long_double_x);
r += remainderl(long_double_x, long_double_x);
r += remquol(long_double_x, long_double_x, &int_x);
diff --git a/test/math/libm-test.inc b/test/math/libm-test.inc
index d0f0a0c..f50b48b 100644
--- a/test/math/libm-test.inc
+++ b/test/math/libm-test.inc
@@ -115,6 +115,9 @@
# define _GNU_SOURCE
#endif
+#undef __CHK_COMPLEX_STUFF
+#define __CHK_COMPLEX_STUFF 0
+
#include "libm-test-ulps.h"
#include <complex.h>
#include <math.h>
@@ -1120,8 +1123,10 @@ cacosh_test (void)
END (cacosh, complex);
}
+#endif
+#if __CHK_COMPLEX_STUFF
static void
carg_test (void)
{
@@ -1188,7 +1193,9 @@ carg_test (void)
END (carg);
}
+#endif /* __CHK_COMPLEX_STUFF */
+#if 0
static void
casin_test (void)
{
@@ -1683,7 +1690,7 @@ ceil_test (void)
}
-#if 0
+#if __CHK_COMPLEX_STUFF
static void
cexp_test (void)
{
@@ -1746,8 +1753,9 @@ cexp_test (void)
END (cexp, complex);
}
+#endif /* __CHK_COMPLEX_STUFF */
-
+#if 0
static void
cimag_test (void)
{
@@ -2588,7 +2596,6 @@ fabs_test (void)
}
-#if 0
static void
fdim_test (void)
{
@@ -2624,7 +2631,6 @@ fdim_test (void)
END (fdim);
}
-#endif
static void
@@ -2694,7 +2700,6 @@ floor_test (void)
}
-#if 0
static void
fma_test (void)
{
@@ -2797,7 +2802,6 @@ fmin_test (void)
END (fmin);
}
-#endif
static void
@@ -3002,7 +3006,7 @@ isnormal_test (void)
END (isnormal);
}
-#if defined __DO_XSI_MATH__
+#if defined __DO_XSI_MATH__ && !(defined TEST_LDOUBLE || defined TEST_FLOAT)
static void
j0_test (void)
{
@@ -3414,8 +3418,6 @@ log1p_test (void)
END (log1p);
}
-
-#if 0
static void
log2_test (void)
{
@@ -3445,8 +3447,6 @@ log2_test (void)
END (log2);
}
-#endif
-
static void
logb_test (void)
@@ -3629,7 +3629,6 @@ modf_test (void)
}
-#if 0
static void
nearbyint_test (void)
{
@@ -3710,7 +3709,6 @@ nexttoward_test (void)
END (nexttoward);
}
-#endif
static void
@@ -3950,7 +3948,6 @@ remainder_test (void)
END (remainder);
}
-#if 0
static void
remquo_test (void)
{
@@ -3981,7 +3978,6 @@ remquo_test (void)
END (remquo);
}
-#endif
static void
rint_test (void)
@@ -4229,12 +4225,12 @@ round_test (void)
#endif
+#ifdef __UCLIBC_SUSV3_LEGACY__
static void
scalb_test (void)
{
START (scalb);
#ifndef TEST_LDOUBLE /* uclibc doesn't have scalbl */
-#ifdef __UCLIBC_SUSV3_LEGACY__ /* scalbf is susv3 legacy */
TEST_ff_f (scalb, 2.0, 0.5, nan_value, INVALID_EXCEPTION);
TEST_ff_f (scalb, 3.0, -2.5, nan_value, INVALID_EXCEPTION);
@@ -4285,11 +4281,10 @@ scalb_test (void)
TEST_ff_f (scalb, 0.8L, 4, 12.8L);
TEST_ff_f (scalb, -0.854375L, 5, -27.34L);
-#endif /* __UCLIBC_SUSV3_LEGACY__ */
#endif /* TEST_LDOUBLE */
END (scalb);
}
-
+#endif
static void
scalbn_test (void)
@@ -4313,7 +4308,6 @@ scalbn_test (void)
}
-#if 0
static void
scalbln_test (void)
{
@@ -4334,7 +4328,6 @@ scalbln_test (void)
END (scalbn);
}
-#endif
static void
@@ -4539,7 +4532,6 @@ tanh_test (void)
END (tanh);
}
-#if 0
static void
tgamma_test (void)
{
@@ -4571,7 +4563,6 @@ tgamma_test (void)
END (tgamma);
}
-#endif
#if 0
@@ -4651,7 +4642,7 @@ trunc_test (void)
}
#endif
-#if defined __DO_XSI_MATH__
+#if defined __DO_XSI_MATH__ && !(defined TEST_LDOUBLE || defined TEST_FLOAT)
static void
y0_test (void)
{
@@ -4973,17 +4964,15 @@ main (int argc, char **argv)
log_test ();
log10_test ();
log1p_test ();
-#if 0
log2_test ();
-#endif
logb_test ();
modf_test ();
ilogb_test ();
+#ifdef __UCLIBC_SUSV3_LEGACY__
scalb_test ();
+#endif
scalbn_test ();
-#if 0
scalbln_test ();
-#endif
significand_test ();
/* Power and absolute value functions: */
@@ -4998,16 +4987,12 @@ main (int argc, char **argv)
erfc_test ();
gamma_test ();
lgamma_test ();
-#if 0
tgamma_test ();
-#endif
/* Nearest integer functions: */
ceil_test ();
floor_test ();
-#if 0
nearbyint_test ();
-#endif
rint_test ();
#if 0
rint_test_tonearest ();
@@ -5025,13 +5010,10 @@ main (int argc, char **argv)
/* Remainder functions: */
fmod_test ();
remainder_test ();
-#if 0
remquo_test ();
-#endif
/* Manipulation functions: */
copysign_test ();
-#if 0
nextafter_test ();
nexttoward_test ();
@@ -5043,24 +5025,29 @@ main (int argc, char **argv)
/* Multiply and add: */
fma_test ();
+
/* Complex functions: */
cabs_test ();
+#if __CHK_COMPLEX_STUFF
+#if 0
cacos_test ();
cacosh_test ();
+#endif
carg_test ();
+#if 0
casin_test ();
casinh_test ();
catan_test ();
catanh_test ();
ccos_test ();
ccosh_test ();
+#endif
cexp_test ();
+#if 0
cimag_test ();
clog10_test ();
clog_test ();
-#if 0
conj_test ();
-#endif
cpow_test ();
cproj_test ();
creal_test ();
@@ -5070,9 +5057,10 @@ main (int argc, char **argv)
ctan_test ();
ctanh_test ();
#endif
+#endif /* __CHK_COMPLEX_STUFF */
/* Bessel functions: */
-#if defined __DO_XSI_MATH__
+#if defined __DO_XSI_MATH__ && !(defined TEST_LDOUBLE || defined TEST_FLOAT)
j0_test ();
j1_test ();
jn_test ();
diff --git a/test/misc/Makefile.in b/test/misc/Makefile.in
index 345889e..d78b276 100644
--- a/test/misc/Makefile.in
+++ b/test/misc/Makefile.in
@@ -21,6 +21,14 @@ ifeq ($(UCLIBC_HAS_GLOB),)
TESTS_DISABLED += bug-glob2
endif
+ifeq ($(UCLIBC_HAS_UTMPX),)
+TESTS_DISABLED += tst-utmpx
+endif
+
+ifeq ($(UCLIBC_HAS_UTMP),)
+TESTS_DISABLED += tst-utmp
+endif
+
DODIFF_dirent := 1
DODIFF_dirent64 := 1
DODIFF_tst-statfs := 1
diff --git a/test/misc/tst-scandir.c b/test/misc/tst-scandir.c
index df62a40..e1c72e3 100644
--- a/test/misc/tst-scandir.c
+++ b/test/misc/tst-scandir.c
@@ -3,7 +3,7 @@
#include <stdio.h> /* perror() */
#include <stdlib.h>
-int skip_all(const struct dirent *dirbuf)
+static int skip_all(const struct dirent *dirbuf)
{
errno = EBADF;
return 0;
diff --git a/test/misc/tst-utmp.c b/test/misc/tst-utmp.c
index 08a6f8e..1b0333a 100644
--- a/test/misc/tst-utmp.c
+++ b/test/misc/tst-utmp.c
@@ -37,6 +37,21 @@
# include <utmp.h>
#endif
+#ifndef _HAVE_UT_TYPE
+# define _HAVE_UT_TYPE 0
+#endif
+#ifndef _HAVE_UT_PID
+# define _HAVE_UT_PID 0
+#endif
+#ifndef _HAVE_UT_ID
+# define _HAVE_UT_ID 0
+#endif
+#ifndef _HAVE_UT_TV
+# define _HAVE_UT_TV 0
+#endif
+#ifndef _HAVE_UT_HOST
+# define _HAVE_UT_HOST 0
+#endif
#if _HAVE_UT_TYPE || defined UTMPX
diff --git a/test/misc/tst-utmpx.c b/test/misc/tst-utmpx.c
new file mode 100644
index 0000000..edb5551
--- /dev/null
+++ b/test/misc/tst-utmpx.c
@@ -0,0 +1,2 @@
+#define UTMPX
+#include "tst-utmp.c"
diff --git a/test/silly/Makefile.in b/test/silly/Makefile.in
index bb08e0d..9bb4032 100644
--- a/test/silly/Makefile.in
+++ b/test/silly/Makefile.in
@@ -3,3 +3,6 @@
RET_hello := 42
RET_tiny := 42
+
+# missing internal headers, disable these
+GLIBC_TESTS_DISABLED := tst-atomic_glibc tst-atomic-long_glibc
diff --git a/test/silly/hello.c b/test/silly/hello.c
index 4aba926..d330597 100644
--- a/test/silly/hello.c
+++ b/test/silly/hello.c
@@ -1,4 +1,4 @@
-#include<stdio.h>
+#include <stdio.h>
#include <stdlib.h>
int main(void)
diff --git a/libc/sysdeps/linux/sparc/jmpbuf-offsets.h b/test/silly/tst-atomic-long.c
similarity index 75%
copy from libc/sysdeps/linux/sparc/jmpbuf-offsets.h
copy to test/silly/tst-atomic-long.c
index 0d0a96d..d13fb07 100644
--- a/libc/sysdeps/linux/sparc/jmpbuf-offsets.h
+++ b/test/silly/tst-atomic-long.c
@@ -1,6 +1,7 @@
-/* Private macros for accessing __jmp_buf contents. SPARC version.
- Copyright (C) 2006 Free Software Foundation, Inc.
+/* Tests for atomic.h macros.
+ Copyright (C) 2003-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub(a)redhat.com>, 2003.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -18,12 +19,9 @@
#include <bits/wordsize.h>
+#define atomic_t long
#if __WORDSIZE == 64
-#define O_mask_was_saved 512
-#define O_gregs 32
-#define O_g1 (O_gregs + 4*8)
-#else
-#define JB_SP 0
-#define JB_FP 1
-#define JB_PC 2
+# define TEST_ATOMIC64 1
#endif
+
+#include "tst-atomic.c"
diff --git a/test/silly/tst-atomic.c b/test/silly/tst-atomic.c
new file mode 100644
index 0000000..fc773b2
--- /dev/null
+++ b/test/silly/tst-atomic.c
@@ -0,0 +1,573 @@
+/* Tests for atomic.h macros.
+ Copyright (C) 2003-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub(a)redhat.com>, 2003.
+
+ 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <atomic.h>
+
+#ifndef atomic_t
+# define atomic_t int
+#endif
+
+#define CHK2(f,a1,a2,rv,new_mem) \
+ retval = f(&mem, a1, a2); \
+ if (retval != rv) { \
+ printf("%s(mem, %lu, %lu): retval %lu != expected %lu\n", \
+ #f, a1, a2, retval, rv); \
+ ret = 1; \
+ } \
+ if (mem != new_mem) { \
+ printf("%s(mem, %lu, %lu): mem %lu != expected %lu\n", \
+ #f, a1, a2, mem, new_mem); \
+ ret = 1; \
+ }
+#define CHK1(f,a1,rv,new_mem) \
+ retval = f(&mem, a1); \
+ if (retval != rv) { \
+ printf("%s(mem, %lu): retval %lu != expected %lu\n", \
+ #f, a1, retval, rv); \
+ ret = 1; \
+ } \
+ if (mem != new_mem) { \
+ printf("%s(mem, %lu): mem %lu != expected %lu\n", \
+ #f, a1, mem, new_mem); \
+ ret = 1; \
+ }
+#define CHK0(f,rv,new_mem) \
+ retval = f(&mem); \
+ if (retval != rv) { \
+ printf("%s(mem): retval %lu != expected %lu\n", \
+ #f, retval, rv); \
+ ret = 1; \
+ } \
+ if (mem != new_mem) { \
+ printf("%s(mem): mem %lu != expected %lu\n", \
+ #f, mem, new_mem); \
+ ret = 1; \
+ }
+
+/* Test various atomic.h macros. */
+static int
+do_test (void)
+{
+ atomic_t mem, expected, retval;
+ int ret = 0;
+
+#ifdef atomic_compare_and_exchange_val_acq
+ mem = 24;
+ CHK2(atomic_compare_and_exchange_val_acq, 35, 24, 24, 35);
+ mem = 12;
+ CHK2(atomic_compare_and_exchange_val_acq, 10, 15, 12, 12);
+ mem = -15;
+ CHK2(atomic_compare_and_exchange_val_acq, -56, -15, -15, -56);
+ mem = -1;
+ CHK2(atomic_compare_and_exchange_val_acq, 17, 0, -1, -1);
+#endif
+
+ mem = 24;
+ CHK2(atomic_compare_and_exchange_bool_acq, 35, 24, 0, 35);
+ mem = 12;
+ CHK2(atomic_compare_and_exchange_bool_acq, 10, 15, 1, 12);
+ mem = -15;
+ CHK2(atomic_compare_and_exchange_bool_acq, -56, -15, 0, -56);
+ mem = -1;
+ CHK2(atomic_compare_and_exchange_bool_acq, 17, 0, 1, -1);
+
+ mem = 64;
+ CHK1(atomic_exchange_acq, 31, 64, 31);
+ mem = 2;
+ CHK1(atomic_exchange_and_add, 11, 2, 13);
+ mem = 2;
+ CHK1(atomic_exchange_and_add_acq, 11, 2, 13);
+ mem = 2;
+ CHK1(atomic_exchange_and_add_rel, 11, 2, 13);
+
+ mem = -21;
+ atomic_add (&mem, 22);
+ if (mem != 1)
+ {
+ printf ("atomic_add(mem, 22): mem %lu != expected 1\n", mem);
+ ret = 1;
+ }
+
+ mem = -1;
+ atomic_increment (&mem);
+ if (mem != 0)
+ {
+ printf ("atomic_increment(mem): mem %lu != expected 0\n", mem);
+ ret = 1;
+ }
+
+ mem = 2;
+ if ((retval = atomic_increment_val (&mem)) != 3)
+ {
+ printf ("atomic_increment_val(mem): retval %lu != expected 3\n", retval);
+ ret = 1;
+ }
+
+ mem = 0;
+ CHK0(atomic_increment_and_test, 0, 1);
+ mem = 35;
+ CHK0(atomic_increment_and_test, 0, 36);
+ mem = -1;
+ CHK0(atomic_increment_and_test, 1, 0);
+ mem = 17;
+ atomic_decrement (&mem);
+ if (mem != 16)
+ {
+ printf ("atomic_increment(mem): mem %lu != expected 16\n", mem);
+ ret = 1;
+ }
+
+ if ((retval = atomic_decrement_val (&mem)) != 15)
+ {
+ printf ("atomic_decrement_val(mem): retval %lu != expected 15\n", retval);
+ ret = 1;
+ }
+
+ mem = 0;
+ CHK0(atomic_decrement_and_test, 0, -1);
+
+ mem = 15;
+ CHK0(atomic_decrement_and_test, 0, 14);
+ mem = 1;
+ CHK0(atomic_decrement_and_test, 1, 0);
+ mem = 1;
+ if (atomic_decrement_if_positive (&mem) != 1
+ || mem != 0)
+ {
+ puts ("atomic_decrement_if_positive test 1 failed");
+ ret = 1;
+ }
+
+ mem = 0;
+ if (atomic_decrement_if_positive (&mem) != 0
+ || mem != 0)
+ {
+ puts ("atomic_decrement_if_positive test 2 failed");
+ ret = 1;
+ }
+
+ mem = -1;
+ if (atomic_decrement_if_positive (&mem) != -1
+ || mem != -1)
+ {
+ puts ("atomic_decrement_if_positive test 3 failed");
+ ret = 1;
+ }
+
+ mem = -12;
+ if (! atomic_add_negative (&mem, 10)
+ || mem != -2)
+ {
+ puts ("atomic_add_negative test 1 failed");
+ ret = 1;
+ }
+
+ mem = 0;
+ if (atomic_add_negative (&mem, 100)
+ || mem != 100)
+ {
+ puts ("atomic_add_negative test 2 failed");
+ ret = 1;
+ }
+
+ mem = 15;
+ if (atomic_add_negative (&mem, -10)
+ || mem != 5)
+ {
+ puts ("atomic_add_negative test 3 failed");
+ ret = 1;
+ }
+
+ mem = -12;
+ if (atomic_add_negative (&mem, 14)
+ || mem != 2)
+ {
+ puts ("atomic_add_negative test 4 failed");
+ ret = 1;
+ }
+
+ mem = 0;
+ if (! atomic_add_negative (&mem, -1)
+ || mem != -1)
+ {
+ puts ("atomic_add_negative test 5 failed");
+ ret = 1;
+ }
+
+ mem = -31;
+ if (atomic_add_negative (&mem, 31)
+ || mem != 0)
+ {
+ puts ("atomic_add_negative test 6 failed");
+ ret = 1;
+ }
+
+ mem = -34;
+ if (atomic_add_zero (&mem, 31)
+ || mem != -3)
+ {
+ puts ("atomic_add_zero test 1 failed");
+ ret = 1;
+ }
+
+ mem = -36;
+ if (! atomic_add_zero (&mem, 36)
+ || mem != 0)
+ {
+ puts ("atomic_add_zero test 2 failed");
+ ret = 1;
+ }
+
+ mem = 113;
+ if (atomic_add_zero (&mem, -13)
+ || mem != 100)
+ {
+ puts ("atomic_add_zero test 3 failed");
+ ret = 1;
+ }
+
+ mem = -18;
+ if (atomic_add_zero (&mem, 20)
+ || mem != 2)
+ {
+ puts ("atomic_add_zero test 4 failed");
+ ret = 1;
+ }
+
+ mem = 10;
+ if (atomic_add_zero (&mem, -20)
+ || mem != -10)
+ {
+ puts ("atomic_add_zero test 5 failed");
+ ret = 1;
+ }
+
+ mem = 10;
+ if (! atomic_add_zero (&mem, -10)
+ || mem != 0)
+ {
+ puts ("atomic_add_zero test 6 failed");
+ ret = 1;
+ }
+
+ mem = 0;
+ atomic_bit_set (&mem, 1);
+ if (mem != 2)
+ {
+ puts ("atomic_bit_set test 1 failed");
+ ret = 1;
+ }
+
+ mem = 8;
+ atomic_bit_set (&mem, 3);
+ if (mem != 8)
+ {
+ puts ("atomic_bit_set test 2 failed");
+ ret = 1;
+ }
+
+#ifdef TEST_ATOMIC64
+ mem = 16;
+ atomic_bit_set (&mem, 35);
+ if (mem != 0x800000010LL)
+ {
+ puts ("atomic_bit_set test 3 failed");
+ ret = 1;
+ }
+#endif
+
+ mem = 0;
+ if (atomic_bit_test_set (&mem, 1)
+ || mem != 2)
+ {
+ puts ("atomic_bit_test_set test 1 failed");
+ ret = 1;
+ }
+
+ mem = 8;
+ if (! atomic_bit_test_set (&mem, 3)
+ || mem != 8)
+ {
+ puts ("atomic_bit_test_set test 2 failed");
+ ret = 1;
+ }
+
+#ifdef TEST_ATOMIC64
+ mem = 16;
+ if (atomic_bit_test_set (&mem, 35)
+ || mem != 0x800000010LL)
+ {
+ puts ("atomic_bit_test_set test 3 failed");
+ ret = 1;
+ }
+
+ mem = 0x100000000LL;
+ if (! atomic_bit_test_set (&mem, 32)
+ || mem != 0x100000000LL)
+ {
+ puts ("atomic_bit_test_set test 4 failed");
+ ret = 1;
+ }
+#endif
+
+#ifdef catomic_compare_and_exchange_val_acq
+ mem = 24;
+ if (catomic_compare_and_exchange_val_acq (&mem, 35, 24) != 24
+ || mem != 35)
+ {
+ puts ("catomic_compare_and_exchange_val_acq test 1 failed");
+ ret = 1;
+ }
+
+ mem = 12;
+ if (catomic_compare_and_exchange_val_acq (&mem, 10, 15) != 12
+ || mem != 12)
+ {
+ puts ("catomic_compare_and_exchange_val_acq test 2 failed");
+ ret = 1;
+ }
+
+ mem = -15;
+ if (catomic_compare_and_exchange_val_acq (&mem, -56, -15) != -15
+ || mem != -56)
+ {
+ puts ("catomic_compare_and_exchange_val_acq test 3 failed");
+ ret = 1;
+ }
+
+ mem = -1;
+ if (catomic_compare_and_exchange_val_acq (&mem, 17, 0) != -1
+ || mem != -1)
+ {
+ puts ("catomic_compare_and_exchange_val_acq test 4 failed");
+ ret = 1;
+ }
+#endif
+
+ mem = 24;
+ if (catomic_compare_and_exchange_bool_acq (&mem, 35, 24)
+ || mem != 35)
+ {
+ puts ("catomic_compare_and_exchange_bool_acq test 1 failed");
+ ret = 1;
+ }
+
+ mem = 12;
+ if (! catomic_compare_and_exchange_bool_acq (&mem, 10, 15)
+ || mem != 12)
+ {
+ puts ("catomic_compare_and_exchange_bool_acq test 2 failed");
+ ret = 1;
+ }
+
+ mem = -15;
+ if (catomic_compare_and_exchange_bool_acq (&mem, -56, -15)
+ || mem != -56)
+ {
+ puts ("catomic_compare_and_exchange_bool_acq test 3 failed");
+ ret = 1;
+ }
+
+ mem = -1;
+ if (! catomic_compare_and_exchange_bool_acq (&mem, 17, 0)
+ || mem != -1)
+ {
+ puts ("catomic_compare_and_exchange_bool_acq test 4 failed");
+ ret = 1;
+ }
+
+ mem = 2;
+ if (catomic_exchange_and_add (&mem, 11) != 2
+ || mem != 13)
+ {
+ puts ("catomic_exchange_and_add test failed");
+ ret = 1;
+ }
+
+ mem = -21;
+ catomic_add (&mem, 22);
+ if (mem != 1)
+ {
+ puts ("catomic_add test failed");
+ ret = 1;
+ }
+
+ mem = -1;
+ catomic_increment (&mem);
+ if (mem != 0)
+ {
+ puts ("catomic_increment test failed");
+ ret = 1;
+ }
+
+ mem = 2;
+ if (catomic_increment_val (&mem) != 3)
+ {
+ puts ("catomic_increment_val test failed");
+ ret = 1;
+ }
+
+ mem = 17;
+ catomic_decrement (&mem);
+ if (mem != 16)
+ {
+ puts ("catomic_decrement test failed");
+ ret = 1;
+ }
+
+ if (catomic_decrement_val (&mem) != 15)
+ {
+ puts ("catomic_decrement_val test failed");
+ ret = 1;
+ }
+
+ /* Tests for C11-like atomics. */
+ mem = 11;
+ if (atomic_load_relaxed (&mem) != 11 || atomic_load_acquire (&mem) != 11)
+ {
+ puts ("atomic_load_{relaxed,acquire} test failed");
+ ret = 1;
+ }
+
+ atomic_store_relaxed (&mem, 12);
+ if (mem != 12)
+ {
+ puts ("atomic_store_relaxed test failed");
+ ret = 1;
+ }
+ atomic_store_release (&mem, 13);
+ if (mem != 13)
+ {
+ puts ("atomic_store_release test failed");
+ ret = 1;
+ }
+
+ mem = 14;
+ expected = 14;
+ if (!atomic_compare_exchange_weak_relaxed (&mem, &expected, 25)
+ || mem != 25 || expected != 14)
+ {
+ puts ("atomic_compare_exchange_weak_relaxed test 1 failed");
+ ret = 1;
+ }
+ if (atomic_compare_exchange_weak_relaxed (&mem, &expected, 14)
+ || mem != 25 || expected != 25)
+ {
+ puts ("atomic_compare_exchange_weak_relaxed test 2 failed");
+ ret = 1;
+ }
+ mem = 14;
+ expected = 14;
+ if (!atomic_compare_exchange_weak_acquire (&mem, &expected, 25)
+ || mem != 25 || expected != 14)
+ {
+ puts ("atomic_compare_exchange_weak_acquire test 1 failed");
+ ret = 1;
+ }
+ if (atomic_compare_exchange_weak_acquire (&mem, &expected, 14)
+ || mem != 25 || expected != 25)
+ {
+ puts ("atomic_compare_exchange_weak_acquire test 2 failed");
+ ret = 1;
+ }
+ mem = 14;
+ expected = 14;
+ if (!atomic_compare_exchange_weak_release (&mem, &expected, 25)
+ || mem != 25 || expected != 14)
+ {
+ puts ("atomic_compare_exchange_weak_release test 1 failed");
+ ret = 1;
+ }
+ if (atomic_compare_exchange_weak_release (&mem, &expected, 14)
+ || mem != 25 || expected != 25)
+ {
+ puts ("atomic_compare_exchange_weak_release test 2 failed");
+ ret = 1;
+ }
+
+ mem = 23;
+ if (atomic_exchange_acquire (&mem, 42) != 23 || mem != 42)
+ {
+ puts ("atomic_exchange_acquire test failed");
+ ret = 1;
+ }
+ mem = 23;
+ if (atomic_exchange_release (&mem, 42) != 23 || mem != 42)
+ {
+ puts ("atomic_exchange_release test failed");
+ ret = 1;
+ }
+
+ mem = 23;
+ if (atomic_fetch_add_relaxed (&mem, 1) != 23 || mem != 24)
+ {
+ puts ("atomic_fetch_add_relaxed test failed");
+ ret = 1;
+ }
+ mem = 23;
+ if (atomic_fetch_add_acquire (&mem, 1) != 23 || mem != 24)
+ {
+ puts ("atomic_fetch_add_acquire test failed");
+ ret = 1;
+ }
+ mem = 23;
+ if (atomic_fetch_add_release (&mem, 1) != 23 || mem != 24)
+ {
+ puts ("atomic_fetch_add_release test failed");
+ ret = 1;
+ }
+ mem = 23;
+ if (atomic_fetch_add_acq_rel (&mem, 1) != 23 || mem != 24)
+ {
+ puts ("atomic_fetch_add_acq_rel test failed");
+ ret = 1;
+ }
+
+ mem = 3;
+ if (atomic_fetch_and_acquire (&mem, 2) != 3 || mem != 2)
+ {
+ puts ("atomic_fetch_and_acquire test failed");
+ ret = 1;
+ }
+
+ mem = 4;
+ if (atomic_fetch_or_relaxed (&mem, 2) != 4 || mem != 6)
+ {
+ puts ("atomic_fetch_or_relaxed test failed");
+ ret = 1;
+ }
+ mem = 4;
+ if (atomic_fetch_or_acquire (&mem, 2) != 4 || mem != 6)
+ {
+ puts ("atomic_fetch_or_acquire test failed");
+ ret = 1;
+ }
+
+ /* This is a single-threaded test, so we can't test the effects of the
+ fences. */
+ atomic_thread_fence_acquire ();
+ atomic_thread_fence_release ();
+ atomic_thread_fence_seq_cst ();
+
+ return ret;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/test/stdlib/Makefile.in b/test/stdlib/Makefile.in
index 38c3e19..91dfde4 100644
--- a/test/stdlib/Makefile.in
+++ b/test/stdlib/Makefile.in
@@ -10,6 +10,9 @@ TESTS_DISABLED :=
ifeq ($(UCLIBC_HAS_PTY),)
TESTS_DISABLED += ptytest
endif
+ifeq ($(UCLIBC_HAS_ARC4RANDOM),)
+TESTS_DISABLED += testarc4random
+endif
CFLAGS_test-canon = -fPIC
CFLAGS_test-canon2 = -fPIC
diff --git a/test/stdlib/testarc4random.c b/test/stdlib/testarc4random.c
index 4d773aa..14ff1cc 100644
--- a/test/stdlib/testarc4random.c
+++ b/test/stdlib/testarc4random.c
@@ -3,10 +3,8 @@
int main(void)
{
-#ifdef __UCLIBC_HAS_ARC4RANDOM__
int random_number;
random_number = arc4random() % 65536;
printf("%d\n", random_number);
-#endif
return 0;
}
hooks/post-receive
--
uClibc-ng - small C library for embedded systems
1
0

uClibc-ng - small C library for embedded systems branch master updated. 045f3557b1d2390a59e2a55ece191dc35d3e95b4
by wbx@helium.waldemar-brodkorb.de 29 Mar '15
by wbx@helium.waldemar-brodkorb.de 29 Mar '15
29 Mar '15
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".
The branch, master has been updated
via 045f3557b1d2390a59e2a55ece191dc35d3e95b4 (commit)
via db1a53a5672ba9011454bdbd0724b52047b8967d (commit)
via 24946289317ea23bb0d1814cca0a499a905f7d6f (commit)
via d3c60fc490d714d7610a91555cec67952409b189 (commit)
via 70bafe7e4d52f6dafbb5888009c9b601cdbc3743 (commit)
via 8fde02feb2f8a36934308012d89fa6614967b2dc (commit)
via cc8d7d062e2db0a1ed3973e6af38cd1938ba74d7 (commit)
via 560f416794403be952e850756d7e8b23e8fa92ac (commit)
via cf80a7fc2db30364ac98be40483e599c2c243e87 (commit)
via 8836d184d4da65e8959210bc7b768e628b0273fb (commit)
via fc673e14203e1c9aea353d99ff89a17d46b2ad93 (commit)
via 2c8a7766681b704e710f51c0817534e3f9a952d1 (commit)
via 9e552e6a2d836698834d2bf887dbf1806172729f (commit)
via 6f363f69221a6b40ef0f88631cd8d675465eb63d (commit)
via 6ff9c31abc14f207265ab214370982ecb3bfe428 (commit)
via 2b33716c08cc506e57115e34b5fe11d8d5477398 (commit)
via 40effcf4c1e9a2fb9169d9189bdc9b1c888f9345 (commit)
via 730db44f0824f505a31822e250b9f04b9f8e7a1b (commit)
via 272e4fa4d38440d5c01259fce7d74f8c0a9d300f (commit)
via c846358a61434e6cb9b1f73bc35df0e5404f52d2 (commit)
via 6cba32e6e9a1910ea0a5277fd39484047094e478 (commit)
via 97c9f52239301c81c021b8be187ac07ddf33496d (commit)
via d0f60a600bafc3f6dfc844418d310cf6a4e38c92 (commit)
via 4da43e9f2e4f2f7593427003e37b87287c7b16cf (commit)
via eee76e42f32f90af4e64a254810fcb767297fecf (commit)
via 9277fe13156a6ff2b055fe8a58d2863115c36b6a (commit)
via 63729418992d5f63965a88fa2ac3570e3d270479 (commit)
via 09ff424905d5de0b2a21a3960d9756a90b07ba26 (commit)
via 534f44d53146457b3ca686c47efb9207543b88e1 (commit)
via bf6f1313132a3d99d645ea8b6661c23d68235278 (commit)
via 5c3661fda947c1bc5e597be081c355b51c595794 (commit)
via bfb988452cc66ddf93f69a199c50ea1c14e9ccb7 (commit)
via 9faa7e94b824e1dc5fd9ce1b6f16c1b3f13c601a (commit)
via fdebbe2044653c5c84172524ed6e036d38716d88 (commit)
via 74e49a5e545576f1436a510495e2e8a682b0db4d (commit)
via 39206e01eb5d27b61410a05f2ccf6051a305db02 (commit)
via be61486447ab447ac24892845af92489fe0b7148 (commit)
via 85cfbc035370d2a3715ea9de3e590ba83fae52d1 (commit)
via 6c4538905e65ceb203f59aaa9a61728e81c6bc0a (commit)
via 78e6494c2cf677d170a5c4ce0f46d152d478abc0 (commit)
via 5d3c0cc2aa60da804c9c981ffd5edcd2f02f1977 (commit)
via 6f4d5a7f53ee7f277b31bbff638bbccecf22f66f (commit)
via 8d15cd677df7e5bc6a1a01e482a33ecc2d271337 (commit)
via 75d9bf2dc57f89532a25ab9942b8bea468585199 (commit)
via f334556476cd9c33d3a9d8df9af0dfae798dc9ae (commit)
via 8ee422cffbfd3e2a16265fe6680a8dde2f5e58fe (commit)
via 21cbb6fe887a30f0777521ec10f0d0d9c2a7da7e (commit)
via 8c66e0a6c7987cda9df8c88e84b3d50d573c1dbb (commit)
via c3ddc18409b71db9e2fc863a7ff94a89b3c316ce (commit)
from 0d3dfd0f8e8f8acdea157b87b372d79ae7b512f0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 045f3557b1d2390a59e2a55ece191dc35d3e95b4
Author: Waldemar Brodkorb <wbx(a)openadk.org>
Date: Sun Mar 29 04:43:37 2015 -0500
disable new tests, atomic.h is missing
commit db1a53a5672ba9011454bdbd0724b52047b8967d
Merge: 0d3dfd0 2494628
Author: Waldemar Brodkorb <wbx(a)openadk.org>
Date: Sun Mar 29 04:42:22 2015 -0500
merge uClibc master
-----------------------------------------------------------------------
Summary of changes:
Makefile.in | 2 +
Makerules | 9 +-
extra/Configs/Config.in | 29 +-
extra/Configs/Config.in.arch | 2 +-
extra/Configs/defconfigs/arc/arcv2_defconfig | 2 +-
extra/Configs/defconfigs/arc/defconfig | 2 +-
extra/scripts/gen_bits_syscall_h.sh | 1 +
include/atomic.h | 235 +++++++-
include/complex.h | 2 +
include/dlfcn.h | 6 +-
include/fcntl.h | 2 +-
include/iconv.h | 4 +-
include/internal/utmp.h | 92 ++++
include/malloc.h | 4 +
include/math.h | 2 +
include/pty.h | 1 +
include/setjmp.h | 19 +-
include/spawn.h | 24 +-
include/stdio.h | 51 +-
include/stdlib.h | 8 +-
include/sys/cdefs.h | 24 +-
include/sys/sysmacros.h | 29 +-
include/sys/wait.h | 18 +-
include/ucontext.h | 6 +-
include/unistd.h | 75 +--
include/utmp.h | 2 +-
include/wchar.h | 8 +-
ldso/include/dl-syscall.h | 10 +-
ldso/ldso/arc/elfinterp.c | 4 +
libc/inet/resolv.c | 6 +-
libc/misc/utmp/Makefile.in | 4 +-
libc/misc/utmp/utent.c | 312 +++++------
libc/misc/utmp/utxent.c | 109 ----
libc/misc/utmp/wtent.c | 59 --
libc/stdio/_fpmaxtostr.h | 22 +-
libc/stdio/_vfprintf.c | 15 -
libc/stdlib/Makefile.in | 4 +-
libc/stdlib/malloc-standard/free.c | 6 +-
libc/stdlib/malloc-standard/malloc.c | 5 +-
libc/stdlib/malloc-standard/memalign.c | 2 +-
libc/stdlib/malloc-standard/realloc.c | 2 +-
libc/string/strverscmp.c | 69 +--
libc/sysdeps/linux/arc/sigaction.c | 3 +-
libc/sysdeps/linux/arc/sys/procfs.h | 7 +-
libc/sysdeps/linux/arm/Makefile.arch | 4 +-
libc/sysdeps/linux/common/Makefile.in | 1 +
libc/sysdeps/linux/common/bits/kernel-features.h | 5 +
libc/sysdeps/linux/common/bits/mathcalls.h | 23 +
libc/sysdeps/linux/common/bits/utmp.h | 4 +-
libc/sysdeps/linux/common/bits/utmpx.h | 2 +-
libc/sysdeps/linux/common/getrandom.c | 14 +
libc/sysdeps/linux/common/getrusage.c | 1 +
.../aeabi_unwind_cpp_pr1.c => common/makedev.c} | 31 +-
libc/sysdeps/linux/common/stubs.c | 4 +
libc/sysdeps/linux/common/sys/random.h | 33 ++
libc/sysdeps/linux/mips/bits/mathdef.h | 7 +-
libc/sysdeps/linux/mips/bits/wordsize.h | 3 +
libc/sysdeps/linux/powerpc/bits/wordsize.h | 2 +-
libc/sysdeps/linux/sh/bits/atomic.h | 12 +-
libc/sysdeps/linux/sh/bits/syscalls.h | 2 +-
libc/sysdeps/linux/sparc/bits/wordsize.h | 1 +
libc/sysdeps/linux/x86_64/bits/wordsize.h | 9 +-
libcrypt/sha256.c | 18 +-
libcrypt/sha512.c | 18 +-
libm/Makefile.in | 41 +-
libm/float_wrappers.c | 62 ++-
libm/ldouble_wrappers.c | 73 ++-
libm/s_fdim.c | 17 +-
libm/s_fmax.c | 6 +-
libm/s_fmin.c | 6 +-
libm/s_nextafter.c | 4 +-
libpthread/linuxthreads/semaphore.h | 4 +-
libpthread/linuxthreads/sysdeps/pthread/pthread.h | 36 +-
libpthread/nptl/Makefile.in | 2 +-
libpthread/nptl/pthread_atfork.c | 12 +-
libpthread/nptl/semaphore.h | 4 +-
libpthread/nptl/sysdeps/pthread/pthread.h | 64 +--
.../nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h | 2 +-
librt/Makefile.in | 3 +
libutil/Makefile.in | 8 +
libutil/forkpty.c | 3 -
libutil/login.c | 6 +-
libutil/login_tty.c | 1 -
libutil/logout.c | 8 +-
libutil/logwtmp.c | 23 +-
libutil/openpty.c | 1 -
test/.gitignore | 3 +
test/README | 3 +
test/Test.mak | 5 +-
test/math/compile_test.c | 20 +-
test/math/libm-test.inc | 62 +--
test/misc/Makefile.in | 8 +
test/misc/tst-scandir.c | 2 +-
test/misc/tst-utmp.c | 15 +
test/misc/tst-utmpx.c | 2 +
test/silly/Makefile.in | 3 +
test/silly/hello.c | 2 +-
.../silly/tst-atomic-long.c | 16 +-
test/silly/tst-atomic.c | 573 ++++++++++++++++++++
test/stdlib/Makefile.in | 3 +
test/stdlib/testarc4random.c | 2 -
101 files changed, 1803 insertions(+), 794 deletions(-)
create mode 100644 include/internal/utmp.h
delete mode 100644 libc/misc/utmp/utxent.c
delete mode 100644 libc/misc/utmp/wtent.c
create mode 100644 libc/sysdeps/linux/common/getrandom.c
copy libc/sysdeps/linux/{arm/aeabi_unwind_cpp_pr1.c => common/makedev.c} (51%)
create mode 100644 libc/sysdeps/linux/common/sys/random.h
create mode 100644 test/misc/tst-utmpx.c
copy libc/sysdeps/linux/sparc/jmpbuf-offsets.h => test/silly/tst-atomic-long.c (75%)
create mode 100644 test/silly/tst-atomic.c
diff --git a/Makefile.in b/Makefile.in
index 4dc3cd6..dedb2aa 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -294,6 +294,7 @@ HEADERS_RM-$(UCLIBC_HAS_THREADS) += *thread*.h semaphore.h \
bits/initspin.h
HEADERS_RM-$(UCLIBC_HAS_THREADS_NATIVE) += atomic.h bits/atomic.h
HEADERS_RM-$(UCLIBC_HAS_OBSTACK) += obstack.h
+HEADERS_RM-$(UCLIBC_HAS_UTMP) += bits/utmp.h utmp.h
HEADERS_RM-$(UCLIBC_HAS_UTMPX) += bits/utmpx.h utmpx.h
HEADERS_RM-$(UCLIBC_HAS_WCHAR) += wchar.h wctype.h
HEADERS_RM-$(UCLIBC_HAS_WORDEXP) += wordexp.h
@@ -310,6 +311,7 @@ HEADERS_RM-$(UCLIBC_LINUX_SPECIFIC) += \
sys/perm.h \
sys/personality.h \
sys/prctl.h \
+ sys/random.h \
sys/reboot.h \
sys/sendfile.h \
bits/signalfd.h \
diff --git a/Makerules b/Makerules
index 4a9c2c8..1060e1f 100644
--- a/Makerules
+++ b/Makerules
@@ -30,6 +30,8 @@ objs: all_objs
define add_IS_IN_lib
ifneq ($(strip $(2)),)
__add_IS_IN_lib := $(2)
+__add_IS_IN_lib += $(2:.o=.i) $(2:.os=.i) $(2:.oS=.i)
+__add_IS_IN_lib += $(2:.o=.s) $(2:.os=.s) $(2:.oS=.s)
$$(__add_IS_IN_lib): CFLAGS-for-library-members:=$(CFLAGS-$(1)) -DIN_LIB=$(word 1,$(subst /, ,$(1)))
endif
endef
@@ -326,9 +328,10 @@ cmd_hcompile.o = $(HOSTCC) $(filter-out $(PHONY),$<) $(DEPS-$(notdir $@)) -c -o
define create-lds
$(Q)$(RM) $@.lds
- $(Q)$(CC) -nostdlib -nostartfiles -shared -Wl,-z,combreloc \
- -Wl,-z,relro -Wl,--hash-style=gnu -Wl,-z,defs \
- -Wl,--verbose 2>&1 | LC_ALL=C \
+ $(Q)$(CC) $(LDFLAG-fuse-ld) $(CPU_LDFLAGS-y) \
+ -nostdlib -nostartfiles -shared -Wl,-z,combreloc \
+ -Wl,-z,relro $(CFLAG_-Wl--hash-style=gnu) -Wl,-z,defs \
+ -x c /dev/null -Wl,--verbose 2>&1 | LC_ALL=C \
$(SED) -e '/^=========/,/^=========/!d;/^=========/d' \
-e 's/^\([ ]*\)\. = .* + SIZEOF_HEADERS;/&\n\1$(SYMBOL_PREFIX)_begin = . - SIZEOF_HEADERS;/' > $@.lds
endef
diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in
index e6a013d..794d663 100644
--- a/extra/Configs/Config.in
+++ b/extra/Configs/Config.in
@@ -670,6 +670,25 @@ config COMPAT_ATEXIT
Enable this option if you want to update from 0.9.28 to git/0.9.29,
else you will be missing atexit() until you rebuild all apps.
+config UCLIBC_HAS_UTMPX
+ bool "utmpx based support for tracking login/logouts to/from the system"
+ help
+ Answer y to enable support for accessing user accounting database.
+ It can be used to track all login/logout to the system.
+
+config UCLIBC_HAS_UTMP
+ bool "utmp support (XPG2 compat, SVr4 compat)"
+ depends on UCLIBC_HAS_UTMPX
+ help
+ Answer y to enable legacy SVID support for accessing
+ user accounting database:
+ getutent(), getutid(), getutline(), pututline(),
+ setutent(), endutent(), utmpname() in utmp.h
+ It can be used to track all login/logout to the system.
+
+ If unsure, answer N and use corresponding POSIX functions
+ from utmpx.h
+
config UCLIBC_SUSV2_LEGACY
bool "Enable SuSv2 LEGACY functions"
help
@@ -995,7 +1014,7 @@ config UCLIBC_LINUX_SPECIFIC
help
accept4(), bdflush(),
capget(), capset(), eventfd(), fallocate(),
- fstatfs(), inotify_*(), ioperm(), iopl(),
+ fstatfs(), getrandom(), inotify_*(), ioperm(), iopl(),
madvise(), modify_ldt(), pipe2(), personality(),
prctl()/arch_prctl(), pivot_root(), modify_ldt(),
ppoll(), readahead(), reboot(), remap_file_pages(),
@@ -2012,14 +2031,6 @@ config UCLIBC_HAS_GNU_GLOB
Most people will answer N.
-config UCLIBC_HAS_UTMPX
- bool "utmpx based support for tracking login/logouts to/from the system"
- help
- Answer y to enable support for accessing user accounting database.
- It can be used to track all login/logout to the system.
-
- If unsure, just answer N.
-
endmenu
diff --git a/extra/Configs/Config.in.arch b/extra/Configs/Config.in.arch
index 68e03bf..0dae84b 100644
--- a/extra/Configs/Config.in.arch
+++ b/extra/Configs/Config.in.arch
@@ -191,7 +191,7 @@ config UCLIBC_HAS_FENV
config UCLIBC_HAS_LONG_DOUBLE_MATH
bool "Enable long double support"
depends on DO_C99_MATH
- depends on TARGET_i386 || TARGET_m68k || TARGET_sparc || TARGET_x86_64 || TARGET_powerpc || TARGET_sh || TARGET_microblaze || TARGET_xtensa
+ depends on TARGET_aarch64 || TARGET_alpha || TARGET_i386 || TARGET_ia64 || TARGET_m68k || TARGET_powerpc || TARGET_s390 || TARGET_sparc || TARGET_tile || TARGET_x86_64
default y
help
If you want the uClibc math library to contain the full set of C99
diff --git a/extra/Configs/defconfigs/arc/arcv2_defconfig b/extra/Configs/defconfigs/arc/arcv2_defconfig
index d3a7dc7..7c4694e 100644
--- a/extra/Configs/defconfigs/arc/arcv2_defconfig
+++ b/extra/Configs/defconfigs/arc/arcv2_defconfig
@@ -7,7 +7,7 @@ KERNEL_HEADERS="%KERNEL_HEADERS%"
# LDSO_CACHE_SUPPORT is not set
LDSO_RUNPATH=y
# LDSO_SAFE_RUNPATH is not set
-LINUXTHREADS_OLD=y
+UCLIBC_HAS_THREADS_NATIVE=y
PTHREADS_DEBUG_SUPPORT=y
UCLIBC_HAS_OBSTACK=y
UCLIBC_SUSV2_LEGACY=y
diff --git a/extra/Configs/defconfigs/arc/defconfig b/extra/Configs/defconfigs/arc/defconfig
index 490bc22..eebb115 100644
--- a/extra/Configs/defconfigs/arc/defconfig
+++ b/extra/Configs/defconfigs/arc/defconfig
@@ -6,7 +6,7 @@ KERNEL_HEADERS="%KERNEL_HEADERS%"
# LDSO_CACHE_SUPPORT is not set
LDSO_RUNPATH=y
# LDSO_SAFE_RUNPATH is not set
-LINUXTHREADS_OLD=y
+UCLIBC_HAS_THREADS_NATIVE=y
PTHREADS_DEBUG_SUPPORT=y
UCLIBC_HAS_OBSTACK=y
UCLIBC_SUSV2_LEGACY=y
diff --git a/extra/scripts/gen_bits_syscall_h.sh b/extra/scripts/gen_bits_syscall_h.sh
index c44cd8f..bfd06b8 100755
--- a/extra/scripts/gen_bits_syscall_h.sh
+++ b/extra/scripts/gen_bits_syscall_h.sh
@@ -23,6 +23,7 @@ fi
case $CC in
*icc*) CC_SYSNUM_ARGS="-dM" ;;
+*clang*) CC_SYSNUM_ARGS="-dM" ;;
*) CC_SYSNUM_ARGS="-dN" ;;
esac
diff --git a/include/atomic.h b/include/atomic.h
index 307704c..3680d87 100644
--- a/include/atomic.h
+++ b/include/atomic.h
@@ -1,5 +1,5 @@
/* Internal macros for atomic operations for GNU C Library.
- Copyright (C) 2002-2006, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper(a)redhat.com>, 2002.
@@ -32,7 +32,7 @@
the multi-thread case. The interfaces have the prefix
"catomic_".
- - support functions like barriers. They also have the preifx
+ - support functions like barriers. They also have the prefix
"atomic_".
Architectures must provide a few lowlevel macros (the compare
@@ -198,8 +198,12 @@
/* Add VALUE to *MEM and return the old value of *MEM. */
-#ifndef atomic_exchange_and_add
-# define atomic_exchange_and_add(mem, value) \
+#ifndef atomic_exchange_and_add_acq
+# ifdef atomic_exchange_and_add
+# define atomic_exchange_and_add_acq(mem, value) \
+ atomic_exchange_and_add (mem, value)
+# else
+# define atomic_exchange_and_add_acq(mem, value) \
({ __typeof (*(mem)) __atg6_oldval; \
__typeof (mem) __atg6_memp = (mem); \
__typeof (*(mem)) __atg6_value = (value); \
@@ -213,8 +217,18 @@
__atg6_oldval), 0)); \
\
__atg6_oldval; })
+# endif
#endif
+#ifndef atomic_exchange_and_add_rel
+# define atomic_exchange_and_add_rel(mem, value) \
+ atomic_exchange_and_add_acq(mem, value)
+#endif
+
+#ifndef atomic_exchange_and_add
+# define atomic_exchange_and_add(mem, value) \
+ atomic_exchange_and_add_acq(mem, value)
+#endif
#ifndef catomic_exchange_and_add
# define catomic_exchange_and_add(mem, value) \
@@ -528,6 +542,219 @@
({ __typeof (x) __x; __asm__ ("" : "=r" (__x) : "0" (x)); __x; })
#endif
+/* This is equal to 1 iff the architecture supports 64b atomic operations. */
+#define __HAVE_64B_ATOMICS 0 /* TODO: not yet used - Add these to arch bits! */
+#ifndef __HAVE_64B_ATOMICS
+#error Unable to determine if 64-bit atomics are present.
+#endif
+
+/* The following functions are a subset of the atomic operations provided by
+ C11. Usually, a function named atomic_OP_MO(args) is equivalent to C11's
+ atomic_OP_explicit(args, memory_order_MO); exceptions noted below. */
+
+/* Each arch can request to use compiler built-ins for C11 atomics. If it
+ does, all atomics will be based on these. */
+#if 0 /* not yet used USE_ATOMIC_COMPILER_BUILTINS */
+
+/* We require 32b atomic operations; some archs also support 64b atomic
+ operations. */
+void __atomic_link_error (void);
+# if __HAVE_64B_ATOMICS == 1
+# define __atomic_check_size(mem) \
+ if ((sizeof (*mem) != 4) && (sizeof (*mem) != 8)) \
+ __atomic_link_error ();
+# else
+# define __atomic_check_size(mem) \
+ if (sizeof (*mem) != 4) \
+ __atomic_link_error ();
+# endif
+
+# define atomic_thread_fence_acquire() \
+ __atomic_thread_fence (__ATOMIC_ACQUIRE)
+# define atomic_thread_fence_release() \
+ __atomic_thread_fence (__ATOMIC_RELEASE)
+# define atomic_thread_fence_seq_cst() \
+ __atomic_thread_fence (__ATOMIC_SEQ_CST)
+
+# define atomic_load_relaxed(mem) \
+ ({ __atomic_check_size((mem)); __atomic_load_n ((mem), __ATOMIC_RELAXED); })
+# define atomic_load_acquire(mem) \
+ ({ __atomic_check_size((mem)); __atomic_load_n ((mem), __ATOMIC_ACQUIRE); })
+
+# define atomic_store_relaxed(mem, val) \
+ do { \
+ __atomic_check_size((mem)); \
+ __atomic_store_n ((mem), (val), __ATOMIC_RELAXED); \
+ } while (0)
+# define atomic_store_release(mem, val) \
+ do { \
+ __atomic_check_size((mem)); \
+ __atomic_store_n ((mem), (val), __ATOMIC_RELEASE); \
+ } while (0)
+
+/* On failure, this CAS has memory_order_relaxed semantics. */
+# define atomic_compare_exchange_weak_relaxed(mem, expected, desired) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_compare_exchange_n ((mem), (expected), (desired), 1, \
+ __ATOMIC_RELAXED, __ATOMIC_RELAXED); })
+# define atomic_compare_exchange_weak_acquire(mem, expected, desired) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_compare_exchange_n ((mem), (expected), (desired), 1, \
+ __ATOMIC_ACQUIRE, __ATOMIC_RELAXED); })
+# define atomic_compare_exchange_weak_release(mem, expected, desired) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_compare_exchange_n ((mem), (expected), (desired), 1, \
+ __ATOMIC_RELEASE, __ATOMIC_RELAXED); })
+
+# define atomic_exchange_acquire(mem, desired) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_exchange_n ((mem), (desired), __ATOMIC_ACQUIRE); })
+# define atomic_exchange_release(mem, desired) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_exchange_n ((mem), (desired), __ATOMIC_RELEASE); })
+
+# define atomic_fetch_add_relaxed(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_add ((mem), (operand), __ATOMIC_RELAXED); })
+# define atomic_fetch_add_acquire(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_add ((mem), (operand), __ATOMIC_ACQUIRE); })
+# define atomic_fetch_add_release(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_add ((mem), (operand), __ATOMIC_RELEASE); })
+# define atomic_fetch_add_acq_rel(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_add ((mem), (operand), __ATOMIC_ACQ_REL); })
+
+# define atomic_fetch_and_acquire(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_and ((mem), (operand), __ATOMIC_ACQUIRE); })
+
+# define atomic_fetch_or_relaxed(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_or ((mem), (operand), __ATOMIC_RELAXED); })
+# define atomic_fetch_or_acquire(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_or ((mem), (operand), __ATOMIC_ACQUIRE); })
+
+#else /* !USE_ATOMIC_COMPILER_BUILTINS */
+
+/* By default, we assume that read, write, and full barriers are equivalent
+ to acquire, release, and seq_cst barriers. Archs for which this does not
+ hold have to provide custom definitions of the fences. */
+# ifndef atomic_thread_fence_acquire
+# define atomic_thread_fence_acquire() atomic_read_barrier ()
+# endif
+# ifndef atomic_thread_fence_release
+# define atomic_thread_fence_release() atomic_write_barrier ()
+# endif
+# ifndef atomic_thread_fence_seq_cst
+# define atomic_thread_fence_seq_cst() atomic_full_barrier ()
+# endif
+
+# ifndef atomic_load_relaxed
+# define atomic_load_relaxed(mem) \
+ ({ __typeof (*(mem)) __atg100_val; \
+ __asm__ ("" : "=r" (__atg100_val) : "0" (*(mem))); \
+ __atg100_val; })
+# endif
+# ifndef atomic_load_acquire
+# define atomic_load_acquire(mem) \
+ ({ __typeof (*(mem)) __atg101_val = atomic_load_relaxed (mem); \
+ atomic_thread_fence_acquire (); \
+ __atg101_val; })
+# endif
+
+# ifndef atomic_store_relaxed
+/* XXX Use inline asm here? */
+# define atomic_store_relaxed(mem, val) do { *(mem) = (val); } while (0)
+# endif
+# ifndef atomic_store_release
+# define atomic_store_release(mem, val) \
+ do { \
+ atomic_thread_fence_release (); \
+ atomic_store_relaxed ((mem), (val)); \
+ } while (0)
+# endif
+
+/* On failure, this CAS has memory_order_relaxed semantics. */
+/* XXX This potentially has one branch more than necessary, but archs
+ currently do not define a CAS that returns both the previous value and
+ the success flag. */
+# ifndef atomic_compare_exchange_weak_acquire
+# define atomic_compare_exchange_weak_acquire(mem, expected, desired) \
+ ({ __typeof (*(expected)) __atg102_expected = *(expected); \
+ *(expected) = \
+ atomic_compare_and_exchange_val_acq ((mem), (desired), *(expected)); \
+ *(expected) == __atg102_expected; })
+# endif
+# ifndef atomic_compare_exchange_weak_relaxed
+/* XXX Fall back to CAS with acquire MO because archs do not define a weaker
+ CAS. */
+# define atomic_compare_exchange_weak_relaxed(mem, expected, desired) \
+ atomic_compare_exchange_weak_acquire ((mem), (expected), (desired))
+# endif
+# ifndef atomic_compare_exchange_weak_release
+# define atomic_compare_exchange_weak_release(mem, expected, desired) \
+ ({ __typeof (*(expected)) __atg103_expected = *(expected); \
+ *(expected) = \
+ atomic_compare_and_exchange_val_rel ((mem), (desired), *(expected)); \
+ *(expected) == __atg103_expected; })
+# endif
+
+# ifndef atomic_exchange_acquire
+# define atomic_exchange_acquire(mem, val) \
+ atomic_exchange_acq ((mem), (val))
+# endif
+# ifndef atomic_exchange_release
+# define atomic_exchange_release(mem, val) \
+ atomic_exchange_rel ((mem), (val))
+# endif
+
+# ifndef atomic_fetch_add_acquire
+# define atomic_fetch_add_acquire(mem, operand) \
+ atomic_exchange_and_add_acq ((mem), (operand))
+# endif
+# ifndef atomic_fetch_add_relaxed
+/* XXX Fall back to acquire MO because the MO semantics of
+ atomic_exchange_and_add are not documented; the generic version falls back
+ to atomic_exchange_and_add_acq if atomic_exchange_and_add is not defined,
+ and vice versa. */
+# define atomic_fetch_add_relaxed(mem, operand) \
+ atomic_fetch_add_acquire ((mem), (operand))
+# endif
+# ifndef atomic_fetch_add_release
+# define atomic_fetch_add_release(mem, operand) \
+ atomic_exchange_and_add_rel ((mem), (operand))
+# endif
+# ifndef atomic_fetch_add_acq_rel
+# define atomic_fetch_add_acq_rel(mem, operand) \
+ ({ atomic_thread_fence_release (); \
+ atomic_exchange_and_add_acq ((mem), (operand)); })
+# endif
+
+/* XXX The default for atomic_and_val has acquire semantics, but this is not
+ documented. */
+# ifndef atomic_fetch_and_acquire
+# define atomic_fetch_and_acquire(mem, operand) \
+ atomic_and_val ((mem), (operand))
+# endif
+
+/* XXX The default for atomic_or_val has acquire semantics, but this is not
+ documented. */
+# ifndef atomic_fetch_or_acquire
+# define atomic_fetch_or_acquire(mem, operand) \
+ atomic_or_val ((mem), (operand))
+# endif
+/* XXX Fall back to acquire MO because archs do not define a weaker
+ atomic_or_val. */
+# ifndef atomic_fetch_or_relaxed
+# define atomic_fetch_or_relaxed(mem, operand) \
+ atomic_fetch_or_acquire ((mem), (operand))
+# endif
+
+#endif /* !USE_ATOMIC_COMPILER_BUILTINS */
+
#ifndef atomic_delay
# define atomic_delay() do { /* nothing */ } while (0)
diff --git a/include/complex.h b/include/complex.h
index 91efc0d..ed7e502 100644
--- a/include/complex.h
+++ b/include/complex.h
@@ -79,6 +79,7 @@ __BEGIN_DECLS
#endif
#include <bits/cmathcalls.h>
#undef _Mdouble_
+#undef _Mfloat_
#undef __MATH_PRECNAME
/* And the long double versions. It is non-critical to define them
@@ -97,6 +98,7 @@ __BEGIN_DECLS
# include <bits/cmathcalls.h>
#endif
#undef _Mdouble_
+#undef _Mlong_double_
#undef __MATH_PRECNAME
#undef __MATHDECL_1
#undef __MATHDECL
diff --git a/include/dlfcn.h b/include/dlfcn.h
index 41d0d6f..241ec54 100644
--- a/include/dlfcn.h
+++ b/include/dlfcn.h
@@ -55,11 +55,11 @@ __BEGIN_DECLS
/* Open the shared object FILE and map it in; return a handle that can be
passed to `dlsym' to get symbol values from it. */
-extern void *dlopen (const char *__file, int __mode) __THROW;
+extern void *dlopen (const char *__file, int __mode) __THROWNL;
/* Unmap and close a shared object opened by `dlopen'.
The handle cannot be used again after calling `dlclose'. */
-extern int dlclose (void *__handle) __THROW __nonnull ((1));
+extern int dlclose (void *__handle) __THROWNL __nonnull ((1));
/* Find the run-time address in the shared object HANDLE refers to
of the symbol called NAME. */
@@ -68,7 +68,7 @@ extern void *dlsym (void *__restrict __handle,
#if 0 /*def __USE_GNU*/
/* Like `dlopen', but request object to be allocated in a new namespace. */
-extern void *dlmopen (Lmid_t __nsid, const char *__file, int __mode) __THROW;
+extern void *dlmopen (Lmid_t __nsid, const char *__file, int __mode) __THROWNL;
/* Find the run-time address in the shared object HANDLE refers to
of the symbol called NAME with VERSION. */
diff --git a/include/fcntl.h b/include/fcntl.h
index 04fc2c0..11000dd 100644
--- a/include/fcntl.h
+++ b/include/fcntl.h
@@ -221,7 +221,7 @@ extern int posix_fadvise64 (int __fd, __off64_t __offset, __off64_t __len,
/* Reserve storage for the data of the file associated with FD.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
# ifndef __USE_FILE_OFFSET64
extern int posix_fallocate (int __fd, __off_t __offset, __off_t __len);
diff --git a/include/iconv.h b/include/iconv.h
index d850de5..5ab4c6c 100644
--- a/include/iconv.h
+++ b/include/iconv.h
@@ -36,7 +36,7 @@ typedef void *iconv_t;
/* Allocate descriptor for code conversion from codeset FROMCODE to
codeset TOCODE.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern iconv_t iconv_open (const char *__tocode, const char *__fromcode);
@@ -50,7 +50,7 @@ extern size_t iconv (iconv_t __cd, char **__restrict __inbuf,
/* Free resources allocated for descriptor CD for code conversion.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int iconv_close (iconv_t __cd);
diff --git a/include/internal/utmp.h b/include/internal/utmp.h
new file mode 100644
index 0000000..49f96b4
--- /dev/null
+++ b/include/internal/utmp.h
@@ -0,0 +1,92 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * internal helper for utmp and utmpx handling
+ *
+ * Copyright (C) 2015 by Bernhard Reutner-Fischer
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ */
+#ifndef __INTERNAL_UTMP_H
+#define __INTERNAL_UTMP_H
+
+#include <utmpx.h>
+#include <utmp.h>
+
+/* Note: _PATH_UTMPX == _PATH_UTMP */
+
+#if (defined __UCLIBC_HAS_UTMPX__ && defined __UCLIBC_HAS_UTMP__) \
+ || !defined __UCLIBC_HAS_UTMP__
+/* implement the X and alias the non-X */
+# define __set_unlocked __setutxent_unlocked
+# define set setutxent
+# define __get_unlocked __getutxent_unlocked
+# define get getutxent
+# define end endutxent
+# define __getid_unlocked __getutxid_unlocked
+# define getid getutxid
+# define getline getutxline
+# define putline pututxline
+# define name utmpxname
+# define updw updwtmpx
+# define UT utmpx
+# ifndef __DEFAULT_PATH_UTMP
+# define __DEFAULT_PATH_UTMP _PATH_UTMPX
+# endif
+# if defined __UCLIBC_HAS_UTMP__
+# define other(n,a) strong_alias_untyped(n,a)
+# else
+# define other(n,a) /* nothing */
+# endif
+#elif defined __UCLIBC_HAS_UTMP__
+# define __set_unlocked __setutent_unlocked
+# define set setutent
+# define __get_unlocked __getutent_unlocked
+# define get getutent
+# define end endutent
+# define __getid_unlocked __getutid_unlocked
+# define getid getutid
+# define getline getutline
+# define putline pututline
+# define name utmpname
+# define updw updwtmp
+# define UT utmp
+# ifndef __DEFAULT_PATH_UTMP
+# define __DEFAULT_PATH_UTMP _PATH_UTMP
+# endif
+# define other(n,a) /* nothing */
+#else
+#error You are supposed to either have UTMP or UTMPX or both here
+#endif
+
+/* not used in libc_hidden_proto(setutxent) */
+/* not used in libc_hidden_proto(endutxent) */
+/* not used in libc_hidden_proto(getutxent) */
+/* not used in libc_hidden_proto(getutxid) */
+/* not used in libc_hidden_proto(getutxline) */
+/* not used in libc_hidden_proto(pututxline) */
+/* not used in libc_hidden_proto(utmpxname) */
+/* not used in libc_hidden_proto(updwtmpx) */
+
+/* not used in libc_hidden_proto(setutent) */
+/* not used in libc_hidden_proto(endutent) */
+/* not used in libc_hidden_proto(getutent) */
+/* not used in libc_hidden_proto(getutid) */
+/* not used in libc_hidden_proto(getutline) */
+/* not used in libc_hidden_proto(pututline) */
+/* not used in libc_hidden_proto(utmpname) */
+/* not used in libc_hidden_proto(updwtmp) */
+
+#ifdef IS_IN_libutil
+# if (defined __UCLIBC_HAS_UTMPX__ && defined __UCLIBC_HAS_UTMP__) \
+ || !defined __UCLIBC_HAS_UTMP__
+ /* monkey-patch to use the POSIX interface */
+# define setutent setutxent
+# define getutline getutxline
+# define pututline pututxline
+# define endutent endutxent
+# define updwtmp updwtmpx
+# endif
+#endif /* IS_IN_libutil */
+
+#endif /* __INTERNAL_UTMP_H */
+
diff --git a/include/malloc.h b/include/malloc.h
index 3209fb0..a289c93 100644
--- a/include/malloc.h
+++ b/include/malloc.h
@@ -132,6 +132,7 @@ extern __malloc_ptr_t valloc __MALLOC_P ((size_t __size)) __attribute_malloc__;
#ifdef __MALLOC_STANDARD__
+# ifdef __USE_SVID
/* SVID2/XPG mallinfo structure */
struct mallinfo {
int arena; /* total space allocated from system */
@@ -149,10 +150,13 @@ struct mallinfo {
/* Returns a copy of the updated current mallinfo. */
extern struct mallinfo mallinfo __MALLOC_P ((void));
libc_hidden_proto(mallinfo)
+# endif /* __USE_SVID */
+# ifdef __USE_GNU
/* Release all but __pad bytes of freed top-most memory back to the
system. Return 1 if successful, else 0. */
extern int malloc_trim(size_t pad);
+# endif /* __USE_GNU */
#include <stdio.h>
/* Prints brief summary statistics to the specified file.
diff --git a/include/math.h b/include/math.h
index 40dd90e..c79af3f 100644
--- a/include/math.h
+++ b/include/math.h
@@ -131,6 +131,7 @@ __BEGIN_DECLS
# undef _Mdouble_
# undef _Mdouble_BEGIN_NAMESPACE
# undef _Mdouble_END_NAMESPACE
+# undef _Mfloat_
# undef __MATH_PRECNAME
# undef __MATH_maybe_libm_hidden_proto
@@ -178,6 +179,7 @@ extern long double __REDIRECT_NTH (nexttowardl, (long double __x, long double __
# undef _Mdouble_
# undef _Mdouble_BEGIN_NAMESPACE
# undef _Mdouble_END_NAMESPACE
+# undef _Mlong_double_
# undef __MATH_PRECNAME
# undef __MATH_maybe_libm_hidden_proto
diff --git a/include/pty.h b/include/pty.h
index 26c3011..f23a260 100644
--- a/include/pty.h
+++ b/include/pty.h
@@ -32,6 +32,7 @@ __BEGIN_DECLS
ends in AMASTER and ASLAVE. */
extern int openpty (int *__amaster, int *__aslave, char *__name,
struct termios *__termp, struct winsize *__winp) __THROW;
+libutil_hidden_proto(openpty)
/* Create child process and establish the slave pseudo terminal as the
child's controlling terminal. */
diff --git a/include/setjmp.h b/include/setjmp.h
index c950137..71c1d35 100644
--- a/include/setjmp.h
+++ b/include/setjmp.h
@@ -49,19 +49,20 @@ typedef struct __jmp_buf_tag jmp_buf[1];
/* Store the calling environment in ENV, also saving the signal mask.
Return 0. */
-extern int setjmp (jmp_buf __env) __THROW;
+extern int setjmp (jmp_buf __env) __THROWNL;
__END_NAMESPACE_STD
/* Store the calling environment in ENV, also saving the
signal mask if SAVEMASK is nonzero. Return 0.
This is the internal name for `sigsetjmp'. */
-extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) __THROW;
+extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask)
+ __THROWNL;
#ifndef __FAVOR_BSD
/* Store the calling environment in ENV, not saving the signal mask.
Return 0. */
-extern int _setjmp (struct __jmp_buf_tag __env[1]) __THROW;
+extern int _setjmp (struct __jmp_buf_tag __env[1]) __THROWNL;
/* Do not save the signal mask. This is equivalent to the `_setjmp'
BSD function. */
@@ -79,7 +80,7 @@ __BEGIN_NAMESPACE_STD
/* Jump to the environment saved in ENV, making the
`setjmp' call there return VAL, or 1 if VAL is 0. */
extern void longjmp (struct __jmp_buf_tag __env[1], int __val)
- __THROW __attribute__ ((__noreturn__));
+ __THROWNL __attribute__ ((__noreturn__));
__END_NAMESPACE_STD
@@ -88,7 +89,7 @@ __END_NAMESPACE_STD
the signal mask. But it is how ENV was saved that determines whether
`longjmp' restores the mask; `_longjmp' is just an alias. */
extern void _longjmp (struct __jmp_buf_tag __env[1], int __val)
- __THROW __attribute__ ((__noreturn__));
+ __THROWNL __attribute__ ((__noreturn__));
#endif
@@ -107,16 +108,16 @@ typedef struct __jmp_buf_tag sigjmp_buf[1];
Restore the signal mask if that sigsetjmp call saved it.
This is just an alias `longjmp'. */
extern void siglongjmp (sigjmp_buf __env, int __val)
- __THROW __attribute__ ((__noreturn__));
+ __THROWNL __attribute__ ((__noreturn__));
#endif /* Use POSIX. */
__END_DECLS
#ifdef _LIBC
-extern void __longjmp(__jmp_buf __env, int __val) attribute_noreturn;
+extern void __longjmp(__jmp_buf __env, int __val) __THROWNL attribute_noreturn;
libc_hidden_proto(__longjmp)
-extern __typeof(longjmp) __libc_longjmp attribute_noreturn;
-extern __typeof(siglongjmp) __libc_siglongjmp attribute_noreturn;
+extern __typeof(longjmp) __libc_longjmp __THROWNL attribute_noreturn;
+extern __typeof(siglongjmp) __libc_siglongjmp __THROWNL attribute_noreturn;
extern void _longjmp_unwind(jmp_buf __env, int __val);
libc_hidden_proto(_longjmp_unwind)
extern int __sigjmp_save(sigjmp_buf __env, int __savemask) attribute_hidden;
diff --git a/include/spawn.h b/include/spawn.h
index 95fff35..3de375b 100644
--- a/include/spawn.h
+++ b/include/spawn.h
@@ -66,15 +66,6 @@ typedef struct
# define POSIX_SPAWN_USEVFORK 0x40
#endif
-
-#define __POSIX_SPAWN_MASK (POSIX_SPAWN_RESETIDS \
- | POSIX_SPAWN_SETPGROUP \
- | POSIX_SPAWN_SETSIGDEF \
- | POSIX_SPAWN_SETSIGMASK \
- | POSIX_SPAWN_SETSCHEDPARAM \
- | POSIX_SPAWN_SETSCHEDULER \
- | POSIX_SPAWN_USEVFORK)
-
__BEGIN_DECLS
/* Spawn a new process executing PATH with the attributes describes in *ATTRP.
@@ -170,12 +161,27 @@ static inline
int posix_spawnattr_setflags (posix_spawnattr_t *_attr,
short int __flags)
{
+#ifdef POSIX_SPAWN_USEVFORK
+# define __POSIX_SPAWN_USEVFORK POSIX_SPAWN_USEVFORK
+#else
+# define __POSIX_SPAWN_USEVFORK 0
+#endif
+#define __POSIX_SPAWN_MASK (POSIX_SPAWN_RESETIDS \
+ | POSIX_SPAWN_SETPGROUP \
+ | POSIX_SPAWN_SETSIGDEF \
+ | POSIX_SPAWN_SETSIGMASK \
+ | POSIX_SPAWN_SETSCHEDPARAM \
+ | POSIX_SPAWN_SETSCHEDULER \
+ | __POSIX_SPAWN_USEVFORK)
+
/* Check no invalid bits are set. */
if (__flags & ~__POSIX_SPAWN_MASK)
return EINVAL;
_attr->__flags = __flags;
return 0;
+#undef __POSIX_SPAWN_USEVFORK
+#undef __POSIX_SPAWN_MASK
}
/* Get process group ID from the attribute structure. */
diff --git a/include/stdio.h b/include/stdio.h
index 75c1464..9aae5ab 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -157,7 +157,7 @@ libc_hidden_proto(renameat)
__BEGIN_NAMESPACE_STD
/* Create a temporary file and open it read/write.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
#ifndef __USE_FILE_OFFSET64
extern FILE *tmpfile (void) __wur;
@@ -345,8 +345,8 @@ extern int printf (const char *__restrict __format, ...);
libc_hidden_proto(printf)
/* Write formatted output to S. */
extern int sprintf (char *__restrict __s,
- const char *__restrict __format, ...)
- __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
+ const char *__restrict __format, ...) __THROWNL
+ __attribute__ ((__format__ (__printf__, 2, 3)));
libc_hidden_proto(sprintf)
/* Write formatted output to S from argument list ARG.
@@ -363,8 +363,8 @@ libc_hidden_proto(vfprintf)
extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
/* Write formatted output to S from argument list ARG. */
extern int vsprintf (char *__restrict __s, const char *__restrict __format,
- __gnuc_va_list __arg)
- __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
+ __gnuc_va_list __arg) __THROWNL
+ __attribute__ ((__format__ (__printf__, 2, 0)));
__END_NAMESPACE_STD
#if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
@@ -372,12 +372,12 @@ __BEGIN_NAMESPACE_C99
/* Maximum chars of output to write in MAXLEN. */
extern int snprintf (char *__restrict __s, size_t __maxlen,
const char *__restrict __format, ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
+ __THROWNL __attribute__ ((__format__ (__printf__, 3, 4)));
libc_hidden_proto(snprintf)
extern int vsnprintf (char *__restrict __s, size_t __maxlen,
const char *__restrict __format, __gnuc_va_list __arg)
- __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
+ __THROWNL __attribute__ ((__format__ (__printf__, 3, 0)));
libc_hidden_proto(vsnprintf)
__END_NAMESPACE_C99
#endif
@@ -387,26 +387,24 @@ __END_NAMESPACE_C99
Store the address of the string in *PTR. */
extern int vasprintf (char **__restrict __ptr, const char *__restrict __f,
__gnuc_va_list __arg)
- __THROW __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
+ __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
libc_hidden_proto(vasprintf)
#if 0 /* uClibc: disabled */
extern int __asprintf (char **__restrict __ptr,
const char *__restrict __fmt, ...)
- __THROW __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
+ __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
#endif
extern int asprintf (char **__restrict __ptr,
const char *__restrict __fmt, ...)
- __THROW __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
+ __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
libc_hidden_proto(asprintf)
#endif
#ifdef __USE_XOPEN2K8
/* Write formatted output to a file descriptor.
- These functions are not part of POSIX and therefore no official
- cancellation point. But due to similarity with an POSIX interface
- or due to the implementation they are cancellation points and
- therefore not marked with __THROW. */
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
extern int vdprintf (int __fd, const char *__restrict __fmt,
__gnuc_va_list __arg)
__attribute__ ((__format__ (__printf__, 2, 0)));
@@ -570,12 +568,21 @@ extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
__wur;
libc_hidden_proto(fgets)
+#if !defined __USE_ISOC11 \
+ || (defined __cplusplus && __cplusplus <= 201103L)
/* Get a newline-terminated string from stdin, removing the newline.
DO NOT USE THIS FUNCTION!! There is no limit on how much it will read.
+ The function has been officially removed in ISO C11. This opportunity
+ is used to also remove it from the GNU feature list. It is now only
+ available when explicitly using an old ISO C, Unix, or POSIX standard.
+ GCC defines _GNU_SOURCE when building C++ code and the function is still
+ in C++11, so it is also available for C++.
+
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern char *gets (char *__s) __wur;
+extern char *gets (char *__s) __wur __attribute_deprecated__;
+#endif
__END_NAMESPACE_STD
#ifdef __USE_GNU
@@ -628,21 +635,21 @@ libc_hidden_proto(getline)
__BEGIN_NAMESPACE_STD
/* Write a string to STREAM.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int fputs (const char *__restrict __s, FILE *__restrict __stream);
libc_hidden_proto(fputs)
/* Write a string, followed by a newline, to stdout.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int puts (const char *__s);
/* Push a character back onto the input buffer of STREAM.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int ungetc (int __c, FILE *__stream);
libc_hidden_proto(ungetc)
@@ -650,14 +657,14 @@ libc_hidden_proto(ungetc)
/* Read chunks of generic data from STREAM.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern size_t fread (void *__restrict __ptr, size_t __size,
size_t __n, FILE *__restrict __stream) __wur;
libc_hidden_proto(fread)
/* Write chunks of generic data to STREAM.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern size_t fwrite (const void *__restrict __ptr, size_t __size,
size_t __n, FILE *__restrict __s) __wur;
@@ -860,11 +867,11 @@ struct obstack; /* See <obstack.h>. */
/* Write formatted output to an obstack. */
extern int obstack_printf (struct obstack *__restrict __obstack,
const char *__restrict __format, ...)
- __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
+ __THROWNL __attribute__ ((__format__ (__printf__, 2, 3)));
extern int obstack_vprintf (struct obstack *__restrict __obstack,
const char *__restrict __format,
__gnuc_va_list __args)
- __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
+ __THROWNL __attribute__ ((__format__ (__printf__, 2, 0)));
libc_hidden_proto(obstack_vprintf)
#endif /* USE_GNU && UCLIBC_HAS_OBSTACK. */
diff --git a/include/stdlib.h b/include/stdlib.h
index b2d7020..809256d 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -38,7 +38,7 @@ __BEGIN_DECLS
#ifndef __need_malloc_and_calloc
#define _STDLIB_H 1
-#if defined __USE_XOPEN && !defined _SYS_WAIT_H
+#if (defined __USE_XOPEN || defined __USE_XOPEN2K8) && !defined _SYS_WAIT_H
/* XPG requires a few symbols from <sys/wait.h> being defined. */
# include <bits/waitflags.h>
# include <bits/waitstatus.h>
@@ -486,11 +486,11 @@ extern int lcong48_r (unsigned short int __param[7],
__BEGIN_NAMESPACE_STD
/* Allocate SIZE bytes of memory. */
extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur;
-/* We want the malloc symbols overridable at runtime
- * libc_hidden_proto(malloc) */
+/* We want the malloc symbol overridable at runtime, do not hide it! */
/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */
extern void *calloc (size_t __nmemb, size_t __size)
__THROW __attribute_malloc__ __wur;
+/* We want the calloc symbol overridable at runtime, do not hide it! */
__END_NAMESPACE_STD
#endif
@@ -503,8 +503,10 @@ __BEGIN_NAMESPACE_STD
between objects pointed by the old and new pointers. */
extern void *realloc (void *__ptr, size_t __size)
__THROW __wur;
+/* We want the realloc symbol overridable at runtime, do not hide it! */
/* Free a block allocated by `malloc', `realloc' or `calloc'. */
extern void free (void *__ptr) __THROW;
+/* We want the free symbol overridable at runtime, do not hide it! */
__END_NAMESPACE_STD
#if 0 /*def __USE_MISC*/
diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h
index 6f81b6a..4da981f 100644
--- a/include/sys/cdefs.h
+++ b/include/sys/cdefs.h
@@ -37,20 +37,33 @@
#ifdef __GNUC__
+/* All functions, except those with callbacks or those that
+ synchronize memory, are leaf functions. */
+# if __GNUC_PREREQ (4, 6) && !defined _LIBC
+# define __LEAF , __leaf__
+# define __LEAF_ATTR __attribute__ ((__leaf__))
+# else
+# define __LEAF
+# define __LEAF_ATTR
+# endif
+
/* GCC can always grok prototypes. For C++ programs we add throw()
to help it optimize the function calls. But this works only with
gcc 2.8.x and egcs. For gcc 3.2 and up we even mark C functions
as non-throwing using a function attribute since programs can use
the -fexceptions options for C code as well. */
# if !defined __cplusplus && __GNUC_PREREQ (3, 3)
-# define __THROW __attribute__ ((__nothrow__))
-# define __NTH(fct) __attribute__ ((__nothrow__)) fct
+# define __THROW __attribute__ ((__nothrow__ __LEAF))
+# define __THROWNL __attribute__ ((__nothrow__))
+# define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct
# else
# if defined __cplusplus && __GNUC_PREREQ (2,8)
# define __THROW throw ()
-# define __NTH(fct) fct throw ()
+# define __THROWNL throw ()
+# define __NTH(fct) __LEAF_ATTR fct throw ()
# else
# define __THROW
+# define __THROWNL
# define __NTH(fct) fct
# endif
# endif
@@ -60,6 +73,7 @@
# define __inline /* No inline functions. */
# define __THROW
+# define __THROWNL
# define __NTH(fct) fct
#endif /* GCC. */
@@ -165,9 +179,13 @@
# ifdef __cplusplus
# define __REDIRECT_NTH(name, proto, alias) \
name proto __THROW __asm__ (__ASMNAME (#alias))
+# define __REDIRECT_NTHNL(name, proto, alias) \
+ name proto __THROWNL __asm__ (__ASMNAME (#alias))
# else
# define __REDIRECT_NTH(name, proto, alias) \
name proto __asm__ (__ASMNAME (#alias)) __THROW
+# define __REDIRECT_NTHNL(name, proto, alias) \
+ name proto __asm__ (__ASMNAME (#alias)) __THROWNL
# endif
# define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname)
# define __ASMNAME2(prefix, cname) __STRING (prefix) cname
diff --git a/include/sys/sysmacros.h b/include/sys/sysmacros.h
index 7a5635e..3addb75 100644
--- a/include/sys/sysmacros.h
+++ b/include/sys/sysmacros.h
@@ -21,35 +21,39 @@
#include <features.h>
+__BEGIN_DECLS
+
/* If the compiler does not know long long it is out of luck. We are
not going to hack weird hacks to support the dev_t representation
they need. */
-#if 1 /*def __GLIBC_HAVE_LONG_LONG uClibc note: always enable */
+
__extension__
-static __inline unsigned int gnu_dev_major (unsigned long long int __dev)
- __THROW;
+extern unsigned int gnu_dev_major (unsigned long long int __dev)
+ __THROW __attribute__ ((__const__));
+libc_hidden_proto(gnu_dev_major)
__extension__
-static __inline unsigned int gnu_dev_minor (unsigned long long int __dev)
- __THROW;
+extern unsigned int gnu_dev_minor (unsigned long long int __dev)
+ __THROW __attribute__ ((__const__));
+libc_hidden_proto(gnu_dev_minor)
__extension__
-static __inline unsigned long long int gnu_dev_makedev (unsigned int __major,
+extern unsigned long long int gnu_dev_makedev (unsigned int __major,
unsigned int __minor)
- __THROW;
+ __THROW __attribute__ ((__const__));
-# if defined __GNUC__ && __GNUC__ >= 2
-__extension__ static __inline unsigned int
+# ifdef __USE_EXTERN_INLINES
+__extension__ __extern_inline __attribute__ ((__const__)) unsigned int
__NTH (gnu_dev_major (unsigned long long int __dev))
{
return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff);
}
-__extension__ static __inline unsigned int
+__extension__ __extern_inline __attribute__ ((__const__)) unsigned int
__NTH (gnu_dev_minor (unsigned long long int __dev))
{
return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff);
}
-__extension__ static __inline unsigned long long int
+__extension__ __extern_inline __attribute__ ((__const__)) unsigned long long int
__NTH (gnu_dev_makedev (unsigned int __major, unsigned int __minor))
{
return ((__minor & 0xff) | ((__major & 0xfff) << 8)
@@ -57,12 +61,11 @@ __NTH (gnu_dev_makedev (unsigned int __major, unsigned int __minor))
| (((unsigned long long int) (__major & ~0xfff)) << 32));
}
# endif
-
+__END_DECLS
/* Access the functions with their traditional names. */
# define major(dev) gnu_dev_major (dev)
# define minor(dev) gnu_dev_minor (dev)
# define makedev(maj, min) gnu_dev_makedev (maj, min)
-#endif
#endif /* sys/sysmacros.h */
diff --git a/include/sys/wait.h b/include/sys/wait.h
index b3c2b97..f7a420b 100644
--- a/include/sys/wait.h
+++ b/include/sys/wait.h
@@ -28,10 +28,9 @@
__BEGIN_DECLS
#include <signal.h>
-#include <sys/resource.h>
/* These macros could also be defined in <stdlib.h>. */
-#if !defined _STDLIB_H || !defined __USE_XOPEN
+#if !defined _STDLIB_H || (!defined __USE_XOPEN && !defined __USE_XOPEN2K8)
/* This will define the `W*' macros for the flag
bits to `waitpid', `wait3', and `wait4'. */
# include <bits/waitflags.h>
@@ -97,7 +96,7 @@ typedef union
#endif
/* The following values are used by the `waitid' function. */
-#if defined __USE_SVID || defined __USE_XOPEN
+#if defined __USE_SVID || defined __USE_XOPEN || defined __USE_XOPEN2K8
typedef enum
{
P_ALL, /* Wait for any child. */
@@ -141,9 +140,15 @@ extern __typeof(waitpid) __waitpid_nocancel attribute_hidden;
libc_hidden_proto(waitpid)
#endif
-#if defined __USE_SVID || defined __USE_XOPEN
+#if defined __USE_SVID || defined __USE_XOPEN || defined __USE_XOPEN2K8
+# ifndef __id_t_defined
+# include <bits/types.h>
+ typedef __id_t id_t;
+# define __id_t_defined
+# endif
# define __need_siginfo_t
# include <bits/siginfo.h>
+
/* Wait for a childing matching IDTYPE and ID to change the status and
place appropriate information in *INFOP.
If IDTYPE is P_PID, match any process whose process ID is ID.
@@ -160,19 +165,20 @@ extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop,
#endif
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+struct rusage;
/* Wait for a child to exit. When one does, put its status in *STAT_LOC and
return its process ID. For errors return (pid_t) -1. If USAGE is not
nil, store information about the child's resource usage there. If the
WUNTRACED bit is set in OPTIONS, return status for stopped children;
otherwise don't. */
extern __pid_t wait3 (__WAIT_STATUS __stat_loc, int __options,
- struct rusage * __usage) __THROW;
+ struct rusage * __usage) __THROWNL;
#endif
#ifdef __USE_BSD
/* PID is like waitpid. Other args are like wait3. */
extern __pid_t wait4 (__pid_t __pid, __WAIT_STATUS __stat_loc, int __options,
- struct rusage *__usage) __THROW;
+ struct rusage *__usage) __THROWNL;
#endif /* Use BSD. */
#ifdef _LIBC
diff --git a/include/ucontext.h b/include/ucontext.h
index f11db77..4ce114e 100644
--- a/include/ucontext.h
+++ b/include/ucontext.h
@@ -31,15 +31,15 @@
__BEGIN_DECLS
/* Get user context and store it in variable pointed to by UCP. */
-extern int getcontext (ucontext_t *__ucp) __THROW;
+extern int getcontext (ucontext_t *__ucp) __THROWNL;
/* Set user context from information of variable pointed to by UCP. */
-extern int setcontext (const ucontext_t *__ucp) __THROW;
+extern int setcontext (const ucontext_t *__ucp) __THROWNL;
/* Save current context in context variable pointed to by OUCP and set
context from variable pointed to by UCP. */
extern int swapcontext (ucontext_t *__restrict __oucp,
- const ucontext_t *__restrict __ucp) __THROW;
+ const ucontext_t *__restrict __ucp) __THROWNL;
/* Manipulate user context UCP to continue with calling functions FUNC
and the ARGC-1 parameters following ARGC when the context is used
diff --git a/include/unistd.h b/include/unistd.h
index 967e058..3793d2d 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -206,7 +206,7 @@ __BEGIN_DECLS
#include <bits/uClibc_posix_opt.h>
/* Get the environment definitions from Unix98. */
-#ifdef __USE_UNIX98
+#if defined __USE_UNIX98 || defined __USE_XOPEN2K
# include <bits/environments.h>
#endif
@@ -266,7 +266,7 @@ typedef __pid_t pid_t;
# endif
#endif /* X/Open */
-#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
# ifndef __intptr_t_defined
typedef __intptr_t intptr_t;
# define __intptr_t_defined
@@ -387,7 +387,7 @@ extern __typeof(write) __write_nocancel attribute_hidden;
libc_hidden_proto(write)
#endif
-#ifdef __USE_UNIX98
+#if defined __USE_UNIX98 || defined __USE_XOPEN2K8
# ifndef __USE_FILE_OFFSET64
/* Read NBYTES into BUF from FD at the given position OFFSET without
changing the file pointer. Return the number read, -1 for errors
@@ -469,8 +469,9 @@ libc_hidden_proto(alarm)
extern unsigned int sleep (unsigned int __seconds);
libc_hidden_proto(sleep)
-#if (defined __USE_BSD || defined __USE_XOPEN_EXTENDED) \
- && defined __UCLIBC_SUSV3_LEGACY__
+#if (defined __USE_BSD \
+ || (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) \
+ ) && defined __UCLIBC_SUSV3_LEGACY__
/* Set an alarm to go off (generating a SIGALRM signal) in VALUE
microseconds. If INTERVAL is nonzero, when the alarm goes off, the
timer is reset to go off every INTERVAL microseconds thereafter.
@@ -500,7 +501,7 @@ extern int chown (const char *__file, __uid_t __owner, __gid_t __group)
__THROW __nonnull ((1)) __wur;
libc_hidden_proto(chown)
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
/* Change the owner and group of the file that FD is open on. */
extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __THROW __wur;
@@ -525,7 +526,7 @@ libc_hidden_proto(fchownat)
extern int chdir (const char *__path) __THROW __nonnull ((1)) __wur;
libc_hidden_proto(chdir)
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
/* Change the process's working directory to the one FD is open on. */
extern int fchdir (int __fd) __THROW __wur;
libc_hidden_proto(fchdir)
@@ -548,7 +549,7 @@ libc_hidden_proto(getcwd)
extern char *get_current_dir_name (void) __THROW;
#endif
-#if 0 /*defined __USE_BSD || defined __USE_XOPEN_EXTENDED*/
+#if 0 /*defined __USE_BSD || (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8)*/
/* Put the absolute pathname of the current working directory in BUF.
If successful, return BUF. If not, put an error message in
BUF and return NULL. BUF should be at least PATH_MAX bytes long. */
@@ -581,52 +582,53 @@ extern char **environ;
/* Replace the current process, executing PATH with arguments ARGV and
environment ENVP. ARGV and ENVP are terminated by NULL pointers. */
extern int execve (const char *__path, char *const __argv[],
- char *const __envp[]) __THROW __nonnull ((1));
+ char *const __envp[]) __THROW __nonnull ((1, 2));
libc_hidden_proto(execve)
#if 0 /*def __USE_XOPEN2K8*/
/* Execute the file FD refers to, overlaying the running program image.
ARGV and ENVP are passed to the new program, as for `execve'. */
extern int fexecve (int __fd, char *const __argv[], char *const __envp[])
- __THROW;
+ __THROW __nonnull ((2));
#endif
/* Execute PATH with arguments ARGV and environment from `environ'. */
extern int execv (const char *__path, char *const __argv[])
- __THROW __nonnull ((1));
+ __THROW __nonnull ((1, 2));
libc_hidden_proto(execv)
/* Execute PATH with all arguments after PATH until a NULL pointer,
and the argument after that for environment. */
extern int execle (const char *__path, const char *__arg, ...)
- __THROW __nonnull ((1));
+ __THROW __nonnull ((1, 2));
libc_hidden_proto(execle)
/* Execute PATH with all arguments after PATH until
a NULL pointer and environment from `environ'. */
extern int execl (const char *__path, const char *__arg, ...)
- __THROW __nonnull ((1));
+ __THROW __nonnull ((1, 2));
libc_hidden_proto(execl)
/* Execute FILE, searching in the `PATH' environment variable if it contains
no slashes, with arguments ARGV and environment from `environ'. */
extern int execvp (const char *__file, char *const __argv[])
- __THROW __nonnull ((1));
+ __THROW __nonnull ((1, 2));
libc_hidden_proto(execvp)
/* Execute FILE, searching in the `PATH' environment variable if
it contains no slashes, with all arguments after FILE until a
NULL pointer and environment from `environ'. */
extern int execlp (const char *__file, const char *__arg, ...)
- __THROW __nonnull ((1));
+ __THROW __nonnull ((1, 2));
libc_hidden_proto(execlp)
#ifdef __USE_GNU
/* Execute FILE, searching in the `PATH' environment variable if it contains
no slashes, with arguments ARGV and environment from a pointer */
-extern int execvpe (__const char *__file, char *__const __argv[], char *__const __envp[])
- __THROW __nonnull ((1));
+extern int execvpe (const char *__file, char *const __argv[],
+ char *const __envp[])
+ __THROW __nonnull ((1, 2));
libc_hidden_proto(execvpe)
#endif
@@ -685,7 +687,7 @@ extern __pid_t __REDIRECT_NTH (getpgrp, (__pid_t __pid), __getpgid);
/* Get the process group ID of process PID. */
extern __pid_t __getpgid (__pid_t __pid) __THROW;
-#ifdef __USE_XOPEN_EXTENDED
+#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
extern __pid_t getpgid (__pid_t __pid) __THROW;
#endif
@@ -731,7 +733,7 @@ extern int __REDIRECT_NTH (setpgrp, (__pid_t __pid, __pid_t __pgrp), setpgid);
extern __pid_t setsid (void) __THROW;
libc_hidden_proto(setsid)
-#ifdef __USE_XOPEN_EXTENDED
+#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
/* Return the session ID of the given process. */
extern __pid_t getsid (__pid_t __pid) __THROW;
libc_hidden_proto(getsid)
@@ -768,37 +770,37 @@ extern int group_member (__gid_t __gid) __THROW;
If the calling process is the super-user, set the real
and effective user IDs, and the saved set-user-ID to UID;
if not, the effective user ID is set to UID. */
-extern int setuid (__uid_t __uid) __THROW;
+extern int setuid (__uid_t __uid) __THROW __wur;
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
/* Set the real user ID of the calling process to RUID,
and the effective user ID of the calling process to EUID. */
-extern int setreuid (__uid_t __ruid, __uid_t __euid) __THROW;
+extern int setreuid (__uid_t __ruid, __uid_t __euid) __THROW __wur;
libc_hidden_proto(setreuid)
#endif
#if defined __USE_BSD || defined __USE_XOPEN2K
/* Set the effective user ID of the calling process to UID. */
-extern int seteuid (__uid_t __uid) __THROW;
+extern int seteuid (__uid_t __uid) __THROW __wur;
libc_hidden_proto(seteuid)
-#endif /* Use BSD. */
+#endif
/* Set the group ID of the calling process to GID.
If the calling process is the super-user, set the real
and effective group IDs, and the saved set-group-ID to GID;
if not, the effective group ID is set to GID. */
-extern int setgid (__gid_t __gid) __THROW;
+extern int setgid (__gid_t __gid) __THROW __wur;
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
/* Set the real group ID of the calling process to RGID,
and the effective group ID of the calling process to EGID. */
-extern int setregid (__gid_t __rgid, __gid_t __egid) __THROW;
+extern int setregid (__gid_t __rgid, __gid_t __egid) __THROW __wur;
libc_hidden_proto(setregid)
#endif
#if defined __USE_BSD || defined __USE_XOPEN2K
/* Set the effective group ID of the calling process to GID. */
-extern int setegid (__gid_t __gid) __THROW;
+extern int setegid (__gid_t __gid) __THROW __wur;
#endif /* Use BSD. */
#ifdef __USE_GNU
@@ -816,14 +818,14 @@ extern int getresgid (__gid_t *__rgid, __gid_t *__egid, __gid_t *__sgid)
/* Set the real user ID, effective user ID, and saved-set user ID,
of the calling process to RUID, EUID, and SUID, respectively. */
extern int setresuid (__uid_t __ruid, __uid_t __euid, __uid_t __suid)
- __THROW;
+ __THROW __wur;
libc_hidden_proto(setresuid)
#endif
/* Set the real group ID, effective group ID, and saved-set group ID,
of the calling process to RGID, EGID, and SGID, respectively. */
extern int setresgid (__gid_t __rgid, __gid_t __egid, __gid_t __sgid)
- __THROW;
+ __THROW __wur;
libc_hidden_proto(setresgid)
#endif
@@ -832,7 +834,7 @@ libc_hidden_proto(setresgid)
/* Clone the calling process, creating an exact copy.
Return -1 for errors, 0 to the new process,
and the process ID of the new process to the old process. */
-extern __pid_t fork (void) __THROW;
+extern __pid_t fork (void) __THROWNL;
# ifdef _LIBC
# ifdef __UCLIBC_HAS_THREADS__
extern __typeof(fork) __libc_fork;
@@ -903,7 +905,7 @@ extern ssize_t readlink (const char *__restrict __path,
char *__restrict __buf, size_t __len)
__THROW __nonnull ((1, 2)) __wur;
libc_hidden_proto(readlink)
-#endif /* Use BSD. */
+#endif /* Use POSIX.1-2001. */
#ifdef __USE_ATFILE
/* Like symlink but a relative path in TO is interpreted relative to TOFD. */
@@ -944,7 +946,7 @@ extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __THROW;
/* Return the login name of the user.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern char *getlogin (void);
libc_hidden_proto(getlogin)
@@ -953,7 +955,7 @@ libc_hidden_proto(getlogin)
If it cannot be determined or some other error occurred, return the error
code. Otherwise return 0.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int getlogin_r (char *__name, size_t __name_len) __nonnull ((1));
#endif
@@ -974,7 +976,7 @@ extern int setlogin (const char *__name) __THROW __nonnull ((1));
#endif
-#if defined __USE_BSD || defined __USE_UNIX98
+#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K
/* Put the name of the current host in no more than LEN bytes of NAME.
The result is null-terminated if LEN is large enough for the full
name and the terminator. */
@@ -1071,6 +1073,11 @@ extern char *getpass (const char *__prompt) __nonnull ((1));
extern int fsync (int __fd);
#endif /* Use BSD || X/Open || Unix98. */
+#if 0 /*def __USE_GNU */
+/* Make all changes done to all files on the file system associated
+ * with FD actually appear on disk. */
+extern int syncfs (int __fd) __THROW;
+#endif
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
@@ -1263,7 +1270,7 @@ extern void swab (const void *__restrict __from, void *__restrict __to,
/* The Single Unix specification demands this prototype to be here.
It is also found in <stdio.h>. */
-#ifdef __USE_XOPEN
+#if defined __USE_XOPEN && !defined __USE_XOPEN2K
/* Return the name of the controlling terminal. */
extern char *ctermid (char *__s) __THROW;
#endif
diff --git a/include/utmp.h b/include/utmp.h
index 2908e33..8ecbb54 100644
--- a/include/utmp.h
+++ b/include/utmp.h
@@ -40,7 +40,7 @@ __BEGIN_DECLS
/* Make FD be the controlling terminal, stdin, stdout, and stderr;
then close FD. Returns 0 on success, nonzero on error. */
extern int login_tty (int __fd) __THROW;
-
+libutil_hidden_proto(login_tty)
/* Write the given entry into utmp and wtmp. */
extern void login (const struct utmp *__entry) __THROW;
diff --git a/include/wchar.h b/include/wchar.h
index 4ddd258..67f44b7 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -660,7 +660,7 @@ extern wint_t putwc (wchar_t __wc, __FILE *__stream);
/* Write a character to stdout.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern wint_t putwchar (wchar_t __wc);
@@ -668,14 +668,14 @@ extern wint_t putwchar (wchar_t __wc);
/* Get a newline-terminated wide character string of finite length
from STREAM.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n,
__FILE *__restrict __stream);
/* Write a string to STREAM.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int fputws (const wchar_t *__restrict __ws,
__FILE *__restrict __stream);
@@ -684,7 +684,7 @@ libc_hidden_proto(fputws)
/* Push a character back onto the input buffer of STREAM.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern wint_t ungetwc (wint_t __wc, __FILE *__stream);
libc_hidden_proto(ungetwc)
diff --git a/ldso/include/dl-syscall.h b/ldso/include/dl-syscall.h
index ac4c57e..4749d7a 100644
--- a/ldso/include/dl-syscall.h
+++ b/ldso/include/dl-syscall.h
@@ -48,7 +48,15 @@ extern int _dl_errno;
dynamic linking at all, so we cannot return any error codes.
We just punt if there is an error. */
#define __NR__dl_exit __NR_exit
-static __always_inline _syscall1(void, _dl_exit, int, status)
+static __always_inline attribute_noreturn __cold void _dl_exit(int status)
+{
+ INLINE_SYSCALL(_dl_exit, 1, status);
+#if defined __GNUC__
+ __builtin_unreachable(); /* shut up warning: 'noreturn' function does return*/
+#else
+ while (1);
+#endif
+}
#define __NR__dl_close __NR_close
static __always_inline _syscall1(int, _dl_close, int, fd)
diff --git a/ldso/ldso/arc/elfinterp.c b/ldso/ldso/arc/elfinterp.c
index 7c31d3a..2f0cf7f 100644
--- a/ldso/ldso/arc/elfinterp.c
+++ b/ldso/ldso/arc/elfinterp.c
@@ -144,6 +144,8 @@ _dl_do_reloc(struct elf_resolve *tpnt, struct r_scope_elem *scope,
#endif
switch (reloc_type) {
+ case R_ARC_NONE:
+ break;
case R_ARC_32:
*reloc_addr += symbol_addr + rpnt->r_addend;
break;
@@ -202,6 +204,8 @@ _dl_do_lazy_reloc(struct elf_resolve *tpnt, struct r_scope_elem *scope,
#endif
switch (reloc_type) {
+ case R_ARC_NONE:
+ break;
case R_ARC_JMP_SLOT:
*reloc_addr += tpnt->loadaddr;
break;
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index cfc1eee..31e6381 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -1615,9 +1615,13 @@ int __read_etc_hosts_r(
#endif
;
int ret = HOST_NOT_FOUND;
+ /* make sure pointer is aligned */
+ int i = ALIGN_BUFFER_OFFSET(buf);
+ buf += i;
+ buflen -= i;
*h_errnop = NETDB_INTERNAL;
- if (buflen < aliaslen
+ if (/* (ssize_t)buflen < 0 || */ buflen < aliaslen
|| (buflen - aliaslen) < BUFSZ + 1)
return ERANGE;
if (parser == NULL)
diff --git a/libc/misc/utmp/Makefile.in b/libc/misc/utmp/Makefile.in
index 535efb1..6c54ade 100644
--- a/libc/misc/utmp/Makefile.in
+++ b/libc/misc/utmp/Makefile.in
@@ -7,8 +7,8 @@
subdirs += libc/misc/utmp
-CSRC-y := utent.c wtent.c
-CSRC-$(UCLIBC_HAS_UTMPX) += utxent.c
+CSRC-y :=
+CSRC-$(if $(findstring y,$(UCLIBC_HAS_UTMP)$(UCLIBC_HAS_UTMPX)),y) += utent.c
MISC_UTMP_DIR := $(top_srcdir)libc/misc/utmp
MISC_UTMP_OUT := $(top_builddir)libc/misc/utmp
diff --git a/libc/misc/utmp/utent.c b/libc/misc/utmp/utent.c
index a35bb2b..3671bb0 100644
--- a/libc/misc/utmp/utent.c
+++ b/libc/misc/utmp/utent.c
@@ -1,3 +1,4 @@
+/* vi: set sw=4 ts=4: */
/* utent.c <ndf(a)linux.mit.edu> */
/* Let it be known that this is very possibly the worst standard ever. HP-UX
does one thing, someone else does another, linux another... If anyone
@@ -18,230 +19,211 @@
#include <paths.h>
#include <errno.h>
#include <string.h>
-#include <utmp.h>
-#ifdef __UCLIBC_HAS_UTMPX__
-# include <utmpx.h>
-#endif
+#include "internal/utmp.h"
#include <not-cancel.h>
-
#include <bits/uClibc_mutex.h>
+
__UCLIBC_MUTEX_STATIC(utmplock, PTHREAD_MUTEX_INITIALIZER);
/* Some global crap */
static int static_fd = -1;
-static struct utmp static_utmp;
-static const char default_file_name[] = _PATH_UTMP;
-static const char *static_ut_name = default_file_name;
+static struct UT static_utmp;
+static const char default_file[] = __DEFAULT_PATH_UTMP;
+static const char *current_file = default_file;
/* This function must be called with the LOCK held */
-static void __setutent_unlocked(void)
+static void __set_unlocked(void)
{
- if (static_fd < 0) {
- static_fd = open_not_cancel_2(static_ut_name, O_RDWR | O_CLOEXEC);
if (static_fd < 0) {
- static_fd = open_not_cancel_2(static_ut_name, O_RDONLY | O_CLOEXEC);
- if (static_fd < 0) {
- return; /* static_fd remains < 0 */
- }
- }
+ static_fd = open_not_cancel_2(current_file, O_RDWR | O_CLOEXEC);
+ if (static_fd < 0) {
+ static_fd = open_not_cancel_2(current_file, O_RDONLY | O_CLOEXEC);
+ if (static_fd < 0) {
+ return; /* static_fd remains < 0 */
+ }
+ }
#ifndef __ASSUME_O_CLOEXEC
- /* Make sure the file will be closed on exec() */
- fcntl_not_cancel(static_fd, F_SETFD, FD_CLOEXEC);
+ /* Make sure the file will be closed on exec() */
+ fcntl_not_cancel(static_fd, F_SETFD, FD_CLOEXEC);
#endif
- return;
- }
- lseek(static_fd, 0, SEEK_SET);
+ return;
+ }
+ lseek(static_fd, 0, SEEK_SET);
}
#if defined __UCLIBC_HAS_THREADS__
-static void __setutent(void)
+void set(void)
{
- __UCLIBC_MUTEX_LOCK(utmplock);
- __setutent_unlocked();
- __UCLIBC_MUTEX_UNLOCK(utmplock);
+ __UCLIBC_MUTEX_LOCK(utmplock);
+ __set_unlocked();
+ __UCLIBC_MUTEX_UNLOCK(utmplock);
}
#else
-static void __setutent(void);
-strong_alias(__setutent_unlocked,__setutent)
-#endif
-strong_alias(__setutent,setutent)
-
-#ifdef __UCLIBC_HAS_UTMPX__
-strong_alias(__setutent,setutxent)
+strong_alias(__set_unlocked,set)
#endif
+/* not used in libc_hidden_def(set) */
+other(setutxent,setutent)
/* This function must be called with the LOCK held */
-static struct utmp *__getutent_unlocked(void)
+static struct UT *__get_unlocked(void)
{
- if (static_fd < 0) {
- __setutent();
if (static_fd < 0) {
- return NULL;
+ __set_unlocked();
+ if (static_fd < 0)
+ return NULL;
}
- }
- if (read_not_cancel(static_fd, &static_utmp, sizeof(static_utmp)) == sizeof(static_utmp)) {
- return &static_utmp;
- }
+ if (read_not_cancel(static_fd, &static_utmp,
+ sizeof(static_utmp)) == sizeof(static_utmp)) {
+ return &static_utmp;
+ }
- return NULL;
+ return NULL;
}
#if defined __UCLIBC_HAS_THREADS__
-static struct utmp *__getutent(void)
+struct UT *get(void)
{
- struct utmp *ret;
+ struct UT *ret;
- __UCLIBC_MUTEX_LOCK(utmplock);
- ret = __getutent_unlocked();
- __UCLIBC_MUTEX_UNLOCK(utmplock);
- return ret;
+ __UCLIBC_MUTEX_LOCK(utmplock);
+ ret = __get_unlocked();
+ __UCLIBC_MUTEX_UNLOCK(utmplock);
+ return ret;
}
#else
-static struct utmp *__getutent(void);
-strong_alias(__getutent_unlocked,__getutent)
+strong_alias(__get_unlocked,get)
#endif
-strong_alias(__getutent,getutent)
+/* not used in libc_hidden_def(get) */
+other(getutxent,getutent)
-#ifdef __UCLIBC_HAS_UTMPX__
-struct utmpx *getutxent(void)
+void end(void)
{
- return (struct utmpx *) __getutent ();
-}
-#endif
-
-static void __endutent(void)
-{
- __UCLIBC_MUTEX_LOCK(utmplock);
- if (static_fd >= 0)
- close_not_cancel_no_status(static_fd);
- static_fd = -1;
- __UCLIBC_MUTEX_UNLOCK(utmplock);
+ __UCLIBC_MUTEX_LOCK(utmplock);
+ if (static_fd >= 0)
+ close_not_cancel_no_status(static_fd);
+ static_fd = -1;
+ __UCLIBC_MUTEX_UNLOCK(utmplock);
}
-strong_alias(__endutent,endutent)
-
-#ifdef __UCLIBC_HAS_UTMPX__
-strong_alias(__endutent,endutxent)
-#endif
+/* not used in libc_hidden_def(end) */
+other(endutxent,endutent)
/* This function must be called with the LOCK held */
-static struct utmp *__getutid_unlocked(const struct utmp *utmp_entry)
+static struct UT *__getid_unlocked(const struct UT *utmp_entry)
{
- struct utmp *lutmp;
- unsigned type;
-
- /* We use the fact that constants we are interested in are: */
- /* RUN_LVL=1, ... OLD_TIME=4; INIT_PROCESS=5, ... USER_PROCESS=8 */
- type = utmp_entry->ut_type - 1;
- type /= 4;
-
- while ((lutmp = __getutent_unlocked()) != NULL) {
- if (type == 0 && lutmp->ut_type == utmp_entry->ut_type) {
- /* one of RUN_LVL, BOOT_TIME, NEW_TIME, OLD_TIME */
- return lutmp;
+ struct UT *lutmp;
+ unsigned type;
+
+ /* We use the fact that constants we are interested in are: */
+ /* RUN_LVL=1, ... OLD_TIME=4; INIT_PROCESS=5, ... USER_PROCESS=8 */
+ type = utmp_entry->ut_type - 1;
+ type /= 4;
+
+ while ((lutmp = __get_unlocked()) != NULL) {
+ if (type == 0 && lutmp->ut_type == utmp_entry->ut_type) {
+ /* one of RUN_LVL, BOOT_TIME, NEW_TIME, OLD_TIME */
+ return lutmp;
+ }
+ if (type == 1
+ && strncmp(lutmp->ut_id, utmp_entry->ut_id,
+ sizeof(lutmp->ut_id)) == 0) {
+ /* INIT_PROCESS, LOGIN_PROCESS, USER_PROCESS, DEAD_PROCESS */
+ return lutmp;
+ }
}
- if (type == 1 && strncmp(lutmp->ut_id, utmp_entry->ut_id, sizeof(lutmp->ut_id)) == 0) {
- /* INIT_PROCESS, LOGIN_PROCESS, USER_PROCESS, DEAD_PROCESS */
- return lutmp;
- }
- }
- return NULL;
+ return NULL;
}
#if defined __UCLIBC_HAS_THREADS__
-static struct utmp *__getutid(const struct utmp *utmp_entry)
+struct UT *getid(const struct UT *utmp_entry)
{
- struct utmp *ret;
+ struct UT *ret;
- __UCLIBC_MUTEX_LOCK(utmplock);
- ret = __getutid_unlocked(utmp_entry);
- __UCLIBC_MUTEX_UNLOCK(utmplock);
- return ret;
+ __UCLIBC_MUTEX_LOCK(utmplock);
+ ret = __getid_unlocked(utmp_entry);
+ __UCLIBC_MUTEX_UNLOCK(utmplock);
+ return ret;
}
#else
-static struct utmp *__getutid(const struct utmp *utmp_entry);
-strong_alias(__getutid_unlocked,__getutid)
-#endif
-strong_alias(__getutid,getutid)
-
-#ifdef __UCLIBC_HAS_UTMPX__
-struct utmpx *getutxid(const struct utmpx *utmp_entry)
-{
- return (struct utmpx *) __getutid ((const struct utmp *) utmp_entry);
-}
+strong_alias(__getid_unlocked,getid)
#endif
+/* not used in libc_hidden_def(getid) */
+other(getutxid,getutid)
-static struct utmp *__getutline(const struct utmp *utmp_entry)
+struct UT *getline(const struct UT *utmp_entry)
{
- struct utmp *lutmp;
-
- __UCLIBC_MUTEX_LOCK(utmplock);
- while ((lutmp = __getutent_unlocked()) != NULL) {
- if (lutmp->ut_type == USER_PROCESS || lutmp->ut_type == LOGIN_PROCESS) {
- if (strncmp(lutmp->ut_line, utmp_entry->ut_line, sizeof(lutmp->ut_line)) == 0) {
- break;
- }
+ struct UT *lutmp;
+
+ __UCLIBC_MUTEX_LOCK(utmplock);
+ while ((lutmp = __get_unlocked()) != NULL) {
+ if (lutmp->ut_type == USER_PROCESS || lutmp->ut_type == LOGIN_PROCESS) {
+ if (strncmp(lutmp->ut_line, utmp_entry->ut_line,
+ sizeof(lutmp->ut_line)) == 0) {
+ break;
+ }
+ }
}
- }
- __UCLIBC_MUTEX_UNLOCK(utmplock);
- return lutmp;
+ __UCLIBC_MUTEX_UNLOCK(utmplock);
+ return lutmp;
}
-strong_alias(__getutline,getutline)
+/* libc_hidden_def(getline) */
+other(getutxline,getutline)
-#ifdef __UCLIBC_HAS_UTMPX__
-struct utmpx *getutxline(const struct utmpx *utmp_entry)
+struct UT *putline(const struct UT *utmp_entry)
{
- return (struct utmpx *) __getutline ((const struct utmp *) utmp_entry);
+ __UCLIBC_MUTEX_LOCK(utmplock);
+ /* Ignore the return value. That way, if they've already positioned
+ the file pointer where they want it, everything will work out. */
+ lseek(static_fd, (off_t) - sizeof(struct UT), SEEK_CUR);
+
+ if (__getid_unlocked(utmp_entry) != NULL)
+ lseek(static_fd, (off_t) - sizeof(struct UT), SEEK_CUR);
+ else
+ lseek(static_fd, (off_t) 0, SEEK_END);
+ if (write(static_fd, utmp_entry, sizeof(struct UT))
+ != sizeof(struct UT))
+ utmp_entry = NULL;
+
+ __UCLIBC_MUTEX_UNLOCK(utmplock);
+ return (struct UT *)utmp_entry;
}
-#endif
+/* not used in libc_hidden_def(putline) */
+other(pututxline,pututline)
-static struct utmp *__pututline(const struct utmp *utmp_entry)
+int name(const char *new_file)
{
- __UCLIBC_MUTEX_LOCK(utmplock);
- /* Ignore the return value. That way, if they've already positioned
- the file pointer where they want it, everything will work out. */
- lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR);
-
- if (__getutid_unlocked(utmp_entry) != NULL)
- lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR);
- else
- lseek(static_fd, (off_t) 0, SEEK_END);
- if (write(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp))
- utmp_entry = NULL;
-
- __UCLIBC_MUTEX_UNLOCK(utmplock);
- return (struct utmp *)utmp_entry;
-}
-strong_alias(__pututline,pututline)
+ __UCLIBC_MUTEX_LOCK(utmplock);
+ if (new_file != NULL) {
+ if (current_file != default_file)
+ free((char *)current_file);
+ current_file = strdup(new_file);
+ if (current_file == NULL) {
+ /* We should probably whine about out-of-memory
+ * errors here... Instead just reset to the default */
+ current_file = default_file;
+ }
+ }
-#ifdef __UCLIBC_HAS_UTMPX__
-struct utmpx *pututxline (const struct utmpx *utmp_entry)
-{
- return (struct utmpx *) __pututline ((const struct utmp *) utmp_entry);
+ if (static_fd >= 0) {
+ close_not_cancel_no_status(static_fd);
+ static_fd = -1;
+ }
+ __UCLIBC_MUTEX_UNLOCK(utmplock);
+ return 0; /* or maybe return -(current_file != new_file)? */
}
-#endif
+/* not used in libc_hidden_def(name) */
+other(utmpxname,utmpname)
-static int __utmpname(const char *new_ut_name)
+void updw(const char *wtmp_file, const struct UT *lutmp)
{
- __UCLIBC_MUTEX_LOCK(utmplock);
- if (new_ut_name != NULL) {
- if (static_ut_name != default_file_name)
- free((char *)static_ut_name);
- static_ut_name = strdup(new_ut_name);
- if (static_ut_name == NULL) {
- /* We should probably whine about out-of-memory
- * errors here... Instead just reset to the default */
- static_ut_name = default_file_name;
+ int fd;
+
+ fd = open_not_cancel_2(wtmp_file, O_APPEND | O_WRONLY);
+ if (fd >= 0) {
+ if (lockf(fd, F_LOCK, 0) == 0) {
+ write_not_cancel(fd, lutmp, sizeof(struct UT));
+ lockf(fd, F_ULOCK, 0);
+ close_not_cancel_no_status(fd);
+ }
}
- }
-
- if (static_fd >= 0) {
- close_not_cancel_no_status(static_fd);
- static_fd = -1;
- }
- __UCLIBC_MUTEX_UNLOCK(utmplock);
- return 0; /* or maybe return -(static_ut_name != new_ut_name)? */
}
-strong_alias(__utmpname,utmpname)
-
-#ifdef __UCLIBC_HAS_UTMPX__
-strong_alias(__utmpname,utmpxname)
-#endif
+/* not used in libc_hidden_def(updw) */
+other(updwtmpx,updwtmp)
diff --git a/libc/misc/utmp/utxent.c b/libc/misc/utmp/utxent.c
deleted file mode 100644
index 71157cc..0000000
--- a/libc/misc/utmp/utxent.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * utexent.c : Support for accessing user accounting database.
- * Copyright (C) 2010 STMicroelectronics Ltd.
- *
- * Author: Salvatore Cro <salvatore.cro(a)st.com>
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- *
- */
-
-#include <features.h>
-#include <string.h>
-#include <utmpx.h>
-#include <utmp.h>
-
-#if 0 /* moved to utent.c */
-void setutxent(void)
-{
- setutent ();
-}
-
-void endutxent(void)
-{
- endutent ();
-}
-
-struct utmpx *getutxent(void)
-{
- return (struct utmpx *) getutent ();
-}
-
-struct utmpx *getutxid(const struct utmpx *utmp_entry)
-{
- return (struct utmpx *) getutid ((const struct utmp *) utmp_entry);
-}
-
-struct utmpx *getutxline(const struct utmpx *utmp_entry)
-{
- return (struct utmpx *) getutline ((const struct utmp *) utmp_entry);
-}
-
-struct utmpx *pututxline (const struct utmpx *utmp_entry)
-{
- return (struct utmpx *) pututline ((const struct utmp *) utmp_entry);
-}
-
-int utmpxname (const char *new_ut_name)
-{
- return utmpname (new_ut_name);
-}
-
-/* moved to wtent.c */
-void updwtmpx (const char *wtmpx_file, const struct utmpx *utmpx)
-{
- updwtmp (wtmpx_file, (const struct utmp *) utmpx);
-}
-#endif
-
-/* Copy the information in UTMPX to UTMP. */
-void getutmp (const struct utmpx *utmpx, struct utmp *utmp)
-{
-#if _HAVE_UT_TYPE - 0
- utmp->ut_type = utmpx->ut_type;
-#endif
-#if _HAVE_UT_PID - 0
- utmp->ut_pid = utmpx->ut_pid;
-#endif
- memcpy (utmp->ut_line, utmpx->ut_line, sizeof (utmp->ut_line));
- memcpy (utmp->ut_user, utmpx->ut_user, sizeof (utmp->ut_user));
-#if _HAVE_UT_ID - 0
- memcpy (utmp->ut_id, utmpx->ut_id, sizeof (utmp->ut_id));
-#endif
-#if _HAVE_UT_HOST - 0
- memcpy (utmp->ut_host, utmpx->ut_host, sizeof (utmp->ut_host));
-#endif
-#if _HAVE_UT_TV - 0
- utmp->ut_tv.tv_sec = utmpx->ut_tv.tv_sec;
- utmp->ut_tv.tv_usec = utmpx->ut_tv.tv_usec;
-#else
- utmp->ut_time = utmpx->ut_time;
-#endif
-}
-
-/* Copy the information in UTMP to UTMPX. */
-void getutmpx (const struct utmp *utmp, struct utmpx *utmpx)
-{
- memset (utmpx, 0, sizeof (struct utmpx));
-
-#if _HAVE_UT_TYPE - 0
- utmpx->ut_type = utmp->ut_type;
-#endif
-#if _HAVE_UT_PID - 0
- utmpx->ut_pid = utmp->ut_pid;
-#endif
- memcpy (utmpx->ut_line, utmp->ut_line, sizeof (utmp->ut_line));
- memcpy (utmpx->ut_user, utmp->ut_user, sizeof (utmp->ut_user));
-#if _HAVE_UT_ID - 0
- memcpy (utmpx->ut_id, utmp->ut_id, sizeof (utmp->ut_id));
-#endif
-#if _HAVE_UT_HOST - 0
- memcpy (utmpx->ut_host, utmp->ut_host, sizeof (utmp->ut_host));
-#endif
-#if _HAVE_UT_TV - 0
- utmpx->ut_tv.tv_sec = utmp->ut_tv.tv_sec;
- utmpx->ut_tv.tv_usec = utmp->ut_tv.tv_usec;
-#else
- utmpx->ut_time = utmp->ut_time;
-#endif
-}
diff --git a/libc/misc/utmp/wtent.c b/libc/misc/utmp/wtent.c
deleted file mode 100644
index 9b3ad50..0000000
--- a/libc/misc/utmp/wtent.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2000-2006 Erik Andersen <andersen(a)uclibc.org>
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- */
-
-/* wtmp support rubbish (i.e. complete crap) */
-
-#include <string.h>
-#include <sys/time.h>
-#include <time.h>
-#include <unistd.h>
-#include <utmp.h>
-#ifdef __UCLIBC_HAS_UTMPX__
-# include <utmpx.h>
-#endif
-#include <fcntl.h>
-#include <sys/file.h>
-#include <not-cancel.h>
-
-#if 0
-/* This is enabled in uClibc/libutil/logwtmp.c */
-void logwtmp (const char *line, const char *name, const char *host)
-{
- struct utmp lutmp;
- memset(&lutmp, 0, sizeof(lutmp));
-
- lutmp.ut_type = (name && *name) ? USER_PROCESS : DEAD_PROCESS;
- lutmp.ut_pid = getpid();
- strncpy(lutmp.ut_line, line, sizeof(lutmp.ut_line)-1);
- strncpy(lutmp.ut_name, name, sizeof(lutmp.ut_name)-1);
- strncpy(lutmp.ut_host, host, sizeof(lutmp.ut_host)-1);
- gettimeofday(&(lutmp.ut_tv), NULL);
-
- updwtmp(_PATH_WTMP, &lutmp);
-}
-#endif
-
-static void __updwtmp(const char *wtmp_file, const struct utmp *lutmp)
-{
- int fd;
-
- fd = open_not_cancel_2(wtmp_file, O_APPEND | O_WRONLY);
- if (fd >= 0) {
- if (lockf(fd, F_LOCK, 0) == 0) {
- write_not_cancel(fd, lutmp, sizeof(struct utmp));
- lockf(fd, F_ULOCK, 0);
- close_not_cancel_no_status(fd);
- }
- }
-}
-strong_alias(__updwtmp,updwtmp)
-
-#ifdef __UCLIBC_HAS_UTMPX__
-void updwtmpx (const char *wtmpx_file, const struct utmpx *utmpx)
-{
- __updwtmp (wtmpx_file, (const struct utmp *) utmpx);
-}
-#endif
diff --git a/libc/stdio/_fpmaxtostr.h b/libc/stdio/_fpmaxtostr.h
index b4e7321..7694629 100644
--- a/libc/stdio/_fpmaxtostr.h
+++ b/libc/stdio/_fpmaxtostr.h
@@ -11,39 +11,39 @@
#define _FPMAXTOSTR_H 1
#include <features.h>
-#ifdef __UCLIBC_HAS_FLOATS__
-
#define __need_size_t
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <printf.h>
#include <sys/types.h>
-#include <float.h>
-#include <bits/uClibc_fpmax.h>
+
+#ifdef __UCLIBC_HAS_FLOATS__
+# include <float.h>
+# include <bits/uClibc_fpmax.h>
/* WARNING: Adjust _fp_out_wide() in _vfprintf.c if this changes! */
/* With 32 bit ints, we can get 9 decimal digits per block. */
-#define DIGITS_PER_BLOCK 9
+# define DIGITS_PER_BLOCK 9
-#define NUM_DIGIT_BLOCKS ((DECIMAL_DIG+DIGITS_PER_BLOCK-1)/DIGITS_PER_BLOCK)
+# define NUM_DIGIT_BLOCKS ((DECIMAL_DIG+DIGITS_PER_BLOCK-1)/DIGITS_PER_BLOCK)
/* WARNING: Adjust _fp_out_wide() in _vfprintf.c if this changes! */
/* extra space for '-', '.', 'e+###', and nul */
-#define BUF_SIZE ( 3 + NUM_DIGIT_BLOCKS * DIGITS_PER_BLOCK )
+# define BUF_SIZE ( 3 + NUM_DIGIT_BLOCKS * DIGITS_PER_BLOCK )
/* psm: why do these internals differ? */
-#ifdef __USE_OLD_VFPRINTF__
+# ifdef __USE_OLD_VFPRINTF__
typedef void (__fp_outfunc_t)(FILE *fp, intptr_t type, intptr_t len, intptr_t buf);
extern size_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info,
__fp_outfunc_t fp_outfunc) attribute_hidden;
-#else
+# else
typedef size_t (__fp_outfunc_t)(FILE *fp, intptr_t type, intptr_t len, intptr_t buf);
extern ssize_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info,
__fp_outfunc_t fp_outfunc) attribute_hidden;
-#endif
+# endif
-#endif /* __UCLIBC_HAS_FLOATS__ */
+# endif /* __UCLIBC_HAS_FLOATS__ */
#endif /* _FPMAXTOSTR_H */
diff --git a/libc/stdio/_vfprintf.c b/libc/stdio/_vfprintf.c
index 01ee218..a795f49 100644
--- a/libc/stdio/_vfprintf.c
+++ b/libc/stdio/_vfprintf.c
@@ -121,18 +121,6 @@
#error Apparently, LONG_LONG_MAX is defined but LLONG_MAX is not. You need to fix your toolchain headers to support the standard macros for (unsigned) long long.
#endif
-/**********************************************************************/
-/* These provide some control over printf's feature set */
-
-/* Now controlled by uClibc_config.h. */
-/* #define __UCLIBC_HAS_FLOATS__ 1 */
-
-/* Now controlled by uClibc_config.h. */
-/* #define __UCLIBC_HAS_PRINTF_M_SPEC__ */
-
-
-/**********************************************************************/
-
#include "_fpmaxtostr.h"
#undef __STDIO_HAS_VSNPRINTF
@@ -142,9 +130,6 @@
/**********************************************************************/
-/* Now controlled by uClibc_config.h. */
-/* #define __UCLIBC_HAS_GLIBC_CUSTOM_PRINTF__ */
-
#ifdef __UCLIBC_MJN3_ONLY__
# ifdef L_register_printf_function
/* emit only once */
diff --git a/libc/stdlib/Makefile.in b/libc/stdlib/Makefile.in
index 880de78..071f911 100644
--- a/libc/stdlib/Makefile.in
+++ b/libc/stdlib/Makefile.in
@@ -61,7 +61,6 @@ CSRC-$(if $(findstring yyy,$(UCLIBC_HAS_FLOATS)$(UCLIBC_HAS_WCHAR)$(UCLIBC_HAS_X
# multi source _atexit.c
CSRC-y += __cxa_atexit.c __cxa_finalize.c __exit_handler.c exit.c on_exit.c
-CSRC-$(COMPAT_ATEXIT) += old_atexit.c
STDLIB_DIR := $(top_srcdir)libc/stdlib
STDLIB_OUT := $(top_builddir)libc/stdlib
@@ -71,11 +70,12 @@ STDLIB_OBJ := $(patsubst %.c,$(STDLIB_OUT)/%.o,$(CSRC-y))
libc-y += $(STDLIB_OBJ)
libc-static-y += $(STDLIB_OUT)/atexit.o $(STDLIB_OUT)/system.o
+libc-static-$(COMPAT_ATEXIT) += $(STDLIB_OUT)/old_atexit.o
libc-shared-y += $(STDLIB_OUT)/system.oS
# this should always be the PIC version, because it could be used in shared libs
libc-nonshared-y += $(STDLIB_OUT)/atexit.os
-
+libc-nonshared-$(COMPAT_ATEXIT) += $(STDLIB_OUT)/old_atexit.os
libc-nomulti-y += $(STDLIB_OUT)/labs.o $(STDLIB_OUT)/atol.o $(STDLIB_OUT)/_stdlib_strto_l.o $(STDLIB_OUT)/_stdlib_strto_ll.o
libc-nomulti-$(UCLIBC_HAS_XLOCALE) += $(STDLIB_OUT)/_stdlib_strto_l_l.o $(STDLIB_OUT)/_stdlib_strto_ll_l.o
diff --git a/libc/stdlib/malloc-standard/free.c b/libc/stdlib/malloc-standard/free.c
index 39e54d6..8b7a81f 100644
--- a/libc/stdlib/malloc-standard/free.c
+++ b/libc/stdlib/malloc-standard/free.c
@@ -104,9 +104,13 @@ static int __malloc_trim(size_t pad, mstate av)
*/
int malloc_trim(size_t pad)
{
+ int r;
+ __MALLOC_LOCK;
mstate av = get_malloc_state();
__malloc_consolidate(av);
- return __malloc_trim(pad, av);
+ r = __malloc_trim(pad, av);
+ __MALLOC_UNLOCK;
+ return r;
}
/*
diff --git a/libc/stdlib/malloc-standard/malloc.c b/libc/stdlib/malloc-standard/malloc.c
index 2abb5bb..fd33b50 100644
--- a/libc/stdlib/malloc-standard/malloc.c
+++ b/libc/stdlib/malloc-standard/malloc.c
@@ -832,8 +832,6 @@ void* malloc(size_t bytes)
}
#endif
- __MALLOC_LOCK;
- av = get_malloc_state();
/*
Convert request size to internal form by adding (sizeof(size_t)) bytes
overhead plus possibly more to obtain necessary alignment and/or
@@ -845,6 +843,9 @@ void* malloc(size_t bytes)
checked_request2size(bytes, nb);
+ __MALLOC_LOCK;
+ av = get_malloc_state();
+
/*
Bypass search if no frees yet
*/
diff --git a/libc/stdlib/malloc-standard/memalign.c b/libc/stdlib/malloc-standard/memalign.c
index 6303c1d..e9ae5a7 100644
--- a/libc/stdlib/malloc-standard/memalign.c
+++ b/libc/stdlib/malloc-standard/memalign.c
@@ -52,8 +52,8 @@ void* memalign(size_t alignment, size_t bytes)
alignment = a;
}
- __MALLOC_LOCK;
checked_request2size(bytes, nb);
+ __MALLOC_LOCK;
/* Strategy: find a spot within that chunk that meets the alignment
* request, and then possibly free the leading and trailing space. */
diff --git a/libc/stdlib/malloc-standard/realloc.c b/libc/stdlib/malloc-standard/realloc.c
index e060b70..e49d111 100644
--- a/libc/stdlib/malloc-standard/realloc.c
+++ b/libc/stdlib/malloc-standard/realloc.c
@@ -54,9 +54,9 @@ void* realloc(void* oldmem, size_t bytes)
return NULL;
}
+ checked_request2size(bytes, nb);
__MALLOC_LOCK;
av = get_malloc_state();
- checked_request2size(bytes, nb);
oldp = mem2chunk(oldmem);
oldsize = chunksize(oldp);
diff --git a/libc/string/strverscmp.c b/libc/string/strverscmp.c
index 714f4ed..7818a91 100644
--- a/libc/string/strverscmp.c
+++ b/libc/string/strverscmp.c
@@ -1,13 +1,8 @@
-/* GNU's strverscmp() function, taken from glibc 2.3.2 sources
- */
-
/* Compare strings while treating digits characters numerically.
- Copyright (C) 1997, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jean-Fran�ois Bignolles <bignolle(a)ecoledoc.ibp.fr>, 1997.
- Derived work for uClibc by Hai Zaar, Codefidence Ltd <haizaar(a)codefidence.com>
-
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
@@ -22,63 +17,54 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#include <stdint.h>
#include <string.h>
#include <ctype.h>
-#include <stdint.h>
-
/* states: S_N: normal, S_I: comparing integral part, S_F: comparing
- fractional parts, S_Z: idem but with leading Zeroes only */
+ fractionnal parts, S_Z: idem but with leading Zeroes only */
#define S_N 0x0
-#define S_I 0x4
-#define S_F 0x8
-#define S_Z 0xC
+#define S_I 0x3
+#define S_F 0x6
+#define S_Z 0x9
/* result_type: CMP: return diff; LEN: compare using len_diff/diff */
#define CMP 2
#define LEN 3
-/* using more efficient isdigit() */
-#undef isdigit
-#define isdigit(a) ((unsigned)((a) - '0') <= 9)
/* Compare S1 and S2 as strings holding indices/version numbers,
returning less than, equal to or greater than zero if S1 is less than,
equal to or greater than S2 (for more info, see the texinfo doc).
*/
+
int strverscmp (const char *s1, const char *s2)
{
const unsigned char *p1 = (const unsigned char *) s1;
const unsigned char *p2 = (const unsigned char *) s2;
- unsigned char c1, c2;
- int state;
- int diff;
- /* Symbol(s) 0 [1-9] others (padding)
- Transition (10) 0 (01) d (00) x (11) - */
+ /* Symbol(s) 0 [1-9] others
+ Transition (10) 0 (01) d (00) x */
static const uint8_t next_state[] =
{
- /* state x d 0 - */
- /* S_N */ S_N, S_I, S_Z, S_N,
- /* S_I */ S_N, S_I, S_I, S_I,
- /* S_F */ S_N, S_F, S_F, S_F,
- /* S_Z */ S_N, S_F, S_Z, S_Z
+ /* state x d 0 */
+ /* S_N */ S_N, S_I, S_Z,
+ /* S_I */ S_N, S_I, S_I,
+ /* S_F */ S_N, S_F, S_F,
+ /* S_Z */ S_N, S_F, S_Z
};
static const int8_t result_type[] =
{
- /* state x/x x/d x/0 x/- d/x d/d d/0 d/-
- 0/x 0/d 0/0 0/- -/x -/d -/0 -/- */
-
- /* S_N */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
- CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
- /* S_I */ CMP, -1, -1, CMP, +1, LEN, LEN, CMP,
- +1, LEN, LEN, CMP, CMP, CMP, CMP, CMP,
- /* S_F */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
- CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
- /* S_Z */ CMP, +1, +1, CMP, -1, CMP, CMP, CMP,
- -1, CMP, CMP, CMP
+ /* state x/x x/d x/0 d/x d/d d/0 0/x 0/d 0/0 */
+
+ /* S_N */ CMP, CMP, CMP, CMP, LEN, CMP, CMP, CMP, CMP,
+ /* S_I */ CMP, -1, -1, +1, LEN, LEN, +1, LEN, LEN,
+ /* S_F */ CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
+ /* S_Z */ CMP, +1, +1, -1, CMP, CMP, -1, CMP, CMP
};
+ unsigned char c1, c2;
+ int state, diff;
if (p1 == p2)
return 0;
@@ -86,17 +72,20 @@ int strverscmp (const char *s1, const char *s2)
c1 = *p1++;
c2 = *p2++;
/* Hint: '0' is a digit too. */
- state = S_N | ((c1 == '0') + (isdigit (c1) != 0));
+ state = S_N + ((c1 == '0') + (isdigit (c1) != 0));
- while ((diff = c1 - c2) == 0 && c1 != '\0')
+ while ((diff = c1 - c2) == 0)
{
+ if (c1 == '\0')
+ return diff;
+
state = next_state[state];
c1 = *p1++;
c2 = *p2++;
- state |= (c1 == '0') + (isdigit (c1) != 0);
+ state += (c1 == '0') + (isdigit (c1) != 0);
}
- state = result_type[state << 2 | (((c2 == '0') + (isdigit (c2) != 0)))];
+ state = result_type[state * 3 + (((c2 == '0') + (isdigit (c2) != 0)))];
switch (state)
{
diff --git a/libc/sysdeps/linux/arc/sigaction.c b/libc/sysdeps/linux/arc/sigaction.c
index 4a4c9e2..67ca38a 100644
--- a/libc/sysdeps/linux/arc/sigaction.c
+++ b/libc/sysdeps/linux/arc/sigaction.c
@@ -13,7 +13,8 @@
/*
* Default sigretrun stub if user doesn't specify SA_RESTORER
*/
-static void __default_rt_sa_restorer(void)
+static void attribute_optimize("Os") __attribute_noinline__
+__default_rt_sa_restorer(void)
{
INTERNAL_SYSCALL_NCS(__NR_rt_sigreturn, , 0);
}
diff --git a/libc/sysdeps/linux/arc/sys/procfs.h b/libc/sysdeps/linux/arc/sys/procfs.h
index a9e375b..a474303 100755
--- a/libc/sysdeps/linux/arc/sys/procfs.h
+++ b/libc/sysdeps/linux/arc/sys/procfs.h
@@ -20,17 +20,14 @@
#include <sys/time.h>
#include <sys/types.h>
#include <sys/user.h>
+#include <asm/ptrace.h>
__BEGIN_DECLS
/* Type for a general-purpose register. */
typedef unsigned long elf_greg_t;
-/* And the whole bunch of them. We could have used `struct
- user_regs' directly in the typedef, but tradition says that
- the register set is an array, which does have some peculiar
- semantics, so leave it that way. */
-#define ELF_NGREG 40
+#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
typedef elf_greg_t elf_gregset_t[ELF_NGREG];
typedef struct { } elf_fpregset_t;
diff --git a/libc/sysdeps/linux/arm/Makefile.arch b/libc/sysdeps/linux/arm/Makefile.arch
index 3054273..cda3db2 100644
--- a/libc/sysdeps/linux/arm/Makefile.arch
+++ b/libc/sysdeps/linux/arm/Makefile.arch
@@ -13,7 +13,9 @@ SSRC-y := \
vfork.S clone.S
SSRC-$(UCLIBC_HAS_LFS) += mmap64.S
-SSRC-$(UCLIBC_HAS_THREADS_NATIVE) += libc-aeabi_read_tp.S libc-thumb_atomics.S
+SSRC-$(UCLIBC_HAS_THREADS_NATIVE) += libc-thumb_atomics.S
+libc-nonshared-$(UCLIBC_HAS_THREADS_NATIVE) += $(ARCH_OUT)/libc-aeabi_read_tp.os
+libc-static-$(UCLIBC_HAS_THREADS_NATIVE) += $(ARCH_OUT)/libc-aeabi_read_tp.o
CSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += makecontext.c
SSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += getcontext.S setcontext.S swapcontext.S
diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in
index 8ee956b..8252598 100644
--- a/libc/sysdeps/linux/common/Makefile.in
+++ b/libc/sysdeps/linux/common/Makefile.in
@@ -27,6 +27,7 @@ CSRC-$(UCLIBC_LINUX_SPECIFIC) += \
eventfd.c \
eventfd_read.c \
eventfd_write.c \
+ getrandom.c \
inotify.c \
ioperm.c \
iopl.c \
diff --git a/libc/sysdeps/linux/common/bits/kernel-features.h b/libc/sysdeps/linux/common/bits/kernel-features.h
index 6184c2b..708bb49 100644
--- a/libc/sysdeps/linux/common/bits/kernel-features.h
+++ b/libc/sysdeps/linux/common/bits/kernel-features.h
@@ -507,3 +507,8 @@
#if defined __x86_64__ && __LINUX_KERNEL_VERSION >= 0x030100
# define __ASSUME_GETCPU_SYSCALL 1
#endif
+
+/* getrandom syscall (widely) appeared around 4.0.0 */
+#if __LINUX_KERNEL_VERSION >= 0x040000
+# define __ASSUME_GETRANDOM_SYSCALL 1
+#endif
diff --git a/libc/sysdeps/linux/common/bits/mathcalls.h b/libc/sysdeps/linux/common/bits/mathcalls.h
index 4270273..3d7e34f 100644
--- a/libc/sysdeps/linux/common/bits/mathcalls.h
+++ b/libc/sysdeps/linux/common/bits/mathcalls.h
@@ -74,8 +74,22 @@ __MATHCALLI (atan2,, (_Mdouble_ __y, _Mdouble_ __x))
/* Cosine of X. */
__MATHCALLI (cos,, (_Mdouble_ __x))
+# if defined _LIBC && defined _Mlong_double_
+libm_hidden_proto(cosl)
+# endif
+# if defined _LIBC && defined _Mfloat_
+libm_hidden_proto(cosf)
+# endif
+
/* Sine of X. */
__MATHCALLI (sin,, (_Mdouble_ __x))
+# if defined _LIBC && defined _Mlong_double_
+libm_hidden_proto(sinl)
+# endif
+# if defined _LIBC && defined _Mfloat_
+libm_hidden_proto(sinf)
+# endif
+
/* Tangent of X. */
__MATHCALLI (tan,, (_Mdouble_ __x))
@@ -111,6 +125,9 @@ __END_NAMESPACE_C99
_Mdouble_BEGIN_NAMESPACE
/* Exponential function of X. */
__MATHCALLI (exp,, (_Mdouble_ __x))
+# if defined _LIBC && defined _Mlong_double_
+libm_hidden_proto(expl)
+# endif
/* Break VALUE into a normalized fraction and an integral power of 2. */
__MATHCALLI (frexp,, (_Mdouble_ __x, int *__exponent))
@@ -173,6 +190,9 @@ _Mdouble_END_NAMESPACE
__BEGIN_NAMESPACE_C99
/* Return `sqrt(X*X + Y*Y)'. */
__MATHCALLI (hypot,, (_Mdouble_ __x, _Mdouble_ __y))
+# if defined _LIBC && defined _Mlong_double_
+libm_hidden_proto(hypotl)
+# endif
__END_NAMESPACE_C99
#endif
@@ -300,6 +320,9 @@ __MATHCALLI (rint,, (_Mdouble_ __x))
/* Return X + epsilon if X < Y, X - epsilon if X > Y. */
__MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__))
+# if defined _LIBC && defined _Mlong_double_
+libm_hidden_proto(nextafterl)
+# endif
# if defined __USE_ISOC99 && !defined __LDBL_COMPAT
# ifndef _Mdouble_is_float_
__MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__))
diff --git a/libc/sysdeps/linux/common/bits/utmp.h b/libc/sysdeps/linux/common/bits/utmp.h
index c13380a..6ece31e 100644
--- a/libc/sysdeps/linux/common/bits/utmp.h
+++ b/libc/sysdeps/linux/common/bits/utmp.h
@@ -36,7 +36,7 @@
previous logins. */
struct lastlog
{
-#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
+#ifdef __WORDSIZE_TIME64_COMPAT32
int32_t ll_time;
#else
__time_t ll_time;
@@ -69,7 +69,7 @@ struct utmp
/* The ut_session and ut_tv fields must be the same size when compiled
32- and 64-bit. This allows data files and shared memory to be
shared between 32- and 64-bit applications. */
-#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
+#ifdef __WORDSIZE_TIME64_COMPAT32
int32_t ut_session; /* Session ID, used for windowing. */
struct
{
diff --git a/libc/sysdeps/linux/common/bits/utmpx.h b/libc/sysdeps/linux/common/bits/utmpx.h
index 87626f0..815fc90 100644
--- a/libc/sysdeps/linux/common/bits/utmpx.h
+++ b/libc/sysdeps/linux/common/bits/utmpx.h
@@ -66,7 +66,7 @@ struct utmpx
/* The fields ut_session and ut_tv must be the same size when compiled
32- and 64-bit. This allows files and shared memory to be shared
between 32- and 64-bit applications. */
-#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
+#ifdef __WORDSIZE_TIME64_COMPAT32
__int32_t ut_session; /* Session ID, used for windowing. */
struct
{
diff --git a/libc/sysdeps/linux/common/getrandom.c b/libc/sysdeps/linux/common/getrandom.c
new file mode 100644
index 0000000..d33d522
--- /dev/null
+++ b/libc/sysdeps/linux/common/getrandom.c
@@ -0,0 +1,14 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * getrandom() for uClibc
+ *
+ * Copyright (C) 2015 Bernhard Reutner-Fischer
+ *
+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
+ */
+
+#include <sys/syscall.h>
+#include <sys/random.h>
+#ifdef __NR_getrandom
+_syscall3(int, getrandom, void *, buf, size_t, buflen, unsigned int, flags)
+#endif
diff --git a/libc/sysdeps/linux/common/getrusage.c b/libc/sysdeps/linux/common/getrusage.c
index 3e719f2..fb7614b 100644
--- a/libc/sysdeps/linux/common/getrusage.c
+++ b/libc/sysdeps/linux/common/getrusage.c
@@ -10,4 +10,5 @@
#include <sys/syscall.h>
#include <unistd.h>
#include <wait.h>
+#include <sys/resource.h>
_syscall2(int, getrusage, __rusage_who_t, who, struct rusage *, usage)
diff --git a/libc/sysdeps/linux/arm/aeabi_unwind_cpp_pr1.c b/libc/sysdeps/linux/common/makedev.c
similarity index 51%
copy from libc/sysdeps/linux/arm/aeabi_unwind_cpp_pr1.c
copy to libc/sysdeps/linux/common/makedev.c
index a5cd73f..d776167 100644
--- a/libc/sysdeps/linux/arm/aeabi_unwind_cpp_pr1.c
+++ b/libc/sysdeps/linux/common/makedev.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Definitions of functions to access `dev_t' values.
+ Copyright (C) 2003-2015 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
@@ -15,25 +16,27 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Because some objects in ld.so and libc.so are built with
- -fexceptions, we end up with references to this personality
- routine. However, these libraries are not linked against
- libgcc_eh.a, so we need a dummy definition. This routine will
- never actually be called. */
+#include <endian.h>
+#include <sys/sysmacros.h>
-#include <stdlib.h>
-
-attribute_hidden void __aeabi_unwind_cpp_pr0 (void);
-attribute_hidden void __aeabi_unwind_cpp_pr0 (void)
+unsigned int
+gnu_dev_major (unsigned long long int dev)
{
+ return ((dev >> 8) & 0xfff) | ((unsigned int) (dev >> 32) & ~0xfff);
}
+libc_hidden_def(gnu_dev_major)
-attribute_hidden void __aeabi_unwind_cpp_pr1 (void);
-attribute_hidden void __aeabi_unwind_cpp_pr1 (void)
+unsigned int
+gnu_dev_minor (unsigned long long int dev)
{
+ return (dev & 0xff) | ((unsigned int) (dev >> 12) & ~0xff);
}
+libc_hidden_def(gnu_dev_minor)
-attribute_hidden void __aeabi_unwind_cpp_pr2 (void);
-attribute_hidden void __aeabi_unwind_cpp_pr2 (void)
+unsigned long long int
+gnu_dev_makedev (unsigned int major, unsigned int minor)
{
+ return ((minor & 0xff) | ((major & 0xfff) << 8)
+ | (((unsigned long long int) (minor & ~0xff)) << 12)
+ | (((unsigned long long int) (major & ~0xfff)) << 32));
}
diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c
index 2c50307..19a3371 100644
--- a/libc/sysdeps/linux/common/stubs.c
+++ b/libc/sysdeps/linux/common/stubs.c
@@ -157,6 +157,10 @@ make_stub(getpeername)
make_stub(getpgrp)
#endif
+#if !defined __NR_getrandom && defined __UCLIBC_LINUX_SPECIFIC__
+make_stub(getrandom)
+#endif
+
#if !defined __NR_getsockname && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
make_stub(getsockname)
#endif
diff --git a/libc/sysdeps/linux/common/sys/random.h b/libc/sysdeps/linux/common/sys/random.h
new file mode 100644
index 0000000..42f8025
--- /dev/null
+++ b/libc/sysdeps/linux/common/sys/random.h
@@ -0,0 +1,33 @@
+/* Copyright (C) 2015 Bernhard Reutner-Fischer
+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
+*/
+
+#ifndef _SYS_RANDOM_H
+#define _SYS_RANDOM_H 1
+#include <features.h>
+
+__BEGIN_DECLS
+
+#if defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU
+# if 0 /*def __ASSUME_GETRANDOM_SYSCALL */
+# include <linux/random.h>
+# else
+# undef GRND_NONBLOCK
+# undef GRND_RANDOM
+/*
+ * Flags for getrandom(2)
+ *
+ * GRND_NONBLOCK Don't block and return EAGAIN instead
+ * GRND_RANDOM Use the /dev/random pool instead of /dev/urandom
+ */
+# define GRND_NONBLOCK 0x0001
+# define GRND_RANDOM 0x0002
+# endif
+/* FIXME: aren't there a couple of __restrict and const missing ? */
+extern int getrandom(void *__buf, size_t count, unsigned int flags)
+ __nonnull ((1)) __wur;
+#endif
+
+__END_DECLS
+
+#endif /* sys/random.h */
diff --git a/libc/sysdeps/linux/mips/bits/mathdef.h b/libc/sysdeps/linux/mips/bits/mathdef.h
index 1c636a1..6afe20d 100644
--- a/libc/sysdeps/linux/mips/bits/mathdef.h
+++ b/libc/sysdeps/linux/mips/bits/mathdef.h
@@ -25,10 +25,9 @@
#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
# define _MATH_H_MATHDEF 1
-/* Normally, there is no long double type and the `float' and `double'
- expressions are evaluated as `double'. */
-typedef double float_t; /* `float' expressions are evaluated as
- `double'. */
+/* MIPS has both `float' and `double' arithmetic. */
+typedef float float_t; /* `float' expressions are evaluated as
+ `float'. */
typedef double double_t; /* `double' expressions are evaluated as
`double'. */
diff --git a/libc/sysdeps/linux/mips/bits/wordsize.h b/libc/sysdeps/linux/mips/bits/wordsize.h
index 39e1506..fe13080 100644
--- a/libc/sysdeps/linux/mips/bits/wordsize.h
+++ b/libc/sysdeps/linux/mips/bits/wordsize.h
@@ -16,3 +16,6 @@
<http://www.gnu.org/licenses/>. */
#define __WORDSIZE _MIPS_SZPTR
+#if _MIPS_SIM == _ABI64
+# define __WORDSIZE_TIME64_COMPAT32 1
+#endif
diff --git a/libc/sysdeps/linux/powerpc/bits/wordsize.h b/libc/sysdeps/linux/powerpc/bits/wordsize.h
index cf93423..3e8a1e0 100644
--- a/libc/sysdeps/linux/powerpc/bits/wordsize.h
+++ b/libc/sysdeps/linux/powerpc/bits/wordsize.h
@@ -2,7 +2,7 @@
#if defined __powerpc64__
# define __WORDSIZE 64
-# define __WORDSIZE_COMPAT32 1
+# define __WORDSIZE_TIME64_COMPAT32 1
#else
# define __WORDSIZE 32
#endif
diff --git a/libc/sysdeps/linux/sh/bits/atomic.h b/libc/sysdeps/linux/sh/bits/atomic.h
index 745c85c..18ae9ea 100644
--- a/libc/sysdeps/linux/sh/bits/atomic.h
+++ b/libc/sysdeps/linux/sh/bits/atomic.h
@@ -68,6 +68,12 @@ typedef uintmax_t uatomic_max_t;
r1: saved stack pointer
*/
+#if __GNUC_PREREQ (4, 7)
+# define rNOSP "u"
+#else
+# define rNOSP "r"
+#endif
+
/* Avoid having lots of different versions of compare and exchange,
by having this one complicated version. Parameters:
bwl: b, w or l for 8, 16 and 32 bit versions.
@@ -94,7 +100,7 @@ typedef uintmax_t uatomic_max_t;
movt %0\n\
.endif\n" \
: "=&r" (__arch_result) \
- : "r" (mem), "r" (newval), "r" (oldval) \
+ : rNOSP (mem), rNOSP (newval), rNOSP (oldval) \
: "r0", "r1", "t", "memory"); \
__arch_result; })
@@ -150,7 +156,7 @@ typedef uintmax_t uatomic_max_t;
mov." #bwl " %1,@%2\n\
1: mov r1,r15" \
: "=&r" (old), "=&r"(new) \
- : "r" (mem), "r" (value) \
+ : rNOSP (mem), rNOSP (value) \
: "r0", "r1", "memory"); \
})
@@ -194,7 +200,7 @@ typedef uintmax_t uatomic_max_t;
mov." #bwl " %0,@%1\n\
1: mov r1,r15" \
: "=&r" (__new) \
- : "r" (mem), "r" (__value) \
+ : rNOSP (mem), rNOSP (__value) \
: "r0", "r1", "memory"); \
__new; \
})
diff --git a/libc/sysdeps/linux/sh/bits/syscalls.h b/libc/sysdeps/linux/sh/bits/syscalls.h
index b308276..efd423e 100644
--- a/libc/sysdeps/linux/sh/bits/syscalls.h
+++ b/libc/sysdeps/linux/sh/bits/syscalls.h
@@ -122,7 +122,7 @@
__asm__ __volatile__ (SYSCALL_INST_STR##nr SYSCALL_INST_PAD \
: "=z" (resultvar) \
: "r" (r3) ASMFMT_##nr \
- : "memory" \
+ : "memory", "t" \
); \
(int) resultvar; \
}) \
diff --git a/libc/sysdeps/linux/sparc/bits/wordsize.h b/libc/sysdeps/linux/sparc/bits/wordsize.h
index c0e600e..aa15dbc 100644
--- a/libc/sysdeps/linux/sparc/bits/wordsize.h
+++ b/libc/sysdeps/linux/sparc/bits/wordsize.h
@@ -2,6 +2,7 @@
#if defined __arch64__ || defined __sparcv9
# define __WORDSIZE 64
+# define __WORDSIZE_TIME64_COMPAT32 1
#else
# define __WORDSIZE 32
#endif
diff --git a/libc/sysdeps/linux/x86_64/bits/wordsize.h b/libc/sysdeps/linux/x86_64/bits/wordsize.h
index e555241..9db982c 100644
--- a/libc/sysdeps/linux/x86_64/bits/wordsize.h
+++ b/libc/sysdeps/linux/x86_64/bits/wordsize.h
@@ -1,9 +1,12 @@
/* Determine the wordsize from the preprocessor defines. */
-#if defined __x86_64__
+#if defined __x86_64__ && !defined __ILP32__
# define __WORDSIZE 64
-/* This makes /var/run/utmp compatible with 32-bit environment: */
-# define __WORDSIZE_COMPAT32 1
#else
# define __WORDSIZE 32
#endif
+
+#ifdef __x86_64__
+/* This makes /var/run/utmp compatible with 32-bit environment: */
+# define __WORDSIZE_TIME64_COMPAT32 1
+#endif
diff --git a/libcrypt/sha256.c b/libcrypt/sha256.c
index 6bc2d8b..3e12b5c 100644
--- a/libcrypt/sha256.c
+++ b/libcrypt/sha256.c
@@ -108,12 +108,12 @@ sha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx)
uint32_t h_save = h;
/* Operators defined in FIPS 180-2:4.1.2. */
-#define Ch(x, y, z) ((x & y) ^ (~x & z))
-#define Maj(x, y, z) ((x & y) ^ (x & z) ^ (y & z))
-#define S0(x) (CYCLIC (x, 2) ^ CYCLIC (x, 13) ^ CYCLIC (x, 22))
-#define S1(x) (CYCLIC (x, 6) ^ CYCLIC (x, 11) ^ CYCLIC (x, 25))
-#define R0(x) (CYCLIC (x, 7) ^ CYCLIC (x, 18) ^ (x >> 3))
-#define R1(x) (CYCLIC (x, 17) ^ CYCLIC (x, 19) ^ (x >> 10))
+#define _Ch(x, y, z) ((x & y) ^ (~x & z))
+#define _Maj(x, y, z) ((x & y) ^ (x & z) ^ (y & z))
+#define _S0(x) (CYCLIC (x, 2) ^ CYCLIC (x, 13) ^ CYCLIC (x, 22))
+#define _S1(x) (CYCLIC (x, 6) ^ CYCLIC (x, 11) ^ CYCLIC (x, 25))
+#define _R0(x) (CYCLIC (x, 7) ^ CYCLIC (x, 18) ^ (x >> 3))
+#define _R1(x) (CYCLIC (x, 17) ^ CYCLIC (x, 19) ^ (x >> 10))
/* It is unfortunate that C does not provide an operator for
cyclic rotation. Hope the C compiler is smart enough. */
@@ -126,13 +126,13 @@ sha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx)
++words;
}
for (unsigned int t = 16; t < 64; ++t)
- W[t] = R1 (W[t - 2]) + W[t - 7] + R0 (W[t - 15]) + W[t - 16];
+ W[t] = _R1 (W[t - 2]) + W[t - 7] + _R0 (W[t - 15]) + W[t - 16];
/* The actual computation according to FIPS 180-2:6.2.2 step 3. */
for (unsigned int t = 0; t < 64; ++t)
{
- uint32_t T1 = h + S1 (e) + Ch (e, f, g) + K[t] + W[t];
- uint32_t T2 = S0 (a) + Maj (a, b, c);
+ uint32_t T1 = h + _S1 (e) + _Ch (e, f, g) + K[t] + W[t];
+ uint32_t T2 = _S0 (a) + _Maj (a, b, c);
h = g;
g = f;
f = e;
diff --git a/libcrypt/sha512.c b/libcrypt/sha512.c
index 079caee..b2e36a3 100644
--- a/libcrypt/sha512.c
+++ b/libcrypt/sha512.c
@@ -139,12 +139,12 @@ sha512_process_block (const void *buffer, size_t len, struct sha512_ctx *ctx)
uint64_t h_save = h;
/* Operators defined in FIPS 180-2:4.1.2. */
-#define Ch(x, y, z) ((x & y) ^ (~x & z))
-#define Maj(x, y, z) ((x & y) ^ (x & z) ^ (y & z))
-#define S0(x) (CYCLIC (x, 28) ^ CYCLIC (x, 34) ^ CYCLIC (x, 39))
-#define S1(x) (CYCLIC (x, 14) ^ CYCLIC (x, 18) ^ CYCLIC (x, 41))
-#define R0(x) (CYCLIC (x, 1) ^ CYCLIC (x, 8) ^ (x >> 7))
-#define R1(x) (CYCLIC (x, 19) ^ CYCLIC (x, 61) ^ (x >> 6))
+#define _Ch(x, y, z) ((x & y) ^ (~x & z))
+#define _Maj(x, y, z) ((x & y) ^ (x & z) ^ (y & z))
+#define _S0(x) (CYCLIC (x, 28) ^ CYCLIC (x, 34) ^ CYCLIC (x, 39))
+#define _S1(x) (CYCLIC (x, 14) ^ CYCLIC (x, 18) ^ CYCLIC (x, 41))
+#define _R0(x) (CYCLIC (x, 1) ^ CYCLIC (x, 8) ^ (x >> 7))
+#define _R1(x) (CYCLIC (x, 19) ^ CYCLIC (x, 61) ^ (x >> 6))
/* It is unfortunate that C does not provide an operator for
cyclic rotation. Hope the C compiler is smart enough. */
@@ -157,13 +157,13 @@ sha512_process_block (const void *buffer, size_t len, struct sha512_ctx *ctx)
++words;
}
for (unsigned int t = 16; t < 80; ++t)
- W[t] = R1 (W[t - 2]) + W[t - 7] + R0 (W[t - 15]) + W[t - 16];
+ W[t] = _R1 (W[t - 2]) + W[t - 7] + _R0 (W[t - 15]) + W[t - 16];
/* The actual computation according to FIPS 180-2:6.3.2 step 3. */
for (unsigned int t = 0; t < 80; ++t)
{
- uint64_t T1 = h + S1 (e) + Ch (e, f, g) + K[t] + W[t];
- uint64_t T2 = S0 (a) + Maj (a, b, c);
+ uint64_t T1 = h + _S1 (e) + _Ch (e, f, g) + K[t] + W[t];
+ uint64_t T2 = _S0 (a) + _Maj (a, b, c);
h = g;
g = f;
f = e;
diff --git a/libm/Makefile.in b/libm/Makefile.in
index 7511706..d886cdb 100644
--- a/libm/Makefile.in
+++ b/libm/Makefile.in
@@ -75,9 +75,6 @@ libm_CSRC := \
s_remquo.c w_exp2.c \
cexp.c sincos.c
-# Not implemented [yet?], see comment in float_wrappers.c:
-# fdimf.o fmaf.o fmaxf.o fminf.o
-# nearbyintf.o remquof.o scalblnf.o tgammaf.o
FL_MOBJ := \
acosf.o \
acoshf.o \
@@ -98,7 +95,11 @@ FL_MOBJ := \
expf.o \
expm1f.o \
fabsf.o \
+ fdimf.o \
floorf.o \
+ fmaf.o \
+ fmaxf.o \
+ fminf.o \
fmodf.o \
frexpf.o \
gammaf.o \
@@ -116,11 +117,14 @@ FL_MOBJ := \
lrintf.o \
lroundf.o \
modff.o \
+ nearbyintf.o \
+ nexttowardf.o \
powf.o \
remainderf.o \
+ remquof.o \
rintf.o \
roundf.o \
- scalbf.o \
+ scalblnf.o \
scalbnf.o \
significandf.o \
sinf.o \
@@ -128,9 +132,24 @@ FL_MOBJ := \
sqrtf.o \
tanf.o \
tanhf.o \
+ tgammaf.o \
truncf.o \
-# Not implemented [yet?]: nexttowardl.o
+ifeq ($(UCLIBC_SUSV3_LEGACY),y)
+FL_MOBJ += scalbf.o
+endif
+
+# Do not (yet?) implement the float variants of bessel functions
+ifeq (not-yet-implemented-$(DO_XSI_MATH),y)
+FL_MOBJ += \
+ j0f.o \
+ j1f.o \
+ jnf.o \
+ y0f.o \
+ y1f.o \
+ ynf.o
+endif
+
LD_MOBJ := \
__finitel.o \
__fpclassifyl.o \
@@ -180,6 +199,7 @@ LD_MOBJ := \
modfl.o \
nearbyintl.o \
nextafterl.o \
+ nexttowardl.o \
powl.o \
remainderl.o \
remquol.o \
@@ -196,6 +216,17 @@ LD_MOBJ := \
tgammal.o \
truncl.o \
+# Do not (yet?) implement the long double variants of bessel functions
+ifeq (not-yet-implemented-$(DO_XSI_MATH),y)
+LD_MOBJ += \
+ j0l.o \
+ j1l.o \
+ jnl.o \
+ y0l.o \
+ y1l.o \
+ ynl.o
+endif
+
else
# This list of math functions was taken from POSIX/IEEE 1003.1b-1993
diff --git a/libm/float_wrappers.c b/libm/float_wrappers.c
index 82b7963..105486e 100644
--- a/libm/float_wrappers.c
+++ b/libm/float_wrappers.c
@@ -38,19 +38,14 @@ long long func##f (float x) \
return func((double)x); \
}
-
-/* For the time being, do _NOT_ implement these functions
- * that are defined by SuSv3 [because we don't need them
- * and nobody asked to include them] */
-#undef L_fdimf /*float fdimf(float, float);*/
-#undef L_fmaf /*float fmaf(float, float, float);*/
-#undef L_fmaxf /*float fmaxf(float, float);*/
-#undef L_fminf /*float fminf(float, float);*/
-#undef L_nearbyintf /*float nearbyintf(float);*/
-#undef L_nexttowardf /*float nexttowardf(float, long double);*/
-#undef L_remquof /*float remquof(float, float, int *);*/
-#undef L_scalblnf /*float scalblnf(float, long);*/
-#undef L_tgammaf /*float tgammaf(float);*/
+#ifndef __DO_XSI_MATH__
+# undef L_j0f /* float j0f(float x); */
+# undef L_j1f /* float j1f(float x); */
+# undef L_jnf /* float jnf(int n, float x); */
+# undef L_y0f /* float y0f(float x); */
+# undef L_y1f /* float y1f(float x); */
+# undef L_ynf /* float ynf(int n, float x); */
+#endif
/* Implement the following, as defined by SuSv3 */
#if 0
@@ -155,6 +150,7 @@ float copysignf (float x, float y)
#ifdef L_cosf
WRAPPER1(cos)
+libm_hidden_def(cosf)
#endif
#ifdef L_coshf
@@ -242,6 +238,21 @@ float hypotf (float x, float y)
int_WRAPPER1(ilogb)
#endif
+#ifdef L_j0f
+WRAPPER1(j0)
+#endif
+
+#ifdef L_j1f
+WRAPPER1(j1)
+#endif
+
+#ifdef L_jnf
+float jnf(int n, float x)
+{
+ return (float) jn(n, (double)x);
+}
+#endif
+
#ifdef L_ldexpf
float ldexpf (float x, int _exp)
{
@@ -306,7 +317,7 @@ WRAPPER1(nearbyint)
#ifdef L_nexttowardf
float nexttowardf (float x, long double y)
{
- return (float) nexttoward( (double)x, (double)y );
+ return (float) nexttoward( (double)x, (long double)y );
}
#endif
@@ -355,6 +366,7 @@ float scalbnf (float x, int _exp)
#ifdef L_sinf
WRAPPER1(sin)
+libm_hidden_def(sinf)
#endif
#ifdef L_sinhf
@@ -381,13 +393,6 @@ WRAPPER1(tgamma)
WRAPPER1(trunc)
#endif
-#ifdef L_fmaf
-float fmaf (float x, float y, float z)
-{
- return (float) fma( (double)x, (double)y, (double)z );
-}
-#endif
-
#if defined L_scalbf && defined __UCLIBC_SUSV3_LEGACY__
float scalbf (float x, float y)
{
@@ -402,3 +407,18 @@ WRAPPER1(gamma)
#ifdef L_significandf
WRAPPER1(significand)
#endif
+
+#ifdef L_y0f
+WRAPPER1(y0)
+#endif
+
+#ifdef L_y1f
+WRAPPER1(y1)
+#endif
+
+#ifdef L_ynf
+float ynf(int n, float x)
+{
+ return (float) yn(n, (double)x);
+}
+#endif
diff --git a/libm/ldouble_wrappers.c b/libm/ldouble_wrappers.c
index 118a78f..840293f 100644
--- a/libm/ldouble_wrappers.c
+++ b/libm/ldouble_wrappers.c
@@ -16,32 +16,42 @@
#include "math.h"
#include <complex.h>
-#define WRAPPER1(func) \
+#if !defined __NO_LONG_DOUBLE_MATH
+# define WRAPPER1(func) \
long double func##l(long double x) \
{ \
return (long double) func((double) x); \
}
-#define WRAPPER2(func) \
+# define WRAPPER2(func) \
long double func##l(long double x, long double y) \
{ \
return (long double) func((double) x, (double) y); \
}
-#define int_WRAPPER1(func) \
+# define int_WRAPPER1(func) \
int func##l(long double x) \
{ \
return func((double) x); \
}
-#define long_WRAPPER1(func) \
+# define long_WRAPPER1(func) \
long func##l(long double x) \
{ \
return func((double) x); \
}
-#define long_long_WRAPPER1(func) \
+# define long_long_WRAPPER1(func) \
long long func##l(long double x) \
{ \
return func((double) x); \
}
+#ifndef __DO_XSI_MATH__
+# undef L_j0l /* long double j0l(long double x); */
+# undef L_j1l /* long double j1l(long double x); */
+# undef L_jnl /* long double jnl(int n, long double x); */
+# undef L_y0l /* long double y0l(long double x); */
+# undef L_y1l /* long double y1l(long double x); */
+# undef L_ynl /* long double ynl(int n, long double x); */
+#endif
+
/* Implement the following, as defined by SuSv3 */
#if 0
long double acoshl(long double);
@@ -156,6 +166,7 @@ WRAPPER1(cosh)
#ifdef L_cosl
WRAPPER1(cos)
+libm_hidden_def(cosl)
#endif
#ifdef L_erfcl
@@ -172,6 +183,7 @@ WRAPPER1(exp2)
#ifdef L_expl
WRAPPER1(exp)
+libm_hidden_def(expl)
#endif
#ifdef L_expm1l
@@ -222,12 +234,28 @@ WRAPPER1(gamma)
#ifdef L_hypotl
WRAPPER2(hypot)
+libm_hidden_def(hypotl)
#endif
#ifdef L_ilogbl
int_WRAPPER1(ilogb)
#endif
+#ifdef L_j0l
+ WRAPPER1(j0)
+#endif
+
+#ifdef L_j1l
+ WRAPPER1(j1)
+#endif
+
+#ifdef L_jnl
+long double jnl(int n, long double x)
+{
+ return (long double) jn(n, (double)x);
+}
+#endif
+
#ifdef L_ldexpl
long double ldexpl (long double x, int ex)
{
@@ -291,12 +319,18 @@ WRAPPER1(nearbyint)
#ifdef L_nextafterl
WRAPPER2(nextafter)
+libm_hidden_def(nextafterl)
#endif
-/* Disabled in Makefile.in */
-#if 0 /* def L_nexttowardl */
-WRAPPER2(nexttoward)
-libm_hidden_def(nexttowardl)
+#ifdef L_nexttowardl
+# if 0 /* TODO */
+strong_alias(nextafterl, nexttowardl)
+# else
+long double nexttowardl(long double x, long double y)
+{
+ return nextafterl(x, y);
+}
+#endif
#endif
#ifdef L_powl
@@ -344,6 +378,7 @@ WRAPPER1(sinh)
#ifdef L_sinl
WRAPPER1(sin)
+libm_hidden_def(sinl)
#endif
#ifdef L_sqrtl
@@ -370,6 +405,22 @@ WRAPPER1(trunc)
WRAPPER1(significand)
#endif
+#ifdef L_y0l
+WRAPPER1(y0)
+#endif
+
+#ifdef L_y1l
+WRAPPER1(y1)
+#endif
+
+#ifdef L_ynl
+long double ynl(int n, long double x)
+{
+ return (long double) yn(n, (double)x);
+}
+#endif
+
+
#if defined __DO_C99_MATH__ && !defined __NO_LONG_DOUBLE_MATH
# ifdef L___fpclassifyl
@@ -397,4 +448,6 @@ int_WRAPPER1(__isinf)
libm_hidden_def(__isinfl)
# endif
-#endif
+#endif /* __DO_C99_MATH__ */
+
+#endif /* __NO_LONG_DOUBLE_MATH */
diff --git a/libm/s_fdim.c b/libm/s_fdim.c
index 6249219..6ed695c 100644
--- a/libm/s_fdim.c
+++ b/libm/s_fdim.c
@@ -6,13 +6,22 @@
#include "math.h"
#include "math_private.h"
+#include <errno.h>
double fdim(double x, double y)
{
- int c = __fpclassify(x);
- if (c == FP_NAN || c == FP_INFINITE)
- return HUGE_VAL;
+ int cx = __fpclassify(x); /* need both NAN and INF */
+ int cy = __fpclassify(y); /* need both NAN and INF */
+ if (cx == FP_NAN || cy == NAN)
+ return x - y;
- return x > y ? x - y : 0.0;
+ if (x <= y)
+ return .0;
+
+ double z = x - y;
+ if (isinf(z) && cx != FP_INFINITE && cy != FP_INFINITE)
+ __set_errno(ERANGE);
+
+ return z;
}
libm_hidden_def(fdim)
diff --git a/libm/s_fmax.c b/libm/s_fmax.c
index 21dfaa9..5f29ad8 100644
--- a/libm/s_fmax.c
+++ b/libm/s_fmax.c
@@ -9,10 +9,10 @@
double fmax(double x, double y)
{
- if (__fpclassify(x) == FP_NAN)
- return x;
- if (__fpclassify(y) == FP_NAN)
+ if (isnan(x))
return y;
+ if (isnan(y))
+ return x;
return x > y ? x : y;
}
diff --git a/libm/s_fmin.c b/libm/s_fmin.c
index 674d9a5..a549678 100644
--- a/libm/s_fmin.c
+++ b/libm/s_fmin.c
@@ -9,10 +9,10 @@
double fmin(double x, double y)
{
- if (__fpclassify(x) == FP_NAN)
- return x;
- if (__fpclassify(y) == FP_NAN)
+ if (isnan(x))
return y;
+ if (isnan(y))
+ return x;
return x < y ? x : y;
}
diff --git a/libm/s_nextafter.c b/libm/s_nextafter.c
index ee4621c..73a8ab2 100644
--- a/libm/s_nextafter.c
+++ b/libm/s_nextafter.c
@@ -32,7 +32,7 @@ double nextafter(double x, double y)
if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) || /* x is nan */
((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0)) /* y is nan */
return x+y;
- if(x==y) return x; /* x=y, return x */
+ if(x==y) return y; /* x=y, return y */
if((ix|lx)==0) { /* x == 0 */
INSERT_WORDS(x,hy&0x80000000,1); /* return +-minsubnormal */
y = x*x;
@@ -68,3 +68,5 @@ double nextafter(double x, double y)
return x;
}
libm_hidden_def(nextafter)
+strong_alias_untyped(nextafter, nexttoward)
+libm_hidden_def(nexttoward)
diff --git a/libpthread/linuxthreads/semaphore.h b/libpthread/linuxthreads/semaphore.h
index 9a9b72c..3924a47 100644
--- a/libpthread/linuxthreads/semaphore.h
+++ b/libpthread/linuxthreads/semaphore.h
@@ -82,10 +82,10 @@ extern int sem_timedwait (sem_t *__restrict __sem,
#endif
/* Test whether SEM is posted. */
-extern int sem_trywait (sem_t *__sem) __THROW;
+extern int sem_trywait (sem_t *__sem) __THROWNL;
/* Post SEM. */
-extern int sem_post (sem_t *__sem) __THROW;
+extern int sem_post (sem_t *__sem) __THROWNL;
/* Get current value of SEM and store it in *SVAL. */
extern int sem_getvalue (sem_t *__restrict __sem, int *__restrict __sval)
diff --git a/libpthread/linuxthreads/sysdeps/pthread/pthread.h b/libpthread/linuxthreads/sysdeps/pthread/pthread.h
index 46c1010..879bcea 100644
--- a/libpthread/linuxthreads/sysdeps/pthread/pthread.h
+++ b/libpthread/linuxthreads/sysdeps/pthread/pthread.h
@@ -163,7 +163,7 @@ enum
extern int pthread_create (pthread_t *__restrict __threadp,
const pthread_attr_t *__restrict __attr,
void *(*__start_routine) (void *),
- void *__restrict __arg) __THROW;
+ void *__restrict __arg) __THROWNL;
/* Obtain the identifier of the current thread. */
extern pthread_t pthread_self (void) __THROW;
@@ -340,20 +340,20 @@ extern int pthread_mutex_init (pthread_mutex_t *__restrict __mutex,
extern int pthread_mutex_destroy (pthread_mutex_t *__mutex) __THROW;
/* Try to lock MUTEX. */
-extern int pthread_mutex_trylock (pthread_mutex_t *__mutex) __THROW;
+extern int pthread_mutex_trylock (pthread_mutex_t *__mutex) __THROWNL;
/* Wait until lock for MUTEX becomes available and lock it. */
-extern int pthread_mutex_lock (pthread_mutex_t *__mutex) __THROW;
+extern int pthread_mutex_lock (pthread_mutex_t *__mutex) __THROWNL;
#ifdef __USE_XOPEN2K
/* Wait until lock becomes available, or specified time passes. */
extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
const struct timespec *__restrict
- __abstime) __THROW;
+ __abstime) __THROWNL;
#endif
/* Unlock MUTEX. */
-extern int pthread_mutex_unlock (pthread_mutex_t *__mutex) __THROW;
+extern int pthread_mutex_unlock (pthread_mutex_t *__mutex) __THROWNL;
/* Functions for handling mutex attributes. */
@@ -401,11 +401,11 @@ extern int pthread_cond_destroy (pthread_cond_t *__cond) __THROW;
libpthread_hidden_proto(pthread_cond_destroy)
/* Wake up one thread waiting for condition variable COND. */
-extern int pthread_cond_signal (pthread_cond_t *__cond) __THROW;
+extern int pthread_cond_signal (pthread_cond_t *__cond) __THROWNL;
libpthread_hidden_proto(pthread_cond_signal)
/* Wake up all threads waiting for condition variables COND. */
-extern int pthread_cond_broadcast (pthread_cond_t *__cond) __THROW;
+extern int pthread_cond_broadcast (pthread_cond_t *__cond) __THROWNL;
libpthread_hidden_proto(pthread_cond_broadcast)
/* Wait for condition variable COND to be signaled or broadcast.
@@ -457,33 +457,33 @@ extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock,
extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock) __THROW;
/* Acquire read lock for RWLOCK. */
-extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock) __THROW;
+extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock) __THROWNL;
/* Try to acquire read lock for RWLOCK. */
-extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock) __THROW;
+extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock) __THROWNL;
# ifdef __USE_XOPEN2K
/* Try to acquire read lock for RWLOCK or return after specfied time. */
extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
const struct timespec *__restrict
- __abstime) __THROW;
+ __abstime) __THROWNL;
# endif
/* Acquire write lock for RWLOCK. */
-extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock) __THROW;
+extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock) __THROWNL;
/* Try to acquire write lock for RWLOCK. */
-extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock) __THROW;
+extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock) __THROWNL;
# ifdef __USE_XOPEN2K
/* Try to acquire write lock for RWLOCK or return after specfied time. */
extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
const struct timespec *__restrict
- __abstime) __THROW;
+ __abstime) __THROWNL;
# endif
/* Unlock RWLOCK. */
-extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock) __THROW;
+extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock) __THROWNL;
/* Functions for handling read-write lock attributes. */
@@ -528,13 +528,13 @@ extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared)
extern int pthread_spin_destroy (pthread_spinlock_t *__lock) __THROW;
/* Wait until spinlock LOCK is retrieved. */
-extern int pthread_spin_lock (pthread_spinlock_t *__lock) __THROW;
+extern int pthread_spin_lock (pthread_spinlock_t *__lock) __THROWNL;
/* Try to lock spinlock LOCK. */
-extern int pthread_spin_trylock (pthread_spinlock_t *__lock) __THROW;
+extern int pthread_spin_trylock (pthread_spinlock_t *__lock) __THROWNL;
/* Release spinlock LOCK. */
-extern int pthread_spin_unlock (pthread_spinlock_t *__lock) __THROW;
+extern int pthread_spin_unlock (pthread_spinlock_t *__lock) __THROWNL;
/* Barriers are a also a new feature in 1003.1j-2000. */
@@ -556,7 +556,7 @@ extern int pthread_barrierattr_getpshared (const pthread_barrierattr_t *
extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr,
int __pshared) __THROW;
-extern int pthread_barrier_wait (pthread_barrier_t *__barrier) __THROW;
+extern int pthread_barrier_wait (pthread_barrier_t *__barrier) __THROWNL;
#endif
#endif
diff --git a/libpthread/nptl/Makefile.in b/libpthread/nptl/Makefile.in
index cdf07cf..0a981cd 100644
--- a/libpthread/nptl/Makefile.in
+++ b/libpthread/nptl/Makefile.in
@@ -21,7 +21,7 @@ libpthread-routines- += allocatestack.c # dummy included by pthread_create.c
libpthread-routines- += pthread_mutex_getprioceiling.c pthread_mutex_setprioceiling.c # XXX: delete those or use them!
libpthread-routines-$(UCLIBC_HAS_RESOLVER_SUPPORT) += res.c
libpthread-routines-$(UCLIBC_SUSV4_LEGACY) += pthread_getconcurrency.c \
- pthread_setconcurrency
+ pthread_setconcurrency.c
libpthread_CSRC = $(filter-out $(libpthread-routines-) \
$(libc-shared-routines-y) \
$(libc-static-routines-y) \
diff --git a/libpthread/nptl/pthread_atfork.c b/libpthread/nptl/pthread_atfork.c
index 3c12cd4..39ac3e2 100644
--- a/libpthread/nptl/pthread_atfork.c
+++ b/libpthread/nptl/pthread_atfork.c
@@ -37,13 +37,17 @@
#include <fork.h>
/* This is defined by newer gcc version unique for each module. */
-extern void *__dso_handle __attribute__ ((__weak__));
- //,__visibility__ ("hidden")));
+extern void *__dso_handle __attribute__ ((__weak__,
+ __visibility__ ("hidden")));
/* Hide the symbol so that no definition but the one locally in the
executable or DSO is used. */
int
+#ifndef __pthread_atfork
+/* Don't mark the compatibility function as hidden. */
+attribute_hidden
+#endif
__pthread_atfork (
void (*prepare) (void),
void (*parent) (void),
@@ -52,4 +56,8 @@ __pthread_atfork (
return __register_atfork (prepare, parent, child,
&__dso_handle == NULL ? NULL : __dso_handle);
}
+#ifndef __pthread_atfork
+extern int pthread_atfork (void (*prepare) (void), void (*parent) (void),
+ void (*child) (void)) attribute_hidden;
strong_alias (__pthread_atfork, pthread_atfork)
+#endif
diff --git a/libpthread/nptl/semaphore.h b/libpthread/nptl/semaphore.h
index aa0f929..c7f195b 100644
--- a/libpthread/nptl/semaphore.h
+++ b/libpthread/nptl/semaphore.h
@@ -63,10 +63,10 @@ extern int sem_timedwait (sem_t *__restrict __sem,
#endif
/* Test whether SEM is posted. */
-extern int sem_trywait (sem_t *__sem) __THROW;
+extern int sem_trywait (sem_t *__sem) __THROWNL;
/* Post SEM. */
-extern int sem_post (sem_t *__sem) __THROW;
+extern int sem_post (sem_t *__sem) __THROWNL;
/* Get current value of SEM and store it in *SVAL. */
extern int sem_getvalue (sem_t *__restrict __sem, int *__restrict __sval)
diff --git a/libpthread/nptl/sysdeps/pthread/pthread.h b/libpthread/nptl/sysdeps/pthread/pthread.h
index 896fb1b..4103a06 100644
--- a/libpthread/nptl/sysdeps/pthread/pthread.h
+++ b/libpthread/nptl/sysdeps/pthread/pthread.h
@@ -229,7 +229,7 @@ __BEGIN_DECLS
extern int pthread_create (pthread_t *__restrict __newthread,
const pthread_attr_t *__restrict __attr,
void *(*__start_routine) (void *),
- void *__restrict __arg) __THROW __nonnull ((1, 3));
+ void *__restrict __arg) __THROWNL __nonnull ((1, 3));
/* Terminate calling thread.
@@ -271,7 +271,8 @@ extern int pthread_detach (pthread_t __th) __THROW;
extern pthread_t pthread_self (void) __THROW __attribute__ ((__const__));
/* Compare two thread identifiers. */
-extern int pthread_equal (pthread_t __thread1, pthread_t __thread2) __THROW;
+extern int pthread_equal (pthread_t __thread1, pthread_t __thread2)
+ __THROW __attribute__ ((__const__));
/* Thread attribute handling. */
@@ -308,8 +309,7 @@ extern int pthread_attr_setguardsize (pthread_attr_t *__attr,
/* Return in *PARAM the scheduling parameters of *ATTR. */
-extern int pthread_attr_getschedparam (const pthread_attr_t *__restrict
- __attr,
+extern int pthread_attr_getschedparam (const pthread_attr_t *__restrict __attr,
struct sched_param *__restrict __param)
__THROW __nonnull ((1, 2));
@@ -643,9 +643,9 @@ __pthread_cleanup_routine (struct __pthread_cleanup_frame *__frame)
__pthread_unwind_buf_t __cancel_buf; \
void (*__cancel_routine) (void *) = (routine); \
void *__cancel_arg = (arg); \
- int not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \
+ int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \
__cancel_buf.__cancel_jmp_buf, 0); \
- if (__builtin_expect (not_first_call, 0)) \
+ if (__builtin_expect (__not_first_call, 0)) \
{ \
__cancel_routine (__cancel_arg); \
__pthread_unwind_next (&__cancel_buf); \
@@ -678,9 +678,9 @@ extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf)
__pthread_unwind_buf_t __cancel_buf; \
void (*__cancel_routine) (void *) = (routine); \
void *__cancel_arg = (arg); \
- int not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \
+ int __not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) (void *) \
__cancel_buf.__cancel_jmp_buf, 0); \
- if (__builtin_expect (not_first_call, 0)) \
+ if (__builtin_expect (__not_first_call, 0)) \
{ \
__cancel_routine (__cancel_arg); \
__pthread_unwind_next (&__cancel_buf); \
@@ -717,7 +717,7 @@ extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf)
/* Function used in the macros. */
struct __jmp_buf_tag;
-extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROW;
+extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROWNL;
/* Mutex handling. */
@@ -733,22 +733,22 @@ extern int pthread_mutex_destroy (pthread_mutex_t *__mutex)
/* Try locking a mutex. */
extern int pthread_mutex_trylock (pthread_mutex_t *__mutex)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
/* Lock a mutex. */
extern int pthread_mutex_lock (pthread_mutex_t *__mutex)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
#ifdef __USE_XOPEN2K
/* Wait until lock becomes available, or specified time passes. */
extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
const struct timespec *__restrict
- __abstime) __THROW __nonnull ((1, 2));
+ __abstime) __THROWNL __nonnull ((1, 2));
#endif
/* Unlock a mutex. */
extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
/* Get the priority ceiling of MUTEX. */
@@ -872,37 +872,37 @@ extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock)
/* Acquire read lock for RWLOCK. */
extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
/* Try to acquire read lock for RWLOCK. */
extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
# ifdef __USE_XOPEN2K
/* Try to acquire read lock for RWLOCK or return after specfied time. */
extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
const struct timespec *__restrict
- __abstime) __THROW __nonnull ((1, 2));
+ __abstime) __THROWNL __nonnull ((1, 2));
# endif
/* Acquire write lock for RWLOCK. */
extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
/* Try to acquire write lock for RWLOCK. */
extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
# ifdef __USE_XOPEN2K
/* Try to acquire write lock for RWLOCK or return after specfied time. */
extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
const struct timespec *__restrict
- __abstime) __THROW __nonnull ((1, 2));
+ __abstime) __THROWNL __nonnull ((1, 2));
# endif
/* Unlock RWLOCK. */
extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
/* Functions for handling read-write lock attributes. */
@@ -943,8 +943,8 @@ extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr,
/* Initialize condition variable COND using attributes ATTR, or use
the default values if later is NULL. */
extern int pthread_cond_init (pthread_cond_t *__restrict __cond,
- const pthread_condattr_t *__restrict
- __cond_attr) __THROW __nonnull ((1));
+ const pthread_condattr_t *__restrict __cond_attr)
+ __THROW __nonnull ((1));
/* Destroy condition variable COND. */
extern int pthread_cond_destroy (pthread_cond_t *__cond)
@@ -952,11 +952,11 @@ extern int pthread_cond_destroy (pthread_cond_t *__cond)
/* Wake up one thread waiting for condition variable COND. */
extern int pthread_cond_signal (pthread_cond_t *__cond)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
/* Wake up all threads waiting for condition variables COND. */
extern int pthread_cond_broadcast (pthread_cond_t *__cond)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
/* Wait for condition variable COND to be signaled or broadcast.
MUTEX is assumed to be locked before.
@@ -976,8 +976,8 @@ extern int pthread_cond_wait (pthread_cond_t *__restrict __cond,
__THROW. */
extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
pthread_mutex_t *__restrict __mutex,
- const struct timespec *__restrict
- __abstime) __nonnull ((1, 2, 3));
+ const struct timespec *__restrict __abstime)
+ __nonnull ((1, 2, 3));
/* Functions for handling condition variable attributes. */
@@ -1000,13 +1000,13 @@ extern int pthread_condattr_setpshared (pthread_condattr_t *__attr,
int __pshared) __THROW __nonnull ((1));
#ifdef __USE_XOPEN2K
-/* Get the clock selected for the conditon variable attribute ATTR. */
+/* Get the clock selected for the condition variable attribute ATTR. */
extern int pthread_condattr_getclock (const pthread_condattr_t *
__restrict __attr,
__clockid_t *__restrict __clock_id)
__THROW __nonnull ((1, 2));
-/* Set the clock selected for the conditon variable attribute ATTR. */
+/* Set the clock selected for the condition variable attribute ATTR. */
extern int pthread_condattr_setclock (pthread_condattr_t *__attr,
__clockid_t __clock_id)
__THROW __nonnull ((1));
@@ -1027,15 +1027,15 @@ extern int pthread_spin_destroy (pthread_spinlock_t *__lock)
/* Wait until spinlock LOCK is retrieved. */
extern int pthread_spin_lock (pthread_spinlock_t *__lock)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
/* Try to lock spinlock LOCK. */
extern int pthread_spin_trylock (pthread_spinlock_t *__lock)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
/* Release spinlock LOCK. */
extern int pthread_spin_unlock (pthread_spinlock_t *__lock)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
/* Functions to handle barriers. */
@@ -1053,7 +1053,7 @@ extern int pthread_barrier_destroy (pthread_barrier_t *__barrier)
/* Wait on barrier BARRIER. */
extern int pthread_barrier_wait (pthread_barrier_t *__barrier)
- __THROW __nonnull ((1));
+ __THROWNL __nonnull ((1));
/* Initialize barrier attribute ATTR. */
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h
index 0b635d3..a9652bb 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h
@@ -358,7 +358,7 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden;
register unsigned long __r5 __asm__ ("r5") \
= __lll_private_flag (FUTEX_WAIT, private); \
register unsigned long __r6 __asm__ ("r6") = (unsigned long) (val); \
- register unsigned long __r7 __asm__ ("r7") = (timeout); \
+ register unsigned long __r7 __asm__ ("r7") = (unsigned long) (timeout); \
__asm__ __volatile__ (SYSCALL_WITH_INST_PAD \
: "=z" (__status) \
: "r" (__r3), "r" (__r4), "r" (__r5), \
diff --git a/librt/Makefile.in b/librt/Makefile.in
index 8555e94..fbbf5b4 100644
--- a/librt/Makefile.in
+++ b/librt/Makefile.in
@@ -15,6 +15,9 @@ LIBS-librt.so := $(LIBS)
ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
LIBS-librt.so += $(top_builddir)lib/libdl.so $(top_builddir)lib/libpthread.so
endif
+START_FILE-librt.so := $(SHARED_START_FILES)
+END_FILE-librt.so := $(SHARED_END_FILES)
+
librt_FULL_NAME := librt-$(VERSION).so
diff --git a/libutil/Makefile.in b/libutil/Makefile.in
index f904fc7..98b178e 100644
--- a/libutil/Makefile.in
+++ b/libutil/Makefile.in
@@ -27,6 +27,14 @@ ifneq ($(UCLIBC_HAS_PTY),y)
libutil_SRC := $(filter-out $(libutil_DIR)/openpty.c $(libutil_DIR)/forkpty.c \
,$(libutil_SRC))
endif
+ifeq ($(UCLIBC_HAS_UTMP)$(UCLIBC_HAS_UTMPX),)
+libutil_SRC := $(filter-out \
+ $(libutil_DIR)/logwtmp.c \
+ $(libutil_DIR)/login.c \
+ $(libutil_DIR)/logout.c \
+ ,$(libutil_SRC))
+endif
+
libutil_OBJ := $(patsubst $(libutil_DIR)/%.c,$(libutil_OUT)/%.o,$(libutil_SRC))
ifeq ($(DOPIC),y)
diff --git a/libutil/forkpty.c b/libutil/forkpty.c
index ec490f0..2464333 100644
--- a/libutil/forkpty.c
+++ b/libutil/forkpty.c
@@ -22,9 +22,6 @@
#include <utmp.h>
#include <pty.h>
-libutil_hidden_proto(openpty)
-libutil_hidden_proto(login_tty)
-
int
forkpty (int *amaster, char *name, struct termios *termp, struct winsize *winp)
{
diff --git a/libutil/login.c b/libutil/login.c
index 4007e4c..971997d 100644
--- a/libutil/login.c
+++ b/libutil/login.c
@@ -3,7 +3,7 @@
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
-#include <utmp.h>
+#include "internal/utmp.h"
/* Write the given entry into utmp and wtmp.
* Note: the match in utmp is done against ut_id field,
@@ -11,7 +11,7 @@
*/
void login(const struct utmp *entry)
{
- struct utmp copy;
+ struct UT copy;
char tty_name[sizeof(copy.ut_line) + 6];
int fd;
@@ -20,7 +20,7 @@ void login(const struct utmp *entry)
// (if there is such a field) with the value USER_PROCESS,
// and fills the field ut->ut_pid (if there is such a field)
// with the process ID of the calling process.
- copy = *entry;
+ copy = *((const struct UT *)(entry));
#if _HAVE_UT_TYPE - 0
copy.ut_type = USER_PROCESS;
#endif
diff --git a/libutil/login_tty.c b/libutil/login_tty.c
index 3979adc..3665858 100644
--- a/libutil/login_tty.c
+++ b/libutil/login_tty.c
@@ -36,7 +36,6 @@
#include <fcntl.h>
#include <utmp.h>
-libutil_hidden_proto(login_tty)
int login_tty(int fd)
{
(void) setsid();
diff --git a/libutil/logout.c b/libutil/logout.c
index 9c7440b..0181e23 100644
--- a/libutil/logout.c
+++ b/libutil/logout.c
@@ -18,14 +18,14 @@
#include <errno.h>
#include <string.h>
-#include <utmp.h>
#include <sys/time.h>
+#include "internal/utmp.h"
int
logout (const char *line)
{
- struct utmp tmp;
- struct utmp *ut;
+ struct UT tmp;
+ struct UT *ut;
int result = 0;
/* if (utmpname (_PATH_UTMP) == -1) return 0; - why?
@@ -50,7 +50,7 @@ logout (const char *line)
memset (ut->ut_host, 0, sizeof ut->ut_host);
#endif
#if _HAVE_UT_TV - 0
-# if !defined __WORDSIZE_COMPAT32 || __WORDSIZE_COMPAT32 == 0
+# if !defined __WORDSIZE_TIME64_COMPAT32
gettimeofday (&ut->ut_tv, NULL);
# else
{
diff --git a/libutil/logwtmp.c b/libutil/logwtmp.c
index 2a6f28a..99b772f 100644
--- a/libutil/logwtmp.c
+++ b/libutil/logwtmp.c
@@ -9,13 +9,13 @@
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
-#include <utmp.h>
#include <fcntl.h>
#include <sys/file.h>
+#include "internal/utmp.h"
void logwtmp(const char *line, const char *name, const char *host)
{
- struct utmp lutmp;
+ struct UT lutmp;
memset(&lutmp, 0, sizeof(lutmp));
lutmp.ut_type = (name && *name) ? USER_PROCESS : DEAD_PROCESS;
@@ -23,7 +23,7 @@ void logwtmp(const char *line, const char *name, const char *host)
strncpy(lutmp.ut_line, line, sizeof(lutmp.ut_line)-1);
strncpy(lutmp.ut_name, name, sizeof(lutmp.ut_name)-1);
strncpy(lutmp.ut_host, host, sizeof(lutmp.ut_host)-1);
-#if !defined __WORDSIZE_COMPAT32 || __WORDSIZE_COMPAT32 == 0
+#if !defined __WORDSIZE_TIME64_COMPAT32
gettimeofday(&lutmp.ut_tv, NULL);
#else
{
@@ -36,20 +36,3 @@ void logwtmp(const char *line, const char *name, const char *host)
updwtmp(_PATH_WTMP, &lutmp);
}
-
-#if 0
-/* This is enabled in uClibc/libc/misc/utmp/wtent.c */
-void updwtmp(const char *wtmp_file, const struct utmp *lutmp)
-{
- int fd;
-
- fd = open(wtmp_file, O_APPEND | O_WRONLY);
- if (fd >= 0) {
- if (lockf(fd, F_LOCK, 0) == 0) {
- write(fd, lutmp, sizeof(*lutmp));
- lockf(fd, F_ULOCK, 0);
- close(fd);
- }
- }
-}
-#endif
diff --git a/libutil/openpty.c b/libutil/openpty.c
index bd8b8d9..848dc8d 100644
--- a/libutil/openpty.c
+++ b/libutil/openpty.c
@@ -84,7 +84,6 @@ pts_name (int fd, char **pts, size_t buf_len)
/* Create pseudo tty master slave pair and set terminal attributes
according to TERMP and WINP. Return handles for both ends in
AMASTER and ASLAVE, and return the name of the slave end in NAME. */
-libutil_hidden_proto(openpty)
int
openpty (int *amaster, int *aslave, char *name, struct termios *termp,
struct winsize *winp)
diff --git a/test/.gitignore b/test/.gitignore
index 5944f0a..0d19285 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -163,6 +163,7 @@ misc/tst-seekdir
misc/tst-statfs
misc/tst-statvfs
misc/tst-utmp
+misc/tst-utmpx
mmap/mmap
mmap/mmap2
mmap/mmap64
@@ -262,6 +263,8 @@ signal/tst-sigset
signal/tst-sigsimple
silly/hello
silly/tiny
+silly/tst-atomic
+silly/tst-atomic-long
stat/memcmp-stat
stat/stat
stat/stat64
diff --git a/test/README b/test/README
index 28225b0..723ce6e 100644
--- a/test/README
+++ b/test/README
@@ -29,6 +29,9 @@ The following make variables may help you in testing:
So, to just run the uClibc tests, try this:
make check UCLIBC_ONLY=1
+You can pass the following 2 environment variables to "make run":
+ - make run SIMULATOR_uclibc=qemu-sh4 SIMULATOR_glibc=qemu-x86_64
+
If you need to test just a subset of all test, delete subdirectories
you do not need.
diff --git a/test/Test.mak b/test/Test.mak
index ee43a0f..a56a201 100644
--- a/test/Test.mak
+++ b/test/Test.mak
@@ -69,7 +69,7 @@ endef
define exec_test
$(showtest)
$(Q)\
- $(WRAPPER) $(WRAPPER_$(tst_src_name)) \
+ $(SIMULATOR) $(WRAPPER) $(WRAPPER_$(tst_src_name)) \
./$(binary_name) $(OPTS) $(OPTS_$(tst_src_name)) > "$(binary_name).out" 2>&1 ; \
ret=$$? ; \
expected_ret="$(RET_$(tst_src_name))" ; \
@@ -85,6 +85,9 @@ endef
test check all: run
run: $(RUN_TARGETS)
+
+$(addsuffix .exe,$(U_TARGETS)): SIMULATOR:=$(SIMULATOR_uclibc)
+$(addsuffix .exe,$(G_TARGETS)): SIMULATOR:=$(SIMULATOR_glibc)
$(RUN_TARGETS):
$(exec_test)
$(diff_test)
diff --git a/test/math/compile_test.c b/test/math/compile_test.c
index ab8c40c..aedfde6 100644
--- a/test/math/compile_test.c
+++ b/test/math/compile_test.c
@@ -22,11 +22,11 @@ r += exp2f(float_x);
r += expf(float_x);
r += expm1f(float_x);
r += fabsf(float_x);
-/*r += fdimf(float_x, float_x); - uclibc does not have it (yet?) */
+r += fdimf(float_x, float_x);
r += floorf(float_x);
-/*r += fmaf(float_x, float_x, float_x); - uclibc does not have it (yet?) */
-/*r += fmaxf(float_x, float_x); - uclibc does not have it (yet?) */
-/*r += fminf(float_x, float_x); - uclibc does not have it (yet?) */
+r += fmaf(float_x, float_x, float_x);
+r += fmaxf(float_x, float_x);
+r += fminf(float_x, float_x);
r += fmodf(float_x, float_x);
r += frexpf(float_x, &int_x);
r += gammaf(float_x);
@@ -44,17 +44,17 @@ r += logf(float_x);
r += lrintf(float_x);
r += lroundf(float_x);
r += modff(float_x, &float_x);
-/*r += nearbyintf(float_x); - uclibc does not have it (yet?) */
-/*r += nexttowardf(float_x, long_double_x); - uclibc does not have it (yet?) */
+r += nearbyintf(float_x);
+r += nexttowardf(float_x, long_double_x);
r += powf(float_x, float_x);
r += remainderf(float_x, float_x);
-/*r += remquof(float_x, float_x, &int_x); - uclibc does not have it (yet?) */
+r += remquof(float_x, float_x, &int_x);
r += rintf(float_x);
r += roundf(float_x);
#ifdef __UCLIBC_SUSV3_LEGACY__
r += scalbf(float_x, float_x);
#endif
-/*r += scalblnf(float_x, long_x); - uclibc does not have it (yet?) */
+r += scalblnf(float_x, long_x);
r += scalbnf(float_x, int_x);
r += significandf(float_x);
r += sinf(float_x);
@@ -62,7 +62,7 @@ r += sinhf(float_x);
r += sqrtf(float_x);
r += tanf(float_x);
r += tanhf(float_x);
-/*r += tgammaf(float_x); - uclibc does not have it (yet?) */
+r += tgammaf(float_x);
r += truncf(float_x);
return r;
}
@@ -116,7 +116,7 @@ r += lroundl(long_double_x);
r += modfl(long_double_x, &long_double_x);
r += nearbyintl(long_double_x);
r += nextafterl(long_double_x, long_double_x);
-/* r += nexttowardl(long_double_x, long_double_x); - uclibc doesn't provide this [yet?] */
+r += nexttowardl(long_double_x, long_double_x);
r += powl(long_double_x, long_double_x);
r += remainderl(long_double_x, long_double_x);
r += remquol(long_double_x, long_double_x, &int_x);
diff --git a/test/math/libm-test.inc b/test/math/libm-test.inc
index d0f0a0c..f50b48b 100644
--- a/test/math/libm-test.inc
+++ b/test/math/libm-test.inc
@@ -115,6 +115,9 @@
# define _GNU_SOURCE
#endif
+#undef __CHK_COMPLEX_STUFF
+#define __CHK_COMPLEX_STUFF 0
+
#include "libm-test-ulps.h"
#include <complex.h>
#include <math.h>
@@ -1120,8 +1123,10 @@ cacosh_test (void)
END (cacosh, complex);
}
+#endif
+#if __CHK_COMPLEX_STUFF
static void
carg_test (void)
{
@@ -1188,7 +1193,9 @@ carg_test (void)
END (carg);
}
+#endif /* __CHK_COMPLEX_STUFF */
+#if 0
static void
casin_test (void)
{
@@ -1683,7 +1690,7 @@ ceil_test (void)
}
-#if 0
+#if __CHK_COMPLEX_STUFF
static void
cexp_test (void)
{
@@ -1746,8 +1753,9 @@ cexp_test (void)
END (cexp, complex);
}
+#endif /* __CHK_COMPLEX_STUFF */
-
+#if 0
static void
cimag_test (void)
{
@@ -2588,7 +2596,6 @@ fabs_test (void)
}
-#if 0
static void
fdim_test (void)
{
@@ -2624,7 +2631,6 @@ fdim_test (void)
END (fdim);
}
-#endif
static void
@@ -2694,7 +2700,6 @@ floor_test (void)
}
-#if 0
static void
fma_test (void)
{
@@ -2797,7 +2802,6 @@ fmin_test (void)
END (fmin);
}
-#endif
static void
@@ -3002,7 +3006,7 @@ isnormal_test (void)
END (isnormal);
}
-#if defined __DO_XSI_MATH__
+#if defined __DO_XSI_MATH__ && !(defined TEST_LDOUBLE || defined TEST_FLOAT)
static void
j0_test (void)
{
@@ -3414,8 +3418,6 @@ log1p_test (void)
END (log1p);
}
-
-#if 0
static void
log2_test (void)
{
@@ -3445,8 +3447,6 @@ log2_test (void)
END (log2);
}
-#endif
-
static void
logb_test (void)
@@ -3629,7 +3629,6 @@ modf_test (void)
}
-#if 0
static void
nearbyint_test (void)
{
@@ -3710,7 +3709,6 @@ nexttoward_test (void)
END (nexttoward);
}
-#endif
static void
@@ -3950,7 +3948,6 @@ remainder_test (void)
END (remainder);
}
-#if 0
static void
remquo_test (void)
{
@@ -3981,7 +3978,6 @@ remquo_test (void)
END (remquo);
}
-#endif
static void
rint_test (void)
@@ -4229,12 +4225,12 @@ round_test (void)
#endif
+#ifdef __UCLIBC_SUSV3_LEGACY__
static void
scalb_test (void)
{
START (scalb);
#ifndef TEST_LDOUBLE /* uclibc doesn't have scalbl */
-#ifdef __UCLIBC_SUSV3_LEGACY__ /* scalbf is susv3 legacy */
TEST_ff_f (scalb, 2.0, 0.5, nan_value, INVALID_EXCEPTION);
TEST_ff_f (scalb, 3.0, -2.5, nan_value, INVALID_EXCEPTION);
@@ -4285,11 +4281,10 @@ scalb_test (void)
TEST_ff_f (scalb, 0.8L, 4, 12.8L);
TEST_ff_f (scalb, -0.854375L, 5, -27.34L);
-#endif /* __UCLIBC_SUSV3_LEGACY__ */
#endif /* TEST_LDOUBLE */
END (scalb);
}
-
+#endif
static void
scalbn_test (void)
@@ -4313,7 +4308,6 @@ scalbn_test (void)
}
-#if 0
static void
scalbln_test (void)
{
@@ -4334,7 +4328,6 @@ scalbln_test (void)
END (scalbn);
}
-#endif
static void
@@ -4539,7 +4532,6 @@ tanh_test (void)
END (tanh);
}
-#if 0
static void
tgamma_test (void)
{
@@ -4571,7 +4563,6 @@ tgamma_test (void)
END (tgamma);
}
-#endif
#if 0
@@ -4651,7 +4642,7 @@ trunc_test (void)
}
#endif
-#if defined __DO_XSI_MATH__
+#if defined __DO_XSI_MATH__ && !(defined TEST_LDOUBLE || defined TEST_FLOAT)
static void
y0_test (void)
{
@@ -4973,17 +4964,15 @@ main (int argc, char **argv)
log_test ();
log10_test ();
log1p_test ();
-#if 0
log2_test ();
-#endif
logb_test ();
modf_test ();
ilogb_test ();
+#ifdef __UCLIBC_SUSV3_LEGACY__
scalb_test ();
+#endif
scalbn_test ();
-#if 0
scalbln_test ();
-#endif
significand_test ();
/* Power and absolute value functions: */
@@ -4998,16 +4987,12 @@ main (int argc, char **argv)
erfc_test ();
gamma_test ();
lgamma_test ();
-#if 0
tgamma_test ();
-#endif
/* Nearest integer functions: */
ceil_test ();
floor_test ();
-#if 0
nearbyint_test ();
-#endif
rint_test ();
#if 0
rint_test_tonearest ();
@@ -5025,13 +5010,10 @@ main (int argc, char **argv)
/* Remainder functions: */
fmod_test ();
remainder_test ();
-#if 0
remquo_test ();
-#endif
/* Manipulation functions: */
copysign_test ();
-#if 0
nextafter_test ();
nexttoward_test ();
@@ -5043,24 +5025,29 @@ main (int argc, char **argv)
/* Multiply and add: */
fma_test ();
+
/* Complex functions: */
cabs_test ();
+#if __CHK_COMPLEX_STUFF
+#if 0
cacos_test ();
cacosh_test ();
+#endif
carg_test ();
+#if 0
casin_test ();
casinh_test ();
catan_test ();
catanh_test ();
ccos_test ();
ccosh_test ();
+#endif
cexp_test ();
+#if 0
cimag_test ();
clog10_test ();
clog_test ();
-#if 0
conj_test ();
-#endif
cpow_test ();
cproj_test ();
creal_test ();
@@ -5070,9 +5057,10 @@ main (int argc, char **argv)
ctan_test ();
ctanh_test ();
#endif
+#endif /* __CHK_COMPLEX_STUFF */
/* Bessel functions: */
-#if defined __DO_XSI_MATH__
+#if defined __DO_XSI_MATH__ && !(defined TEST_LDOUBLE || defined TEST_FLOAT)
j0_test ();
j1_test ();
jn_test ();
diff --git a/test/misc/Makefile.in b/test/misc/Makefile.in
index 345889e..d78b276 100644
--- a/test/misc/Makefile.in
+++ b/test/misc/Makefile.in
@@ -21,6 +21,14 @@ ifeq ($(UCLIBC_HAS_GLOB),)
TESTS_DISABLED += bug-glob2
endif
+ifeq ($(UCLIBC_HAS_UTMPX),)
+TESTS_DISABLED += tst-utmpx
+endif
+
+ifeq ($(UCLIBC_HAS_UTMP),)
+TESTS_DISABLED += tst-utmp
+endif
+
DODIFF_dirent := 1
DODIFF_dirent64 := 1
DODIFF_tst-statfs := 1
diff --git a/test/misc/tst-scandir.c b/test/misc/tst-scandir.c
index df62a40..e1c72e3 100644
--- a/test/misc/tst-scandir.c
+++ b/test/misc/tst-scandir.c
@@ -3,7 +3,7 @@
#include <stdio.h> /* perror() */
#include <stdlib.h>
-int skip_all(const struct dirent *dirbuf)
+static int skip_all(const struct dirent *dirbuf)
{
errno = EBADF;
return 0;
diff --git a/test/misc/tst-utmp.c b/test/misc/tst-utmp.c
index 08a6f8e..1b0333a 100644
--- a/test/misc/tst-utmp.c
+++ b/test/misc/tst-utmp.c
@@ -37,6 +37,21 @@
# include <utmp.h>
#endif
+#ifndef _HAVE_UT_TYPE
+# define _HAVE_UT_TYPE 0
+#endif
+#ifndef _HAVE_UT_PID
+# define _HAVE_UT_PID 0
+#endif
+#ifndef _HAVE_UT_ID
+# define _HAVE_UT_ID 0
+#endif
+#ifndef _HAVE_UT_TV
+# define _HAVE_UT_TV 0
+#endif
+#ifndef _HAVE_UT_HOST
+# define _HAVE_UT_HOST 0
+#endif
#if _HAVE_UT_TYPE || defined UTMPX
diff --git a/test/misc/tst-utmpx.c b/test/misc/tst-utmpx.c
new file mode 100644
index 0000000..edb5551
--- /dev/null
+++ b/test/misc/tst-utmpx.c
@@ -0,0 +1,2 @@
+#define UTMPX
+#include "tst-utmp.c"
diff --git a/test/silly/Makefile.in b/test/silly/Makefile.in
index bb08e0d..2114d4d 100644
--- a/test/silly/Makefile.in
+++ b/test/silly/Makefile.in
@@ -3,3 +3,6 @@
RET_hello := 42
RET_tiny := 42
+
+# missing internal headers, disable these
+TESTS_DISABLED := tst-atomic tst-atomic-long
diff --git a/test/silly/hello.c b/test/silly/hello.c
index 4aba926..d330597 100644
--- a/test/silly/hello.c
+++ b/test/silly/hello.c
@@ -1,4 +1,4 @@
-#include<stdio.h>
+#include <stdio.h>
#include <stdlib.h>
int main(void)
diff --git a/libc/sysdeps/linux/sparc/jmpbuf-offsets.h b/test/silly/tst-atomic-long.c
similarity index 75%
copy from libc/sysdeps/linux/sparc/jmpbuf-offsets.h
copy to test/silly/tst-atomic-long.c
index 0d0a96d..d13fb07 100644
--- a/libc/sysdeps/linux/sparc/jmpbuf-offsets.h
+++ b/test/silly/tst-atomic-long.c
@@ -1,6 +1,7 @@
-/* Private macros for accessing __jmp_buf contents. SPARC version.
- Copyright (C) 2006 Free Software Foundation, Inc.
+/* Tests for atomic.h macros.
+ Copyright (C) 2003-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub(a)redhat.com>, 2003.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -18,12 +19,9 @@
#include <bits/wordsize.h>
+#define atomic_t long
#if __WORDSIZE == 64
-#define O_mask_was_saved 512
-#define O_gregs 32
-#define O_g1 (O_gregs + 4*8)
-#else
-#define JB_SP 0
-#define JB_FP 1
-#define JB_PC 2
+# define TEST_ATOMIC64 1
#endif
+
+#include "tst-atomic.c"
diff --git a/test/silly/tst-atomic.c b/test/silly/tst-atomic.c
new file mode 100644
index 0000000..fc773b2
--- /dev/null
+++ b/test/silly/tst-atomic.c
@@ -0,0 +1,573 @@
+/* Tests for atomic.h macros.
+ Copyright (C) 2003-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub(a)redhat.com>, 2003.
+
+ 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <atomic.h>
+
+#ifndef atomic_t
+# define atomic_t int
+#endif
+
+#define CHK2(f,a1,a2,rv,new_mem) \
+ retval = f(&mem, a1, a2); \
+ if (retval != rv) { \
+ printf("%s(mem, %lu, %lu): retval %lu != expected %lu\n", \
+ #f, a1, a2, retval, rv); \
+ ret = 1; \
+ } \
+ if (mem != new_mem) { \
+ printf("%s(mem, %lu, %lu): mem %lu != expected %lu\n", \
+ #f, a1, a2, mem, new_mem); \
+ ret = 1; \
+ }
+#define CHK1(f,a1,rv,new_mem) \
+ retval = f(&mem, a1); \
+ if (retval != rv) { \
+ printf("%s(mem, %lu): retval %lu != expected %lu\n", \
+ #f, a1, retval, rv); \
+ ret = 1; \
+ } \
+ if (mem != new_mem) { \
+ printf("%s(mem, %lu): mem %lu != expected %lu\n", \
+ #f, a1, mem, new_mem); \
+ ret = 1; \
+ }
+#define CHK0(f,rv,new_mem) \
+ retval = f(&mem); \
+ if (retval != rv) { \
+ printf("%s(mem): retval %lu != expected %lu\n", \
+ #f, retval, rv); \
+ ret = 1; \
+ } \
+ if (mem != new_mem) { \
+ printf("%s(mem): mem %lu != expected %lu\n", \
+ #f, mem, new_mem); \
+ ret = 1; \
+ }
+
+/* Test various atomic.h macros. */
+static int
+do_test (void)
+{
+ atomic_t mem, expected, retval;
+ int ret = 0;
+
+#ifdef atomic_compare_and_exchange_val_acq
+ mem = 24;
+ CHK2(atomic_compare_and_exchange_val_acq, 35, 24, 24, 35);
+ mem = 12;
+ CHK2(atomic_compare_and_exchange_val_acq, 10, 15, 12, 12);
+ mem = -15;
+ CHK2(atomic_compare_and_exchange_val_acq, -56, -15, -15, -56);
+ mem = -1;
+ CHK2(atomic_compare_and_exchange_val_acq, 17, 0, -1, -1);
+#endif
+
+ mem = 24;
+ CHK2(atomic_compare_and_exchange_bool_acq, 35, 24, 0, 35);
+ mem = 12;
+ CHK2(atomic_compare_and_exchange_bool_acq, 10, 15, 1, 12);
+ mem = -15;
+ CHK2(atomic_compare_and_exchange_bool_acq, -56, -15, 0, -56);
+ mem = -1;
+ CHK2(atomic_compare_and_exchange_bool_acq, 17, 0, 1, -1);
+
+ mem = 64;
+ CHK1(atomic_exchange_acq, 31, 64, 31);
+ mem = 2;
+ CHK1(atomic_exchange_and_add, 11, 2, 13);
+ mem = 2;
+ CHK1(atomic_exchange_and_add_acq, 11, 2, 13);
+ mem = 2;
+ CHK1(atomic_exchange_and_add_rel, 11, 2, 13);
+
+ mem = -21;
+ atomic_add (&mem, 22);
+ if (mem != 1)
+ {
+ printf ("atomic_add(mem, 22): mem %lu != expected 1\n", mem);
+ ret = 1;
+ }
+
+ mem = -1;
+ atomic_increment (&mem);
+ if (mem != 0)
+ {
+ printf ("atomic_increment(mem): mem %lu != expected 0\n", mem);
+ ret = 1;
+ }
+
+ mem = 2;
+ if ((retval = atomic_increment_val (&mem)) != 3)
+ {
+ printf ("atomic_increment_val(mem): retval %lu != expected 3\n", retval);
+ ret = 1;
+ }
+
+ mem = 0;
+ CHK0(atomic_increment_and_test, 0, 1);
+ mem = 35;
+ CHK0(atomic_increment_and_test, 0, 36);
+ mem = -1;
+ CHK0(atomic_increment_and_test, 1, 0);
+ mem = 17;
+ atomic_decrement (&mem);
+ if (mem != 16)
+ {
+ printf ("atomic_increment(mem): mem %lu != expected 16\n", mem);
+ ret = 1;
+ }
+
+ if ((retval = atomic_decrement_val (&mem)) != 15)
+ {
+ printf ("atomic_decrement_val(mem): retval %lu != expected 15\n", retval);
+ ret = 1;
+ }
+
+ mem = 0;
+ CHK0(atomic_decrement_and_test, 0, -1);
+
+ mem = 15;
+ CHK0(atomic_decrement_and_test, 0, 14);
+ mem = 1;
+ CHK0(atomic_decrement_and_test, 1, 0);
+ mem = 1;
+ if (atomic_decrement_if_positive (&mem) != 1
+ || mem != 0)
+ {
+ puts ("atomic_decrement_if_positive test 1 failed");
+ ret = 1;
+ }
+
+ mem = 0;
+ if (atomic_decrement_if_positive (&mem) != 0
+ || mem != 0)
+ {
+ puts ("atomic_decrement_if_positive test 2 failed");
+ ret = 1;
+ }
+
+ mem = -1;
+ if (atomic_decrement_if_positive (&mem) != -1
+ || mem != -1)
+ {
+ puts ("atomic_decrement_if_positive test 3 failed");
+ ret = 1;
+ }
+
+ mem = -12;
+ if (! atomic_add_negative (&mem, 10)
+ || mem != -2)
+ {
+ puts ("atomic_add_negative test 1 failed");
+ ret = 1;
+ }
+
+ mem = 0;
+ if (atomic_add_negative (&mem, 100)
+ || mem != 100)
+ {
+ puts ("atomic_add_negative test 2 failed");
+ ret = 1;
+ }
+
+ mem = 15;
+ if (atomic_add_negative (&mem, -10)
+ || mem != 5)
+ {
+ puts ("atomic_add_negative test 3 failed");
+ ret = 1;
+ }
+
+ mem = -12;
+ if (atomic_add_negative (&mem, 14)
+ || mem != 2)
+ {
+ puts ("atomic_add_negative test 4 failed");
+ ret = 1;
+ }
+
+ mem = 0;
+ if (! atomic_add_negative (&mem, -1)
+ || mem != -1)
+ {
+ puts ("atomic_add_negative test 5 failed");
+ ret = 1;
+ }
+
+ mem = -31;
+ if (atomic_add_negative (&mem, 31)
+ || mem != 0)
+ {
+ puts ("atomic_add_negative test 6 failed");
+ ret = 1;
+ }
+
+ mem = -34;
+ if (atomic_add_zero (&mem, 31)
+ || mem != -3)
+ {
+ puts ("atomic_add_zero test 1 failed");
+ ret = 1;
+ }
+
+ mem = -36;
+ if (! atomic_add_zero (&mem, 36)
+ || mem != 0)
+ {
+ puts ("atomic_add_zero test 2 failed");
+ ret = 1;
+ }
+
+ mem = 113;
+ if (atomic_add_zero (&mem, -13)
+ || mem != 100)
+ {
+ puts ("atomic_add_zero test 3 failed");
+ ret = 1;
+ }
+
+ mem = -18;
+ if (atomic_add_zero (&mem, 20)
+ || mem != 2)
+ {
+ puts ("atomic_add_zero test 4 failed");
+ ret = 1;
+ }
+
+ mem = 10;
+ if (atomic_add_zero (&mem, -20)
+ || mem != -10)
+ {
+ puts ("atomic_add_zero test 5 failed");
+ ret = 1;
+ }
+
+ mem = 10;
+ if (! atomic_add_zero (&mem, -10)
+ || mem != 0)
+ {
+ puts ("atomic_add_zero test 6 failed");
+ ret = 1;
+ }
+
+ mem = 0;
+ atomic_bit_set (&mem, 1);
+ if (mem != 2)
+ {
+ puts ("atomic_bit_set test 1 failed");
+ ret = 1;
+ }
+
+ mem = 8;
+ atomic_bit_set (&mem, 3);
+ if (mem != 8)
+ {
+ puts ("atomic_bit_set test 2 failed");
+ ret = 1;
+ }
+
+#ifdef TEST_ATOMIC64
+ mem = 16;
+ atomic_bit_set (&mem, 35);
+ if (mem != 0x800000010LL)
+ {
+ puts ("atomic_bit_set test 3 failed");
+ ret = 1;
+ }
+#endif
+
+ mem = 0;
+ if (atomic_bit_test_set (&mem, 1)
+ || mem != 2)
+ {
+ puts ("atomic_bit_test_set test 1 failed");
+ ret = 1;
+ }
+
+ mem = 8;
+ if (! atomic_bit_test_set (&mem, 3)
+ || mem != 8)
+ {
+ puts ("atomic_bit_test_set test 2 failed");
+ ret = 1;
+ }
+
+#ifdef TEST_ATOMIC64
+ mem = 16;
+ if (atomic_bit_test_set (&mem, 35)
+ || mem != 0x800000010LL)
+ {
+ puts ("atomic_bit_test_set test 3 failed");
+ ret = 1;
+ }
+
+ mem = 0x100000000LL;
+ if (! atomic_bit_test_set (&mem, 32)
+ || mem != 0x100000000LL)
+ {
+ puts ("atomic_bit_test_set test 4 failed");
+ ret = 1;
+ }
+#endif
+
+#ifdef catomic_compare_and_exchange_val_acq
+ mem = 24;
+ if (catomic_compare_and_exchange_val_acq (&mem, 35, 24) != 24
+ || mem != 35)
+ {
+ puts ("catomic_compare_and_exchange_val_acq test 1 failed");
+ ret = 1;
+ }
+
+ mem = 12;
+ if (catomic_compare_and_exchange_val_acq (&mem, 10, 15) != 12
+ || mem != 12)
+ {
+ puts ("catomic_compare_and_exchange_val_acq test 2 failed");
+ ret = 1;
+ }
+
+ mem = -15;
+ if (catomic_compare_and_exchange_val_acq (&mem, -56, -15) != -15
+ || mem != -56)
+ {
+ puts ("catomic_compare_and_exchange_val_acq test 3 failed");
+ ret = 1;
+ }
+
+ mem = -1;
+ if (catomic_compare_and_exchange_val_acq (&mem, 17, 0) != -1
+ || mem != -1)
+ {
+ puts ("catomic_compare_and_exchange_val_acq test 4 failed");
+ ret = 1;
+ }
+#endif
+
+ mem = 24;
+ if (catomic_compare_and_exchange_bool_acq (&mem, 35, 24)
+ || mem != 35)
+ {
+ puts ("catomic_compare_and_exchange_bool_acq test 1 failed");
+ ret = 1;
+ }
+
+ mem = 12;
+ if (! catomic_compare_and_exchange_bool_acq (&mem, 10, 15)
+ || mem != 12)
+ {
+ puts ("catomic_compare_and_exchange_bool_acq test 2 failed");
+ ret = 1;
+ }
+
+ mem = -15;
+ if (catomic_compare_and_exchange_bool_acq (&mem, -56, -15)
+ || mem != -56)
+ {
+ puts ("catomic_compare_and_exchange_bool_acq test 3 failed");
+ ret = 1;
+ }
+
+ mem = -1;
+ if (! catomic_compare_and_exchange_bool_acq (&mem, 17, 0)
+ || mem != -1)
+ {
+ puts ("catomic_compare_and_exchange_bool_acq test 4 failed");
+ ret = 1;
+ }
+
+ mem = 2;
+ if (catomic_exchange_and_add (&mem, 11) != 2
+ || mem != 13)
+ {
+ puts ("catomic_exchange_and_add test failed");
+ ret = 1;
+ }
+
+ mem = -21;
+ catomic_add (&mem, 22);
+ if (mem != 1)
+ {
+ puts ("catomic_add test failed");
+ ret = 1;
+ }
+
+ mem = -1;
+ catomic_increment (&mem);
+ if (mem != 0)
+ {
+ puts ("catomic_increment test failed");
+ ret = 1;
+ }
+
+ mem = 2;
+ if (catomic_increment_val (&mem) != 3)
+ {
+ puts ("catomic_increment_val test failed");
+ ret = 1;
+ }
+
+ mem = 17;
+ catomic_decrement (&mem);
+ if (mem != 16)
+ {
+ puts ("catomic_decrement test failed");
+ ret = 1;
+ }
+
+ if (catomic_decrement_val (&mem) != 15)
+ {
+ puts ("catomic_decrement_val test failed");
+ ret = 1;
+ }
+
+ /* Tests for C11-like atomics. */
+ mem = 11;
+ if (atomic_load_relaxed (&mem) != 11 || atomic_load_acquire (&mem) != 11)
+ {
+ puts ("atomic_load_{relaxed,acquire} test failed");
+ ret = 1;
+ }
+
+ atomic_store_relaxed (&mem, 12);
+ if (mem != 12)
+ {
+ puts ("atomic_store_relaxed test failed");
+ ret = 1;
+ }
+ atomic_store_release (&mem, 13);
+ if (mem != 13)
+ {
+ puts ("atomic_store_release test failed");
+ ret = 1;
+ }
+
+ mem = 14;
+ expected = 14;
+ if (!atomic_compare_exchange_weak_relaxed (&mem, &expected, 25)
+ || mem != 25 || expected != 14)
+ {
+ puts ("atomic_compare_exchange_weak_relaxed test 1 failed");
+ ret = 1;
+ }
+ if (atomic_compare_exchange_weak_relaxed (&mem, &expected, 14)
+ || mem != 25 || expected != 25)
+ {
+ puts ("atomic_compare_exchange_weak_relaxed test 2 failed");
+ ret = 1;
+ }
+ mem = 14;
+ expected = 14;
+ if (!atomic_compare_exchange_weak_acquire (&mem, &expected, 25)
+ || mem != 25 || expected != 14)
+ {
+ puts ("atomic_compare_exchange_weak_acquire test 1 failed");
+ ret = 1;
+ }
+ if (atomic_compare_exchange_weak_acquire (&mem, &expected, 14)
+ || mem != 25 || expected != 25)
+ {
+ puts ("atomic_compare_exchange_weak_acquire test 2 failed");
+ ret = 1;
+ }
+ mem = 14;
+ expected = 14;
+ if (!atomic_compare_exchange_weak_release (&mem, &expected, 25)
+ || mem != 25 || expected != 14)
+ {
+ puts ("atomic_compare_exchange_weak_release test 1 failed");
+ ret = 1;
+ }
+ if (atomic_compare_exchange_weak_release (&mem, &expected, 14)
+ || mem != 25 || expected != 25)
+ {
+ puts ("atomic_compare_exchange_weak_release test 2 failed");
+ ret = 1;
+ }
+
+ mem = 23;
+ if (atomic_exchange_acquire (&mem, 42) != 23 || mem != 42)
+ {
+ puts ("atomic_exchange_acquire test failed");
+ ret = 1;
+ }
+ mem = 23;
+ if (atomic_exchange_release (&mem, 42) != 23 || mem != 42)
+ {
+ puts ("atomic_exchange_release test failed");
+ ret = 1;
+ }
+
+ mem = 23;
+ if (atomic_fetch_add_relaxed (&mem, 1) != 23 || mem != 24)
+ {
+ puts ("atomic_fetch_add_relaxed test failed");
+ ret = 1;
+ }
+ mem = 23;
+ if (atomic_fetch_add_acquire (&mem, 1) != 23 || mem != 24)
+ {
+ puts ("atomic_fetch_add_acquire test failed");
+ ret = 1;
+ }
+ mem = 23;
+ if (atomic_fetch_add_release (&mem, 1) != 23 || mem != 24)
+ {
+ puts ("atomic_fetch_add_release test failed");
+ ret = 1;
+ }
+ mem = 23;
+ if (atomic_fetch_add_acq_rel (&mem, 1) != 23 || mem != 24)
+ {
+ puts ("atomic_fetch_add_acq_rel test failed");
+ ret = 1;
+ }
+
+ mem = 3;
+ if (atomic_fetch_and_acquire (&mem, 2) != 3 || mem != 2)
+ {
+ puts ("atomic_fetch_and_acquire test failed");
+ ret = 1;
+ }
+
+ mem = 4;
+ if (atomic_fetch_or_relaxed (&mem, 2) != 4 || mem != 6)
+ {
+ puts ("atomic_fetch_or_relaxed test failed");
+ ret = 1;
+ }
+ mem = 4;
+ if (atomic_fetch_or_acquire (&mem, 2) != 4 || mem != 6)
+ {
+ puts ("atomic_fetch_or_acquire test failed");
+ ret = 1;
+ }
+
+ /* This is a single-threaded test, so we can't test the effects of the
+ fences. */
+ atomic_thread_fence_acquire ();
+ atomic_thread_fence_release ();
+ atomic_thread_fence_seq_cst ();
+
+ return ret;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/test/stdlib/Makefile.in b/test/stdlib/Makefile.in
index 38c3e19..91dfde4 100644
--- a/test/stdlib/Makefile.in
+++ b/test/stdlib/Makefile.in
@@ -10,6 +10,9 @@ TESTS_DISABLED :=
ifeq ($(UCLIBC_HAS_PTY),)
TESTS_DISABLED += ptytest
endif
+ifeq ($(UCLIBC_HAS_ARC4RANDOM),)
+TESTS_DISABLED += testarc4random
+endif
CFLAGS_test-canon = -fPIC
CFLAGS_test-canon2 = -fPIC
diff --git a/test/stdlib/testarc4random.c b/test/stdlib/testarc4random.c
index 4d773aa..14ff1cc 100644
--- a/test/stdlib/testarc4random.c
+++ b/test/stdlib/testarc4random.c
@@ -3,10 +3,8 @@
int main(void)
{
-#ifdef __UCLIBC_HAS_ARC4RANDOM__
int random_number;
random_number = arc4random() % 65536;
printf("%d\n", random_number);
-#endif
return 0;
}
hooks/post-receive
--
uClibc-ng - small C library for embedded systems
1
0

uClibc-ng - small C library for embedded systems branch upstream updated. 24946289317ea23bb0d1814cca0a499a905f7d6f
by wbx@helium.waldemar-brodkorb.de 28 Mar '15
by wbx@helium.waldemar-brodkorb.de 28 Mar '15
28 Mar '15
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".
The branch, upstream has been updated
via 24946289317ea23bb0d1814cca0a499a905f7d6f (commit)
via d3c60fc490d714d7610a91555cec67952409b189 (commit)
via 70bafe7e4d52f6dafbb5888009c9b601cdbc3743 (commit)
via 8fde02feb2f8a36934308012d89fa6614967b2dc (commit)
via cc8d7d062e2db0a1ed3973e6af38cd1938ba74d7 (commit)
via 560f416794403be952e850756d7e8b23e8fa92ac (commit)
via cf80a7fc2db30364ac98be40483e599c2c243e87 (commit)
via 8836d184d4da65e8959210bc7b768e628b0273fb (commit)
via fc673e14203e1c9aea353d99ff89a17d46b2ad93 (commit)
via 2c8a7766681b704e710f51c0817534e3f9a952d1 (commit)
via 9e552e6a2d836698834d2bf887dbf1806172729f (commit)
via 6f363f69221a6b40ef0f88631cd8d675465eb63d (commit)
via 6ff9c31abc14f207265ab214370982ecb3bfe428 (commit)
via 2b33716c08cc506e57115e34b5fe11d8d5477398 (commit)
from 40effcf4c1e9a2fb9169d9189bdc9b1c888f9345 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 24946289317ea23bb0d1814cca0a499a905f7d6f
Author: Alexey Brodkin <abrodkin(a)synopsys.com>
Date: Thu Mar 26 14:25:37 2015 +0530
ARC: don't hard-code ELF_NGREG
Signed-off-by: Alexey Brodkin <abrodkin(a)synopsys.com>
Signed-off-by: Vineet Gupta <vgupta(a)synopsys.com>
[updated changelog]
Signed-off-by: Vineet Gupta <vgupta(a)synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit d3c60fc490d714d7610a91555cec67952409b189
Author: Vineet Gupta <vgupta(a)synopsys.com>
Date: Thu Mar 26 18:07:04 2015 +0530
ARC/signal: shield sa_restorer from compiler toggle side-effects
when building uClibc with -O0 (DODEBUG build) the default sigrestorer
had some extra glue code generated for stack manipulation which was
messing up resume from signal path.
So annotate the function with -Os so that gcc would only generate the
bare min 2 instruction TRAP sequence
Reported-and-Debugged-by: Alexey Brodkin <abrodkin(a)synopsys.com>
Signed-off-by: Vineet Gupta <vgupta(a)synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 70bafe7e4d52f6dafbb5888009c9b601cdbc3743
Author: Vineet Gupta <vgupta(a)synopsys.com>
Date: Thu Mar 26 14:25:35 2015 +0530
ARC: switch to NPTL
Signed-off-by: Vineet Gupta <vgupta(a)synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 8fde02feb2f8a36934308012d89fa6614967b2dc
Author: Andrew Burgess <andrew.burgess(a)embecosm.com>
Date: Thu Mar 26 14:25:34 2015 +0530
Add support for R_ARC_NONE relocations.
The R_ARC_NONE relocation is generated when --gc-sections, used by the
compile time linker, removes some sections. This is completely normal,
and we can see that all other targets (based on random sampling) have
support for R_*_NONE relocations (named for each target).
Handling R_ARC_NONE involves doing nothing with it, which is nice and
easy.
Signed-off-by: Andrew Burgess <andrew.burgess(a)embecosm.com>
Signed-off-by: Vineet Gupta <vgupta(a)synopsys.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit cc8d7d062e2db0a1ed3973e6af38cd1938ba74d7
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Thu Mar 26 23:12:38 2015 +0100
include: update atomic.h from glibc
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 560f416794403be952e850756d7e8b23e8fa92ac
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Thu Mar 26 22:51:16 2015 +0100
test: Add SIMULATOR_uclibc and SIMULATOR_glibc
where SIMULATOR_glibc is an optional simulator to run host binaries and
SIMULATOR_uclibc is an optional simulator to run target (uClibc)
binaries.
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit cf80a7fc2db30364ac98be40483e599c2c243e87
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Thu Mar 26 00:50:17 2015 +0100
utmp: always have at least utmpx
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 8836d184d4da65e8959210bc7b768e628b0273fb
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Thu Mar 26 00:03:09 2015 +0100
NPTL: SH: silence warning
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit fc673e14203e1c9aea353d99ff89a17d46b2ad93
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Thu Mar 26 00:03:05 2015 +0100
SH: add 't' to syscall clobber list
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 2c8a7766681b704e710f51c0817534e3f9a952d1
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Thu Mar 26 00:02:58 2015 +0100
ldso: mark _dl_exit as noreturn
Otherwise gcc might not understand that oom() ended control-flow and
might emit an (untaken) reference to abort() in _dl_update_slotinfo()
on e.g. SH4 which breaks linking ld-uClibc.so.
Arguably -ffreestanding should prevent GCC from emitting this
'.global abort' but alas, it does not, which is another bug..
Also mark the function cold to further lower the incoming frequency and
branch probability.
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 9e552e6a2d836698834d2bf887dbf1806172729f
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Wed Mar 25 23:59:52 2015 +0100
test: tweaks
Fix arc4random exclusion for real.
Silence warning about missing prototype for external helper-function in
tst-scandir
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 6f363f69221a6b40ef0f88631cd8d675465eb63d
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Wed Mar 25 23:59:49 2015 +0100
include: Expand malloc-family comments
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 6ff9c31abc14f207265ab214370982ecb3bfe428
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Wed Mar 25 23:59:45 2015 +0100
utmp: favour POSIX utmpx over SVID utmp
Note: _PATH_UTMPX == _PATH_UTMP and the utmp struct is identical to the
utmpx struct so this only changes the external API entrypoints and NOT
the underlying data source.
This saves about 500b (~1300b from previously ~1950) while at it.
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 2b33716c08cc506e57115e34b5fe11d8d5477398
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Wed Mar 25 23:59:37 2015 +0100
utmp: Remove unneeded alias
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
-----------------------------------------------------------------------
Summary of changes:
extra/Configs/Config.in | 24 +-
extra/Configs/defconfigs/arc/arcv2_defconfig | 2 +-
extra/Configs/defconfigs/arc/defconfig | 2 +-
include/atomic.h | 235 +++++++-
include/internal/utmp.h | 92 ++++
include/pty.h | 1 +
include/stdlib.h | 6 +-
include/utmp.h | 10 +-
ldso/include/dl-syscall.h | 10 +-
ldso/ldso/arc/elfinterp.c | 4 +
libc/misc/utmp/Makefile.in | 4 +-
libc/misc/utmp/utent.c | 122 +++--
libc/misc/utmp/utxent.c | 108 ----
libc/misc/utmp/wtent.c | 50 --
libc/sysdeps/linux/arc/sigaction.c | 3 +-
libc/sysdeps/linux/arc/sys/procfs.h | 7 +-
libc/sysdeps/linux/sh/bits/atomic.h | 12 +-
libc/sysdeps/linux/sh/bits/syscalls.h | 2 +-
.../nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h | 2 +-
libutil/forkpty.c | 3 -
libutil/login.c | 6 +-
libutil/login_tty.c | 1 -
libutil/logout.c | 6 +-
libutil/logwtmp.c | 21 +-
libutil/openpty.c | 1 -
test/.gitignore | 2 +
test/README | 3 +
test/Test.mak | 5 +-
test/misc/Makefile.in | 4 +
test/misc/tst-scandir.c | 2 +-
test/silly/Makefile.in | 3 +
test/silly/hello.c | 2 +-
.../silly/tst-atomic-long.c | 16 +-
test/silly/tst-atomic.c | 573 ++++++++++++++++++++
test/stdlib/Makefile.in | 3 +-
35 files changed, 1052 insertions(+), 295 deletions(-)
create mode 100644 include/internal/utmp.h
delete mode 100644 libc/misc/utmp/utxent.c
delete mode 100644 libc/misc/utmp/wtent.c
copy libc/sysdeps/linux/sparc/jmpbuf-offsets.h => test/silly/tst-atomic-long.c (75%)
create mode 100644 test/silly/tst-atomic.c
diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in
index 7546e96..1fd6860 100644
--- a/extra/Configs/Config.in
+++ b/extra/Configs/Config.in
@@ -701,23 +701,23 @@ config COMPAT_ATEXIT
else you will be missing atexit() until you rebuild all apps.
config UCLIBC_HAS_UTMPX
- bool "utmpx based support for tracking login/logouts to/from the system"
- depends on UCLIBC_HAS_UTMP # TODO, remove this, it's backward
- help
- Answer y to enable support for accessing user accounting database.
- It can be used to track all login/logout to the system.
+ bool "utmpx based support for tracking login/logouts to/from the system"
+ help
+ Answer y to enable support for accessing user accounting database.
+ It can be used to track all login/logout to the system.
config UCLIBC_HAS_UTMP
- bool "utmp support (XPG2, SVr4 compat)"
- help
- Answer y to enable legacy SVID support for accessing
- user accounting database:
+ bool "utmp support (XPG2 compat, SVr4 compat)"
+ depends on UCLIBC_HAS_UTMPX
+ help
+ Answer y to enable legacy SVID support for accessing
+ user accounting database:
getutent(), getutid(), getutline(), pututline(),
setutent(), endutent(), utmpname() in utmp.h
- It can be used to track all login/logout to the system.
+ It can be used to track all login/logout to the system.
- If unsure, just answer N and use utmpx.h and corresponding
- POSIX functions.
+ If unsure, answer N and use corresponding POSIX functions
+ from utmpx.h
config UCLIBC_SUSV2_LEGACY
bool "Enable SuSv2 LEGACY functions"
diff --git a/extra/Configs/defconfigs/arc/arcv2_defconfig b/extra/Configs/defconfigs/arc/arcv2_defconfig
index d3a7dc7..7c4694e 100644
--- a/extra/Configs/defconfigs/arc/arcv2_defconfig
+++ b/extra/Configs/defconfigs/arc/arcv2_defconfig
@@ -7,7 +7,7 @@ KERNEL_HEADERS="%KERNEL_HEADERS%"
# LDSO_CACHE_SUPPORT is not set
LDSO_RUNPATH=y
# LDSO_SAFE_RUNPATH is not set
-LINUXTHREADS_OLD=y
+UCLIBC_HAS_THREADS_NATIVE=y
PTHREADS_DEBUG_SUPPORT=y
UCLIBC_HAS_OBSTACK=y
UCLIBC_SUSV2_LEGACY=y
diff --git a/extra/Configs/defconfigs/arc/defconfig b/extra/Configs/defconfigs/arc/defconfig
index 490bc22..eebb115 100644
--- a/extra/Configs/defconfigs/arc/defconfig
+++ b/extra/Configs/defconfigs/arc/defconfig
@@ -6,7 +6,7 @@ KERNEL_HEADERS="%KERNEL_HEADERS%"
# LDSO_CACHE_SUPPORT is not set
LDSO_RUNPATH=y
# LDSO_SAFE_RUNPATH is not set
-LINUXTHREADS_OLD=y
+UCLIBC_HAS_THREADS_NATIVE=y
PTHREADS_DEBUG_SUPPORT=y
UCLIBC_HAS_OBSTACK=y
UCLIBC_SUSV2_LEGACY=y
diff --git a/include/atomic.h b/include/atomic.h
index 307704c..3680d87 100644
--- a/include/atomic.h
+++ b/include/atomic.h
@@ -1,5 +1,5 @@
/* Internal macros for atomic operations for GNU C Library.
- Copyright (C) 2002-2006, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper(a)redhat.com>, 2002.
@@ -32,7 +32,7 @@
the multi-thread case. The interfaces have the prefix
"catomic_".
- - support functions like barriers. They also have the preifx
+ - support functions like barriers. They also have the prefix
"atomic_".
Architectures must provide a few lowlevel macros (the compare
@@ -198,8 +198,12 @@
/* Add VALUE to *MEM and return the old value of *MEM. */
-#ifndef atomic_exchange_and_add
-# define atomic_exchange_and_add(mem, value) \
+#ifndef atomic_exchange_and_add_acq
+# ifdef atomic_exchange_and_add
+# define atomic_exchange_and_add_acq(mem, value) \
+ atomic_exchange_and_add (mem, value)
+# else
+# define atomic_exchange_and_add_acq(mem, value) \
({ __typeof (*(mem)) __atg6_oldval; \
__typeof (mem) __atg6_memp = (mem); \
__typeof (*(mem)) __atg6_value = (value); \
@@ -213,8 +217,18 @@
__atg6_oldval), 0)); \
\
__atg6_oldval; })
+# endif
#endif
+#ifndef atomic_exchange_and_add_rel
+# define atomic_exchange_and_add_rel(mem, value) \
+ atomic_exchange_and_add_acq(mem, value)
+#endif
+
+#ifndef atomic_exchange_and_add
+# define atomic_exchange_and_add(mem, value) \
+ atomic_exchange_and_add_acq(mem, value)
+#endif
#ifndef catomic_exchange_and_add
# define catomic_exchange_and_add(mem, value) \
@@ -528,6 +542,219 @@
({ __typeof (x) __x; __asm__ ("" : "=r" (__x) : "0" (x)); __x; })
#endif
+/* This is equal to 1 iff the architecture supports 64b atomic operations. */
+#define __HAVE_64B_ATOMICS 0 /* TODO: not yet used - Add these to arch bits! */
+#ifndef __HAVE_64B_ATOMICS
+#error Unable to determine if 64-bit atomics are present.
+#endif
+
+/* The following functions are a subset of the atomic operations provided by
+ C11. Usually, a function named atomic_OP_MO(args) is equivalent to C11's
+ atomic_OP_explicit(args, memory_order_MO); exceptions noted below. */
+
+/* Each arch can request to use compiler built-ins for C11 atomics. If it
+ does, all atomics will be based on these. */
+#if 0 /* not yet used USE_ATOMIC_COMPILER_BUILTINS */
+
+/* We require 32b atomic operations; some archs also support 64b atomic
+ operations. */
+void __atomic_link_error (void);
+# if __HAVE_64B_ATOMICS == 1
+# define __atomic_check_size(mem) \
+ if ((sizeof (*mem) != 4) && (sizeof (*mem) != 8)) \
+ __atomic_link_error ();
+# else
+# define __atomic_check_size(mem) \
+ if (sizeof (*mem) != 4) \
+ __atomic_link_error ();
+# endif
+
+# define atomic_thread_fence_acquire() \
+ __atomic_thread_fence (__ATOMIC_ACQUIRE)
+# define atomic_thread_fence_release() \
+ __atomic_thread_fence (__ATOMIC_RELEASE)
+# define atomic_thread_fence_seq_cst() \
+ __atomic_thread_fence (__ATOMIC_SEQ_CST)
+
+# define atomic_load_relaxed(mem) \
+ ({ __atomic_check_size((mem)); __atomic_load_n ((mem), __ATOMIC_RELAXED); })
+# define atomic_load_acquire(mem) \
+ ({ __atomic_check_size((mem)); __atomic_load_n ((mem), __ATOMIC_ACQUIRE); })
+
+# define atomic_store_relaxed(mem, val) \
+ do { \
+ __atomic_check_size((mem)); \
+ __atomic_store_n ((mem), (val), __ATOMIC_RELAXED); \
+ } while (0)
+# define atomic_store_release(mem, val) \
+ do { \
+ __atomic_check_size((mem)); \
+ __atomic_store_n ((mem), (val), __ATOMIC_RELEASE); \
+ } while (0)
+
+/* On failure, this CAS has memory_order_relaxed semantics. */
+# define atomic_compare_exchange_weak_relaxed(mem, expected, desired) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_compare_exchange_n ((mem), (expected), (desired), 1, \
+ __ATOMIC_RELAXED, __ATOMIC_RELAXED); })
+# define atomic_compare_exchange_weak_acquire(mem, expected, desired) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_compare_exchange_n ((mem), (expected), (desired), 1, \
+ __ATOMIC_ACQUIRE, __ATOMIC_RELAXED); })
+# define atomic_compare_exchange_weak_release(mem, expected, desired) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_compare_exchange_n ((mem), (expected), (desired), 1, \
+ __ATOMIC_RELEASE, __ATOMIC_RELAXED); })
+
+# define atomic_exchange_acquire(mem, desired) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_exchange_n ((mem), (desired), __ATOMIC_ACQUIRE); })
+# define atomic_exchange_release(mem, desired) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_exchange_n ((mem), (desired), __ATOMIC_RELEASE); })
+
+# define atomic_fetch_add_relaxed(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_add ((mem), (operand), __ATOMIC_RELAXED); })
+# define atomic_fetch_add_acquire(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_add ((mem), (operand), __ATOMIC_ACQUIRE); })
+# define atomic_fetch_add_release(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_add ((mem), (operand), __ATOMIC_RELEASE); })
+# define atomic_fetch_add_acq_rel(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_add ((mem), (operand), __ATOMIC_ACQ_REL); })
+
+# define atomic_fetch_and_acquire(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_and ((mem), (operand), __ATOMIC_ACQUIRE); })
+
+# define atomic_fetch_or_relaxed(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_or ((mem), (operand), __ATOMIC_RELAXED); })
+# define atomic_fetch_or_acquire(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_or ((mem), (operand), __ATOMIC_ACQUIRE); })
+
+#else /* !USE_ATOMIC_COMPILER_BUILTINS */
+
+/* By default, we assume that read, write, and full barriers are equivalent
+ to acquire, release, and seq_cst barriers. Archs for which this does not
+ hold have to provide custom definitions of the fences. */
+# ifndef atomic_thread_fence_acquire
+# define atomic_thread_fence_acquire() atomic_read_barrier ()
+# endif
+# ifndef atomic_thread_fence_release
+# define atomic_thread_fence_release() atomic_write_barrier ()
+# endif
+# ifndef atomic_thread_fence_seq_cst
+# define atomic_thread_fence_seq_cst() atomic_full_barrier ()
+# endif
+
+# ifndef atomic_load_relaxed
+# define atomic_load_relaxed(mem) \
+ ({ __typeof (*(mem)) __atg100_val; \
+ __asm__ ("" : "=r" (__atg100_val) : "0" (*(mem))); \
+ __atg100_val; })
+# endif
+# ifndef atomic_load_acquire
+# define atomic_load_acquire(mem) \
+ ({ __typeof (*(mem)) __atg101_val = atomic_load_relaxed (mem); \
+ atomic_thread_fence_acquire (); \
+ __atg101_val; })
+# endif
+
+# ifndef atomic_store_relaxed
+/* XXX Use inline asm here? */
+# define atomic_store_relaxed(mem, val) do { *(mem) = (val); } while (0)
+# endif
+# ifndef atomic_store_release
+# define atomic_store_release(mem, val) \
+ do { \
+ atomic_thread_fence_release (); \
+ atomic_store_relaxed ((mem), (val)); \
+ } while (0)
+# endif
+
+/* On failure, this CAS has memory_order_relaxed semantics. */
+/* XXX This potentially has one branch more than necessary, but archs
+ currently do not define a CAS that returns both the previous value and
+ the success flag. */
+# ifndef atomic_compare_exchange_weak_acquire
+# define atomic_compare_exchange_weak_acquire(mem, expected, desired) \
+ ({ __typeof (*(expected)) __atg102_expected = *(expected); \
+ *(expected) = \
+ atomic_compare_and_exchange_val_acq ((mem), (desired), *(expected)); \
+ *(expected) == __atg102_expected; })
+# endif
+# ifndef atomic_compare_exchange_weak_relaxed
+/* XXX Fall back to CAS with acquire MO because archs do not define a weaker
+ CAS. */
+# define atomic_compare_exchange_weak_relaxed(mem, expected, desired) \
+ atomic_compare_exchange_weak_acquire ((mem), (expected), (desired))
+# endif
+# ifndef atomic_compare_exchange_weak_release
+# define atomic_compare_exchange_weak_release(mem, expected, desired) \
+ ({ __typeof (*(expected)) __atg103_expected = *(expected); \
+ *(expected) = \
+ atomic_compare_and_exchange_val_rel ((mem), (desired), *(expected)); \
+ *(expected) == __atg103_expected; })
+# endif
+
+# ifndef atomic_exchange_acquire
+# define atomic_exchange_acquire(mem, val) \
+ atomic_exchange_acq ((mem), (val))
+# endif
+# ifndef atomic_exchange_release
+# define atomic_exchange_release(mem, val) \
+ atomic_exchange_rel ((mem), (val))
+# endif
+
+# ifndef atomic_fetch_add_acquire
+# define atomic_fetch_add_acquire(mem, operand) \
+ atomic_exchange_and_add_acq ((mem), (operand))
+# endif
+# ifndef atomic_fetch_add_relaxed
+/* XXX Fall back to acquire MO because the MO semantics of
+ atomic_exchange_and_add are not documented; the generic version falls back
+ to atomic_exchange_and_add_acq if atomic_exchange_and_add is not defined,
+ and vice versa. */
+# define atomic_fetch_add_relaxed(mem, operand) \
+ atomic_fetch_add_acquire ((mem), (operand))
+# endif
+# ifndef atomic_fetch_add_release
+# define atomic_fetch_add_release(mem, operand) \
+ atomic_exchange_and_add_rel ((mem), (operand))
+# endif
+# ifndef atomic_fetch_add_acq_rel
+# define atomic_fetch_add_acq_rel(mem, operand) \
+ ({ atomic_thread_fence_release (); \
+ atomic_exchange_and_add_acq ((mem), (operand)); })
+# endif
+
+/* XXX The default for atomic_and_val has acquire semantics, but this is not
+ documented. */
+# ifndef atomic_fetch_and_acquire
+# define atomic_fetch_and_acquire(mem, operand) \
+ atomic_and_val ((mem), (operand))
+# endif
+
+/* XXX The default for atomic_or_val has acquire semantics, but this is not
+ documented. */
+# ifndef atomic_fetch_or_acquire
+# define atomic_fetch_or_acquire(mem, operand) \
+ atomic_or_val ((mem), (operand))
+# endif
+/* XXX Fall back to acquire MO because archs do not define a weaker
+ atomic_or_val. */
+# ifndef atomic_fetch_or_relaxed
+# define atomic_fetch_or_relaxed(mem, operand) \
+ atomic_fetch_or_acquire ((mem), (operand))
+# endif
+
+#endif /* !USE_ATOMIC_COMPILER_BUILTINS */
+
#ifndef atomic_delay
# define atomic_delay() do { /* nothing */ } while (0)
diff --git a/include/internal/utmp.h b/include/internal/utmp.h
new file mode 100644
index 0000000..49f96b4
--- /dev/null
+++ b/include/internal/utmp.h
@@ -0,0 +1,92 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * internal helper for utmp and utmpx handling
+ *
+ * Copyright (C) 2015 by Bernhard Reutner-Fischer
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ */
+#ifndef __INTERNAL_UTMP_H
+#define __INTERNAL_UTMP_H
+
+#include <utmpx.h>
+#include <utmp.h>
+
+/* Note: _PATH_UTMPX == _PATH_UTMP */
+
+#if (defined __UCLIBC_HAS_UTMPX__ && defined __UCLIBC_HAS_UTMP__) \
+ || !defined __UCLIBC_HAS_UTMP__
+/* implement the X and alias the non-X */
+# define __set_unlocked __setutxent_unlocked
+# define set setutxent
+# define __get_unlocked __getutxent_unlocked
+# define get getutxent
+# define end endutxent
+# define __getid_unlocked __getutxid_unlocked
+# define getid getutxid
+# define getline getutxline
+# define putline pututxline
+# define name utmpxname
+# define updw updwtmpx
+# define UT utmpx
+# ifndef __DEFAULT_PATH_UTMP
+# define __DEFAULT_PATH_UTMP _PATH_UTMPX
+# endif
+# if defined __UCLIBC_HAS_UTMP__
+# define other(n,a) strong_alias_untyped(n,a)
+# else
+# define other(n,a) /* nothing */
+# endif
+#elif defined __UCLIBC_HAS_UTMP__
+# define __set_unlocked __setutent_unlocked
+# define set setutent
+# define __get_unlocked __getutent_unlocked
+# define get getutent
+# define end endutent
+# define __getid_unlocked __getutid_unlocked
+# define getid getutid
+# define getline getutline
+# define putline pututline
+# define name utmpname
+# define updw updwtmp
+# define UT utmp
+# ifndef __DEFAULT_PATH_UTMP
+# define __DEFAULT_PATH_UTMP _PATH_UTMP
+# endif
+# define other(n,a) /* nothing */
+#else
+#error You are supposed to either have UTMP or UTMPX or both here
+#endif
+
+/* not used in libc_hidden_proto(setutxent) */
+/* not used in libc_hidden_proto(endutxent) */
+/* not used in libc_hidden_proto(getutxent) */
+/* not used in libc_hidden_proto(getutxid) */
+/* not used in libc_hidden_proto(getutxline) */
+/* not used in libc_hidden_proto(pututxline) */
+/* not used in libc_hidden_proto(utmpxname) */
+/* not used in libc_hidden_proto(updwtmpx) */
+
+/* not used in libc_hidden_proto(setutent) */
+/* not used in libc_hidden_proto(endutent) */
+/* not used in libc_hidden_proto(getutent) */
+/* not used in libc_hidden_proto(getutid) */
+/* not used in libc_hidden_proto(getutline) */
+/* not used in libc_hidden_proto(pututline) */
+/* not used in libc_hidden_proto(utmpname) */
+/* not used in libc_hidden_proto(updwtmp) */
+
+#ifdef IS_IN_libutil
+# if (defined __UCLIBC_HAS_UTMPX__ && defined __UCLIBC_HAS_UTMP__) \
+ || !defined __UCLIBC_HAS_UTMP__
+ /* monkey-patch to use the POSIX interface */
+# define setutent setutxent
+# define getutline getutxline
+# define pututline pututxline
+# define endutent endutxent
+# define updwtmp updwtmpx
+# endif
+#endif /* IS_IN_libutil */
+
+#endif /* __INTERNAL_UTMP_H */
+
diff --git a/include/pty.h b/include/pty.h
index 26c3011..f23a260 100644
--- a/include/pty.h
+++ b/include/pty.h
@@ -32,6 +32,7 @@ __BEGIN_DECLS
ends in AMASTER and ASLAVE. */
extern int openpty (int *__amaster, int *__aslave, char *__name,
struct termios *__termp, struct winsize *__winp) __THROW;
+libutil_hidden_proto(openpty)
/* Create child process and establish the slave pseudo terminal as the
child's controlling terminal. */
diff --git a/include/stdlib.h b/include/stdlib.h
index 2065dfa..809256d 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -486,11 +486,11 @@ extern int lcong48_r (unsigned short int __param[7],
__BEGIN_NAMESPACE_STD
/* Allocate SIZE bytes of memory. */
extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur;
-/* We want the malloc symbols overridable at runtime
- * libc_hidden_proto(malloc) */
+/* We want the malloc symbol overridable at runtime, do not hide it! */
/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */
extern void *calloc (size_t __nmemb, size_t __size)
__THROW __attribute_malloc__ __wur;
+/* We want the calloc symbol overridable at runtime, do not hide it! */
__END_NAMESPACE_STD
#endif
@@ -503,8 +503,10 @@ __BEGIN_NAMESPACE_STD
between objects pointed by the old and new pointers. */
extern void *realloc (void *__ptr, size_t __size)
__THROW __wur;
+/* We want the realloc symbol overridable at runtime, do not hide it! */
/* Free a block allocated by `malloc', `realloc' or `calloc'. */
extern void free (void *__ptr) __THROW;
+/* We want the free symbol overridable at runtime, do not hide it! */
__END_NAMESPACE_STD
#if 0 /*def __USE_MISC*/
diff --git a/include/utmp.h b/include/utmp.h
index 754f767..8ecbb54 100644
--- a/include/utmp.h
+++ b/include/utmp.h
@@ -40,7 +40,7 @@ __BEGIN_DECLS
/* Make FD be the controlling terminal, stdin, stdout, and stderr;
then close FD. Returns 0 on success, nonzero on error. */
extern int login_tty (int __fd) __THROW;
-
+libutil_hidden_proto(login_tty)
/* Write the given entry into utmp and wtmp. */
extern void login (const struct utmp *__entry) __THROW;
@@ -56,37 +56,29 @@ extern void logwtmp (const char *__ut_line, const char *__ut_name,
/* Append entry UTMP to the wtmp-like file WTMP_FILE. */
extern void updwtmp (const char *__wtmp_file, const struct utmp *__utmp)
__THROW;
-libc_hidden_proto(updwtmp)
/* Change name of the utmp file to be examined. */
extern int utmpname (const char *__file) __THROW;
-libc_hidden_proto(utmpname)
/* Read next entry from a utmp-like file. */
extern struct utmp *getutent (void) __THROW;
-libc_hidden_proto(getutent)
/* Reset the input stream to the beginning of the file. */
extern void setutent (void) __THROW;
-libc_hidden_proto(setutent)
/* Close the current open file. */
extern void endutent (void) __THROW;
-libc_hidden_proto(endutent)
/* Search forward from the current point in the utmp file until the
next entry with a ut_type matching ID->ut_type. */
extern struct utmp *getutid (const struct utmp *__id) __THROW;
-libc_hidden_proto(getutid)
/* Search forward from the current point in the utmp file until the
next entry with a ut_line matching LINE->ut_line. */
extern struct utmp *getutline (const struct utmp *__line) __THROW;
-libc_hidden_proto(getutline)
/* Write out entry pointed to by UTMP_PTR into the utmp file. */
extern struct utmp *pututline (const struct utmp *__utmp_ptr) __THROW;
-libc_hidden_proto(pututline)
#if 0 /* def __USE_MISC */
diff --git a/ldso/include/dl-syscall.h b/ldso/include/dl-syscall.h
index 675b93a..e556f7b 100644
--- a/ldso/include/dl-syscall.h
+++ b/ldso/include/dl-syscall.h
@@ -52,7 +52,15 @@ extern int _dl_errno;
dynamic linking at all, so we cannot return any error codes.
We just punt if there is an error. */
#define __NR__dl_exit __NR_exit
-static __always_inline _syscall1(void, _dl_exit, int, status)
+static __always_inline attribute_noreturn __cold void _dl_exit(int status)
+{
+ INLINE_SYSCALL(_dl_exit, 1, status);
+#if defined __GNUC__
+ __builtin_unreachable(); /* shut up warning: 'noreturn' function does return*/
+#else
+ while (1);
+#endif
+}
#define __NR__dl_close __NR_close
static __always_inline _syscall1(int, _dl_close, int, fd)
diff --git a/ldso/ldso/arc/elfinterp.c b/ldso/ldso/arc/elfinterp.c
index 7c31d3a..2f0cf7f 100644
--- a/ldso/ldso/arc/elfinterp.c
+++ b/ldso/ldso/arc/elfinterp.c
@@ -144,6 +144,8 @@ _dl_do_reloc(struct elf_resolve *tpnt, struct r_scope_elem *scope,
#endif
switch (reloc_type) {
+ case R_ARC_NONE:
+ break;
case R_ARC_32:
*reloc_addr += symbol_addr + rpnt->r_addend;
break;
@@ -202,6 +204,8 @@ _dl_do_lazy_reloc(struct elf_resolve *tpnt, struct r_scope_elem *scope,
#endif
switch (reloc_type) {
+ case R_ARC_NONE:
+ break;
case R_ARC_JMP_SLOT:
*reloc_addr += tpnt->loadaddr;
break;
diff --git a/libc/misc/utmp/Makefile.in b/libc/misc/utmp/Makefile.in
index 715341c..6c54ade 100644
--- a/libc/misc/utmp/Makefile.in
+++ b/libc/misc/utmp/Makefile.in
@@ -8,9 +8,7 @@
subdirs += libc/misc/utmp
CSRC-y :=
-CSRC-$(if $(findstring y,$(UCLIBC_HAS_UTMP)$(UCLIBC_HAS_UTMPX)),y) += wtent.c
-CSRC-$(UCLIBC_HAS_UTMP) += utent.c
-CSRC-$(UCLIBC_HAS_UTMPX) += utxent.c
+CSRC-$(if $(findstring y,$(UCLIBC_HAS_UTMP)$(UCLIBC_HAS_UTMPX)),y) += utent.c
MISC_UTMP_DIR := $(top_srcdir)libc/misc/utmp
MISC_UTMP_OUT := $(top_builddir)libc/misc/utmp
diff --git a/libc/misc/utmp/utent.c b/libc/misc/utmp/utent.c
index 4d71f5e..3671bb0 100644
--- a/libc/misc/utmp/utent.c
+++ b/libc/misc/utmp/utent.c
@@ -19,7 +19,7 @@
#include <paths.h>
#include <errno.h>
#include <string.h>
-#include <utmp.h>
+#include "internal/utmp.h"
#include <not-cancel.h>
#include <bits/uClibc_mutex.h>
@@ -27,17 +27,17 @@ __UCLIBC_MUTEX_STATIC(utmplock, PTHREAD_MUTEX_INITIALIZER);
/* Some global crap */
static int static_fd = -1;
-static struct utmp static_utmp;
-static const char default_file_name[] = _PATH_UTMP;
-static const char *static_ut_name = default_file_name;
+static struct UT static_utmp;
+static const char default_file[] = __DEFAULT_PATH_UTMP;
+static const char *current_file = default_file;
/* This function must be called with the LOCK held */
-static void __setutent_unlocked(void)
+static void __set_unlocked(void)
{
if (static_fd < 0) {
- static_fd = open_not_cancel_2(static_ut_name, O_RDWR | O_CLOEXEC);
+ static_fd = open_not_cancel_2(current_file, O_RDWR | O_CLOEXEC);
if (static_fd < 0) {
- static_fd = open_not_cancel_2(static_ut_name, O_RDONLY | O_CLOEXEC);
+ static_fd = open_not_cancel_2(current_file, O_RDONLY | O_CLOEXEC);
if (static_fd < 0) {
return; /* static_fd remains < 0 */
}
@@ -51,22 +51,23 @@ static void __setutent_unlocked(void)
lseek(static_fd, 0, SEEK_SET);
}
#if defined __UCLIBC_HAS_THREADS__
-void setutent(void)
+void set(void)
{
__UCLIBC_MUTEX_LOCK(utmplock);
- __setutent_unlocked();
+ __set_unlocked();
__UCLIBC_MUTEX_UNLOCK(utmplock);
}
#else
-strong_alias(__setutent_unlocked,setutent)
+strong_alias(__set_unlocked,set)
#endif
-libc_hidden_def(setutent)
+/* not used in libc_hidden_def(set) */
+other(setutxent,setutent)
/* This function must be called with the LOCK held */
-static struct utmp *__getutent_unlocked(void)
+static struct UT *__get_unlocked(void)
{
if (static_fd < 0) {
- __setutent_unlocked();
+ __set_unlocked();
if (static_fd < 0)
return NULL;
}
@@ -79,21 +80,22 @@ static struct utmp *__getutent_unlocked(void)
return NULL;
}
#if defined __UCLIBC_HAS_THREADS__
-struct utmp *getutent(void)
+struct UT *get(void)
{
- struct utmp *ret;
+ struct UT *ret;
__UCLIBC_MUTEX_LOCK(utmplock);
- ret = __getutent_unlocked();
+ ret = __get_unlocked();
__UCLIBC_MUTEX_UNLOCK(utmplock);
return ret;
}
#else
-strong_alias(__getutent_unlocked,getutent)
+strong_alias(__get_unlocked,get)
#endif
-libc_hidden_def(getutent)
+/* not used in libc_hidden_def(get) */
+other(getutxent,getutent)
-static void __endutent(void)
+void end(void)
{
__UCLIBC_MUTEX_LOCK(utmplock);
if (static_fd >= 0)
@@ -101,13 +103,13 @@ static void __endutent(void)
static_fd = -1;
__UCLIBC_MUTEX_UNLOCK(utmplock);
}
-strong_alias(__endutent,endutent)
-libc_hidden_def(endutent)
+/* not used in libc_hidden_def(end) */
+other(endutxent,endutent)
/* This function must be called with the LOCK held */
-static struct utmp *__getutid_unlocked(const struct utmp *utmp_entry)
+static struct UT *__getid_unlocked(const struct UT *utmp_entry)
{
- struct utmp *lutmp;
+ struct UT *lutmp;
unsigned type;
/* We use the fact that constants we are interested in are: */
@@ -115,7 +117,7 @@ static struct utmp *__getutid_unlocked(const struct utmp *utmp_entry)
type = utmp_entry->ut_type - 1;
type /= 4;
- while ((lutmp = __getutent_unlocked()) != NULL) {
+ while ((lutmp = __get_unlocked()) != NULL) {
if (type == 0 && lutmp->ut_type == utmp_entry->ut_type) {
/* one of RUN_LVL, BOOT_TIME, NEW_TIME, OLD_TIME */
return lutmp;
@@ -131,26 +133,27 @@ static struct utmp *__getutid_unlocked(const struct utmp *utmp_entry)
return NULL;
}
#if defined __UCLIBC_HAS_THREADS__
-struct utmp *getutid(const struct utmp *utmp_entry)
+struct UT *getid(const struct UT *utmp_entry)
{
- struct utmp *ret;
+ struct UT *ret;
__UCLIBC_MUTEX_LOCK(utmplock);
- ret = __getutid_unlocked(utmp_entry);
+ ret = __getid_unlocked(utmp_entry);
__UCLIBC_MUTEX_UNLOCK(utmplock);
return ret;
}
#else
-strong_alias(__getutid_unlocked,getutid)
+strong_alias(__getid_unlocked,getid)
#endif
-libc_hidden_def(getutid)
+/* not used in libc_hidden_def(getid) */
+other(getutxid,getutid)
-struct utmp *getutline(const struct utmp *utmp_entry)
+struct UT *getline(const struct UT *utmp_entry)
{
- struct utmp *lutmp;
+ struct UT *lutmp;
__UCLIBC_MUTEX_LOCK(utmplock);
- while ((lutmp = __getutent_unlocked()) != NULL) {
+ while ((lutmp = __get_unlocked()) != NULL) {
if (lutmp->ut_type == USER_PROCESS || lutmp->ut_type == LOGIN_PROCESS) {
if (strncmp(lutmp->ut_line, utmp_entry->ut_line,
sizeof(lutmp->ut_line)) == 0) {
@@ -161,39 +164,41 @@ struct utmp *getutline(const struct utmp *utmp_entry)
__UCLIBC_MUTEX_UNLOCK(utmplock);
return lutmp;
}
-libc_hidden_def(getutline)
+/* libc_hidden_def(getline) */
+other(getutxline,getutline)
-struct utmp *pututline(const struct utmp *utmp_entry)
+struct UT *putline(const struct UT *utmp_entry)
{
__UCLIBC_MUTEX_LOCK(utmplock);
/* Ignore the return value. That way, if they've already positioned
the file pointer where they want it, everything will work out. */
- lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR);
+ lseek(static_fd, (off_t) - sizeof(struct UT), SEEK_CUR);
- if (__getutid_unlocked(utmp_entry) != NULL)
- lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR);
+ if (__getid_unlocked(utmp_entry) != NULL)
+ lseek(static_fd, (off_t) - sizeof(struct UT), SEEK_CUR);
else
lseek(static_fd, (off_t) 0, SEEK_END);
- if (write(static_fd, utmp_entry, sizeof(struct utmp))
- != sizeof(struct utmp))
+ if (write(static_fd, utmp_entry, sizeof(struct UT))
+ != sizeof(struct UT))
utmp_entry = NULL;
__UCLIBC_MUTEX_UNLOCK(utmplock);
- return (struct utmp *)utmp_entry;
+ return (struct UT *)utmp_entry;
}
-libc_hidden_def(pututline)
+/* not used in libc_hidden_def(putline) */
+other(pututxline,pututline)
-int utmpname(const char *new_ut_name)
+int name(const char *new_file)
{
__UCLIBC_MUTEX_LOCK(utmplock);
- if (new_ut_name != NULL) {
- if (static_ut_name != default_file_name)
- free((char *)static_ut_name);
- static_ut_name = strdup(new_ut_name);
- if (static_ut_name == NULL) {
+ if (new_file != NULL) {
+ if (current_file != default_file)
+ free((char *)current_file);
+ current_file = strdup(new_file);
+ if (current_file == NULL) {
/* We should probably whine about out-of-memory
* errors here... Instead just reset to the default */
- static_ut_name = default_file_name;
+ current_file = default_file;
}
}
@@ -202,6 +207,23 @@ int utmpname(const char *new_ut_name)
static_fd = -1;
}
__UCLIBC_MUTEX_UNLOCK(utmplock);
- return 0; /* or maybe return -(static_ut_name != new_ut_name)? */
+ return 0; /* or maybe return -(current_file != new_file)? */
}
-libc_hidden_def(utmpname)
+/* not used in libc_hidden_def(name) */
+other(utmpxname,utmpname)
+
+void updw(const char *wtmp_file, const struct UT *lutmp)
+{
+ int fd;
+
+ fd = open_not_cancel_2(wtmp_file, O_APPEND | O_WRONLY);
+ if (fd >= 0) {
+ if (lockf(fd, F_LOCK, 0) == 0) {
+ write_not_cancel(fd, lutmp, sizeof(struct UT));
+ lockf(fd, F_ULOCK, 0);
+ close_not_cancel_no_status(fd);
+ }
+ }
+}
+/* not used in libc_hidden_def(updw) */
+other(updwtmpx,updwtmp)
diff --git a/libc/misc/utmp/utxent.c b/libc/misc/utmp/utxent.c
deleted file mode 100644
index c32e4da..0000000
--- a/libc/misc/utmp/utxent.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/*
- * utexent.c : Support for accessing user accounting database.
- * Copyright (C) 2010 STMicroelectronics Ltd.
- *
- * Author: Salvatore Cro <salvatore.cro(a)st.com>
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- *
- */
-
-#include <features.h>
-#include <string.h>
-#include <utmpx.h>
-#include <utmp.h>
-
-void setutxent(void)
-{
- setutent ();
-}
-
-void endutxent(void)
-{
- endutent ();
-}
-
-struct utmpx *getutxent(void)
-{
- return (struct utmpx *) getutent ();
-}
-
-struct utmpx *getutxid(const struct utmpx *utmp_entry)
-{
- return (struct utmpx *) getutid ((const struct utmp *) utmp_entry);
-}
-
-struct utmpx *getutxline(const struct utmpx *utmp_entry)
-{
- return (struct utmpx *) getutline ((const struct utmp *) utmp_entry);
-}
-
-struct utmpx *pututxline (const struct utmpx *utmp_entry)
-{
- return (struct utmpx *) pututline ((const struct utmp *) utmp_entry);
-}
-
-int utmpxname (const char *new_ut_name)
-{
- return utmpname (new_ut_name);
-}
-
-void updwtmpx (const char *wtmpx_file, const struct utmpx *utmpx)
-{
- updwtmp (wtmpx_file, (const struct utmp *) utmpx);
-}
-
-/* Copy the information in UTMPX to UTMP. */
-void getutmp (const struct utmpx *utmpx, struct utmp *utmp)
-{
-#if _HAVE_UT_TYPE - 0
- utmp->ut_type = utmpx->ut_type;
-#endif
-#if _HAVE_UT_PID - 0
- utmp->ut_pid = utmpx->ut_pid;
-#endif
- memcpy (utmp->ut_line, utmpx->ut_line, sizeof (utmp->ut_line));
- memcpy (utmp->ut_user, utmpx->ut_user, sizeof (utmp->ut_user));
-#if _HAVE_UT_ID - 0
- memcpy (utmp->ut_id, utmpx->ut_id, sizeof (utmp->ut_id));
-#endif
-#if _HAVE_UT_HOST - 0
- memcpy (utmp->ut_host, utmpx->ut_host, sizeof (utmp->ut_host));
-#endif
-#if _HAVE_UT_TV - 0
- utmp->ut_tv.tv_sec = utmpx->ut_tv.tv_sec;
- utmp->ut_tv.tv_usec = utmpx->ut_tv.tv_usec;
-#else
- utmp->ut_time = utmpx->ut_time;
-#endif
-}
-
-/* Copy the information in UTMP to UTMPX. */
-void getutmpx (const struct utmp *utmp, struct utmpx *utmpx)
-{
- memset (utmpx, 0, sizeof (struct utmpx));
-
-#if _HAVE_UT_TYPE - 0
- utmpx->ut_type = utmp->ut_type;
-#endif
-#if _HAVE_UT_PID - 0
- utmpx->ut_pid = utmp->ut_pid;
-#endif
- memcpy (utmpx->ut_line, utmp->ut_line, sizeof (utmp->ut_line));
- memcpy (utmpx->ut_user, utmp->ut_user, sizeof (utmp->ut_user));
-#if _HAVE_UT_ID - 0
- memcpy (utmpx->ut_id, utmp->ut_id, sizeof (utmp->ut_id));
-#endif
-#if _HAVE_UT_HOST - 0
- memcpy (utmpx->ut_host, utmp->ut_host, sizeof (utmp->ut_host));
-#endif
-#if _HAVE_UT_TV - 0
- utmpx->ut_tv.tv_sec = utmp->ut_tv.tv_sec;
- utmpx->ut_tv.tv_usec = utmp->ut_tv.tv_usec;
-#else
- utmpx->ut_time = utmp->ut_time;
-#endif
-}
-
diff --git a/libc/misc/utmp/wtent.c b/libc/misc/utmp/wtent.c
deleted file mode 100644
index 30939ea..0000000
--- a/libc/misc/utmp/wtent.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/*
- * Copyright (C) 2000-2006 Erik Andersen <andersen(a)uclibc.org>
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- */
-
-/* wtmp support rubbish (i.e. complete crap) */
-
-#include <string.h>
-#include <sys/time.h>
-#include <time.h>
-#include <unistd.h>
-#include <utmp.h>
-#include <fcntl.h>
-#include <sys/file.h>
-#include <not-cancel.h>
-
-#if 0
-/* This is enabled in uClibc/libutil/logwtmp.c */
-void logwtmp (const char *line, const char *name, const char *host)
-{
- struct utmp lutmp;
- memset(&lutmp, 0, sizeof(lutmp));
-
- lutmp.ut_type = (name && *name) ? USER_PROCESS : DEAD_PROCESS;
- lutmp.ut_pid = getpid();
- strncpy(lutmp.ut_line, line, sizeof(lutmp.ut_line)-1);
- strncpy(lutmp.ut_name, name, sizeof(lutmp.ut_name)-1);
- strncpy(lutmp.ut_host, host, sizeof(lutmp.ut_host)-1);
- gettimeofday(&(lutmp.ut_tv), NULL);
-
- updwtmp(_PATH_WTMP, &lutmp);
-}
-#endif
-
-void updwtmp(const char *wtmp_file, const struct utmp *lutmp)
-{
- int fd;
-
- fd = open_not_cancel_2(wtmp_file, O_APPEND | O_WRONLY);
- if (fd >= 0) {
- if (lockf(fd, F_LOCK, 0) == 0) {
- write_not_cancel(fd, lutmp, sizeof(struct utmp));
- lockf(fd, F_ULOCK, 0);
- close_not_cancel_no_status(fd);
- }
- }
-}
-libc_hidden_def(updwtmp)
diff --git a/libc/sysdeps/linux/arc/sigaction.c b/libc/sysdeps/linux/arc/sigaction.c
index 4a4c9e2..67ca38a 100644
--- a/libc/sysdeps/linux/arc/sigaction.c
+++ b/libc/sysdeps/linux/arc/sigaction.c
@@ -13,7 +13,8 @@
/*
* Default sigretrun stub if user doesn't specify SA_RESTORER
*/
-static void __default_rt_sa_restorer(void)
+static void attribute_optimize("Os") __attribute_noinline__
+__default_rt_sa_restorer(void)
{
INTERNAL_SYSCALL_NCS(__NR_rt_sigreturn, , 0);
}
diff --git a/libc/sysdeps/linux/arc/sys/procfs.h b/libc/sysdeps/linux/arc/sys/procfs.h
index a9e375b..a474303 100755
--- a/libc/sysdeps/linux/arc/sys/procfs.h
+++ b/libc/sysdeps/linux/arc/sys/procfs.h
@@ -20,17 +20,14 @@
#include <sys/time.h>
#include <sys/types.h>
#include <sys/user.h>
+#include <asm/ptrace.h>
__BEGIN_DECLS
/* Type for a general-purpose register. */
typedef unsigned long elf_greg_t;
-/* And the whole bunch of them. We could have used `struct
- user_regs' directly in the typedef, but tradition says that
- the register set is an array, which does have some peculiar
- semantics, so leave it that way. */
-#define ELF_NGREG 40
+#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
typedef elf_greg_t elf_gregset_t[ELF_NGREG];
typedef struct { } elf_fpregset_t;
diff --git a/libc/sysdeps/linux/sh/bits/atomic.h b/libc/sysdeps/linux/sh/bits/atomic.h
index 745c85c..18ae9ea 100644
--- a/libc/sysdeps/linux/sh/bits/atomic.h
+++ b/libc/sysdeps/linux/sh/bits/atomic.h
@@ -68,6 +68,12 @@ typedef uintmax_t uatomic_max_t;
r1: saved stack pointer
*/
+#if __GNUC_PREREQ (4, 7)
+# define rNOSP "u"
+#else
+# define rNOSP "r"
+#endif
+
/* Avoid having lots of different versions of compare and exchange,
by having this one complicated version. Parameters:
bwl: b, w or l for 8, 16 and 32 bit versions.
@@ -94,7 +100,7 @@ typedef uintmax_t uatomic_max_t;
movt %0\n\
.endif\n" \
: "=&r" (__arch_result) \
- : "r" (mem), "r" (newval), "r" (oldval) \
+ : rNOSP (mem), rNOSP (newval), rNOSP (oldval) \
: "r0", "r1", "t", "memory"); \
__arch_result; })
@@ -150,7 +156,7 @@ typedef uintmax_t uatomic_max_t;
mov." #bwl " %1,@%2\n\
1: mov r1,r15" \
: "=&r" (old), "=&r"(new) \
- : "r" (mem), "r" (value) \
+ : rNOSP (mem), rNOSP (value) \
: "r0", "r1", "memory"); \
})
@@ -194,7 +200,7 @@ typedef uintmax_t uatomic_max_t;
mov." #bwl " %0,@%1\n\
1: mov r1,r15" \
: "=&r" (__new) \
- : "r" (mem), "r" (__value) \
+ : rNOSP (mem), rNOSP (__value) \
: "r0", "r1", "memory"); \
__new; \
})
diff --git a/libc/sysdeps/linux/sh/bits/syscalls.h b/libc/sysdeps/linux/sh/bits/syscalls.h
index b308276..efd423e 100644
--- a/libc/sysdeps/linux/sh/bits/syscalls.h
+++ b/libc/sysdeps/linux/sh/bits/syscalls.h
@@ -122,7 +122,7 @@
__asm__ __volatile__ (SYSCALL_INST_STR##nr SYSCALL_INST_PAD \
: "=z" (resultvar) \
: "r" (r3) ASMFMT_##nr \
- : "memory" \
+ : "memory", "t" \
); \
(int) resultvar; \
}) \
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h
index 0b635d3..a9652bb 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h
@@ -358,7 +358,7 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden;
register unsigned long __r5 __asm__ ("r5") \
= __lll_private_flag (FUTEX_WAIT, private); \
register unsigned long __r6 __asm__ ("r6") = (unsigned long) (val); \
- register unsigned long __r7 __asm__ ("r7") = (timeout); \
+ register unsigned long __r7 __asm__ ("r7") = (unsigned long) (timeout); \
__asm__ __volatile__ (SYSCALL_WITH_INST_PAD \
: "=z" (__status) \
: "r" (__r3), "r" (__r4), "r" (__r5), \
diff --git a/libutil/forkpty.c b/libutil/forkpty.c
index ec490f0..2464333 100644
--- a/libutil/forkpty.c
+++ b/libutil/forkpty.c
@@ -22,9 +22,6 @@
#include <utmp.h>
#include <pty.h>
-libutil_hidden_proto(openpty)
-libutil_hidden_proto(login_tty)
-
int
forkpty (int *amaster, char *name, struct termios *termp, struct winsize *winp)
{
diff --git a/libutil/login.c b/libutil/login.c
index 4007e4c..971997d 100644
--- a/libutil/login.c
+++ b/libutil/login.c
@@ -3,7 +3,7 @@
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
-#include <utmp.h>
+#include "internal/utmp.h"
/* Write the given entry into utmp and wtmp.
* Note: the match in utmp is done against ut_id field,
@@ -11,7 +11,7 @@
*/
void login(const struct utmp *entry)
{
- struct utmp copy;
+ struct UT copy;
char tty_name[sizeof(copy.ut_line) + 6];
int fd;
@@ -20,7 +20,7 @@ void login(const struct utmp *entry)
// (if there is such a field) with the value USER_PROCESS,
// and fills the field ut->ut_pid (if there is such a field)
// with the process ID of the calling process.
- copy = *entry;
+ copy = *((const struct UT *)(entry));
#if _HAVE_UT_TYPE - 0
copy.ut_type = USER_PROCESS;
#endif
diff --git a/libutil/login_tty.c b/libutil/login_tty.c
index 3979adc..3665858 100644
--- a/libutil/login_tty.c
+++ b/libutil/login_tty.c
@@ -36,7 +36,6 @@
#include <fcntl.h>
#include <utmp.h>
-libutil_hidden_proto(login_tty)
int login_tty(int fd)
{
(void) setsid();
diff --git a/libutil/logout.c b/libutil/logout.c
index 4580455..0181e23 100644
--- a/libutil/logout.c
+++ b/libutil/logout.c
@@ -18,14 +18,14 @@
#include <errno.h>
#include <string.h>
-#include <utmp.h>
#include <sys/time.h>
+#include "internal/utmp.h"
int
logout (const char *line)
{
- struct utmp tmp;
- struct utmp *ut;
+ struct UT tmp;
+ struct UT *ut;
int result = 0;
/* if (utmpname (_PATH_UTMP) == -1) return 0; - why?
diff --git a/libutil/logwtmp.c b/libutil/logwtmp.c
index 6a53b5f..99b772f 100644
--- a/libutil/logwtmp.c
+++ b/libutil/logwtmp.c
@@ -9,13 +9,13 @@
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
-#include <utmp.h>
#include <fcntl.h>
#include <sys/file.h>
+#include "internal/utmp.h"
void logwtmp(const char *line, const char *name, const char *host)
{
- struct utmp lutmp;
+ struct UT lutmp;
memset(&lutmp, 0, sizeof(lutmp));
lutmp.ut_type = (name && *name) ? USER_PROCESS : DEAD_PROCESS;
@@ -36,20 +36,3 @@ void logwtmp(const char *line, const char *name, const char *host)
updwtmp(_PATH_WTMP, &lutmp);
}
-
-#if 0
-/* This is enabled in uClibc/libc/misc/utmp/wtent.c */
-void updwtmp(const char *wtmp_file, const struct utmp *lutmp)
-{
- int fd;
-
- fd = open(wtmp_file, O_APPEND | O_WRONLY);
- if (fd >= 0) {
- if (lockf(fd, F_LOCK, 0) == 0) {
- write(fd, lutmp, sizeof(*lutmp));
- lockf(fd, F_ULOCK, 0);
- close(fd);
- }
- }
-}
-#endif
diff --git a/libutil/openpty.c b/libutil/openpty.c
index bd8b8d9..848dc8d 100644
--- a/libutil/openpty.c
+++ b/libutil/openpty.c
@@ -84,7 +84,6 @@ pts_name (int fd, char **pts, size_t buf_len)
/* Create pseudo tty master slave pair and set terminal attributes
according to TERMP and WINP. Return handles for both ends in
AMASTER and ASLAVE, and return the name of the slave end in NAME. */
-libutil_hidden_proto(openpty)
int
openpty (int *amaster, int *aslave, char *name, struct termios *termp,
struct winsize *winp)
diff --git a/test/.gitignore b/test/.gitignore
index beb5095..0d19285 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -263,6 +263,8 @@ signal/tst-sigset
signal/tst-sigsimple
silly/hello
silly/tiny
+silly/tst-atomic
+silly/tst-atomic-long
stat/memcmp-stat
stat/stat
stat/stat64
diff --git a/test/README b/test/README
index 28225b0..723ce6e 100644
--- a/test/README
+++ b/test/README
@@ -29,6 +29,9 @@ The following make variables may help you in testing:
So, to just run the uClibc tests, try this:
make check UCLIBC_ONLY=1
+You can pass the following 2 environment variables to "make run":
+ - make run SIMULATOR_uclibc=qemu-sh4 SIMULATOR_glibc=qemu-x86_64
+
If you need to test just a subset of all test, delete subdirectories
you do not need.
diff --git a/test/Test.mak b/test/Test.mak
index ee43a0f..a56a201 100644
--- a/test/Test.mak
+++ b/test/Test.mak
@@ -69,7 +69,7 @@ endef
define exec_test
$(showtest)
$(Q)\
- $(WRAPPER) $(WRAPPER_$(tst_src_name)) \
+ $(SIMULATOR) $(WRAPPER) $(WRAPPER_$(tst_src_name)) \
./$(binary_name) $(OPTS) $(OPTS_$(tst_src_name)) > "$(binary_name).out" 2>&1 ; \
ret=$$? ; \
expected_ret="$(RET_$(tst_src_name))" ; \
@@ -85,6 +85,9 @@ endef
test check all: run
run: $(RUN_TARGETS)
+
+$(addsuffix .exe,$(U_TARGETS)): SIMULATOR:=$(SIMULATOR_uclibc)
+$(addsuffix .exe,$(G_TARGETS)): SIMULATOR:=$(SIMULATOR_glibc)
$(RUN_TARGETS):
$(exec_test)
$(diff_test)
diff --git a/test/misc/Makefile.in b/test/misc/Makefile.in
index 2fb9652..09f631f 100644
--- a/test/misc/Makefile.in
+++ b/test/misc/Makefile.in
@@ -20,6 +20,10 @@ ifeq ($(UCLIBC_HAS_UTMPX),)
TESTS_DISABLED += tst-utmpx
endif
+ifeq ($(UCLIBC_HAS_UTMP),)
+TESTS_DISABLED += tst-utmp
+endif
+
DODIFF_dirent := 1
DODIFF_dirent64 := 1
DODIFF_tst-statfs := 1
diff --git a/test/misc/tst-scandir.c b/test/misc/tst-scandir.c
index df62a40..e1c72e3 100644
--- a/test/misc/tst-scandir.c
+++ b/test/misc/tst-scandir.c
@@ -3,7 +3,7 @@
#include <stdio.h> /* perror() */
#include <stdlib.h>
-int skip_all(const struct dirent *dirbuf)
+static int skip_all(const struct dirent *dirbuf)
{
errno = EBADF;
return 0;
diff --git a/test/silly/Makefile.in b/test/silly/Makefile.in
index bb08e0d..9bb4032 100644
--- a/test/silly/Makefile.in
+++ b/test/silly/Makefile.in
@@ -3,3 +3,6 @@
RET_hello := 42
RET_tiny := 42
+
+# missing internal headers, disable these
+GLIBC_TESTS_DISABLED := tst-atomic_glibc tst-atomic-long_glibc
diff --git a/test/silly/hello.c b/test/silly/hello.c
index 4aba926..d330597 100644
--- a/test/silly/hello.c
+++ b/test/silly/hello.c
@@ -1,4 +1,4 @@
-#include<stdio.h>
+#include <stdio.h>
#include <stdlib.h>
int main(void)
diff --git a/libc/sysdeps/linux/sparc/jmpbuf-offsets.h b/test/silly/tst-atomic-long.c
similarity index 75%
copy from libc/sysdeps/linux/sparc/jmpbuf-offsets.h
copy to test/silly/tst-atomic-long.c
index 0d0a96d..d13fb07 100644
--- a/libc/sysdeps/linux/sparc/jmpbuf-offsets.h
+++ b/test/silly/tst-atomic-long.c
@@ -1,6 +1,7 @@
-/* Private macros for accessing __jmp_buf contents. SPARC version.
- Copyright (C) 2006 Free Software Foundation, Inc.
+/* Tests for atomic.h macros.
+ Copyright (C) 2003-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub(a)redhat.com>, 2003.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -18,12 +19,9 @@
#include <bits/wordsize.h>
+#define atomic_t long
#if __WORDSIZE == 64
-#define O_mask_was_saved 512
-#define O_gregs 32
-#define O_g1 (O_gregs + 4*8)
-#else
-#define JB_SP 0
-#define JB_FP 1
-#define JB_PC 2
+# define TEST_ATOMIC64 1
#endif
+
+#include "tst-atomic.c"
diff --git a/test/silly/tst-atomic.c b/test/silly/tst-atomic.c
new file mode 100644
index 0000000..fc773b2
--- /dev/null
+++ b/test/silly/tst-atomic.c
@@ -0,0 +1,573 @@
+/* Tests for atomic.h macros.
+ Copyright (C) 2003-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub(a)redhat.com>, 2003.
+
+ 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <atomic.h>
+
+#ifndef atomic_t
+# define atomic_t int
+#endif
+
+#define CHK2(f,a1,a2,rv,new_mem) \
+ retval = f(&mem, a1, a2); \
+ if (retval != rv) { \
+ printf("%s(mem, %lu, %lu): retval %lu != expected %lu\n", \
+ #f, a1, a2, retval, rv); \
+ ret = 1; \
+ } \
+ if (mem != new_mem) { \
+ printf("%s(mem, %lu, %lu): mem %lu != expected %lu\n", \
+ #f, a1, a2, mem, new_mem); \
+ ret = 1; \
+ }
+#define CHK1(f,a1,rv,new_mem) \
+ retval = f(&mem, a1); \
+ if (retval != rv) { \
+ printf("%s(mem, %lu): retval %lu != expected %lu\n", \
+ #f, a1, retval, rv); \
+ ret = 1; \
+ } \
+ if (mem != new_mem) { \
+ printf("%s(mem, %lu): mem %lu != expected %lu\n", \
+ #f, a1, mem, new_mem); \
+ ret = 1; \
+ }
+#define CHK0(f,rv,new_mem) \
+ retval = f(&mem); \
+ if (retval != rv) { \
+ printf("%s(mem): retval %lu != expected %lu\n", \
+ #f, retval, rv); \
+ ret = 1; \
+ } \
+ if (mem != new_mem) { \
+ printf("%s(mem): mem %lu != expected %lu\n", \
+ #f, mem, new_mem); \
+ ret = 1; \
+ }
+
+/* Test various atomic.h macros. */
+static int
+do_test (void)
+{
+ atomic_t mem, expected, retval;
+ int ret = 0;
+
+#ifdef atomic_compare_and_exchange_val_acq
+ mem = 24;
+ CHK2(atomic_compare_and_exchange_val_acq, 35, 24, 24, 35);
+ mem = 12;
+ CHK2(atomic_compare_and_exchange_val_acq, 10, 15, 12, 12);
+ mem = -15;
+ CHK2(atomic_compare_and_exchange_val_acq, -56, -15, -15, -56);
+ mem = -1;
+ CHK2(atomic_compare_and_exchange_val_acq, 17, 0, -1, -1);
+#endif
+
+ mem = 24;
+ CHK2(atomic_compare_and_exchange_bool_acq, 35, 24, 0, 35);
+ mem = 12;
+ CHK2(atomic_compare_and_exchange_bool_acq, 10, 15, 1, 12);
+ mem = -15;
+ CHK2(atomic_compare_and_exchange_bool_acq, -56, -15, 0, -56);
+ mem = -1;
+ CHK2(atomic_compare_and_exchange_bool_acq, 17, 0, 1, -1);
+
+ mem = 64;
+ CHK1(atomic_exchange_acq, 31, 64, 31);
+ mem = 2;
+ CHK1(atomic_exchange_and_add, 11, 2, 13);
+ mem = 2;
+ CHK1(atomic_exchange_and_add_acq, 11, 2, 13);
+ mem = 2;
+ CHK1(atomic_exchange_and_add_rel, 11, 2, 13);
+
+ mem = -21;
+ atomic_add (&mem, 22);
+ if (mem != 1)
+ {
+ printf ("atomic_add(mem, 22): mem %lu != expected 1\n", mem);
+ ret = 1;
+ }
+
+ mem = -1;
+ atomic_increment (&mem);
+ if (mem != 0)
+ {
+ printf ("atomic_increment(mem): mem %lu != expected 0\n", mem);
+ ret = 1;
+ }
+
+ mem = 2;
+ if ((retval = atomic_increment_val (&mem)) != 3)
+ {
+ printf ("atomic_increment_val(mem): retval %lu != expected 3\n", retval);
+ ret = 1;
+ }
+
+ mem = 0;
+ CHK0(atomic_increment_and_test, 0, 1);
+ mem = 35;
+ CHK0(atomic_increment_and_test, 0, 36);
+ mem = -1;
+ CHK0(atomic_increment_and_test, 1, 0);
+ mem = 17;
+ atomic_decrement (&mem);
+ if (mem != 16)
+ {
+ printf ("atomic_increment(mem): mem %lu != expected 16\n", mem);
+ ret = 1;
+ }
+
+ if ((retval = atomic_decrement_val (&mem)) != 15)
+ {
+ printf ("atomic_decrement_val(mem): retval %lu != expected 15\n", retval);
+ ret = 1;
+ }
+
+ mem = 0;
+ CHK0(atomic_decrement_and_test, 0, -1);
+
+ mem = 15;
+ CHK0(atomic_decrement_and_test, 0, 14);
+ mem = 1;
+ CHK0(atomic_decrement_and_test, 1, 0);
+ mem = 1;
+ if (atomic_decrement_if_positive (&mem) != 1
+ || mem != 0)
+ {
+ puts ("atomic_decrement_if_positive test 1 failed");
+ ret = 1;
+ }
+
+ mem = 0;
+ if (atomic_decrement_if_positive (&mem) != 0
+ || mem != 0)
+ {
+ puts ("atomic_decrement_if_positive test 2 failed");
+ ret = 1;
+ }
+
+ mem = -1;
+ if (atomic_decrement_if_positive (&mem) != -1
+ || mem != -1)
+ {
+ puts ("atomic_decrement_if_positive test 3 failed");
+ ret = 1;
+ }
+
+ mem = -12;
+ if (! atomic_add_negative (&mem, 10)
+ || mem != -2)
+ {
+ puts ("atomic_add_negative test 1 failed");
+ ret = 1;
+ }
+
+ mem = 0;
+ if (atomic_add_negative (&mem, 100)
+ || mem != 100)
+ {
+ puts ("atomic_add_negative test 2 failed");
+ ret = 1;
+ }
+
+ mem = 15;
+ if (atomic_add_negative (&mem, -10)
+ || mem != 5)
+ {
+ puts ("atomic_add_negative test 3 failed");
+ ret = 1;
+ }
+
+ mem = -12;
+ if (atomic_add_negative (&mem, 14)
+ || mem != 2)
+ {
+ puts ("atomic_add_negative test 4 failed");
+ ret = 1;
+ }
+
+ mem = 0;
+ if (! atomic_add_negative (&mem, -1)
+ || mem != -1)
+ {
+ puts ("atomic_add_negative test 5 failed");
+ ret = 1;
+ }
+
+ mem = -31;
+ if (atomic_add_negative (&mem, 31)
+ || mem != 0)
+ {
+ puts ("atomic_add_negative test 6 failed");
+ ret = 1;
+ }
+
+ mem = -34;
+ if (atomic_add_zero (&mem, 31)
+ || mem != -3)
+ {
+ puts ("atomic_add_zero test 1 failed");
+ ret = 1;
+ }
+
+ mem = -36;
+ if (! atomic_add_zero (&mem, 36)
+ || mem != 0)
+ {
+ puts ("atomic_add_zero test 2 failed");
+ ret = 1;
+ }
+
+ mem = 113;
+ if (atomic_add_zero (&mem, -13)
+ || mem != 100)
+ {
+ puts ("atomic_add_zero test 3 failed");
+ ret = 1;
+ }
+
+ mem = -18;
+ if (atomic_add_zero (&mem, 20)
+ || mem != 2)
+ {
+ puts ("atomic_add_zero test 4 failed");
+ ret = 1;
+ }
+
+ mem = 10;
+ if (atomic_add_zero (&mem, -20)
+ || mem != -10)
+ {
+ puts ("atomic_add_zero test 5 failed");
+ ret = 1;
+ }
+
+ mem = 10;
+ if (! atomic_add_zero (&mem, -10)
+ || mem != 0)
+ {
+ puts ("atomic_add_zero test 6 failed");
+ ret = 1;
+ }
+
+ mem = 0;
+ atomic_bit_set (&mem, 1);
+ if (mem != 2)
+ {
+ puts ("atomic_bit_set test 1 failed");
+ ret = 1;
+ }
+
+ mem = 8;
+ atomic_bit_set (&mem, 3);
+ if (mem != 8)
+ {
+ puts ("atomic_bit_set test 2 failed");
+ ret = 1;
+ }
+
+#ifdef TEST_ATOMIC64
+ mem = 16;
+ atomic_bit_set (&mem, 35);
+ if (mem != 0x800000010LL)
+ {
+ puts ("atomic_bit_set test 3 failed");
+ ret = 1;
+ }
+#endif
+
+ mem = 0;
+ if (atomic_bit_test_set (&mem, 1)
+ || mem != 2)
+ {
+ puts ("atomic_bit_test_set test 1 failed");
+ ret = 1;
+ }
+
+ mem = 8;
+ if (! atomic_bit_test_set (&mem, 3)
+ || mem != 8)
+ {
+ puts ("atomic_bit_test_set test 2 failed");
+ ret = 1;
+ }
+
+#ifdef TEST_ATOMIC64
+ mem = 16;
+ if (atomic_bit_test_set (&mem, 35)
+ || mem != 0x800000010LL)
+ {
+ puts ("atomic_bit_test_set test 3 failed");
+ ret = 1;
+ }
+
+ mem = 0x100000000LL;
+ if (! atomic_bit_test_set (&mem, 32)
+ || mem != 0x100000000LL)
+ {
+ puts ("atomic_bit_test_set test 4 failed");
+ ret = 1;
+ }
+#endif
+
+#ifdef catomic_compare_and_exchange_val_acq
+ mem = 24;
+ if (catomic_compare_and_exchange_val_acq (&mem, 35, 24) != 24
+ || mem != 35)
+ {
+ puts ("catomic_compare_and_exchange_val_acq test 1 failed");
+ ret = 1;
+ }
+
+ mem = 12;
+ if (catomic_compare_and_exchange_val_acq (&mem, 10, 15) != 12
+ || mem != 12)
+ {
+ puts ("catomic_compare_and_exchange_val_acq test 2 failed");
+ ret = 1;
+ }
+
+ mem = -15;
+ if (catomic_compare_and_exchange_val_acq (&mem, -56, -15) != -15
+ || mem != -56)
+ {
+ puts ("catomic_compare_and_exchange_val_acq test 3 failed");
+ ret = 1;
+ }
+
+ mem = -1;
+ if (catomic_compare_and_exchange_val_acq (&mem, 17, 0) != -1
+ || mem != -1)
+ {
+ puts ("catomic_compare_and_exchange_val_acq test 4 failed");
+ ret = 1;
+ }
+#endif
+
+ mem = 24;
+ if (catomic_compare_and_exchange_bool_acq (&mem, 35, 24)
+ || mem != 35)
+ {
+ puts ("catomic_compare_and_exchange_bool_acq test 1 failed");
+ ret = 1;
+ }
+
+ mem = 12;
+ if (! catomic_compare_and_exchange_bool_acq (&mem, 10, 15)
+ || mem != 12)
+ {
+ puts ("catomic_compare_and_exchange_bool_acq test 2 failed");
+ ret = 1;
+ }
+
+ mem = -15;
+ if (catomic_compare_and_exchange_bool_acq (&mem, -56, -15)
+ || mem != -56)
+ {
+ puts ("catomic_compare_and_exchange_bool_acq test 3 failed");
+ ret = 1;
+ }
+
+ mem = -1;
+ if (! catomic_compare_and_exchange_bool_acq (&mem, 17, 0)
+ || mem != -1)
+ {
+ puts ("catomic_compare_and_exchange_bool_acq test 4 failed");
+ ret = 1;
+ }
+
+ mem = 2;
+ if (catomic_exchange_and_add (&mem, 11) != 2
+ || mem != 13)
+ {
+ puts ("catomic_exchange_and_add test failed");
+ ret = 1;
+ }
+
+ mem = -21;
+ catomic_add (&mem, 22);
+ if (mem != 1)
+ {
+ puts ("catomic_add test failed");
+ ret = 1;
+ }
+
+ mem = -1;
+ catomic_increment (&mem);
+ if (mem != 0)
+ {
+ puts ("catomic_increment test failed");
+ ret = 1;
+ }
+
+ mem = 2;
+ if (catomic_increment_val (&mem) != 3)
+ {
+ puts ("catomic_increment_val test failed");
+ ret = 1;
+ }
+
+ mem = 17;
+ catomic_decrement (&mem);
+ if (mem != 16)
+ {
+ puts ("catomic_decrement test failed");
+ ret = 1;
+ }
+
+ if (catomic_decrement_val (&mem) != 15)
+ {
+ puts ("catomic_decrement_val test failed");
+ ret = 1;
+ }
+
+ /* Tests for C11-like atomics. */
+ mem = 11;
+ if (atomic_load_relaxed (&mem) != 11 || atomic_load_acquire (&mem) != 11)
+ {
+ puts ("atomic_load_{relaxed,acquire} test failed");
+ ret = 1;
+ }
+
+ atomic_store_relaxed (&mem, 12);
+ if (mem != 12)
+ {
+ puts ("atomic_store_relaxed test failed");
+ ret = 1;
+ }
+ atomic_store_release (&mem, 13);
+ if (mem != 13)
+ {
+ puts ("atomic_store_release test failed");
+ ret = 1;
+ }
+
+ mem = 14;
+ expected = 14;
+ if (!atomic_compare_exchange_weak_relaxed (&mem, &expected, 25)
+ || mem != 25 || expected != 14)
+ {
+ puts ("atomic_compare_exchange_weak_relaxed test 1 failed");
+ ret = 1;
+ }
+ if (atomic_compare_exchange_weak_relaxed (&mem, &expected, 14)
+ || mem != 25 || expected != 25)
+ {
+ puts ("atomic_compare_exchange_weak_relaxed test 2 failed");
+ ret = 1;
+ }
+ mem = 14;
+ expected = 14;
+ if (!atomic_compare_exchange_weak_acquire (&mem, &expected, 25)
+ || mem != 25 || expected != 14)
+ {
+ puts ("atomic_compare_exchange_weak_acquire test 1 failed");
+ ret = 1;
+ }
+ if (atomic_compare_exchange_weak_acquire (&mem, &expected, 14)
+ || mem != 25 || expected != 25)
+ {
+ puts ("atomic_compare_exchange_weak_acquire test 2 failed");
+ ret = 1;
+ }
+ mem = 14;
+ expected = 14;
+ if (!atomic_compare_exchange_weak_release (&mem, &expected, 25)
+ || mem != 25 || expected != 14)
+ {
+ puts ("atomic_compare_exchange_weak_release test 1 failed");
+ ret = 1;
+ }
+ if (atomic_compare_exchange_weak_release (&mem, &expected, 14)
+ || mem != 25 || expected != 25)
+ {
+ puts ("atomic_compare_exchange_weak_release test 2 failed");
+ ret = 1;
+ }
+
+ mem = 23;
+ if (atomic_exchange_acquire (&mem, 42) != 23 || mem != 42)
+ {
+ puts ("atomic_exchange_acquire test failed");
+ ret = 1;
+ }
+ mem = 23;
+ if (atomic_exchange_release (&mem, 42) != 23 || mem != 42)
+ {
+ puts ("atomic_exchange_release test failed");
+ ret = 1;
+ }
+
+ mem = 23;
+ if (atomic_fetch_add_relaxed (&mem, 1) != 23 || mem != 24)
+ {
+ puts ("atomic_fetch_add_relaxed test failed");
+ ret = 1;
+ }
+ mem = 23;
+ if (atomic_fetch_add_acquire (&mem, 1) != 23 || mem != 24)
+ {
+ puts ("atomic_fetch_add_acquire test failed");
+ ret = 1;
+ }
+ mem = 23;
+ if (atomic_fetch_add_release (&mem, 1) != 23 || mem != 24)
+ {
+ puts ("atomic_fetch_add_release test failed");
+ ret = 1;
+ }
+ mem = 23;
+ if (atomic_fetch_add_acq_rel (&mem, 1) != 23 || mem != 24)
+ {
+ puts ("atomic_fetch_add_acq_rel test failed");
+ ret = 1;
+ }
+
+ mem = 3;
+ if (atomic_fetch_and_acquire (&mem, 2) != 3 || mem != 2)
+ {
+ puts ("atomic_fetch_and_acquire test failed");
+ ret = 1;
+ }
+
+ mem = 4;
+ if (atomic_fetch_or_relaxed (&mem, 2) != 4 || mem != 6)
+ {
+ puts ("atomic_fetch_or_relaxed test failed");
+ ret = 1;
+ }
+ mem = 4;
+ if (atomic_fetch_or_acquire (&mem, 2) != 4 || mem != 6)
+ {
+ puts ("atomic_fetch_or_acquire test failed");
+ ret = 1;
+ }
+
+ /* This is a single-threaded test, so we can't test the effects of the
+ fences. */
+ atomic_thread_fence_acquire ();
+ atomic_thread_fence_release ();
+ atomic_thread_fence_seq_cst ();
+
+ return ret;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/test/stdlib/Makefile.in b/test/stdlib/Makefile.in
index df3440a..e1cbccf 100644
--- a/test/stdlib/Makefile.in
+++ b/test/stdlib/Makefile.in
@@ -11,8 +11,9 @@ GLIBC_TESTS_DISABLED :=
ifeq ($(UCLIBC_HAS_PTY),)
TESTS_DISABLED += ptytest
endif
+
ifeq ($(UCLIBC_HAS_ARC4RANDOM),)
TESTS_DISABLED += testarc4random
else
-GLIBC_TESTS_DISABLED += testarc4random
+GLIBC_TESTS_DISABLED += testarc4random_glibc
endif
hooks/post-receive
--
uClibc-ng - small C library for embedded systems
1
0

uClibc-ng - small C library for embedded systems branch upstream updated. 40effcf4c1e9a2fb9169d9189bdc9b1c888f9345
by wbx@helium.waldemar-brodkorb.de 24 Mar '15
by wbx@helium.waldemar-brodkorb.de 24 Mar '15
24 Mar '15
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".
The branch, upstream has been updated
via 40effcf4c1e9a2fb9169d9189bdc9b1c888f9345 (commit)
via 730db44f0824f505a31822e250b9f04b9f8e7a1b (commit)
via 272e4fa4d38440d5c01259fce7d74f8c0a9d300f (commit)
via c846358a61434e6cb9b1f73bc35df0e5404f52d2 (commit)
via 6cba32e6e9a1910ea0a5277fd39484047094e478 (commit)
via 97c9f52239301c81c021b8be187ac07ddf33496d (commit)
via d0f60a600bafc3f6dfc844418d310cf6a4e38c92 (commit)
via 4da43e9f2e4f2f7593427003e37b87287c7b16cf (commit)
via eee76e42f32f90af4e64a254810fcb767297fecf (commit)
via 9277fe13156a6ff2b055fe8a58d2863115c36b6a (commit)
via 63729418992d5f63965a88fa2ac3570e3d270479 (commit)
via 09ff424905d5de0b2a21a3960d9756a90b07ba26 (commit)
via 534f44d53146457b3ca686c47efb9207543b88e1 (commit)
via bf6f1313132a3d99d645ea8b6661c23d68235278 (commit)
via 5c3661fda947c1bc5e597be081c355b51c595794 (commit)
via bfb988452cc66ddf93f69a199c50ea1c14e9ccb7 (commit)
via 9faa7e94b824e1dc5fd9ce1b6f16c1b3f13c601a (commit)
via fdebbe2044653c5c84172524ed6e036d38716d88 (commit)
via 74e49a5e545576f1436a510495e2e8a682b0db4d (commit)
from 39206e01eb5d27b61410a05f2ccf6051a305db02 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 40effcf4c1e9a2fb9169d9189bdc9b1c888f9345
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Tue Mar 24 00:11:49 2015 +0100
mips: switch float_t to float
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 730db44f0824f505a31822e250b9f04b9f8e7a1b
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Tue Mar 24 00:11:47 2015 +0100
libm: honor NO_LONG_DOUBLE in ldouble_wrappers
Fixes SH build breakage due to attempts to define hidden defs for
unavailable long double functions.
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 272e4fa4d38440d5c01259fce7d74f8c0a9d300f
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Tue Mar 24 00:11:44 2015 +0100
libcrypt: Rename some internal macros
to avoid clashes
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit c846358a61434e6cb9b1f73bc35df0e5404f52d2
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Tue Mar 24 00:11:41 2015 +0100
buildsys: fix IS_IN_lib* for .s
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 6cba32e6e9a1910ea0a5277fd39484047094e478
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Tue Mar 24 00:11:38 2015 +0100
utmp: indent
indent only, no code changes
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 97c9f52239301c81c021b8be187ac07ddf33496d
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Tue Mar 24 00:11:28 2015 +0100
utmp: Remove unneeded aliases
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit d0f60a600bafc3f6dfc844418d310cf6a4e38c92
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Tue Mar 24 00:11:24 2015 +0100
utmp: add _unlocked suffix to internal helpers
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 4da43e9f2e4f2f7593427003e37b87287c7b16cf
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Tue Mar 24 00:11:21 2015 +0100
buildsys: HAS_UTMP (XPG2, SVr4 compat) knob
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit eee76e42f32f90af4e64a254810fcb767297fecf
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Tue Mar 24 00:11:15 2015 +0100
libc: TIME64_COMPAT32 for sparc, mips
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 9277fe13156a6ff2b055fe8a58d2863115c36b6a
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Tue Mar 24 00:09:45 2015 +0100
Revert "utent.c, wtent.c: move functions from utxent.c"
This reverts commit 84135275cfeebc0b233c1c96eeada4d4178a0b18.
This change is said to make systemd deadlock (cannot reproduce this)
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Conflicts:
include/utmp.h
commit 63729418992d5f63965a88fa2ac3570e3d270479
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Sun Mar 22 14:47:29 2015 +0100
test: add utmpx test
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 09ff424905d5de0b2a21a3960d9756a90b07ba26
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Sun Mar 22 14:47:29 2015 +0100
libc: add getrandom(2)
Introduce a <sys/random.h> for it.
/* FIXME: aren't there a couple of __restrict and const missing ?
*/
extern int getrandom(void *__buf, size_t count, unsigned int flags)
__nonnull ((1)) __wur;
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 534f44d53146457b3ca686c47efb9207543b88e1
Author: Khem Raj <raj.khem(a)gmail.com>
Date: Sat Jun 23 16:51:52 2012 -0700
librt: Use -nodefaultlibs instead of -nostdlib
nostdlib disables linking in startup files too which is not
what we want here since it needs to resolve __dso_handle
which comes from crtbeginS.o, otherwise librt has this
undefined reference to a weak undefined __dso_handle that
shows up as error (with gold linker)
when shared libraries are being built which are
linking in librt
Signed-off-by: Khem Raj <raj.khem(a)gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit bf6f1313132a3d99d645ea8b6661c23d68235278
Author: Khem Raj <raj.khem(a)gmail.com>
Date: Sat Jun 23 15:59:01 2012 -0700
nptl/atfork: Hide pthread_atfork in shared versions
Signed-off-by: Khem Raj <raj.khem(a)gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 5c3661fda947c1bc5e597be081c355b51c595794
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Sun Mar 22 14:47:29 2015 +0100
libc: Fix vfprintf compilation without HAS_FLOATS
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit bfb988452cc66ddf93f69a199c50ea1c14e9ccb7
Author: Khem Raj <raj.khem(a)gmail.com>
Date: Sat Jun 23 14:21:17 2012 -0700
nptl/arm: Move aeabi_read_tp to uclibc_nonshared.a
Otherwise it creates wrong references from shared libs
Signed-off-by: Khem Raj <raj.khem(a)gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 9faa7e94b824e1dc5fd9ce1b6f16c1b3f13c601a
Author: Khem Raj <raj.khem(a)gmail.com>
Date: Sat Jun 23 13:26:30 2012 -0700
atexit_old: Do not add it to shared libc
atexit should only be in either uclibc_nonshared.a
shared libc case or libc.a in static build case
Signed-off-by: Khem Raj <raj.khem(a)gmail.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit fdebbe2044653c5c84172524ed6e036d38716d88
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Sun Mar 22 14:47:29 2015 +0100
test: enable libm test log2
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 74e49a5e545576f1436a510495e2e8a682b0db4d
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Sun Mar 22 14:47:29 2015 +0100
extra: add clang flags for gen_bits_syscall_h
Closes bugzilla #6008
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
-----------------------------------------------------------------------
Summary of changes:
Makefile.in | 2 +
Makerules | 4 +-
extra/Configs/Config.in | 29 ++-
extra/Configs/Config.in.arch | 2 +-
extra/scripts/gen_bits_syscall_h.sh | 1 +
include/utmp.h | 8 +
ldso/ldso/sh/dl-syscalls.h | 2 +-
libc/misc/utmp/Makefile.in | 4 +-
libc/misc/utmp/utent.c | 272 +++++++++-------------
libc/misc/utmp/utxent.c | 5 +-
libc/misc/utmp/wtent.c | 15 +-
libc/stdio/_fpmaxtostr.h | 22 +-
libc/stdio/_vfprintf.c | 15 --
libc/stdlib/Makefile.in | 4 +-
libc/sysdeps/linux/arm/Makefile.arch | 4 +-
libc/sysdeps/linux/common/Makefile.in | 1 +
libc/sysdeps/linux/common/bits/kernel-features.h | 5 +
libc/sysdeps/linux/common/bits/utmp.h | 4 +-
libc/sysdeps/linux/common/bits/utmpx.h | 2 +-
libc/sysdeps/linux/common/getrandom.c | 14 ++
libc/sysdeps/linux/common/stubs.c | 4 +
libc/sysdeps/linux/common/sys/random.h | 33 +++
libc/sysdeps/linux/mips/bits/mathdef.h | 7 +-
libc/sysdeps/linux/mips/bits/wordsize.h | 3 +
libc/sysdeps/linux/powerpc/bits/wordsize.h | 2 +-
libc/sysdeps/linux/sparc/bits/wordsize.h | 1 +
libc/sysdeps/linux/x86_64/bits/wordsize.h | 9 +-
libcrypt/sha256.c | 18 +-
libcrypt/sha512.c | 18 +-
libm/ldouble_wrappers.c | 15 +-
libpthread/nptl/pthread_atfork.c | 12 +-
librt/Makefile.in | 3 +
libutil/Makefile.in | 8 +
libutil/logout.c | 2 +-
libutil/logwtmp.c | 2 +-
test/.gitignore | 1 +
test/math/libm-test.inc | 6 -
test/misc/Makefile.in | 4 +
test/misc/tst-utmp.c | 15 ++
test/misc/tst-utmpx.c | 2 +
40 files changed, 322 insertions(+), 258 deletions(-)
create mode 100644 libc/sysdeps/linux/common/getrandom.c
create mode 100644 libc/sysdeps/linux/common/sys/random.h
create mode 100644 test/misc/tst-utmpx.c
diff --git a/Makefile.in b/Makefile.in
index 5d60dda..2233be8 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -294,6 +294,7 @@ HEADERS_RM-$(UCLIBC_HAS_THREADS) += *thread*.h semaphore.h \
bits/initspin.h
HEADERS_RM-$(UCLIBC_HAS_THREADS_NATIVE) += atomic.h bits/atomic.h
HEADERS_RM-$(UCLIBC_HAS_OBSTACK) += obstack.h
+HEADERS_RM-$(UCLIBC_HAS_UTMP) += bits/utmp.h utmp.h
HEADERS_RM-$(UCLIBC_HAS_UTMPX) += bits/utmpx.h utmpx.h
HEADERS_RM-$(UCLIBC_HAS_WCHAR) += wchar.h wctype.h
HEADERS_RM-$(UCLIBC_HAS_WORDEXP) += wordexp.h
@@ -310,6 +311,7 @@ HEADERS_RM-$(UCLIBC_LINUX_SPECIFIC) += \
sys/perm.h \
sys/personality.h \
sys/prctl.h \
+ sys/random.h \
sys/reboot.h \
sys/sendfile.h \
bits/signalfd.h \
diff --git a/Makerules b/Makerules
index a60338a..fd6bb19 100644
--- a/Makerules
+++ b/Makerules
@@ -29,7 +29,9 @@ objs: all_objs
# apply unconditional per-directory flags
define add_IS_IN_lib
ifneq ($(strip $(2)),)
-__add_IS_IN_lib := $(2) $(2:.o=.i) $(2:.os=.i) $(2:.oS=.i)
+__add_IS_IN_lib := $(2)
+__add_IS_IN_lib += $(2:.o=.i) $(2:.os=.i) $(2:.oS=.i)
+__add_IS_IN_lib += $(2:.o=.s) $(2:.os=.s) $(2:.oS=.s)
$$(__add_IS_IN_lib): CFLAGS-for-library-members:=$(CFLAGS-$(1)) -DIN_LIB=$(word 1,$(subst /, ,$(1)))
endif
endef
diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in
index f5210cd..7546e96 100644
--- a/extra/Configs/Config.in
+++ b/extra/Configs/Config.in
@@ -700,6 +700,25 @@ config COMPAT_ATEXIT
Enable this option if you want to update from 0.9.28 to git/0.9.29,
else you will be missing atexit() until you rebuild all apps.
+config UCLIBC_HAS_UTMPX
+ bool "utmpx based support for tracking login/logouts to/from the system"
+ depends on UCLIBC_HAS_UTMP # TODO, remove this, it's backward
+ help
+ Answer y to enable support for accessing user accounting database.
+ It can be used to track all login/logout to the system.
+
+config UCLIBC_HAS_UTMP
+ bool "utmp support (XPG2, SVr4 compat)"
+ help
+ Answer y to enable legacy SVID support for accessing
+ user accounting database:
+ getutent(), getutid(), getutline(), pututline(),
+ setutent(), endutent(), utmpname() in utmp.h
+ It can be used to track all login/logout to the system.
+
+ If unsure, just answer N and use utmpx.h and corresponding
+ POSIX functions.
+
config UCLIBC_SUSV2_LEGACY
bool "Enable SuSv2 LEGACY functions"
help
@@ -1025,7 +1044,7 @@ config UCLIBC_LINUX_SPECIFIC
help
accept4(), bdflush(),
capget(), capset(), eventfd(), fallocate(),
- fstatfs(), inotify_*(), ioperm(), iopl(),
+ fstatfs(), getrandom(), inotify_*(), ioperm(), iopl(),
madvise(), modify_ldt(), pipe2(), personality(),
prctl()/arch_prctl(), pivot_root(), modify_ldt(),
ppoll(), readahead(), reboot(), remap_file_pages(),
@@ -2042,14 +2061,6 @@ config UCLIBC_HAS_GNU_GLOB
Most people will answer N.
-config UCLIBC_HAS_UTMPX
- bool "utmpx based support for tracking login/logouts to/from the system"
- help
- Answer y to enable support for accessing user accounting database.
- It can be used to track all login/logout to the system.
-
- If unsure, just answer N.
-
endmenu
diff --git a/extra/Configs/Config.in.arch b/extra/Configs/Config.in.arch
index 68e03bf..0dae84b 100644
--- a/extra/Configs/Config.in.arch
+++ b/extra/Configs/Config.in.arch
@@ -191,7 +191,7 @@ config UCLIBC_HAS_FENV
config UCLIBC_HAS_LONG_DOUBLE_MATH
bool "Enable long double support"
depends on DO_C99_MATH
- depends on TARGET_i386 || TARGET_m68k || TARGET_sparc || TARGET_x86_64 || TARGET_powerpc || TARGET_sh || TARGET_microblaze || TARGET_xtensa
+ depends on TARGET_aarch64 || TARGET_alpha || TARGET_i386 || TARGET_ia64 || TARGET_m68k || TARGET_powerpc || TARGET_s390 || TARGET_sparc || TARGET_tile || TARGET_x86_64
default y
help
If you want the uClibc math library to contain the full set of C99
diff --git a/extra/scripts/gen_bits_syscall_h.sh b/extra/scripts/gen_bits_syscall_h.sh
index c44cd8f..bfd06b8 100755
--- a/extra/scripts/gen_bits_syscall_h.sh
+++ b/extra/scripts/gen_bits_syscall_h.sh
@@ -23,6 +23,7 @@ fi
case $CC in
*icc*) CC_SYSNUM_ARGS="-dM" ;;
+*clang*) CC_SYSNUM_ARGS="-dM" ;;
*) CC_SYSNUM_ARGS="-dN" ;;
esac
diff --git a/include/utmp.h b/include/utmp.h
index 2908e33..754f767 100644
--- a/include/utmp.h
+++ b/include/utmp.h
@@ -56,29 +56,37 @@ extern void logwtmp (const char *__ut_line, const char *__ut_name,
/* Append entry UTMP to the wtmp-like file WTMP_FILE. */
extern void updwtmp (const char *__wtmp_file, const struct utmp *__utmp)
__THROW;
+libc_hidden_proto(updwtmp)
/* Change name of the utmp file to be examined. */
extern int utmpname (const char *__file) __THROW;
+libc_hidden_proto(utmpname)
/* Read next entry from a utmp-like file. */
extern struct utmp *getutent (void) __THROW;
+libc_hidden_proto(getutent)
/* Reset the input stream to the beginning of the file. */
extern void setutent (void) __THROW;
+libc_hidden_proto(setutent)
/* Close the current open file. */
extern void endutent (void) __THROW;
+libc_hidden_proto(endutent)
/* Search forward from the current point in the utmp file until the
next entry with a ut_type matching ID->ut_type. */
extern struct utmp *getutid (const struct utmp *__id) __THROW;
+libc_hidden_proto(getutid)
/* Search forward from the current point in the utmp file until the
next entry with a ut_line matching LINE->ut_line. */
extern struct utmp *getutline (const struct utmp *__line) __THROW;
+libc_hidden_proto(getutline)
/* Write out entry pointed to by UTMP_PTR into the utmp file. */
extern struct utmp *pututline (const struct utmp *__utmp_ptr) __THROW;
+libc_hidden_proto(pututline)
#if 0 /* def __USE_MISC */
diff --git a/ldso/ldso/sh/dl-syscalls.h b/ldso/ldso/sh/dl-syscalls.h
index f9f13c7..b99a9b5 100644
--- a/ldso/ldso/sh/dl-syscalls.h
+++ b/ldso/ldso/sh/dl-syscalls.h
@@ -1,4 +1,4 @@
-#if __GNUC_PREREQ (4, 1)
+#if __GNUC_PREREQ (4, 1) && !__GNUC_PREREQ (4, 9)
#warning !!! gcc 4.1 and later have problems with __always_inline so redefined as inline
# ifdef __always_inline
# undef __always_inline
diff --git a/libc/misc/utmp/Makefile.in b/libc/misc/utmp/Makefile.in
index 535efb1..715341c 100644
--- a/libc/misc/utmp/Makefile.in
+++ b/libc/misc/utmp/Makefile.in
@@ -7,7 +7,9 @@
subdirs += libc/misc/utmp
-CSRC-y := utent.c wtent.c
+CSRC-y :=
+CSRC-$(if $(findstring y,$(UCLIBC_HAS_UTMP)$(UCLIBC_HAS_UTMPX)),y) += wtent.c
+CSRC-$(UCLIBC_HAS_UTMP) += utent.c
CSRC-$(UCLIBC_HAS_UTMPX) += utxent.c
MISC_UTMP_DIR := $(top_srcdir)libc/misc/utmp
diff --git a/libc/misc/utmp/utent.c b/libc/misc/utmp/utent.c
index a35bb2b..4d71f5e 100644
--- a/libc/misc/utmp/utent.c
+++ b/libc/misc/utmp/utent.c
@@ -1,3 +1,4 @@
+/* vi: set sw=4 ts=4: */
/* utent.c <ndf(a)linux.mit.edu> */
/* Let it be known that this is very possibly the worst standard ever. HP-UX
does one thing, someone else does another, linux another... If anyone
@@ -19,12 +20,9 @@
#include <errno.h>
#include <string.h>
#include <utmp.h>
-#ifdef __UCLIBC_HAS_UTMPX__
-# include <utmpx.h>
-#endif
#include <not-cancel.h>
-
#include <bits/uClibc_mutex.h>
+
__UCLIBC_MUTEX_STATIC(utmplock, PTHREAD_MUTEX_INITIALIZER);
/* Some global crap */
@@ -36,212 +34,174 @@ static const char *static_ut_name = default_file_name;
/* This function must be called with the LOCK held */
static void __setutent_unlocked(void)
{
- if (static_fd < 0) {
- static_fd = open_not_cancel_2(static_ut_name, O_RDWR | O_CLOEXEC);
if (static_fd < 0) {
- static_fd = open_not_cancel_2(static_ut_name, O_RDONLY | O_CLOEXEC);
- if (static_fd < 0) {
- return; /* static_fd remains < 0 */
- }
- }
+ static_fd = open_not_cancel_2(static_ut_name, O_RDWR | O_CLOEXEC);
+ if (static_fd < 0) {
+ static_fd = open_not_cancel_2(static_ut_name, O_RDONLY | O_CLOEXEC);
+ if (static_fd < 0) {
+ return; /* static_fd remains < 0 */
+ }
+ }
#ifndef __ASSUME_O_CLOEXEC
- /* Make sure the file will be closed on exec() */
- fcntl_not_cancel(static_fd, F_SETFD, FD_CLOEXEC);
+ /* Make sure the file will be closed on exec() */
+ fcntl_not_cancel(static_fd, F_SETFD, FD_CLOEXEC);
#endif
- return;
- }
- lseek(static_fd, 0, SEEK_SET);
+ return;
+ }
+ lseek(static_fd, 0, SEEK_SET);
}
#if defined __UCLIBC_HAS_THREADS__
-static void __setutent(void)
+void setutent(void)
{
- __UCLIBC_MUTEX_LOCK(utmplock);
- __setutent_unlocked();
- __UCLIBC_MUTEX_UNLOCK(utmplock);
+ __UCLIBC_MUTEX_LOCK(utmplock);
+ __setutent_unlocked();
+ __UCLIBC_MUTEX_UNLOCK(utmplock);
}
#else
-static void __setutent(void);
-strong_alias(__setutent_unlocked,__setutent)
-#endif
-strong_alias(__setutent,setutent)
-
-#ifdef __UCLIBC_HAS_UTMPX__
-strong_alias(__setutent,setutxent)
+strong_alias(__setutent_unlocked,setutent)
#endif
+libc_hidden_def(setutent)
/* This function must be called with the LOCK held */
static struct utmp *__getutent_unlocked(void)
{
- if (static_fd < 0) {
- __setutent();
if (static_fd < 0) {
- return NULL;
+ __setutent_unlocked();
+ if (static_fd < 0)
+ return NULL;
}
- }
- if (read_not_cancel(static_fd, &static_utmp, sizeof(static_utmp)) == sizeof(static_utmp)) {
- return &static_utmp;
- }
+ if (read_not_cancel(static_fd, &static_utmp,
+ sizeof(static_utmp)) == sizeof(static_utmp)) {
+ return &static_utmp;
+ }
- return NULL;
+ return NULL;
}
#if defined __UCLIBC_HAS_THREADS__
-static struct utmp *__getutent(void)
+struct utmp *getutent(void)
{
- struct utmp *ret;
+ struct utmp *ret;
- __UCLIBC_MUTEX_LOCK(utmplock);
- ret = __getutent_unlocked();
- __UCLIBC_MUTEX_UNLOCK(utmplock);
- return ret;
+ __UCLIBC_MUTEX_LOCK(utmplock);
+ ret = __getutent_unlocked();
+ __UCLIBC_MUTEX_UNLOCK(utmplock);
+ return ret;
}
#else
-static struct utmp *__getutent(void);
-strong_alias(__getutent_unlocked,__getutent)
-#endif
-strong_alias(__getutent,getutent)
-
-#ifdef __UCLIBC_HAS_UTMPX__
-struct utmpx *getutxent(void)
-{
- return (struct utmpx *) __getutent ();
-}
+strong_alias(__getutent_unlocked,getutent)
#endif
+libc_hidden_def(getutent)
static void __endutent(void)
{
- __UCLIBC_MUTEX_LOCK(utmplock);
- if (static_fd >= 0)
- close_not_cancel_no_status(static_fd);
- static_fd = -1;
- __UCLIBC_MUTEX_UNLOCK(utmplock);
+ __UCLIBC_MUTEX_LOCK(utmplock);
+ if (static_fd >= 0)
+ close_not_cancel_no_status(static_fd);
+ static_fd = -1;
+ __UCLIBC_MUTEX_UNLOCK(utmplock);
}
strong_alias(__endutent,endutent)
-
-#ifdef __UCLIBC_HAS_UTMPX__
-strong_alias(__endutent,endutxent)
-#endif
+libc_hidden_def(endutent)
/* This function must be called with the LOCK held */
static struct utmp *__getutid_unlocked(const struct utmp *utmp_entry)
{
- struct utmp *lutmp;
- unsigned type;
-
- /* We use the fact that constants we are interested in are: */
- /* RUN_LVL=1, ... OLD_TIME=4; INIT_PROCESS=5, ... USER_PROCESS=8 */
- type = utmp_entry->ut_type - 1;
- type /= 4;
-
- while ((lutmp = __getutent_unlocked()) != NULL) {
- if (type == 0 && lutmp->ut_type == utmp_entry->ut_type) {
- /* one of RUN_LVL, BOOT_TIME, NEW_TIME, OLD_TIME */
- return lutmp;
- }
- if (type == 1 && strncmp(lutmp->ut_id, utmp_entry->ut_id, sizeof(lutmp->ut_id)) == 0) {
- /* INIT_PROCESS, LOGIN_PROCESS, USER_PROCESS, DEAD_PROCESS */
- return lutmp;
+ struct utmp *lutmp;
+ unsigned type;
+
+ /* We use the fact that constants we are interested in are: */
+ /* RUN_LVL=1, ... OLD_TIME=4; INIT_PROCESS=5, ... USER_PROCESS=8 */
+ type = utmp_entry->ut_type - 1;
+ type /= 4;
+
+ while ((lutmp = __getutent_unlocked()) != NULL) {
+ if (type == 0 && lutmp->ut_type == utmp_entry->ut_type) {
+ /* one of RUN_LVL, BOOT_TIME, NEW_TIME, OLD_TIME */
+ return lutmp;
+ }
+ if (type == 1
+ && strncmp(lutmp->ut_id, utmp_entry->ut_id,
+ sizeof(lutmp->ut_id)) == 0) {
+ /* INIT_PROCESS, LOGIN_PROCESS, USER_PROCESS, DEAD_PROCESS */
+ return lutmp;
+ }
}
- }
- return NULL;
+ return NULL;
}
#if defined __UCLIBC_HAS_THREADS__
-static struct utmp *__getutid(const struct utmp *utmp_entry)
+struct utmp *getutid(const struct utmp *utmp_entry)
{
- struct utmp *ret;
+ struct utmp *ret;
- __UCLIBC_MUTEX_LOCK(utmplock);
- ret = __getutid_unlocked(utmp_entry);
- __UCLIBC_MUTEX_UNLOCK(utmplock);
- return ret;
+ __UCLIBC_MUTEX_LOCK(utmplock);
+ ret = __getutid_unlocked(utmp_entry);
+ __UCLIBC_MUTEX_UNLOCK(utmplock);
+ return ret;
}
#else
-static struct utmp *__getutid(const struct utmp *utmp_entry);
-strong_alias(__getutid_unlocked,__getutid)
+strong_alias(__getutid_unlocked,getutid)
#endif
-strong_alias(__getutid,getutid)
+libc_hidden_def(getutid)
-#ifdef __UCLIBC_HAS_UTMPX__
-struct utmpx *getutxid(const struct utmpx *utmp_entry)
+struct utmp *getutline(const struct utmp *utmp_entry)
{
- return (struct utmpx *) __getutid ((const struct utmp *) utmp_entry);
-}
-#endif
-
-static struct utmp *__getutline(const struct utmp *utmp_entry)
-{
- struct utmp *lutmp;
-
- __UCLIBC_MUTEX_LOCK(utmplock);
- while ((lutmp = __getutent_unlocked()) != NULL) {
- if (lutmp->ut_type == USER_PROCESS || lutmp->ut_type == LOGIN_PROCESS) {
- if (strncmp(lutmp->ut_line, utmp_entry->ut_line, sizeof(lutmp->ut_line)) == 0) {
- break;
- }
+ struct utmp *lutmp;
+
+ __UCLIBC_MUTEX_LOCK(utmplock);
+ while ((lutmp = __getutent_unlocked()) != NULL) {
+ if (lutmp->ut_type == USER_PROCESS || lutmp->ut_type == LOGIN_PROCESS) {
+ if (strncmp(lutmp->ut_line, utmp_entry->ut_line,
+ sizeof(lutmp->ut_line)) == 0) {
+ break;
+ }
+ }
}
- }
- __UCLIBC_MUTEX_UNLOCK(utmplock);
- return lutmp;
+ __UCLIBC_MUTEX_UNLOCK(utmplock);
+ return lutmp;
}
-strong_alias(__getutline,getutline)
-
-#ifdef __UCLIBC_HAS_UTMPX__
-struct utmpx *getutxline(const struct utmpx *utmp_entry)
-{
- return (struct utmpx *) __getutline ((const struct utmp *) utmp_entry);
-}
-#endif
+libc_hidden_def(getutline)
-static struct utmp *__pututline(const struct utmp *utmp_entry)
+struct utmp *pututline(const struct utmp *utmp_entry)
{
- __UCLIBC_MUTEX_LOCK(utmplock);
- /* Ignore the return value. That way, if they've already positioned
- the file pointer where they want it, everything will work out. */
- lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR);
-
- if (__getutid_unlocked(utmp_entry) != NULL)
+ __UCLIBC_MUTEX_LOCK(utmplock);
+ /* Ignore the return value. That way, if they've already positioned
+ the file pointer where they want it, everything will work out. */
lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR);
- else
- lseek(static_fd, (off_t) 0, SEEK_END);
- if (write(static_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp))
- utmp_entry = NULL;
- __UCLIBC_MUTEX_UNLOCK(utmplock);
- return (struct utmp *)utmp_entry;
-}
-strong_alias(__pututline,pututline)
+ if (__getutid_unlocked(utmp_entry) != NULL)
+ lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR);
+ else
+ lseek(static_fd, (off_t) 0, SEEK_END);
+ if (write(static_fd, utmp_entry, sizeof(struct utmp))
+ != sizeof(struct utmp))
+ utmp_entry = NULL;
-#ifdef __UCLIBC_HAS_UTMPX__
-struct utmpx *pututxline (const struct utmpx *utmp_entry)
-{
- return (struct utmpx *) __pututline ((const struct utmp *) utmp_entry);
+ __UCLIBC_MUTEX_UNLOCK(utmplock);
+ return (struct utmp *)utmp_entry;
}
-#endif
+libc_hidden_def(pututline)
-static int __utmpname(const char *new_ut_name)
+int utmpname(const char *new_ut_name)
{
- __UCLIBC_MUTEX_LOCK(utmplock);
- if (new_ut_name != NULL) {
- if (static_ut_name != default_file_name)
- free((char *)static_ut_name);
- static_ut_name = strdup(new_ut_name);
- if (static_ut_name == NULL) {
- /* We should probably whine about out-of-memory
- * errors here... Instead just reset to the default */
- static_ut_name = default_file_name;
+ __UCLIBC_MUTEX_LOCK(utmplock);
+ if (new_ut_name != NULL) {
+ if (static_ut_name != default_file_name)
+ free((char *)static_ut_name);
+ static_ut_name = strdup(new_ut_name);
+ if (static_ut_name == NULL) {
+ /* We should probably whine about out-of-memory
+ * errors here... Instead just reset to the default */
+ static_ut_name = default_file_name;
+ }
}
- }
- if (static_fd >= 0) {
- close_not_cancel_no_status(static_fd);
- static_fd = -1;
- }
- __UCLIBC_MUTEX_UNLOCK(utmplock);
- return 0; /* or maybe return -(static_ut_name != new_ut_name)? */
+ if (static_fd >= 0) {
+ close_not_cancel_no_status(static_fd);
+ static_fd = -1;
+ }
+ __UCLIBC_MUTEX_UNLOCK(utmplock);
+ return 0; /* or maybe return -(static_ut_name != new_ut_name)? */
}
-strong_alias(__utmpname,utmpname)
-
-#ifdef __UCLIBC_HAS_UTMPX__
-strong_alias(__utmpname,utmpxname)
-#endif
+libc_hidden_def(utmpname)
diff --git a/libc/misc/utmp/utxent.c b/libc/misc/utmp/utxent.c
index 71157cc..c32e4da 100644
--- a/libc/misc/utmp/utxent.c
+++ b/libc/misc/utmp/utxent.c
@@ -1,3 +1,4 @@
+/* vi: set sw=4 ts=4: */
/*
* utexent.c : Support for accessing user accounting database.
* Copyright (C) 2010 STMicroelectronics Ltd.
@@ -13,7 +14,6 @@
#include <utmpx.h>
#include <utmp.h>
-#if 0 /* moved to utent.c */
void setutxent(void)
{
setutent ();
@@ -49,12 +49,10 @@ int utmpxname (const char *new_ut_name)
return utmpname (new_ut_name);
}
-/* moved to wtent.c */
void updwtmpx (const char *wtmpx_file, const struct utmpx *utmpx)
{
updwtmp (wtmpx_file, (const struct utmp *) utmpx);
}
-#endif
/* Copy the information in UTMPX to UTMP. */
void getutmp (const struct utmpx *utmpx, struct utmp *utmp)
@@ -107,3 +105,4 @@ void getutmpx (const struct utmp *utmp, struct utmpx *utmpx)
utmpx->ut_time = utmp->ut_time;
#endif
}
+
diff --git a/libc/misc/utmp/wtent.c b/libc/misc/utmp/wtent.c
index 9b3ad50..30939ea 100644
--- a/libc/misc/utmp/wtent.c
+++ b/libc/misc/utmp/wtent.c
@@ -1,3 +1,4 @@
+/* vi: set sw=4 ts=4: */
/*
* Copyright (C) 2000-2006 Erik Andersen <andersen(a)uclibc.org>
*
@@ -11,9 +12,6 @@
#include <time.h>
#include <unistd.h>
#include <utmp.h>
-#ifdef __UCLIBC_HAS_UTMPX__
-# include <utmpx.h>
-#endif
#include <fcntl.h>
#include <sys/file.h>
#include <not-cancel.h>
@@ -36,7 +34,7 @@ void logwtmp (const char *line, const char *name, const char *host)
}
#endif
-static void __updwtmp(const char *wtmp_file, const struct utmp *lutmp)
+void updwtmp(const char *wtmp_file, const struct utmp *lutmp)
{
int fd;
@@ -49,11 +47,4 @@ static void __updwtmp(const char *wtmp_file, const struct utmp *lutmp)
}
}
}
-strong_alias(__updwtmp,updwtmp)
-
-#ifdef __UCLIBC_HAS_UTMPX__
-void updwtmpx (const char *wtmpx_file, const struct utmpx *utmpx)
-{
- __updwtmp (wtmpx_file, (const struct utmp *) utmpx);
-}
-#endif
+libc_hidden_def(updwtmp)
diff --git a/libc/stdio/_fpmaxtostr.h b/libc/stdio/_fpmaxtostr.h
index b4e7321..7694629 100644
--- a/libc/stdio/_fpmaxtostr.h
+++ b/libc/stdio/_fpmaxtostr.h
@@ -11,39 +11,39 @@
#define _FPMAXTOSTR_H 1
#include <features.h>
-#ifdef __UCLIBC_HAS_FLOATS__
-
#define __need_size_t
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <printf.h>
#include <sys/types.h>
-#include <float.h>
-#include <bits/uClibc_fpmax.h>
+
+#ifdef __UCLIBC_HAS_FLOATS__
+# include <float.h>
+# include <bits/uClibc_fpmax.h>
/* WARNING: Adjust _fp_out_wide() in _vfprintf.c if this changes! */
/* With 32 bit ints, we can get 9 decimal digits per block. */
-#define DIGITS_PER_BLOCK 9
+# define DIGITS_PER_BLOCK 9
-#define NUM_DIGIT_BLOCKS ((DECIMAL_DIG+DIGITS_PER_BLOCK-1)/DIGITS_PER_BLOCK)
+# define NUM_DIGIT_BLOCKS ((DECIMAL_DIG+DIGITS_PER_BLOCK-1)/DIGITS_PER_BLOCK)
/* WARNING: Adjust _fp_out_wide() in _vfprintf.c if this changes! */
/* extra space for '-', '.', 'e+###', and nul */
-#define BUF_SIZE ( 3 + NUM_DIGIT_BLOCKS * DIGITS_PER_BLOCK )
+# define BUF_SIZE ( 3 + NUM_DIGIT_BLOCKS * DIGITS_PER_BLOCK )
/* psm: why do these internals differ? */
-#ifdef __USE_OLD_VFPRINTF__
+# ifdef __USE_OLD_VFPRINTF__
typedef void (__fp_outfunc_t)(FILE *fp, intptr_t type, intptr_t len, intptr_t buf);
extern size_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info,
__fp_outfunc_t fp_outfunc) attribute_hidden;
-#else
+# else
typedef size_t (__fp_outfunc_t)(FILE *fp, intptr_t type, intptr_t len, intptr_t buf);
extern ssize_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info,
__fp_outfunc_t fp_outfunc) attribute_hidden;
-#endif
+# endif
-#endif /* __UCLIBC_HAS_FLOATS__ */
+# endif /* __UCLIBC_HAS_FLOATS__ */
#endif /* _FPMAXTOSTR_H */
diff --git a/libc/stdio/_vfprintf.c b/libc/stdio/_vfprintf.c
index 01ee218..a795f49 100644
--- a/libc/stdio/_vfprintf.c
+++ b/libc/stdio/_vfprintf.c
@@ -121,18 +121,6 @@
#error Apparently, LONG_LONG_MAX is defined but LLONG_MAX is not. You need to fix your toolchain headers to support the standard macros for (unsigned) long long.
#endif
-/**********************************************************************/
-/* These provide some control over printf's feature set */
-
-/* Now controlled by uClibc_config.h. */
-/* #define __UCLIBC_HAS_FLOATS__ 1 */
-
-/* Now controlled by uClibc_config.h. */
-/* #define __UCLIBC_HAS_PRINTF_M_SPEC__ */
-
-
-/**********************************************************************/
-
#include "_fpmaxtostr.h"
#undef __STDIO_HAS_VSNPRINTF
@@ -142,9 +130,6 @@
/**********************************************************************/
-/* Now controlled by uClibc_config.h. */
-/* #define __UCLIBC_HAS_GLIBC_CUSTOM_PRINTF__ */
-
#ifdef __UCLIBC_MJN3_ONLY__
# ifdef L_register_printf_function
/* emit only once */
diff --git a/libc/stdlib/Makefile.in b/libc/stdlib/Makefile.in
index 880de78..071f911 100644
--- a/libc/stdlib/Makefile.in
+++ b/libc/stdlib/Makefile.in
@@ -61,7 +61,6 @@ CSRC-$(if $(findstring yyy,$(UCLIBC_HAS_FLOATS)$(UCLIBC_HAS_WCHAR)$(UCLIBC_HAS_X
# multi source _atexit.c
CSRC-y += __cxa_atexit.c __cxa_finalize.c __exit_handler.c exit.c on_exit.c
-CSRC-$(COMPAT_ATEXIT) += old_atexit.c
STDLIB_DIR := $(top_srcdir)libc/stdlib
STDLIB_OUT := $(top_builddir)libc/stdlib
@@ -71,11 +70,12 @@ STDLIB_OBJ := $(patsubst %.c,$(STDLIB_OUT)/%.o,$(CSRC-y))
libc-y += $(STDLIB_OBJ)
libc-static-y += $(STDLIB_OUT)/atexit.o $(STDLIB_OUT)/system.o
+libc-static-$(COMPAT_ATEXIT) += $(STDLIB_OUT)/old_atexit.o
libc-shared-y += $(STDLIB_OUT)/system.oS
# this should always be the PIC version, because it could be used in shared libs
libc-nonshared-y += $(STDLIB_OUT)/atexit.os
-
+libc-nonshared-$(COMPAT_ATEXIT) += $(STDLIB_OUT)/old_atexit.os
libc-nomulti-y += $(STDLIB_OUT)/labs.o $(STDLIB_OUT)/atol.o $(STDLIB_OUT)/_stdlib_strto_l.o $(STDLIB_OUT)/_stdlib_strto_ll.o
libc-nomulti-$(UCLIBC_HAS_XLOCALE) += $(STDLIB_OUT)/_stdlib_strto_l_l.o $(STDLIB_OUT)/_stdlib_strto_ll_l.o
diff --git a/libc/sysdeps/linux/arm/Makefile.arch b/libc/sysdeps/linux/arm/Makefile.arch
index 3054273..cda3db2 100644
--- a/libc/sysdeps/linux/arm/Makefile.arch
+++ b/libc/sysdeps/linux/arm/Makefile.arch
@@ -13,7 +13,9 @@ SSRC-y := \
vfork.S clone.S
SSRC-$(UCLIBC_HAS_LFS) += mmap64.S
-SSRC-$(UCLIBC_HAS_THREADS_NATIVE) += libc-aeabi_read_tp.S libc-thumb_atomics.S
+SSRC-$(UCLIBC_HAS_THREADS_NATIVE) += libc-thumb_atomics.S
+libc-nonshared-$(UCLIBC_HAS_THREADS_NATIVE) += $(ARCH_OUT)/libc-aeabi_read_tp.os
+libc-static-$(UCLIBC_HAS_THREADS_NATIVE) += $(ARCH_OUT)/libc-aeabi_read_tp.o
CSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += makecontext.c
SSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += getcontext.S setcontext.S swapcontext.S
diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in
index 8ee956b..8252598 100644
--- a/libc/sysdeps/linux/common/Makefile.in
+++ b/libc/sysdeps/linux/common/Makefile.in
@@ -27,6 +27,7 @@ CSRC-$(UCLIBC_LINUX_SPECIFIC) += \
eventfd.c \
eventfd_read.c \
eventfd_write.c \
+ getrandom.c \
inotify.c \
ioperm.c \
iopl.c \
diff --git a/libc/sysdeps/linux/common/bits/kernel-features.h b/libc/sysdeps/linux/common/bits/kernel-features.h
index 6184c2b..708bb49 100644
--- a/libc/sysdeps/linux/common/bits/kernel-features.h
+++ b/libc/sysdeps/linux/common/bits/kernel-features.h
@@ -507,3 +507,8 @@
#if defined __x86_64__ && __LINUX_KERNEL_VERSION >= 0x030100
# define __ASSUME_GETCPU_SYSCALL 1
#endif
+
+/* getrandom syscall (widely) appeared around 4.0.0 */
+#if __LINUX_KERNEL_VERSION >= 0x040000
+# define __ASSUME_GETRANDOM_SYSCALL 1
+#endif
diff --git a/libc/sysdeps/linux/common/bits/utmp.h b/libc/sysdeps/linux/common/bits/utmp.h
index c13380a..6ece31e 100644
--- a/libc/sysdeps/linux/common/bits/utmp.h
+++ b/libc/sysdeps/linux/common/bits/utmp.h
@@ -36,7 +36,7 @@
previous logins. */
struct lastlog
{
-#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
+#ifdef __WORDSIZE_TIME64_COMPAT32
int32_t ll_time;
#else
__time_t ll_time;
@@ -69,7 +69,7 @@ struct utmp
/* The ut_session and ut_tv fields must be the same size when compiled
32- and 64-bit. This allows data files and shared memory to be
shared between 32- and 64-bit applications. */
-#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
+#ifdef __WORDSIZE_TIME64_COMPAT32
int32_t ut_session; /* Session ID, used for windowing. */
struct
{
diff --git a/libc/sysdeps/linux/common/bits/utmpx.h b/libc/sysdeps/linux/common/bits/utmpx.h
index 87626f0..815fc90 100644
--- a/libc/sysdeps/linux/common/bits/utmpx.h
+++ b/libc/sysdeps/linux/common/bits/utmpx.h
@@ -66,7 +66,7 @@ struct utmpx
/* The fields ut_session and ut_tv must be the same size when compiled
32- and 64-bit. This allows files and shared memory to be shared
between 32- and 64-bit applications. */
-#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
+#ifdef __WORDSIZE_TIME64_COMPAT32
__int32_t ut_session; /* Session ID, used for windowing. */
struct
{
diff --git a/libc/sysdeps/linux/common/getrandom.c b/libc/sysdeps/linux/common/getrandom.c
new file mode 100644
index 0000000..d33d522
--- /dev/null
+++ b/libc/sysdeps/linux/common/getrandom.c
@@ -0,0 +1,14 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * getrandom() for uClibc
+ *
+ * Copyright (C) 2015 Bernhard Reutner-Fischer
+ *
+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
+ */
+
+#include <sys/syscall.h>
+#include <sys/random.h>
+#ifdef __NR_getrandom
+_syscall3(int, getrandom, void *, buf, size_t, buflen, unsigned int, flags)
+#endif
diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c
index 2c50307..19a3371 100644
--- a/libc/sysdeps/linux/common/stubs.c
+++ b/libc/sysdeps/linux/common/stubs.c
@@ -157,6 +157,10 @@ make_stub(getpeername)
make_stub(getpgrp)
#endif
+#if !defined __NR_getrandom && defined __UCLIBC_LINUX_SPECIFIC__
+make_stub(getrandom)
+#endif
+
#if !defined __NR_getsockname && !defined __NR_socketcall && defined __UCLIBC_HAS_SOCKET__
make_stub(getsockname)
#endif
diff --git a/libc/sysdeps/linux/common/sys/random.h b/libc/sysdeps/linux/common/sys/random.h
new file mode 100644
index 0000000..42f8025
--- /dev/null
+++ b/libc/sysdeps/linux/common/sys/random.h
@@ -0,0 +1,33 @@
+/* Copyright (C) 2015 Bernhard Reutner-Fischer
+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
+*/
+
+#ifndef _SYS_RANDOM_H
+#define _SYS_RANDOM_H 1
+#include <features.h>
+
+__BEGIN_DECLS
+
+#if defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU
+# if 0 /*def __ASSUME_GETRANDOM_SYSCALL */
+# include <linux/random.h>
+# else
+# undef GRND_NONBLOCK
+# undef GRND_RANDOM
+/*
+ * Flags for getrandom(2)
+ *
+ * GRND_NONBLOCK Don't block and return EAGAIN instead
+ * GRND_RANDOM Use the /dev/random pool instead of /dev/urandom
+ */
+# define GRND_NONBLOCK 0x0001
+# define GRND_RANDOM 0x0002
+# endif
+/* FIXME: aren't there a couple of __restrict and const missing ? */
+extern int getrandom(void *__buf, size_t count, unsigned int flags)
+ __nonnull ((1)) __wur;
+#endif
+
+__END_DECLS
+
+#endif /* sys/random.h */
diff --git a/libc/sysdeps/linux/mips/bits/mathdef.h b/libc/sysdeps/linux/mips/bits/mathdef.h
index 1c636a1..6afe20d 100644
--- a/libc/sysdeps/linux/mips/bits/mathdef.h
+++ b/libc/sysdeps/linux/mips/bits/mathdef.h
@@ -25,10 +25,9 @@
#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
# define _MATH_H_MATHDEF 1
-/* Normally, there is no long double type and the `float' and `double'
- expressions are evaluated as `double'. */
-typedef double float_t; /* `float' expressions are evaluated as
- `double'. */
+/* MIPS has both `float' and `double' arithmetic. */
+typedef float float_t; /* `float' expressions are evaluated as
+ `float'. */
typedef double double_t; /* `double' expressions are evaluated as
`double'. */
diff --git a/libc/sysdeps/linux/mips/bits/wordsize.h b/libc/sysdeps/linux/mips/bits/wordsize.h
index 39e1506..fe13080 100644
--- a/libc/sysdeps/linux/mips/bits/wordsize.h
+++ b/libc/sysdeps/linux/mips/bits/wordsize.h
@@ -16,3 +16,6 @@
<http://www.gnu.org/licenses/>. */
#define __WORDSIZE _MIPS_SZPTR
+#if _MIPS_SIM == _ABI64
+# define __WORDSIZE_TIME64_COMPAT32 1
+#endif
diff --git a/libc/sysdeps/linux/powerpc/bits/wordsize.h b/libc/sysdeps/linux/powerpc/bits/wordsize.h
index cf93423..3e8a1e0 100644
--- a/libc/sysdeps/linux/powerpc/bits/wordsize.h
+++ b/libc/sysdeps/linux/powerpc/bits/wordsize.h
@@ -2,7 +2,7 @@
#if defined __powerpc64__
# define __WORDSIZE 64
-# define __WORDSIZE_COMPAT32 1
+# define __WORDSIZE_TIME64_COMPAT32 1
#else
# define __WORDSIZE 32
#endif
diff --git a/libc/sysdeps/linux/sparc/bits/wordsize.h b/libc/sysdeps/linux/sparc/bits/wordsize.h
index c0e600e..aa15dbc 100644
--- a/libc/sysdeps/linux/sparc/bits/wordsize.h
+++ b/libc/sysdeps/linux/sparc/bits/wordsize.h
@@ -2,6 +2,7 @@
#if defined __arch64__ || defined __sparcv9
# define __WORDSIZE 64
+# define __WORDSIZE_TIME64_COMPAT32 1
#else
# define __WORDSIZE 32
#endif
diff --git a/libc/sysdeps/linux/x86_64/bits/wordsize.h b/libc/sysdeps/linux/x86_64/bits/wordsize.h
index e555241..9db982c 100644
--- a/libc/sysdeps/linux/x86_64/bits/wordsize.h
+++ b/libc/sysdeps/linux/x86_64/bits/wordsize.h
@@ -1,9 +1,12 @@
/* Determine the wordsize from the preprocessor defines. */
-#if defined __x86_64__
+#if defined __x86_64__ && !defined __ILP32__
# define __WORDSIZE 64
-/* This makes /var/run/utmp compatible with 32-bit environment: */
-# define __WORDSIZE_COMPAT32 1
#else
# define __WORDSIZE 32
#endif
+
+#ifdef __x86_64__
+/* This makes /var/run/utmp compatible with 32-bit environment: */
+# define __WORDSIZE_TIME64_COMPAT32 1
+#endif
diff --git a/libcrypt/sha256.c b/libcrypt/sha256.c
index 6bc2d8b..3e12b5c 100644
--- a/libcrypt/sha256.c
+++ b/libcrypt/sha256.c
@@ -108,12 +108,12 @@ sha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx)
uint32_t h_save = h;
/* Operators defined in FIPS 180-2:4.1.2. */
-#define Ch(x, y, z) ((x & y) ^ (~x & z))
-#define Maj(x, y, z) ((x & y) ^ (x & z) ^ (y & z))
-#define S0(x) (CYCLIC (x, 2) ^ CYCLIC (x, 13) ^ CYCLIC (x, 22))
-#define S1(x) (CYCLIC (x, 6) ^ CYCLIC (x, 11) ^ CYCLIC (x, 25))
-#define R0(x) (CYCLIC (x, 7) ^ CYCLIC (x, 18) ^ (x >> 3))
-#define R1(x) (CYCLIC (x, 17) ^ CYCLIC (x, 19) ^ (x >> 10))
+#define _Ch(x, y, z) ((x & y) ^ (~x & z))
+#define _Maj(x, y, z) ((x & y) ^ (x & z) ^ (y & z))
+#define _S0(x) (CYCLIC (x, 2) ^ CYCLIC (x, 13) ^ CYCLIC (x, 22))
+#define _S1(x) (CYCLIC (x, 6) ^ CYCLIC (x, 11) ^ CYCLIC (x, 25))
+#define _R0(x) (CYCLIC (x, 7) ^ CYCLIC (x, 18) ^ (x >> 3))
+#define _R1(x) (CYCLIC (x, 17) ^ CYCLIC (x, 19) ^ (x >> 10))
/* It is unfortunate that C does not provide an operator for
cyclic rotation. Hope the C compiler is smart enough. */
@@ -126,13 +126,13 @@ sha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx)
++words;
}
for (unsigned int t = 16; t < 64; ++t)
- W[t] = R1 (W[t - 2]) + W[t - 7] + R0 (W[t - 15]) + W[t - 16];
+ W[t] = _R1 (W[t - 2]) + W[t - 7] + _R0 (W[t - 15]) + W[t - 16];
/* The actual computation according to FIPS 180-2:6.2.2 step 3. */
for (unsigned int t = 0; t < 64; ++t)
{
- uint32_t T1 = h + S1 (e) + Ch (e, f, g) + K[t] + W[t];
- uint32_t T2 = S0 (a) + Maj (a, b, c);
+ uint32_t T1 = h + _S1 (e) + _Ch (e, f, g) + K[t] + W[t];
+ uint32_t T2 = _S0 (a) + _Maj (a, b, c);
h = g;
g = f;
f = e;
diff --git a/libcrypt/sha512.c b/libcrypt/sha512.c
index 079caee..b2e36a3 100644
--- a/libcrypt/sha512.c
+++ b/libcrypt/sha512.c
@@ -139,12 +139,12 @@ sha512_process_block (const void *buffer, size_t len, struct sha512_ctx *ctx)
uint64_t h_save = h;
/* Operators defined in FIPS 180-2:4.1.2. */
-#define Ch(x, y, z) ((x & y) ^ (~x & z))
-#define Maj(x, y, z) ((x & y) ^ (x & z) ^ (y & z))
-#define S0(x) (CYCLIC (x, 28) ^ CYCLIC (x, 34) ^ CYCLIC (x, 39))
-#define S1(x) (CYCLIC (x, 14) ^ CYCLIC (x, 18) ^ CYCLIC (x, 41))
-#define R0(x) (CYCLIC (x, 1) ^ CYCLIC (x, 8) ^ (x >> 7))
-#define R1(x) (CYCLIC (x, 19) ^ CYCLIC (x, 61) ^ (x >> 6))
+#define _Ch(x, y, z) ((x & y) ^ (~x & z))
+#define _Maj(x, y, z) ((x & y) ^ (x & z) ^ (y & z))
+#define _S0(x) (CYCLIC (x, 28) ^ CYCLIC (x, 34) ^ CYCLIC (x, 39))
+#define _S1(x) (CYCLIC (x, 14) ^ CYCLIC (x, 18) ^ CYCLIC (x, 41))
+#define _R0(x) (CYCLIC (x, 1) ^ CYCLIC (x, 8) ^ (x >> 7))
+#define _R1(x) (CYCLIC (x, 19) ^ CYCLIC (x, 61) ^ (x >> 6))
/* It is unfortunate that C does not provide an operator for
cyclic rotation. Hope the C compiler is smart enough. */
@@ -157,13 +157,13 @@ sha512_process_block (const void *buffer, size_t len, struct sha512_ctx *ctx)
++words;
}
for (unsigned int t = 16; t < 80; ++t)
- W[t] = R1 (W[t - 2]) + W[t - 7] + R0 (W[t - 15]) + W[t - 16];
+ W[t] = _R1 (W[t - 2]) + W[t - 7] + _R0 (W[t - 15]) + W[t - 16];
/* The actual computation according to FIPS 180-2:6.3.2 step 3. */
for (unsigned int t = 0; t < 80; ++t)
{
- uint64_t T1 = h + S1 (e) + Ch (e, f, g) + K[t] + W[t];
- uint64_t T2 = S0 (a) + Maj (a, b, c);
+ uint64_t T1 = h + _S1 (e) + _Ch (e, f, g) + K[t] + W[t];
+ uint64_t T2 = _S0 (a) + _Maj (a, b, c);
h = g;
g = f;
f = e;
diff --git a/libm/ldouble_wrappers.c b/libm/ldouble_wrappers.c
index b4215cb..840293f 100644
--- a/libm/ldouble_wrappers.c
+++ b/libm/ldouble_wrappers.c
@@ -16,27 +16,28 @@
#include "math.h"
#include <complex.h>
-#define WRAPPER1(func) \
+#if !defined __NO_LONG_DOUBLE_MATH
+# define WRAPPER1(func) \
long double func##l(long double x) \
{ \
return (long double) func((double) x); \
}
-#define WRAPPER2(func) \
+# define WRAPPER2(func) \
long double func##l(long double x, long double y) \
{ \
return (long double) func((double) x, (double) y); \
}
-#define int_WRAPPER1(func) \
+# define int_WRAPPER1(func) \
int func##l(long double x) \
{ \
return func((double) x); \
}
-#define long_WRAPPER1(func) \
+# define long_WRAPPER1(func) \
long func##l(long double x) \
{ \
return func((double) x); \
}
-#define long_long_WRAPPER1(func) \
+# define long_long_WRAPPER1(func) \
long long func##l(long double x) \
{ \
return func((double) x); \
@@ -447,4 +448,6 @@ int_WRAPPER1(__isinf)
libm_hidden_def(__isinfl)
# endif
-#endif
+#endif /* __DO_C99_MATH__ */
+
+#endif /* __NO_LONG_DOUBLE_MATH */
diff --git a/libpthread/nptl/pthread_atfork.c b/libpthread/nptl/pthread_atfork.c
index 3c12cd4..39ac3e2 100644
--- a/libpthread/nptl/pthread_atfork.c
+++ b/libpthread/nptl/pthread_atfork.c
@@ -37,13 +37,17 @@
#include <fork.h>
/* This is defined by newer gcc version unique for each module. */
-extern void *__dso_handle __attribute__ ((__weak__));
- //,__visibility__ ("hidden")));
+extern void *__dso_handle __attribute__ ((__weak__,
+ __visibility__ ("hidden")));
/* Hide the symbol so that no definition but the one locally in the
executable or DSO is used. */
int
+#ifndef __pthread_atfork
+/* Don't mark the compatibility function as hidden. */
+attribute_hidden
+#endif
__pthread_atfork (
void (*prepare) (void),
void (*parent) (void),
@@ -52,4 +56,8 @@ __pthread_atfork (
return __register_atfork (prepare, parent, child,
&__dso_handle == NULL ? NULL : __dso_handle);
}
+#ifndef __pthread_atfork
+extern int pthread_atfork (void (*prepare) (void), void (*parent) (void),
+ void (*child) (void)) attribute_hidden;
strong_alias (__pthread_atfork, pthread_atfork)
+#endif
diff --git a/librt/Makefile.in b/librt/Makefile.in
index 8555e94..fbbf5b4 100644
--- a/librt/Makefile.in
+++ b/librt/Makefile.in
@@ -15,6 +15,9 @@ LIBS-librt.so := $(LIBS)
ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
LIBS-librt.so += $(top_builddir)lib/libdl.so $(top_builddir)lib/libpthread.so
endif
+START_FILE-librt.so := $(SHARED_START_FILES)
+END_FILE-librt.so := $(SHARED_END_FILES)
+
librt_FULL_NAME := librt-$(VERSION).so
diff --git a/libutil/Makefile.in b/libutil/Makefile.in
index f904fc7..98b178e 100644
--- a/libutil/Makefile.in
+++ b/libutil/Makefile.in
@@ -27,6 +27,14 @@ ifneq ($(UCLIBC_HAS_PTY),y)
libutil_SRC := $(filter-out $(libutil_DIR)/openpty.c $(libutil_DIR)/forkpty.c \
,$(libutil_SRC))
endif
+ifeq ($(UCLIBC_HAS_UTMP)$(UCLIBC_HAS_UTMPX),)
+libutil_SRC := $(filter-out \
+ $(libutil_DIR)/logwtmp.c \
+ $(libutil_DIR)/login.c \
+ $(libutil_DIR)/logout.c \
+ ,$(libutil_SRC))
+endif
+
libutil_OBJ := $(patsubst $(libutil_DIR)/%.c,$(libutil_OUT)/%.o,$(libutil_SRC))
ifeq ($(DOPIC),y)
diff --git a/libutil/logout.c b/libutil/logout.c
index 9c7440b..4580455 100644
--- a/libutil/logout.c
+++ b/libutil/logout.c
@@ -50,7 +50,7 @@ logout (const char *line)
memset (ut->ut_host, 0, sizeof ut->ut_host);
#endif
#if _HAVE_UT_TV - 0
-# if !defined __WORDSIZE_COMPAT32 || __WORDSIZE_COMPAT32 == 0
+# if !defined __WORDSIZE_TIME64_COMPAT32
gettimeofday (&ut->ut_tv, NULL);
# else
{
diff --git a/libutil/logwtmp.c b/libutil/logwtmp.c
index 2a6f28a..6a53b5f 100644
--- a/libutil/logwtmp.c
+++ b/libutil/logwtmp.c
@@ -23,7 +23,7 @@ void logwtmp(const char *line, const char *name, const char *host)
strncpy(lutmp.ut_line, line, sizeof(lutmp.ut_line)-1);
strncpy(lutmp.ut_name, name, sizeof(lutmp.ut_name)-1);
strncpy(lutmp.ut_host, host, sizeof(lutmp.ut_host)-1);
-#if !defined __WORDSIZE_COMPAT32 || __WORDSIZE_COMPAT32 == 0
+#if !defined __WORDSIZE_TIME64_COMPAT32
gettimeofday(&lutmp.ut_tv, NULL);
#else
{
diff --git a/test/.gitignore b/test/.gitignore
index 5944f0a..beb5095 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -163,6 +163,7 @@ misc/tst-seekdir
misc/tst-statfs
misc/tst-statvfs
misc/tst-utmp
+misc/tst-utmpx
mmap/mmap
mmap/mmap2
mmap/mmap64
diff --git a/test/math/libm-test.inc b/test/math/libm-test.inc
index 8f0db3c..f50b48b 100644
--- a/test/math/libm-test.inc
+++ b/test/math/libm-test.inc
@@ -3418,8 +3418,6 @@ log1p_test (void)
END (log1p);
}
-
-#if 0
static void
log2_test (void)
{
@@ -3449,8 +3447,6 @@ log2_test (void)
END (log2);
}
-#endif
-
static void
logb_test (void)
@@ -4968,9 +4964,7 @@ main (int argc, char **argv)
log_test ();
log10_test ();
log1p_test ();
-#if 0
log2_test ();
-#endif
logb_test ();
modf_test ();
ilogb_test ();
diff --git a/test/misc/Makefile.in b/test/misc/Makefile.in
index 1e0da6f..2fb9652 100644
--- a/test/misc/Makefile.in
+++ b/test/misc/Makefile.in
@@ -16,6 +16,10 @@ ifeq ($(UCLIBC_HAS_GLOB),)
TESTS_DISABLED += bug-glob2
endif
+ifeq ($(UCLIBC_HAS_UTMPX),)
+TESTS_DISABLED += tst-utmpx
+endif
+
DODIFF_dirent := 1
DODIFF_dirent64 := 1
DODIFF_tst-statfs := 1
diff --git a/test/misc/tst-utmp.c b/test/misc/tst-utmp.c
index 08a6f8e..1b0333a 100644
--- a/test/misc/tst-utmp.c
+++ b/test/misc/tst-utmp.c
@@ -37,6 +37,21 @@
# include <utmp.h>
#endif
+#ifndef _HAVE_UT_TYPE
+# define _HAVE_UT_TYPE 0
+#endif
+#ifndef _HAVE_UT_PID
+# define _HAVE_UT_PID 0
+#endif
+#ifndef _HAVE_UT_ID
+# define _HAVE_UT_ID 0
+#endif
+#ifndef _HAVE_UT_TV
+# define _HAVE_UT_TV 0
+#endif
+#ifndef _HAVE_UT_HOST
+# define _HAVE_UT_HOST 0
+#endif
#if _HAVE_UT_TYPE || defined UTMPX
diff --git a/test/misc/tst-utmpx.c b/test/misc/tst-utmpx.c
new file mode 100644
index 0000000..edb5551
--- /dev/null
+++ b/test/misc/tst-utmpx.c
@@ -0,0 +1,2 @@
+#define UTMPX
+#include "tst-utmp.c"
hooks/post-receive
--
uClibc-ng - small C library for embedded systems
1
0

uClibc-ng - small C library for embedded systems branch master updated. 0d3dfd0f8e8f8acdea157b87b372d79ae7b512f0
by wbx@helium.waldemar-brodkorb.de 22 Mar '15
by wbx@helium.waldemar-brodkorb.de 22 Mar '15
22 Mar '15
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".
The branch, master has been updated
via 0d3dfd0f8e8f8acdea157b87b372d79ae7b512f0 (commit)
from 4ad33b2f16f3c537226698c961b488162b8fc548 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 0d3dfd0f8e8f8acdea157b87b372d79ae7b512f0
Author: Waldemar Brodkorb <wbx(a)openadk.org>
Date: Sun Mar 8 14:00:06 2015 -0500
okay, chicken-egg-problem solved really now. (was xtensa no thread failure)
-----------------------------------------------------------------------
Summary of changes:
ldso/ldso/xtensa/dl-tlsdesc.S | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/ldso/ldso/xtensa/dl-tlsdesc.S b/ldso/ldso/xtensa/dl-tlsdesc.S
index f1bbf41..0638af4 100644
--- a/ldso/ldso/xtensa/dl-tlsdesc.S
+++ b/ldso/ldso/xtensa/dl-tlsdesc.S
@@ -18,12 +18,10 @@
#include <sysdep.h>
-#if defined(USE_TLS) && USE_TLS
-
+#if defined __UCLIBC_HAS_TLS__
#include <tls.h>
#include "tlsdesc.h"
-
.text
.align 4
.hidden _dl_tlsdesc_return
@@ -97,4 +95,4 @@ _dl_tlsdesc_dynamic:
.size _dl_tlsdesc_dynamic, .-_dl_tlsdesc_dynamic
#endif /* SHARED */
-#endif /* USE_TLS */
+#endif
hooks/post-receive
--
uClibc-ng - small C library for embedded systems
1
0

uClibc-ng - small C library for embedded systems branch 1.0 updated. v1.0.1-6-gad2bffb
by wbx@helium.waldemar-brodkorb.de 22 Mar '15
by wbx@helium.waldemar-brodkorb.de 22 Mar '15
22 Mar '15
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".
The branch, 1.0 has been updated
via ad2bffbf1926051ef333f9899344f6bddf2c03cf (commit)
from cbec6ecd4d0fde5bf7fea20eb0c0c5fc9a6dec90 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit ad2bffbf1926051ef333f9899344f6bddf2c03cf
Author: Waldemar Brodkorb <wbx(a)openadk.org>
Date: Wed Mar 11 23:35:36 2015 -0500
fix bfin compile, -msoft-float is not available
-----------------------------------------------------------------------
Summary of changes:
Rules.mak | 11 +----------
ldso/ldso/bfin/dl-sysdep.h | 12 +++---------
2 files changed, 4 insertions(+), 19 deletions(-)
diff --git a/Rules.mak b/Rules.mak
index 5217004..e88eda1 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -292,12 +292,8 @@ CPU_CFLAGS-y := -funsigned-char -fno-builtin
$(eval $(call check-gcc-var,-fno-asm))
CPU_CFLAGS-y += $(CFLAG_-fno-asm)
-LDADD_LIBFLOAT=
ifeq ($(UCLIBC_HAS_SOFT_FLOAT),y)
-# If -msoft-float isn't supported, we want an error anyway.
-# Hmm... might need to revisit this for arm since it has 2 different
-# soft float encodings.
-ifneq ($(TARGET_ARCH),nios)
+ifneq ($(TARGET_ARCH),bfin)
ifneq ($(TARGET_ARCH),nios2)
ifneq ($(TARGET_ARCH),sh)
ifneq ($(TARGET_ARCH),c6x)
@@ -306,11 +302,6 @@ endif
endif
endif
endif
-ifeq ($(TARGET_ARCH),arm)
-# No longer needed with current toolchains, but leave it here for now.
-# If anyone is actually still using gcc 2.95 (say), they can uncomment it.
-# LDADD_LIBFLOAT=-lfloat
-endif
endif
$(eval $(call check-gcc-var,-std=gnu99))
diff --git a/ldso/ldso/bfin/dl-sysdep.h b/ldso/ldso/bfin/dl-sysdep.h
index c965263..a026b64 100644
--- a/ldso/ldso/bfin/dl-sysdep.h
+++ b/ldso/ldso/bfin/dl-sysdep.h
@@ -79,6 +79,7 @@ while (0)
#define DL_MAP_SEGMENT(EPNT, PPNT, INFILE, FLAGS) \
__dl_map_segment (EPNT, PPNT, INFILE, FLAGS)
+#if defined(__FDPIC__)
#include "../fdpic/dl-sysdep.h"
static __always_inline Elf32_Addr
@@ -92,13 +93,6 @@ static __always_inline void
elf_machine_relative (DL_LOADADDR_TYPE load_off, const Elf32_Addr rel_addr,
Elf32_Word relative_count)
{
-#if 0
- Elf32_Rel * rpnt = (void *) rel_addr;
- --rpnt;
- do {
- Elf32_Addr *const reloc_addr = (void *) (load_off + (++rpnt)->r_offset);
-
- *reloc_addr = DL_RELOC_ADDR (load_off, *reloc_addr);
- } while (--relative_count);
-#endif
+ return 0;
}
+#endif
hooks/post-receive
--
uClibc-ng - small C library for embedded systems
1
0