summaryrefslogtreecommitdiff
path: root/sysdeps/generic
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/generic')
-rw-r--r--sysdeps/generic/Makefile2
-rw-r--r--sysdeps/generic/_G_config.h60
-rw-r--r--sysdeps/generic/_itoa.h4
-rw-r--r--sysdeps/generic/abort-instr.h2
-rw-r--r--sysdeps/generic/aio_misc.h4
-rw-r--r--sysdeps/generic/atomic-machine.h2
-rw-r--r--sysdeps/generic/device-nrs.h2
-rw-r--r--sysdeps/generic/dirstream.h2
-rw-r--r--sysdeps/generic/dl-cache.h5
-rw-r--r--sysdeps/generic/dl-dtprocnum.h2
-rw-r--r--sysdeps/generic/dl-dtv.h38
-rw-r--r--sysdeps/generic/dl-fcntl.h21
-rw-r--r--sysdeps/generic/dl-fileid.h2
-rw-r--r--sysdeps/generic/dl-fptr.h2
-rw-r--r--sysdeps/generic/dl-hash.h2
-rw-r--r--sysdeps/generic/dl-irel.h2
-rw-r--r--sysdeps/generic/dl-librecon.h2
-rw-r--r--sysdeps/generic/dl-lookupcfg.h2
-rw-r--r--sysdeps/generic/dl-machine.h9
-rw-r--r--sysdeps/generic/dl-mman.h2
-rw-r--r--sysdeps/generic/dl-osinfo.h2
-rw-r--r--sysdeps/generic/dl-procinfo.h5
-rw-r--r--sysdeps/generic/dl-procruntime.c1
-rw-r--r--sysdeps/generic/dl-prop.h54
-rw-r--r--sysdeps/generic/dl-sysdep.h2
-rw-r--r--sysdeps/generic/dl-unistd.h2
-rw-r--r--sysdeps/generic/dwarf2.h2
-rw-r--r--sysdeps/generic/elide.h2
-rw-r--r--sysdeps/generic/eloop-threshold.h2
-rw-r--r--sysdeps/generic/exit-thread.h2
-rw-r--r--sysdeps/generic/fd_to_filename.h2
-rw-r--r--sysdeps/generic/fips-private.h2
-rw-r--r--sysdeps/generic/fix-fp-int-compare-invalid.h (renamed from sysdeps/generic/sys/sysmacros.h)21
-rw-r--r--sysdeps/generic/fix-fp-int-convert-overflow.h4
-rw-r--r--sysdeps/generic/fix-int-fp-convert-zero.h2
-rw-r--r--sysdeps/generic/float128-abi.h1
-rw-r--r--sysdeps/generic/fpu_control.h2
-rw-r--r--sysdeps/generic/framestate.c2
-rw-r--r--sysdeps/generic/gcc-compat.h2
-rw-r--r--sysdeps/generic/gccframe.h2
-rw-r--r--sysdeps/generic/get-rounding-mode.h2
-rw-r--r--sysdeps/generic/gmp-mparam.h2
-rw-r--r--sysdeps/generic/hp-timing-common.h2
-rw-r--r--sysdeps/generic/hp-timing.h2
-rw-r--r--sysdeps/generic/ifreq.h14
-rw-r--r--sysdeps/generic/ifunc-init.h54
-rw-r--r--sysdeps/generic/ifunc-sel.h2
-rw-r--r--sysdeps/generic/internal-signals.h62
-rw-r--r--sysdeps/generic/inttypes.h2
-rw-r--r--sysdeps/generic/ldbl-classify-compat.h33
-rw-r--r--sysdeps/generic/ldconfig.h4
-rw-r--r--sysdeps/generic/ldsodefs.h369
-rw-r--r--sysdeps/generic/libc-lock.h2
-rw-r--r--sysdeps/generic/libc-mmap.h2
-rw-r--r--sysdeps/generic/libc-start.h31
-rw-r--r--sysdeps/generic/libc-tsd.h2
-rw-r--r--sysdeps/generic/libm-alias-double.h72
-rw-r--r--sysdeps/generic/libm-alias-float.h53
-rw-r--r--sysdeps/generic/libm-alias-float128.h55
-rw-r--r--sysdeps/generic/libm-alias-ldouble.h65
-rw-r--r--sysdeps/generic/libm-test-ulps-name1
-rw-r--r--sysdeps/generic/libnsl.abilist (renamed from sysdeps/generic/libcidn.abilist)0
-rw-r--r--sysdeps/generic/libutil.abilist0
-rw-r--r--sysdeps/generic/link_map.h1
-rw-r--r--sysdeps/generic/localplt.data11
-rw-r--r--sysdeps/generic/machine-gmon.h2
-rw-r--r--sysdeps/generic/machine-lock.h14
-rw-r--r--sysdeps/generic/machine-sp.h2
-rw-r--r--sysdeps/generic/malloc-alignment.h31
-rw-r--r--sysdeps/generic/malloc-machine.h22
-rw-r--r--sysdeps/generic/malloc-sysdep.h2
-rw-r--r--sysdeps/generic/math-barriers.h37
-rw-r--r--sysdeps/generic/math-nan-payload-double.h29
-rw-r--r--sysdeps/generic/math-nan-payload-float.h28
-rw-r--r--sysdeps/generic/math-tests-arch.h2
-rw-r--r--sysdeps/generic/math-tests.h61
-rw-r--r--sysdeps/generic/math-type-macros-double.h49
-rw-r--r--sysdeps/generic/math-type-macros-float.h52
-rw-r--r--sysdeps/generic/math-type-macros-float128.h49
-rw-r--r--sysdeps/generic/math-type-macros-ldouble.h49
-rw-r--r--sysdeps/generic/math-type-macros.h134
-rw-r--r--sysdeps/generic/math_ldbl.h10
-rw-r--r--sysdeps/generic/math_private.h532
-rw-r--r--sysdeps/generic/math_private_calls.h124
-rw-r--r--sysdeps/generic/memcopy.h2
-rw-r--r--sysdeps/generic/memusage.h2
-rw-r--r--sysdeps/generic/nan-high-order-bit.h27
-rw-r--r--sysdeps/generic/net/if.h2
-rw-r--r--sysdeps/generic/netinet/if_ether.h5
-rw-r--r--sysdeps/generic/netinet/in_systm.h10
-rw-r--r--sysdeps/generic/netinet/ip.h48
-rw-r--r--sysdeps/generic/netinet/tcp.h34
-rw-r--r--sysdeps/generic/nfs/nfs.h2
-rw-r--r--sysdeps/generic/not-cancel.h55
-rw-r--r--sysdeps/generic/not-errno.h (renamed from sysdeps/generic/frame.h)10
-rw-r--r--sysdeps/generic/nscd-types.h2
-rw-r--r--sysdeps/generic/pagecopy.h2
-rw-r--r--sysdeps/generic/profil-counter.h2
-rw-r--r--sysdeps/generic/pty-private.h2
-rw-r--r--sysdeps/generic/register-dump.h2
-rw-r--r--sysdeps/generic/safe-fatal.h2
-rw-r--r--sysdeps/generic/setjmpP.h (renamed from sysdeps/generic/bits/hwcap.h)13
-rw-r--r--sysdeps/generic/sigcontextinfo.h7
-rw-r--r--sysdeps/generic/siglist.h26
-rw-r--r--sysdeps/generic/sigset-cvt-mask.h4
-rw-r--r--sysdeps/generic/sigsetops.h76
-rw-r--r--sysdeps/generic/stackinfo.h2
-rw-r--r--sysdeps/generic/startup.h23
-rw-r--r--sysdeps/generic/stdint.h125
-rw-r--r--sysdeps/generic/stdio-lock.h7
-rw-r--r--sysdeps/generic/string_private.h2
-rw-r--r--sysdeps/generic/symbol-hacks.h12
-rw-r--r--sysdeps/generic/sys/ptrace.h2
-rw-r--r--sysdeps/generic/sys/swap.h2
-rw-r--r--sysdeps/generic/sys/sysinfo.h2
-rw-r--r--sysdeps/generic/sys/ucontext.h28
-rw-r--r--sysdeps/generic/sysdep.h2
-rw-r--r--sysdeps/generic/thread_state.h6
-rw-r--r--sysdeps/generic/tininess.h2
-rw-r--r--sysdeps/generic/tls-setup.h22
-rw-r--r--sysdeps/generic/tls.h8
-rw-r--r--sysdeps/generic/tst-stack-align.h2
-rw-r--r--sysdeps/generic/unsecvars.h8
-rw-r--r--sysdeps/generic/unwind-dw2-fde-glibc.c2
-rw-r--r--sysdeps/generic/unwind-dw2-fde.c6
-rw-r--r--sysdeps/generic/unwind-dw2-fde.h2
-rw-r--r--sysdeps/generic/unwind-dw2.c2
-rw-r--r--sysdeps/generic/unwind-pe.h2
-rw-r--r--sysdeps/generic/unwind-resume.h2
-rw-r--r--sysdeps/generic/unwind.h2
-rw-r--r--sysdeps/generic/utmp-equal.h2
131 files changed, 2117 insertions, 846 deletions
diff --git a/sysdeps/generic/Makefile b/sysdeps/generic/Makefile
index f68ac6893c..d287bfafc6 100644
--- a/sysdeps/generic/Makefile
+++ b/sysdeps/generic/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1992-2016 Free Software Foundation, Inc.
+# Copyright (C) 1992-2018 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
diff --git a/sysdeps/generic/_G_config.h b/sysdeps/generic/_G_config.h
index f44a3d4eee..7c917bf64c 100644
--- a/sysdeps/generic/_G_config.h
+++ b/sysdeps/generic/_G_config.h
@@ -1,57 +1,15 @@
-/* This file is needed by libio to define various configuration parameters.
- These are always the same in the GNU C library. */
+/* Configuration parameters for stdio - generic version. */
-#ifndef _G_config_h
-#define _G_config_h 1
-
-/* Define types for libio in terms of the standard internal type names. */
-
-#include <bits/types.h>
-#define __need_size_t
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-# define __need_wchar_t
-#endif
-#define __need_NULL
-#include <stddef.h>
-#define __need_mbstate_t
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-# define __need_wint_t
-#endif
-#include <wchar.h>
-typedef struct
-{
- __off_t __pos;
- __mbstate_t __state;
-} _G_fpos_t;
-typedef struct
-{
- __off64_t __pos;
- __mbstate_t __state;
-} _G_fpos64_t;
-#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-# include <gconv.h>
-typedef union
-{
- struct __gconv_info __cd;
- struct
- {
- struct __gconv_info __cd;
- struct __gconv_step_data __data;
- } __combined;
-} _G_iconv_t;
-#endif
-
-
-/* These library features are always available in the GNU C library. */
-#define _G_va_list __gnuc_va_list
+#ifndef __G_CONFIG_H
+#define __G_CONFIG_H 1
+/* Define to 1 if the operating system supports mmap, 0 otherwise.
+ This function is required by POSIX but might still be unavailable,
+ for instance when the hardware lacks support for virtual memory. */
#define _G_HAVE_MMAP 1
-#define _G_IO_IO_FILE_VERSION 0x20001
-
-/* This is defined by <bits/stat.h> if `st_blksize' exists. */
-#define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE)
-
-#define _G_BUFSIZ 8192
+/* Define to 1 if the operating system supports mremap, 0 otherwise.
+ This function is currently a Linux-specific extension. */
+#define _G_HAVE_MREMAP 0
#endif /* _G_config.h */
diff --git a/sysdeps/generic/_itoa.h b/sysdeps/generic/_itoa.h
index 462cc09529..d54d0155c9 100644
--- a/sysdeps/generic/_itoa.h
+++ b/sysdeps/generic/_itoa.h
@@ -1,5 +1,5 @@
/* Internal function for converting integers to ASCII.
- Copyright (C) 1994-2016 Free Software Foundation, Inc.
+ Copyright (C) 1994-2018 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
@@ -46,7 +46,7 @@ extern char *_itoa (unsigned long long int value, char *buflim,
extern const char _itoa_upper_digits[];
extern const char _itoa_lower_digits[];
-#if IS_IN (libc) || IS_IN (rtld)
+#if IS_IN (libc) || (IS_IN (rtld) && !defined NO_RTLD_HIDDEN)
hidden_proto (_itoa_upper_digits)
hidden_proto (_itoa_lower_digits)
#endif
diff --git a/sysdeps/generic/abort-instr.h b/sysdeps/generic/abort-instr.h
index 7e96e11e7f..c86516889e 100644
--- a/sysdeps/generic/abort-instr.h
+++ b/sysdeps/generic/abort-instr.h
@@ -1,5 +1,5 @@
/* Magic instruction to crash quickly and reliably. Generic/stub version.
- Copyright (C) 2014-2016 Free Software Foundation, Inc.
+ Copyright (C) 2014-2018 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
diff --git a/sysdeps/generic/aio_misc.h b/sysdeps/generic/aio_misc.h
index 56f872fc48..0cd030bf53 100644
--- a/sysdeps/generic/aio_misc.h
+++ b/sysdeps/generic/aio_misc.h
@@ -1,5 +1,5 @@
/* Internal declarations for <aio.h> functions implementation. Stub version.
- Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ Copyright (C) 2001-2018 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
@@ -41,7 +41,7 @@ typedef union
/* Send the signal. */
extern int __aio_sigqueue (int sig, const union sigval val, pid_t caller_pid)
- internal_function;
+ attribute_hidden;
#endif /* aio_misc.h */
diff --git a/sysdeps/generic/atomic-machine.h b/sysdeps/generic/atomic-machine.h
index 6c04ad54a4..15f33901fd 100644
--- a/sysdeps/generic/atomic-machine.h
+++ b/sysdeps/generic/atomic-machine.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003-2016 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
diff --git a/sysdeps/generic/device-nrs.h b/sysdeps/generic/device-nrs.h
index 236d821c81..03040d6ad1 100644
--- a/sysdeps/generic/device-nrs.h
+++ b/sysdeps/generic/device-nrs.h
@@ -1,5 +1,5 @@
/* Device numbers of devices used in the implementation. Generic version.
- Copyright (C) 2000-2016 Free Software Foundation, Inc.
+ Copyright (C) 2000-2018 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
diff --git a/sysdeps/generic/dirstream.h b/sysdeps/generic/dirstream.h
index b41bbdc023..399f00e458 100644
--- a/sysdeps/generic/dirstream.h
+++ b/sysdeps/generic/dirstream.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1993-2018 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
diff --git a/sysdeps/generic/dl-cache.h b/sysdeps/generic/dl-cache.h
index eb2f900ae5..cf43f1cf3b 100644
--- a/sysdeps/generic/dl-cache.h
+++ b/sysdeps/generic/dl-cache.h
@@ -1,5 +1,5 @@
/* Support for reading /etc/ld.so.cache files written by Linux ldconfig.
- Copyright (C) 1999-2016 Free Software Foundation, Inc.
+ Copyright (C) 1999-2018 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
@@ -100,5 +100,4 @@ struct cache_file_new
(((addr) + __alignof__ (struct cache_file_new) -1) \
& (~(__alignof__ (struct cache_file_new) - 1)))
-extern int _dl_cache_libcmp (const char *p1, const char *p2)
- internal_function attribute_hidden;
+extern int _dl_cache_libcmp (const char *p1, const char *p2) attribute_hidden;
diff --git a/sysdeps/generic/dl-dtprocnum.h b/sysdeps/generic/dl-dtprocnum.h
index 35d00529b4..dc2839b720 100644
--- a/sysdeps/generic/dl-dtprocnum.h
+++ b/sysdeps/generic/dl-dtprocnum.h
@@ -1,5 +1,5 @@
/* Configuration of lookup functions.
- Copyright (C) 2000-2016 Free Software Foundation, Inc.
+ Copyright (C) 2000-2018 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
diff --git a/sysdeps/generic/dl-dtv.h b/sysdeps/generic/dl-dtv.h
new file mode 100644
index 0000000000..b2346b2b65
--- /dev/null
+++ b/sysdeps/generic/dl-dtv.h
@@ -0,0 +1,38 @@
+/* Generic declarations for DTV-based TLS handling in the dynamic linker.
+ Copyright (C) 2002-2018 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 _DL_DTV_H
+#define _DL_DTV_H
+
+struct dtv_pointer
+{
+ void *val; /* Pointer to data, or TLS_DTV_UNALLOCATED. */
+ void *to_free; /* Unaligned pointer, for deallocation. */
+};
+
+/* Type for the dtv. */
+typedef union dtv
+{
+ size_t counter;
+ struct dtv_pointer pointer;
+} dtv_t;
+
+/* Value used for dtv entries for which the allocation is delayed. */
+#define TLS_DTV_UNALLOCATED ((void *) -1l)
+
+#endif /* _DLT_DTV_H */
diff --git a/sysdeps/generic/dl-fcntl.h b/sysdeps/generic/dl-fcntl.h
new file mode 100644
index 0000000000..607bb36731
--- /dev/null
+++ b/sysdeps/generic/dl-fcntl.h
@@ -0,0 +1,21 @@
+/* Functions with hidden attribute internal to ld.so, which are declared
+ in include/fcntl.h. Generic version.
+ Copyright (C) 2016-2018 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/>. */
+
+extern __typeof (__open) __open attribute_hidden;
+extern __typeof (__fcntl) __fcntl attribute_hidden;
diff --git a/sysdeps/generic/dl-fileid.h b/sysdeps/generic/dl-fileid.h
index 7cfeefaff7..a7e2fcdfb7 100644
--- a/sysdeps/generic/dl-fileid.h
+++ b/sysdeps/generic/dl-fileid.h
@@ -1,5 +1,5 @@
/* File identity for the dynamic linker. Stub version.
- Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ Copyright (C) 2015-2018 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
diff --git a/sysdeps/generic/dl-fptr.h b/sysdeps/generic/dl-fptr.h
index df0abba642..faea7a92cb 100644
--- a/sysdeps/generic/dl-fptr.h
+++ b/sysdeps/generic/dl-fptr.h
@@ -1,5 +1,5 @@
/* Function descriptors. Generic version.
- Copyright (C) 1995-2016 Free Software Foundation, Inc.
+ Copyright (C) 1995-2018 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
diff --git a/sysdeps/generic/dl-hash.h b/sysdeps/generic/dl-hash.h
index 6f2c408a42..1fe2efbddb 100644
--- a/sysdeps/generic/dl-hash.h
+++ b/sysdeps/generic/dl-hash.h
@@ -1,5 +1,5 @@
/* Compute hash value for given string according to ELF standard.
- Copyright (C) 1995-2016 Free Software Foundation, Inc.
+ Copyright (C) 1995-2018 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
diff --git a/sysdeps/generic/dl-irel.h b/sysdeps/generic/dl-irel.h
index 411943c6a6..3c3365f29f 100644
--- a/sysdeps/generic/dl-irel.h
+++ b/sysdeps/generic/dl-irel.h
@@ -1,5 +1,5 @@
/* Machine-dependent ELF indirect relocation inline functions.
- Copyright (C) 2009-2016 Free Software Foundation, Inc.
+ Copyright (C) 2009-2018 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
diff --git a/sysdeps/generic/dl-librecon.h b/sysdeps/generic/dl-librecon.h
index 2f617177a7..5f2601d47b 100644
--- a/sysdeps/generic/dl-librecon.h
+++ b/sysdeps/generic/dl-librecon.h
@@ -1,5 +1,5 @@
/* Optional code to distinguish library flavours.
- Copyright (C) 1998-2016 Free Software Foundation, Inc.
+ Copyright (C) 1998-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
diff --git a/sysdeps/generic/dl-lookupcfg.h b/sysdeps/generic/dl-lookupcfg.h
index 3ac1f46869..e7d3717014 100644
--- a/sysdeps/generic/dl-lookupcfg.h
+++ b/sysdeps/generic/dl-lookupcfg.h
@@ -1,5 +1,5 @@
/* Configuration of lookup functions.
- Copyright (C) 2002-2016 Free Software Foundation, Inc.
+ Copyright (C) 2002-2018 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
diff --git a/sysdeps/generic/dl-machine.h b/sysdeps/generic/dl-machine.h
index 041c99e221..fc0f2141f5 100644
--- a/sysdeps/generic/dl-machine.h
+++ b/sysdeps/generic/dl-machine.h
@@ -1,5 +1,5 @@
/* Machine-dependent ELF dynamic relocation inline functions. Stub version.
- Copyright (C) 1995-2016 Free Software Foundation, Inc.
+ Copyright (C) 1995-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -51,10 +51,11 @@ elf_machine_load_address (void)
/* Fixup a PLT entry to bounce directly to the function at VALUE. */
-static inline Elf32_Addr
+static inline ElfW(Addr)
elf_machine_fixup_plt (struct link_map *map, lookup_t t,
- const Elf32_Rel *reloc,
- Elf32_Addr *reloc_addr, Elf32_Addr value)
+ const ElfW(Sym) *refsym, const ElfW(Sym) *sym,
+ const ElfW(Rel) *reloc,
+ ElfW(Addr) *reloc_addr, ElfW(Addr) value)
{
return *reloc_addr = value;
}
diff --git a/sysdeps/generic/dl-mman.h b/sysdeps/generic/dl-mman.h
index 66ffdb2e42..2fd6051b65 100644
--- a/sysdeps/generic/dl-mman.h
+++ b/sysdeps/generic/dl-mman.h
@@ -1,6 +1,6 @@
/* Functions with hidden attribute internal to ld.so, which are declared
in include/sys/mman.h. Generic version.
- Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ Copyright (C) 2015-2018 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
diff --git a/sysdeps/generic/dl-osinfo.h b/sysdeps/generic/dl-osinfo.h
index 2489e7b6d8..931b3710f1 100644
--- a/sysdeps/generic/dl-osinfo.h
+++ b/sysdeps/generic/dl-osinfo.h
@@ -1,5 +1,5 @@
/* Operating system specific code for generic dynamic loader functions.
- Copyright (C) 2009-2016 Free Software Foundation, Inc.
+ Copyright (C) 2009-2018 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
diff --git a/sysdeps/generic/dl-procinfo.h b/sysdeps/generic/dl-procinfo.h
index 578a350627..70a74bdd37 100644
--- a/sysdeps/generic/dl-procinfo.h
+++ b/sysdeps/generic/dl-procinfo.h
@@ -1,5 +1,5 @@
/* Stub version of processor capability information handling macros.
- Copyright (C) 1998-2016 Free Software Foundation, Inc.
+ Copyright (C) 1998-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -26,9 +26,6 @@
/* There are no hardware capabilities defined. */
#define _dl_hwcap_string(idx) ""
-/* There are no different platforms defined. */
-#define _dl_platform_string(idx) ""
-
/* By default there is no important hardware capability. */
#define HWCAP_IMPORTANT (0)
diff --git a/sysdeps/generic/dl-procruntime.c b/sysdeps/generic/dl-procruntime.c
new file mode 100644
index 0000000000..a056184690
--- /dev/null
+++ b/sysdeps/generic/dl-procruntime.c
@@ -0,0 +1 @@
+/* No architecture specific definitions. */
diff --git a/sysdeps/generic/dl-prop.h b/sysdeps/generic/dl-prop.h
new file mode 100644
index 0000000000..a2b1d38c79
--- /dev/null
+++ b/sysdeps/generic/dl-prop.h
@@ -0,0 +1,54 @@
+/* Support for GNU properties. Generic version.
+ Copyright (C) 2018 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 _DL_PROP_H
+#define _DL_PROP_H
+
+/* The following functions are used by the dynamic loader and the
+ dlopen machinery to process PT_NOTE entries in the binary or
+ shared object. The notes can be used to change the behaviour of
+ the loader, and as such offer a flexible mechanism for hooking in
+ various checks related to ABI tags or implementing "flag day" ABI
+ transitions. */
+
+static inline void __attribute__ ((always_inline))
+_rtld_main_check (struct link_map *m, const char *program)
+{
+}
+
+static inline void __attribute__ ((always_inline))
+_dl_open_check (struct link_map *m)
+{
+}
+
+#ifdef FILEBUF_SIZE
+static inline int __attribute__ ((always_inline))
+_dl_process_pt_note (struct link_map *l, const ElfW(Phdr) *ph,
+ int fd, struct filebuf *fbp)
+{
+ return 0;
+}
+#endif
+
+static inline int __attribute__ ((always_inline))
+_rtld_process_pt_note (struct link_map *l, const ElfW(Phdr) *ph)
+{
+ return 0;
+}
+
+#endif /* _DL_PROP_H */
diff --git a/sysdeps/generic/dl-sysdep.h b/sysdeps/generic/dl-sysdep.h
index df36113253..2cb8565b5b 100644
--- a/sysdeps/generic/dl-sysdep.h
+++ b/sysdeps/generic/dl-sysdep.h
@@ -1,5 +1,5 @@
/* System-specific settings for dynamic linker code. Generic version.
- Copyright (C) 2002-2016 Free Software Foundation, Inc.
+ Copyright (C) 2002-2018 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
diff --git a/sysdeps/generic/dl-unistd.h b/sysdeps/generic/dl-unistd.h
index df6376e01f..8040b4b34a 100644
--- a/sysdeps/generic/dl-unistd.h
+++ b/sysdeps/generic/dl-unistd.h
@@ -1,6 +1,6 @@
/* Functions with hidden attribute internal to ld.so, which are declared
in include/unistd.h. Generic version.
- Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ Copyright (C) 2015-2018 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
diff --git a/sysdeps/generic/dwarf2.h b/sysdeps/generic/dwarf2.h
index 027a012c0c..12219ad8bf 100644
--- a/sysdeps/generic/dwarf2.h
+++ b/sysdeps/generic/dwarf2.h
@@ -1,6 +1,6 @@
/* Declarations and definitions of codes relating to the DWARF2 symbolic
debugging information format.
- Copyright (C) 1992-2016 Free Software Foundation, Inc.
+ Copyright (C) 1992-2018 Free Software Foundation, Inc.
Contributed by Gary Funck (gary@intrepid.com). Derived from the
DWARF 1 implementation written by Ron Guilmette (rfg@monkeys.com).
diff --git a/sysdeps/generic/elide.h b/sysdeps/generic/elide.h
index 39e28924bf..ea383a2f6b 100644
--- a/sysdeps/generic/elide.h
+++ b/sysdeps/generic/elide.h
@@ -1,5 +1,5 @@
/* elide.h: Fallback noop lock elision support.
- Copyright (C) 2014-2016 Free Software Foundation, Inc.
+ Copyright (C) 2014-2018 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
diff --git a/sysdeps/generic/eloop-threshold.h b/sysdeps/generic/eloop-threshold.h
index 9dd2fdd840..34391a2ee1 100644
--- a/sysdeps/generic/eloop-threshold.h
+++ b/sysdeps/generic/eloop-threshold.h
@@ -1,5 +1,5 @@
/* Threshold at which to diagnose ELOOP. Generic version.
- Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ Copyright (C) 2012-2018 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
diff --git a/sysdeps/generic/exit-thread.h b/sysdeps/generic/exit-thread.h
index 10c5aa4adf..af14a4fdfd 100644
--- a/sysdeps/generic/exit-thread.h
+++ b/sysdeps/generic/exit-thread.h
@@ -1,5 +1,5 @@
/* Call to terminate the current thread. Stub version.
- Copyright (C) 2014-2016 Free Software Foundation, Inc.
+ Copyright (C) 2014-2018 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
diff --git a/sysdeps/generic/fd_to_filename.h b/sysdeps/generic/fd_to_filename.h
index 61d4a3cec6..bacfe5bf52 100644
--- a/sysdeps/generic/fd_to_filename.h
+++ b/sysdeps/generic/fd_to_filename.h
@@ -1,5 +1,5 @@
/* Query filename corresponding to an open FD. Generic version.
- Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ Copyright (C) 2001-2018 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
diff --git a/sysdeps/generic/fips-private.h b/sysdeps/generic/fips-private.h
index 25a3e210bf..6a60bc5827 100644
--- a/sysdeps/generic/fips-private.h
+++ b/sysdeps/generic/fips-private.h
@@ -1,5 +1,5 @@
/* Dummy implementation of FIPS compliance status test.
- Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ Copyright (C) 2012-2018 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
diff --git a/sysdeps/generic/sys/sysmacros.h b/sysdeps/generic/fix-fp-int-compare-invalid.h
index 4cc59616fb..484adcd2cd 100644
--- a/sysdeps/generic/sys/sysmacros.h
+++ b/sysdeps/generic/fix-fp-int-compare-invalid.h
@@ -1,5 +1,6 @@
-/* Definitions of macros to access `dev_t' values.
- Copyright (C) 1996-2016 Free Software Foundation, Inc.
+/* Fix for missing "invalid" exceptions from floating-point
+ comparisons. Generic version.
+ Copyright (C) 2016-2018 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
@@ -16,15 +17,11 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#ifndef _SYS_SYSMACROS_H
-#define _SYS_SYSMACROS_H 1
+#ifndef FIX_FP_INT_COMPARE_INVALID_H
+#define FIX_FP_INT_COMPARE_INVALID_H 1
-/* For compatibility we provide alternative names.
+/* Define this macro to 1 to work around ordered comparison operators
+ in C failing to raise the "invalid" exception for NaN operands. */
+#define FIX_COMPARE_INVALID 0
- The problem here is that compilers other than GCC probably don't
- have the `long long' type and so `dev_t' is actually an array. */
-#define major(dev) ((int)(((unsigned int) (dev) >> 8) & 0xff))
-#define minor(dev) ((int)((dev) & 0xff))
-#define makedev(major, minor) (((major) << 8) | (minor))
-
-#endif /* sys/sysmacros.h */
+#endif /* fix-fp-int-compare-invalid.h */
diff --git a/sysdeps/generic/fix-fp-int-convert-overflow.h b/sysdeps/generic/fix-fp-int-convert-overflow.h
index fb681147c0..d0a4ba9150 100644
--- a/sysdeps/generic/fix-fp-int-convert-overflow.h
+++ b/sysdeps/generic/fix-fp-int-convert-overflow.h
@@ -1,5 +1,5 @@
/* Fix for conversion of floating point to integer overflow. Generic version.
- Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ Copyright (C) 2015-2018 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
@@ -29,5 +29,7 @@
#define FIX_DBL_LLONG_CONVERT_OVERFLOW 0
#define FIX_LDBL_LONG_CONVERT_OVERFLOW 0
#define FIX_LDBL_LLONG_CONVERT_OVERFLOW 0
+#define FIX_FLT128_LONG_CONVERT_OVERFLOW 0
+#define FIX_FLT128_LLONG_CONVERT_OVERFLOW 0
#endif /* fix-fp-int-convert-overflow.h */
diff --git a/sysdeps/generic/fix-int-fp-convert-zero.h b/sysdeps/generic/fix-int-fp-convert-zero.h
index 01414aa00a..43ad6fda84 100644
--- a/sysdeps/generic/fix-int-fp-convert-zero.h
+++ b/sysdeps/generic/fix-int-fp-convert-zero.h
@@ -1,5 +1,5 @@
/* Fix for conversion of integer 0 to floating point. Generic version.
- Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ Copyright (C) 2015-2018 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
diff --git a/sysdeps/generic/float128-abi.h b/sysdeps/generic/float128-abi.h
new file mode 100644
index 0000000000..dfcf083c27
--- /dev/null
+++ b/sysdeps/generic/float128-abi.h
@@ -0,0 +1 @@
+/* No _Float128 ABI support by default. */
diff --git a/sysdeps/generic/fpu_control.h b/sysdeps/generic/fpu_control.h
index 297288f3a7..8a7d8fb808 100644
--- a/sysdeps/generic/fpu_control.h
+++ b/sysdeps/generic/fpu_control.h
@@ -1,5 +1,5 @@
/* FPU control word definitions. Stub version.
- Copyright (C) 1996-2016 Free Software Foundation, Inc.
+ Copyright (C) 1996-2018 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
diff --git a/sysdeps/generic/framestate.c b/sysdeps/generic/framestate.c
index 2f10ce7559..807447364e 100644
--- a/sysdeps/generic/framestate.c
+++ b/sysdeps/generic/framestate.c
@@ -1,5 +1,5 @@
/* __frame_state_for unwinder helper function wrapper.
- Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ Copyright (C) 2001-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2001.
diff --git a/sysdeps/generic/gcc-compat.h b/sysdeps/generic/gcc-compat.h
index d776614119..404e082748 100644
--- a/sysdeps/generic/gcc-compat.h
+++ b/sysdeps/generic/gcc-compat.h
@@ -1,5 +1,5 @@
/* Macros for checking required GCC compatibility. Generic version.
- Copyright (C) 2014-2016 Free Software Foundation, Inc.
+ Copyright (C) 2014-2018 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
diff --git a/sysdeps/generic/gccframe.h b/sysdeps/generic/gccframe.h
index 33c60b0cf3..5467b5549e 100644
--- a/sysdeps/generic/gccframe.h
+++ b/sysdeps/generic/gccframe.h
@@ -1,5 +1,5 @@
/* Definition of object in frame unwind info. Generic version.
- Copyright (C) 2000-2016 Free Software Foundation, Inc.
+ Copyright (C) 2000-2018 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
diff --git a/sysdeps/generic/get-rounding-mode.h b/sysdeps/generic/get-rounding-mode.h
index 4a58e6a5a5..8d55ad7d7e 100644
--- a/sysdeps/generic/get-rounding-mode.h
+++ b/sysdeps/generic/get-rounding-mode.h
@@ -1,5 +1,5 @@
/* Determine floating-point rounding mode within libc. Generic version.
- Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ Copyright (C) 2012-2018 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
diff --git a/sysdeps/generic/gmp-mparam.h b/sysdeps/generic/gmp-mparam.h
index baf1560400..3b8ff3fedb 100644
--- a/sysdeps/generic/gmp-mparam.h
+++ b/sysdeps/generic/gmp-mparam.h
@@ -1,5 +1,5 @@
/* gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright (C) 1991-2016 Free Software Foundation, Inc.
+Copyright (C) 1991-2018 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
diff --git a/sysdeps/generic/hp-timing-common.h b/sysdeps/generic/hp-timing-common.h
index 257cdd3e55..505c6bf5d2 100644
--- a/sysdeps/generic/hp-timing-common.h
+++ b/sysdeps/generic/hp-timing-common.h
@@ -1,5 +1,5 @@
/* High precision, low overhead timing functions. Generic version.
- Copyright (C) 1998-2016 Free Software Foundation, Inc.
+ Copyright (C) 1998-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
diff --git a/sysdeps/generic/hp-timing.h b/sysdeps/generic/hp-timing.h
index 6ca7f7d03f..e2c02c2bc0 100644
--- a/sysdeps/generic/hp-timing.h
+++ b/sysdeps/generic/hp-timing.h
@@ -1,5 +1,5 @@
/* High precision, low overhead timing functions. Generic version.
- Copyright (C) 1998-2016 Free Software Foundation, Inc.
+ Copyright (C) 1998-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
diff --git a/sysdeps/generic/ifreq.h b/sysdeps/generic/ifreq.h
index 5ff0ef8805..4b7b93e9a4 100644
--- a/sysdeps/generic/ifreq.h
+++ b/sysdeps/generic/ifreq.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>.
@@ -23,18 +23,6 @@
#include <sys/socket.h>
#include <sys/ioctl.h>
-static inline struct ifreq *
-__if_nextreq (struct ifreq *ifr)
-{
-#ifdef _HAVE_SA_LEN
- if (ifr->ifr_addr.sa_len > sizeof ifr->ifr_addr)
- return (struct ifreq *) ((char *) &ifr->ifr_addr + ifr->ifr_addr.sa_len);
-#endif
- return ifr + 1;
-}
-
-extern void __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd);
-
static inline void
__if_freereq (struct ifreq *ifreqs, int num_ifs)
diff --git a/sysdeps/generic/ifunc-init.h b/sysdeps/generic/ifunc-init.h
new file mode 100644
index 0000000000..241e416179
--- /dev/null
+++ b/sysdeps/generic/ifunc-init.h
@@ -0,0 +1,54 @@
+/* IFUNC generic definitions.
+ This file is part of the GNU C Library.
+ Copyright (C) 2017-2018 Free Software Foundation, Inc.
+
+ 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/>. */
+
+/* These macros are used to implement ifunc selection in C. To implement
+ an ifunc function, foo, which returns the address of __foo_impl1 or
+ __foo_impl2:
+
+ #define foo __redirect_foo
+ #include <foo.h>
+ #undef foo
+ #define SYMBOL_NAME foo
+ #include <ifunc-init.h>
+
+ extern __typeof (REDIRECT_NAME) OPTIMIZE (impl1) attribute_hidden;
+ extern __typeof (REDIRECT_NAME) OPTIMIZE (impl2) attribute_hidden;
+
+ static inline void *
+ foo_selector (void)
+ {
+ if (condition)
+ return OPTIMIZE (impl2);
+
+ return OPTIMIZE (impl1);
+ }
+
+ libc_ifunc_redirected (__redirect_foo, foo, IFUNC_SELECTOR ());
+*/
+
+#define PASTER1(x,y) x##_##y
+#define EVALUATOR1(x,y) PASTER1 (x,y)
+#define PASTER2(x,y) __##x##_##y
+#define EVALUATOR2(x,y) PASTER2 (x,y)
+
+/* Basically set '__redirect_<symbol>' to use as type definition,
+ '__<symbol>_<variant>' as the optimized implementation and
+ '<symbol>_ifunc_selector' as the IFUNC selector. */
+#define REDIRECT_NAME EVALUATOR1 (__redirect, SYMBOL_NAME)
+#define OPTIMIZE(name) EVALUATOR2 (SYMBOL_NAME, name)
+#define IFUNC_SELECTOR EVALUATOR1 (SYMBOL_NAME, ifunc_selector)
diff --git a/sysdeps/generic/ifunc-sel.h b/sysdeps/generic/ifunc-sel.h
index 6a27b69c5b..1fff4059cc 100644
--- a/sysdeps/generic/ifunc-sel.h
+++ b/sysdeps/generic/ifunc-sel.h
@@ -5,6 +5,7 @@
extern int global;
static inline void *
+inhibit_stack_protector
ifunc_sel (int (*f1) (void), int (*f2) (void), int (*f3) (void))
{
switch (global)
@@ -19,6 +20,7 @@ ifunc_sel (int (*f1) (void), int (*f2) (void), int (*f3) (void))
}
static inline void *
+inhibit_stack_protector
ifunc_one (int (*f1) (void))
{
return f1;
diff --git a/sysdeps/generic/internal-signals.h b/sysdeps/generic/internal-signals.h
new file mode 100644
index 0000000000..5282cffce0
--- /dev/null
+++ b/sysdeps/generic/internal-signals.h
@@ -0,0 +1,62 @@
+/* Special use of signals internally. Stub version.
+ Copyright (C) 2014-2018 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 __INTERNAL_SIGNALS_H
+# define __INTERNAL_SIGNALS_H
+
+#include <signal.h>
+#include <sigsetops.h>
+#include <stdbool.h>
+
+static inline bool
+__is_internal_signal (int sig)
+{
+ return false;
+}
+
+static inline void
+__clear_internal_signals (sigset_t *set)
+{
+}
+
+static inline int
+__libc_signal_block_all (sigset_t *set)
+{
+ sigset_t allset;
+ __sigfillset (&allset);
+ return __sigprocmask (SIG_BLOCK, &allset, set);
+}
+
+static inline int
+__libc_signal_block_app (sigset_t *set)
+{
+ sigset_t allset;
+ __sigfillset (&allset);
+ __clear_internal_signals (&allset);
+ return __sigprocmask (SIG_BLOCK, &allset, set);
+}
+
+/* Restore current process signal mask. */
+static inline int
+__libc_signal_restore_set (const sigset_t *set)
+{
+ return __sigprocmask (SIG_SETMASK, set, NULL);
+}
+
+
+#endif /* __INTERNAL_SIGNALS_H */
diff --git a/sysdeps/generic/inttypes.h b/sysdeps/generic/inttypes.h
index 1207bf2e73..69f8cb17a5 100644
--- a/sysdeps/generic/inttypes.h
+++ b/sysdeps/generic/inttypes.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2018 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
diff --git a/sysdeps/generic/ldbl-classify-compat.h b/sysdeps/generic/ldbl-classify-compat.h
new file mode 100644
index 0000000000..d77ca18275
--- /dev/null
+++ b/sysdeps/generic/ldbl-classify-compat.h
@@ -0,0 +1,33 @@
+/* Specify whether there should be compat symbol aliases for some
+ classification functions. Generic version.
+ Copyright (C) 2015-2018 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 _LDBL_CLASSIFY_COMPAT_H
+#define _LDBL_CLASSIFY_COMPAT_H 1
+
+/* If defined to 1, enable __finitel, __isinfl, and __isnanl function
+ aliases for binary compatibility when built without long double
+ support. If defined to 0, or if long double does not have the same
+ format as double, there are no such aliases. New ports should use
+ the default definition of this as 0, as such
+ implementation-namespace functions should only have one exported
+ name per floating-point format, not one per floating-point
+ type. */
+#define LDBL_CLASSIFY_COMPAT 0
+
+#endif /* ldbl-classify-compat.h */
diff --git a/sysdeps/generic/ldconfig.h b/sysdeps/generic/ldconfig.h
index 07600b7596..59e20dc3ef 100644
--- a/sysdeps/generic/ldconfig.h
+++ b/sysdeps/generic/ldconfig.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 1999.
@@ -42,6 +42,8 @@
#define FLAG_MIPS_LIB32_NAN2008 0x0c00
#define FLAG_MIPS64_LIBN32_NAN2008 0x0d00
#define FLAG_MIPS64_LIBN64_NAN2008 0x0e00
+#define FLAG_RISCV_FLOAT_ABI_SOFT 0x0f00
+#define FLAG_RISCV_FLOAT_ABI_DOUBLE 0x1000
/* Name of auxiliary cache. */
#define _PATH_LDCONFIG_AUX_CACHE "/var/cache/ldconfig/aux-cache"
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 2733ac8268..95dc87519b 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -1,5 +1,5 @@
/* Run-time dynamic linker data structures for loaded ELF shared objects.
- Copyright (C) 1995-2016 Free Software Foundation, Inc.
+ Copyright (C) 1995-2018 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
@@ -66,14 +66,21 @@ __BEGIN_DECLS
/* Result of the lookup functions and how to retrieve the base address. */
typedef struct link_map *lookup_t;
#define LOOKUP_VALUE(map) map
-#define LOOKUP_VALUE_ADDRESS(map) ((map) ? (map)->l_addr : 0)
+#define LOOKUP_VALUE_ADDRESS(map, set) ((set) || (map) ? (map)->l_addr : 0)
+
+/* Calculate the address of symbol REF using the base address from map MAP,
+ if non-NULL. Don't check for NULL map if MAP_SET is TRUE. */
+#define SYMBOL_ADDRESS(map, ref, map_set) \
+ ((ref) == NULL ? 0 \
+ : (__glibc_unlikely ((ref)->st_shndx == SHN_ABS) ? 0 \
+ : LOOKUP_VALUE_ADDRESS (map, map_set)) + (ref)->st_value)
/* On some architectures a pointer to a function is not just a pointer
to the actual code of the function but rather an architecture
specific descriptor. */
#ifndef ELF_FUNCTION_PTR_IS_SPECIAL
# define DL_SYMBOL_ADDRESS(map, ref) \
- (void *) (LOOKUP_VALUE_ADDRESS (map) + ref->st_value)
+ (void *) SYMBOL_ADDRESS (map, ref, false)
# define DL_LOOKUP_ADDRESS(addr) ((ElfW(Addr)) (addr))
# define DL_CALL_DT_INIT(map, start, argc, argv, env) \
((init_t) (start)) (argc, argv, env)
@@ -88,6 +95,19 @@ typedef struct link_map *lookup_t;
|| (ADDR) < (L)->l_addr + (SYM)->st_value + (SYM)->st_size) \
&& ((MATCHSYM) == NULL || (MATCHSYM)->st_value < (SYM)->st_value))
+/* According to the ELF gABI no STV_HIDDEN or STV_INTERNAL symbols are
+ expected to be present in dynamic symbol tables as they should have
+ been either removed or converted to STB_LOCAL binding by the static
+ linker. However some GNU binutils versions produce such symbols in
+ some cases. To prevent such symbols present in a buggy binary from
+ preempting global symbols we filter them out with this predicate. */
+static __always_inline bool
+dl_symbol_visibility_binds_local_p (const ElfW(Sym) *sym)
+{
+ return (ELFW(ST_VISIBILITY) (sym->st_other) == STV_HIDDEN
+ || ELFW(ST_VISIBILITY) (sym->st_other) == STV_INTERNAL);
+}
+
/* Unmap a loaded object, called by _dl_close (). */
#ifndef DL_UNMAP_IS_SPECIAL
# define DL_UNMAP(map) _dl_unmap_segments (map)
@@ -235,11 +255,14 @@ struct audit_ifaces
/* Test whether given NAME matches any of the names of the given object. */
extern int _dl_name_match_p (const char *__name, const struct link_map *__map)
- internal_function attribute_hidden;
+ attribute_hidden;
/* Compute next higher prime number. */
extern unsigned long int _dl_higher_prime_number (unsigned long int n)
- internal_function attribute_hidden;
+ attribute_hidden;
+
+/* A stripped down strtoul-like implementation. */
+uint64_t _dl_strtoul (const char *, char **) attribute_hidden;
/* Function used as argument for `_dl_receive_error' function. The
arguments are the error code, error string, and the objname the
@@ -344,10 +367,6 @@ struct rtld_global
/* List of search directories. */
EXTERN struct r_search_path_elem *_dl_all_dirs;
-#ifdef _LIBC_REENTRANT
- EXTERN void **(*_dl_error_catch_tsd) (void) __attribute__ ((const));
-#endif
-
/* Structure describing the dynamic linker itself. We need to
reserve memory for the data the audit libraries need. */
EXTERN struct link_map _dl_rtld_map;
@@ -361,10 +380,17 @@ struct rtld_global
EXTERN void (*_dl_rtld_unlock_recursive) (void *);
#endif
+ /* Get architecture specific definitions. */
+#define PROCINFO_DECL
+#ifndef PROCINFO_CLASS
+# define PROCINFO_CLASS EXTERN
+#endif
+#include <dl-procruntime.c>
+
/* If loading a shared object requires that we make the stack executable
when it was not, we do it by calling this function.
It returns an errno code or zero on success. */
- EXTERN int (*_dl_make_stack_executable_hook) (void **) internal_function;
+ EXTERN int (*_dl_make_stack_executable_hook) (void **);
/* Prevailing state of the stack, PF_X indicating it's executable. */
EXTERN ElfW(Word) _dl_stack_flags;
@@ -416,6 +442,9 @@ struct rtld_global
size_t count;
void *list[50];
} *_dl_scope_free_list;
+#if !THREAD_GSCOPE_IN_TCB
+ EXTERN int _dl_thread_gscope_count;
+#endif
#ifdef SHARED
};
# define __rtld_global_attribute__
@@ -506,17 +535,17 @@ struct rtld_global_ro
/* Mask for hardware capabilities that are available. */
EXTERN uint64_t _dl_hwcap;
+#if !HAVE_TUNABLES
/* Mask for important hardware capabilities we honour. */
EXTERN uint64_t _dl_hwcap_mask;
+#endif
+#ifdef HAVE_AUX_VECTOR
/* Pointer to the auxv list supplied to the program at startup. */
EXTERN ElfW(auxv_t) *_dl_auxv;
+#endif
/* Get architecture specific definitions. */
-#define PROCINFO_DECL
-#ifndef PROCINFO_CLASS
-# define PROCINFO_CLASS EXTERN
-#endif
#include <dl-procinfo.c>
/* Names of shared object for which the RPATH should be ignored. */
@@ -539,7 +568,11 @@ struct rtld_global_ro
/* Map of shared object to be prelink traced. */
EXTERN struct link_map *_dl_trace_prelink_map;
- /* All search directories defined at startup. */
+ /* All search directories defined at startup. This is assigned a
+ non-NULL pointer by the ld.so startup code (after initialization
+ to NULL), so this can also serve as an indicator whether a copy
+ of ld.so is initialized and active. See the rtld_active function
+ below. */
EXTERN struct r_search_path_elem *_dl_init_all_dirs;
#ifdef NEED_DL_SYSINFO
@@ -568,19 +601,11 @@ struct rtld_global_ro
PLT relocations in libc.so. */
void (*_dl_debug_printf) (const char *, ...)
__attribute__ ((__format__ (__printf__, 1, 2)));
- int (internal_function *_dl_catch_error) (const char **, const char **,
- bool *, void (*) (void *), void *);
- void (internal_function *_dl_signal_error) (int, const char *, const char *,
- const char *);
void (*_dl_mcount) (ElfW(Addr) frompc, ElfW(Addr) selfpc);
- lookup_t (internal_function *_dl_lookup_symbol_x) (const char *,
- struct link_map *,
- const ElfW(Sym) **,
- struct r_scope_elem *[],
- const struct r_found_version *,
- int, int,
- struct link_map *);
- int (*_dl_check_caller) (const void *, enum allowmask);
+ lookup_t (*_dl_lookup_symbol_x) (const char *, struct link_map *,
+ const ElfW(Sym) **, struct r_scope_elem *[],
+ const struct r_found_version *, int, int,
+ struct link_map *);
void *(*_dl_open) (const char *file, int mode, const void *caller_dlopen,
Lmid_t nsid, int argc, char *argv[], char *env[]);
void (*_dl_close) (void *map);
@@ -617,16 +642,9 @@ extern const ElfW(Phdr) *_dl_phdr;
extern size_t _dl_phnum;
#endif
-#if IS_IN (rtld)
-/* This is the initial value of GL(dl_error_catch_tsd).
- A non-TLS libpthread will change it. */
-extern void **_dl_initial_error_catch_tsd (void) __attribute__ ((const))
- attribute_hidden;
-#endif
-
/* This is the initial value of GL(dl_make_stack_executable_hook).
A threads library can change it. */
-extern int _dl_make_stack_executable (void **stack_endp) internal_function;
+extern int _dl_make_stack_executable (void **stack_endp);
rtld_hidden_proto (_dl_make_stack_executable)
/* Variable pointing to the end of the stack (or close to it). This value
@@ -690,9 +708,20 @@ extern void _dl_debug_printf_c (const char *fmt, ...)
/* Write a message on the specified descriptor FD. The parameters are
interpreted as for a `printf' call. */
+#if IS_IN (rtld) || !defined (SHARED)
extern void _dl_dprintf (int fd, const char *fmt, ...)
__attribute__ ((__format__ (__printf__, 2, 3)))
attribute_hidden;
+#else
+__attribute__ ((always_inline, __format__ (__printf__, 2, 3)))
+static inline void
+_dl_dprintf (int fd, const char *fmt, ...)
+{
+ /* Use local declaration to avoid includign <stdio.h>. */
+ extern int __dprintf(int fd, const char *format, ...) attribute_hidden;
+ __dprintf (fd, fmt, __builtin_va_arg_pack ());
+}
+#endif
/* Write a message on the specified descriptor standard output. The
parameters are interpreted as for a `printf' call. */
@@ -715,41 +744,118 @@ extern void _dl_dprintf (int fd, const char *fmt, ...)
while (1)
-/* This function is called by all the internal dynamic linker functions
- when they encounter an error. ERRCODE is either an `errno' code or
- zero; OBJECT is the name of the problematical shared object, or null if
- it is a general problem; ERRSTRING is a string describing the specific
- problem. */
+/* An exception raised by the _dl_signal_error function family and
+ caught by _dl_catch_error function family. Exceptions themselves
+ are copied as part of the raise operation, but the strings are
+ not. */
+struct dl_exception
+{
+ const char *objname;
+ const char *errstring;
+
+ /* This buffer typically stores both objname and errstring
+ above. */
+ char *message_buffer;
+};
+
+/* Creates a new exception. This calls malloc; if allocation fails,
+ dummy values are inserted. OBJECT is the name of the problematical
+ shared object, or null if its a general problem. ERRSTRING is a
+ string describing the specific problem. */
+void _dl_exception_create (struct dl_exception *, const char *object,
+ const char *errstring)
+ __attribute__ ((nonnull (1, 3)));
+rtld_hidden_proto (_dl_exception_create)
+
+/* Like _dl_exception_create, but create errstring from a format
+ string FMT. Currently, only "%s" and "%%" are supported as format
+ directives. */
+void _dl_exception_create_format (struct dl_exception *, const char *objname,
+ const char *fmt, ...)
+ __attribute__ ((nonnull (1, 3), format (printf, 3, 4)));
+rtld_hidden_proto (_dl_exception_create_format)
+
+/* Deallocate the exception, freeing allocated buffers (if
+ possible). */
+void _dl_exception_free (struct dl_exception *)
+ __attribute__ ((nonnull (1)));
+rtld_hidden_proto (_dl_exception_free)
+
+/* This function is called by all the internal dynamic linker
+ functions when they encounter an error. ERRCODE is either an
+ `errno' code or zero; it specifies the return value of
+ _dl_catch_error. OCCASION is included in the error message if the
+ process is terminated immediately. */
+void _dl_signal_exception (int errcode, struct dl_exception *,
+ const char *occasion)
+ __attribute__ ((__noreturn__));
+libc_hidden_proto (_dl_signal_exception)
+
+/* Like _dl_signal_exception, but creates the exception first. */
extern void _dl_signal_error (int errcode, const char *object,
- const char *occurred, const char *errstring)
- internal_function __attribute__ ((__noreturn__)) attribute_hidden;
+ const char *occasion, const char *errstring)
+ __attribute__ ((__noreturn__));
+libc_hidden_proto (_dl_signal_error)
+
+/* Like _dl_signal_exception, but may return when called in the
+ context of _dl_receive_error. This is only used during ld.so
+ bootstrap. In static and profiled builds, this is equivalent to
+ _dl_signal_exception. */
+#if IS_IN (rtld)
+extern void _dl_signal_cexception (int errcode, struct dl_exception *,
+ const char *occasion) attribute_hidden;
+#else
+__attribute__ ((always_inline))
+static inline void
+_dl_signal_cexception (int errcode, struct dl_exception *exception,
+ const char *occasion)
+{
+ _dl_signal_exception (errcode, exception, occasion);
+}
+#endif
-/* Like _dl_signal_error, but may return when called in the context of
- _dl_receive_error. */
+/* See _dl_signal_cexception above. */
+#if IS_IN (rtld)
extern void _dl_signal_cerror (int errcode, const char *object,
- const char *occation, const char *errstring)
- internal_function attribute_hidden;
+ const char *occasion, const char *errstring)
+ attribute_hidden;
+#else
+__attribute__ ((always_inline))
+static inline void
+_dl_signal_cerror (int errcode, const char *object,
+ const char *occasion, const char *errstring)
+{
+ _dl_signal_error (errcode, object, occasion, errstring);
+}
+#endif
/* Call OPERATE, receiving errors from `dl_signal_cerror'. Unlike
`_dl_catch_error' the operation is resumed after the OPERATE
function returns.
ARGS is passed as argument to OPERATE. */
extern void _dl_receive_error (receiver_fct fct, void (*operate) (void *),
- void *args)
- internal_function attribute_hidden;
-
-/* Call OPERATE, catching errors from `dl_signal_error'. If there is no
- error, *ERRSTRING is set to null. If there is an error, *ERRSTRING is
- set to a string constructed from the strings passed to _dl_signal_error,
- and the error code passed is the return value and *OBJNAME is set to
- the object name which experienced the problems. ERRSTRING if nonzero
- points to a malloc'ed string which the caller has to free after use.
- ARGS is passed as argument to OPERATE. MALLOCEDP is set to true only
- if the returned string is allocated using the libc's malloc. */
+ void *args) attribute_hidden;
+
+/* Call OPERATE, catching errors from `_dl_signal_error' and related
+ functions. If there is no error, *ERRSTRING is set to null. If
+ there is an error, *ERRSTRING is set to a string constructed from
+ the strings passed to _dl_signal_error, and the error code passed
+ is the return value and *OBJNAME is set to the object name which
+ experienced the problems. ERRSTRING if nonzero points to a
+ malloc'ed string which the caller has to free after use. ARGS is
+ passed as argument to OPERATE. MALLOCEDP is set to true only if
+ the returned string is allocated using the libc's malloc. */
extern int _dl_catch_error (const char **objname, const char **errstring,
bool *mallocedp, void (*operate) (void *),
- void *args)
- internal_function attribute_hidden;
+ void *args);
+libc_hidden_proto (_dl_catch_error)
+
+/* Call OPERATE (ARGS). If no error occurs, set *EXCEPTION to zero.
+ Otherwise, store a copy of the raised exception in *EXCEPTION,
+ which has to be freed by _dl_exception_free. */
+int _dl_catch_exception (struct dl_exception *exception,
+ void (*operate) (void *), void *args);
+libc_hidden_proto (_dl_catch_exception)
/* Open the shared object NAME and map in its segments.
LOADER's DT_RPATH is used in searching for NAME.
@@ -757,8 +863,7 @@ extern int _dl_catch_error (const char **objname, const char **errstring,
extern struct link_map *_dl_map_object (struct link_map *loader,
const char *name,
int type, int trace_mode, int mode,
- Lmid_t nsid)
- internal_function attribute_hidden;
+ Lmid_t nsid) attribute_hidden;
/* Call _dl_map_object on the dependencies of MAP, and set up
MAP->l_searchlist. PRELOADS points to a vector of NPRELOADS previously
@@ -768,11 +873,10 @@ extern void _dl_map_object_deps (struct link_map *map,
struct link_map **preloads,
unsigned int npreloads, int trace_mode,
int open_mode)
- internal_function attribute_hidden;
+ attribute_hidden;
/* Cache the locations of MAP's hash table. */
-extern void _dl_setup_hash (struct link_map *map)
- internal_function attribute_hidden;
+extern void _dl_setup_hash (struct link_map *map) attribute_hidden;
/* Collect the directories in the search path for LOADER's dependencies.
@@ -781,8 +885,7 @@ extern void _dl_setup_hash (struct link_map *map)
by a previous call with COUNTING set, and SI must point to SI->dls_size
bytes to be used in filling in the result. */
extern void _dl_rtld_di_serinfo (struct link_map *loader,
- Dl_serinfo *si, bool counting)
- internal_function;
+ Dl_serinfo *si, bool counting);
/* Search loaded objects' symbol tables for a definition of the symbol
@@ -813,22 +916,18 @@ extern lookup_t _dl_lookup_symbol_x (const char *undef,
const struct r_found_version *version,
int type_class, int flags,
struct link_map *skip_map)
- internal_function attribute_hidden;
-
+ attribute_hidden;
-/* Look up symbol NAME in MAP's scope and return its run-time address. */
-extern ElfW(Addr) _dl_symbol_value (struct link_map *map, const char *name)
- internal_function;
/* Add the new link_map NEW to the end of the namespace list. */
extern void _dl_add_to_namespace_list (struct link_map *new, Lmid_t nsid)
- internal_function attribute_hidden;
+ attribute_hidden;
/* Allocate a `struct link_map' for a new object being loaded. */
extern struct link_map *_dl_new_object (char *realname, const char *libname,
int type, struct link_map *loader,
int mode, Lmid_t nsid)
- internal_function attribute_hidden;
+ attribute_hidden;
/* Relocate the given object (if it hasn't already been).
SCOPE is passed to _dl_lookup_symbol in symbol lookups.
@@ -839,15 +938,14 @@ extern void _dl_relocate_object (struct link_map *map,
attribute_hidden;
/* Protect PT_GNU_RELRO area. */
-extern void _dl_protect_relro (struct link_map *map)
- internal_function attribute_hidden;
+extern void _dl_protect_relro (struct link_map *map) attribute_hidden;
/* Call _dl_signal_error with a message about an unhandled reloc type.
TYPE is the result of ELFW(R_TYPE) (r_info), i.e. an R_<CPU>_* value.
PLT is nonzero if this was a PLT reloc; it just affects the message. */
extern void _dl_reloc_bad_type (struct link_map *map,
unsigned int type, int plt)
- internal_function attribute_hidden __attribute__ ((__noreturn__));
+ attribute_hidden __attribute__ ((__noreturn__));
/* Resolve conflicts if prelinking. */
extern void _dl_resolve_conflicts (struct link_map *l,
@@ -858,28 +956,25 @@ extern void _dl_resolve_conflicts (struct link_map *l,
/* Check the version dependencies of all objects available through
MAP. If VERBOSE print some more diagnostics. */
extern int _dl_check_all_versions (struct link_map *map, int verbose,
- int trace_mode)
- internal_function attribute_hidden;
+ int trace_mode) attribute_hidden;
/* Check the version dependencies for MAP. If VERBOSE print some more
diagnostics. */
extern int _dl_check_map_versions (struct link_map *map, int verbose,
- int trace_mode)
- internal_function attribute_hidden;
+ int trace_mode) attribute_hidden;
/* Initialize the object in SCOPE by calling the constructors with
ARGC, ARGV, and ENV as the parameters. */
extern void _dl_init (struct link_map *main_map, int argc, char **argv,
- char **env) internal_function attribute_hidden;
+ char **env) attribute_hidden;
/* Call the finalizer functions of all shared objects whose
initializer functions have completed. */
-extern void _dl_fini (void) internal_function;
+extern void _dl_fini (void) attribute_hidden;
/* Sort array MAPS according to dependencies of the contained objects. */
-extern void _dl_sort_fini (struct link_map **maps, size_t nmaps, char *used,
- Lmid_t ns)
- internal_function attribute_hidden;
+extern void _dl_sort_maps (struct link_map **maps, unsigned int nmaps,
+ char *used, bool for_fini) attribute_hidden;
/* The dynamic linker calls this function before and having changing
any shared object mappings. The `r_state' member of `struct r_debug'
@@ -892,15 +987,14 @@ rtld_hidden_proto (_dl_debug_state)
argument is the run-time load address of the dynamic linker, to be put
in the `r_ldbase' member. Returns the address of the structure. */
extern struct r_debug *_dl_debug_initialize (ElfW(Addr) ldbase, Lmid_t ns)
- internal_function attribute_hidden;
+ attribute_hidden;
/* Initialize the basic data structure for the search paths. */
-extern void _dl_init_paths (const char *library_path)
- internal_function attribute_hidden;
+extern void _dl_init_paths (const char *library_path) attribute_hidden;
/* Gather the information needed to install the profiling tables and start
the timers. */
-extern void _dl_start_profile (void) internal_function attribute_hidden;
+extern void _dl_start_profile (void) attribute_hidden;
/* The actual functions used to keep book on the calls. */
extern void _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc);
@@ -912,25 +1006,22 @@ rtld_hidden_proto (_dl_mcount)
extern void _dl_mcount_wrapper (void *selfpc);
/* Show the members of the auxiliary array passed up from the kernel. */
-extern void _dl_show_auxv (void)
- internal_function attribute_hidden;
+extern void _dl_show_auxv (void) attribute_hidden;
/* Return all environment variables starting with `LD_', one after the
other. */
-extern char *_dl_next_ld_env_entry (char ***position)
- internal_function attribute_hidden;
+extern char *_dl_next_ld_env_entry (char ***position) attribute_hidden;
/* Return an array with the names of the important hardware capabilities. */
extern const struct r_strlenpair *_dl_important_hwcaps (const char *platform,
size_t paltform_len,
size_t *sz,
size_t *max_capstrlen)
- internal_function attribute_hidden;
+ attribute_hidden;
/* Look up NAME in ld.so.cache and return the file name stored there,
or null if none is found. Caller must free returned string. */
-extern char *_dl_load_cache_lookup (const char *name)
- internal_function attribute_hidden;
+extern char *_dl_load_cache_lookup (const char *name) attribute_hidden;
/* If the system does not support MAP_COPY we cannot leave the file open
all the time since this would create problems when the file is replaced.
@@ -942,8 +1033,7 @@ extern void _dl_unload_cache (void) attribute_hidden;
most convenient manner available. *SIZEP gets the size of the
file. On error MAP_FAILED is returned. */
extern void *_dl_sysdep_read_whole_file (const char *file, size_t *sizep,
- int prot)
- internal_function attribute_hidden;
+ int prot) attribute_hidden;
/* System-specific function to do initial startup for the dynamic linker.
After this, file access calls and getenv must work. This is responsible
@@ -956,45 +1046,57 @@ extern ElfW(Addr) _dl_sysdep_start (void **start_argptr,
ElfW(auxv_t) *auxv))
attribute_hidden;
-extern void _dl_sysdep_start_cleanup (void)
- internal_function attribute_hidden;
+extern void _dl_sysdep_start_cleanup (void) attribute_hidden;
/* Determine next available module ID. */
-extern size_t _dl_next_tls_modid (void) internal_function attribute_hidden;
+extern size_t _dl_next_tls_modid (void) attribute_hidden;
/* Count the modules with TLS segments. */
-extern size_t _dl_count_modids (void) internal_function attribute_hidden;
+extern size_t _dl_count_modids (void) attribute_hidden;
/* Calculate offset of the TLS blocks in the static TLS block. */
-extern void _dl_determine_tlsoffset (void) internal_function attribute_hidden;
+extern void _dl_determine_tlsoffset (void) attribute_hidden;
+
+#ifndef SHARED
+/* Set up the TCB for statically linked applications. This is called
+ early during startup because we always use TLS (for errno and the
+ stack protector, among other things). */
+void __libc_setup_tls (void);
+
+# if ENABLE_STATIC_PIE
+/* Relocate static executable with PIE. */
+extern void _dl_relocate_static_pie (void) attribute_hidden;
+
+/* Get a pointer to _dl_main_map. */
+extern struct link_map * _dl_get_dl_main_map (void)
+ __attribute__ ((visibility ("hidden")));
+# else
+# define _dl_relocate_static_pie()
+# endif
+#endif
-/* Set up the data structures for TLS, when they were not set up at startup.
- Returns nonzero on malloc failure.
- This is called from _dl_map_object_from_fd or by libpthread. */
-extern int _dl_tls_setup (void) internal_function;
-rtld_hidden_proto (_dl_tls_setup)
+/* Initialization of libpthread for statically linked applications.
+ If libpthread is not linked in, this is an empty function. */
+void __pthread_initialize_minimal (void) weak_function;
/* Allocate memory for static TLS block (unless MEM is nonzero) and dtv. */
-extern void *_dl_allocate_tls (void *mem) internal_function;
+extern void *_dl_allocate_tls (void *mem);
rtld_hidden_proto (_dl_allocate_tls)
/* Get size and alignment requirements of the static TLS block. */
-extern void _dl_get_tls_static_info (size_t *sizep, size_t *alignp)
- internal_function;
+extern void _dl_get_tls_static_info (size_t *sizep, size_t *alignp);
-extern void _dl_allocate_static_tls (struct link_map *map)
- internal_function attribute_hidden;
+extern void _dl_allocate_static_tls (struct link_map *map) attribute_hidden;
/* These are internal entry points to the two halves of _dl_allocate_tls,
only used within rtld.c itself at startup time. */
-extern void *_dl_allocate_tls_storage (void)
- internal_function attribute_hidden;
-extern void *_dl_allocate_tls_init (void *) internal_function;
+extern void *_dl_allocate_tls_storage (void) attribute_hidden;
+extern void *_dl_allocate_tls_init (void *);
rtld_hidden_proto (_dl_allocate_tls_init)
/* Deallocate memory allocated with _dl_allocate_tls. */
-extern void _dl_deallocate_tls (void *tcb, bool dealloc_tcb) internal_function;
+extern void _dl_deallocate_tls (void *tcb, bool dealloc_tcb);
rtld_hidden_proto (_dl_deallocate_tls)
extern void _dl_nothread_init_static_tls (struct link_map *) attribute_hidden;
@@ -1003,15 +1105,11 @@ extern void _dl_nothread_init_static_tls (struct link_map *) attribute_hidden;
extern const char *_dl_get_origin (void) attribute_hidden;
/* Count DSTs. */
-extern size_t _dl_dst_count (const char *name, int is_path) attribute_hidden;
+extern size_t _dl_dst_count (const char *name) attribute_hidden;
/* Substitute DST values. */
extern char *_dl_dst_substitute (struct link_map *l, const char *name,
- char *result, int is_path) attribute_hidden;
-
-/* Check validity of the caller. */
-extern int _dl_check_caller (const void *caller, enum allowmask mask)
- attribute_hidden;
+ char *result) attribute_hidden;
/* Open the shared object NAME, relocate it, and run its initializer if it
hasn't already been run. MODE is as for `dlopen' (see <dlfcn.h>). If
@@ -1038,22 +1136,37 @@ extern struct link_map *_dl_update_slotinfo (unsigned long int req_modid)
extern void *_dl_tls_get_addr_soft (struct link_map *l) attribute_hidden;
extern int _dl_addr_inside_object (struct link_map *l, const ElfW(Addr) addr)
- internal_function attribute_hidden;
+ attribute_hidden;
/* Show show of an object. */
extern void _dl_show_scope (struct link_map *new, int from)
attribute_hidden;
-extern struct link_map *_dl_find_dso_for_object (const ElfW(Addr) addr)
- internal_function;
+extern struct link_map *_dl_find_dso_for_object (const ElfW(Addr) addr);
rtld_hidden_proto (_dl_find_dso_for_object)
/* Initialization which is normally done by the dynamic linker. */
-extern void _dl_non_dynamic_init (void) internal_function;
+extern void _dl_non_dynamic_init (void)
+ attribute_hidden;
/* Used by static binaries to check the auxiliary vector. */
-extern void _dl_aux_init (ElfW(auxv_t) *av) internal_function;
+extern void _dl_aux_init (ElfW(auxv_t) *av)
+ attribute_hidden;
+/* Return true if the ld.so copy in this namespace is actually active
+ and working. If false, the dl_open/dlfcn hooks have to be used to
+ call into the outer dynamic linker (which happens after static
+ dlopen). */
+#ifdef SHARED
+static inline bool
+rtld_active (void)
+{
+ /* The default-initialized variable does not have a non-zero
+ dl_init_all_dirs member, so this allows us to recognize an
+ initialized and active ld.so copy. */
+ return GLRO(dl_init_all_dirs) != NULL;
+}
+#endif
__END_DECLS
diff --git a/sysdeps/generic/libc-lock.h b/sysdeps/generic/libc-lock.h
index d5a541e209..4f21f9c8c0 100644
--- a/sysdeps/generic/libc-lock.h
+++ b/sysdeps/generic/libc-lock.h
@@ -1,5 +1,5 @@
/* libc-internal interface for mutex locks. Stub version.
- Copyright (C) 1996-2016 Free Software Foundation, Inc.
+ Copyright (C) 1996-2018 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
diff --git a/sysdeps/generic/libc-mmap.h b/sysdeps/generic/libc-mmap.h
index e2e0ca36b9..8de70ebf57 100644
--- a/sysdeps/generic/libc-mmap.h
+++ b/sysdeps/generic/libc-mmap.h
@@ -1,5 +1,5 @@
/* Internal logic for dealing with mmap quirks.
- Copyright (C) 2013-2016 Free Software Foundation, Inc.
+ Copyright (C) 2013-2018 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
diff --git a/sysdeps/generic/libc-start.h b/sysdeps/generic/libc-start.h
new file mode 100644
index 0000000000..e0361f655a
--- /dev/null
+++ b/sysdeps/generic/libc-start.h
@@ -0,0 +1,31 @@
+/* Generic definitions for libc main startup.
+ Copyright (C) 2017-2018 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 _LIBC_START_H
+#define _LIBC_START_H
+
+#ifndef SHARED
+/* By default we perform STT_GNU_IFUNC resolution *before* TLS
+ initialization, and this means you cannot, without machine
+ knowledge, access TLS from an IFUNC resolver. */
+#define ARCH_SETUP_IREL() apply_irel ()
+#define ARCH_SETUP_TLS() __libc_setup_tls ()
+#define ARCH_APPLY_IREL()
+#endif /* ! SHARED */
+
+#endif /* _LIBC_START_H */
diff --git a/sysdeps/generic/libc-tsd.h b/sysdeps/generic/libc-tsd.h
index eef55ef3ad..73e792dd0a 100644
--- a/sysdeps/generic/libc-tsd.h
+++ b/sysdeps/generic/libc-tsd.h
@@ -1,5 +1,5 @@
/* libc-internal interface for thread-specific data. Stub or TLS version.
- Copyright (C) 1998-2016 Free Software Foundation, Inc.
+ Copyright (C) 1998-2018 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
diff --git a/sysdeps/generic/libm-alias-double.h b/sysdeps/generic/libm-alias-double.h
new file mode 100644
index 0000000000..b97d2f8c36
--- /dev/null
+++ b/sysdeps/generic/libm-alias-double.h
@@ -0,0 +1,72 @@
+/* Define aliases for libm double functions.
+ Copyright (C) 2017-2018 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 _LIBM_ALIAS_DOUBLE_H
+#define _LIBM_ALIAS_DOUBLE_H
+
+#include <bits/floatn.h>
+
+#if __HAVE_FLOAT64 && !__HAVE_DISTINCT_FLOAT64
+# define libm_alias_double_other_r_f64(from, to, r) \
+ weak_alias (from ## r, to ## f64 ## r)
+#else
+# define libm_alias_double_other_r_f64(from, to, r)
+#endif
+
+#if __HAVE_FLOAT32X && !__HAVE_DISTINCT_FLOAT32X
+# define libm_alias_double_other_r_f32x(from, to, r) \
+ weak_alias (from ## r, to ## f32x ## r)
+#else
+# define libm_alias_double_other_r_f32x(from, to, r)
+#endif
+
+/* Define _FloatN / _FloatNx aliases for a double libm function that
+ has internal name FROM ## R and public names TO ## suffix ## R for
+ each suffix of a supported _FloatN / _FloatNx floating-point type
+ with the same format as double. */
+#define libm_alias_double_other_r(from, to, r) \
+ libm_alias_double_other_r_f64 (from, to, r); \
+ libm_alias_double_other_r_f32x (from, to, r)
+
+/* Likewise, but without the R suffix. */
+#define libm_alias_double_other(from, to) \
+ libm_alias_double_other_r (from, to, )
+
+/* Define aliases for a double libm function that has internal name
+ FROM ## R and public names TO ## suffix ## R for each suffix of a
+ supported floating-point type with the same format as double. This
+ should only be used for functions where such public names exist for
+ _FloatN types, not for implementation-namespace exported names
+ (where there is one name per format, not per type) or for
+ obsolescent functions not provided for _FloatN types. */
+#ifdef NO_LONG_DOUBLE
+# define libm_alias_double_r(from, to, r) \
+ weak_alias (from ## r, to ## r) \
+ strong_alias (from ## r, from ## l ## r) \
+ weak_alias (from ## r, to ## l ## r); \
+ libm_alias_double_other_r (from, to, r)
+#else
+# define libm_alias_double_r(from, to, r) \
+ weak_alias (from ## r, to ## r); \
+ libm_alias_double_other_r (from, to, r)
+#endif
+
+/* Likewise, but without the R suffix. */
+#define libm_alias_double(from, to) libm_alias_double_r (from, to, )
+
+#endif
diff --git a/sysdeps/generic/libm-alias-float.h b/sysdeps/generic/libm-alias-float.h
new file mode 100644
index 0000000000..50e464f270
--- /dev/null
+++ b/sysdeps/generic/libm-alias-float.h
@@ -0,0 +1,53 @@
+/* Define aliases for libm float functions.
+ Copyright (C) 2017-2018 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 _LIBM_ALIAS_FLOAT_H
+#define _LIBM_ALIAS_FLOAT_H
+
+#include <bits/floatn.h>
+
+/* Define _FloatN / _FloatNx aliases for a float libm function that
+ has internal name FROM ## f ## R and public names TO ## suffix ## R
+ for each suffix of a supported _FloatN / _FloatNx floating-point
+ type with the same format as float. */
+#if __HAVE_FLOAT32 && !__HAVE_DISTINCT_FLOAT32
+# define libm_alias_float_other_r(from, to, r) \
+ weak_alias (from ## f ## r, to ## f32 ## r)
+#else
+# define libm_alias_float_other_r(from, to, r)
+#endif
+
+/* Likewise, but without the R suffix. */
+#define libm_alias_float_other(from, to) \
+ libm_alias_float_other_r (from, to, )
+
+/* Define aliases for a float libm function that has internal name
+ FROM ## f ## R and public names TO ## suffix ## R for each suffix
+ of a supported floating-point type with the same format as float.
+ This should only be used for functions where such public names
+ exist for _FloatN types, not for implementation-namespace exported
+ names (where there is one name per format, not per type) or for
+ obsolescent functions not provided for _FloatN types. */
+#define libm_alias_float_r(from, to, r) \
+ weak_alias (from ## f ## r, to ## f ## r); \
+ libm_alias_float_other_r (from, to, r)
+
+/* Likewise, but without the R suffix. */
+#define libm_alias_float(from, to) libm_alias_float_r (from, to, )
+
+#endif
diff --git a/sysdeps/generic/libm-alias-float128.h b/sysdeps/generic/libm-alias-float128.h
new file mode 100644
index 0000000000..3a3ff50ff7
--- /dev/null
+++ b/sysdeps/generic/libm-alias-float128.h
@@ -0,0 +1,55 @@
+/* Define aliases for libm _Float128 functions.
+ Copyright (C) 2017-2018 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 _LIBM_ALIAS_FLOAT128_H
+#define _LIBM_ALIAS_FLOAT128_H
+
+#include <bits/floatn.h>
+
+/* Define _FloatN / _FloatNx aliases (other than that for _Float128)
+ for a _Float128 libm function that has internal name FROM ## f128
+ ## R and public names TO ## suffix ## R for each suffix of a
+ supported _FloatN / _FloatNx floating-point type with the same
+ format as _Float128. */
+#if __HAVE_FLOAT64X && !__HAVE_FLOAT64X_LONG_DOUBLE
+# define libm_alias_float128_other_r(from, to, r) \
+ weak_alias (from ## f128 ## r, to ## f64x ## r)
+#else
+# define libm_alias_float128_other_r(from, to, r)
+#endif
+
+/* Likewise, but without the R suffix. */
+#define libm_alias_float128_other(from, to) \
+ libm_alias_float128_other_r (from, to, )
+
+/* Define aliases for a _Float128 libm function that has internal name
+ FROM ## f128 ## R and public names TO ## suffix ## R for each
+ suffix of a supported floating-point type with the same format as
+ _Float128. This should only be used for functions where such
+ public names exist for _FloatN types, not for
+ implementation-namespace exported names (where there is one name
+ per format, not per type) or for obsolescent functions not provided
+ for _FloatN types. */
+#define libm_alias_float128_r(from, to, r) \
+ weak_alias (from ## f128 ## r, to ## f128 ## r); \
+ libm_alias_float128_other_r (from, to, r)
+
+/* Likewise, but without the R suffix. */
+#define libm_alias_float128(from, to) libm_alias_float128_r (from, to, )
+
+#endif
diff --git a/sysdeps/generic/libm-alias-ldouble.h b/sysdeps/generic/libm-alias-ldouble.h
new file mode 100644
index 0000000000..7abfe30121
--- /dev/null
+++ b/sysdeps/generic/libm-alias-ldouble.h
@@ -0,0 +1,65 @@
+/* Define aliases for libm long double functions.
+ Copyright (C) 2017-2018 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 _LIBM_ALIAS_LDOUBLE_H
+#define _LIBM_ALIAS_LDOUBLE_H
+
+#include <bits/floatn.h>
+
+#if __HAVE_FLOAT128 && !__HAVE_DISTINCT_FLOAT128
+# define libm_alias_ldouble_other_r_f128(from, to, r) \
+ weak_alias (from ## l ## r, to ## f128 ## r)
+#else
+# define libm_alias_ldouble_other_r_f128(from, to, r)
+#endif
+
+#if __HAVE_FLOAT64X_LONG_DOUBLE
+# define libm_alias_ldouble_other_r_f64x(from, to, r) \
+ weak_alias (from ## l ## r, to ## f64x ## r)
+#else
+# define libm_alias_ldouble_other_r_f64x(from, to, r)
+#endif
+
+/* Define _FloatN / _FloatNx aliases for a long double libm function
+ that has internal name FROM ## l ## R and public names TO ## suffix
+ ## R for each suffix of a supported _FloatN / _FloatNx
+ floating-point type with the same format as long double. */
+#define libm_alias_ldouble_other_r(from, to, r) \
+ libm_alias_ldouble_other_r_f128 (from, to, r); \
+ libm_alias_ldouble_other_r_f64x (from, to, r)
+
+/* Likewise, but without the R suffix. */
+#define libm_alias_ldouble_other(from, to) \
+ libm_alias_ldouble_other_r (from, to, )
+
+/* Define aliases for a long double libm function that has internal
+ name FROM ## l ## R and public names TO ## suffix ## R for each
+ suffix of a supported floating-point type with the same format as
+ long double. This should only be used for functions where such
+ public names exist for _FloatN types, not for
+ implementation-namespace exported names (where there is one name
+ per format, not per type) or for obsolescent functions not provided
+ for _FloatN types. */
+#define libm_alias_ldouble_r(from, to, r) \
+ weak_alias (from ## l ## r, to ## l ## r); \
+ libm_alias_ldouble_other_r (from, to, r)
+
+/* Likewise, but without the R suffix. */
+#define libm_alias_ldouble(from, to) libm_alias_ldouble_r (from, to, )
+
+#endif
diff --git a/sysdeps/generic/libm-test-ulps-name b/sysdeps/generic/libm-test-ulps-name
new file mode 100644
index 0000000000..8470d61195
--- /dev/null
+++ b/sysdeps/generic/libm-test-ulps-name
@@ -0,0 +1 @@
+Generic
diff --git a/sysdeps/generic/libcidn.abilist b/sysdeps/generic/libnsl.abilist
index e69de29bb2..e69de29bb2 100644
--- a/sysdeps/generic/libcidn.abilist
+++ b/sysdeps/generic/libnsl.abilist
diff --git a/sysdeps/generic/libutil.abilist b/sysdeps/generic/libutil.abilist
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/sysdeps/generic/libutil.abilist
diff --git a/sysdeps/generic/link_map.h b/sysdeps/generic/link_map.h
new file mode 100644
index 0000000000..a056184690
--- /dev/null
+++ b/sysdeps/generic/link_map.h
@@ -0,0 +1 @@
+/* No architecture specific definitions. */
diff --git a/sysdeps/generic/localplt.data b/sysdeps/generic/localplt.data
index 1a40cf9841..2d5c66ae28 100644
--- a/sysdeps/generic/localplt.data
+++ b/sysdeps/generic/localplt.data
@@ -7,11 +7,14 @@ libc.so: malloc
libc.so: memalign
libc.so: realloc
libm.so: matherr
-# The dynamic loader uses __libc_memalign internally to allocate aligned
-# TLS storage. The other malloc family of functions are expected to allow
-# user symbol interposition.
-ld.so: __libc_memalign
+# The main malloc is interposed into the dynamic linker, for
+# allocations after the initial link (when dlopen is used).
ld.so: malloc
ld.so: calloc
ld.so: realloc
ld.so: free
+# The TLS-enabled version of these functions is interposed from libc.so.
+ld.so: _dl_signal_error
+ld.so: _dl_catch_error
+ld.so: _dl_signal_exception
+ld.so: _dl_catch_exception
diff --git a/sysdeps/generic/machine-gmon.h b/sysdeps/generic/machine-gmon.h
index 0bacaa95be..2463ad388e 100644
--- a/sysdeps/generic/machine-gmon.h
+++ b/sysdeps/generic/machine-gmon.h
@@ -1,5 +1,5 @@
/* Machine-dependent definitions for profiling support. Generic GCC 2 version.
- Copyright (C) 1996-2016 Free Software Foundation, Inc.
+ Copyright (C) 1996-2018 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
diff --git a/sysdeps/generic/machine-lock.h b/sysdeps/generic/machine-lock.h
index 71e299eb5e..b3e6724ed3 100644
--- a/sysdeps/generic/machine-lock.h
+++ b/sysdeps/generic/machine-lock.h
@@ -1,5 +1,5 @@
/* Machine-specific definition for spin locks. Stub version.
- Copyright (C) 1994-2016 Free Software Foundation, Inc.
+ Copyright (C) 1994-2018 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
@@ -34,9 +34,9 @@ typedef volatile int __spin_lock_t;
/* Unlock LOCK. */
-void __spin_unlock (__spin_lock_t *__lock);
+extern void __spin_unlock (__spin_lock_t *__lock);
-#ifdef __USE_EXTERN_INLINES
+#if defined __USE_EXTERN_INLINES && defined _LIBC
_EXTERN_INLINE void
__spin_unlock (__spin_lock_t *__lock)
{
@@ -46,9 +46,9 @@ __spin_unlock (__spin_lock_t *__lock)
/* Try to lock LOCK; return nonzero if we locked it, zero if another has. */
-int __spin_try_lock (__spin_lock_t *__lock);
+extern int __spin_try_lock (__spin_lock_t *__lock);
-#ifdef __USE_EXTERN_INLINES
+#if defined __USE_EXTERN_INLINES && defined _LIBC
_EXTERN_INLINE int
__spin_try_lock (__spin_lock_t *__lock)
{
@@ -61,9 +61,9 @@ __spin_try_lock (__spin_lock_t *__lock)
/* Return nonzero if LOCK is locked. */
-int __spin_lock_locked (__spin_lock_t *__lock);
+extern int __spin_lock_locked (__spin_lock_t *__lock);
-#ifdef __USE_EXTERN_INLINES
+#if defined __USE_EXTERN_INLINES && defined _LIBC
_EXTERN_INLINE int
__spin_lock_locked (__spin_lock_t *__lock)
{
diff --git a/sysdeps/generic/machine-sp.h b/sysdeps/generic/machine-sp.h
index 0bc90f3d5b..6be9d26f59 100644
--- a/sysdeps/generic/machine-sp.h
+++ b/sysdeps/generic/machine-sp.h
@@ -1,5 +1,5 @@
/* Machine-specific function to return the stack pointer. Stub version.
- Copyright (C) 1994-2016 Free Software Foundation, Inc.
+ Copyright (C) 1994-2018 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
diff --git a/sysdeps/generic/malloc-alignment.h b/sysdeps/generic/malloc-alignment.h
new file mode 100644
index 0000000000..d60c74e89a
--- /dev/null
+++ b/sysdeps/generic/malloc-alignment.h
@@ -0,0 +1,31 @@
+/* Define MALLOC_ALIGNMENT for malloc. Generic version.
+ Copyright (C) 2017-2018 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 _GENERIC_MALLOC_ALIGNMENT_H
+#define _GENERIC_MALLOC_ALIGNMENT_H
+
+/* MALLOC_ALIGNMENT is the minimum alignment for malloc'ed chunks. It
+ must be a power of two at least 2 * SIZE_SZ, even on machines for
+ which smaller alignments would suffice. It may be defined as larger
+ than this though. Note however that code and data structures are
+ optimized for the case of 8-byte alignment. */
+#define MALLOC_ALIGNMENT (2 * SIZE_SZ < __alignof__ (long double) \
+ ? __alignof__ (long double) : 2 * SIZE_SZ)
+
+
+#endif /* !defined(_GENERIC_MALLOC_ALIGNMENT_H) */
diff --git a/sysdeps/generic/malloc-machine.h b/sysdeps/generic/malloc-machine.h
index 1ed2d50a20..68ca3c7bc4 100644
--- a/sysdeps/generic/malloc-machine.h
+++ b/sysdeps/generic/malloc-machine.h
@@ -1,6 +1,6 @@
/* Basic platform-independent macro definitions for mutexes,
thread-specific data and parameters for malloc.
- Copyright (C) 2003-2016 Free Software Foundation, Inc.
+ Copyright (C) 2003-2018 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
@@ -21,25 +21,7 @@
#define _GENERIC_MALLOC_MACHINE_H
#include <atomic.h>
-
-#ifndef mutex_init /* No threads, provide dummy macros */
-
-# define NO_THREADS
-
-/* The mutex functions used to do absolutely nothing, i.e. lock,
- trylock and unlock would always just return 0. However, even
- without any concurrently active threads, a mutex can be used
- legitimately as an `in use' flag. To make the code that is
- protected by a mutex async-signal safe, these macros would have to
- be based on atomic test-and-set operations, for example. */
-typedef int mutex_t;
-
-# define mutex_init(m) (*(m) = 0)
-# define mutex_lock(m) ({ *(m) = 1; 0; })
-# define mutex_trylock(m) (*(m) ? 1 : ((*(m) = 1), 0))
-# define mutex_unlock(m) (*(m) = 0)
-
-#endif /* !defined mutex_init */
+#include <malloc-alignment.h>
#ifndef atomic_full_barrier
# define atomic_full_barrier() __asm ("" ::: "memory")
diff --git a/sysdeps/generic/malloc-sysdep.h b/sysdeps/generic/malloc-sysdep.h
index 09b70ae9dc..890684d900 100644
--- a/sysdeps/generic/malloc-sysdep.h
+++ b/sysdeps/generic/malloc-sysdep.h
@@ -1,5 +1,5 @@
/* System-specific malloc support functions. Generic version.
- Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ Copyright (C) 2012-2018 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
diff --git a/sysdeps/generic/math-barriers.h b/sysdeps/generic/math-barriers.h
new file mode 100644
index 0000000000..425173149c
--- /dev/null
+++ b/sysdeps/generic/math-barriers.h
@@ -0,0 +1,37 @@
+/* Control when floating-point expressions are evaluated. Generic version.
+ Copyright (C) 2007-2018 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 _MATH_BARRIERS_H
+#define _MATH_BARRIERS_H 1
+
+/* math_opt_barrier evaluates and returns its floating-point argument
+ and ensures that the evaluation of any expression using the result
+ of math_opt_barrier is not moved before the call. math_force_eval
+ ensures that its floating-point argument is evaluated for its side
+ effects even if its value is apparently unused, and that the
+ evaluation of its argument is not moved after the call. Both these
+ macros are used to ensure the correct ordering of floating-point
+ expression evaluations with respect to accesses to the
+ floating-point environment. */
+
+#define math_opt_barrier(x) \
+ ({ __typeof (x) __x = (x); __asm ("" : "+m" (__x)); __x; })
+#define math_force_eval(x) \
+ ({ __typeof (x) __x = (x); __asm __volatile__ ("" : : "m" (__x)); })
+
+#endif /* math-barriers.h */
diff --git a/sysdeps/generic/math-nan-payload-double.h b/sysdeps/generic/math-nan-payload-double.h
new file mode 100644
index 0000000000..cfcc53a7b6
--- /dev/null
+++ b/sysdeps/generic/math-nan-payload-double.h
@@ -0,0 +1,29 @@
+/* NaN payload handling for double.
+ Copyright (C) 1997-2018 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 SET_NAN_PAYLOAD(flt, mant) \
+ do \
+ { \
+ union ieee754_double u; \
+ u.d = (flt); \
+ u.ieee_nan.mantissa0 = (mant) >> 32; \
+ u.ieee_nan.mantissa1 = (mant); \
+ if ((u.ieee.mantissa0 | u.ieee.mantissa1) != 0) \
+ (flt) = u.d; \
+ } \
+ while (0)
diff --git a/sysdeps/generic/math-nan-payload-float.h b/sysdeps/generic/math-nan-payload-float.h
new file mode 100644
index 0000000000..2a4ff8ca64
--- /dev/null
+++ b/sysdeps/generic/math-nan-payload-float.h
@@ -0,0 +1,28 @@
+/* NaN payload handling for float.
+ Copyright (C) 1997-2018 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 SET_NAN_PAYLOAD(flt, mant) \
+ do \
+ { \
+ union ieee754_float u; \
+ u.f = (flt); \
+ u.ieee_nan.mantissa = (mant); \
+ if (u.ieee.mantissa != 0) \
+ (flt) = u.f; \
+ } \
+ while (0)
diff --git a/sysdeps/generic/math-tests-arch.h b/sysdeps/generic/math-tests-arch.h
index 47f14ba9fb..4d0268897c 100644
--- a/sysdeps/generic/math-tests-arch.h
+++ b/sysdeps/generic/math-tests-arch.h
@@ -1,5 +1,5 @@
/* Runtime architecture check for math tests.
- Copyright (C) 2014-2016 Free Software Foundation, Inc.
+ Copyright (C) 2014-2018 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
diff --git a/sysdeps/generic/math-tests.h b/sysdeps/generic/math-tests.h
index 9393229a36..cf9eff4691 100644
--- a/sysdeps/generic/math-tests.h
+++ b/sysdeps/generic/math-tests.h
@@ -1,5 +1,5 @@
/* Configuration for math tests. Generic version.
- Copyright (C) 2013-2016 Free Software Foundation, Inc.
+ Copyright (C) 2013-2018 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
@@ -16,6 +16,23 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#include <bits/floatn.h>
+
+/* Expand the appropriate macro for whether to enable tests for a
+ given type. */
+#if __HAVE_DISTINCT_FLOAT128
+# define MATH_TESTS_TG(PREFIX, ARGS, TYPE) \
+ (sizeof (TYPE) == sizeof (float) ? PREFIX ## float ARGS \
+ : sizeof (TYPE) == sizeof (double) ? PREFIX ## double ARGS \
+ : __builtin_types_compatible_p (TYPE, _Float128) ? PREFIX ## float128 ARGS \
+ : PREFIX ## long_double ARGS)
+# else
+# define MATH_TESTS_TG(PREFIX, ARGS, TYPE) \
+ (sizeof (TYPE) == sizeof (float) ? PREFIX ## float ARGS \
+ : sizeof (TYPE) == sizeof (double) ? PREFIX ## double ARGS \
+ : PREFIX ## long_double ARGS)
+#endif
+
/* Indicate whether to run tests involving sNaN values for the float, double,
and long double C data types, respectively. All are run unless
overridden. */
@@ -28,12 +45,12 @@
#ifndef SNAN_TESTS_long_double
# define SNAN_TESTS_long_double 1
#endif
+#ifndef SNAN_TESTS_float128
+# define SNAN_TESTS_float128 1
+#endif
/* Return nonzero value if to run tests involving sNaN values for X. */
-#define SNAN_TESTS(x) \
- (sizeof (x) == sizeof (float) ? SNAN_TESTS_float \
- : sizeof (x) == sizeof (double) ? SNAN_TESTS_double \
- : SNAN_TESTS_long_double)
+#define SNAN_TESTS(x) MATH_TESTS_TG (SNAN_TESTS_, , x)
/* Indicate whether to run tests involving type casts of sNaN values. These
are run unless overridden. */
@@ -41,6 +58,14 @@
# define SNAN_TESTS_TYPE_CAST 1
#endif
+/* Indicate whether operations on signaling NaNs preserve the payload
+ (if possible; it is not possible with a zero payload if the high
+ bit is set for signaling NaNs) when generating a quiet NaN, and
+ this should be tested. */
+#ifndef SNAN_TESTS_PRESERVE_PAYLOAD
+# define SNAN_TESTS_PRESERVE_PAYLOAD 1
+#endif
+
/* Indicate whether to run tests involving a given rounding mode for a
given floating-point type, given that fesetround succeeds for that
mode. All are run if fesetround succeeds unless overridden. */
@@ -53,11 +78,12 @@
#ifndef ROUNDING_TESTS_long_double
# define ROUNDING_TESTS_long_double(MODE) 1
#endif
+#ifndef ROUNDING_TESTS_float128
+# define ROUNDING_TESTS_float128(MODE) 1
+#endif
-#define ROUNDING_TESTS(TYPE, MODE) \
- (sizeof (TYPE) == sizeof (float) ? ROUNDING_TESTS_float (MODE) \
- : sizeof (TYPE) == sizeof (double) ? ROUNDING_TESTS_double (MODE) \
- : ROUNDING_TESTS_long_double (MODE))
+#define ROUNDING_TESTS(TYPE, MODE) \
+ MATH_TESTS_TG (ROUNDING_TESTS_, (MODE), TYPE)
/* Indicate whether to run tests of floating-point exceptions for a
given floating-point type, given that the exception macros are
@@ -71,11 +97,11 @@
#ifndef EXCEPTION_TESTS_long_double
# define EXCEPTION_TESTS_long_double 1
#endif
+#ifndef EXCEPTION_TESTS_float128
+# define EXCEPTION_TESTS_float128 1
+#endif
-#define EXCEPTION_TESTS(TYPE) \
- (sizeof (TYPE) == sizeof (float) ? EXCEPTION_TESTS_float \
- : sizeof (TYPE) == sizeof (double) ? EXCEPTION_TESTS_double \
- : EXCEPTION_TESTS_long_double)
+#define EXCEPTION_TESTS(TYPE) MATH_TESTS_TG (EXCEPTION_TESTS_, , TYPE)
/* Indicate whether the given exception trap(s) can be enabled
in feenableexcept. If non-zero, the traps are always supported.
@@ -87,3 +113,12 @@
# define EXCEPTION_ENABLE_SUPPORTED(EXCEPT) \
(EXCEPTION_TESTS_float || EXCEPTION_TESTS_double)
#endif
+
+/* Indicate whether exception traps, if enabled, occur whenever an
+ exception flag is set explicitly, so it is not possible to set flag
+ bits with traps enabled without causing traps to be taken. If
+ traps cannot be enabled, the value of this macro does not
+ matter. */
+#ifndef EXCEPTION_SET_FORCES_TRAP
+# define EXCEPTION_SET_FORCES_TRAP 0
+#endif
diff --git a/sysdeps/generic/math-type-macros-double.h b/sysdeps/generic/math-type-macros-double.h
new file mode 100644
index 0000000000..be5d94488f
--- /dev/null
+++ b/sysdeps/generic/math-type-macros-double.h
@@ -0,0 +1,49 @@
+/* Helper macros for double variants of type generic functions of libm.
+ Copyright (C) 2016-2018 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 _MATH_TYPE_MACROS_DOUBLE
+#define _MATH_TYPE_MACROS_DOUBLE
+
+#define M_LIT(c) c
+#define M_MLIT(c) c
+#define M_PFX DBL
+#define M_SUF(c) c
+#define FLOAT double
+#define CFLOAT _Complex double
+#define M_STRTO_NAN __strtod_nan
+
+#include <libm-alias-double.h>
+#include <math-nan-payload-double.h>
+
+#ifndef declare_mgen_alias
+# define declare_mgen_alias(from, to) libm_alias_double (from, to)
+#endif
+
+#ifndef declare_mgen_alias_r
+# define declare_mgen_alias_r(from, to) libm_alias_double_r (from, to, _r)
+#endif
+
+/* Supply the generic macros. */
+#include <math-type-macros.h>
+
+/* Do not use the type-generic wrapper templates if compatibility with
+ SVID error handling is needed. */
+#include <math/math-svid-compat.h>
+#define __USE_WRAPPER_TEMPLATE !LIBM_SVID_COMPAT
+
+#endif
diff --git a/sysdeps/generic/math-type-macros-float.h b/sysdeps/generic/math-type-macros-float.h
new file mode 100644
index 0000000000..1f280950cd
--- /dev/null
+++ b/sysdeps/generic/math-type-macros-float.h
@@ -0,0 +1,52 @@
+/* Helper macros for float variants of type generic functions of libm.
+ Copyright (C) 2016-2018 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 _MATH_TYPE_MACROS_FLOAT
+#define _MATH_TYPE_MACROS_FLOAT
+
+#define M_LIT(c) c ## f
+#define M_PFX FLT
+#define M_SUF(c) c ## f
+#define FLOAT float
+#define CFLOAT _Complex float
+#define M_STRTO_NAN __strtof_nan
+
+/* Standard/GNU macro literals do not exist for the float type. Use
+ the double macro constants. */
+#define M_MLIT(c) c
+
+#include <libm-alias-float.h>
+#include <math-nan-payload-float.h>
+
+#ifndef declare_mgen_alias
+# define declare_mgen_alias(from, to) libm_alias_float (from, to)
+#endif
+
+#ifndef declare_mgen_alias_r
+# define declare_mgen_alias_r(from, to) libm_alias_float_r (from, to, _r)
+#endif
+
+/* Supply the generic macros. */
+#include <math-type-macros.h>
+
+/* Do not use the type-generic wrapper templates if compatibility with
+ SVID error handling is needed. */
+#include <math/math-svid-compat.h>
+#define __USE_WRAPPER_TEMPLATE !LIBM_SVID_COMPAT
+
+#endif
diff --git a/sysdeps/generic/math-type-macros-float128.h b/sysdeps/generic/math-type-macros-float128.h
new file mode 100644
index 0000000000..c36785fbe3
--- /dev/null
+++ b/sysdeps/generic/math-type-macros-float128.h
@@ -0,0 +1,49 @@
+/* Helper macros for _Float128 variants of type generic functions of libm.
+ Copyright (C) 2017-2018 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 _MATH_TYPE_MACROS_FLOAT128
+#define _MATH_TYPE_MACROS_FLOAT128
+
+#define M_LIT(c) __f128 (c)
+#define M_PFX FLT128
+#define M_SUF(c) c ## f128
+#define FLOAT _Float128
+#define M_STRTO_NAN __strtof128_nan
+
+#define CFLOAT __CFLOAT128
+
+#define M_MLIT(c) c ## f128
+
+#include <libm-alias-float128.h>
+#include <math-nan-payload-float128.h>
+
+#ifndef declare_mgen_alias
+# define declare_mgen_alias(from, to) libm_alias_float128 (from, to)
+#endif
+
+#ifndef declare_mgen_alias_r
+# define declare_mgen_alias_r(from, to) libm_alias_float128_r (from, to, _r)
+#endif
+
+/* Supply the generic macros. */
+#include <math-type-macros.h>
+
+/* Use the type-generic wrapper templates. */
+#define __USE_WRAPPER_TEMPLATE 1
+
+#endif
diff --git a/sysdeps/generic/math-type-macros-ldouble.h b/sysdeps/generic/math-type-macros-ldouble.h
new file mode 100644
index 0000000000..300dd18f94
--- /dev/null
+++ b/sysdeps/generic/math-type-macros-ldouble.h
@@ -0,0 +1,49 @@
+/* Helper macros for long double variants of type generic functions of libm.
+ Copyright (C) 2016-2018 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 _MATH_TYPE_MACROS_LDOUBLE
+#define _MATH_TYPE_MACROS_LDOUBLE
+
+#define M_LIT(c) c ## L
+#define M_MLIT(c) c ## l
+#define M_PFX LDBL
+#define M_SUF(c) c ## l
+#define FLOAT long double
+#define CFLOAT _Complex long double
+#define M_STRTO_NAN __strtold_nan
+
+#include <libm-alias-ldouble.h>
+#include <math-nan-payload-ldouble.h>
+
+#ifndef declare_mgen_alias
+# define declare_mgen_alias(from, to) libm_alias_ldouble (from, to)
+#endif
+
+#ifndef declare_mgen_alias_r
+# define declare_mgen_alias_r(from, to) libm_alias_ldouble_r (from, to, _r)
+#endif
+
+/* Supply the generic macros. */
+#include <math-type-macros.h>
+
+/* Do not use the type-generic wrapper templates if compatibility with
+ SVID error handling is needed. */
+#include <math/math-svid-compat.h>
+#define __USE_WRAPPER_TEMPLATE !LIBM_SVID_COMPAT
+
+#endif
diff --git a/sysdeps/generic/math-type-macros.h b/sysdeps/generic/math-type-macros.h
new file mode 100644
index 0000000000..5250815253
--- /dev/null
+++ b/sysdeps/generic/math-type-macros.h
@@ -0,0 +1,134 @@
+/* Helper macros for type generic function implementations within libm.
+ Copyright (C) 2016-2018 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 _MATH_TYPE_MACROS
+#define _MATH_TYPE_MACROS
+
+/* Each type imports a header which is expected to
+ define:
+
+ M_LIT(x) - Paste the type specific suffix onto the constant x.
+ M_MLIT(x) - Paste the type specific suffix used by the macro
+ constants in math.h, i.e M_PI or M_PIl.
+ M_PFX - The prefixed used by float.h macros like FLT_MANT_DIG.
+ M_SUF(x) - Paste the the type specific suffix used by functions
+ i.e expf expl exp.
+ FLOAT - Resolves to the C typename of M_TYPE.
+ CFLOAT - Resolves to the complex typename of M_TYPE.
+ M_STRTO_NAN - Resolves to the internal libc function which
+ converts a string into the appropriate FLOAT nan
+ value.
+
+ declare_mgen_alias(from,to)
+ This exposes the appropriate symbol(s) for a
+ function f of type FLOAT.
+
+ declare_mgen_alias_r(from,to)
+ This exposes the appropriate symbol(s) for a
+ function f_r of type FLOAT.
+
+ SET_NAN_PAYLOAD(flt, mant)
+ Set the NaN payload bits of the variable FLT of type FLOAT to
+ the mantissa MANT. */
+
+#ifndef M_PFX
+# error "M_PFX must be defined."
+#endif
+#ifndef M_LIT
+# error "M_LIT must be defined."
+#endif
+#ifndef M_MLIT
+# error "M_MLIT must be defined."
+#endif
+#ifndef M_SUF
+# error "M_SUF must be defined."
+#endif
+#ifndef FLOAT
+# error "FLOAT must be defined."
+#endif
+#ifndef CFLOAT
+# error "CFLOAT must be defined."
+#endif
+#ifndef declare_mgen_alias
+# error "declare_mgen_alias must be defined."
+#endif
+#ifndef declare_mgen_alias_r
+# error "declare_mgen_alias_r must be defined."
+#endif
+#ifndef SET_NAN_PAYLOAD
+# error "SET_NAN_PAYLOAD must be defined."
+#endif
+
+#ifndef declare_mgen_finite_alias_x
+#define declare_mgen_finite_alias_x(from, to) \
+ strong_alias (from, to ## _finite)
+#endif
+
+#ifndef declare_mgen_finite_alias_s
+# define declare_mgen_finite_alias_s(from,to) \
+ declare_mgen_finite_alias_x (from, to)
+#endif
+
+#ifndef declare_mgen_finite_alias
+# define declare_mgen_finite_alias(from, to) \
+ declare_mgen_finite_alias_s (M_SUF (from), M_SUF (to))
+#endif
+
+#define __M_CONCAT(a,b) a ## b
+#define __M_CONCATX(a,b) __M_CONCAT(a,b)
+
+#define M_NAN M_SUF (__builtin_nan) ("")
+#define M_MIN_EXP __M_CONCATX (M_PFX, _MIN_EXP)
+#define M_MAX_EXP __M_CONCATX (M_PFX, _MAX_EXP)
+#define M_MIN __M_CONCATX (M_PFX, _MIN)
+#define M_MAX __M_CONCATX (M_PFX, _MAX)
+#define M_MANT_DIG __M_CONCATX (M_PFX, _MANT_DIG)
+#define M_HUGE_VAL (M_SUF (__builtin_huge_val) ())
+
+/* Helper macros for commonly used functions. */
+#define M_COPYSIGN M_SUF (__copysign)
+#define M_FABS M_SUF (fabs)
+#define M_SINCOS M_SUF (__sincos)
+#define M_SCALBN M_SUF (__scalbn)
+#define M_LOG1P M_SUF (__log1p)
+
+#define M_ATAN2 M_SUF (__ieee754_atan2)
+#define M_COSH M_SUF (__ieee754_cosh)
+#define M_EXP M_SUF (__ieee754_exp)
+#define M_HYPOT M_SUF (__ieee754_hypot)
+#define M_LOG M_SUF (__ieee754_log)
+#define M_SINH M_SUF (__ieee754_sinh)
+#define M_SQRT M_SUF (sqrt)
+
+/* Needed to evaluate M_MANT_DIG below. */
+#include <float.h>
+
+/* Use a special epsilon value for IBM long double
+ to avoid spurious overflows/underflows. */
+#if M_MANT_DIG != 106
+# define M_EPSILON __M_CONCATX (M_PFX, _EPSILON)
+#else
+# define M_EPSILON M_LIT (0x1p-106)
+#endif
+
+/* Enable overloading of function name to assist reuse. */
+#ifndef M_DECL_FUNC
+# define M_DECL_FUNC(f) M_SUF (f)
+#endif
+
+#endif /* _MATH_TYPE_MACROS */
diff --git a/sysdeps/generic/math_ldbl.h b/sysdeps/generic/math_ldbl.h
index f0b97ef8f9..4e7ee7912e 100644
--- a/sysdeps/generic/math_ldbl.h
+++ b/sysdeps/generic/math_ldbl.h
@@ -1,5 +1,7 @@
-#ifndef _MATH_PRIVATE_H_
-#error "Never use <math_ldbl.h> directly; include <math_private.h> instead."
-#endif
+#ifndef _MATH_LDBL_H_
+#define _MATH_LDBL_H_ 1
+
+/* Any machine with a 'long double' distinct from 'double' must
+ override this header. */
-/* This is empty. Any machine using long double type will override this header. */
+#endif
diff --git a/sysdeps/generic/math_private.h b/sysdeps/generic/math_private.h
index cf1865dac8..1212abaf47 100644
--- a/sysdeps/generic/math_private.h
+++ b/sysdeps/generic/math_private.h
@@ -20,9 +20,11 @@
#include <stdint.h>
#include <sys/types.h>
#include <fenv.h>
-#include <float.h>
#include <get-rounding-mode.h>
+/* Gather machine dependent _Floatn support. */
+#include <bits/floatn.h>
+
/* The original fdlibm code used statements like:
n0 = ((*(int*)&one)>>29)^1; * index of high word *
ix0 = *(n0+(int*)&x); * high word of x *
@@ -37,30 +39,30 @@
/* A union which permits us to convert between a double and two 32 bit
ints. */
-#if __FLOAT_WORD_ORDER == BIG_ENDIAN
+#if __FLOAT_WORD_ORDER == __BIG_ENDIAN
typedef union
{
double value;
struct
{
- u_int32_t msw;
- u_int32_t lsw;
+ uint32_t msw;
+ uint32_t lsw;
} parts;
uint64_t word;
} ieee_double_shape_type;
#endif
-#if __FLOAT_WORD_ORDER == LITTLE_ENDIAN
+#if __FLOAT_WORD_ORDER == __LITTLE_ENDIAN
typedef union
{
double value;
struct
{
- u_int32_t lsw;
- u_int32_t msw;
+ uint32_t lsw;
+ uint32_t msw;
} parts;
uint64_t word;
} ieee_double_shape_type;
@@ -158,7 +160,7 @@ do { \
typedef union
{
float value;
- u_int32_t word;
+ uint32_t word;
} ieee_float_shape_type;
/* Get a 32 bit int from a float. */
@@ -181,307 +183,85 @@ do { \
} while (0)
#endif
+/* We need to guarantee an expansion of name when building
+ ldbl-128 files as another type (e.g _Float128). */
+#define mathx_hidden_def(name) hidden_def(name)
+
/* Get long double macros from a separate header. */
#include <math_ldbl.h>
-/* ieee style elementary functions */
-extern double __ieee754_sqrt (double);
-extern double __ieee754_acos (double);
-extern double __ieee754_acosh (double);
-extern double __ieee754_log (double);
-extern double __ieee754_atanh (double);
-extern double __ieee754_asin (double);
-extern double __ieee754_atan2 (double,double);
-extern double __ieee754_exp (double);
-extern double __ieee754_exp2 (double);
-extern double __ieee754_exp10 (double);
-extern double __ieee754_cosh (double);
-extern double __ieee754_fmod (double,double);
-extern double __ieee754_pow (double,double);
-extern double __ieee754_lgamma_r (double,int *);
-extern double __ieee754_gamma_r (double,int *);
-extern double __ieee754_lgamma (double);
-extern double __ieee754_gamma (double);
-extern double __ieee754_log10 (double);
-extern double __ieee754_log2 (double);
-extern double __ieee754_sinh (double);
-extern double __ieee754_hypot (double,double);
-extern double __ieee754_j0 (double);
-extern double __ieee754_j1 (double);
-extern double __ieee754_y0 (double);
-extern double __ieee754_y1 (double);
-extern double __ieee754_jn (int,double);
-extern double __ieee754_yn (int,double);
-extern double __ieee754_remainder (double,double);
-extern int32_t __ieee754_rem_pio2 (double,double*);
-extern double __ieee754_scalb (double,double);
-extern int __ieee754_ilogb (double);
-
-/* fdlibm kernel function */
-extern double __kernel_standard (double,double,int);
-extern float __kernel_standard_f (float,float,int);
-extern long double __kernel_standard_l (long double,long double,int);
-extern double __kernel_sin (double,double,int);
-extern double __kernel_cos (double,double);
-extern double __kernel_tan (double,double,int);
-extern int __kernel_rem_pio2 (double*,double*,int,int,int, const int32_t*);
-
-/* internal functions. */
-extern double __copysign (double x, double __y);
-
-extern inline double __copysign (double x, double y)
-{ return __builtin_copysign (x, y); }
-
-/* ieee style elementary float functions */
-extern float __ieee754_sqrtf (float);
-extern float __ieee754_acosf (float);
-extern float __ieee754_acoshf (float);
-extern float __ieee754_logf (float);
-extern float __ieee754_atanhf (float);
-extern float __ieee754_asinf (float);
-extern float __ieee754_atan2f (float,float);
-extern float __ieee754_expf (float);
-extern float __ieee754_exp2f (float);
-extern float __ieee754_exp10f (float);
-extern float __ieee754_coshf (float);
-extern float __ieee754_fmodf (float,float);
-extern float __ieee754_powf (float,float);
-extern float __ieee754_lgammaf_r (float,int *);
-extern float __ieee754_gammaf_r (float,int *);
-extern float __ieee754_lgammaf (float);
-extern float __ieee754_gammaf (float);
-extern float __ieee754_log10f (float);
-extern float __ieee754_log2f (float);
-extern float __ieee754_sinhf (float);
-extern float __ieee754_hypotf (float,float);
-extern float __ieee754_j0f (float);
-extern float __ieee754_j1f (float);
-extern float __ieee754_y0f (float);
-extern float __ieee754_y1f (float);
-extern float __ieee754_jnf (int,float);
-extern float __ieee754_ynf (int,float);
-extern float __ieee754_remainderf (float,float);
-extern int32_t __ieee754_rem_pio2f (float,float*);
-extern float __ieee754_scalbf (float,float);
-extern int __ieee754_ilogbf (float);
-
-
-/* float versions of fdlibm kernel functions */
-extern float __kernel_sinf (float,float,int);
-extern float __kernel_cosf (float,float);
-extern float __kernel_tanf (float,float,int);
-extern int __kernel_rem_pio2f (float*,float*,int,int,int, const int32_t*);
-
-/* internal functions. */
-extern float __copysignf (float x, float __y);
-
-extern inline float __copysignf (float x, float y)
-{ return __builtin_copysignf (x, y); }
-
-/* ieee style elementary long double functions */
-extern long double __ieee754_sqrtl (long double);
-extern long double __ieee754_acosl (long double);
-extern long double __ieee754_acoshl (long double);
-extern long double __ieee754_logl (long double);
-extern long double __ieee754_atanhl (long double);
-extern long double __ieee754_asinl (long double);
-extern long double __ieee754_atan2l (long double,long double);
-extern long double __ieee754_expl (long double);
-extern long double __ieee754_exp2l (long double);
-extern long double __ieee754_exp10l (long double);
-extern long double __ieee754_coshl (long double);
-extern long double __ieee754_fmodl (long double,long double);
-extern long double __ieee754_powl (long double,long double);
-extern long double __ieee754_lgammal_r (long double,int *);
-extern long double __ieee754_gammal_r (long double,int *);
-extern long double __ieee754_lgammal (long double);
-extern long double __ieee754_gammal (long double);
-extern long double __ieee754_log10l (long double);
-extern long double __ieee754_log2l (long double);
-extern long double __ieee754_sinhl (long double);
-extern long double __ieee754_hypotl (long double,long double);
-extern long double __ieee754_j0l (long double);
-extern long double __ieee754_j1l (long double);
-extern long double __ieee754_y0l (long double);
-extern long double __ieee754_y1l (long double);
-extern long double __ieee754_jnl (int,long double);
-extern long double __ieee754_ynl (int,long double);
-extern long double __ieee754_remainderl (long double,long double);
-extern int __ieee754_rem_pio2l (long double,long double*);
-extern long double __ieee754_scalbl (long double,long double);
-extern int __ieee754_ilogbl (long double);
-
-/* long double versions of fdlibm kernel functions */
-extern long double __kernel_sinl (long double,long double,int);
-extern long double __kernel_cosl (long double,long double);
-extern long double __kernel_tanl (long double,long double,int);
-extern void __kernel_sincosl (long double,long double,
- long double *,long double *, int);
-extern int __kernel_rem_pio2l (long double*,long double*,int,int,
- int,const int*);
-
-#ifndef NO_LONG_DOUBLE
-/* prototypes required to compile the ldbl-96 support without warnings */
-extern int __finitel (long double);
-extern int __ilogbl (long double);
-extern int __isinfl (long double);
-extern int __isnanl (long double);
-extern long double __atanl (long double);
-extern long double __copysignl (long double, long double);
-extern long double __expm1l (long double);
-extern long double __floorl (long double);
-extern long double __frexpl (long double, int *);
-extern long double __ldexpl (long double, int);
-extern long double __log1pl (long double);
-extern long double __nanl (const char *);
-extern long double __rintl (long double);
-extern long double __scalbnl (long double, int);
-extern long double __sqrtl (long double x);
-extern long double fabsl (long double x);
-extern void __sincosl (long double, long double *, long double *);
-extern long double __logbl (long double x);
-extern long double __significandl (long double x);
-
-extern inline long double __copysignl (long double x, long double y)
-{ return __builtin_copysignl (x, y); }
+/* Include function declarations for each floating-point. */
+#define _Mdouble_ double
+#define _MSUF_
+#include <math_private_calls.h>
+#undef _MSUF_
+#undef _Mdouble_
+
+#define _Mdouble_ float
+#define _MSUF_ f
+#define __MATH_DECLARING_FLOAT
+#include <math_private_calls.h>
+#undef __MATH_DECLARING_FLOAT
+#undef _MSUF_
+#undef _Mdouble_
+
+#define _Mdouble_ long double
+#define _MSUF_ l
+#define __MATH_DECLARING_LONG_DOUBLE
+#include <math_private_calls.h>
+#undef __MATH_DECLARING_LONG_DOUBLE
+#undef _MSUF_
+#undef _Mdouble_
+
+#if __HAVE_DISTINCT_FLOAT128
+# define _Mdouble_ _Float128
+# define _MSUF_ f128
+# define __MATH_DECLARING_FLOATN
+# include <math_private_calls.h>
+# undef __MATH_DECLARING_FLOATN
+# undef _MSUF_
+# undef _Mdouble_
+#endif
+
+#if __HAVE_DISTINCT_FLOAT128
+
+/* __builtin_isinf_sign is broken in GCC < 7 for float128. */
+# if ! __GNUC_PREREQ (7, 0)
+# include <ieee754_float128.h>
+extern inline int
+__isinff128 (_Float128 x)
+{
+ int64_t hx, lx;
+ GET_FLOAT128_WORDS64 (hx, lx, x);
+ lx |= (hx & 0x7fffffffffffffffLL) ^ 0x7fff000000000000LL;
+ lx |= -lx;
+ return ~(lx >> 63) & (hx >> 62);
+}
+# endif
+extern inline _Float128
+fabsf128 (_Float128 x)
+{
+ return __builtin_fabsf128 (x);
+}
#endif
+
+
/* Prototypes for functions of the IBM Accurate Mathematical Library. */
-extern double __exp1 (double __x, double __xx, double __error);
+extern double __exp1 (double __x, double __xx);
extern double __sin (double __x);
extern double __cos (double __x);
extern int __branred (double __x, double *__a, double *__aa);
extern void __doasin (double __x, double __dx, double __v[]);
extern void __dubsin (double __x, double __dx, double __v[]);
extern void __dubcos (double __x, double __dx, double __v[]);
-extern double __halfulp (double __x, double __y);
extern double __sin32 (double __x, double __res, double __res1);
extern double __cos32 (double __x, double __res, double __res1);
extern double __mpsin (double __x, double __dx, bool __range_reduce);
extern double __mpcos (double __x, double __dx, bool __range_reduce);
-extern double __slowexp (double __x);
-extern double __slowpow (double __x, double __y, double __z);
extern void __docos (double __x, double __dx, double __v[]);
-/* Return X^2 + Y^2 - 1, computed without large cancellation error.
- It is given that 1 > X >= Y >= epsilon / 2, and that X^2 + Y^2 >=
- 0.5. */
-extern float __x2y2m1f (float x, float y);
-extern double __x2y2m1 (double x, double y);
-extern long double __x2y2m1l (long double x, long double y);
-
-/* Compute the product of X + X_EPS, X + X_EPS + 1, ..., X + X_EPS + N
- - 1, in the form R * (1 + *EPS) where the return value R is an
- approximation to the product and *EPS is set to indicate the
- approximate error in the return value. X is such that all the
- values X + 1, ..., X + N - 1 are exactly representable, and X_EPS /
- X is small enough that factors quadratic in it can be
- neglected. */
-extern float __gamma_productf (float x, float x_eps, int n, float *eps);
-extern double __gamma_product (double x, double x_eps, int n, double *eps);
-extern long double __gamma_productl (long double x, long double x_eps,
- int n, long double *eps);
-
-/* Compute lgamma of a negative argument X, if it is in a range
- (depending on the floating-point format) for which expansion around
- zeros is used, setting *SIGNGAMP accordingly. */
-extern float __lgamma_negf (float x, int *signgamp);
-extern double __lgamma_neg (double x, int *signgamp);
-extern long double __lgamma_negl (long double x, int *signgamp);
-
-/* Compute the product of 1 + (T / (X + X_EPS)), 1 + (T / (X + X_EPS +
- 1)), ..., 1 + (T / (X + X_EPS + N - 1)), minus 1. X is such that
- all the values X + 1, ..., X + N - 1 are exactly representable, and
- X_EPS / X is small enough that factors quadratic in it can be
- neglected. */
-extern double __lgamma_product (double t, double x, double x_eps, int n);
-extern long double __lgamma_productl (long double t, long double x,
- long double x_eps, int n);
-
-#ifndef math_opt_barrier
-# define math_opt_barrier(x) \
-({ __typeof (x) __x = (x); __asm ("" : "+m" (__x)); __x; })
-# define math_force_eval(x) \
-({ __typeof (x) __x = (x); __asm __volatile__ ("" : : "m" (__x)); })
-#endif
-
-/* math_narrow_eval reduces its floating-point argument to the range
- and precision of its semantic type. (The original evaluation may
- still occur with excess range and precision, so the result may be
- affected by double rounding.) */
-#if FLT_EVAL_METHOD == 0
-# define math_narrow_eval(x) (x)
-#else
-# if FLT_EVAL_METHOD == 1
-# define excess_precision(type) __builtin_types_compatible_p (type, float)
-# else
-# define excess_precision(type) (__builtin_types_compatible_p (type, float) \
- || __builtin_types_compatible_p (type, \
- double))
-# endif
-# define math_narrow_eval(x) \
- ({ \
- __typeof (x) math_narrow_eval_tmp = (x); \
- if (excess_precision (__typeof (math_narrow_eval_tmp))) \
- __asm__ ("" : "+m" (math_narrow_eval_tmp)); \
- math_narrow_eval_tmp; \
- })
-#endif
-
-#define fabs_tg(x) __builtin_choose_expr \
- (__builtin_types_compatible_p (__typeof (x), float), \
- __builtin_fabsf (x), \
- __builtin_choose_expr \
- (__builtin_types_compatible_p (__typeof (x), double), \
- __builtin_fabs (x), __builtin_fabsl (x)))
-#define min_of_type(type) __builtin_choose_expr \
- (__builtin_types_compatible_p (type, float), \
- FLT_MIN, \
- __builtin_choose_expr \
- (__builtin_types_compatible_p (type, double), \
- DBL_MIN, LDBL_MIN))
-
-/* If X (which is not a NaN) is subnormal, force an underflow
- exception. */
-#define math_check_force_underflow(x) \
- do \
- { \
- __typeof (x) force_underflow_tmp = (x); \
- if (fabs_tg (force_underflow_tmp) \
- < min_of_type (__typeof (force_underflow_tmp))) \
- { \
- __typeof (force_underflow_tmp) force_underflow_tmp2 \
- = force_underflow_tmp * force_underflow_tmp; \
- math_force_eval (force_underflow_tmp2); \
- } \
- } \
- while (0)
-/* Likewise, but X is also known to be nonnegative. */
-#define math_check_force_underflow_nonneg(x) \
- do \
- { \
- __typeof (x) force_underflow_tmp = (x); \
- if (force_underflow_tmp \
- < min_of_type (__typeof (force_underflow_tmp))) \
- { \
- __typeof (force_underflow_tmp) force_underflow_tmp2 \
- = force_underflow_tmp * force_underflow_tmp; \
- math_force_eval (force_underflow_tmp2); \
- } \
- } \
- while (0)
-/* Likewise, for both real and imaginary parts of a complex
- result. */
-#define math_check_force_underflow_complex(x) \
- do \
- { \
- __typeof (x) force_underflow_complex_tmp = (x); \
- math_check_force_underflow (__real__ force_underflow_complex_tmp); \
- math_check_force_underflow (__imag__ force_underflow_complex_tmp); \
- } \
- while (0)
-
/* The standards only specify one variant of the fenv.h interfaces.
But at least for some architectures we can be more efficient if we
know what operations are going to be performed. Therefore we
@@ -632,7 +412,7 @@ default_libc_feupdateenv_test (fenv_t *e, int ex)
# define libc_feresetroundl libc_feupdateenvl
#endif
-/* ... and a version that may also discard exceptions. */
+/* ... and a version that also discards exceptions. */
#ifndef libc_feresetround_noex
# define libc_feresetround_noex libc_fesetenv
@@ -648,33 +428,6 @@ default_libc_feupdateenv_test (fenv_t *e, int ex)
# define HAVE_RM_CTX 0
#endif
-#if HAVE_RM_CTX
-/* Set/Restore Rounding Modes only when necessary. If defined, these functions
- set/restore floating point state only if the state needed within the lexical
- block is different from the current state. This saves a lot of time when
- the floating point unit is much slower than the fixed point units. */
-
-# ifndef libc_feholdsetround_noex_ctx
-# define libc_feholdsetround_noex_ctx libc_feholdsetround_ctx
-# endif
-# ifndef libc_feholdsetround_noexf_ctx
-# define libc_feholdsetround_noexf_ctx libc_feholdsetroundf_ctx
-# endif
-# ifndef libc_feholdsetround_noexl_ctx
-# define libc_feholdsetround_noexl_ctx libc_feholdsetroundl_ctx
-# endif
-
-# ifndef libc_feresetround_noex_ctx
-# define libc_feresetround_noex_ctx libc_fesetenv_ctx
-# endif
-# ifndef libc_feresetround_noexf_ctx
-# define libc_feresetround_noexf_ctx libc_fesetenvf_ctx
-# endif
-# ifndef libc_feresetround_noexl_ctx
-# define libc_feresetround_noexl_ctx libc_fesetenvl_ctx
-# endif
-
-#else
/* Default implementation using standard fenv functions.
Avoid unnecessary rounding mode changes by first checking the
@@ -682,7 +435,7 @@ default_libc_feupdateenv_test (fenv_t *e, int ex)
important for performance. */
static __always_inline void
-libc_feholdsetround_ctx (struct rm_ctx *ctx, int round)
+default_libc_feholdsetround_ctx (struct rm_ctx *ctx, int round)
{
ctx->updated_status = false;
@@ -696,7 +449,7 @@ libc_feholdsetround_ctx (struct rm_ctx *ctx, int round)
}
static __always_inline void
-libc_feresetround_ctx (struct rm_ctx *ctx)
+default_libc_feresetround_ctx (struct rm_ctx *ctx)
{
/* Restore the rounding mode if updated. */
if (__glibc_unlikely (ctx->updated_status))
@@ -704,10 +457,11 @@ libc_feresetround_ctx (struct rm_ctx *ctx)
}
static __always_inline void
-libc_feholdsetround_noex_ctx (struct rm_ctx *ctx, int round)
+default_libc_feholdsetround_noex_ctx (struct rm_ctx *ctx, int round)
{
- /* Save exception flags and rounding mode. */
- __fegetenv (&ctx->env);
+ /* Save exception flags and rounding mode, and disable exception
+ traps. */
+ __feholdexcept (&ctx->env);
/* Update rounding mode only if different. */
if (__glibc_unlikely (round != get_rounding_mode ()))
@@ -715,12 +469,45 @@ libc_feholdsetround_noex_ctx (struct rm_ctx *ctx, int round)
}
static __always_inline void
-libc_feresetround_noex_ctx (struct rm_ctx *ctx)
+default_libc_feresetround_noex_ctx (struct rm_ctx *ctx)
{
/* Restore exception flags and rounding mode. */
__fesetenv (&ctx->env);
}
+#if HAVE_RM_CTX
+/* Set/Restore Rounding Modes only when necessary. If defined, these functions
+ set/restore floating point state only if the state needed within the lexical
+ block is different from the current state. This saves a lot of time when
+ the floating point unit is much slower than the fixed point units. */
+
+# ifndef libc_feholdsetround_noex_ctx
+# define libc_feholdsetround_noex_ctx libc_feholdsetround_ctx
+# endif
+# ifndef libc_feholdsetround_noexf_ctx
+# define libc_feholdsetround_noexf_ctx libc_feholdsetroundf_ctx
+# endif
+# ifndef libc_feholdsetround_noexl_ctx
+# define libc_feholdsetround_noexl_ctx libc_feholdsetroundl_ctx
+# endif
+
+# ifndef libc_feresetround_noex_ctx
+# define libc_feresetround_noex_ctx libc_fesetenv_ctx
+# endif
+# ifndef libc_feresetround_noexf_ctx
+# define libc_feresetround_noexf_ctx libc_fesetenvf_ctx
+# endif
+# ifndef libc_feresetround_noexl_ctx
+# define libc_feresetround_noexl_ctx libc_fesetenvl_ctx
+# endif
+
+#else
+
+# define libc_feholdsetround_ctx default_libc_feholdsetround_ctx
+# define libc_feresetround_ctx default_libc_feresetround_ctx
+# define libc_feholdsetround_noex_ctx default_libc_feholdsetround_noex_ctx
+# define libc_feresetround_noex_ctx default_libc_feresetround_noex_ctx
+
# define libc_feholdsetroundf_ctx libc_feholdsetround_ctx
# define libc_feholdsetroundl_ctx libc_feholdsetround_ctx
# define libc_feresetroundf_ctx libc_feresetround_ctx
@@ -760,7 +547,7 @@ libc_feresetround_noex_ctx (struct rm_ctx *ctx)
the value at the start of the block. The exception mode must be preserved.
Exceptions raised within the block must be discarded, and exception flags
are restored to the value at the start of the block.
- Non-stop mode may be enabled inside the block. */
+ Non-stop mode must be enabled inside the block. */
#define SET_RESTORE_ROUND_NOEX(RM) \
SET_RESTORE_ROUND_GENERIC (RM, libc_feholdsetround_noex, \
@@ -777,11 +564,94 @@ libc_feresetround_noex_ctx (struct rm_ctx *ctx)
SET_RESTORE_ROUND_GENERIC (RM, libc_feholdsetround_53bit, \
libc_feresetround_53bit)
-#define __nan(str) \
- (__builtin_constant_p (str) && str[0] == '\0' ? NAN : __nan (str))
-#define __nanf(str) \
- (__builtin_constant_p (str) && str[0] == '\0' ? NAN : __nan (str))
-#define __nanl(str) \
- (__builtin_constant_p (str) && str[0] == '\0' ? NAN : __nan (str))
+/* When no floating-point exceptions are defined in <fenv.h>, make
+ feraiseexcept ignore its argument so that unconditional
+ feraiseexcept calls do not cause errors for undefined exceptions.
+ Define it to expand to a void expression so that any calls testing
+ the result of feraiseexcept do produce errors. */
+#if FE_ALL_EXCEPT == 0
+# define feraiseexcept(excepts) ((void) 0)
+# define __feraiseexcept(excepts) ((void) 0)
+#endif
+
+/* Similarly, most <fenv.h> functions have trivial implementations in
+ the absence of support for floating-point exceptions and rounding
+ modes. */
+
+#if !FE_HAVE_ROUNDING_MODES
+# if FE_ALL_EXCEPT == 0
+extern inline int
+fegetenv (fenv_t *__e)
+{
+ return 0;
+}
+
+extern inline int
+__fegetenv (fenv_t *__e)
+{
+ return 0;
+}
+
+extern inline int
+feholdexcept (fenv_t *__e)
+{
+ return 0;
+}
+
+extern inline int
+__feholdexcept (fenv_t *__e)
+{
+ return 0;
+}
+
+extern inline int
+fesetenv (const fenv_t *__e)
+{
+ return 0;
+}
+
+extern inline int
+__fesetenv (const fenv_t *__e)
+{
+ return 0;
+}
+
+extern inline int
+feupdateenv (const fenv_t *__e)
+{
+ return 0;
+}
+
+extern inline int
+__feupdateenv (const fenv_t *__e)
+{
+ return 0;
+}
+# endif
+
+extern inline int
+fegetround (void)
+{
+ return FE_TONEAREST;
+}
+
+extern inline int
+__fegetround (void)
+{
+ return FE_TONEAREST;
+}
+
+extern inline int
+fesetround (int __d)
+{
+ return 0;
+}
+
+extern inline int
+__fesetround (int __d)
+{
+ return 0;
+}
+#endif
#endif /* _MATH_PRIVATE_H_ */
diff --git a/sysdeps/generic/math_private_calls.h b/sysdeps/generic/math_private_calls.h
new file mode 100644
index 0000000000..16b4ea3736
--- /dev/null
+++ b/sysdeps/generic/math_private_calls.h
@@ -0,0 +1,124 @@
+/* Private function declarations for libm.
+ Copyright (C) 2011-2018 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 __MSUF_X(x, suffix) x ## suffix
+#define __MSUF_S(...) __MSUF_X (__VA_ARGS__)
+#define __MSUF(x) __MSUF_S (x, _MSUF_)
+
+#define __MSUF_R_X(x, suffix) x ## suffix ## _r
+#define __MSUF_R_S(...) __MSUF_R_X (__VA_ARGS__)
+#define __MSUF_R(x) __MSUF_R_S (x, _MSUF_)
+
+/* IEEE style elementary functions. */
+extern _Mdouble_ __MSUF (__ieee754_acos) (_Mdouble_);
+extern _Mdouble_ __MSUF (__ieee754_acosh) (_Mdouble_);
+extern _Mdouble_ __MSUF (__ieee754_asin) (_Mdouble_);
+extern _Mdouble_ __MSUF (__ieee754_atan2) (_Mdouble_, _Mdouble_);
+extern _Mdouble_ __MSUF (__ieee754_atanh) (_Mdouble_);
+extern _Mdouble_ __MSUF (__ieee754_cosh) (_Mdouble_);
+extern _Mdouble_ __MSUF (__ieee754_exp) (_Mdouble_);
+extern _Mdouble_ __MSUF (__ieee754_exp10) (_Mdouble_);
+extern _Mdouble_ __MSUF (__ieee754_exp2) (_Mdouble_);
+extern _Mdouble_ __MSUF (__ieee754_fmod) (_Mdouble_, _Mdouble_);
+extern _Mdouble_ __MSUF (__ieee754_gamma) (_Mdouble_);
+extern _Mdouble_ __MSUF_R (__ieee754_gamma) (_Mdouble_, int *);
+extern _Mdouble_ __MSUF (__ieee754_hypot) (_Mdouble_, _Mdouble_);
+extern _Mdouble_ __MSUF (__ieee754_j0) (_Mdouble_);
+extern _Mdouble_ __MSUF (__ieee754_j1) (_Mdouble_);
+extern _Mdouble_ __MSUF (__ieee754_jn) (int, _Mdouble_);
+extern _Mdouble_ __MSUF (__ieee754_lgamma) (_Mdouble_);
+extern _Mdouble_ __MSUF_R (__ieee754_lgamma) (_Mdouble_, int *);
+extern _Mdouble_ __MSUF (__ieee754_log) (_Mdouble_);
+extern _Mdouble_ __MSUF (__ieee754_log10) (_Mdouble_);
+extern _Mdouble_ __MSUF (__ieee754_log2) (_Mdouble_);
+extern _Mdouble_ __MSUF (__ieee754_pow) (_Mdouble_, _Mdouble_);
+extern _Mdouble_ __MSUF (__ieee754_remainder) (_Mdouble_, _Mdouble_);
+extern _Mdouble_ __MSUF (__ieee754_sinh) (_Mdouble_);
+extern _Mdouble_ __MSUF (__ieee754_sqrt) (_Mdouble_);
+extern _Mdouble_ __MSUF (__ieee754_y0) (_Mdouble_);
+extern _Mdouble_ __MSUF (__ieee754_y1) (_Mdouble_);
+extern _Mdouble_ __MSUF (__ieee754_yn) (int, _Mdouble_);
+
+extern _Mdouble_ __MSUF (__ieee754_scalb) (_Mdouble_, _Mdouble_);
+extern int __MSUF (__ieee754_ilogb) (_Mdouble_);
+
+extern int32_t __MSUF (__ieee754_rem_pio2) (_Mdouble_, _Mdouble_ *);
+
+/* fdlibm kernel functions. */
+extern _Mdouble_ __MSUF (__kernel_sin) (_Mdouble_, _Mdouble_, int);
+extern _Mdouble_ __MSUF (__kernel_cos) (_Mdouble_, _Mdouble_);
+extern _Mdouble_ __MSUF (__kernel_tan) (_Mdouble_, _Mdouble_, int);
+
+#if defined __MATH_DECLARING_LONG_DOUBLE || defined __MATH_DECLARING_FLOATN
+extern void __MSUF (__kernel_sincos) (_Mdouble_, _Mdouble_,
+ _Mdouble_ *, _Mdouble_ *, int);
+#endif
+
+#if !defined __MATH_DECLARING_LONG_DOUBLE || defined __MATH_DECLARING_FLOATN
+extern int __MSUF (__kernel_rem_pio2) (_Mdouble_ *, _Mdouble_ *, int,
+ int, int, const int32_t *);
+#endif
+
+/* Internal functions. */
+#if !defined __MATH_DECLARING_LONG_DOUBLE || !defined NO_LONG_DOUBLE
+extern _Mdouble_ __MSUF (__copysign) (_Mdouble_ x, _Mdouble_ __y);
+
+extern inline _Mdouble_
+__MSUF (__copysign) (_Mdouble_ x, _Mdouble_ __y)
+{
+ return __MSUF (__builtin_copysign) (x, __y);
+}
+#endif
+
+/* Return X^2 + Y^2 - 1, computed without large cancellation error.
+ It is given that 1 > X >= Y >= epsilon / 2, and that X^2 + Y^2 >=
+ 0.5. */
+extern _Mdouble_ __MSUF (__x2y2m1) (_Mdouble_ x, _Mdouble_ y);
+
+/* Compute the product of X + X_EPS, X + X_EPS + 1, ..., X + X_EPS + N
+ - 1, in the form R * (1 + *EPS) where the return value R is an
+ approximation to the product and *EPS is set to indicate the
+ approximate error in the return value. X is such that all the
+ values X + 1, ..., X + N - 1 are exactly representable, and X_EPS /
+ X is small enough that factors quadratic in it can be
+ neglected. */
+extern _Mdouble_ __MSUF (__gamma_product) (_Mdouble_ x, _Mdouble_ x_eps,
+ int n, _Mdouble_ *eps);
+
+/* Compute lgamma of a negative argument X, if it is in a range
+ (depending on the floating-point format) for which expansion around
+ zeros is used, setting *SIGNGAMP accordingly. */
+extern _Mdouble_ __MSUF (__lgamma_neg) (_Mdouble_ x, int *signgamp);
+
+/* Compute the product of 1 + (T / (X + X_EPS)), 1 + (T / (X + X_EPS +
+ 1)), ..., 1 + (T / (X + X_EPS + N - 1)), minus 1. X is such that
+ all the values X + 1, ..., X + N - 1 are exactly representable, and
+ X_EPS / X is small enough that factors quadratic in it can be
+ neglected. */
+#if !defined __MATH_DECLARING_FLOAT
+extern _Mdouble_ __MSUF (__lgamma_product) (_Mdouble_ t, _Mdouble_ x,
+ _Mdouble_ x_eps, int n);
+#endif
+
+#undef __MSUF_X
+#undef __MSUF_S
+#undef __MSUF
+
+#undef __MSUF_R_X
+#undef __MSUF_R_S
+#undef __MSUF_R
diff --git a/sysdeps/generic/memcopy.h b/sysdeps/generic/memcopy.h
index fe9aa60857..c0d8da3568 100644
--- a/sysdeps/generic/memcopy.h
+++ b/sysdeps/generic/memcopy.h
@@ -1,5 +1,5 @@
/* memcopy.h -- definitions for memory copy functions. Generic C version.
- Copyright (C) 1991-2016 Free Software Foundation, Inc.
+ Copyright (C) 1991-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Torbjorn Granlund (tege@sics.se).
diff --git a/sysdeps/generic/memusage.h b/sysdeps/generic/memusage.h
index a8dbd2359f..2887ff1be3 100644
--- a/sysdeps/generic/memusage.h
+++ b/sysdeps/generic/memusage.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2016 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2018 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
diff --git a/sysdeps/generic/nan-high-order-bit.h b/sysdeps/generic/nan-high-order-bit.h
new file mode 100644
index 0000000000..8ff3bcffa1
--- /dev/null
+++ b/sysdeps/generic/nan-high-order-bit.h
@@ -0,0 +1,27 @@
+/* Specify NaN high-order bit conventions. Generic version.
+ Copyright (C) 2016-2018 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 NAN_HIGH_ORDER_BIT_H
+#define NAN_HIGH_ORDER_BIT_H 1
+
+/* Define this macro to 1 if the high-order bit of a NaN's mantissa is
+ set for signaling NaNs and clear for quiet NaNs, 0 otherwise (the
+ preferred IEEE convention). */
+#define HIGH_ORDER_BIT_IS_SET_FOR_SNAN 0
+
+#endif /* nan-high-order-bit.h */
diff --git a/sysdeps/generic/net/if.h b/sysdeps/generic/net/if.h
index 6ddd86342a..61c34620d0 100644
--- a/sysdeps/generic/net/if.h
+++ b/sysdeps/generic/net/if.h
@@ -1,5 +1,5 @@
/* net/if.h -- declarations for inquiring about network interfaces
- Copyright (C) 2000-2016 Free Software Foundation, Inc.
+ Copyright (C) 2000-2018 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
diff --git a/sysdeps/generic/netinet/if_ether.h b/sysdeps/generic/netinet/if_ether.h
index c106a41c82..7f33d220d0 100644
--- a/sysdeps/generic/netinet/if_ether.h
+++ b/sysdeps/generic/netinet/if_ether.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2018 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
@@ -19,6 +19,7 @@
#define __NETINET_IF_ETHER_H 1
#include <sys/types.h>
+#include <stdint.h>
#define ETH_ALEN 6 /* Octets in one ethernet address. */
@@ -26,7 +27,7 @@
systems. */
struct ether_addr
{
- u_int8_t ether_addr_octet[ETH_ALEN];
+ uint8_t ether_addr_octet[ETH_ALEN];
} __attribute__ ((__packed__));
#endif /* netinet/if_ether.h */
diff --git a/sysdeps/generic/netinet/in_systm.h b/sysdeps/generic/netinet/in_systm.h
index 41704ee40a..76c11c6763 100644
--- a/sysdeps/generic/netinet/in_systm.h
+++ b/sysdeps/generic/netinet/in_systm.h
@@ -1,5 +1,5 @@
/* System specific type definitions for networking code.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
+ Copyright (C) 1997-2018 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
@@ -19,8 +19,8 @@
#ifndef _NETINET_IN_SYSTM_H
#define _NETINET_IN_SYSTM_H 1
-#include <sys/cdefs.h>
#include <sys/types.h>
+#include <stdint.h>
__BEGIN_DECLS
@@ -31,9 +31,9 @@ __BEGIN_DECLS
* may not reflect the actual size of the native data types.
*/
-typedef u_int16_t n_short; /* short as received from the net */
-typedef u_int32_t n_long; /* long as received from the net */
-typedef u_int32_t n_time; /* ms since 00:00 GMT, byte rev */
+typedef uint16_t n_short; /* short as received from the net */
+typedef uint32_t n_long; /* long as received from the net */
+typedef uint32_t n_time; /* ms since 00:00 GMT, byte rev */
__END_DECLS
diff --git a/sysdeps/generic/netinet/ip.h b/sysdeps/generic/netinet/ip.h
index 557a460d71..821349458d 100644
--- a/sysdeps/generic/netinet/ip.h
+++ b/sysdeps/generic/netinet/ip.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2018 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
@@ -27,8 +27,8 @@ __BEGIN_DECLS
struct timestamp
{
- u_int8_t len;
- u_int8_t ptr;
+ uint8_t len;
+ uint8_t ptr;
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned int flags:4;
unsigned int overflow:4;
@@ -38,7 +38,7 @@ struct timestamp
#else
# error "Please fix <bits/endian.h>"
#endif
- u_int32_t data[9];
+ uint32_t data[9];
};
struct iphdr
@@ -52,15 +52,15 @@ struct iphdr
#else
# error "Please fix <bits/endian.h>"
#endif
- u_int8_t tos;
- u_int16_t tot_len;
- u_int16_t id;
- u_int16_t frag_off;
- u_int8_t ttl;
- u_int8_t protocol;
- u_int16_t check;
- u_int32_t saddr;
- u_int32_t daddr;
+ uint8_t tos;
+ uint16_t tot_len;
+ uint16_t id;
+ uint16_t frag_off;
+ uint8_t ttl;
+ uint8_t protocol;
+ uint16_t check;
+ uint32_t saddr;
+ uint32_t daddr;
/*The options start here. */
};
@@ -114,17 +114,17 @@ struct ip
unsigned int ip_v:4; /* version */
unsigned int ip_hl:4; /* header length */
#endif
- u_int8_t ip_tos; /* type of service */
- u_short ip_len; /* total length */
- u_short ip_id; /* identification */
- u_short ip_off; /* fragment offset field */
+ uint8_t ip_tos; /* type of service */
+ unsigned short ip_len; /* total length */
+ unsigned short ip_id; /* identification */
+ unsigned short ip_off; /* fragment offset field */
#define IP_RF 0x8000 /* reserved fragment flag */
#define IP_DF 0x4000 /* dont fragment flag */
#define IP_MF 0x2000 /* more fragments flag */
#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
- u_int8_t ip_ttl; /* time to live */
- u_int8_t ip_p; /* protocol */
- u_short ip_sum; /* checksum */
+ uint8_t ip_ttl; /* time to live */
+ uint8_t ip_p; /* protocol */
+ unsigned short ip_sum; /* checksum */
struct in_addr ip_src, ip_dst; /* source and dest address */
};
@@ -133,9 +133,9 @@ struct ip
*/
struct ip_timestamp
{
- u_int8_t ipt_code; /* IPOPT_TS */
- u_int8_t ipt_len; /* size of structure (variable) */
- u_int8_t ipt_ptr; /* index of current entry */
+ uint8_t ipt_code; /* IPOPT_TS */
+ uint8_t ipt_len; /* size of structure (variable) */
+ uint8_t ipt_ptr; /* index of current entry */
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned int ipt_flg:4; /* flags, see below */
unsigned int ipt_oflw:4; /* overflow counter */
@@ -144,7 +144,7 @@ struct ip_timestamp
unsigned int ipt_oflw:4; /* overflow counter */
unsigned int ipt_flg:4; /* flags, see below */
#endif
- u_int32_t data[9];
+ uint32_t data[9];
};
#endif /* __USE_MISC */
diff --git a/sysdeps/generic/netinet/tcp.h b/sysdeps/generic/netinet/tcp.h
index 0d71903309..49f1bfbc26 100644
--- a/sysdeps/generic/netinet/tcp.h
+++ b/sysdeps/generic/netinet/tcp.h
@@ -43,42 +43,42 @@ typedef unsigned int tcp_seq;
* Per RFC 793, September, 1981.
*/
struct tcphdr {
- u_short th_sport; /* source port */
- u_short th_dport; /* destination port */
- tcp_seq th_seq; /* sequence number */
- tcp_seq th_ack; /* acknowledgement number */
+ unsigned short th_sport; /* source port */
+ unsigned short th_dport; /* destination port */
+ tcp_seq th_seq; /* sequence number */
+ tcp_seq th_ack; /* acknowledgement number */
#if __BYTE_ORDER == __LITTLE_ENDIAN
- u_char th_x2:4, /* (unused) */
- th_off:4; /* data offset */
+ unsigned char th_x2:4, /* (unused) */
+ th_off:4; /* data offset */
#endif
#if __BYTE_ORDER == __BIG_ENDIAN
- u_char th_off:4, /* data offset */
- th_x2:4; /* (unused) */
+ unsigned char th_off:4, /* data offset */
+ th_x2:4; /* (unused) */
#endif
- u_char th_flags;
+ unsigned char th_flags;
#define TH_FIN 0x01
#define TH_SYN 0x02
#define TH_RST 0x04
#define TH_PUSH 0x08
#define TH_ACK 0x10
#define TH_URG 0x20
- u_short th_win; /* window */
- u_short th_sum; /* checksum */
- u_short th_urp; /* urgent pointer */
+ unsigned short th_win; /* window */
+ unsigned short th_sum; /* checksum */
+ unsigned short th_urp; /* urgent pointer */
};
#define TCPOPT_EOL 0
#define TCPOPT_NOP 1
#define TCPOPT_MAXSEG 2
-#define TCPOLEN_MAXSEG 4
+#define TCPOLEN_MAXSEG 4
#define TCPOPT_WINDOW 3
-#define TCPOLEN_WINDOW 3
+#define TCPOLEN_WINDOW 3
#define TCPOPT_SACK_PERMITTED 4 /* Experimental */
-#define TCPOLEN_SACK_PERMITTED 2
+#define TCPOLEN_SACK_PERMITTED 2
#define TCPOPT_SACK 5 /* Experimental */
#define TCPOPT_TIMESTAMP 8
-#define TCPOLEN_TIMESTAMP 10
-#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */
+#define TCPOLEN_TIMESTAMP 10
+#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */
#define TCPOPT_TSTAMP_HDR \
(TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
diff --git a/sysdeps/generic/nfs/nfs.h b/sysdeps/generic/nfs/nfs.h
index 6e1d64c4b5..8b78de8289 100644
--- a/sysdeps/generic/nfs/nfs.h
+++ b/sysdeps/generic/nfs/nfs.h
@@ -1,5 +1,5 @@
/* <nfs/nfs.h> -- ill-specified NFS-related definitions
- Copyright (C) 1999-2016 Free Software Foundation, Inc.
+ Copyright (C) 1999-2018 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
diff --git a/sysdeps/generic/not-cancel.h b/sysdeps/generic/not-cancel.h
index d703bb228f..d9f8a75dbd 100644
--- a/sysdeps/generic/not-cancel.h
+++ b/sysdeps/generic/not-cancel.h
@@ -1,5 +1,5 @@
/* Uncancelable versions of cancelable interfaces. Generic version.
- Copyright (C) 2003-2016 Free Software Foundation, Inc.
+ Copyright (C) 2003-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
@@ -17,38 +17,41 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#ifndef NOT_CANCEL_H
+# define NOT_CANCEL_H
+
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <time.h>
+#include <sys/uio.h>
+
/* By default we have none. Map the name to the normal functions. */
-#define open_not_cancel(name, flags, mode) \
- __libc_open (name, flags, mode)
-#define open_not_cancel_2(name, flags) \
- __libc_open (name, flags)
-#define openat_not_cancel(fd, name, flags, mode) \
- __openat (fd, name, flags, mode)
-#define openat_not_cancel_3(fd, name, flags) \
- __openat (fd, name, flags, 0)
-#define openat64_not_cancel(fd, name, flags, mode) \
- __openat64 (fd, name, flags, mode)
-#define openat64_not_cancel_3(fd, name, flags) \
- __openat64 (fd, name, flags, 0)
-#define close_not_cancel(fd) \
+#define __open_nocancel(...) \
+ __open (__VA_ARGS__)
+#define __open64_nocancel(...) \
+ __open64 (__VA_ARGS__)
+#define __openat_nocancel(...) \
+ __openat (__VA_ARGS__)
+#define __openat64_nocancel(...) \
+ __openat64 (__VA_ARGS__)
+#define __close_nocancel(fd) \
__close (fd)
-#define close_not_cancel_no_status(fd) \
+#define __close_nocancel_nostatus(fd) \
(void) __close (fd)
-#define read_not_cancel(fd, buf, n) \
+#define __read_nocancel(fd, buf, n) \
__read (fd, buf, n)
-#define write_not_cancel(fd, buf, n) \
+#define __write_nocancel(fd, buf, n) \
__write (fd, buf, n)
-#define writev_not_cancel_no_status(fd, iov, n) \
+#define __writev_nocancel_nostatus(fd, iov, n) \
(void) __writev (fd, iov, n)
-#define fcntl_not_cancel(fd, cmd, val) \
- __fcntl (fd, cmd, val)
-# define waitpid_not_cancel(pid, stat_loc, options) \
+# define __waitpid_nocancel(pid, stat_loc, options) \
__waitpid (pid, stat_loc, options)
-#define pause_not_cancel() \
+#define __pause_nocancel() \
__pause ()
-#define nanosleep_not_cancel(requested_time, remaining) \
+#define __nanosleep_nocancel(requested_time, remaining) \
__nanosleep (requested_time, remaining)
-#define sigsuspend_not_cancel(set) \
- __sigsuspend (set)
+#define __fcntl64_nocancel(fd, cmd, ...) \
+ __fcntl64 (fd, cmd, __VA_ARGS__)
-#define NO_CANCELLATION 1
+#endif /* NOT_CANCEL_H */
diff --git a/sysdeps/generic/frame.h b/sysdeps/generic/not-errno.h
index 958dcc0495..93617a3266 100644
--- a/sysdeps/generic/frame.h
+++ b/sysdeps/generic/not-errno.h
@@ -1,5 +1,5 @@
-/* Definition of stack frame structure. Generic version.
- Copyright (C) 2000-2016 Free Software Foundation, Inc.
+/* Syscall wrapper that do not set errno. Generic version.
+ Copyright (C) 2017-2018 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
@@ -16,8 +16,4 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-struct layout
-{
- void *next;
- void *return_address;
-};
+extern __typeof (__access) __access_noerrno attribute_hidden;
diff --git a/sysdeps/generic/nscd-types.h b/sysdeps/generic/nscd-types.h
index 3874f3339f..724f3de4eb 100644
--- a/sysdeps/generic/nscd-types.h
+++ b/sysdeps/generic/nscd-types.h
@@ -1,5 +1,5 @@
/* Types for the NSCD implementation. Generic version.
- Copyright (c) 2000-2016 Free Software Foundation, Inc.
+ Copyright (c) 2000-2018 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
diff --git a/sysdeps/generic/pagecopy.h b/sysdeps/generic/pagecopy.h
index 6ab29ce91d..1c5910702e 100644
--- a/sysdeps/generic/pagecopy.h
+++ b/sysdeps/generic/pagecopy.h
@@ -1,5 +1,5 @@
/* Macros for copying by pages; used in memcpy, memmove.
- Copyright (C) 1995-2016 Free Software Foundation, Inc.
+ Copyright (C) 1995-2018 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
diff --git a/sysdeps/generic/profil-counter.h b/sysdeps/generic/profil-counter.h
index 514245888a..a6fd39ace8 100644
--- a/sysdeps/generic/profil-counter.h
+++ b/sysdeps/generic/profil-counter.h
@@ -1,5 +1,5 @@
/* Machine-dependent SIGPROF signal handler. "Generic" version w/ sigcontext
- Copyright (C) 1996-2016 Free Software Foundation, Inc.
+ Copyright (C) 1996-2018 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
diff --git a/sysdeps/generic/pty-private.h b/sysdeps/generic/pty-private.h
index 955e77f106..9d453a57d0 100644
--- a/sysdeps/generic/pty-private.h
+++ b/sysdeps/generic/pty-private.h
@@ -1,5 +1,5 @@
/* Internal defenitions and declarations for pseudo terminal functions.
- Copyright (C) 1998-2016 Free Software Foundation, Inc.
+ Copyright (C) 1998-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
diff --git a/sysdeps/generic/register-dump.h b/sysdeps/generic/register-dump.h
index 831dbc53db..6ac099a932 100644
--- a/sysdeps/generic/register-dump.h
+++ b/sysdeps/generic/register-dump.h
@@ -1,5 +1,5 @@
/* Dump registers.
- Copyright (C) 1998-2016 Free Software Foundation, Inc.
+ Copyright (C) 1998-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
diff --git a/sysdeps/generic/safe-fatal.h b/sysdeps/generic/safe-fatal.h
index 22ab3560ea..60f798a0a5 100644
--- a/sysdeps/generic/safe-fatal.h
+++ b/sysdeps/generic/safe-fatal.h
@@ -1,5 +1,5 @@
/* Crash the process immediately, without possibility of deadlock. Generic.
- Copyright (C) 2014-2016 Free Software Foundation, Inc.
+ Copyright (C) 2014-2018 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
diff --git a/sysdeps/generic/bits/hwcap.h b/sysdeps/generic/setjmpP.h
index 39839ff27b..b30d105cd0 100644
--- a/sysdeps/generic/bits/hwcap.h
+++ b/sysdeps/generic/setjmpP.h
@@ -1,5 +1,5 @@
-/* Defines for bits in AT_HWCAP.
- Copyright (C) 2012-2016 Free Software Foundation, Inc.
+/* Internal header file for <setjmp.h>. Generic version.
+ Copyright (C) 2017-2018 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
@@ -16,8 +16,9 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#ifndef _SYS_AUXV_H
-# error "Never include <bits/hwcap.h> directly; use <sys/auxv.h> instead."
-#endif
+#ifndef _SETJMPP_H
+#define _SETJMPP_H 1
-/* No bits defined for this architecture. */
+#include <setjmp.h>
+
+#endif /* setjmpP.h */
diff --git a/sysdeps/generic/sigcontextinfo.h b/sysdeps/generic/sigcontextinfo.h
index 035986dd1b..3e199416f8 100644
--- a/sysdeps/generic/sigcontextinfo.h
+++ b/sysdeps/generic/sigcontextinfo.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -18,9 +18,4 @@
/* In general we cannot provide any information. */
#define SIGCONTEXT struct sigcontext *
-#define SIGCONTEXT_EXTRA_ARGS
#define GET_PC(ctx) ((void *) 0)
-#define GET_FRAME(ctx) ((void *) 0)
-#define GET_STACK(ctx) ((void *) 0)
-#define CALL_SIGHANDLER(handler, signo, ctx) \
- (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
diff --git a/sysdeps/generic/siglist.h b/sysdeps/generic/siglist.h
index 49b86eaf90..99d05b25d0 100644
--- a/sysdeps/generic/siglist.h
+++ b/sysdeps/generic/siglist.h
@@ -1,5 +1,5 @@
/* Canonical list of all signal names.
- Copyright (C) 1996-2016 Free Software Foundation, Inc.
+ Copyright (C) 1996-2018 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
@@ -24,7 +24,8 @@
/* This file is included multiple times. */
-/* Standard signals */
+/* Standard signals, in the numerical order defined in
+ bits/signum-generic.h. */
init_sig (SIGHUP, "HUP", N_("Hangup"))
init_sig (SIGINT, "INT", N_("Interrupt"))
init_sig (SIGQUIT, "QUIT", N_("Quit"))
@@ -34,6 +35,7 @@
init_sig (SIGFPE, "FPE", N_("Floating point exception"))
init_sig (SIGKILL, "KILL", N_("Killed"))
init_sig (SIGBUS, "BUS", N_("Bus error"))
+ init_sig (SIGSYS, "SYS", N_("Bad system call"))
init_sig (SIGSEGV, "SEGV", N_("Segmentation fault"))
init_sig (SIGPIPE, "PIPE", N_("Broken pipe"))
init_sig (SIGALRM, "ALRM", N_("Alarm clock"))
@@ -45,32 +47,28 @@
init_sig (SIGCHLD, "CHLD", N_("Child exited"))
init_sig (SIGTTIN, "TTIN", N_("Stopped (tty input)"))
init_sig (SIGTTOU, "TTOU", N_("Stopped (tty output)"))
- init_sig (SIGIO, "IO", N_("I/O possible"))
+ init_sig (SIGPOLL, "POLL", N_("I/O possible"))
init_sig (SIGXCPU, "XCPU", N_("CPU time limit exceeded"))
init_sig (SIGXFSZ, "XFSZ", N_("File size limit exceeded"))
init_sig (SIGVTALRM, "VTALRM", N_("Virtual timer expired"))
init_sig (SIGPROF, "PROF", N_("Profiling timer expired"))
init_sig (SIGUSR1, "USR1", N_("User defined signal 1"))
init_sig (SIGUSR2, "USR2", N_("User defined signal 2"))
+ init_sig (SIGWINCH, "WINCH", N_("Window changed"))
-/* Variations */
+/* Signals that are not present on all supported platforms. */
#ifdef SIGEMT
init_sig (SIGEMT, "EMT", N_("EMT trap"))
#endif
-#ifdef SIGSYS
- init_sig (SIGSYS, "SYS", N_("Bad system call"))
-#endif
#ifdef SIGSTKFLT
init_sig (SIGSTKFLT, "STKFLT", N_("Stack fault"))
#endif
-#ifdef SIGINFO
- init_sig (SIGINFO, "INFO", N_("Information request"))
-#elif defined(SIGPWR) && (!defined(SIGLOST) || (SIGPWR != SIGLOST))
+#ifdef SIGPWR
init_sig (SIGPWR, "PWR", N_("Power failure"))
#endif
-#ifdef SIGLOST
- init_sig (SIGLOST, "LOST", N_("Resource lost"))
+#if defined SIGINFO && (!defined SIGPWR || SIGPWR != SIGINFO)
+ init_sig (SIGINFO, "INFO", N_("Information request"))
#endif
-#ifdef SIGWINCH
- init_sig (SIGWINCH, "WINCH", N_("Window changed"))
+#if defined SIGLOST && (!defined SIGPWR || SIGPWR != SIGLOST)
+ init_sig (SIGLOST, "LOST", N_("Resource lost"))
#endif
diff --git a/sysdeps/generic/sigset-cvt-mask.h b/sysdeps/generic/sigset-cvt-mask.h
index 78a8fa5896..ad4b8b2d2d 100644
--- a/sysdeps/generic/sigset-cvt-mask.h
+++ b/sysdeps/generic/sigset-cvt-mask.h
@@ -1,6 +1,6 @@
/* Convert between lowlevel sigmask and libc representation of sigset_t.
Generic version.
- Copyright (C) 1998-2016 Free Software Foundation, Inc.
+ Copyright (C) 1998-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Joe Keane <jgk@jgk.org>.
@@ -20,6 +20,8 @@
/* Convert between an old-style 32-bit signal mask and a POSIX sigset_t. */
+#include <sigsetops.h>
+
/* Perform *SET = MASK. Unused bits of *SET are set to 0.
Returns zero for success or -1 for errors (from sigaddset/sigemptyset). */
static inline int __attribute__ ((unused))
diff --git a/sysdeps/generic/sigsetops.h b/sysdeps/generic/sigsetops.h
new file mode 100644
index 0000000000..52b0e79071
--- /dev/null
+++ b/sysdeps/generic/sigsetops.h
@@ -0,0 +1,76 @@
+/* __sigset_t manipulators. Generic/BSD version.
+ Copyright (C) 1991-2018 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 _SIGSETOPS_H
+#define _SIGSETOPS_H 1
+
+#include <signal.h>
+
+/* Return a mask that includes SIG only. The cast to `sigset_t' avoids
+ overflow if `sigset_t' is wider than `int'. */
+# define __sigmask(sig) (((__sigset_t) 1) << ((sig) - 1))
+
+#define __sigemptyset(set) \
+ (__extension__ ({ \
+ *(set) = (__sigset_t) 0; \
+ 0; \
+ }))
+#define __sigfillset(set) \
+ (__extension__ ({ \
+ *(set) = ~(__sigset_t) 0; \
+ 0; \
+ }))
+
+# define __sigisemptyset(set) \
+ (*(set) == (__sigset_t) 0)
+
+# define __sigandset(dest, left, right) \
+ (__extension__ ({ \
+ *(dest) = *(left) & *(right); \
+ 0; \
+ }))
+
+# define __sigorset(dest, left, right) \
+ (__extension__ ({ \
+ *(dest) = *(left) | *(right); \
+ 0; \
+ }))
+
+/* These macros needn't check for a bogus signal number;
+ checking is done in the non-__ versions. */
+# define __sigismember(set, sig) \
+ (__extension__ ({ \
+ __sigset_t __mask = __sigmask (sig); \
+ *(set) & __mask ? 1 : 0; \
+ }))
+
+# define __sigaddset(set, sig) \
+ (__extension__ ({ \
+ __sigset_t __mask = __sigmask (sig); \
+ *(set) |= __mask; \
+ 0; \
+ }))
+
+# define __sigdelset(set, sig) \
+ (__extension__ ({ \
+ __sigset_t __mask = __sigmask (sig); \
+ *(set) &= ~__mask; \
+ 0; \
+ }))
+
+#endif
diff --git a/sysdeps/generic/stackinfo.h b/sysdeps/generic/stackinfo.h
index d510c59c74..d6bf544a11 100644
--- a/sysdeps/generic/stackinfo.h
+++ b/sysdeps/generic/stackinfo.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2018 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
diff --git a/sysdeps/generic/startup.h b/sysdeps/generic/startup.h
new file mode 100644
index 0000000000..b1e0118604
--- /dev/null
+++ b/sysdeps/generic/startup.h
@@ -0,0 +1,23 @@
+/* Generic definitions of functions used by static libc main startup.
+ Copyright (C) 2017-2018 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/>. */
+
+/* Targets should override this file if the default definitions below
+ will not work correctly very early before TLS is initialized. */
+
+/* Use macro instead of inline function to avoid including <stdio.h>. */
+#define _startup_fatal(message) __libc_fatal ((message))
diff --git a/sysdeps/generic/stdint.h b/sysdeps/generic/stdint.h
index 442762728b..11fb0ebef9 100644
--- a/sysdeps/generic/stdint.h
+++ b/sysdeps/generic/stdint.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2018 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
@@ -22,66 +22,34 @@
#ifndef _STDINT_H
#define _STDINT_H 1
-#include <features.h>
+#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
+#include <bits/libc-header-start.h>
+#include <bits/types.h>
#include <bits/wchar.h>
#include <bits/wordsize.h>
/* Exact integral types. */
/* Signed. */
-
-/* There is some amount of overlap with <sys/types.h> as known by inet code */
-#ifndef __int8_t_defined
-# define __int8_t_defined
-typedef signed char int8_t;
-typedef short int int16_t;
-typedef int int32_t;
-# if __WORDSIZE == 64
-typedef long int int64_t;
-# else
-__extension__
-typedef long long int int64_t;
-# endif
-#endif
+#include <bits/stdint-intn.h>
/* Unsigned. */
-typedef unsigned char uint8_t;
-typedef unsigned short int uint16_t;
-#ifndef __uint32_t_defined
-typedef unsigned int uint32_t;
-# define __uint32_t_defined
-#endif
-#if __WORDSIZE == 64
-typedef unsigned long int uint64_t;
-#else
-__extension__
-typedef unsigned long long int uint64_t;
-#endif
+#include <bits/stdint-uintn.h>
/* Small types. */
/* Signed. */
-typedef signed char int_least8_t;
-typedef short int int_least16_t;
-typedef int int_least32_t;
-#if __WORDSIZE == 64
-typedef long int int_least64_t;
-#else
-__extension__
-typedef long long int int_least64_t;
-#endif
+typedef __int_least8_t int_least8_t;
+typedef __int_least16_t int_least16_t;
+typedef __int_least32_t int_least32_t;
+typedef __int_least64_t int_least64_t;
/* Unsigned. */
-typedef unsigned char uint_least8_t;
-typedef unsigned short int uint_least16_t;
-typedef unsigned int uint_least32_t;
-#if __WORDSIZE == 64
-typedef unsigned long int uint_least64_t;
-#else
-__extension__
-typedef unsigned long long int uint_least64_t;
-#endif
+typedef __uint_least8_t uint_least8_t;
+typedef __uint_least16_t uint_least16_t;
+typedef __uint_least32_t uint_least32_t;
+typedef __uint_least64_t uint_least64_t;
/* Fast types. */
@@ -130,15 +98,8 @@ typedef unsigned int uintptr_t;
/* Largest integral types. */
-#if __WORDSIZE == 64
-typedef long int intmax_t;
-typedef unsigned long int uintmax_t;
-#else
-__extension__
-typedef long long int intmax_t;
-__extension__
-typedef unsigned long long int uintmax_t;
-#endif
+typedef __intmax_t intmax_t;
+typedef __uintmax_t uintmax_t;
# if __WORDSIZE == 64
@@ -248,8 +209,13 @@ typedef unsigned long long int uintmax_t;
# define PTRDIFF_MIN (-9223372036854775807L-1)
# define PTRDIFF_MAX (9223372036854775807L)
# else
-# define PTRDIFF_MIN (-2147483647-1)
-# define PTRDIFF_MAX (2147483647)
+# if __WORDSIZE32_PTRDIFF_LONG
+# define PTRDIFF_MIN (-2147483647L-1)
+# define PTRDIFF_MAX (2147483647L)
+# else
+# define PTRDIFF_MIN (-2147483647-1)
+# define PTRDIFF_MAX (2147483647)
+# endif
# endif
/* Limits of `sig_atomic_t'. */
@@ -260,7 +226,7 @@ typedef unsigned long long int uintmax_t;
# if __WORDSIZE == 64
# define SIZE_MAX (18446744073709551615UL)
# else
-# ifdef __WORDSIZE32_SIZE_ULONG
+# if __WORDSIZE32_SIZE_ULONG
# define SIZE_MAX (4294967295UL)
# else
# define SIZE_MAX (4294967295U)
@@ -307,4 +273,47 @@ typedef unsigned long long int uintmax_t;
# define UINTMAX_C(c) c ## ULL
# endif
+#if __GLIBC_USE (IEC_60559_BFP_EXT)
+
+# define INT8_WIDTH 8
+# define UINT8_WIDTH 8
+# define INT16_WIDTH 16
+# define UINT16_WIDTH 16
+# define INT32_WIDTH 32
+# define UINT32_WIDTH 32
+# define INT64_WIDTH 64
+# define UINT64_WIDTH 64
+
+# define INT_LEAST8_WIDTH 8
+# define UINT_LEAST8_WIDTH 8
+# define INT_LEAST16_WIDTH 16
+# define UINT_LEAST16_WIDTH 16
+# define INT_LEAST32_WIDTH 32
+# define UINT_LEAST32_WIDTH 32
+# define INT_LEAST64_WIDTH 64
+# define UINT_LEAST64_WIDTH 64
+
+# define INT_FAST8_WIDTH 8
+# define UINT_FAST8_WIDTH 8
+# define INT_FAST16_WIDTH __WORDSIZE
+# define UINT_FAST16_WIDTH __WORDSIZE
+# define INT_FAST32_WIDTH __WORDSIZE
+# define UINT_FAST32_WIDTH __WORDSIZE
+# define INT_FAST64_WIDTH 64
+# define UINT_FAST64_WIDTH 64
+
+# define INTPTR_WIDTH __WORDSIZE
+# define UINTPTR_WIDTH __WORDSIZE
+
+# define INTMAX_WIDTH 64
+# define UINTMAX_WIDTH 64
+
+# define PTRDIFF_WIDTH __WORDSIZE
+# define SIG_ATOMIC_WIDTH 32
+# define SIZE_WIDTH __WORDSIZE
+# define WCHAR_WIDTH 32
+# define WINT_WIDTH 32
+
+#endif
+
#endif /* stdint.h */
diff --git a/sysdeps/generic/stdio-lock.h b/sysdeps/generic/stdio-lock.h
index 69090a1409..4a40618545 100644
--- a/sysdeps/generic/stdio-lock.h
+++ b/sysdeps/generic/stdio-lock.h
@@ -1,5 +1,5 @@
/* Thread package specific definitions of stream lock type. Generic version.
- Copyright (C) 2000-2016 Free Software Foundation, Inc.
+ Copyright (C) 2000-2018 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
@@ -22,6 +22,7 @@
#include <libc-lock.h>
__libc_lock_define_recursive (typedef, _IO_lock_t)
+#define _IO_lock_t_defined 1
/* We need recursive (counting) mutexes. */
#ifdef _LIBC_LOCK_RECURSIVE_INITIALIZER
@@ -49,13 +50,13 @@ __libc_lock_define_recursive (typedef, _IO_lock_t)
# ifdef __EXCEPTIONS
# define _IO_acquire_lock(_fp) \
do { \
- _IO_FILE *_IO_acquire_lock_file \
+ FILE *_IO_acquire_lock_file \
__attribute__((cleanup (_IO_acquire_lock_fct))) \
= (_fp); \
_IO_flockfile (_IO_acquire_lock_file);
# define _IO_acquire_lock_clear_flags2(_fp) \
do { \
- _IO_FILE *_IO_acquire_lock_file \
+ FILE *_IO_acquire_lock_file \
__attribute__((cleanup (_IO_acquire_lock_clear_flags2_fct))) \
= (_fp); \
_IO_flockfile (_IO_acquire_lock_file);
diff --git a/sysdeps/generic/string_private.h b/sysdeps/generic/string_private.h
index c880aae4f2..4e152efce6 100644
--- a/sysdeps/generic/string_private.h
+++ b/sysdeps/generic/string_private.h
@@ -1,5 +1,5 @@
/* Define _STRING_ARCH_unaligned. Generic version.
- Copyright (C) 2016 Free Software Foundation, Inc.
+ Copyright (C) 2016-2018 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
diff --git a/sysdeps/generic/symbol-hacks.h b/sysdeps/generic/symbol-hacks.h
index ce576c9fd2..d614c099c9 100644
--- a/sysdeps/generic/symbol-hacks.h
+++ b/sysdeps/generic/symbol-hacks.h
@@ -4,4 +4,16 @@
asm ("memmove = __GI_memmove");
asm ("memset = __GI_memset");
asm ("memcpy = __GI_memcpy");
+
+/* Some targets do not use __stack_chk_fail_local. In libc.so,
+ redirect __stack_chk_fail to a hidden reference
+ __stack_chk_fail_local, to avoid the PLT reference.
+ __stack_chk_fail itself is a global symbol, exported from libc.so,
+ and cannot be made hidden. */
+
+# if IS_IN (libc) && defined SHARED && \
+ defined STACK_PROTECTOR_LEVEL && STACK_PROTECTOR_LEVEL > 0
+asm (".hidden __stack_chk_fail_local\n"
+ "__stack_chk_fail = __stack_chk_fail_local");
+# endif
#endif
diff --git a/sysdeps/generic/sys/ptrace.h b/sysdeps/generic/sys/ptrace.h
index baf4f7a440..268b4313e1 100644
--- a/sysdeps/generic/sys/ptrace.h
+++ b/sysdeps/generic/sys/ptrace.h
@@ -1,5 +1,5 @@
/* `ptrace' debugger support interface. Generic version; constants are common.
- Copyright (C) 1991-2016 Free Software Foundation, Inc.
+ Copyright (C) 1991-2018 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
diff --git a/sysdeps/generic/sys/swap.h b/sysdeps/generic/sys/swap.h
index 40cdea89bc..ee684a44b4 100644
--- a/sysdeps/generic/sys/swap.h
+++ b/sysdeps/generic/sys/swap.h
@@ -1,5 +1,5 @@
/* Calls to enable and disable swapping on specified locations. Unix version.
- Copyright (C) 1996-2016 Free Software Foundation, Inc.
+ Copyright (C) 1996-2018 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
diff --git a/sysdeps/generic/sys/sysinfo.h b/sysdeps/generic/sys/sysinfo.h
index 5c1a8c662c..625550cb47 100644
--- a/sysdeps/generic/sys/sysinfo.h
+++ b/sysdeps/generic/sys/sysinfo.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2018 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
diff --git a/sysdeps/generic/sys/ucontext.h b/sysdeps/generic/sys/ucontext.h
index f08cec04cc..0191f0306d 100644
--- a/sysdeps/generic/sys/ucontext.h
+++ b/sysdeps/generic/sys/ucontext.h
@@ -1,5 +1,5 @@
/* Data structures for user-level context switching. Generic version.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
+ Copyright (C) 1997-2018 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
@@ -17,28 +17,38 @@
<http://www.gnu.org/licenses/>. */
/* This file's definitions suffice for any platform where all
- the machine-specific state is described in `struct sigcontext'. */
+ the machine-specific state is described in `struct sigcontext', but
+ use of struct sigcontext does not conform to POSIX namespace
+ requirements. */
#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/types/sigset_t.h>
#include <bits/sigcontext.h>
+#include <bits/types/stack_t.h>
+
typedef struct sigcontext mcontext_t;
+#ifdef __USE_MISC
+# define __ctx(fld) fld
+#else
+# define __ctx(fld) __ ## fld
+#endif
+
/* Userlevel context. */
-typedef struct ucontext
+typedef struct ucontext_t
{
- unsigned long int uc_flags;
- struct ucontext *uc_link;
+ unsigned long int __ctx(uc_flags);
+ struct ucontext_t *uc_link;
stack_t uc_stack;
mcontext_t uc_mcontext;
- __sigset_t uc_sigmask;
+ sigset_t uc_sigmask;
} ucontext_t;
+#undef __ctx
+
#endif /* sys/ucontext.h */
diff --git a/sysdeps/generic/sysdep.h b/sysdeps/generic/sysdep.h
index 4c45702628..934d4da839 100644
--- a/sysdeps/generic/sysdep.h
+++ b/sysdeps/generic/sysdep.h
@@ -1,5 +1,5 @@
/* Generic asm macros used on many machines.
- Copyright (C) 1991-2016 Free Software Foundation, Inc.
+ Copyright (C) 1991-2018 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
diff --git a/sysdeps/generic/thread_state.h b/sysdeps/generic/thread_state.h
index b168e20246..99b7c923e8 100644
--- a/sysdeps/generic/thread_state.h
+++ b/sysdeps/generic/thread_state.h
@@ -1,5 +1,5 @@
/* Mach thread state definitions for machine-independent code. Stub version.
- Copyright (C) 1994-2016 Free Software Foundation, Inc.
+ Copyright (C) 1994-2018 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
@@ -22,7 +22,11 @@
/* Replace <machine> with "i386" or "mips" or whatever. */
+/* This lets the kernel define architecture-specific registers for a new
+ thread. */
#define MACHINE_NEW_THREAD_STATE_FLAVOR <machine>_NEW_THREAD_STATE
+/* This makes the kernel load all architectures-specific registers for the
+ thread. */
#define MACHINE_THREAD_STATE_FLAVOR <machine>_THREAD_STATE
#define MACHINE_THREAD_STATE_COUNT <machine>_THREAD_STATE_COUNT
diff --git a/sysdeps/generic/tininess.h b/sysdeps/generic/tininess.h
index 2d459dcce1..bb3ab28152 100644
--- a/sysdeps/generic/tininess.h
+++ b/sysdeps/generic/tininess.h
@@ -1,6 +1,6 @@
/* Specify architecture-specific rules for determining tininess of
floating-point results. Generic version.
- Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ Copyright (C) 2012-2018 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
diff --git a/sysdeps/generic/tls-setup.h b/sysdeps/generic/tls-setup.h
new file mode 100644
index 0000000000..8d0c36d2b8
--- /dev/null
+++ b/sysdeps/generic/tls-setup.h
@@ -0,0 +1,22 @@
+/* Definitions to set up thread-local data. Generic version.
+ Copyright (C) 2018 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/>. */
+
+static inline void __attribute__ ((always_inline))
+tls_setup_tcbhead (struct pthread *pd)
+{
+}
diff --git a/sysdeps/generic/tls.h b/sysdeps/generic/tls.h
index 5126a50198..01cbbeb7ba 100644
--- a/sysdeps/generic/tls.h
+++ b/sysdeps/generic/tls.h
@@ -1,5 +1,5 @@
/* Definition for thread-local data handling. Generic version.
- Copyright (C) 2002-2016 Free Software Foundation, Inc.
+ Copyright (C) 2002-2018 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
@@ -71,4 +71,10 @@
This macro returns the address of the DTV of the current thread.
This normally is done using the thread register which points
to the dtv or the TCB (from which the DTV can found).
+
+
+ THREAD_GSCOPE_IN_TCB
+
+ This should be set to 1 if the global scope flag is stored within the TCB.
+ When set to 0, GL(_dl_thread_gscope_count) will be defined to store it.
*/
diff --git a/sysdeps/generic/tst-stack-align.h b/sysdeps/generic/tst-stack-align.h
index 372509adef..e5cb331048 100644
--- a/sysdeps/generic/tst-stack-align.h
+++ b/sysdeps/generic/tst-stack-align.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003-2016 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2018 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
diff --git a/sysdeps/generic/unsecvars.h b/sysdeps/generic/unsecvars.h
index d5b8119c9c..5ea8a4a259 100644
--- a/sysdeps/generic/unsecvars.h
+++ b/sysdeps/generic/unsecvars.h
@@ -1,14 +1,22 @@
+#if !HAVE_TUNABLES
+# define GLIBC_TUNABLES_ENVVAR "GLIBC_TUNABLES\0"
+#else
+# define GLIBC_TUNABLES_ENVVAR
+#endif
+
/* Environment variable to be removed for SUID programs. The names are
all stuffed in a single string which means they have to be terminated
with a '\0' explicitly. */
#define UNSECURE_ENVVARS \
"GCONV_PATH\0" \
"GETCONF_DIR\0" \
+ GLIBC_TUNABLES_ENVVAR \
"HOSTALIASES\0" \
"LD_AUDIT\0" \
"LD_DEBUG\0" \
"LD_DEBUG_OUTPUT\0" \
"LD_DYNAMIC_WEAK\0" \
+ "LD_HWCAP_MASK\0" \
"LD_LIBRARY_PATH\0" \
"LD_ORIGIN_PATH\0" \
"LD_PRELOAD\0" \
diff --git a/sysdeps/generic/unwind-dw2-fde-glibc.c b/sysdeps/generic/unwind-dw2-fde-glibc.c
index e09fd4ce4b..3b374b8982 100644
--- a/sysdeps/generic/unwind-dw2-fde-glibc.c
+++ b/sysdeps/generic/unwind-dw2-fde-glibc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2018 Free Software Foundation, Inc.
Contributed by Jakub Jelinek <jakub@redhat.com>.
This file is part of the GNU C Library.
diff --git a/sysdeps/generic/unwind-dw2-fde.c b/sysdeps/generic/unwind-dw2-fde.c
index 6a64cbd254..80bcf61370 100644
--- a/sysdeps/generic/unwind-dw2-fde.c
+++ b/sysdeps/generic/unwind-dw2-fde.c
@@ -1,5 +1,5 @@
/* Subroutines needed for unwinding stack frames for exception handling. */
-/* Copyright (C) 1997-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
Contributed by Jason Merrill <jason@cygnus.com>.
This file is part of the GNU C Library.
@@ -202,6 +202,7 @@ __deregister_frame_info_bases (void *begin)
{
struct object **p;
struct object *ob = 0;
+ struct fde_vector *tofree = NULL;
/* If .eh_frame is empty, we haven't registered. */
if (*(uword *) begin == 0)
@@ -225,7 +226,7 @@ __deregister_frame_info_bases (void *begin)
{
ob = *p;
*p = ob->next;
- free (ob->u.sort);
+ tofree = ob->u.sort;
goto out;
}
}
@@ -244,6 +245,7 @@ __deregister_frame_info_bases (void *begin)
out:
__gthread_mutex_unlock (&object_mutex);
+ free (tofree);
return (void *) ob;
}
hidden_def (__deregister_frame_info_bases)
diff --git a/sysdeps/generic/unwind-dw2-fde.h b/sysdeps/generic/unwind-dw2-fde.h
index 9b55e73e77..869448bfb1 100644
--- a/sysdeps/generic/unwind-dw2-fde.h
+++ b/sysdeps/generic/unwind-dw2-fde.h
@@ -1,5 +1,5 @@
/* Subroutines needed for unwinding stack frames for exception handling. */
-/* Copyright (C) 1997-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
Contributed by Jason Merrill <jason@cygnus.com>.
This file is part of the GNU C Library.
diff --git a/sysdeps/generic/unwind-dw2.c b/sysdeps/generic/unwind-dw2.c
index b6bb5fa1d9..082609b34a 100644
--- a/sysdeps/generic/unwind-dw2.c
+++ b/sysdeps/generic/unwind-dw2.c
@@ -1,5 +1,5 @@
/* DWARF2 exception handling and frame unwind runtime interface routines.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
+ Copyright (C) 1997-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
diff --git a/sysdeps/generic/unwind-pe.h b/sysdeps/generic/unwind-pe.h
index c3a98ab816..4a791ac93f 100644
--- a/sysdeps/generic/unwind-pe.h
+++ b/sysdeps/generic/unwind-pe.h
@@ -1,5 +1,5 @@
/* Exception handling and frame unwind runtime interface routines.
- Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ Copyright (C) 2001-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
diff --git a/sysdeps/generic/unwind-resume.h b/sysdeps/generic/unwind-resume.h
index fd6e80cef8..3807e6eadb 100644
--- a/sysdeps/generic/unwind-resume.h
+++ b/sysdeps/generic/unwind-resume.h
@@ -1,5 +1,5 @@
/* Definitions for unwind-resume.c. Generic version.
- Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ Copyright (C) 2015-2018 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
diff --git a/sysdeps/generic/unwind.h b/sysdeps/generic/unwind.h
index 23325468ad..aad9c10154 100644
--- a/sysdeps/generic/unwind.h
+++ b/sysdeps/generic/unwind.h
@@ -1,5 +1,5 @@
/* Exception handling and frame unwind runtime interface routines.
- Copyright (C) 2001-2016 Free Software Foundation, Inc.
+ Copyright (C) 2001-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
diff --git a/sysdeps/generic/utmp-equal.h b/sysdeps/generic/utmp-equal.h
index 0eeedbbcf4..8b5c2e2cd2 100644
--- a/sysdeps/generic/utmp-equal.h
+++ b/sysdeps/generic/utmp-equal.h
@@ -1,5 +1,5 @@
/* Helper function for utmp functions to see if two entries are equal.
- Copyright (C) 1996-2016 Free Software Foundation, Inc.
+ Copyright (C) 1996-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>
and Paul Janzen <pcj@primenet.com>, 1996.