Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3998-patch/glibc-2.34-new/stdlib/Makefile
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3998-patch/glibc-2.34-new/stdlib/Makefile (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3998-patch/glibc-2.34-new/stdlib/Makefile (revision 348)
@@ -0,0 +1,246 @@
+# Copyright (C) 1991-2021 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
+# <https://www.gnu.org/licenses/>.
+
+#
+# Makefile for stdlib routines
+#
+subdir := stdlib
+
+include ../Makeconfig
+
+headers := stdlib.h bits/stdlib.h bits/stdlib-ldbl.h bits/stdlib-float.h \
+ monetary.h bits/monetary-ldbl.h \
+ inttypes.h stdint.h bits/wordsize.h bits/timesize.h \
+ errno.h sys/errno.h bits/errno.h bits/types/error_t.h \
+ ucontext.h sys/ucontext.h bits/indirect-return.h \
+ alloca.h fmtmsg.h \
+ bits/stdlib-bsearch.h sys/random.h bits/stdint-intn.h \
+ bits/stdint-uintn.h bits/time64.h \
+
+routines := \
+ atof atoi atol atoll \
+ abort \
+ bsearch qsort msort \
+ getenv putenv setenv secure-getenv \
+ exit on_exit atexit cxa_atexit cxa_finalize old_atexit \
+ quick_exit at_quick_exit cxa_at_quick_exit cxa_thread_atexit_impl \
+ abs labs llabs \
+ div ldiv lldiv \
+ mblen mbstowcs mbtowc wcstombs wctomb \
+ random random_r rand rand_r \
+ drand48 erand48 lrand48 nrand48 mrand48 jrand48 \
+ srand48 seed48 lcong48 \
+ drand48_r erand48_r lrand48_r nrand48_r mrand48_r jrand48_r \
+ srand48_r seed48_r lcong48_r \
+ drand48-iter getrandom getentropy \
+ strfromf strfromd strfroml \
+ strtol strtoul strtoll strtoull \
+ strtol_l strtoul_l strtoll_l strtoull_l \
+ strtof strtod strtold \
+ strtof_l strtod_l strtold_l \
+ strtof_nan strtod_nan strtold_nan \
+ system canonicalize \
+ a64l l64a \
+ rpmatch strfmon strfmon_l getsubopt xpg_basename fmtmsg \
+ getcontext setcontext makecontext swapcontext
+aux = grouping groupingwc tens_in_limb
+
+# These routines will be omitted from the libc shared object.
+# Instead the static object files will be included in a special archive
+# linked against when the shared library will be used.
+static-only-routines = atexit at_quick_exit
+
+test-srcs := tst-fmtmsg
+tests := tst-strtol tst-strtod testmb testrand testsort testdiv \
+ test-canon test-canon2 tst-strtoll tst-environ \
+ tst-xpg-basename tst-random tst-random2 tst-bsearch \
+ tst-limits tst-rand48 bug-strtod tst-setcontext \
+ tst-setcontext2 test-a64l tst-qsort testmb2 \
+ bug-strtod2 tst-atof1 tst-atof2 tst-strtod2 \
+ tst-rand48-2 tst-makecontext tst-strtod5 \
+ tst-qsort2 tst-makecontext2 tst-strtod6 tst-unsetenv1 \
+ tst-makecontext3 bug-getcontext bug-fmtmsg1 \
+ tst-secure-getenv tst-strtod-overflow tst-strtod-round \
+ tst-tininess tst-strtod-underflow tst-setcontext3 \
+ tst-strtol-locale tst-strtod-nan-locale tst-strfmon_l \
+ tst-quick_exit tst-thread-quick_exit tst-width \
+ tst-width-stdint tst-strfrom tst-strfrom-locale \
+ tst-getrandom tst-atexit tst-at_quick_exit \
+ tst-cxa_atexit tst-on_exit test-atexit-race \
+ test-at_quick_exit-race test-cxa_atexit-race \
+ test-cxa_atexit-race2 \
+ test-on_exit-race test-dlclose-exit-race \
+ tst-makecontext-align test-bz22786 tst-strtod-nan-sign \
+ tst-swapcontext1 tst-setcontext4 tst-setcontext5 \
+ tst-setcontext6 tst-setcontext7 tst-setcontext8 \
+ tst-setcontext9 tst-bz20544 tst-canon-bz26341 \
+ tst-realpath-toolong tst-realpath
+
+tests-internal := tst-strtod1i tst-strtod3 tst-strtod4 tst-strtod5i \
+ tst-tls-atexit tst-tls-atexit-nodelete
+tests-static := tst-secure-getenv
+tests-container := tst-system
+
+ifeq ($(build-hardcoded-path-in-tests),yes)
+tests += tst-empty-env
+endif
+
+LDLIBS-test-atexit-race = $(shared-thread-library)
+LDLIBS-test-at_quick_exit-race = $(shared-thread-library)
+LDLIBS-test-cxa_atexit-race = $(shared-thread-library)
+LDLIBS-test-cxa_atexit-race2 = $(shared-thread-library)
+LDLIBS-test-on_exit-race = $(shared-thread-library)
+LDLIBS-tst-canon-bz26341 = $(shared-thread-library)
+
+LDLIBS-test-dlclose-exit-race = $(shared-thread-library)
+LDFLAGS-test-dlclose-exit-race = $(LDFLAGS-rdynamic)
+LDLIBS-test-dlclose-exit-race-helper.so = $(libsupport) $(shared-thread-library)
+
+ifeq ($(have-cxx-thread_local),yes)
+CFLAGS-tst-quick_exit.o = -std=c++11
+LDLIBS-tst-quick_exit = -lstdc++
+CFLAGS-tst-thread-quick_exit.o = -std=c++11
+LDLIBS-tst-thread-quick_exit = -lstdc++
+$(objpfx)tst-thread-quick_exit: $(shared-thread-library)
+else
+tests-unsupported += tst-quick_exit tst-thread-quick_exit
+endif
+
+modules-names = tst-tls-atexit-lib test-dlclose-exit-race-helper
+extra-test-objs += $(addsuffix .os, $(modules-names))
+
+ifeq ($(build-shared),yes)
+tests += tst-putenv
+endif
+
+# Several mpn functions from GNU MP are used by the strtod function.
+mpn-routines := inlines add_n addmul_1 cmp divmod_1 divrem udiv_qrnnd \
+ lshift rshift mod_1 mul mul_1 mul_n sub_n submul_1
+mpn-headers = longlong.h gmp.h gmp-impl.h gmp-mparam.h asm-syntax.h
+
+routines := $(strip $(routines) $(mpn-routines)) \
+ dbl2mpn ldbl2mpn \
+ mpn2flt mpn2dbl mpn2ldbl
+aux += fpioconst mp_clz_tab
+
+tests-extras += tst-putenvmod
+extra-test-objs += tst-putenvmod.os
+
+generated += isomac isomac.out tst-putenvmod.so
+
+CFLAGS-bsearch.c += $(uses-callbacks)
+CFLAGS-msort.c += $(uses-callbacks)
+CFLAGS-qsort.c += $(uses-callbacks)
+CFLAGS-system.c += -fexceptions
+CFLAGS-system.os = -fomit-frame-pointer
+CFLAGS-fmtmsg.c += -fexceptions
+
+CFLAGS-strfmon.c += $(libio-mtsafe)
+CFLAGS-strfmon_l.c += $(libio-mtsafe)
+
+# The strfrom class of functions call __printf_fp in order to convert the
+# floating-point value to characters. This requires the value of IO_MTSAFE_IO.
+CFLAGS-strfromd.c += $(libio-mtsafe)
+CFLAGS-strfromf.c += $(libio-mtsafe)
+CFLAGS-strfroml.c += $(libio-mtsafe)
+
+CFLAGS-tst-bsearch.c += $(stack-align-test-flags)
+CFLAGS-tst-qsort.c += $(stack-align-test-flags)
+CFLAGS-tst-makecontext.c += -funwind-tables
+CFLAGS-tst-makecontext2.c += $(stack-align-test-flags)
+
+# Run a test on the header files we use.
+tests-special += $(objpfx)isomac.out
+
+ifeq ($(run-built-tests),yes)
+tests-special += $(objpfx)tst-fmtmsg.out
+endif
+
+include ../Rules
+
+ifeq ($(run-built-tests),yes)
+LOCALES := cs_CZ.UTF-8 de_DE.UTF-8 en_US.ISO-8859-1 tr_TR.UTF-8 \
+ tr_TR.ISO-8859-9 tg_TJ.UTF-8 hr_HR.UTF-8 hi_IN.UTF-8 \
+ el_GR.UTF-8
+include ../gen-locales.mk
+
+$(objpfx)bug-strtod2.out: $(gen-locales)
+$(objpfx)testmb2.out: $(gen-locales)
+$(objpfx)tst-strtod.out: $(gen-locales)
+$(objpfx)tst-strtod1i.out: $(gen-locales)
+$(objpfx)tst-strtod3.out: $(gen-locales)
+$(objpfx)tst-strtod4.out: $(gen-locales)
+$(objpfx)tst-strtod5.out: $(gen-locales)
+$(objpfx)tst-strtod5i.out: $(gen-locales)
+$(objpfx)tst-strtol-locale.out: $(gen-locales)
+$(objpfx)tst-strtod-nan-locale.out: $(gen-locales)
+$(objpfx)tst-strfmon_l.out: $(gen-locales)
+$(objpfx)tst-strfrom.out: $(gen-locales)
+$(objpfx)tst-strfrom-locale.out: $(gen-locales)
+$(objpfx)test-dlclose-exit-race.out: $(objpfx)test-dlclose-exit-race-helper.so
+endif
+
+# Testdir has to be named stdlib and needs to be writable
+test-canon-ARGS = --test-dir=${common-objpfx}stdlib
+
+bug-fmtmsg1-ENV = SEV_LEVEL=foo,11,newsev
+
+$(objpfx)isomac.out: $(objpfx)isomac
+ $(dir $<)$(notdir $<) '$(CC)' \
+ '-I../include $(+sysdep-includes) $(sysincludes) -I..' > $@; \
+ $(evaluate-test)
+
+isomac-CFLAGS = -O
+$(objpfx)isomac: isomac.c
+ $(native-compile)
+
+$(objpfx)tst-fmtmsg.out: tst-fmtmsg.sh $(objpfx)tst-fmtmsg
+ $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
+ '$(run-program-env)' '$(test-program-prefix-after-env)' \
+ $(common-objpfx)stdlib/; \
+ $(evaluate-test)
+
+$(objpfx)tst-putenv: $(objpfx)tst-putenvmod.so
+LDFLAGS-tst-putenv = -Wl,--no-as-needed
+
+$(objpfx)tst-putenvmod.so: $(objpfx)tst-putenvmod.os $(link-libc-deps)
+ $(build-module)
+libof-tst-putenvmod = extramodules
+
+$(objpfx)bug-getcontext: $(libm)
+$(objpfx)bug-strtod2: $(libm)
+$(objpfx)tst-strtod-round: $(libm)
+$(objpfx)tst-tininess: $(libm)
+$(objpfx)tst-strtod-underflow: $(libm)
+$(objpfx)tst-strtod6: $(libm)
+$(objpfx)tst-strtod-nan-locale: $(libm)
+$(objpfx)tst-strtod-nan-sign: $(libm)
+
+tst-tls-atexit-lib.so-no-z-defs = yes
+test-dlclose-exit-race-helper.so-no-z-defs = yes
+
+$(objpfx)tst-tls-atexit: $(shared-thread-library)
+$(objpfx)tst-tls-atexit.out: $(objpfx)tst-tls-atexit-lib.so
+
+$(objpfx)tst-tls-atexit-nodelete: $(shared-thread-library)
+$(objpfx)tst-tls-atexit-nodelete.out: $(objpfx)tst-tls-atexit-lib.so
+
+$(objpfx)tst-setcontext3.out: tst-setcontext3.sh $(objpfx)tst-setcontext3
+ $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
+ '$(run-program-env)' '$(test-program-prefix-after-env)' \
+ $(common-objpfx)stdlib/; \
+ $(evaluate-test)
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3998-patch/glibc-2.34-new/stdlib/canonicalize.c
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3998-patch/glibc-2.34-new/stdlib/canonicalize.c (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3998-patch/glibc-2.34-new/stdlib/canonicalize.c (revision 348)
@@ -0,0 +1,475 @@
+/* Return the canonical absolute name of a given file.
+ Copyright (C) 1996-2021 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
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _LIBC
+/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
+ optimizes away the name == NULL test below. */
+# define _GL_ARG_NONNULL(params)
+
+# define _GL_USE_STDLIB_ALLOC 1
+# include <libc-config.h>
+#endif
+
+/* Specification. */
+#include <stdlib.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <stdbool.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include <eloop-threshold.h>
+#include <filename.h>
+#include <idx.h>
+#include <intprops.h>
+#include <scratch_buffer.h>
+
+#ifdef _LIBC
+# include <shlib-compat.h>
+# define GCC_LINT 1
+# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+#else
+# define __canonicalize_file_name canonicalize_file_name
+# define __realpath realpath
+# include "pathmax.h"
+# define __faccessat faccessat
+# if defined _WIN32 && !defined __CYGWIN__
+# define __getcwd _getcwd
+# elif HAVE_GETCWD
+# if IN_RELOCWRAPPER
+ /* When building the relocatable program wrapper, use the system's getcwd
+ function, not the gnulib override, otherwise we would get a link error.
+ */
+# undef getcwd
+# endif
+# if defined VMS && !defined getcwd
+ /* We want the directory in Unix syntax, not in VMS syntax.
+ The gnulib override of 'getcwd' takes 2 arguments; the original VMS
+ 'getcwd' takes 3 arguments. */
+# define __getcwd(buf, max) getcwd (buf, max, 0)
+# else
+# define __getcwd getcwd
+# endif
+# else
+# define __getcwd(buf, max) getwd (buf)
+# endif
+# define __mempcpy mempcpy
+# define __pathconf pathconf
+# define __rawmemchr rawmemchr
+# define __readlink readlink
+# define __stat stat
+#endif
+
+/* Suppress bogus GCC -Wmaybe-uninitialized warnings. */
+#if defined GCC_LINT || defined lint
+# define IF_LINT(Code) Code
+#else
+# define IF_LINT(Code) /* empty */
+#endif
+
+#ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT
+# define DOUBLE_SLASH_IS_DISTINCT_ROOT false
+#endif
+
+#if defined _LIBC || !FUNC_REALPATH_WORKS
+
+/* Return true if FILE's existence can be shown, false (setting errno)
+ otherwise. Follow symbolic links. */
+static bool
+file_accessible (char const *file)
+{
+# if defined _LIBC || HAVE_FACCESSAT
+ return __faccessat (AT_FDCWD, file, F_OK, AT_EACCESS) == 0;
+# else
+ struct stat st;
+ return __stat (file, &st) == 0 || errno == EOVERFLOW;
+# endif
+}
+
+/* True if concatenating END as a suffix to a file name means that the
+ code needs to check that the file name is that of a searchable
+ directory, since the canonicalize_filename_mode_stk code won't
+ check this later anyway when it checks an ordinary file name
+ component within END. END must either be empty, or start with a
+ slash. */
+
+static bool _GL_ATTRIBUTE_PURE
+suffix_requires_dir_check (char const *end)
+{
+ /* If END does not start with a slash, the suffix is OK. */
+ while (ISSLASH (*end))
+ {
+ /* Two or more slashes act like a single slash. */
+ do
+ end++;
+ while (ISSLASH (*end));
+
+ switch (*end++)
+ {
+ default: return false; /* An ordinary file name component is OK. */
+ case '\0': return true; /* Trailing "/" is trouble. */
+ case '.': break; /* Possibly "." or "..". */
+ }
+ /* Trailing "/.", or "/.." even if not trailing, is trouble. */
+ if (!*end || (*end == '.' && (!end[1] || ISSLASH (end[1]))))
+ return true;
+ }
+
+ return false;
+}
+
+/* Append this to a file name to test whether it is a searchable directory.
+ On POSIX platforms "/" suffices, but "/./" is sometimes needed on
+ macOS 10.13 <https://bugs.gnu.org/30350>, and should also work on
+ platforms like AIX 7.2 that need at least "/.". */
+
+#if defined _LIBC || defined LSTAT_FOLLOWS_SLASHED_SYMLINK
+static char const dir_suffix[] = "/";
+#else
+static char const dir_suffix[] = "/./";
+#endif
+
+/* Return true if DIR is a searchable dir, false (setting errno) otherwise.
+ DIREND points to the NUL byte at the end of the DIR string.
+ Store garbage into DIREND[0 .. strlen (dir_suffix)]. */
+
+static bool
+dir_check (char *dir, char *dirend)
+{
+ strcpy (dirend, dir_suffix);
+ return file_accessible (dir);
+}
+
+static idx_t
+get_path_max (void)
+{
+# ifdef PATH_MAX
+ long int path_max = PATH_MAX;
+# else
+ /* The caller invoked realpath with a null RESOLVED, even though
+ PATH_MAX is not defined as a constant. The glibc manual says
+ programs should not do this, and POSIX says the behavior is undefined.
+ Historically, glibc here used the result of pathconf, or 1024 if that
+ failed; stay consistent with this (dubious) historical practice. */
+ int err = errno;
+ long int path_max = __pathconf ("/", _PC_PATH_MAX);
+ __set_errno (err);
+# endif
+ return path_max < 0 ? 1024 : path_max <= IDX_MAX ? path_max : IDX_MAX;
+}
+
+/* Act like __realpath (see below), with an additional argument
+ rname_buf that can be used as temporary storage.
+
+ If GCC_LINT is defined, do not inline this function with GCC 10.1
+ and later, to avoid creating a pointer to the stack that GCC
+ -Wreturn-local-addr incorrectly complains about. See:
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93644
+ Although the noinline attribute can hurt performance a bit, no better way
+ to pacify GCC is known; even an explicit #pragma does not pacify GCC.
+ When the GCC bug is fixed this workaround should be limited to the
+ broken GCC versions. */
+#if __GNUC_PREREQ (10, 1)
+# if defined GCC_LINT || defined lint
+__attribute__ ((__noinline__))
+# elif __OPTIMIZE__ && !__NO_INLINE__
+# define GCC_BOGUS_WRETURN_LOCAL_ADDR
+# endif
+#endif
+static char *
+realpath_stk (const char *name, char *resolved,
+ struct scratch_buffer *rname_buf)
+{
+ char *dest;
+ char const *start;
+ char const *end;
+ int num_links = 0;
+
+ if (name == NULL)
+ {
+ /* As per Single Unix Specification V2 we must return an error if
+ either parameter is a null pointer. We extend this to allow
+ the RESOLVED parameter to be NULL in case the we are expected to
+ allocate the room for the return value. */
+ __set_errno (EINVAL);
+ return NULL;
+ }
+
+ if (name[0] == '\0')
+ {
+ /* As per Single Unix Specification V2 we must return an error if
+ the name argument points to an empty string. */
+ __set_errno (ENOENT);
+ return NULL;
+ }
+
+ struct scratch_buffer extra_buffer, link_buffer;
+ scratch_buffer_init (&extra_buffer);
+ scratch_buffer_init (&link_buffer);
+ scratch_buffer_init (rname_buf);
+ char *rname_on_stack = rname_buf->data;
+ char *rname = rname_on_stack;
+ bool end_in_extra_buffer = false;
+ bool failed = true;
+
+ /* This is always zero for Posix hosts, but can be 2 for MS-Windows
+ and MS-DOS X:/foo/bar file names. */
+ idx_t prefix_len = FILE_SYSTEM_PREFIX_LEN (name);
+
+ if (!IS_ABSOLUTE_FILE_NAME (name))
+ {
+ while (!__getcwd (rname, rname_buf->length))
+ {
+ if (errno != ERANGE)
+ {
+ dest = rname;
+ goto error;
+ }
+ if (!scratch_buffer_grow (rname_buf))
+ goto error_nomem;
+ rname = rname_buf->data;
+ }
+ dest = __rawmemchr (rname, '\0');
+ start = name;
+ prefix_len = FILE_SYSTEM_PREFIX_LEN (rname);
+ }
+ else
+ {
+ dest = __mempcpy (rname, name, prefix_len);
+ *dest++ = '/';
+ if (DOUBLE_SLASH_IS_DISTINCT_ROOT)
+ {
+ if (prefix_len == 0 /* implies ISSLASH (name[0]) */
+ && ISSLASH (name[1]) && !ISSLASH (name[2]))
+ *dest++ = '/';
+ *dest = '\0';
+ }
+ start = name + prefix_len;
+ }
+
+ for ( ; *start; start = end)
+ {
+ /* Skip sequence of multiple file name separators. */
+ while (ISSLASH (*start))
+ ++start;
+
+ /* Find end of component. */
+ for (end = start; *end && !ISSLASH (*end); ++end)
+ /* Nothing. */;
+
+ /* Length of this file name component; it can be zero if a file
+ name ends in '/'. */
+ idx_t startlen = end - start;
+
+ if (startlen == 0)
+ break;
+ else if (startlen == 1 && start[0] == '.')
+ /* nothing */;
+ else if (startlen == 2 && start[0] == '.' && start[1] == '.')
+ {
+ /* Back up to previous component, ignore if at root already. */
+ if (dest > rname + prefix_len + 1)
+ for (--dest; dest > rname && !ISSLASH (dest[-1]); --dest)
+ continue;
+ if (DOUBLE_SLASH_IS_DISTINCT_ROOT
+ && dest == rname + 1 && !prefix_len
+ && ISSLASH (*dest) && !ISSLASH (dest[1]))
+ dest++;
+ }
+ else
+ {
+ if (!ISSLASH (dest[-1]))
+ *dest++ = '/';
+
+ while (rname + rname_buf->length - dest
+ < startlen + sizeof dir_suffix)
+ {
+ idx_t dest_offset = dest - rname;
+ if (!scratch_buffer_grow_preserve (rname_buf))
+ goto error_nomem;
+ rname = rname_buf->data;
+ dest = rname + dest_offset;
+ }
+
+ dest = __mempcpy (dest, start, startlen);
+ *dest = '\0';
+
+ char *buf;
+ ssize_t n;
+ while (true)
+ {
+ buf = link_buffer.data;
+ idx_t bufsize = link_buffer.length;
+ n = __readlink (rname, buf, bufsize - 1);
+ if (n < bufsize - 1)
+ break;
+ if (!scratch_buffer_grow (&link_buffer))
+ goto error_nomem;
+ }
+ if (0 <= n)
+ {
+ if (++num_links > __eloop_threshold ())
+ {
+ __set_errno (ELOOP);
+ goto error;
+ }
+
+ buf[n] = '\0';
+
+ char *extra_buf = extra_buffer.data;
+ idx_t end_idx IF_LINT (= 0);
+ if (end_in_extra_buffer)
+ end_idx = end - extra_buf;
+ size_t len = strlen (end);
+ if (INT_ADD_OVERFLOW (len, n))
+ {
+ __set_errno (ENOMEM);
+ goto error_nomem;
+ }
+ while (extra_buffer.length <= len + n)
+ {
+ if (!scratch_buffer_grow_preserve (&extra_buffer))
+ goto error_nomem;
+ extra_buf = extra_buffer.data;
+ }
+ if (end_in_extra_buffer)
+ end = extra_buf + end_idx;
+
+ /* Careful here, end may be a pointer into extra_buf... */
+ memmove (&extra_buf[n], end, len + 1);
+ name = end = memcpy (extra_buf, buf, n);
+ end_in_extra_buffer = true;
+
+ if (IS_ABSOLUTE_FILE_NAME (buf))
+ {
+ idx_t pfxlen = FILE_SYSTEM_PREFIX_LEN (buf);
+
+ dest = __mempcpy (rname, buf, pfxlen);
+ *dest++ = '/'; /* It's an absolute symlink */
+ if (DOUBLE_SLASH_IS_DISTINCT_ROOT)
+ {
+ if (ISSLASH (buf[1]) && !ISSLASH (buf[2]) && !pfxlen)
+ *dest++ = '/';
+ *dest = '\0';
+ }
+ /* Install the new prefix to be in effect hereafter. */
+ prefix_len = pfxlen;
+ }
+ else
+ {
+ /* Back up to previous component, ignore if at root
+ already: */
+ if (dest > rname + prefix_len + 1)
+ for (--dest; dest > rname && !ISSLASH (dest[-1]); --dest)
+ continue;
+ if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rname + 1
+ && ISSLASH (*dest) && !ISSLASH (dest[1]) && !prefix_len)
+ dest++;
+ }
+ }
+ else if (! (suffix_requires_dir_check (end)
+ ? dir_check (rname, dest)
+ : errno == EINVAL))
+ goto error;
+ }
+ }
+ if (dest > rname + prefix_len + 1 && ISSLASH (dest[-1]))
+ --dest;
+ if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rname + 1 && !prefix_len
+ && ISSLASH (*dest) && !ISSLASH (dest[1]))
+ dest++;
+ failed = false;
+
+error:
+ *dest++ = '\0';
+ if (resolved != NULL)
+ {
+ if (dest - rname <= get_path_max ())
+ rname = strcpy (resolved, rname);
+ else
+ {
+ failed = true;
+ __set_errno (ENAMETOOLONG);
+ }
+ }
+
+error_nomem:
+ scratch_buffer_free (&extra_buffer);
+ scratch_buffer_free (&link_buffer);
+
+ if (failed || rname == resolved)
+ {
+ scratch_buffer_free (rname_buf);
+ return failed ? NULL : resolved;
+ }
+
+ return scratch_buffer_dupfree (rname_buf, dest - rname);
+}
+
+/* Return the canonical absolute name of file NAME. A canonical name
+ does not contain any ".", ".." components nor any repeated file name
+ separators ('/') or symlinks. All file name components must exist. If
+ RESOLVED is null, the result is malloc'd; otherwise, if the
+ canonical name is PATH_MAX chars or more, returns null with 'errno'
+ set to ENAMETOOLONG; if the name fits in fewer than PATH_MAX chars,
+ returns the name in RESOLVED. If the name cannot be resolved and
+ RESOLVED is non-NULL, it contains the name of the first component
+ that cannot be resolved. If the name can be resolved, RESOLVED
+ holds the same value as the value returned. */
+
+char *
+__realpath (const char *name, char *resolved)
+{
+ #ifdef GCC_BOGUS_WRETURN_LOCAL_ADDR
+ #warning "GCC might issue a bogus -Wreturn-local-addr warning here."
+ #warning "See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93644>."
+ #endif
+ struct scratch_buffer rname_buffer;
+ return realpath_stk (name, resolved, &rname_buffer);
+}
+libc_hidden_def (__realpath)
+versioned_symbol (libc, __realpath, realpath, GLIBC_2_3);
+#endif /* !FUNC_REALPATH_WORKS || defined _LIBC */
+
+
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3)
+char *
+attribute_compat_text_section
+__old_realpath (const char *name, char *resolved)
+{
+ if (resolved == NULL)
+ {
+ __set_errno (EINVAL);
+ return NULL;
+ }
+
+ return __realpath (name, resolved);
+}
+compat_symbol (libc, __old_realpath, realpath, GLIBC_2_0);
+#endif
+
+
+char *
+__canonicalize_file_name (const char *name)
+{
+ return __realpath (name, NULL);
+}
+weak_alias (__canonicalize_file_name, canonicalize_file_name)
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3998-patch/glibc-2.34-new/stdlib/tst-realpath-toolong.c
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3998-patch/glibc-2.34-new/stdlib/tst-realpath-toolong.c (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3998-patch/glibc-2.34-new/stdlib/tst-realpath-toolong.c (revision 348)
@@ -0,0 +1,49 @@
+/* Verify that realpath returns NULL with ENAMETOOLONG if the result exceeds
+ NAME_MAX.
+ Copyright The GNU Toolchain Authors.
+ 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
+ <https://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <support/check.h>
+#include <support/temp_file.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#define BASENAME "tst-realpath-toolong."
+
+int
+do_test (void)
+{
+ char *base = support_create_and_chdir_toolong_temp_directory (BASENAME);
+
+ char buf[PATH_MAX + 1];
+ const char *res = realpath (".", buf);
+
+ /* canonicalize.c states that if the real path is >= PATH_MAX, then
+ realpath returns NULL and sets ENAMETOOLONG. */
+ TEST_VERIFY (res == NULL);
+ TEST_VERIFY (errno == ENAMETOOLONG);
+
+ free (base);
+ return 0;
+}
+
+#include <support/test-driver.c>
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3998-patch/create.patch.sh
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3998-patch/create.patch.sh (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3998-patch/create.patch.sh (revision 348)
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+VERSION=2.34
+
+tar --files-from=file.list -xJvf ../glibc-$VERSION.tar.xz
+mv glibc-$VERSION glibc-$VERSION-orig
+
+cp -rf ./glibc-$VERSION-new ./glibc-$VERSION
+
+diff -b --unified -Nr glibc-$VERSION-orig glibc-$VERSION > glibc-$VERSION-CVE-2021-3998.patch
+
+mv glibc-$VERSION-CVE-2021-3998.patch ../patches
+
+rm -rf ./glibc-$VERSION
+rm -rf ./glibc-$VERSION-orig
Property changes on: toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3998-patch/create.patch.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3998-patch/file.list
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3998-patch/file.list (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3998-patch/file.list (revision 348)
@@ -0,0 +1,2 @@
+glibc-2.34/stdlib/Makefile
+glibc-2.34/stdlib/canonicalize.c
Index: toolchains-1.7.2/sources/GNU/glibc/patches/README
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/patches/README (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/patches/README (revision 348)
@@ -0,0 +1,70 @@
+
+/* begin *
+
+ NOTE:
+ ====
+ The patch 'glibc-2.34-c-utf8-locale.patch' should be applyed after 'glibc-2.34-i18n.patch'.
+
+ glibc-2.34-CVE-2021-38604.patch - librt: fix NULL pointer dereference (bug 28213):
+
+ Helper thread frees copied attribute on NOTIFY_REMOVED message
+ received from the OS kernel. Unfortunately, it fails to check whether
+ copied attribute actually exists (data.attr != NULL). This worked
+ earlier because free() checks passed pointer before actually
+ attempting to release corresponding memory. But
+ __pthread_attr_destroy assumes pointer is not NULL.
+
+ So passing NULL pointer to __pthread_attr_destroy will result in
+ segmentation fault. This scenario is possible if
+ notification->sigev_notify_attributes == NULL (which means default
+ thread attributes should be used).
+
+ glibc-2.34-CVE-2021-3998.patch - realpath: Set errno to ENAMETOOLONG for result
+ larger than PATH_MAX [BZ #28770]:
+
+ realpath returns an allocated string when the result exceeds PATH_MAX,
+ which is unexpected when its second argument is not NULL. This results
+ in the second argument (resolved) being uninitialized and also results
+ in a memory leak since the caller expects resolved to be the same as the
+ returned value.
+
+ Return NULL and set errno to ENAMETOOLONG if the result exceeds
+ PATH_MAX. This fixes [BZ #28770], which is CVE-2021-3998.
+
+ glibc-2.34-CVE-2021-3999.patch - getcwd: Set errno to ERANGE for size == 1 (CVE-2021-3999):
+
+ No valid path returned by getcwd would fit into 1 byte, so reject the
+ size early and return NULL with errno set to ERANGE. This change is
+ prompted by CVE-2021-3999, which describes a single byte buffer
+ underflow and overflow when all of the following conditions are met:
+
+ - The buffer size (i.e. the second argument of getcwd) is 1 byte
+ - The current working directory is too long
+ - '/' is also mounted on the current working directory
+
+ Sequence of events:
+
+ - In sysdeps/unix/sysv/linux/getcwd.c, the syscall returns ENAMETOOLONG
+ because the linux kernel checks for name length before it checks
+ buffer size
+
+ - The code falls back to the generic getcwd in sysdeps/posix
+
+ - In the generic func, the buf[0] is set to '\0' on line 250
+
+ - this while loop on line 262 is bypassed:
+
+ while (!(thisdev == rootdev && thisino == rootino))
+
+ since the rootfs (/) is bind mounted onto the directory and the flow
+ goes on to line 449, where it puts a '/' in the byte before the
+ buffer.
+
+ - Finally on line 458, it moves 2 bytes (the underflowed byte and the
+ '\0') to the buf[0] and buf[1], resulting in a 1 byte buffer overflow.
+
+ - buf is returned on line 469 and errno is not set.
+
+ This resolves BZ #28769.
+
+ * end */
Index: toolchains-1.7.2/sources/GNU/glibc/patches
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/patches (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/patches (revision 348)
Property changes on: toolchains-1.7.2/sources/GNU/glibc/patches
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,77 ##
+
+# Target build dirs
+.noarch
+.host
+
+.arm32-newlib
+.a33xx-newlib
+.a9xx-newlib
+.h5-newlib
+.s9xx-newlib
+.rk33xx-newlib
+.m1000-newlib
+.riscv64-newlib
+.at91sam7s-newlib
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.imx6-glibc
+.jz47xx-glibc
+.p5600-glibc
+.m1000-glibc
+.omap543x-glibc
+.am335x-glibc
+.rk328x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.a9xx-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.a33xx-glibc
+.power8-glibc
+.power9-glibc
+.power8le-glibc
+.power9le-glibc
+.riscv64-glibc
+.i686-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.src_requires
+.src_requires_depend
+.dist
+
+# Destinations
+dist
+
+
+# Tarballs
+*.gz
+*.bz2
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Text files
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# Object Files
+*.[ao]
+
+# backup copies
+*~
Index: toolchains-1.7.2/sources/GNU/glibc/Makefile
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/Makefile (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/Makefile (revision 348)
@@ -0,0 +1,83 @@
+#
+# Download: http://www.gnu.org/prep/ftp.html
+#
+# You can use the generic url http://ftpmirror.gnu.org
+# to automatically choose a nearby and up-to-date mirror.
+#
+# original url: http://ftp.gnu.org/gnu/binutils
+#
+
+COMPONENT_TARGETS = $(TOOLCHAIN_NOARCH)
+
+
+include ../../../build-system/config.mk
+
+
+url = $(DOWNLOAD_SERVER)/sources/GNU/glibc
+
+versions = 2.34
+
+pkgname = glibc
+suffix = tar.xz
+
+tarballs = $(addsuffix .$(suffix), $(addprefix $(pkgname)-, $(versions)))
+sha1s = $(addsuffix .sha1sum, $(tarballs))
+
+patches = $(CURDIR)/patches/glibc-2.34-CVE-2021-38604.patch
+patches += $(CURDIR)/patches/glibc-2.34-CVE-2021-3998.patch
+patches += $(CURDIR)/patches/glibc-2.34-CVE-2021-3999.patch
+patches += $(CURDIR)/patches/glibc-2.34-c-utf8-locale.patch
+patches += $(CURDIR)/patches/glibc-2.34-en_US-no-am-pm.patch
+patches += $(CURDIR)/patches/glibc-2.34-i18n.patch
+patches += $(CURDIR)/patches/glibc-2.34-locale-no-archive.patch
+patches += $(CURDIR)/patches/glibc-2.34-malloc-hooks.patch
+patches += $(CURDIR)/patches/glibc-2.34-ppc64-interpreter.patch
+patches += $(CURDIR)/patches/glibc-2.34-x86_64-interpreter.patch
+
+.NOTPARALLEL: $(patches)
+
+
+BUILD_TARGETS = $(tarballs) $(sha1s) $(patches)
+
+
+include ../../../build-system/core.mk
+
+
+.PHONY: download_clean
+
+
+$(tarballs):
+ @echo -e "\n======= Downloading source tarballs =======" ; \
+ for tarball in $(tarballs) ; do \
+ echo "$(url)/$$tarball" | xargs -n 1 -P 100 wget $(WGET_OPTIONS) - & \
+ done ; wait
+
+$(sha1s): $(tarballs)
+ @for sha in $@ ; do \
+ echo -e "\n======= Downloading '$$sha' signature =======\n" ; \
+ echo "$(url)/$$sha" | xargs -n 1 -P 100 wget $(WGET_OPTIONS) - & wait %1 ; \
+ touch $$sha ; \
+ echo -e "\n======= Check the '$$sha' sha1sum =======\n" ; \
+ sha1sum --check $$sha ; ret="$$?" ; \
+ if [ "$$ret" == "1" ]; then \
+ echo -e "\n======= ERROR: Bad '$$sha' sha1sum =======\n" ; \
+ exit 1 ; \
+ fi ; \
+ done
+
+$(patches): $(sha1s)
+ @echo -e "\n======= Create Patches =======\n" ; \
+ ( cd create-2.34-CVE-2021-38604-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.34-CVE-2021-3998-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.34-CVE-2021-3999-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.34-c-utf8-locale-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.34-en_US-no-am-pm-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.34-i18n-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.34-locale-no-archive-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.34-malloc-hooks-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.34-ppc64-interpreter-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.34-x86_64-interpreter-patch ; ./create.patch.sh ) ; \
+ echo -e "\n"
+
+download_clean:
+ @rm -f $(tarballs) $(sha1s) $(patches)
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3999-patch/create.patch.sh
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3999-patch/create.patch.sh (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3999-patch/create.patch.sh (revision 348)
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+VERSION=2.34
+
+tar --files-from=file.list -xJvf ../glibc-$VERSION.tar.xz
+mv glibc-$VERSION glibc-$VERSION-orig
+
+cp -rf ./glibc-$VERSION-new ./glibc-$VERSION
+
+diff -b --unified -Nr glibc-$VERSION-orig glibc-$VERSION > glibc-$VERSION-CVE-2021-3999.patch
+
+mv glibc-$VERSION-CVE-2021-3999.patch ../patches
+
+rm -rf ./glibc-$VERSION
+rm -rf ./glibc-$VERSION-orig
Property changes on: toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3999-patch/create.patch.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3999-patch/file.list
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3999-patch/file.list (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3999-patch/file.list (revision 348)
@@ -0,0 +1,3 @@
+glibc-2.34/NEWS
+glibc-2.34/sysdeps/posix/getcwd.c
+glibc-2.34/sysdeps/unix/sysv/linux/Makefile
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3999-patch/glibc-2.34-new/NEWS
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3999-patch/glibc-2.34-new/NEWS (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3999-patch/glibc-2.34-new/NEWS (revision 348)
@@ -0,0 +1,6745 @@
+GNU C Library NEWS -- history of user-visible changes.
+Copyright (C) 1992-2021 Free Software Foundation, Inc.
+See the end for copying conditions.
+
+Please send GNU C library bug reports via <https://sourceware.org/bugzilla/>
+using `glibc' in the "product" field.
+
+Version 2.34
+
+Major new features:
+
+* In order to support smoother in-place-upgrades and to simplify
+ the implementation of the runtime all functionality formerly
+ implemented in the libraries libpthread, libdl, libutil, libanl has
+ been integrated into libc. New applications do not need to link with
+ -lpthread, -ldl, -lutil, -lanl anymore. For backwards compatibility,
+ empty static archives libpthread.a, libdl.a, libutil.a, libanl.a are
+ provided, so that the linker options keep working. Applications which
+ have been linked against glibc 2.33 or earlier continue to load the
+ corresponding shared objects (which are now empty). The integration
+ of those libraries into libc means that additional symbols become
+ available by default. This can cause applications that contain weak
+ references to take unexpected code paths that would only have been
+ used in previous glibc versions when e.g. preloading libpthread.so.0,
+ potentially exposing application bugs.
+
+* When _DYNAMIC_STACK_SIZE_SOURCE or _GNU_SOURCE are defined,
+ PTHREAD_STACK_MIN is no longer constant and is redefined to
+ sysconf(_SC_THREAD_STACK_MIN). This supports dynamic sized register
+ sets for modern architectural features like Arm SVE.
+
+* Add _SC_MINSIGSTKSZ and _SC_SIGSTKSZ. When _DYNAMIC_STACK_SIZE_SOURCE
+ or _GNU_SOURCE are defined, MINSIGSTKSZ and SIGSTKSZ are no longer
+ constant on Linux. MINSIGSTKSZ is redefined to sysconf(_SC_MINSIGSTKSZ)
+ and SIGSTKSZ is redefined to sysconf (_SC_SIGSTKSZ). This supports
+ dynamic sized register sets for modern architectural features like
+ Arm SVE.
+
+* The dynamic linker implements the --list-diagnostics option, printing
+ a dump of information related to IFUNC resolver operation and
+ glibc-hwcaps subdirectory selection.
+
+* On Linux, the function execveat has been added. It operates similar to
+ execve and it is is already used to implement fexecve without requiring
+ /proc to be mounted. However, different than fexecve, if the syscall is not
+ supported by the kernel an error is returned instead of trying a fallback.
+
+* The ISO C2X function timespec_getres has been added.
+
+* The feature test macro __STDC_WANT_IEC_60559_EXT__, from draft ISO
+ C2X, is supported to enable declarations of functions defined in Annex F
+ of C2X. Those declarations are also enabled when
+ __STDC_WANT_IEC_60559_BFP_EXT__, as specified in TS 18661-1, is
+ defined, and when _GNU_SOURCE is defined.
+
+* On powerpc64*, glibc can now be compiled without scv support using the
+ --disable-scv configure option.
+
+* Add support for 64-bit time_t on configurations like x86 where time_t
+ is traditionally 32-bit. Although time_t still defaults to 32-bit on
+ these configurations, this default may change in future versions.
+ This is enabled with the _TIME_BITS preprocessor macro set to 64 and is
+ only supported when LFS (_FILE_OFFSET_BITS=64) is also enabled. It is
+ only enabled for Linux and the full support requires a minimum kernel
+ version of 5.1.
+
+* The main gconv-modules file in glibc now contains only a small set of
+ essential converter modules and the rest have been moved into a supplementary
+ configuration file gconv-modules-extra.conf in the gconv-modules.d directory
+ in the same GCONV_PATH. Similarly, external converter modules directories
+ may have supplementary configuration files in a gconv-modules.d directory
+ with names ending with .conf to logically classify the converter modules in
+ that directory.
+
+* On Linux, a new tunable, glibc.pthread.stack_cache_size, can be used
+ to configure the size of the thread stack cache.
+
+* The function _Fork has been added as an async-signal-safe fork replacement
+ since Austin Group issue 62 droped the async-signal-safe requirement for
+ fork (and it will be included in the future POSIX standard). The new _Fork
+ function does not run any atfork function neither resets any internal state
+ or lock (such as the malloc one), and only sets up a minimal state required
+ to call async-signal-safe functions (such as raise or execve). This function
+ is currently a GNU extension.
+
+* On Linux, the close_range function has been added. It allows efficiently
+ closing a range of file descriptors on recent kernels (version 5.9).
+
+* The function closefrom has been added. It closes all file descriptors
+ greater than or equal to a given integer. This function is a GNU extension,
+ although it is also present in other systems.
+
+* The posix_spawn_file_actions_addclosefrom_np function has been added,
+ enabling posix_spawn and posix_spawnp to close all file descriptors greater
+ than or equal to a given integer. This function is a GNU extension,
+ although Solaris also provides a similar function.
+
+Deprecated and removed features, and other changes affecting compatibility:
+
+* The function pthread_mutex_consistent_np has been deprecated; programs
+ should use the equivalent standard function pthread_mutex_consistent
+ instead.
+
+* The function pthread_mutexattr_getrobust_np has been deprecated;
+ programs should use the equivalent standard function
+ pthread_mutexattr_getrobust instead.
+
+* The function pthread_mutexattr_setrobust_np has been deprecated;
+ programs should use the equivalent standard function
+ pthread_mutexattr_setrobust instead.
+
+* The function pthread_yield has been deprecated; programs should use
+ the equivalent standard function sched_yield instead.
+
+* The function inet_neta declared in <arpa/inet.h> has been deprecated.
+
+* Various rarely-used functions declared in <resolv.h> and
+ <arpa/nameser.h> have been deprecated. Applications are encouraged to
+ use dedicated DNS processing libraries if applicable. For <resolv.h>,
+ this affects the functions dn_count_labels, fp_nquery, fp_query,
+ fp_resstat, hostalias, loc_aton, loc_ntoa, p_cdname, p_cdnname,
+ p_class, p_fqname, p_fqnname, p_option, p_query, p_rcode, p_time,
+ p_type, putlong, putshort, res_hostalias, res_isourserver,
+ res_nameinquery, res_queriesmatch, res_randomid, sym_ntop, sym_ntos,
+ sym_ston. For <arpa/nameser.h>, the functions ns_datetosecs,
+ ns_format_ttl, ns_makecanon, ns_parse_ttl, ns_samedomain, ns_samename,
+ ns_sprintrr, ns_sprintrrf, ns_subdomain have been deprecated.
+
+* Various symbols previously defined in libresolv have been moved to libc
+ in order to prepare for libresolv moving entirely into libc (see earlier
+ entry for merging libraries into libc). The symbols __dn_comp,
+ __dn_expand, __dn_skipname, __res_dnok, __res_hnok, __res_mailok,
+ __res_mkquery, __res_nmkquery, __res_nquery, __res_nquerydomain,
+ __res_nsearch, __res_nsend, __res_ownok, __res_query, __res_querydomain,
+ __res_search, __res_send formerly in libresolv have been renamed and no
+ longer have a __ prefix. They are now available in libc.
+
+* The pthread cancellation handler is now installed with SA_RESTART and
+ pthread_cancel will always send the internal SIGCANCEL on a cancellation
+ request. It should not be visible to applications since the cancellation
+ handler should either act upon cancellation (if asynchronous cancellation
+ is enabled) or ignore the cancellation internal signal. However there are
+ buggy kernel interfaces (for instance some CIFS versions) that could still
+ see a spurious EINTR error when cancellation interrupts a blocking syscall.
+
+* Previously, glibc installed its various shared objects under versioned
+ file names such as libc-2.33.so. The ABI sonames (e.g., libc.so.6)
+ were provided as symbolic links. Starting with glibc 2.34, the shared
+ objects are installed under their ABI sonames directly, without
+ symbolic links. This increases compatibility with distribution
+ package managers that delete removed files late during the package
+ upgrade or downgrade process.
+
+* The symbols mallwatch and tr_break are now deprecated and no longer used in
+ mtrace. Similar functionality can be achieved by using conditional
+ breakpoints within mtrace functions from within gdb.
+
+* The __morecore and __after_morecore_hook malloc hooks and the default
+ implementation __default_morecore have been removed from the API. Existing
+ applications will continue to link against these symbols but the interfaces
+ no longer have any effect on malloc.
+
+* Debugging features in malloc such as the MALLOC_CHECK_ environment variable
+ (or the glibc.malloc.check tunable), mtrace() and mcheck() have now been
+ disabled by default in the main C library. Users looking to use these
+ features now need to preload a new debugging DSO libc_malloc_debug.so to get
+ this functionality back.
+
+* The deprecated functions malloc_get_state and malloc_set_state have been
+ moved from the core C library into libc_malloc_debug.so. Legacy applications
+ that still use these functions will now need to preload libc_malloc_debug.so
+ in their environment using the LD_PRELOAD environment variable.
+
+* The deprecated memory allocation hooks __malloc_hook, __realloc_hook,
+ __memalign_hook and __free_hook are now removed from the API. Compatibility
+ symbols are present to support legacy programs but new applications can no
+ longer link to these symbols. These hooks no longer have any effect on glibc
+ functionality. The malloc debugging DSO libc_malloc_debug.so currently
+ supports hooks and can be preloaded to get this functionality back for older
+ programs. However this is a transitional measure and may be removed in a
+ future release of the GNU C Library. Users may port away from these hooks by
+ writing and preloading their own malloc interposition library.
+
+Changes to build and runtime requirements:
+
+* On Linux, the shm_open, sem_open, and related functions now expect the
+ file shared memory file system to be mounted at /dev/shm. These functions
+ no longer search among the system's mount points for a suitable
+ replacement if /dev/shm is not available.
+
+Security related changes:
+
+ CVE-2021-27645: The nameserver caching daemon (nscd), when processing
+ a request for netgroup lookup, may crash due to a double-free,
+ potentially resulting in degraded service or Denial of Service on the
+ local system. Reported by Chris Schanzle.
+
+ CVE-2021-33574: The mq_notify function has a potential use-after-free
+ issue when using a notification type of SIGEV_THREAD and a thread
+ attribute with a non-default affinity mask.
+
+ CVE-2021-35942: The wordexp function may overflow the positional
+ parameter number when processing the expansion resulting in a crash.
+ Reported by Philippe Antoine.
+
+ CVE-2021-3998: Passing a path longer than PATH_MAX to the realpath
+ function could result in a memory leak and potential access of
+ uninitialized memory. Reported by Qualys.
+
+ CVE-2021-3999: Passing a buffer of size exactly 1 byte to the getcwd
+ function may result in an off-by-one buffer underflow and overflow
+ when the current working directory is longer than PATH_MAX and also
+ corresponds to the / directory through an unprivileged mount
+ namespace. Reported by Qualys.
+
+The following bugs are resolved with this release:
+
+ [4737] libc: fork is not async-signal-safe
+ [5781] math: Slow dbl-64 sin/cos/sincos for special values
+ [10353] libc: Methods for deleting all file descriptors greater than
+ given integer (closefrom)
+ [14185] glob: fnmatch() fails when '*' wildcard is applied on the file
+ name containing multi-byte character(s)
+ [14469] math: Inaccurate j0f function
+ [14470] math: Inaccurate j1f function
+ [14471] math: Inaccurate y0f function
+ [14472] math: Inaccurate y1f function
+ [14744] nptl: kill -32 $pid or kill -33 $pid on a process cancels a
+ random thread
+ [15271] dynamic-link: dlmopen()ed shared library with LM_ID_NEWLM
+ crashes if it fails dlsym() twice
+ [15648] nptl: multiple definition of `__lll_lock_wait_private'
+ [16063] nptl: Provide a pthread_once variant in libc directly
+ [17144] libc: syslog is not thread-safe if NO_SIGPIPE is not defined
+ [17145] libc: syslog with LOG_CONS leaks console file descriptor
+ [17183] manual: description of ENTRY struct in <search.h> in glibc
+ manual is incorrect
+ [18435] nptl: pthread_once hangs when init routine throws an exception
+ [18524] nptl: Missing calloc error checking in
+ __cxa_thread_atexit_impl
+ [19329] dynamic-link: dl-tls.c assert failure at concurrent
+ pthread_create and dlopen
+ [19366] nptl: returning from a thread should disable cancellation
+ [19511] nptl: 8MB memory leak in pthread_create in case of failure
+ when non-root user changes priority
+ [20802] dynamic-link: getauxval NULL pointer dereference after static
+ dlopen
+ [20813] nptl: pthread_exit is inconsistent between libc and libpthread
+ [22057] malloc: malloc_usable_size is broken with mcheck
+ [22668] locale: LC_COLLATE: the last character of ellipsis is not
+ ordered correctly
+ [23323] libc: [RFE] CSU startup hardening.
+ [23328] malloc: Remove malloc hooks and ensure related APIs return no
+ data.
+ [23462] dynamic-link: Static binary with dynamic string tokens ($LIB,
+ $PLATFORM, $ORIGIN) crashes
+ [23489] libc: "gcc -lmcheck" aborts on free when using posix_memalign
+ [23554] nptl: pthread_getattr_np reports wrong stack size with
+ MULTI_PAGE_ALIASING
+ [24106] libc: Bash interpreter in ldd script is taken from host
+ [24773] dynamic-link: dlerror in an secondary namespace does not use
+ the right free implementation
+ [25036] localedata: Update collation order for Swedish
+ [25383] libc: where_is_shmfs/__shm_directory/SHM_GET_NAME may cause
+ shm_open to pick wrong directory
+ [25680] dynamic-link: ifuncmain9picstatic and ifuncmain9picstatic
+ crash in IFUNC resolver due to stack canary (--enable-stack-
+ protector=all)
+ [26874] build: -Warray-bounds in _IO_wdefault_doallocate
+ [26983] math: [x86_64] x86_64 tgamma has too large ULP error
+ [27111] dynamic-link: pthread_create and tls access use link_map
+ objects that may be concurrently freed by dlclose
+ [27132] malloc: memusagestat is linked to system librt, leading to
+ undefined symbols on major version upgrade
+ [27136] dynamic-link: dtv setup at thread creation may leave an entry
+ uninitialized
+ [27249] libc: libSegFault.so does not output signal number properly
+ [27304] nptl: pthread_cond_destroy does not pass private flag to futex
+ system calls
+ [27318] dynamic-link: glibc fails to load binaries when built with
+ -march=sandybridge: CPU ISA level is lower than required
+ [27343] nss: initgroups() SIGSEGVs when called on a system without
+ nsswich.conf (in a chroot)
+ [27346] dynamic-link: x86: PTWRITE feature check is missing
+ [27389] network: NSS chroot hardening causes regressions in chroot
+ deployments
+ [27403] dynamic-link: aarch64: tlsdesc htab is not freed on dlclose
+ [27444] libc: sysconf reports unsupported option (-1) for
+ _SC_LEVEL1_ICACHE_LINESIZE on X86 since v2.33
+ [27462] nscd: double-free in nscd (CVE-2021-27645)
+ [27468] malloc: aarch64: realloc crash with heap tagging: FAIL:
+ malloc/tst-malloc-thread-fail
+ [27498] dynamic-link: __dl_iterate_phdr lacks unwinding information
+ [27511] libc: S390 memmove assumes Vector Facility when MIE Facility 3
+ is present
+ [27522] glob: glob, glob64 incorrectly marked as __THROW
+ [27555] dynamic-link: Static tests fail with --enable-stack-
+ protector=all
+ [27559] libc: fstat(AT_FDCWD) succeeds (it shouldn't) and returns
+ information for the current directory
+ [27577] dynamic-link: elf/ld.so --help doesn't work
+ [27605] libc: tunables can't control xsave/xsavec selection in
+ dl_runtime_resolve_*
+ [27623] libc: powerpc: Missing registers in sc[v] clobbers list
+ [27645] libc: [linux] sysconf(_SC_NPROCESSOR...) breaks down on
+ containers
+ [27646] dynamic-link: Linker error for non-existing NSS symbols (e.g.
+ _nss_files_getcanonname_r) from within a dlmopen namespace.
+ [27648] libc: FAIL: misc/tst-select
+ [27650] stdio: vfscanf returns too early if a match is longer than
+ INT_MAX
+ [27651] libc: Performance regression after updating to 2.33
+ [27655] string: Wrong size calculation in string/test-strnlen.c
+ [27706] libc: select fails to update timeout on error
+ [27709] libc: arm: FAIL: debug/tst-longjmp_chk2
+ [27721] dynamic-link: x86: ld_audit ignores bind now for TLSDESC and
+ tries resolving them lazily
+ [27744] nptl: Support different libpthread/ld.so load orders in
+ libthread_db
+ [27749] libc: Data race __run_exit_handlers
+ [27761] libc: getconf: Segmentation fault when passing '-vq' as
+ argument
+ [27832] nss: makedb.c:797:7: error: 'writev' specified size 4294967295
+ exceeds maximum object size 2147483647
+ [27870] malloc: MALLOC_CHECK_ causes realloc(valid_ptr, TOO_LARGE) to
+ not set ENOMEM
+ [27872] build: Obsolete configure option --enable-stackguard-
+ randomization
+ [27873] build: tst-cpu-features-cpuinfo fail when building on AMD cpu
+ [27882] localedata: Use U+00AF MACRON in more EBCDIC charsets
+ [27892] libc: powerpc: scv ABI error handling fails to check
+ IS_ERR_VALUE
+ [27896] nptl: mq_notify does not handle separately allocated thread
+ attributes (CVE-2021-33574)
+ [27901] libc: TEST_STACK_ALIGN doesn't work
+ [27902] libc: The x86-64 clone wrapper fails to align child stack
+ [27914] nptl: Install SIGSETXID handler with SA_ONSTACK
+ [27939] libc: aarch64: clone does not align the stack
+ [27968] libc: s390x: clone does not align the stack
+ [28011] libc: Wild read in wordexp (parse_param) (CVE-2021-35942)
+ [28024] string: s390(31bit): Wrong result of memchr (MEMCHR_Z900_G5)
+ with n >= 0x80000000
+ [28028] malloc: malloc: tcache shutdown sequence does not work if the
+ thread never allocated anything
+ [28033] libc: Need to check RTM_ALWAYS_ABORT for RTM
+ [28064] string: x86_64:wcslen implementation list has wcsnlen
+ [28067] libc: FAIL: posix/tst-spawn5
+ [28068] malloc: FAIL: malloc/tst-mallocalign1-mcheck
+ [28071] time: clock_gettime, gettimeofday, time lost vDSO acceleration
+ on older kernels
+ [28075] nis: Out-of-bounds static buffer read in nis_local_domain
+ [28089] build: tst-tls20 fails when linker defaults to --as-needed
+ [28090] build: elf/tst-cpu-features-cpuinfo-static fails on certain
+ AMD64 cpus
+ [28091] network: ns_name_skip may return 0 for domain names without
+ terminator
+
+
+Version 2.33
+
+Major new features:
+
+* The dynamic linker accepts the --list-tunables argument which prints
+ all the supported tunables. This option is disable if glibc is
+ configured with tunables disabled (--enable-tunables=no).
+
+* The dynamic linker accepts the --argv0 argument and provides opportunity
+ to change argv[0] string.
+
+* The dynamic linker loads optimized implementations of shared objects
+ from subdirectories under the glibc-hwcaps directory on the library
+ search path if the system's capabilities meet the requirements for
+ that subdirectory. Initially supported subdirectories include
+ "power9" and "power10" for the powerpc64le-linux-gnu architecture,
+ "z13", "z14", "z15" for s390x-linux-gnu, and "x86-64-v2", "x86-64-v3",
+ "x86-64-v4" for x86_64-linux-gnu. In the x86_64-linux-gnu case, the
+ subdirectory names correspond to the vendor-independent x86-64
+ microarchitecture levels defined in the x86-64 psABI supplement.
+
+* The new --help option of the dynamic linker provides usage and
+ information and library search path diagnostics.
+
+* The mallinfo2 function is added to report statistics as per mallinfo,
+ but with larger field widths to accurately report values that are
+ larger than fit in an integer.
+
+* Add <sys/platform/x86.h> to provide query macros for x86 CPU features.
+
+* Support for the RISC-V ISA running on Linux has been expanded to run on
+ 32-bit hardware. This is supported for the following ISA and ABI pairs:
+
+ - rv32imac ilp32
+ - rv32imafdc ilp32
+ - rv32imafdc ilp32d
+
+ The 32-bit RISC-V port requires at least Linux 5.4, GCC 7.1 and binutils
+ 2.28.
+
+* A new fortification level _FORTIFY_SOURCE=3 is available. At this level,
+ glibc may use additional checks that may have an additional performance
+ overhead. At present these checks are available only on LLVM 9 and later.
+ The latest GCC available at this time (10.2) does not support this level of
+ fortification.
+
+Deprecated and removed features, and other changes affecting compatibility:
+
+* The mallinfo function is marked deprecated. Callers should call
+ mallinfo2 instead.
+
+* When dlopen is used in statically linked programs, alternative library
+ implementations from HWCAP subdirectories are no longer loaded.
+ Instead, the default implementation is used.
+
+* The deprecated <sys/vtimes.h> header and the function vtimes have been
+ removed. To support old binaries, the vtimes function continues to exist
+ as a compatibility symbol. Applications should use the getrlimit or
+ prlimit.
+
+* Following a change in the tzdata 2018a release upstream, the zdump
+ program is now installed in the /usr/bin subdirectory. Previously,
+ the /usr/sbin subdirectory was used.
+
+* On s390(x), the type float_t is now derived from the macro
+ __FLT_EVAL_METHOD__ that is defined by the compiler, instead of being
+ hardcoded to double. This does not affect the ABI of any libraries
+ that are part of the GNU C Library, but may affect the ABI of other
+ libraries that use this type in their interfaces. The new definition
+ improves consistency with compiler behavior in many scenarios.
+
+* A future version of glibc will stop loading shared objects from the
+ "tls" subdirectories on the library search path, the subdirectory that
+ corresponds to the AT_PLATFORM system name, and also stop employing
+ the legacy AT_HWCAP search mechanism. Applications should switch to
+ the new glibc-hwcaps mechanism instead; if they do not do that, only
+ the baseline version (directly from the search path directory) will be
+ loaded.
+
+Changes to build and runtime requirements:
+
+* On Linux, the system administrator needs to configure /dev/pts with
+ the intended access modes for pseudo-terminals. glibc no longer
+ attemps to adjust permissions of terminal devices. The previous glibc
+ defaults ("tty" group, user read/write and group write) already
+ corresponded to what most systems used, so that grantpt did not
+ perform any adjustments.
+
+* On Linux, the posix_openpt and getpt functions no longer attempt to
+ use legacy (BSD) pseudo-terminals and assume that if /dev/ptmx exists
+ (and pseudo-terminals are supported), a devpts file system is mounted
+ on /dev/pts. Current systems already meet these requirements.
+
+* s390x requires GCC 7.1 or newer. See gcc Bug 98269.
+
+Security related changes:
+
+ CVE-2021-3326: An assertion failure during conversion from the
+ ISO-20220-JP-3 character set using the iconv function has been fixed.
+ This assertion was triggered by certain valid inputs in which the
+ converted output contains a combined sequence of two wide characters
+ crossing a buffer boundary. Reported by Tavis Ormandy.
+
+ CVE-2020-27618: An infinite loop has been fixed in the iconv program when
+ invoked with input containing redundant shift sequences in the IBM1364,
+ IBM1371, IBM1388, IBM1390, or IBM1399 character sets.
+
+ CVE-2020-29562: An assertion failure has been fixed in the iconv function
+ when invoked with UCS4 input containing an invalid character.
+
+ CVE-2019-25013: A buffer overflow has been fixed in the iconv function when
+ invoked with EUC-KR input containing invalid multibyte input sequences.
+
+The following bugs are resolved with this release:
+
+ [10635] libc: realpath portability patches
+ [16124] dynamic-link: ld.so should allow to change argv[0]
+ [17924] malloc: 'free' should not set errno
+ [18683] libc: Linux faccessat implementation can incorrectly ignore
+ AT_EACCESS
+ [22899] libc: Use 64-bit readdir() in generic POSIX getcwd()
+ [23091] hurd: missing waitid support
+ [23249] libc: Epyc and other current AMD CPUs do not select the
+ "haswell" platform subdirectory
+ [24080] dynamic-link: Definition of "haswell" platform is inconsistent
+ with GCC
+ [24202] libc: m68k setjmp() saves incorrect 'a5' register in --enable-
+ stack-protector=all
+ [24941] libc: Make grantpt usable after multi-threaded fork in more
+ cases
+ [24970] libc: realpath mishandles EOVERFLOW; stat not needed anyway
+ [24973] locale: iconv encounters segmentation fault when converting
+ 0x00 0xfe in EUC-KR to UTF-8 (CVE-2019-25013)
+ [25399] string: undefined reference to `__warn_memset_zero_len' when
+ changing gnuc version
+ [25859] libc: glibc parser for /sys/devices/system/cpu/online is
+ incorrect
+ [25938] dynamic-link: ld.so.cache should store meaning of hwcap mask
+ bits
+ [25971] libc: s390 bits/hwcap.h out of sync with kernel
+ [26053] libc: unlockpt fails with ENOTTY for non-ptmx descriptors
+ [26100] libc: Race in syslog(3) with regards to tag printing.
+ [26124] libc: Export <cpu-features.h>
+ [26130] nscd: Inconsistent nscd cache during pruning
+ [26203] libc: GLRO(dl_x86_cpu_features) may not be intialized
+ [26224] locale: iconv hangs when converting some invalid inputs from
+ several IBM character sets (CVE-2020-27618)
+ [26341] libc: realpath cyclically call __alloca(path_max) to consume
+ too much stack space
+ [26343] manual: invalid documented return type for strerrorname_np(),
+ strerrordesc_np(), sigdescr_np(), sigabbrev_np()
+ [26376] libc: Namespace violation in stdio.h and sys/stat.h if build
+ with optimization.
+ [26383] locale: bind_textdomain_codeset doesn't accept //TRANSLIT
+ anymore
+ [26394] time: [2.33 Regression] FAIL: nptl/tst-join14
+ [26534] math: libm.so 2.32 SIGILL in pow() due to FMA4 instruction on
+ non-FMA4 system
+ [26552] dynamic-link: CPU_FEATURE_USABLE_P should be more conservative
+ [26553] libc: mtx_init allows type set to "mtx_recursive" only
+ [26555] string: strerrorname_np does not return the documented value
+ [26592] libc: pointer arithmetic overflows in realpath
+ [26600] network: Transaction ID collisions cause slow DNS lookups in
+ getaddrinfo
+ [26606] libc: [2.33 Regression] pselect is broken on x32
+ [26615] libc: powerpc: libc segfaults when LD_PRELOADed with libgcc
+ [26620] glob: fnmatch with collating symbols results in segmentation
+ fault
+ [26625] libc: [2.33 Regression] CET is disabled
+ [26636] libc: 32-bit shmctl(IPC_INFO) crashes when shminfo struct is
+ at the end of a memory mapping
+ [26637] libc: semctl SEM_STAT_ANY fails to pass the buffer specified
+ by the caller to the kernel
+ [26639] libc: msgctl IPC_INFO and MSG_INFO return garbage
+ [26647] build: [-Werror=array-parameter=] due to different
+ declarations for __sigsetjmp
+ [26648] libc: mkstemp is likely to fail on systems with non-stricly-
+ monotonic clocks
+ [26649] stdio: printf should handle non-normal x86 long double numbers
+ gracefully (CVE-2020-29573)
+ [26686] build: -Warray-parameter instances building with GCC 11
+ [26687] build: -Warray-bounds instances building with GCC 11
+ [26690] stdio: Aliasing violation in __vfscanf_internal
+ [26691] nptl: Use a minimum guard size of 64 KiB on aarch64
+ [26726] build: GCC warning calling new_composite_name with an array of
+ one element
+ [26736] libc: FAIL: misc/tst-sysvshm-linux
+ [26737] libc: Random FAIL: rt/tst-shm
+ [26791] libc: Missing O_CLOEXEC in sysconf.c
+ [26798] dynamic-link: aarch64: variant PCS symbols may be incorrectly
+ lazy bound
+ [26801] nptl: pthread_mutex_clocklock with CLOCK_MONOTONIC can fail on
+ PI mutexes
+ [26818] string: aarch64: string tests may run ifunc variants that are
+ not safe
+ [26821] libc: Memory leak test failures on Fedora 33
+ [26824] libc: FAIL: elf/tst-cpu-features-supports with recent trunk:
+ FSGSBASE/LM/RDRAND check failure
+ [26833] time: adjtime() with delta == NULL segfaults on armv7 32bit
+ platform
+ [26853] libc: aarch64: Missing unwind information in statically linked
+ startup code
+ [26923] locale: Assertion failure in iconv when converting invalid
+ UCS4 (CVE-2020-29562)
+ [26926] dynamic-link: aarch64: library dependencies are not bti
+ protected
+ [26932] libc: sh: Multiple floating point functions defined as stubs
+ only since 2.31
+ [26964] nptl: pthread_mutex_timedlock returning EAGAIN after futex is
+ locked
+ [26988] dynamic-link: aarch64: BTI mprotect address is not page
+ aligned
+ [27002] build: libc_freeres_fn build failure with GCC 11
+ [27004] dynamic-link: ld.so is miscompiled by GCC 11
+ [27008] dynamic-link: ld.so.cache should have endianness markup
+ [27042] libc: [alpha] anonymous union in struct stat confuses
+ detection logic
+ [27053] libc: Conformance regression in system(3) (and probably also
+ pclose(3))
+ [27072] dynamic-link: static pie ifunc resolvers run before hwcap is
+ setup
+ [27077] network: Do not reload /etc/nsswitch.conf from chroot
+ [27083] libc: Unsafe unbounded alloca in addmntent
+ [27104] dynamic-link: The COMMON_CPUID_INDEX_MAX handshake does not
+ work
+ [27130] string: "rep movsb" performance issue
+ [27150] libc: alpha: wait4() is unavailable in static linking
+ [27177] dynamic-link:
+ GLIBC_TUNABLES=glibc.cpu.x86_ibt=on:glibc.cpu.x86_shstk=on doesn't
+ work
+ [27222] dynamic-link: Incorrect sysdeps/x86/tst-cpu-features-cpuinfo.c
+ [27237] malloc: deadlock in malloc/tst-malloc-stats-cancellation
+ [27256] locale: Assertion failure in ISO-2022-JP-3 gconv module
+ related to combining characters (CVE-2021-3326)
+
+
+Version 2.32
+
+Major new features:
+
+* Unicode 13.0.0 Support: Character encoding, character type info, and
+ transliteration tables are all updated to Unicode 13.0.0, using
+ generator scripts contributed by Mike FABIAN (Red Hat).
+
+* New locale added: ckb_IQ (Kurdish/Sorani spoken in Iraq)
+
+* Support for Synopsys ARC HS cores (ARCv2 ISA) running Linux has been
+ added. This port requires at least binutils-2.32, gcc-8.3 and Linux-5.1.
+ Three ABIs are supported:
+
+ - arc-linux-gnu
+ - arc-linux-gnuhf
+ - arceb-linux-gnu
+
+ The arc* ABIs are little-endian while arceb is big-endian. All ABIs use
+ 64-bit time (y2038 safe) and 64-bit file offsets (LFS default).
+
+* The GNU C Library now loads audit modules listed in the DT_AUDIT and
+ DT_DEPAUDIT dynamic section entries of the main executable.
+
+* powerpc64le supports IEEE128 long double libm/libc redirects when
+ using -mabi=ieeelongdouble to compile C code on supported GCC
+ toolchains. It is recommended to use GCC 8 or newer when testing
+ this option.
+
+* To help detect buffer overflows and other out-of-bounds accesses
+ several APIs have been annotated with GCC 'access' attribute. This
+ should help GCC 10 issue better warnings.
+
+* On Linux, functions pthread_attr_setsigmask_np and
+ pthread_attr_getsigmask_np have been added. They allow applications
+ to specify the signal mask of a thread created with pthread_create.
+
+* The GNU C Library now provides the header file <sys/single_threaded.h>
+ which declares the variable __libc_single_threaded. Applications are
+ encouraged to use this variable for single-thread optimizations,
+ instead of weak references to symbols historically defined in
+ libpthread.
+
+* The functions sigabbrev_np and sigdescr_np have been added. The
+ sigabbrev_np function returns the abbreviated signal name (e.g. "HUP" for
+ SIGHUP) while sigdescr_np returns a string describing the signal number
+ (e.g "Hangup" for SIGHUP). Different than strsignal, sigdescr_np does not
+ attempt to translate the return description, both functions return
+ NULL for an invalid signal number.
+
+ They should be used instead of sys_siglist or sys_sigabbrev and they
+ are both thread and async-signal safe. These functions are GNU extensions.
+
+* The functions strerrorname_np and strerrordesc_np have been added. The
+ strerroname_np function returns error number name (e.g. "EINVAL" for EINVAL)
+ while strerrordesc_np returns a string describing the error number
+ (e.g "Invalid argument" for EINVAL). Different than strerror,
+ strerrordesc_np does not attempt to translate the return description, both
+ functions return NULL for an invalid error number.
+
+ They should be used instead of sys_errlist and sys_nerr, both are
+ thread and async-signal safe. These functions are GNU extensions.
+
+* AArch64 now supports standard branch protection security hardening
+ in glibc when it is built with a GCC that is configured with
+ --enable-standard-branch-protection (or if -mbranch-protection=standard
+ flag is passed when building both GCC target libraries and glibc,
+ in either case a custom GCC is needed). This includes branch target
+ identification (BTI) and pointer authentication for return addresses
+ (PAC-RET). They require armv8.5-a and armv8.3-a architecture
+ extensions respectively for the protection to be effective,
+ otherwise the used instructions are nops. User code can use PAC-RET
+ without libc support, but BTI requires a libc that is built with BTI
+ support, otherwise runtime objects linked into user code will not be
+ BTI compatible.
+
+Deprecated and removed features, and other changes affecting compatibility:
+
+* Remove configure option --enable-obsolete-rpc. Sun RPC is removed
+ from glibc. This includes the rpcgen program, librpcsvc, and the Sun
+ RPC header files. Backward compatibility for old programs is kept
+ only for architectures and ABIs that have been added in or before
+ glibc 2.31. New programs need to use TI-RPC
+ <http://git.linux-nfs.org/?p=steved/libtirpc.git;a=summary> and
+ rpcsvc-proto <https://github.com/thkukuk/rpcsvc-proto>.
+
+* Remove configure option --enable-obsolete-nsl. libnsl is only built
+ as shared library for backward compatibility and the NSS modules "nis"
+ and "nisplus" are not built at all and libnsl's headers aren't
+ installed. This compatibility is kept only for architectures and ABIs
+ that have been added in or before version 2.28. Replacement
+ implementations based on TI-RPC, which additionally support IPv6, are
+ available from <https://github.com/thkukuk/>. This change does not
+ affect the "compat" NSS module, which does not depend on libnsl
+ since 2.27 and thus can be used without NIS.
+
+* The deprecated <sys/sysctl.h> header and the sysctl function have been
+ removed. To support old binaries, the sysctl function continues to
+ exist as a compatibility symbol (on those architectures which had it),
+ but always fails with ENOSYS. This reflects the removal of the system
+ call from all architectures, starting with Linux 5.5.
+
+* The sstk function is no longer available to newly linked binaries.
+ Its implementation always returned with a failure, and the function
+ was not declared in any header file.
+
+* The legacy signal handling functions siginterrupt, sigpause, sighold,
+ sigrelse, sigignore and sigset, and the sigmask macro have been
+ deprecated. Applications should use the sigsuspend, sigprocmask and
+ sigaction functions instead.
+
+* ldconfig now defaults to the new format for ld.so.cache. glibc has
+ already supported this format for almost 20 years.
+
+* The deprecated arrays sys_siglist, _sys_siglist, and sys_sigabbrev
+ are no longer available to newly linked binaries, and their declarations
+ have been removed from <string.h>. They are exported solely as
+ compatibility symbols to support old binaries. All programs should use
+ strsignal instead.
+
+* The deprecated symbols sys_errlist, _sys_errlist, sys_nerr, and _sys_nerr
+ are no longer available to newly linked binaries, and their declarations
+ have been removed from <stdio.h>. They are exported solely as
+ compatibility symbols to support old binaries. All programs should use
+ strerror or strerror_r instead.
+
+* Both strerror and strerror_l now share the same internal buffer in the
+ calling thread, meaning that the returned string pointer may be invalided
+ or contents might be overwritten on subsequent calls in the same thread or
+ if the thread is terminated. It makes strerror MT-safe.
+
+* Using weak references to libpthread functions such as pthread_create
+ or pthread_key_create to detect the singled-threaded nature of a
+ program is an obsolescent feature. Future versions of glibc will
+ define pthread_create within libc.so.6 itself, so such checks will
+ always flag the program as multi-threaded. Applications should check
+ the __libc_single_threaded variable declared in
+ <sys/single_threaded.h> instead.
+
+* The "files" NSS module no longer supports the "key" database (used for
+ secure RPC). The contents of the /etc/publickey file will be ignored,
+ regardless of the settings in /etc/nsswitch.conf. (This method of
+ storing RPC keys only supported the obsolete and insecure AUTH_DES
+ flavor of secure RPC.)
+
+* The __morecore and __after_morecore_hook malloc hooks and the default
+ implementation __default_morecore have been deprecated. Applications
+ should use malloc interposition to change malloc behavior, and mmap to
+ allocate anonymous memory. A future version of glibc may require that
+ applications which use the malloc hooks must preload a special shared
+ object, to enable the hooks.
+
+* The hesiod NSS module has been deprecated and will be removed in a
+ future version of glibc. System administrators are encouraged to
+ switch to other approaches for networked account databases, such as
+ LDAP.
+
+Changes to build and runtime requirements:
+
+* powerpc64le requires GCC 7.4 or newer. This is required for supporting
+ long double redirects.
+
+Security related changes:
+
+ CVE-2016-10228: An infinite loop has been fixed in the iconv program when
+ invoked with the -c option and when processing invalid multi-byte input
+ sequences. Reported by Jan Engelhardt.
+
+ CVE-2020-10029: Trigonometric functions on x86 targets suffered from stack
+ corruption when they were passed a pseudo-zero argument. Reported by Guido
+ Vranken / ForAllSecure Mayhem.
+
+ CVE-2020-1752: A use-after-free vulnerability in the glob function when
+ expanding ~user has been fixed.
+
+ CVE-2020-6096: A signed comparison vulnerability in the ARMv7 memcpy and
+ memmove functions has been fixed. Discovered by Jason Royes and Samual
+ Dytrych of the Cisco Security Assessment and Penetration Team (See
+ TALOS-2020-1019).
+
+The following bugs are resolved with this release:
+
+ [9809] localedata: ckb_IQ: new Kurdish Sorani locale
+ [10441] manual: Backtraces code example lacks error checking
+ [10815] librt: [timer_create / SIGEV_THREAD] signalmask of
+ timer_sigev_thread dangerous
+ [14231] stdio: stdio-common tests memory requirements
+ [14578] libc: /proc-based emulation for lchmod, fchmodat
+ [16272] dynamic-link: dlopen()ing a DT_FILTER library crashes if
+ filtee has constructor
+ [19519] locale: iconv(1) with -c option hangs on illegal multi-byte
+ sequences (CVE-2016-10228)
+ [19737] admin: Doc page “20.5.2 Infinity and NaN” has incorrect HTML
+ character entities for infinity & pi
+ [20338] libc: Parsing of /etc/gshadow can return bad pointers causing
+ segfaults in applications
+ [20543] libc: Please move from .gnu.linkonce to comdat
+ [22489] network: gcc warns about implicit convertion in
+ ICMP6_FILTER_SETPASS with -Wsign-conversion
+ [22525] localedata: or_IN LC_COLLATE does not use copy "iso14651_t1"
+ [23294] math: Complex _FloatN functions are redirected to the wrong
+ function with -mlong-double-64
+ [23296] libc: Data race in setting function descriptor during lazy
+ binding
+ [23668] dynamic-link: ldconfig: Default to the new format for
+ ld.so.cache
+ [23819] hurd: hurd: Add C11 thread support
+ [23990] build: test-container error out on failure to exec child.
+ [23991] build: shell-container typo in run_command_array
+ [24638] manual: Error in example of parsing a template string
+ [24654] manual: Wrong declaration of wcschr in libc manual
+ [24943] dynamic-link: Support DT_AUDIT, DT_DEPAUDIT in the dynamic
+ linker
+ [25051] dynamic-link: aarch64, powerpc64 uses surplus static tls for
+ dynamically loaded dsos
+ [25098] nptl: nptl: ctype classification functions are not AS-Safe
+ [25219] libc: improve out-of-bounds checking with GCC 10 attribute
+ access
+ [25262] libc: getcontext/setcontext/swapcontext unnecessarily save and
+ restore EAX, ECX and EDX
+ [25397] dynamic-link: Legacy bitmap doesn't cover jitted code
+ [25414] glob: 'glob' use-after-free bug (CVE-2020-1752)
+ [25420] network: Race condition in resolv_conf.c can result in caching
+ stale configuration forever
+ [25487] math: sinl() stack corruption from crafted input
+ (CVE-2020-10029)
+ [25506] build: configure: broken detection of STT_GNU_IFUNC when GCC
+ defaults to PIE
+ [25523] libc: MIPS/Linux inline syscall template is miscompiled
+ [25620] libc: Signed comparison vulnerability in the ARMv7 memcpy()
+ (CVE-2020-6096)
+ [25623] libc: test-sysvmsg, test-sysvsem, test-sysvshm fail with 2.31
+ on 32 bit and old kernel
+ [25635] libc: arm: Wrong sysdep order selection for soft-fp
+ [25639] localedata: Some names of days and months wrongly spelt in
+ Occitan
+ [25657] libc: sigprocmask() and sigisemptyset() manipulate different
+ amount of sigset_t bytes
+ [25691] stdio: printf: memory leak when printing long multibyte
+ strings
+ [25715] libc: system() returns wrong errors when posix_spawn fails
+ [25733] malloc: mallopt(M_MXFAST) can set global_max_fast to 0
+ [25734] locale: mbrtowc with Big5-HKSCS fails to reset conversion
+ state for conversions that produce two Unicode code points
+ [25765] nptl: Incorrect futex syscall in __pthread_disable_asynccancel
+ for linux x86_64 leads to livelock
+ [25788] dynamic-link: [i386] -fno-omit-frame-pointer in CFLAGS causes
+ test failures, invalid instruction in ld.so
+ [25790] glob: Typo in tst-fnmatch.input
+ [25810] libc: x32: Incorrect syscall entries with pointer, off_t and
+ size_t
+ [25819] localedata: Update locale data to Unicode 13.0.0
+ [25824] libc: Abnormal function of strnlen in aarch64
+ [25887] dynamic-link: Wasted space in _dl_x86_feature_1[1]
+ [25896] libc: Incorrect prctl
+ [25902] libc: Bad LOADARGS_N
+ [25905] dynamic-link: VSX registers are corrupted during PLT
+ resolution when glibc is built with --disable-multi-arch and --with-
+ cpu=power9
+ [25933] string: Off by one error in __strncmp_avx2 when
+ length=VEC_SIZE*4 and strings are at page boundaries can cause a
+ segfault
+ [25942] nptl: Deadlock on stack_cache_lock between __nptl_setxid and
+ exiting detached thread
+ [25966] libc: Incorrect access of __x86_shared_non_temporal_threshold
+ for x32
+ [25976] nss: internal_end*ent in nss_compat may clobber errno, hiding
+ ERANGE
+ [25999] nptl: Use-after-free issue in pthread_getaddr_default_np
+ [26073] math: getpayload() has wrong return value
+ [26076] dynamic-link: dlmopen crashes after failing to load
+ dependencies in audit mode
+ [26120] localedata: column width of of some Korean
+ JUNGSEONG/JONGSEONG characters wrong (should be 0)
+ [26128] libc: Incorrect bit_cpu_CLFLUSHOPT
+ [26133] libc: Incorrect need_arch_feature_F16C
+ [26137] libc: strtod() triggers exception FE_INEXACT on reasonable
+ input
+ [26149] libc: PKU is usable only if OSPKE is set
+ [26173] libc: powerpc64*: Add @notoc to calls to functions that do not
+ preserve r2
+ [26208] libc: Incorrect bit_cpu_CLFSH
+ [26210] network: Incorrect use of hidden symbols for global sunrpc
+ variables
+ [26211] stdio: printf integer overflow calculating allocation size
+ [26214] stdio: printf_fp double free
+ [26215] stdio: printf_fp memory leak
+ [26232] time: FAIL: support/tst-timespec for 32-bit targets
+ [26258] nss: nss_compat should not read input files with mmap
+ [26332] string: Incorrect cache line size load causes memory
+ corruption in memset
+
+
+Version 2.31
+
+Major new features:
+
+* The GNU C Library now supports a feature test macro _ISOC2X_SOURCE to
+ enable features from the draft ISO C2X standard. Only some features from
+ this draft standard are supported by the GNU C Library, and as the draft
+ is under active development, the set of features enabled by this macro is
+ liable to change. Features from C2X are also enabled by _GNU_SOURCE, or
+ by compiling with "gcc -std=gnu2x".
+
+* The <math.h> functions that round their results to a narrower type now
+ have corresponding type-generic macros in <tgmath.h>, as defined in TS
+ 18661-1:2014 and TS 18661-3:2015 as amended by the resolution of
+ Clarification Request 13 to TS 18661-3.
+
+* The function pthread_clockjoin_np has been added, enabling join with a
+ terminated thread with a specific clock. It allows waiting against
+ CLOCK_MONOTONIC and CLOCK_REALTIME. This function is a GNU extension.
+
+* New locale added: mnw_MM (Mon language spoken in Myanmar).
+
+* The DNS stub resolver will optionally send the AD (authenticated data) bit
+ in queries if the trust-ad option is set via the options directive in
+ /etc/resolv.conf (or if RES_TRUSTAD is set in _res.options). In this
+ mode, the AD bit, as provided by the name server, is available to
+ applications which call res_search and related functions. In the default
+ mode, the AD bit is not set in queries, and it is automatically cleared in
+ responses, indicating a lack of DNSSEC validation. (Therefore, the name
+ servers and the network path to them are treated as untrusted.)
+
+Deprecated and removed features, and other changes affecting compatibility:
+
+* The totalorder and totalordermag functions, and the corresponding
+ functions for other floating-point types, now take pointer arguments to
+ avoid signaling NaNs possibly being converted to quiet NaNs in argument
+ passing. This is in accordance with the resolution of Clarification
+ Request 25 to TS 18661-1, as applied for C2X. Existing binaries that pass
+ floating-point arguments directly will continue to work.
+
+* The obsolete function stime is no longer available to newly linked
+ binaries, and its declaration has been removed from <time.h>.
+ Programs that set the system time should use clock_settime instead.
+
+* We plan to remove the obsolete function ftime, and the header <sys/timeb.h>,
+ in a future version of glibc. In this release, the header still exists
+ but calling ftime will cause a compiler warning. All programs should use
+ gettimeofday or clock_gettime instead.
+
+* The gettimeofday function no longer reports information about a
+ system-wide time zone. This 4.2-BSD-era feature has been deprecated for
+ many years, as it cannot handle the full complexity of the world's
+ timezones, but hitherto we have supported it on a best-effort basis.
+ Changes required to support 64-bit time_t on 32-bit architectures have
+ made this no longer practical.
+
+ As of this release, callers of gettimeofday with a non-null 'tzp' argument
+ should expect to receive a 'struct timezone' whose tz_minuteswest and
+ tz_dsttime fields are zero. (For efficiency reasons, this does not always
+ happen on a few Linux-based ports. This will be corrected in a future
+ release.)
+
+ All callers should supply a null pointer for the 'tzp' argument to
+ gettimeofday. For accurate information about the time zone associated
+ with the current time, use the localtime function.
+
+ gettimeofday itself is obsolescent according to POSIX. We have no plans
+ to remove access to this function, but portable programs should consider
+ using clock_gettime instead.
+
+* The settimeofday function can still be used to set a system-wide time
+ zone when the operating system supports it. This is because the Linux
+ kernel reused the API, on some architectures, to describe a system-wide
+ time-zone-like offset between the software clock maintained by the kernel,
+ and the "RTC" clock that keeps time when the system is shut down.
+
+ However, to reduce the odds of this offset being set by accident,
+ settimeofday can no longer be used to set the time and the offset
+ simultaneously. If both of its two arguments are non-null, the call
+ will fail (setting errno to EINVAL).
+
+ Callers attempting to set this offset should also be prepared for the call
+ to fail and set errno to ENOSYS; this already happens on the Hurd and on
+ some Linux architectures. The Linux kernel maintainers are discussing a
+ more principled replacement for the reused API. After a replacement
+ becomes available, we will change settimeofday to fail with ENOSYS on all
+ platforms when its 'tzp' argument is not a null pointer.
+
+ settimeofday itself is obsolescent according to POSIX. Programs that set
+ the system time should use clock_settime and/or the adjtime family of
+ functions instead. We may cease to make settimeofday available to newly
+ linked binaries after there is a replacement for Linux's time-zone-like
+ offset API.
+
+* SPARC ISA v7 is no longer supported. v8 is still supported, but only if
+ the optional CAS instruction is implemented (for instance, LEON processors
+ are still supported, but SuperSPARC processors are not).
+
+ As the oldest 64-bit SPARC ISA is v9, this only affects 32-bit
+ configurations.
+
+* If a lazy binding failure happens during dlopen, during the execution of
+ an ELF constructor, the process is now terminated. Previously, the
+ dynamic loader would return NULL from dlopen, with the lazy binding error
+ captured in a dlerror message. In general, this is unsafe because
+ resetting the stack in an arbitrary function call is not possible.
+
+* For MIPS hard-float ABIs, the GNU C Library will be configured to need an
+ executable stack unless explicitly configured at build time to require
+ minimum kernel version 4.8 or newer. This is because executing
+ floating-point branches on a non-executable stack on Linux kernels prior to
+ 4.8 can lead to application crashes for some MIPS configurations. While
+ currently PT_GNU_STACK is not widely used on MIPS, future releases of GCC are
+ expected to enable non-executable stack by default with PT_GNU_STACK by
+ default and is thus likely to trigger a crash on older kernels.
+
+ The GNU C Library can be built with --enable-kernel=4.8.0 in order to keep a
+ non-executable stack while dropping support for older kernels.
+
+* System call wrappers for time system calls now use the new time64 system
+ calls when available. On 32-bit targets, these wrappers attempt to call
+ the new system calls first and fall back to the older 32-bit time system
+ calls if they are not present. This may cause issues in environments
+ that cannot handle unsupported system calls gracefully by returning
+ -ENOSYS. Seccomp sandboxes are affected by this issue.
+
+Changes to build and runtime requirements:
+
+* It is no longer necessary to have recent Linux kernel headers to build
+ working (non-stub) system call wrappers on all architectures except 64-bit
+ RISC-V. 64-bit RISC-V requires a minimum kernel headers version of 5.0.
+
+* The ChangeLog file is no longer present in the toplevel directory of the
+ source tree. ChangeLog files are located in the ChangeLog.old directory as
+ ChangeLog.N where the highest N has the latest entries.
+
+Security related changes:
+
+ CVE-2020-1751: A defect in the PowerPC backtrace function could cause an
+ out-of-bounds write when executed in a signal frame context.
+
+ CVE-2019-19126: ld.so failed to ignore the LD_PREFER_MAP_32BIT_EXEC
+ environment variable during program execution after a security
+ transition, allowing local attackers to restrict the possible mapping
+ addresses for loaded libraries and thus bypass ASLR for a setuid
+ program. Reported by Marcin Kościelnicki.
+
+The following bugs are resolved with this release:
+
+ [12031] localedata: iconv -t ascii//translit with Greek characters
+ [15813] libc: Multiple issues in __gen_tempname
+ [17726] libc: [arm, sparc] profil_counter should be compat symbol
+ [18231] libc: ipc_perm struct's mode member has wrong type in sys/ipc.h
+ [19767] libc: vdso is not used with static linking
+ [19903] hurd: Shared mappings not being inherited by children processes
+ [20358] network: RES_USE_DNSSEC sets DO; should also have a way to set AD
+ [20839] dynamic-link: Incomplete rollback of dynamic linker state on
+ linking failure
+ [23132] localedata: Missing transliterations in Miscellaneous Mathematical
+ Symbols-A/B Unicode blocks
+ [23518] libc: Eliminate __libc_utmp_jump_table
+ [24026] malloc: malloc_info() returns wrong numbers
+ [24054] localedata: Many locales are missing date_fmt
+ [24214] dynamic-link: user defined ifunc resolvers may run in ldd mode
+ [24304] dynamic-link: Lazy binding failure during ELF
+ constructors/destructors is not fatal
+ [24376] libc: RISC-V symbol size confusion with _start
+ [24682] localedata: zh_CN first weekday should be Monday per GB/T
+ 7408-2005
+ [24824] libc: test-in-container does not install charmap files compatible
+ with localedef
+ [24844] regex: regex bad pointer / leakage if malloc fails
+ [24867] malloc: Unintended malloc_info formatting changes
+ [24879] libc: login: utmp alarm timer can arrive after lock acquisition
+ [24880] libc: login: utmp implementation uses struct flock with fcntl64
+ [24882] libc: login: pututline uses potentially outdated cache
+ [24899] libc: Missing nonstring attributes in <utmp.h>, <utmpx.h>
+ [24902] libc: login: Repeating pututxline on EINTR/EAGAIN causes stale
+ utmp entries
+ [24916] dynamic-link: [MIPS] Highest EI_ABIVERSION value not raised to
+ ABSOLUTE ABI
+ [24930] dynamic-link: dlopen of PIE executable can result in
+ _dl_allocate_tls_init assertion failure
+ [24950] localedata: Top-of-tree glibc does not build with top-of-tree GCC
+ (stringop-overflow error)
+ [24959] time: librt IFUNC resolvers for clock_gettime and clock_*
+ functions other can lead to crashes
+ [24967] libc: jemalloc static linking causes runtime failure
+ [24986] libc: alpha: new getegid, geteuid and getppid syscalls used
+ unconditionally
+ [25035] libc: sbrk() failure handled poorly in tunables_strdup
+ [25087] dynamic-link: ldconfig mishandles unusual .dynstr placement
+ [25097] libc: new -Warray-bounds with GCC 10
+ [25112] dynamic-link: dlopen must not make new objects accessible when it
+ still can fail with an error
+ [25139] localedata: Please add the new mnw_MM locale
+ [25149] regex: Array bounds violation in proceed_next_node
+ [25157] dynamic-link: Audit cookie for the dynamic loader is not
+ initialized correctly
+ [25189] libc: glibc's __glibc_has_include causes issues with clang
+ -frewrite-includes
+ [25194] malloc: malloc.c: do_set_mxfast incorrectly casts the mallopt
+ value to an unsigned
+ [25204] dynamic-link: LD_PREFER_MAP_32BIT_EXEC not ignored in setuid
+ binaries (CVE-2019-19126)
+ [25225] libc: ld.so fails to link on x86 if GCC defaults to -fcf-
+ protection
+ [25226] string: strstr: Invalid result if needle crosses page on s390-z15
+ ifunc variant.
+ [25232] string: <string.h> does not enable const correctness for strchr et
+ al. for Clang++
+ [25233] localedata: Consider "." as the thousands separator for sl_SI
+ (Slovenian)
+ [25241] nptl: __SIZEOF_PTHREAD_MUTEX_T defined twice for x86
+ [25251] build: Failure to run tests when CFLAGS contains -DNDEBUG.
+ [25271] libc: undeclared identifier PTHREAD_MUTEX_DEFAULT when compiling
+ with -std=c11
+ [25323] localedata: km_KH: d_t_fmt contains "m" instead of "%M"
+ [25324] localedata: lv_LV: d_t_fmt contains suspicious words in the time
+ part
+ [25396] dynamic-link: Failing dlopen can leave behind dangling GL
+ (dl_initfirst) link map pointer
+ [25401] malloc: pvalloc must not have __attribute_alloc_size__
+ [25423] libc: Array overflow in backtrace on powerpc
+ [25425] network: Missing call to __resolv_context_put in
+ getaddrinfo.c:gethosts
+
+
+Version 2.30
+
+Major new features:
+
+* Unicode 12.1.0 Support: Character encoding, character type info, and
+ transliteration tables are all updated to Unicode 12.1.0, using
+ generator scripts contributed by Mike FABIAN (Red Hat).
+
+* The dynamic linker accepts the --preload argument to preload shared
+ objects, in addition to the LD_PRELOAD environment variable.
+
+* The twalk_r function has been added. It is similar to the existing
+ twalk function, but it passes an additional caller-supplied argument
+ to the callback function.
+
+* On Linux, the getdents64, gettid, and tgkill functions have been added.
+
+* Minguo (Republic of China) calendar support has been added as an
+ alternative calendar for the following locales: zh_TW, cmn_TW, hak_TW,
+ nan_TW, lzh_TW.
+
+* The entry for the new Japanese era has been added for ja_JP locale.
+
+* Memory allocation functions malloc, calloc, realloc, reallocarray, valloc,
+ pvalloc, memalign, and posix_memalign fail now with total object size
+ larger than PTRDIFF_MAX. This is to avoid potential undefined behavior with
+ pointer subtraction within the allocated object, where results might
+ overflow the ptrdiff_t type.
+
+* The dynamic linker no longer refuses to load objects which reference
+ versioned symbols whose implementation has moved to a different soname
+ since the object has been linked. The old error message, symbol
+ FUNCTION-NAME, version SYMBOL-VERSION not defined in file DSO-NAME with
+ link time reference, is gone.
+
+* Add new POSIX-proposed pthread_cond_clockwait, pthread_mutex_clocklock,
+ pthread_rwlock_clockrdlock, pthread_rwlock_clockwrlock and sem_clockwait
+ functions. These behave similarly to their "timed" equivalents, but also
+ accept a clockid_t parameter to determine which clock their timeout should
+ be measured against. All functions allow waiting against CLOCK_MONOTONIC
+ and CLOCK_REALTIME. The decision of which clock to be used is made at the
+ time of the wait (unlike with pthread_condattr_setclock, which requires
+ the clock choice at initialization time).
+
+* On AArch64 the GNU IFUNC resolver call ABI changed: old resolvers still
+ work, new resolvers can use a second argument which can be extended in
+ the future, currently it contains the AT_HWCAP2 value.
+
+Deprecated and removed features, and other changes affecting compatibility:
+
+* The copy_file_range function fails with ENOSYS if the kernel does not
+ support the system call of the same name. Previously, user space
+ emulation was performed, but its behavior did not match the kernel
+ behavior, which was deemed too confusing. Applications which use the
+ copy_file_range function can no longer rely on glibc to provide a fallback
+ on kernels that do not support the copy_file_range system call, and if
+ this function returns ENOSYS, they will need to use their own fallback.
+ Support for copy_file_range for most architectures was added in version
+ 4.5 of the mainline Linux kernel.
+
+* The functions clock_gettime, clock_getres, clock_settime,
+ clock_getcpuclockid, clock_nanosleep were removed from the librt library
+ for new applications (on architectures which had them). Instead, the
+ definitions in libc will be used automatically, which have been available
+ since glibc 2.17.
+
+* The obsolete and never-implemented XSI STREAMS header files <stropts.h>
+ and <sys/stropts.h> have been removed.
+
+* Support for the "inet6" option in /etc/resolv.conf and the RES_USE_INET6
+ resolver flag (deprecated in glibc 2.25) have been removed.
+
+* The obsolete RES_INSECURE1 and RES_INSECURE2 option flags for the DNS stub
+ resolver have been removed from <resolv.h>.
+
+* With --enable-bind-now, installed programs are now linked with the
+ BIND_NOW flag.
+
+* Support for the PowerPC SPE ISA extension (powerpc-*-*gnuspe*
+ configurations) has been removed, following the deprecation of this
+ subarchitecture in version 8 of GCC, and its removal in version 9.
+
+* On 32-bit Arm, support for the port-based I/O emulation and the <sys/io.h>
+ header have been removed.
+
+* The Linux-specific <sys/sysctl.h> header and the sysctl function have been
+ deprecated and will be removed from a future version of glibc.
+ Application should directly access /proc instead. For obtaining random
+ bits, the getentropy function can be used.
+
+Changes to build and runtime requirements:
+
+* GCC 6.2 or later is required to build the GNU C Library.
+
+ Older GCC versions and non-GNU compilers are still supported when
+ compiling programs that use the GNU C Library.
+
+Security related changes:
+
+ CVE-2019-7309: x86-64 memcmp used signed Jcc instructions to check
+ size. For x86-64, memcmp on an object size larger than SSIZE_MAX
+ has undefined behavior. On x32, the size_t argument may be passed
+ in the lower 32 bits of the 64-bit RDX register with non-zero upper
+ 32 bits. When it happened with the sign bit of RDX register set,
+ memcmp gave the wrong result since it treated the size argument as
+ zero. Reported by H.J. Lu.
+
+ CVE-2019-9169: Attempted case-insensitive regular-expression match
+ via proceed_next_node in posix/regexec.c leads to heap-based buffer
+ over-read. Reported by Hongxu Chen.
+
+The following bugs are resolved with this release:
+
+ [2872] locale: Transliteration Cyrillic -> ASCII fails
+ [6399] libc: gettid() should have a wrapper
+ [16573] malloc: mtrace hangs when MALLOC_TRACE is defined
+ [16976] glob: fnmatch unbounded stack VLA for collating symbols
+ [17396] localedata: globbing for locale by [[.collating-element.]]
+ [18035] dynamic-link: pldd does no longer work, enters infinite loop
+ [18465] malloc: memusagestat is built using system C library
+ [18830] locale: iconv -c -f ascii with >buffer size worth of input before
+ invalid input drops valid char
+ [20188] nptl: libpthread IFUNC resolver for vfork can lead to crash
+ [20568] locale: Segfault with wide characters and setlocale/fgetwc/UTF-8
+ [21897] localedata: Afar locales: Fix mon, abmon, and abday
+ [22964] localedata: The Japanese Era name will be changed on May 1, 2019
+ [23352] malloc: __malloc_check_init still defined in public header
+ malloc.h.
+ [23403] nptl: Wrong alignment of TLS variables
+ [23501] libc: nftw() doesn't return dangling symlink's inode
+ [23733] malloc: Check the count before calling tcache_get()
+ [23741] malloc: Missing __attribute_alloc_size__ in many allocation
+ functions
+ [23831] localedata: nl_NL missing LC_NUMERIC thousands_sep
+ [23844] nptl: pthread_rwlock_trywrlock results in hang
+ [23983] argparse: Missing compat versions of argp_failure and argp_error
+ for long double = double
+ [23984] libc: Missing compat versions of err.h and error.h functions for
+ long double = double
+ [23996] localedata: Dutch salutations
+ [24040] libc: riscv64: unterminated call chain in __thread_start
+ [24047] network: libresolv should use IP_RECVERR/IPV6_RECVERR to avoid
+ long timeouts
+ [24051] stdio: puts and putchar output to _IO_stdout instead of stdout
+ [24059] nss: nss_files: get_next_alias calls fgets_unlocked without
+ checking for NULL.
+ [24114] regex: regexec buffer read overrun in "grep -i
+ '\(\(\)*.\)*\(\)\(\)\1'"
+ [24122] libc: Segfaults if 0 returned from la_version
+ [24153] stdio: Some input functions do not react to stdin assignment
+ [24155] string: x32 memcmp can treat positive length as 0 (if sign bit in
+ RDX is set) (CVE-2019-7309)
+ [24161] nptl: __run_fork_handlers self-deadlocks in malloc/tst-mallocfork2
+ [24164] libc: Systemtap probes need to use "nr" constraint on 32-bit Arm,
+ not the default "nor"
+ [24166] dynamic-link: Dl_serinfo.dls_serpath[1] in dlfcn.h causes UBSAN
+ false positives, change to modern flexible array
+ [24180] nptl: pthread_mutex_trylock does not use the correct order of
+ instructions while maintaining the robust mutex list due to missing
+ compiler barriers.
+ [24194] librt: Non-compatibility symbols for clock_gettime etc. cause
+ unnecessary librt dependencies
+ [24200] localedata: Revert first_weekday removal in en_IE locale
+ [24211] nptl: Use-after-free in Systemtap probe in pthread_join
+ [24215] nptl: pthread_timedjoin_np should be a cancellation point
+ [24216] malloc: Check for large bin list corruption when inserting
+ unsorted chunk
+ [24228] stdio: old x86 applications that use legacy libio crash on exit
+ [24231] dynamic-link: [sparc64] R_SPARC_H34 implementation falls through
+ to R_SPARC_H44
+ [24293] localedata: Missing Minguo calendar support for TW locales
+ [24296] localedata: Orthographic mistakes in 'day' and 'abday' sections in
+ tt_RU (Tatar) locale
+ [24307] localedata: Update locale data to Unicode 12.0.0
+ [24323] dynamic-link: dlopen should not be able open PIE objects
+ [24335] build: "Obsolete types detected" with Linux 5.0 headers
+ [24369] localedata: Orthographic mistakes in 'mon' and 'abmon' sections in
+ tt_RU (Tatar) locale
+ [24370] localedata: Add lang_name for tt_RU locale
+ [24372] locale: Binary locale files are not architecture independent
+ [24394] time: strptime %Ey mis-parses final year of era
+ [24476] dynamic-link: __libc_freeres triggers bad free in libdl if dlerror
+ was not used
+ [24506] dynamic-link: FAIL: elf/tst-pldd with --enable-hardcoded-path-in-
+ tests
+ [24531] malloc: Malloc tunables give tcache assertion failures
+ [24532] libc: conform/arpa/inet.h failures due to linux kernel 64-bit
+ time_t changes
+ [24535] localedata: Update locale data to Unicode 12.1.0
+ [24537] build: nptl/tst-eintr1 test case can hit task limits on some
+ kernels and break testing
+ [24544] build: elf/tst-pldd doesn't work if you install with a --prefix
+ [24556] build: [GCC 9] error: ‘%s’ directive argument is null
+ [-Werror=format-overflow=]
+ [24570] libc: alpha: compat msgctl uses __IPC_64
+ [24584] locale: Data race in __wcsmbs_clone_conv
+ [24588] stdio: Remove codecvt vtables from libio
+ [24603] math: sysdeps/ieee754/dbl-64/branred.c is slow when compiled with
+ -O3 -march=skylake
+ [24614] localedata: nl_NL LC_MONETARY doesn't match CLDR 35
+ [24632] stdio: Old binaries which use freopen with default stdio handles
+ crash
+ [24640] libc: __ppc_get_timebase_freq() always return 0 when using static
+ linked glibc
+ [24652] localedata: szl_PL spelling correction
+ [24695] nss: nss_db: calling getpwent after endpwent crashes
+ [24696] nss: endgrent() clobbers errno=ERRNO for 'group: db files' entry
+ in /etc/nsswitch.conf
+ [24699] libc: mmap64 with very large offset broken on MIPS64 n32
+ [24740] libc: getdents64 type confusion
+ [24741] dynamic-link: ld.so should not require that a versioned symbol is
+ always implemented in the same library
+ [24744] libc: Remove copy_file_range emulation
+ [24757] malloc: memusagestat is linked against system libpthread
+ [24794] libc: Partial test suite run builds corrupt test-in-container
+ testroot
+
+
+Version 2.29
+
+Major new features:
+
+* The getcpu wrapper function has been added, which returns the currently
+ used CPU and NUMA node. This function is Linux-specific.
+
+* A new convenience target has been added for distribution maintainers
+ to build and install all locales as directories with files. The new
+ target is run by issuing the following command in your build tree:
+ 'make localedata/install-locale-files', with an optional DESTDIR
+ to set the install root if you wish to install into a non-default
+ configured location.
+
+* Optimized generic exp, exp2, log, log2, pow, sinf, cosf, sincosf and tanf.
+
+* The reallocarray function is now declared under _DEFAULT_SOURCE, not just
+ for _GNU_SOURCE, to match BSD environments.
+
+* For powercp64le ABI, Transactional Lock Elision is now enabled iff kernel
+ indicates that it will abort the transaction prior to entering the kernel
+ (PPC_FEATURE2_HTM_NOSC on hwcap2). On older kernels the transaction is
+ suspended, and this caused some undefined side-effects issues by aborting
+ transactions manually. Glibc avoided it by abort transactions manually on
+ each syscall, but it lead to performance issues on newer kernels where the
+ HTM state is saved and restore lazily (the state being saved even when the
+ process actually does not use HTM).
+
+* The functions posix_spawn_file_actions_addchdir_np and
+ posix_spawn_file_actions_addfchdir_np have been added, enabling
+ posix_spawn and posix_spawnp to run the new process in a different
+ directory. These functions are GNU extensions. The function
+ posix_spawn_file_actions_addchdir_np is similar to the Solaris function
+ of the same name.
+
+* The popen and system do not run atfork handlers anymore (BZ#17490).
+ Although it is a possible POSIX violation, the POSIX rationale in
+ pthread_atfork documentation regarding atfork handlers is to handle
+ inconsistent mutex state after a fork call in a multi-threaded process.
+ In both popen and system there is no direct access to user-defined mutexes.
+
+* Support for the C-SKY ABIV2 running on Linux has been added. This port
+ requires at least binutils-2.32, gcc-9.0, and linux-4.20. Two ABIs are
+ supported:
+ - C-SKY ABIV2 soft-float little-endian
+ - C-SKY ABIV2 hard-float little-endian
+
+* strftime's default formatting of a locale's alternative year (%Ey)
+ has been changed to zero-pad the year to a minimum of two digits,
+ like "%y". This improves the display of Japanese era years during
+ the first nine years of a new era, and is expected to be harmless
+ for all other locales (only Japanese locales regularly have
+ alternative year numbers less than 10). Zero-padding can be
+ overridden with the '_' or '-' flags (which are GNU extensions).
+
+* As a GNU extension, the '_' and '-' flags can now be applied to
+ "%EY" to control how the year number is formatted; they have the
+ same effect that they would on "%Ey".
+
+Deprecated and removed features, and other changes affecting compatibility:
+
+* The glibc.tune tunable namespace has been renamed to glibc.cpu and the
+ tunable glibc.tune.cpu has been renamed to glibc.cpu.name.
+
+* The type of the pr_uid and pr_gid members of struct elf_prpsinfo, defined
+ in <sys/procfs.h>, has been corrected to match the type actually used by
+ the Linux kernel. This affects the size and layout of that structure on
+ MicroBlaze, MIPS (n64 ABI only), Nios II and RISC-V.
+
+* For the MIPS n32 ABI, the type of the pr_sigpend and pr_sighold members of
+ struct elf_prstatus, and the pr_flag member of struct elf_prpsinfo,
+ defined in <sys/procfs.h>, has been corrected to match the type actually
+ used by the Linux kernel. This affects the size and layout of those
+ structures.
+
+* An archaic GNU extension to scanf, under which '%as', '%aS', and '%a[...]'
+ meant to scan a string and allocate space for it with malloc, is now
+ restricted to programs compiled in C89 or C++98 mode with _GNU_SOURCE
+ defined. This extension conflicts with C99's use of '%a' to scan a
+ hexadecimal floating-point number, which is now available to programs
+ compiled as C99 or C++11 or higher, regardless of _GNU_SOURCE.
+
+ POSIX.1-2008 includes the feature of allocating a buffer for string input
+ with malloc, using the modifier letter 'm' instead. Programs using
+ '%as', '%aS', or '%a[...]' with the old GNU meaning should change to
+ '%ms', '%mS', or '%m[...]' respectively. Programs that wish to use the
+ C99 '%a' no longer need to avoid _GNU_SOURCE.
+
+ GCC's -Wformat warnings can detect most uses of this extension, as long
+ as all functions that call vscanf, vfscanf, or vsscanf are annotated with
+ __attribute__ ((format (scanf, ...))).
+
+Changes to build and runtime requirements:
+
+* Python 3.4 or later is required to build the GNU C Library.
+
+* On most architectures, GCC 5 or later is required to build the GNU C
+ Library. (On powerpc64le, GCC 6.2 or later is still required, as before.)
+
+ Older GCC versions and non-GNU compilers are still supported when
+ compiling programs that use the GNU C Library.
+
+Security related changes:
+
+ CVE-2018-19591: A file descriptor leak in if_nametoindex can lead to a
+ denial of service due to resource exhaustion when processing getaddrinfo
+ calls with crafted host names. Reported by Guido Vranken.
+
+ CVE-2019-6488: On x32, the size_t parameter may be passed in the lower
+ 32 bits of a 64-bit register with with non-zero upper 32 bit. When it
+ happened, accessing the 32-bit size_t value as the full 64-bit register
+ in the assembly string/memory functions would cause a buffer overflow.
+ Reported by H.J. Lu.
+
+ CVE-2016-10739: The getaddrinfo function could successfully parse IPv4
+ addresses with arbitrary trailing characters, potentially leading to data
+ or command injection issues in applications.
+
+The following bugs are resolved with this release:
+
+ [10425] localedata: it_IT/it_CH: LC_TIME format is wrong
+ [10496] localedata: 12h time representation in multiple locales faulty
+ [10797] localedata: it_IT locale numeric does not have a separator for
+ thousands
+ [11319] libc: dprintf doesn't handle errors properly
+ [16346] time: mktime: potentially unsafe use of localtime_offset
+ [17248] build: glibc should not sort CFLAGS (support gcc plugins and
+ --param options)
+ [17405] libc: Implement posix_spawn_file_actions_addchdir_np,
+ posix_spawn_file_actions_addfchdir_np
+ [17426] localedata: Indian locales: set the correct date format
+ [17490] stdio: popen should not invoke atfork handlers
+ [17783] libc: TIOCSER_TEMT conditions inconsistent
+ [18040] regex: use-after-free in regexec/get_subexp
+ [18093] libc: Corrupted aux-cache causes ldconfig to segfault
+ [20018] network: getaddrinfo should reject IP addresses with trailing
+ characters (CVE-2016-10739)
+ [20209] localedata: Spelling mistake for Sunday in Greenlandic kl_GL
+ [20271] libc: Missing "\n" in __libc_fatal calls
+ [20480] dynamic-link: Patch: ifunc not executable, crashes sudo qemu
+ [20544] libc: RFE: atexit, __cxa_atexit, on_exit should assert function
+ pointer argument is non-NULL
+ [21037] stdio: open_memstream and freopen
+ [21286] libc: bits/siginfo.h is missing enum definition for TRAP_HWBKPT
+ [21716] time: Crash in glibc's mktime in low-memory situations
+ [22834] stdio: Subprocess forked by popen may crash in Linux when
+ multithreads call popen
+ [22927] network: crash in vn_gai_enqueue_request if requests_tail was NULL
+ and pthread_create fails.
+ [23032] hurd: sysdeps/htl/pt-barrier-init.c:39: bad call to memcmp ?
+ [23125] libc: riscv64: endless loop when throwing an exception from a
+ constructor
+ [23275] nptl: Race in pthread_mutex_lock while promoting to
+ PTHREAD_MUTEX_ELISION_NP.
+ [23400] libc: stdlib/test-bz22786.c creates temporary files in glibc
+ source tree
+ [23479] math: [mips] bits/fenv.h should not define some macros for soft-
+ float
+ [23490] libc: sysdeps/unix/sysv/linux/x86/tst-cet-property-2.c:49: off by
+ one error
+ [23497] libc: readdir64@GLIBC_2.1 cannot parse the kernel directory stream
+ [23509] dynamic-link: CET enabled glibc is incompatible with the older
+ linker
+ [23520] nscd: nscd: Use-after-free in addgetnetgrentX and its callers
+ [23521] nss: get_next_alias nss_files file stream leak
+ [23538] nptl: Hang in pthread_cond_broadcast
+ [23562] libc: Wrong type for si_band in Linux-specific siginfo_t
+ [23578] regex: Invalid memory access if regex pattern contains NUL byte
+ [23579] libc: Errors misreported in preadv2
+ [23597] build: support/test-container.c doesn't work with different
+ filesystems
+ [23603] time: mktime signed integer overflow on large timestamps
+ [23606] libc: Missing ENDBR32 in sysdeps/i386/start.S
+ [23614] libc: powerpc: missing CFI register information in __mpn_*
+ functions
+ [23637] string: Generic strstr/strcasestr fails with huge needles
+ [23640] libc: no way to easily clear FD_CLOEXEC in
+ posix_spawn_file_actions_adddup2()
+ [23649] libc: [microblaze/mips/nios2/riscv] sys/procfs.h pr_uid, pr_gid
+ have wrong type
+ [23656] libc: [mips n32] sys/procfs.h pr_sigpend, pr_sighold, pr_flag have
+ wrong type
+ [23679] libc: gethostid: Missing NULL check for gethostbyname_r result
+ [23689] libc: Bug in documentation for rusage.ru_ixrss in
+ bits/types/struct_rusage.h
+ [23690] dynamic-link: Segfault in _dl_profile_fixup with a high number of
+ threads
+ [23707] dynamic-link: Missing unwind info in sysdeps/powerpc/powerpc32/dl-
+ start.S
+ [23709] string: glibc 2.25 lacks sse2 optimized strstr()
+ [23716] dynamic-link: _dl_runtime_resolve_shstk isn't selected properly
+ [23717] libc: glibc: stdlib/tst-setcontext9 test suite failure on
+ powerpc64le
+ [23724] localedata: Albanian date formats are incorrect
+ [23735] math: libnldbl_nonshared.a references internal libm symbols
+ [23740] localedata: kl_GL: Month names and date formats need update
+ [23744] regex: regex refactorings to remove BE, avoid duplication
+ [23745] time: mktime fix for Gnulib + coreutils
+ [23758] time: Improve the width of alternate representation for year in
+ strftime
+ [23783] libc: [mips] Missing CMSPAR bits/termios.h
+ [23789] time: mktime does not set errno on failure
+ [23791] localedata: Wrong monetary format for ca_ES locale
+ [23793] locale: c32rtomb and mbrtoc32 should not alias wcrtomb and mbrtowc
+ [23794] locale: c16rtomb does not handle surrogate pairs
+ [23821] libc: si_band in siginfo_t has wrong type long int on sparc64
+ [23822] math: ia64 static libm.a is missing exp2f, log2f and powf symbols
+ [23836] time: time/tst-mktime2 test failure on Arm (32-bit)
+ [23848] libc: [sparc] Some socket syscalls wrongly assumed to be present
+ [23861] nptl: rdlock stalls indefinitely on an unlocked pthread rwlock
+ [23862] libc: [sh] missing kernel-features.h undefines
+ [23864] libc: [riscv] missing kernel-features.h undefines
+ [23867] libc: [arm/microblaze] __ASSUME_MLOCK2 incorrect
+ [23907] malloc: Incorrect double-free malloc tcache check disregards
+ tcache size
+ [23913] libc: off-by-one in function maybe_script_execute in
+ sysdeps/posix/spawni.c
+ [23915] libc: [arm] __ASSUME_COPY_FILE_RANGE incorrect
+ [23923] locale: Add --no-hard-links option to localedef
+ [23927] network: Linux if_nametoindex() does not close descriptor
+ (CVE-2018-19591)
+ [23961] math: powf can overflow to inf without setting errno in non-
+ nearest rounding mode
+ [23967] libc: [2.28 Regression]: New sigaction implementation breaks m68k
+ [23972] libc: __old_getdents64 uses wrong d_off value on overflow
+ [23993] libc: glibc 2.29 doesn't build with gcc 4.9
+ [23995] localedata: Remove execution flags from localedata/locales/bi_VU
+ [24011] localedata: Fixed small type in comment for locale bs_BA
+ [24018] libc: gettext() may return NULL
+ [24022] build: riscv build failure with Linux kernel 4.20-rc7
+ [24023] build: [2.29 Regression] FAIL: elf/check-localplt
+ [24024] string: strerror() might set errno to ENOMEM due to -fno-math-
+ error
+ [24027] malloc: glibc: realloc() ncopies 32-bit integer overflow
+ [24034] libc: tst-cancel21-static fails with SIGBUS on pre-ARMv7 when
+ using GCC 8
+ [24046] localedata: en_US locale doesn't define date_fmt
+ [24063] manual: @var{errno} should be @code{errno}
+ [24066] soft-fp: Inconsistent _FP_W_TYPE_SIZE check
+ [24088] libc: VSCR field is not being correctly read in ucontext_t on
+ ppc64le
+ [24096] time: Specifying '_' or '-' flag for "%EY" does not produce the
+ expected result
+ [24097] string: Can't use 64-bit register for size_t in assembly codes for
+ x32 (CVE-2019-6488)
+ [24110] hurd: SS_DISABLE never set in stack_t value returned by
+ sigaltstack
+ [24112] network: Do not send DNS queries for non-host names (where all
+ answers will be rejected)
+ [24130] libc: alpha __remqu corrupts $f3 register
+
+
+Version 2.28
+
+Major new features:
+
+* The localization data for ISO 14651 is updated to match the 2016
+ Edition 4 release of the standard, this matches data provided by
+ Unicode 9.0.0. This update introduces significant improvements to the
+ collation of Unicode characters. This release deviates slightly from
+ the standard in that the collation element ordering for lowercase and
+ uppercase LATIN script characters is adjusted to ensure that regular
+ expressions with ranges like [a-z] and [A-Z] don't interleave e.g. A
+ is not matched by [a-z]. With the update many locales have been
+ updated to take advantage of the new collation information. The new
+ collation information has increased the size of the compiled locale
+ archive or binary locales.
+
+* The GNU C Library can now be compiled with support for Intel CET, AKA
+ Intel Control-flow Enforcement Technology. When the library is built
+ with --enable-cet, the resulting glibc is protected with indirect
+ branch tracking (IBT) and shadow stack (SHSTK). CET-enabled glibc is
+ compatible with all existing executables and shared libraries. This
+ feature is currently supported on i386, x86_64 and x32 with GCC 8 and
+ binutils 2.29 or later. Note that CET-enabled glibc requires CPUs
+ capable of multi-byte NOPs, like x86-64 processors as well as Intel
+ Pentium Pro or newer. NOTE: --enable-cet has been tested for i686,
+ x86_64 and x32 on non-CET processors. --enable-cet has been tested
+ for x86_64 and x32 on CET SDVs, but Intel CET support hasn't been
+ validated for i686.
+
+* The GNU C Library now has correct support for ABSOLUTE symbols
+ (SHN_ABS-relative symbols). Previously such ABSOLUTE symbols were
+ relocated incorrectly or in some cases discarded. The GNU linker can
+ make use of the newer semantics, but it must communicate it to the
+ dynamic loader by setting the ELF file's identification (EI_ABIVERSION
+ field) to indicate such support is required.
+
+* Unicode 11.0.0 Support: Character encoding, character type info, and
+ transliteration tables are all updated to Unicode 11.0.0, using
+ generator scripts contributed by Mike FABIAN (Red Hat).
+
+* <math.h> functions that round their results to a narrower type are added
+ from TS 18661-1:2014 and TS 18661-3:2015:
+
+ - fadd, faddl, daddl and corresponding fMaddfN, fMaddfNx, fMxaddfN and
+ fMxaddfNx functions.
+
+ - fsub, fsubl, dsubl and corresponding fMsubfN, fMsubfNx, fMxsubfN and
+ fMxsubfNx functions.
+
+ - fmul, fmull, dmull and corresponding fMmulfN, fMmulfNx, fMxmulfN and
+ fMxmulfNx functions.
+
+ - fdiv, fdivl, ddivl and corresponding fMdivfN, fMdivfNx, fMxdivfN and
+ fMxdivfNx functions.
+
+* Two grammatical forms of month names are now supported for the following
+ languages: Armenian, Asturian, Catalan, Czech, Kashubian, Occitan, Ossetian,
+ Scottish Gaelic, Upper Sorbian, and Walloon. The following languages now
+ support two grammatical forms in abbreviated month names: Catalan, Greek,
+ and Kashubian.
+
+* Newly added locales: Lower Sorbian (dsb_DE) and Yakut (sah_RU) also
+ include the support for two grammatical forms of month names.
+
+* Building and running on GNU/Hurd systems now works without out-of-tree
+ patches.
+
+* The renameat2 function has been added, a variant of the renameat function
+ which has a flags argument. If the flags are zero, the renameat2 function
+ acts like renameat. If the flag is not zero and there is no kernel
+ support for renameat2, the function will fail with an errno value of
+ EINVAL. This is different from the existing gnulib function renameatu,
+ which performs a plain rename operation in case of a RENAME_NOREPLACE
+ flags and a non-existing destination (and therefore has a race condition
+ that can clobber the destination inadvertently).
+
+* The statx function has been added, a variant of the fstatat64
+ function with an additional flags argument. If there is no direct
+ kernel support for statx, glibc provides basic stat support based on
+ the fstatat64 function.
+
+* IDN domain names in getaddrinfo and getnameinfo now use the system libidn2
+ library if installed. libidn2 version 2.0.5 or later is recommended. If
+ libidn2 is not available, internationalized domain names are not encoded
+ or decoded even if the AI_IDN or NI_IDN flags are passed to getaddrinfo or
+ getnameinfo. (getaddrinfo calls with non-ASCII names and AI_IDN will fail
+ with an encoding error.) Flags which used to change the IDN encoding and
+ decoding behavior (AI_IDN_ALLOW_UNASSIGNED, AI_IDN_USE_STD3_ASCII_RULES,
+ NI_IDN_ALLOW_UNASSIGNED, NI_IDN_USE_STD3_ASCII_RULES) have been
+ deprecated. They no longer have any effect.
+
+* Parsing of dynamic string tokens in DT_RPATH, DT_RUNPATH, DT_NEEDED,
+ DT_AUXILIARY, and DT_FILTER has been expanded to support the full
+ range of ELF gABI expressions including such constructs as
+ '$ORIGIN$ORIGIN' (if valid). For SUID/GUID applications the rules
+ have been further restricted, and where in the past a dynamic string
+ token sequence may have been interpreted as a literal string it will
+ now cause a load failure. These load failures were always considered
+ unspecified behaviour from the perspective of the dynamic loader, and
+ for safety are now load errors e.g. /foo/${ORIGIN}.so in DT_NEEDED
+ results in a load failure now.
+
+* Support for ISO C threads (ISO/IEC 9899:2011) has been added. The
+ implementation includes all the standard functions provided by
+ <threads.h>:
+
+ - thrd_current, thrd_equal, thrd_sleep, thrd_yield, thrd_create,
+ thrd_detach, thrd_exit, and thrd_join for thread management.
+
+ - mtx_init, mtx_lock, mtx_timedlock, mtx_trylock, mtx_unlock, and
+ mtx_destroy for mutual exclusion.
+
+ - call_once for function call synchronization.
+
+ - cnd_broadcast, cnd_destroy, cnd_init, cnd_signal, cnd_timedwait, and
+ cnd_wait for conditional variables.
+
+ - tss_create, tss_delete, tss_get, and tss_set for thread-local storage.
+
+ Application developers must link against libpthread to use ISO C threads.
+
+Deprecated and removed features, and other changes affecting compatibility:
+
+* The nonstandard header files <libio.h> and <_G_config.h> are no longer
+ installed. Software that was using either header should be updated to
+ use standard <stdio.h> interfaces instead.
+
+* The stdio functions 'getc' and 'putc' are no longer defined as macros.
+ This was never required by the C standard, and the macros just expanded
+ to call alternative names for the same functions. If you hoped getc and
+ putc would provide performance improvements over fgetc and fputc, instead
+ investigate using (f)getc_unlocked and (f)putc_unlocked, and, if
+ necessary, flockfile and funlockfile.
+
+* All stdio functions now treat end-of-file as a sticky condition. If you
+ read from a file until EOF, and then the file is enlarged by another
+ process, you must call clearerr or another function with the same effect
+ (e.g. fseek, rewind) before you can read the additional data. This
+ corrects a longstanding C99 conformance bug. It is most likely to affect
+ programs that use stdio to read interactive input from a terminal.
+ (Bug #1190.)
+
+* The macros 'major', 'minor', and 'makedev' are now only available from
+ the header <sys/sysmacros.h>; not from <sys/types.h> or various other
+ headers that happen to include <sys/types.h>. These macros are rarely
+ used, not part of POSIX nor XSI, and their names frequently collide with
+ user code; see https://sourceware.org/bugzilla/show_bug.cgi?id=19239 for
+ further explanation.
+
+ <sys/sysmacros.h> is a GNU extension. Portable programs that require
+ these macros should first include <sys/types.h>, and then include
+ <sys/sysmacros.h> if __GNU_LIBRARY__ is defined.
+
+* The tilegx*-*-linux-gnu configurations are no longer supported.
+
+* The obsolete function ustat is no longer available to newly linked
+ binaries; the headers <ustat.h> and <sys/ustat.h> have been removed. This
+ function has been deprecated in favor of fstatfs and statfs.
+
+* The obsolete function nfsservctl is no longer available to newly linked
+ binaries. This function was specific to systems using the Linux kernel
+ and could not usefully be used with the GNU C Library on systems with
+ version 3.1 or later of the Linux kernel.
+
+* The obsolete function name llseek is no longer available to newly linked
+ binaries. This function was specific to systems using the Linux kernel
+ and was not declared in a header. Programs should use the lseek64 name
+ for this function instead.
+
+* The AI_IDN_ALLOW_UNASSIGNED and NI_IDN_ALLOW_UNASSIGNED flags for the
+ getaddrinfo and getnameinfo functions have been deprecated. The behavior
+ previously selected by them is now always enabled.
+
+* The AI_IDN_USE_STD3_ASCII_RULES and NI_IDN_USE_STD3_ASCII_RULES flags for
+ the getaddrinfo and getnameinfo functions have been deprecated. The STD3
+ restriction (rejecting '_' in host names, among other things) has been
+ removed, for increased compatibility with non-IDN name resolution.
+
+* The fcntl function now have a Long File Support variant named fcntl64. It
+ is added to fix some Linux Open File Description (OFD) locks usage on non
+ LFS mode. As for others *64 functions, fcntl64 semantics are analogous with
+ fcntl and LFS support is handled transparently. Also for Linux, the OFD
+ locks act as a cancellation entrypoint.
+
+* The obsolete functions encrypt, encrypt_r, setkey, setkey_r, cbc_crypt,
+ ecb_crypt, and des_setparity are no longer available to newly linked
+ binaries, and the headers <rpc/des_crypt.h> and <rpc/rpc_des.h> are no
+ longer installed. These functions encrypted and decrypted data with the
+ DES block cipher, which is no longer considered secure. Software that
+ still uses these functions should switch to a modern cryptography library,
+ such as libgcrypt.
+
+* Reflecting the removal of the encrypt and setkey functions above, the
+ macro _XOPEN_CRYPT is no longer defined. As a consequence, the crypt
+ function is no longer declared unless _DEFAULT_SOURCE or _GNU_SOURCE is
+ enabled.
+
+* The obsolete function fcrypt is no longer available to newly linked
+ binaries. It was just another name for the standard function crypt,
+ and it has not appeared in any header file in many years.
+
+* We have tentative plans to hand off maintenance of the passphrase-hashing
+ library, libcrypt, to a separate development project that will, we hope,
+ keep up better with new passphrase-hashing algorithms. We will continue
+ to declare 'crypt' in <unistd.h>, and programs that use 'crypt' or
+ 'crypt_r' should not need to change at all; however, distributions will
+ need to install <crypt.h> and libcrypt from a separate project.
+
+ In this release, if the configure option --disable-crypt is used, glibc
+ will not install <crypt.h> or libcrypt, making room for the separate
+ project's versions of these files. The plan is to make this the default
+ behavior in a future release.
+
+Changes to build and runtime requirements:
+
+ GNU make 4.0 or later is now required to build glibc.
+
+Security related changes:
+
+ CVE-2016-6261, CVE-2016-6263, CVE-2017-14062: Various vulnerabilities have
+ been fixed by removing the glibc-internal IDNA implementation and using
+ the system-provided libidn2 library instead. Originally reported by Hanno
+ Böck and Christian Weisgerber.
+
+ CVE-2017-18269: An SSE2-based memmove implementation for the i386
+ architecture could corrupt memory. Reported by Max Horn.
+
+ CVE-2018-11236: Very long pathname arguments to realpath function could
+ result in an integer overflow and buffer overflow. Reported by Alexey
+ Izbyshev.
+
+ CVE-2018-11237: The mempcpy implementation for the Intel Xeon Phi
+ architecture could write beyond the target buffer, resulting in a buffer
+ overflow. Reported by Andreas Schwab.
+
+The following bugs are resolved with this release:
+
+ [1190] stdio: fgetc()/fread() behaviour is not POSIX compliant
+ [6889] manual: 'PWD' mentioned but not specified
+ [13575] libc: SSIZE_MAX defined as LONG_MAX is inconsistent with ssize_t,
+ when __WORDSIZE != 64
+ [13762] regex: re_search etc. should return -2 on memory exhaustion
+ [13888] build: /tmp usage during testing
+ [13932] math: dbl-64 pow unexpectedly slow for some inputs
+ [14092] nptl: Support C11 threads
+ [14095] localedata: Review / update collation data from Unicode / ISO
+ 14651
+ [14508] libc: -Wformat warnings
+ [14553] libc: Namespace pollution loff_t in sys/types.h
+ [14890] libc: Make NT_PRFPREG canonical.
+ [15105] libc: Extra PLT references with -Os
+ [15512] libc: __bswap_constant_16 not compiled when -Werror -Wsign-
+ conversion is given
+ [16335] manual: Feature test macro documentation incomplete and out of
+ date
+ [16552] libc: Unify umount implementations in terms of umount2
+ [17082] libc: htons et al.: statement-expressions prevent use on global
+ scope with -O1 and higher
+ [17343] libc: Signed integer overflow in /stdlib/random_r.c
+ [17438] localedata: pt_BR: wrong d_fmt delimiter
+ [17662] libc: please implement binding for the new renameat2 syscall
+ [17721] libc: __restrict defined as /* Ignore */ even in c11
+ [17979] libc: inconsistency between uchar.h and stdint.h
+ [18018] dynamic-link: Additional $ORIGIN handling issues (CVE-2011-0536)
+ [18023] libc: extend_alloca is broken (questionable pointer comparison,
+ horrible machine code)
+ [18124] libc: hppa: setcontext erroneously returns -1 as exit code for
+ last constant.
+ [18471] libc: llseek should be a compat symbol
+ [18473] soft-fp: [powerpc-nofpu] __sqrtsf2, __sqrtdf2 should be compat
+ symbols
+ [18991] nss: nss_files skips large entry in database
+ [19239] libc: Including stdlib.h ends up with macros major and minor being
+ defined
+ [19463] libc: linknamespace failures when compiled with -Os
+ [19485] localedata: csb_PL: Update month translations + add yesstr/nostr
+ [19527] locale: Normalized charset name not recognized by setlocale
+ [19667] string: Missing Sanity Check for malloc calls in file 'testcopy.c'
+ [19668] libc: Missing Sanity Check for malloc() in file 'tst-setcontext-
+ fpscr.c'
+ [19728] network: out of bounds stack read in libidn function
+ idna_to_ascii_4i (CVE-2016-6261)
+ [19729] network: out of bounds heap read on invalid utf-8 inputs in
+ stringprep_utf8_nfkc_normalize (CVE-2016-6263)
+ [19818] dynamic-link: Absolute (SHN_ABS) symbols incorrectly relocated by
+ the base address
+ [20079] libc: Add SHT_X86_64_UNWIND to elf.h
+ [20251] libc: 32bit programs pass garbage in struct flock for OFD locks
+ [20419] dynamic-link: files with large allocated notes crash in
+ open_verify
+ [20530] libc: bswap_16 should use __builtin_bswap16() when available
+ [20890] dynamic-link: ldconfig: fsync the files before atomic rename
+ [20980] manual: CFLAGS environment variable replaces vital options
+ [21163] regex: Assertion failure in pop_fail_stack when executing a
+ malformed regexp (CVE-2015-8985)
+ [21234] manual: use of CFLAGS makes glibc detect no optimization
+ [21269] dynamic-link: i386 sigaction sa_restorer handling is wrong
+ [21313] build: Compile Error GCC 5.4.0 MIPS with -0S
+ [21314] build: Compile Error GCC 5.2.0 MIPS with -0s
+ [21508] locale: intl/tst-gettext failure with latest msgfmt
+ [21547] localedata: Tibetan script collation broken (Dzongkha and Tibetan)
+ [21812] network: getifaddrs() returns entries with ifa_name == NULL
+ [21895] libc: ppc64 setjmp/longjmp not fully interoperable with static
+ dlopen
+ [21942] dynamic-link: _dl_dst_substitute incorrectly handles $ORIGIN: with
+ AT_SECURE=1
+ [22241] localedata: New locale: Yakut (Sakha) locale for Russia (sah_RU)
+ [22247] network: Integer overflow in the decode_digit function in
+ puny_decode.c in libidn (CVE-2017-14062)
+ [22342] nscd: NSCD not properly caching netgroup
+ [22391] nptl: Signal function clear NPTL internal symbols inconsistently
+ [22550] localedata: es_ES locale (and other es_* locales): collation
+ should treat ñ as a primary different character, sync the collation
+ for Spanish with CLDR
+ [22638] dynamic-link: sparc: static binaries are broken if glibc is built
+ by gcc configured with --enable-default-pie
+ [22639] time: year 2039 bug for localtime etc. on 64-bit platforms
+ [22644] string: memmove-sse2-unaligned on 32bit x86 produces garbage when
+ crossing 2GB threshold (CVE-2017-18269)
+ [22646] localedata: redundant data (LC_TIME) for es_CL, es_CU, es_EC and
+ es_BO
+ [22735] time: Misleading typo in time.h source comment regarding
+ CLOCKS_PER_SECOND
+ [22753] libc: preadv2/pwritev2 fallback code should handle offset=-1
+ [22761] libc: No trailing `%n' conversion specifier in FMT passed from
+ `__assert_perror_fail ()' to `__assert_fail_base ()'
+ [22766] libc: all glibc internal dlopen should use RTLD_NOW for robust
+ dlopen failures
+ [22786] libc: Stack buffer overflow in realpath() if input size is close
+ to SSIZE_MAX (CVE-2018-11236)
+ [22787] dynamic-link: _dl_check_caller returns false when libc is linked
+ through an absolute DT_NEEDED path
+ [22792] build: tcb-offsets.h dependency dropped
+ [22797] libc: pkey_get() uses non-reserved name of argument
+ [22807] libc: PTRACE_* constants missing for powerpc
+ [22818] glob: posix/tst-glob_lstat_compat failure on alpha
+ [22827] dynamic-link: RISC-V ELF64 parser mis-reads flag in ldconfig
+ [22830] malloc: malloc_stats doesn't restore cancellation state on stderr
+ [22848] localedata: ca_ES: update date definitions from CLDR
+ [22862] build: _DEFAULT_SOURCE is defined even when _ISOC11_SOURCE is
+ [22884] math: RISCV fmax/fmin handle signalling NANs incorrectly
+ [22896] localedata: Update locale data for an_ES
+ [22902] math: float128 test failures with GCC 8
+ [22918] libc: multiple common of `__nss_shadow_database'
+ [22919] libc: sparc32: backtrace yields infinite backtrace with
+ makecontext
+ [22926] libc: FTBFS on powerpcspe
+ [22932] localedata: lt_LT: Update of abbreviated month names from CLDR
+ required
+ [22937] localedata: Greek (el_GR, el_CY) locales actually need ab_alt_mon
+ [22947] libc: FAIL: misc/tst-preadvwritev2
+ [22963] localedata: cs_CZ: Add alternative month names
+ [22987] math: [powerpc/sparc] fdim inlines errno, exceptions handling
+ [22996] localedata: change LC_PAPER to en_US in es_BO locale
+ [22998] dynamic-link: execstack tests are disabled when SELinux is
+ disabled
+ [23005] network: Crash in __res_context_send after memory allocation
+ failure
+ [23007] math: strtod cannot handle -nan
+ [23024] nss: getlogin_r is performing NSS lookups when loginid isn't set
+ [23036] regex: regex equivalence class regression
+ [23037] libc: initialize msg_flags to zero for sendmmsg() calls
+ [23069] libc: sigaction broken on riscv64-linux-gnu
+ [23094] localedata: hr_HR: wrong thousands_sep and mon_thousands_sep
+ [23102] dynamic-link: Incorrect parsing of multiple consecutive $variable
+ patterns in runpath entries (e.g. $ORIGIN$ORIGIN)
+ [23137] nptl: s390: pthread_join sometimes block indefinitely (on 31bit
+ and libc build with -Os)
+ [23140] localedata: More languages need two forms of month names
+ [23145] libc: _init/_fini aren't marked as hidden
+ [23152] localedata: gd_GB: Fix typo in "May" (abbreviated)
+ [23171] math: C++ iseqsig for long double converts arguments to double
+ [23178] nscd: sudo will fail when it is run in concurrent with commands
+ that changes /etc/passwd
+ [23196] string: __mempcpy_avx512_no_vzeroupper mishandles large copies
+ (CVE-2018-11237)
+ [23206] dynamic-link: static-pie + dlopen breaks debugger interaction
+ [23208] localedata: New locale - Lower Sorbian (dsb)
+ [23233] regex: Memory leak in build_charclass_op function in file
+ posix/regcomp.c
+ [23236] stdio: Harden function pointers in _IO_str_fields
+ [23250] nptl: Offset of __private_ss differs from GCC
+ [23253] math: tgamma test suite failures on i686 with -march=x86-64
+ -mtune=generic -mfpmath=sse
+ [23259] dynamic-link: Unsubstituted ${ORIGIN} remains in DT_NEEDED for
+ AT_SECURE
+ [23264] libc: posix_spawnp wrongly executes ENOEXEC in non compat mode
+ [23266] nis: stringop-truncation warning with new gcc8.1 in nisplus-
+ parser.c
+ [23272] math: fma(INFINITY,INFIITY,0.0) should be INFINITY
+ [23277] math: nan function should not have const attribute
+ [23279] math: scanf and strtod wrong for some hex floating-point
+ [23280] math: wscanf rounds wrong; wcstod is ok for negative numbers and
+ directed rounding
+ [23290] localedata: IBM273 is not equivalent to ISO-8859-1
+ [23303] build: undefined reference to symbol
+ '__parse_hwcap_and_convert_at_platform@@GLIBC_2.23'
+ [23307] dynamic-link: Absolute symbols whose value is zero ignored in
+ lookup
+ [23313] stdio: libio vtables validation and standard file object
+ interposition
+ [23329] libc: The __libc_freeres infrastructure is not properly run across
+ DSO boundaries.
+ [23349] libc: Various glibc headers no longer compatible with
+ <linux/time.h>
+ [23351] malloc: Remove unused code related to heap dumps and malloc
+ checking
+ [23363] stdio: stdio-common/tst-printf.c has non-free license
+ [23396] regex: Regex equivalence regression in single-byte locales
+ [23422] localedata: oc_FR: More updates of locale data
+ [23442] build: New warning with GCC 8
+ [23448] libc: Out of bounds access in IBM-1390 converter
+ [23456] libc: Wrong index_cpu_LZCNT
+ [23458] build: tst-get-cpu-features-static isn't added to tests
+ [23459] libc: COMMON_CPUID_INDEX_80000001 isn't populated for Intel
+ processors
+ [23467] dynamic-link: x86/CET: A property note parser bug
+
+
+Version 2.27
+
+Major new features:
+
+* The GNU C Library can now be compiled with support for building static
+ PIE executables (See --enable-static-pie in INSTALL). These static PIE
+ executables are like static executables but can be loaded at any address
+ and provide additional security hardening benefits at the cost of some
+ memory and performance. When the library is built with --enable-static-pie
+ the resulting libc.a is usable with GCC 8 and above to create static PIE
+ executables using the GCC option '-static-pie'. This feature is currently
+ supported on i386, x86_64 and x32 with binutils 2.29 or later, and on
+ aarch64 with binutils 2.30 or later.
+
+* Optimized x86-64 asin, atan2, exp, expf, log, pow, atan, sin, cosf,
+ sinf, sincosf and tan with FMA, contributed by Arjan van de Ven and
+ H.J. Lu from Intel.
+
+* Optimized x86-64 trunc and truncf for processors with SSE4.1.
+
+* Optimized generic expf, exp2f, logf, log2f, powf, sinf, cosf and sincosf.
+
+* In order to support faster and safer process termination the malloc API
+ family of functions will no longer print a failure address and stack
+ backtrace after detecting heap corruption. The goal is to minimize the
+ amount of work done after corruption is detected and to avoid potential
+ security issues in continued process execution. Reducing shutdown time
+ leads to lower overall process restart latency, so there is benefit both
+ from a security and performance perspective.
+
+* The abort function terminates the process immediately, without flushing
+ stdio streams. Previous glibc versions used to flush streams, resulting
+ in deadlocks and further data corruption. This change also affects
+ process aborts as the result of assertion failures.
+
+* On platforms where long double has the IEEE binary128 format (aarch64,
+ alpha, mips64, riscv, s390 and sparc), the math library now implements
+ _Float128 interfaces for that type, as defined by ISO/IEC TS 18661-3:2015.
+ These are the same interfaces added in version 2.26 for some platforms where
+ this format is supported but is not the format of long double.
+
+* On platforms with support for _Float64x (aarch64, alpha, i386, ia64,
+ mips64, powerpc64le, riscv, s390, sparc and x86_64), the math library now
+ implements interfaces for that type, as defined by ISO/IEC TS
+ 18661-3:2015. These are corresponding interfaces to those supported for
+ _Float128.
+
+* The math library now implements interfaces for the _Float32, _Float64 and
+ _Float32x types, as defined by ISO/IEC TS 18661-3:2015. These are
+ corresponding interfaces to those supported for _Float128.
+
+* glibc now implements the memfd_create and mlock2 functions on Linux.
+
+* Support for memory protection keys was added. The <sys/mman.h> header now
+ declares the functions pkey_alloc, pkey_free, pkey_mprotect, pkey_set,
+ pkey_get.
+
+* The copy_file_range function was added.
+
+* Optimized memcpy, mempcpy, memmove, and memset for sparc M7.
+
+* The ldconfig utility now processes `include' directives using the C/POSIX
+ collation ordering. Previous glibc versions used locale-specific
+ ordering, the change might break systems that relied on that.
+
+* Support for two grammatical forms of month names has been added.
+ In a call to strftime, the "%B" and "%b" format specifiers will now
+ produce the grammatical form required when the month is used as part
+ of a complete date. New "%OB" and "%Ob" specifiers produce the form
+ required when the month is named by itself. For instance, in Greek
+ and in many Slavic and Baltic languages, "%B" will produce the month
+ in genitive case, and "%OB" will produce the month in nominative case.
+
+ In a call to strptime, "%B", "%b", "%h", "%OB", "%Ob", and "%Oh"
+ are all valid and will all accept any known form of month
+ name---standalone or complete, abbreviated or full. In a call to
+ nl_langinfo, the query constants MON_1..12 and ABMON_1..12 return
+ the strings used by "%B" and "%b", respectively. New query
+ constants ALTMON_1..12 and _NL_ABALTMON_1..12 return the strings
+ used by "%OB" and "%Ob", respectively.
+
+ In a locale definition file, use "alt_mon" and "ab_alt_mon" to
+ define the strings for %OB and %Ob, respectively; these have the
+ same syntax as "mon" and "abmon". These arrays are optional; if they
+ are not provided then they have the same content as "mon" and "abmon",
+ respectively.
+
+ These features are provided for locales which define "alt_mon" and/or
+ "ab_alt_mon" in their locale source data. This release includes such
+ alternative month name data for the following languages: Belarusian,
+ Croatian, Greek, Lithuanian, Polish, Russian, and Ukrainian.
+
+ This feature is currently a GNU extension, but it is expected to
+ be added to the next revision of POSIX, and it is also already
+ available on some BSD-derived operating systems.
+
+ This feature will cause existing statically compiled applications
+ to fail to load locales and fall back to the builtin C/POSIX locales.
+ See notes below for other changes affecting compatibility.
+
+* Support for the RISC-V ISA running on Linux has been added. This port
+ requires at least binutils-2.30, gcc-7.3.0, and linux-4.15; and is supported
+ for the following ISA and ABI pairs:
+
+ - rv64imac lp64
+ - rv64imafdc lp64
+ - rv64imafdc lp64d
+
+Deprecated and removed features, and other changes affecting compatibility:
+
+* Statically compiled applications attempting to load locales compiled for the
+ GNU C Library version 2.27 will fail and fall back to the builtin C/POSIX
+ locale. The reason for this is that the addition of the new "%OB" and "%Ob",
+ support for two grammatical forms of the month names, also extends the locale
+ data binary format. Static applications needing locale support must be
+ recompiled to match the runtime and data they are deployed with. In some
+ distributions there is an upgrade window where dynamically linked applications
+ may use a new library but the old locale data and also fall back to the
+ builtin C/POSIX locales; restarting the application process is sufficient to
+ fix this.
+
+* Support for statically linked applications which call dlopen is deprecated
+ and will be removed in a future version of glibc. Applications which call
+ dlopen need to be linked dynamically instead.
+
+* Support for old programs which use internal stdio data structures and
+ functions is deprecated. This includes programs which use the C++ streams
+ provided by libstdc++ in GCC 2.95. Programs which use the internal
+ symbols _IO_adjust_wcolumn, _IO_default_doallocate, _IO_default_finish,
+ _IO_default_pbackfail, _IO_default_uflow, _IO_default_xsgetn,
+ _IO_default_xsputn, _IO_doallocbuf, _IO_do_write, _IO_file_attach,
+ _IO_file_close, _IO_file_close_it, _IO_file_doallocate, _IO_file_fopen,
+ _IO_file_init, _IO_file_jumps, _IO_fileno, _IO_file_open,
+ _IO_file_overflow, _IO_file_read, _IO_file_seek, _IO_file_seekoff,
+ _IO_file_setbuf, _IO_file_stat, _IO_file_sync, _IO_file_underflow,
+ _IO_file_write, _IO_file_xsputn, _IO_flockfile, _IO_flush_all,
+ _IO_flush_all_linebuffered, _IO_free_backup_area, _IO_free_wbackup_area,
+ _IO_init, _IO_init_marker, _IO_init_wmarker, _IO_iter_begin, _IO_iter_end,
+ _IO_iter_file, _IO_iter_next, _IO_least_wmarker, _IO_link_in,
+ _IO_list_all, _IO_list_lock, _IO_list_resetlock, _IO_list_unlock,
+ _IO_marker_delta, _IO_marker_difference, _IO_remove_marker, _IO_seekmark,
+ _IO_seekwmark, _IO_str_init_readonly, _IO_str_init_static,
+ _IO_str_overflow, _IO_str_pbackfail, _IO_str_seekoff, _IO_str_underflow,
+ _IO_switch_to_main_wget_area, _IO_switch_to_wget_mode,
+ _IO_unsave_wmarkers, _IO_wdefault_doallocate, _IO_wdefault_finish,
+ _IO_wdefault_pbackfail, _IO_wdefault_setbuf, _IO_wdefault_uflow,
+ _IO_wdefault_xsgetn, _IO_wdefault_xsputn, _IO_wdoallocbuf, _IO_wdo_write,
+ _IO_wfile_jumps, _IO_wfile_overflow, _IO_wfile_sync, _IO_wfile_underflow,
+ _IO_wfile_xsputn, _IO_wmarker_delta, or _IO_wsetb may stop working with a
+ future version of glibc. Unlike other symbol removals, these old
+ applications will not be supported using compatibility symbols.
+
+* On GNU/Linux, the obsolete Linux constant PTRACE_SEIZE_DEVEL is no longer
+ defined by <sys/ptrace.h>.
+
+* libm no longer supports SVID error handling (calling a user-provided
+ matherr function on error) or the _LIB_VERSION variable to control error
+ handling. (SVID error handling and the _LIB_VERSION variable still work
+ for binaries linked against older versions of the GNU C Library.) The
+ libieee.a library is no longer provided. math.h no longer defines struct
+ exception, or the macros X_TLOSS, DOMAIN, SING, OVERFLOW, UNDERFLOW,
+ TLOSS, PLOSS and HUGE.
+
+* The libm functions pow10, pow10f and pow10l are no longer supported for
+ new programs. Programs should use the standard names exp10, exp10f and
+ exp10l for these functions instead.
+
+* The mcontext_t type is no longer the same as struct sigcontext. On
+ platforms where it was previously the same, this changes the C++ name
+ mangling for interfaces involving this type.
+
+* The add-ons mechanism for building additional packages at the same time as
+ glibc has been removed. The --enable-add-ons configure option is now
+ ignored.
+
+* The --without-fp configure option is now ignored. Whether hardware
+ floating-point instructions are used is now configured based on whether
+ the compiler used at configure time (without any options implied by a
+ --with-cpu= configure option) uses such instructions.
+
+* The res_hnok, res_dnok, res_mailok and res_ownok functions now check that
+ the specified string can be parsed as a domain name.
+
+* In the malloc_info output, the <heap> element may contain another <aspace>
+ element, "subheaps", which contains the number of sub-heaps.
+
+* The libresolv function p_secstodate is no longer supported for new
+ programs.
+
+* The tilepro-*-linux-gnu configuration is no longer supported.
+
+* The nonstandard header files <libio.h> and <_G_config.h> are deprecated
+ and will be removed in a future release. Software that is still using
+ either header should be updated to use standard <stdio.h> interfaces
+ instead.
+
+ libio.h was originally the header for a set of supported GNU extensions,
+ but they have not been maintained as such in many years, they are now
+ standing in the way of improvements to stdio, and we don't think there are
+ any remaining external users. _G_config.h was never intended for public
+ use, but predates the bits convention.
+
+Changes to build and runtime requirements:
+
+* bison version 2.7 or later is required to generate code in the 'intl'
+ subdirectory.
+
+Security related changes:
+
+ CVE-2009-5064: The ldd script would sometimes run the program under
+ examination directly, without preventing code execution through the
+ dynamic linker. (The glibc project disputes that this is a security
+ vulnerability; only trusted binaries must be examined using the ldd
+ script.)
+
+ CVE-2017-15670: The glob function, when invoked with GLOB_TILDE,
+ suffered from a one-byte overflow during ~ operator processing (either
+ on the stack or the heap, depending on the length of the user name).
+ Reported by Tim Rühsen.
+
+ CVE-2017-15671: The glob function, when invoked with GLOB_TILDE,
+ would sometimes fail to free memory allocated during ~ operator
+ processing, leading to a memory leak and, potentially, to a denial
+ of service.
+
+ CVE-2017-15804: The glob function, when invoked with GLOB_TILDE and
+ without GLOB_NOESCAPE, could write past the end of a buffer while
+ unescaping user names. Reported by Tim Rühsen.
+
+ CVE-2017-17426: The malloc function, when called with an object size near
+ the value SIZE_MAX, would return a pointer to a buffer which is too small,
+ instead of NULL. This was a regression introduced with the new malloc
+ thread cache in glibc 2.26. Reported by Iain Buclaw.
+
+ CVE-2017-1000408: Incorrect array size computation in _dl_init_paths leads
+ to the allocation of too much memory. (This is not a security bug per se,
+ it is mentioned here only because of the CVE assignment.) Reported by
+ Qualys.
+
+ CVE-2017-1000409: Buffer overflow in _dl_init_paths due to miscomputation
+ of the number of search path components. (This is not a security
+ vulnerability per se because no trust boundary is crossed if the fix for
+ CVE-2017-1000366 has been applied, but it is mentioned here only because
+ of the CVE assignment.) Reported by Qualys.
+
+ CVE-2017-16997: Incorrect handling of RPATH or RUNPATH containing $ORIGIN
+ for AT_SECURE or SUID binaries could be used to load libraries from the
+ current directory.
+
+ CVE-2018-1000001: Buffer underflow in realpath function when getcwd function
+ succeeds without returning an absolute path due to unexpected behaviour
+ of the Linux kernel getcwd syscall. Reported by halfdog.
+
+ CVE-2018-6485: The posix_memalign and memalign functions, when called with
+ an object size near the value of SIZE_MAX, would return a pointer to a
+ buffer which is too small, instead of NULL. Reported by Jakub Wilk.
+
+ CVE-2018-6551: The malloc function, when called with an object size near
+ the value of SIZE_MAX, would return a pointer to a buffer which is too
+ small, instead of NULL.
+
+The following bugs are resolved with this release:
+
+ [866] glob: glob should match dangling symlinks
+ [1062] glob: sysdeps/generic/glob.c merge from gnulib (part 3 of 3)
+ [2522] localedata: ca_ES@valencia: new Valencian (meridional Catalan)
+ locale
+ [5997] math: Very slow execution of sinf function
+ [10580] localedata: hr_HR: updated locale
+ [10871] locale: 'mon' array should contain both nominative and genitive
+ cases
+ [12349] localedata: eu_ES: incorrect thousands separator
+ [13605] localedata: shn_MM: new Shan locale
+ [13805] localedata: ru_RU: currency should use ',' as radix point
+ [13953] localedata: km_KH: locale update
+ [13994] localedata: mjw_IN: new locale
+ [14121] build: make writes .mo files in po directory
+ [14333] libc: Fix the race between atexit() and exit()
+ [14681] dynamic-link: _dl_get_origin leaks memory via executable link map.
+ [14925] localedata: bn_*: LC_IDENTIFICATION.language key should be
+ "Bangla"
+ [15260] localedata: LC_MESSAGES.{yes,no}{str,expr}: various errors
+ [15261] localedata: LC_MESSAGES.yesexpr/noexpr: inconsistent use of full-
+ width Latin characters
+ [15332] localedata: es_CU: locale update
+ [15436] stdio: Don't close or flush stdio streams on abort
+ [15537] localedata: lv_LV: invalid collation for Latvian diacritical
+ letters
+ [16148] localedata: ca_ES: incorrect thousands separator
+ [16750] dynamic-link: ldd should not try to execute the binaries
+ (CVE-2009-5064)
+ [16777] localedata: pl_PL: incorrect thousands separator in locale
+ [16905] localedata: hanzi: new collation
+ [17563] localedata: cmn_TW: add hanzi collation
+ [17750] localedata: wrong collation order of diacritics in most locales
+ [17804] libc: scandirat fails with ENOMEM because it checks for errno even
+ if malloc succeeded
+ [17956] build: Build fails on missing definitions from header file
+ nss/nss.h when Mozilla NSS is used for cryptography
+ [18203] libc: realpath() does not handle unreachable paths correctly
+ [18572] dynamic-link: [arm] Lazy TLSDESC relocation has data race
+ [18812] localedata: kab_DZ: new Kabyle Algeria locale
+ [18822] libc: Internal functions are called via PLT
+ [18858] string: _HAVE_STRING_ARCH_xxx aren't defined for i386 nor x86_64
+ [19170] libc: __gmon_start__ defined in hppa in crtn.S
+ [19574] libc: glibc should support building static PIE binaries
+ [19852] localedata: charmaps/UTF-8: incorrect wcwidth for U+3099 and
+ U+309A
+ [19971] glob: glob: Do not skip entries with zero d_ino values
+ [19982] localedata: fr.po: spelling mistake for error code EXDEV
+ [20008] localedata: km_KH: convert to translit_neutral
+ [20009] localedata: tr_TR: convert LC_CTYPE to i18n
+ [20142] math: [x86_64] Add SSE4.1 trunc, truncf
+ [20204] dynamic-link: _dl_open_hook and _dlfcn_hook hardening
+ [20482] localedata: de_CH: abbreviated weekdays should be two letters
+ [20498] localedata: miq_NI: new Mískitu / Miskito (miq) language locale
+ for Nicaragua
+ [20532] nss: getaddrinfo uses errno and h_errno without guaranteeing
+ they're set, wrong errors returned by gaih_inet when lookup functions
+ are not found.
+ [20756] localedata: [PATCH] Use Unicode wise thousands separator
+ [20826] network: posix/tst-getaddrinfo5 fails on hosts without network
+ access
+ [20952] localedata: yuw_PG: new locale
+ [21084] localedata: charmaps/IBM858: new codepage
+ [21161] manual: [PATCH] fix typo in manual/arith.texi on strtoul prototype
+ [21242] libc: assert gives pedantic warning in old gcc versions
+ [21265] dynamic-link: _dl_runtime_resolve isn't compatible with Intel C++
+ __regcall calling convention
+ [21309] math: signed integer overflow in sysdeps/ieee754/dbl-64/e_pow.c
+ [21326] libc: C99 functions are not declared for C++11 and later if
+ _GNU_SOURCE is not predefined by g++
+ [21457] libc: sys/ucontext.h namespace
+ [21530] libc: tmpfile() should be implemented using O_TMPFILE
+ [21660] math: GCC fails to compile a formula with tgmath.h
+ [21672] nptl: sys-libs/glibc on ia64 crashes on thread exit: signal
+ SIGSEGV, Segmentation fault: pthread_create.c:432: __madvise
+ (pd->stackblock, freesize - PTHREAD_STACK_MIN, MADV_DONTNEED);
+ [21684] math: tgmath.h handling of complex integers
+ [21685] math: tgmath.h handling of bit-fields
+ [21686] math: tgmath.h handling of __int128
+ [21706] localedata: yesstr and nostr are missing for Breton [LC_MESSAGES]
+ locale
+ [21745] libc: [powerpc64le] Extra PLT reference with --enable-stack-
+ protector=all
+ [21750] localedata: column width of characters incompatible with classical
+ wcwidth
+ [21754] malloc: malloc: Perform as little work as possible after heap
+ consistency check failures
+ [21780] libc: hppa: p{read,write}v2 does not set ENOSUP on invalid flag
+ [21790] libc: Missing __memset_zero_constant_len_parameter in libc.so
+ [21791] string: Unused XXX_chk_XXX functions in libc.a
+ [21815] dynamic-link: FAIL: elf/tst-prelink-cmp with GCC is defaulted to
+ PIE
+ [21836] localedata: Removed redundant data (LC_MONETARY) in various Indian
+ locales
+ [21845] localedata: Added new Locale bho_NP
+ [21853] localedata: Fix abday Which looks same as day in zh_SG
+ [21854] localedata: Added New Locale en_SC
+ [21864] libc: xmalloc.o is compiled with -DMODULE_NAME=libc
+ [21871] dynamic-link: _dl_runtime_resolve_avx_opt is slower than
+ _dl_runtime_resolve_avx_slow
+ [21885] network: getaddrinfo: gethosts does not release resolver context
+ on memory allocation failure
+ [21899] libc: XPG4.2 sigaction namespace
+ [21908] dynamic-link: dynamic linker broke on ia64 (mmap2 consolidation is
+ the suspect)
+ [21913] libc: static binaries SIGSEGV in __brk when host's gcc is pie-by-
+ default (i386)
+ [21915] nss: nss_files can return with NSS_STATUS_SUCCESS and a clobbered
+ errno value, causing getaddrinfo to fail
+ [21920] localedata: Fix p_cs_precedes/n_cs_precedes for mt_MT
+ [21922] network: getaddrinfo with AF_INET/AF_INET6 returns EAI_NONAME
+ instead of EAI_NODATA
+ [21928] libc: sys/ptrace.h: remove obsolete temporary development Linux
+ constant PTRACE_SEIZE_DEVEL
+ [21930] math: C-only gcc builtins used in <math.h> isinf
+ [21932] network: Unpaired __resolv_context_get in generic get*_r
+ implementation
+ [21941] math: powerpc: Wrong register constraint for xssqrtqp in sqrtf128
+ [21944] libc: sigval namespace
+ [21951] localedata: Update hanzi collation by stroke
+ [21955] math: Wrong alignment of L(SP_RANGE)/L(SP_INF_0) in
+ sysdeps/x86_64/fpu/e_expf.S
+ [21956] libc: Stack allocation in MIPS syscall impl (ubounded stack
+ allocation in syscall loops)
+ [21959] localedata: Fix Country name for xh_ZA
+ [21960] localedata: Fix abmon for bem_ZM
+ [21966] math: AVX2 mathvec functions use FMA without checking
+ [21967] math: When 512-bit AVX2 wrapper functions in mathvec are used?
+ [21971] localedata: Added New Locale for mfe_MU
+ [21972] libc: assert macro requires operator== (int) for its argument type
+ [21973] math: [sparc] libm missing sqrtl compat symbol
+ [21974] libc: Remove __bb_init_func and __bb_exit_func
+ [21982] string: stratcliff.c: error: assuming signed overflow does not
+ occur with -O3
+ [21986] stdio: __guess_grouping is called incorrectly
+ [21987] math: [sparc32] wrong bits/long-double.h installed
+ [22019] localedata: Wrong placement of monetary symbol in el_GR (negative
+ amounts)
+ [22022] localedata: Missing country_name for mni_IN
+ [22023] localedata: Removed redundant data (LC_TIME and LC_MESSAGES) for
+ niu_NZ
+ [22025] locale: iconv: Inconsistency between pointer mangling and NULL
+ checks
+ [22026] locale: iconv_open: heap overflow on gconv_init failure
+ [22028] math: bits/math-finite.h _MSUF_ expansion namespace
+ [22035] math: [m68k] bits/math-inline.h macro namespace
+ [22038] localedata: Fix abbreviated weeks and months for Somali
+ [22044] localedata: Remove redundant data for Limburgish Language
+ [22050] malloc: Linking with -lmcheck does not hook
+ __malloc_initialize_hook correctly
+ [22051] libc: zero terminator in the middle of glibc's .eh_frame
+ [22052] malloc: malloc failed to compile with GCC 7 and -O3
+ [22070] localedata: charmaps/UTF-8: wcwidth for
+ Prepended_Concatenation_Mark codepoints set to 0 (should be 1)
+ [22074] localedata: charmaps/UTF-8: wcwidth for U+1160-U+11FF (Hangul
+ Jungseong and Jongseong) should be 0
+ [22078] nss: nss_files performance issue in multi mode
+ [22082] math: bits/math-finite.h exp10 condition
+ [22086] libc: pcprofiledump incorrect cross-endian condition
+ [22093] dynamic-link: ld.so no longer searches in .../x86_64
+ [22095] network: Name server address allocation memory leak in resolv.conf
+ parsing after OOM
+ [22096] network: __resolv_conf_attach can incorrectly free passed conf
+ object
+ [22100] localedata: om_KE: LC_TIME: copy redundant data from om_ET
+ [22101] dynamic-link: Dynamic loader must ignore "debug" shared objects
+ e.g. ET_GNU_DEBUG_*
+ [22111] malloc: malloc: per thread cache is not returned when thread exits
+ [22112] localedata: Fix LC_TELEPHONE/LC_NAME for az_AZ
+ [22134] libc: [linux] implement fexecve with execveat
+ [22142] libc: [powerpc] printf outputs a wrong value of DBL_MAX on ppc64 and
+ ppc64le
+ [22145] libc: ttyname() gives up too early in the face of namespaces
+ [22146] math: C++ build issue with float128 on x86_64
+ [22153] nptl: nptl: save error code before process termination
+ [22156] libc: [hppa,ia64,microblaze] Executable stack default
+ [22159] malloc: malloc: MALLOC_CHECK_ broken with --enable-tunables=no
+ [22161] nscd: nscd cache prune for netgroups hangs after timeout bump
+ [22165] libc: [hppa] Text relocations in libc.so
+ [22180] libc: destructor registered via __cxa_atexit is called twice
+ [22183] glob: commit 5554304f0ddd ("posix: Allow glob to match dangling
+ symlinks") cause "make" segfaults
+ [22189] math: [powerpc] math_private.h definitions of math_opt_barrier and
+ math_force_eval
+ [22207] libc: FAIL: stdlib/test-atexit-race
+ [22225] math: nearbyint arithmetic moved before feholdexcept
+ [22229] math: [sparc32] missing copysignl, fabsl, fmal compat symbols
+ [22235] math: iscanonical in C++ and float128
+ [22243] math: log2(0) and log10(0) are wrong in downward rounding without
+ the svid compat wrapper
+ [22244] math: ynf and yn are wrong without the svid compat wrapper
+ [22273] libc: Improper assert in Linux posix_spawn implementation
+ [22284] libc: -pg -pie doesn't work
+ [22292] locale: localedef exits with error 4 when it should be error 1
+ [22294] locale: Allow "" for int_currency_symbol definition in locales.
+ [22295] locale: Don't warn on non-symbolic characters in locale sources in
+ --verbose.
+ [22296] math: glibc 2.26: signbit build issue with Gcc 5.5.0 on x86_64
+ [22298] nptl: x32: lockups on recursive pthread_mutex_lock after upgrade
+ to 2.26
+ [22299] dynamic-link: Problem with $PLATFORM on x86_64 platform
+ [22320] glob: Buffer overflow in glob with GLOB_TILDE (CVE-2017-15670)
+ [22321] libc: sysconf(_SC_IOV_MAX) returns -1 on Linux
+ [22322] libc: [mips64] wrong bits/long-double.h installed
+ [22325] glob: Memory leak in glob with GLOB_TILDE (CVE-2017-15671)
+ [22332] glob: Buffer overflow in glob with GLOB_TILDE in unescaping
+ (CVE-2017-15804)
+ [22336] localedata: cs_CZ LC_COLLATE does not use i18n
+ [22343] malloc: Integer overflow in posix_memalign
+ [22347] libc: getrandom() returns the number of bytes that were copied to
+ the buffer even though the comments say "Return 0 on success and -1 on
+ failure."
+ [22353] string: sysdeps/i386/i586/strcpy.S isn't maintainable
+ [22362] libc: Installed crt1.o, crti,.o and crtn.o files are used with
+ -m32
+ [22370] dynamic-link: Incorrect note padding check
+ [22375] libc: malloc returns pointer from tcache_get when should return
+ NULL (CVE-2017-17426)
+ [22377] math: iseqsig, float128 and C++
+ [22382] localedata: Error in tpi_PG locale
+ [22387] localedata: Replace unicode sequences <Uxxxx> for characters
+ inside the ASCII printable range
+ [22402] math: [powerpc64le] __MATH_TG does not support _Float128 for
+ -mlong-double-64
+ [22403] localedata: Slash needs escaping in some locales
+ [22408] malloc: malloc_info access heaps without arena lock, ignores heaps
+ [22409] network: res_hnok does not accept some host names used on the
+ Internet
+ [22412] network: res_dnok, res_hnok should perform syntax checks
+ [22413] network: ns_name_pton ignores syntactically invalid trailing
+ backslash
+ [22415] stdio: setvbuf can lead to invalid free/segfault
+ [22432] build: Non-deterministic build
+ [22439] malloc: malloc_info should compute summary statistics for all sub-
+ heaps in an arena
+ [22442] network: if_nametoindex could report index for the wrong
+ networking interface
+ [22446] build: aliasing violation calling readlink in handle_request
+ [22447] build: unsafe call to strlen with a non-string in getlogin_r.c
+ [22457] libc: Generic preadv/pwritev incorrectly calls __posix_memalign
+ [22459] libc: FAIL: elf/check-localplt with __stack_chk_fail related to
+ __nscd_hash/__nss_hash
+ [22463] network: p_secstodate overflow handling
+ [22469] localedata: pl_PL LC_COLLATE does not use i18n
+ [22478] libc: sigwait can fail with EINTR
+ [22505] libc: ldconfig processes include directive in locale-specific
+ order
+ [22515] localedata: hsb_DE LC_COLLATE does not use copy "iso14651_t1"
+ [22517] localedata: et_EE LC_COLLATE does not use copy "iso14651_t1"
+ [22519] localedata: is_IS LC_COLLATE does not use copy "iso14651_t1"
+ [22524] localedata: lt_LT LC_COLLATE does not use copy "iso14651_t1"
+ [22527] localedata: tr_TR LC_COLLATE does not use copy "iso14651_t1"
+ [22534] localedata: Collation rules for Serbian and Bosnian should be the
+ same as for Croatian
+ [22561] math: [DR#471] cacosh (0 + iNaN) should return NaN +/- i pi/2
+ [22568] math: [DR#471] ctanh (0 + iNaN), ctanh (0 + i Inf)
+ [22577] libc: missing newline after "cannot allocate TLS data structures
+ for initial thread"
+ [22588] manual: manual/conf.texi: missing underscore in front of
+ SC_SSIZE_MAX
+ [22593] math: nextafter and nexttoward are declared with const attribute
+ [22596] manual: manual: finite(nan) wrongly described as returning nonzero
+ [22603] string: ia64 memchr overflows internal pointer check
+ [22605] libc: SH clone does not set the exit code correctly
+ [22606] dynamic-link: Incorrect array size computation in _dl_init_paths
+ (CVE-2017-1000408)
+ [22607] dynamic-link: Buffer Overflow in _dl_init_paths (CVE-2017-1000409)
+ [22611] malloc: malloc/tst-realloc wrongly assumes that errno must not be
+ modified in case of success
+ [22614] build: gcc: error: unrecognized command line option ‘-no-pie’
+ [22615] manual: manual: ambiguous wording about errno value in case of
+ success
+ [22624] libc: MIPS setjmp() saves incorrect 'o0' register in --enable-
+ stack-protector=all
+ [22625] dynamic-link: RPATH $ORIGIN replaced by PWD for AT_SECURE/SUID
+ binaries or if /proc is not mounted (CVE-2017-16997)
+ [22627] dynamic-link: $ORIGIN in $LD_LIBRARY_PATH is substituted twice
+ [22630] build: $(no-pie-ldflag) is no longer effective
+ [22631] math: [m68k] Bad const attributes in bits/mathinline.h
+ [22635] nptl: pthread_self returns NULL before libpthread is loaded
+ [22636] nptl: PTHREAD_STACK_MIN is too small on x86-64
+ [22637] nptl: guard size is subtracted from thread stack size instead of
+ adding it on top
+ [22648] libc: getrlimit/setrlimit with RLIM_INFINITY broken on alpha
+ [22657] localedata: hu_HU: Avoid double space in date
+ [22660] math: fmax, fmin sNaN handling on alpha
+ [22664] libc: New warning of GCC8
+ [22665] math: alpha: ceil and floor raise inexact exceptions
+ [22666] math: alpha: trunc raise inexact exceptions
+ [22667] libc: makecontext lacks stack alignment on i386
+ [22678] libc: prlimit fails for RLIM_INFINITY values on 32-bit machines
+ [22679] libc: getcwd(3) can succeed without returning an absolute path
+ (CVE-2018-1000001)
+ [22685] libc: PowerPC: Static AT_SECURE binaries segfault with lock-
+ elision and tunables
+ [22687] math: [powerpc-nofpu] complex long double functions spurious
+ "invalid" exception
+ [22688] math: [powerpc-nofpu] remainderl wrong sign of zero result
+ [22690] math: [ldbl-128ibm] lrintl, lroundl missing "invalid" exceptions
+ [22691] math: [powerpc-nofpu] fmaxmagl, fminmagl spurious "invalid"
+ exception
+ [22693] math: [ldbl-128ibm] log1pl (-qNaN) spurious "invalid" exception
+ [22697] math: [powerpc] llround spurious "inexact" exceptions on 32-bit
+ power4
+ [22701] nis: Incomplete removal of libnsl
+ [22702] math: [powerpc-nofpu] nearbyintl traps with trapping "inexact"
+ [22707] libc: Missing defines in elf.h for DF_1_STUB and DF_1_PIE.
+ [22715] dynamic-link: FAIL: elf/tst-audit10
+ [22719] libc: Backtrace tests fail on hppa
+ [22742] libc: [aarch64] mcontext_t __reserved field got renamed
+ [22743] nptl: __pthread_register_cancel corrupts stack after f81ddabffd
+ [22765] crypt: (struct crypt_data *data)->initialized is not set to zero
+ before the first call to crypt_r () in crypt/badsalttest.c
+
+
+Version 2.26
+
+Major new features:
+
+* A per-thread cache has been added to malloc. Access to the cache requires
+ no locks and therefore significantly accelerates the fast path to allocate
+ and free small amounts of memory. Refilling an empty cache requires locking
+ the underlying arena. Performance measurements show significant gains in a
+ wide variety of user workloads. Workloads were captured using a special
+ instrumented malloc and analyzed with a malloc simulator. Contributed by
+ DJ Delorie with the help of Florian Weimer, and Carlos O'Donell.
+
+* Unicode 10.0.0 Support: Character encoding, character type info, and
+ transliteration tables are all updated to Unicode 10.0.0, using
+ generator scripts contributed by Mike FABIAN (Red Hat).
+ These updates cause user visible changes, especially the changes in
+ wcwidth for many emoji characters cause problems when emoji sequences
+ are rendered with pango, see for example:
+ https://bugzilla.gnome.org/show_bug.cgi?id=780669#c5
+
+* Collation of Hungarian has been overhauled and is now consistent with "The
+ Rules of Hungarian Orthography, 12th edition" (Bug 18934). Contributed by
+ Egmont Koblinger.
+
+* Improvements to the DNS stub resolver, contributed by Florian Weimer:
+
+ - The GNU C Library will now detect when /etc/resolv.conf has been
+ modified and reload the changed configuration. The new resolver option
+ “no-reload” (RES_NORELOAD) disables this behavior.
+
+ - The GNU C Library now supports an arbitrary number of search domains
+ (configured using the “search” directive in /etc/resolv.conf);
+ previously, there was a hard limit of six domains. For backward
+ compatibility, applications that directly modify the ‘_res’ global
+ object are still limited to six search domains.
+
+ - When the “rotate” (RES_ROTATE) resolver option is active, the GNU C
+ Library will now randomly pick a name server from the configuration as a
+ starting point. (Previously, the second name server was always used.)
+
+* The tunables feature is now enabled by default. This allows users to tweak
+ behavior of the GNU C Library using the GLIBC_TUNABLES environment variable.
+
+* New function reallocarray, which resizes an allocated block (like realloc)
+ to the product of two sizes, with a guaranteed clean failure upon integer
+ overflow in the multiplication. Originally from OpenBSD, contributed by
+ Dennis Wölfing and Rüdiger Sonderfeld.
+
+* New wrappers for the Linux-specific system calls preadv2 and pwritev2.
+ These are extended versions of preadv and pwritev, respectively, taking an
+ additional flags argument. The set of supported flags depends on the
+ running kernel; full support currently requires kernel 4.7 or later.
+
+* posix_spawnattr_setflags now supports the flag POSIX_SPAWN_SETSID, to
+ create a new session ID for the spawned process. This feature is
+ scheduled to be added to the next major revision of POSIX; for the time
+ being, it is available under _GNU_SOURCE.
+
+* errno.h is now safe to use from C-preprocessed assembly language on all
+ supported operating systems. In this context, it will only define the
+ Exxxx constants, as preprocessor macros expanding to integer literals.
+
+* On ia64, powerpc64le, x86-32, and x86-64, the math library now implements
+ 128-bit floating point as defined by ISO/IEC/IEEE 60559:2011 (IEEE
+ 754-2008) and ISO/IEC TS 18661-3:2015. Contributed by Paul E. Murphy,
+ Gabriel F. T. Gomes, Tulio Magno Quites Machado Filho, and Joseph Myers.
+
+ To compile programs that use this feature, the compiler must support
+ 128-bit floating point with the type name _Float128 (as defined by TS
+ 18661-3) or __float128 (the nonstandard name used by GCC for C++, and for
+ C prior to version 7). _GNU_SOURCE or __STDC_WANT_IEC_60559_TYPES_EXT__
+ must be defined to make the new interfaces visible.
+
+ The new functions and macros correspond to those present for other
+ floating-point types (except for a few obsolescent interfaces not
+ supported for the new type), with F128 or f128 suffixes; for example,
+ strtof128, HUGE_VAL_F128 and cosf128. Following TS 18661-3, there are no
+ printf or scanf formats for the new type; the strfromf128 and strtof128
+ interfaces should be used instead.
+
+Deprecated and removed features, and other changes affecting compatibility:
+
+* The synchronization that pthread_spin_unlock performs has been changed to
+ now be equivalent to a C11 atomic store with release memory order to the
+ spin lock's memory location. Previously, several (but not all)
+ architectures used stronger synchronization (e.g., containing what is
+ often called a full barrier). This change can improve performance, but
+ may affect odd fringe uses of spin locks that depend on the previous
+ behavior (e.g., using spin locks as atomic variables to try to implement
+ Dekker's mutual exclusion algorithm).
+
+* The port to Native Client running on ARMv7-A (--host=arm-nacl) has been
+ removed.
+
+* Sun RPC is deprecated. The rpcgen program, librpcsvc, and Sun RPC headers
+ will only be built and installed when the GNU C Library is configured with
+ --enable-obsolete-rpc. This allows alternative RPC implementations, such
+ as TIRPC or rpcsvc-proto, to be used.
+
+* The NIS(+) name service modules, libnss_nis, libnss_nisplus, and
+ libnss_compat, are deprecated, and will not be built or installed by
+ default.
+
+ The NIS(+) support library, libnsl, is also deprecated. By default, a
+ compatibility shared library will be built and installed, but not headers
+ or development libraries. Only a few NIS-related programs require this
+ library. (In particular, the GNU C Library has never required programs
+ that use 'gethostbyname' to be linked with libnsl.)
+
+ Replacement implementations based on TIRPC, which additionally support
+ IPv6, are available from <https://github.com/thkukuk/>. The configure
+ option --enable-obsolete-nsl will cause libnsl's headers, and the NIS(+)
+ name service modules, to be built and installed.
+
+* The DNS stub resolver no longer performs EDNS fallback. If EDNS or DNSSEC
+ support is enabled, the configured recursive resolver must support EDNS.
+ (Responding to EDNS-enabled queries with responses which are not
+ EDNS-enabled is fine, but FORMERR responses are not.)
+
+* res_mkquery and res_nmkquery no longer support the IQUERY opcode. DNS
+ servers have not supported this opcode for a long time.
+
+* The _res_opcodes variable has been removed from libresolv. It had been
+ exported by accident.
+
+* <string.h> no longer includes inline versions of any string functions,
+ as this kind of optimization is better done by the compiler. The macros
+ __USE_STRING_INLINES and __NO_STRING_INLINES no longer have any effect.
+
+* The nonstandard header <xlocale.h> has been removed. Most programs should
+ use <locale.h> instead. If you have a specific need for the definition of
+ locale_t with no other declarations, please contact
+ libc-alpha@sourceware.org and explain.
+
+* The obsolete header <sys/ultrasound.h> has been removed.
+
+* The obsolete signal constant SIGUNUSED is no longer defined by <signal.h>.
+
+* The obsolete function cfree has been removed. Applications should use
+ free instead.
+
+* The stack_t type no longer has the name struct sigaltstack. This changes
+ the C++ name mangling for interfaces involving this type.
+
+* The ucontext_t type no longer has the name struct ucontext. This changes
+ the C++ name mangling for interfaces involving this type.
+
+* On M68k GNU/Linux and MIPS GNU/Linux, the fpregset_t type no longer has
+ the name struct fpregset. On Nios II GNU/Linux, the mcontext_t type no
+ longer has the name struct mcontext. On SPARC GNU/Linux, the struct
+ mc_fq, struct rwindow, struct fpq and struct fq types are no longer
+ defined in sys/ucontext.h, the mc_fpu_t type no longer has the name struct
+ mc_fpu, the gwindows_t type no longer has the name struct gwindows and the
+ fpregset_t type no longer has the name struct fpu. This changes the C++
+ name mangling for interfaces involving those types.
+
+* On S/390 GNU/Linux, the constants defined by <sys/ptrace.h> have been
+ synced with the kernel:
+
+ - PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS and PTRACE_SETFPREGS
+ are not supported on this architecture and have been removed.
+
+ - PTRACE_SINGLEBLOCK, PTRACE_SECCOMP_GET_FILTER, PTRACE_PEEKUSR_AREA,
+ PTRACE_POKEUSR_AREA, PTRACE_GET_LAST_BREAK, PTRACE_ENABLE_TE,
+ PTRACE_DISABLE_TE and PTRACE_TE_ABORT_RAND have been added.
+
+ Programs that assume the GET/SETREGS ptrace requests are universally
+ available will now fail to build, instead of malfunctioning at runtime.
+
+Changes to build and runtime requirements:
+
+* Linux kernel 3.2 or later is required at runtime, on all architectures
+ supported by that kernel. (This is a change from version 2.25 only for
+ x86-32 and x86-64.)
+
+* GNU Binutils 2.25 or later is now required to build the GNU C Library.
+
+* On most architectures, GCC 4.9 or later is required to build the GNU C
+ Library. On powerpc64le, GCC 6.2 or later is required.
+
+ Older GCC versions and non-GNU compilers are still supported when
+ compiling programs that use the GNU C Library. (We do not know exactly
+ how old, and some GNU extensions to C may be _de facto_ required. If you
+ are interested in helping us make this statement less vague, please
+ contact libc-alpha@sourceware.org.)
+
+Security related changes:
+
+* The DNS stub resolver limits the advertised UDP buffer size to 1200 bytes,
+ to avoid fragmentation-based spoofing attacks (CVE-2017-12132).
+
+* LD_LIBRARY_PATH is now ignored in binaries running in privileged AT_SECURE
+ mode to guard against local privilege escalation attacks (CVE-2017-1000366).
+
+* Avoid printing a backtrace from the __stack_chk_fail function since it is
+ called on a corrupt stack and a backtrace is unreliable on a corrupt stack
+ (CVE-2010-3192).
+
+* A use-after-free vulnerability in clntudp_call in the Sun RPC system has been
+ fixed (CVE-2017-12133).
+
+The following bugs are resolved with this release:
+
+ [984] network: Respond to changed resolv.conf in gethostbyname
+ [5010] network: sunrpc service cleanup causes unwanted port mapper traffic
+ [12068] localedata: sc_IT: misspelled yesexpr/day/abday/mon/abmon/date_fmt
+ fields
+ [12189] libc: __stack_chk_fail should not attempt a backtrace
+ (CVE-2010-3192)
+ [14096] time: Race condition on timezone/tst-timezone.out
+ [14172] localedata: az_IR: new locale
+ [14995] build: glibc fails to build if gold is the default linker, even if
+ ld.bfd is available
+ [15998] build: [powerpc] Set arch_minimum_kernel for powerpc LE
+ [16637] network: inet_pton function is accepting IPv6 with bad format
+ [16640] string: string/strtok.c: undefined behaviour inconsistent between
+ x86 and other generic code
+ [16875] localedata: ko_KR: fix lang_name
+ [17225] localedata: ar_SY: localized month names for May and June are
+ incorrect
+ [17297] localedata: da_DK: wrong date_fmt string
+ [18907] stdio: Incorrect order of __wur __THROW in <printf.h>
+ [18934] localedata: hu_HU: collate: fix multiple bugs and add tests
+ [18988] nptl: pthread wastes memory with mlockall(MCL_FUTURE)
+ [19066] localedata: ar_SA abbreviated day and month names are in English
+ [19569] network: resolv: Support an arbitrary number of search domains
+ [19570] network: Implement random DNS server selection in the stub
+ resolver
+ [19838] locale: localedef fails on PA-RISC
+ [19919] localedata: iso14651_t1_common: Correct the Malayalam sorting
+ order of 0D36 and 0D37
+ [19922] localedata: iso14651_t1_common: Define collation for Malayalam
+ chillu characters
+ [20098] libc: FAIL: debug/backtrace-tst on hppa
+ [20257] network: sunrpc: clntudp_call does not enforce timeout when
+ receiving data
+ [20275] localedata: locale day/abday/mon/abmon should not have trailing
+ whitespace
+ [20313] localedata: Update locale data to Unicode 9.0
+ [20424] manual: Document how to provide a malloc replacement
+ [20496] localedata: agr_PE: new language locale Awajún / Aguaruna (agr)
+ for Peru
+ [20686] locale: Add el_GR@euro to SUPPORTED.
+ [20831] dynamic-link: _dl_map_segments does not test for __mprotect
+ failures consistently
+ [21015] dynamic-link: Document and fix --enable-bind-now
+ [21016] nptl: pthread_cond support is broken on hppa
+ [21029] libc: glibc-2.23 (and later) fails to compile with -fno-omit-
+ frame-pointer on i386
+ [21049] libc: segfault in longjmp_chk() due to clobbered processor
+ register
+ [21075] libc: unused assigment to %g4 in sparc/sparc{64,32}/clone.S
+ [21088] libc: Build fails with --enable-static-nss
+ [21094] math: cosf(1.57079697) has 3 ulp error on targets where the
+ generic c code is used
+ [21109] libc: Tunables broken on big-endian
+ [21112] math: powf has large ulp errors with base close to 1 and exponent
+ around 4000
+ [21115] network: sunrpc: Use-after-free in error path in clntudp_call
+ (CVE-2017-12133)
+ [21120] malloc: glibc malloc is incompatible with GCC 7
+ [21130] math: Incorrect return from y0l (-inf) and y1l (-inf) when linking
+ with -lieee
+ [21134] math: Exception (divide by zero) not set for y0/y1 (0.0) and y0/y1
+ (-0.0) when linking with -lieee
+ [21171] math: log10, log2 and lgamma return incorrect results
+ [21179] libc: handle R_SPARC_DISP64 and R_SPARC_REGISTER relocs
+ [21182] libc: __memchr_sse2: regression in glibc-2.25 on i686
+ [21207] localedata: ce_RU: update weekdays from CLDR
+ [21209] dynamic-link: LD_HWCAP_MASK read in setuid binaries
+ [21217] localedata: Update months from CLDR-31
+ [21232] libc: miss posix_fadvise64 on MIPS64 when static linking
+ [21243] libc: support_delete_temp_file should issue warning for failed
+ remove()
+ [21244] libc: support resolv_test_start() socket fd close should be
+ checked for errors.
+ [21253] libc: localedef randomly segfaults when using -fstack-check due to
+ new posix_spawn implementation
+ [21258] dynamic-link: Branch predication in _dl_runtime_resolve_avx512_opt
+ leads to lower CPU frequency
+ [21259] libc: [alpha] termios.h missing IXANY for POSIX
+ [21261] libc: [sparc64] bits/setjmp.h namespace
+ [21267] network: [mips] bits/socket.h IOC* namespace
+ [21268] libc: [alpha] termios.h NL2, NL3 namespace
+ [21270] libc: mmap64 silently truncates large offset values
+ [21275] libc: posix_spawn always crashes on ia64 now
+ [21277] libc: [alpha] termios.h missing IUCLC for UNIX98 and older
+ [21280] math: [powerpc] logbl for POWER7 return incorrect results
+ [21289] libc: Incorrect declaration for 32-bit platforms with
+ _FILE_OFFSET_BITS=64 causes build error
+ [21295] network: GETAI(AF_UNSPEC) drops IPv6 addresses if nss module does
+ not support gethostbyname4_r
+ [21298] nptl: rwlock can deadlock on frequent reader/writer phase
+ switching
+ [21338] malloc: mallopt M_ARENA_MAX doesn't set the maximum number of
+ arenas
+ [21340] libc: Support POSIX_SPAWN_SETSID
+ [21357] libc: unwind-dw2-fde deadlock when using AddressSanitizer
+ [21359] network: ns_name_pack needs additional byte in destination buffer
+ [21361] network: resolv: Reduce advertised EDNS0 buffer size to guard
+ against fragmentation attacks (CVE-2017-12132)
+ [21369] network: resolv: Remove EDNS fallback
+ [21371] libc: Missing timespec definition when compiled with _XOPEN_SOURCE
+ and _POSIX_C_SOURCE
+ [21386] nptl: Assertion in fork for distinct parent PID is incorrect
+ [21391] dynamic-link: x86: Set dl_platform and dl_hwcap from CPU features
+ [21393] stdio: Missing dup3 error check in freopen, freopen64
+ [21396] libc: Use AVX2 memcpy/memset on Skylake server
+ [21399] localedata: Bad description for U00EC in
+ localedata/charmaps/CP1254
+ [21411] malloc: realloc documentation error
+ [21426] network: sys/socket.h uio.h namespace
+ [21428] libc: [aarch64] tst-backtrace5 testsuite failure
+ [21445] libc: signal.h bsd_signal namespace
+ [21455] network: Network headers stdint.h namespace
+ [21474] network: resolv: res_init does not use RES_DFLRETRY (2) but 4 for
+ retry value
+ [21475] network: resolv: Overlong search path is truncated mid-label
+ [21511] libc: sigstack namespace
+ [21512] libc: clone() ends up calling exit_group() through _exit() wrapper
+ [21514] libc: sysdeps/unix/sysv/linux/sys/syscall.h:31:27: fatal error:
+ bits/syscall.h: No such file or directory
+ [21517] libc: struct sigaltstack namespace
+ [21528] dynamic-link: Duplicated minimal strtoul implementations in ld.so
+ [21533] localedata: Update locale data to Unicode 10.0
+ [21537] libc:
+ ../sysdeps/unix/sysv/linux/s390/s390-32/__makecontext_ret.S:44: Error:
+ junk at end of line, first unrecognized character is `@'
+ [21538] libc: SIG_HOLD missing for XPG4
+ [21539] libc: S390: Mismatch between kernel and glibc ptrace.h with
+ request 12: PTRACE_SINGLEBLOCK vs PTRACE_GETREGS.
+ [21542] libc: Use conservative default for sysconf (_SC_NPROCESSORS_ONLN)
+ [21543] libc: sigevent namespace
+ [21548] libc: [mips] get/set/make/swap context for MIPS O32 assume wrong
+ size for general purpose registers in mcontext_t structure
+ [21550] libc: sigwait namespace
+ [21552] libc: XPG4 bsd_signal namespace
+ [21554] libc: sigpause namespace
+ [21560] libc: sys/wait.h signal.h namespace
+ [21561] libc: waitid namespace
+ [21573] nptl: GCC 7: /usr/bin/install: cannot remove
+ '/usr/include/stdlib.h': Permission denied
+ [21575] libc: sys/wait.h missing struct rusage definition
+ [21584] libc: sigaltstack etc namespace
+ [21597] libc: siginterrupt namespace
+ [21607] math: hppa: FAIL: math/test-tgmath
+ [21609] dynamic-link: Incomplete workaround for GCC __tls_get_addr ABI
+ issue on x86-64
+ [21622] libc: [tile] missing SA_* for POSIX.1:2008
+ [21624] dynamic-link: ld.so: Unsafe alloca allows local attackers to alias
+ stack and heap (CVE-2017-1000366)
+ [21625] libc: wait3 namespace
+ [21654] nss: Incorrect pointer alignment in NSS group merge result
+ construction
+ [21657] network: Parse interface zone id for node-local multicast
+ [21662] string: memcmp-avx2-movbe.S lacks saturating subtraction for
+ between_2_3
+ [21666] libc: .symver is used on common symbol
+ [21668] network: resolv: res_init cross-thread broadcast introduces race
+ conditions
+ [21687] math: tgmath.h totalorder, totalordermag return type
+ [21694] locale: Current Glibc Locale Does Not Support Tok-Pisin and Fiji
+ Hindi Locale
+ [21696] libc: Incorrect assumption of of __cpu_mask in
+ posix/sched_cpucount.c
+ [21697] libc: sysdeps/posix/spawni.c: 2 * suspicious condition ?
+ [21706] localedata: yesstr and nostr are missing for Breton [LC_MESSAGES]
+ locale
+ [21707] math: ppc64le: Invalid IFUNC resolver from libgcc calls getauxval,
+ leading to relocation crash
+ [21709] libc: resolv_conf.c:552: update_from_conf: Assertion
+ `resolv_conf_matches (resp, conf)' failed.
+ [21710] localedata: Added Samoan language locale for Samoa
+ [21711] localedata: Pashto yesstr/nostr locale are missing
+ [21715] nptl: sysdeps/nptl/bits/pthreadtypes.h: typedef guard
+ __have_pthread_attr_t can cause redefinition of typedef ‘pthread_attr_t’
+ [21721] localedata: Incorrect Full Weekday names for ks_IN@devanagari
+ [21723] localedata: yesstr/nostr missing for Chinese language locale
+ [21724] localedata: yesstr and nostr are missing for Xhosa [LC_MESSAGES]
+ locale
+ [21727] localedata: yesstr and nostr are missing for Tsonga [LC_MESSAGES]
+ locale
+ [21728] localedata: New Locale for Tongan language
+ [21729] localedata: incorrect LC_NAME fields for hi_IN
+ [21733] localedata: yesstr and nostr are missing for zh_HK
+ [21734] localedata: Missing yesstr and nostr are for kw_GB
+ [21738] libc: misc/tst-preadvwritev2 and misc/tst-preadvwritev64v2 fail
+ [21741] libc: Undefined __memmove_chk_XXX and __memset_chk_XXX in libc.a
+ [21742] libc: _dl_num_cache_relocations is undefined in libc.a
+ [21743] localedata: ks_IN@devanagari: abday strings mismatch the day
+ strings
+ [21744] libc: Tests failing on --enable-tunables --enable-stack-
+ protector=all
+ [21749] localedata: Wrong abbreviated day name (“abday”) for
+ ar_JO/ar_LB/ar_SY
+ [21756] localedata: missing yesstr, nostr for nds_DE and nds_NL
+ [21757] localedata: missing yesstr, nostr for pap_AW and pap_CW
+ [21759] localedata: missing yesstr and nostr for Tigrinya
+ [21760] localedata: Fix LC_MESSAGES and LC_ADDRESS for anp_IN
+ [21766] localedata: Wrong LC_MESSAGES for om_ET Locale
+ [21767] localedata: Missing Bislama locales
+ [21768] localedata: Missing yesstr and nostr for aa_ET
+ [21770] localedata: Missing Field in li_NL
+ [21778] nptl: Robust mutex may deadlock
+ [21779] libc: MicroBlaze segfaults when loading libpthread
+ [21783] localedata: Fix int_select international_call_prefixes
+ [21784] localedata: Inconsistency in country_isbn
+ [21788] localedata: Missing Country Postal Abbreviations
+ [21794] localedata: Added-country_isbn-for-Italy
+ [21795] localedata: Add/Fix country_isbn for France
+ [21796] localedata: Added country_isbn for Republic of Korea
+ [21797] localedata: Fix inconsistency in country_isbn and missing prefixes
+ [21799] localedata: Added int_select international_call_prefixes
+ [21801] localedata: Added int_select international_call_prefixes
+ [21804] nptl: Double semicolon in thread-shared-types.h
+ [21807] localedata: LC_ADDRESS fix for pap_CW
+ [21808] localedata: Fix LC_ADDRESS for pap_AW
+ [21821] localedata: Added country_name in mai_IN
+ [21822] localedata: Fix LC_TIME for mai_IN
+ [21823] localedata: missing yesstr, nostr for sa_IN
+ [21825] localedata: Fix name_mrs for mag_IN
+ [21828] localedata: 2.26 changelog should mention user visible changes
+ with unicode 9.0
+ [21835] localedata: Added Maithili language locale for Nepal
+ [21838] localedata: Removed redundant data for the_NP
+ [21839] localedata: Fix LC_MONETARY for ta_LK
+ [21844] localedata: Fix Latin characters and Months Sequence.
+ [21848] localedata: Fix mai_NP Title Name
+
+
+Version 2.25
+
+* The feature test macro __STDC_WANT_LIB_EXT2__, from ISO/IEC TR
+ 24731-2:2010, is supported to enable declarations of functions from that
+ TR. Note that not all functions from that TR are supported by the GNU C
+ Library.
+
+* The feature test macro __STDC_WANT_IEC_60559_BFP_EXT__, from ISO/IEC TS
+ 18661-1:2014, is supported to enable declarations of functions and macros
+ from that TS. Note that not all features from that TS are supported by
+ the GNU C Library.
+
+* The feature test macro __STDC_WANT_IEC_60559_FUNCS_EXT__, from ISO/IEC TS
+ 18661-4:2015, is supported to enable declarations of functions and macros
+ from that TS. Note that most features from that TS are not supported by
+ the GNU C Library.
+
+* The nonstandard feature selection macros _REENTRANT and _THREAD_SAFE are
+ now treated as compatibility synonyms for _POSIX_C_SOURCE=199506L.
+ Since the GNU C Library defaults to a much newer revision of POSIX, this
+ will only affect programs that specifically request an old conformance
+ mode. For instance, a program compiled with -std=c89 -D_REENTRANT will
+ see a change in the visible declarations, but a program compiled with
+ just -D_REENTRANT, or -std=c99 -D_POSIX_C_SOURCE=200809L -D_REENTRANT,
+ will not.
+
+ Some C libraries once required _REENTRANT and/or _THREAD_SAFE to be
+ defined by all multithreaded code, but glibc has not required this for
+ many years.
+
+* The inclusion of <sys/sysmacros.h> by <sys/types.h> is deprecated. This
+ means that in a future release, the macros “major”, “minor”, and “makedev”
+ will only be available from <sys/sysmacros.h>.
+
+ These macros are not part of POSIX nor XSI, and their names frequently
+ collide with user code; see for instance glibc bug 19239 and Red Hat bug
+ 130601. <stdlib.h> includes <sys/types.h> under _GNU_SOURCE, and C++ code
+ presently cannot avoid being compiled under _GNU_SOURCE, exacerbating the
+ problem.
+
+* New <fenv.h> features from TS 18661-1:2014 are added to libm: the
+ fesetexcept, fetestexceptflag, fegetmode and fesetmode functions, the
+ femode_t type and the FE_DFL_MODE and FE_SNANS_ALWAYS_SIGNAL macros.
+
+* Integer width macros from TS 18661-1:2014 are added to <limits.h>:
+ CHAR_WIDTH, SCHAR_WIDTH, UCHAR_WIDTH, SHRT_WIDTH, USHRT_WIDTH, INT_WIDTH,
+ UINT_WIDTH, LONG_WIDTH, ULONG_WIDTH, LLONG_WIDTH, ULLONG_WIDTH; and to
+ <stdint.h>: INT8_WIDTH, UINT8_WIDTH, INT16_WIDTH, UINT16_WIDTH,
+ INT32_WIDTH, UINT32_WIDTH, INT64_WIDTH, UINT64_WIDTH, INT_LEAST8_WIDTH,
+ UINT_LEAST8_WIDTH, INT_LEAST16_WIDTH, UINT_LEAST16_WIDTH,
+ INT_LEAST32_WIDTH, UINT_LEAST32_WIDTH, INT_LEAST64_WIDTH,
+ UINT_LEAST64_WIDTH, INT_FAST8_WIDTH, UINT_FAST8_WIDTH, INT_FAST16_WIDTH,
+ UINT_FAST16_WIDTH, INT_FAST32_WIDTH, UINT_FAST32_WIDTH, INT_FAST64_WIDTH,
+ UINT_FAST64_WIDTH, INTPTR_WIDTH, UINTPTR_WIDTH, INTMAX_WIDTH,
+ UINTMAX_WIDTH, PTRDIFF_WIDTH, SIG_ATOMIC_WIDTH, SIZE_WIDTH, WCHAR_WIDTH,
+ WINT_WIDTH.
+
+* New <math.h> features are added from TS 18661-1:2014:
+
+ - Signaling NaN macros: SNANF, SNAN, SNANL.
+
+ - Nearest integer functions: roundeven, roundevenf, roundevenl, fromfp,
+ fromfpf, fromfpl, ufromfp, ufromfpf, ufromfpl, fromfpx, fromfpxf,
+ fromfpxl, ufromfpx, ufromfpxf, ufromfpxl.
+
+ - llogb functions: the llogb, llogbf and llogbl functions, and the
+ FP_LLOGB0 and FP_LLOGBNAN macros.
+
+ - Max-min magnitude functions: fmaxmag, fmaxmagf, fmaxmagl, fminmag,
+ fminmagf, fminmagl.
+
+ - Comparison macros: iseqsig.
+
+ - Classification macros: iscanonical, issubnormal, iszero.
+
+ - Total order functions: totalorder, totalorderf, totalorderl,
+ totalordermag, totalordermagf, totalordermagl.
+
+ - Canonicalize functions: canonicalize, canonicalizef, canonicalizel.
+
+ - NaN functions: getpayload, getpayloadf, getpayloadl, setpayload,
+ setpayloadf, setpayloadl, setpayloadsig, setpayloadsigf, setpayloadsigl.
+
+* The functions strfromd, strfromf, and strfroml, from ISO/IEC TS 18661-1:2014,
+ are added to libc. They convert a floating-point number into string.
+
+* Most of glibc can now be built with the stack smashing protector enabled.
+ It is recommended to build glibc with --enable-stack-protector=strong.
+ Implemented by Nick Alcock (Oracle).
+
+* The function explicit_bzero, from OpenBSD, has been added to libc. It is
+ intended to be used instead of memset() to erase sensitive data after use;
+ the compiler will not optimize out calls to explicit_bzero even if they
+ are "unnecessary" (in the sense that no _correct_ program can observe the
+ effects of the memory clear).
+
+* On ColdFire, MicroBlaze, Nios II and SH3, the float_t type is now defined
+ to float instead of double. This does not affect the ABI of any libraries
+ that are part of the GNU C Library, but may affect the ABI of other
+ libraries that use this type in their interfaces.
+
+* On x86_64, when compiling with -mfpmath=387 or -mfpmath=sse+387, the
+ float_t and double_t types are now defined to long double instead of float
+ and double. These options are not the default, and this does not affect
+ the ABI of any libraries that are part of the GNU C Library, but it may
+ affect the ABI of other libraries that use this type in their interfaces,
+ if they are compiled or used with those options.
+
+* The getentropy and getrandom functions, and the <sys/random.h> header file
+ have been added.
+
+* The buffer size for byte-oriented stdio streams is now limited to 8192
+ bytes by default. Previously, on Linux, the default buffer size on most
+ file systems was 4096 bytes (and thus remains unchanged), except on
+ network file systems, where the buffer size was unpredictable and could be
+ as large as several megabytes.
+
+* The <sys/quota.h> header now includes the <linux/quota.h> header. Support
+ for the Linux quota interface which predates kernel version 2.4.22 has
+ been removed.
+
+* The malloc_get_state and malloc_set_state functions have been removed.
+ Already-existing binaries that dynamically link to these functions will
+ get a hidden implementation in which malloc_get_state is a stub. As far
+ as we know, these functions are used only by GNU Emacs and this change
+ will not adversely affect already-built Emacs executables. Any undumped
+ Emacs executables, which normally exist only during an Emacs build, should
+ be rebuilt by re-running “./configure; make” in the Emacs build tree.
+
+* The “ip6-dotint” and “no-ip6-dotint” resolver options, and the
+ corresponding RES_NOIP6DOTINT flag from <resolv.h> have been removed.
+ “no-ip6-dotint” had already been the default, and support for the
+ “ip6-dotint” option was removed from the Internet in 2006.
+
+* The "ip6-bytestring" resolver option and the corresponding RES_USEBSTRING
+ flag from <resolv.h> have been removed. The option relied on a
+ backwards-incompatible DNS extension which was never deployed on the
+ Internet.
+
+* The flags RES_AAONLY, RES_PRIMARY, RES_NOCHECKNAME, RES_KEEPTSIG,
+ RES_BLAST defined in the <resolv.h> header file have been deprecated.
+ They were already unimplemented.
+
+* The "inet6" option in /etc/resolv.conf and the RES_USE_INET6 flag for
+ _res.flags are deprecated. The flag was standardized in RFC 2133, but
+ removed again from the IETF name lookup interface specification in RFC
+ 2553. Applications should use getaddrinfo instead.
+
+* DNSSEC-related declarations and definitions have been removed from the
+ <arpa/nameser.h> header file, and libresolv will no longer attempt to
+ decode the data part of DNSSEC record types. Previous versions of glibc
+ only implemented minimal support for the previous version of DNSSEC, which
+ is incompatible with the currently deployed version.
+
+* The resource record type classification macros ns_t_qt_p, ns_t_mrr_p,
+ ns_t_rr_p, ns_t_udp_p, ns_t_xfr_p have been removed from the
+ <arpa/nameser.h> header file because the distinction between RR types and
+ meta-RR types is not officially standardized, subject to revision, and
+ thus not suitable for encoding in a macro.
+
+* The types res_sendhookact, res_send_qhook, re_send_rhook, and the qhook
+ and rhook members of the res_state type in <resolv.h> have been removed.
+ The glibc stub resolver did not support these hooks, but the header file
+ did not reflect that.
+
+* For multi-arch support it is recommended to use a GCC which has
+ been built with support for GNU indirect functions. This ensures
+ that correct debugging information is generated for functions
+ selected by IFUNC resolvers. This support can either be enabled by
+ configuring GCC with '--enable-gnu-indirect-function', or by
+ enabling it by default by setting 'default_gnu_indirect_function'
+ variable for a particular architecture in the GCC source file
+ 'gcc/config.gcc'.
+
+* GDB pretty printers have been added for mutex and condition variable
+ structures in POSIX Threads. When installed and loaded in gdb these pretty
+ printers show various pthread variables in human-readable form when read
+ using the 'print' or 'display' commands in gdb.
+
+* Tunables feature added to allow tweaking of the runtime for an application
+ program. This feature can be enabled with the '--enable-tunables' configure
+ flag. The GNU C Library manual has details on usage and README.tunables has
+ instructions on adding new tunables to the library.
+
+* A new version of condition variables functions have been implemented in
+ the NPTL implementation of POSIX Threads to provide stronger ordering
+ guarantees.
+
+* A new version of pthread_rwlock functions have been implemented to use a more
+ scalable algorithm primarily through not using a critical section anymore to
+ make state changes.
+
+Security related changes:
+
+* On ARM EABI (32-bit), generating a backtrace for execution contexts which
+ have been created with makecontext could fail to terminate due to a
+ missing .cantunwind annotation. This has been observed to lead to a hang
+ (denial of service) in some Go applications compiled with gccgo. Reported
+ by Andreas Schwab. (CVE-2016-6323)
+
+* The DNS stub resolver functions would crash due to a NULL pointer
+ dereference when processing a query with a valid DNS question type which
+ was used internally in the implementation. The stub resolver now uses a
+ question type which is outside the range of valid question type values.
+ (CVE-2015-5180)
+
+The following bugs are resolved with this release:
+
+ [4099] stdio: Overly aggressive caching by stream i/o functions.
+ [7065] build: Support building glibc with -fstack-protector or -fstack-
+ protector-all
+ [9842] localedata: en_CA: incorrect date format
+ [13165] nptl: pthread_cond_wait() can consume a signal that was sent
+ before it started waiting
+ [14139] manual: Do not hardcode platform names in manual/libm-err-tab.pl
+ [15765] nptl: sem_open is wrongly a cancellation point
+ [16421] network: IN6_IS_ADDR_UNSPECIFIED can use undefined s6_addr32
+ [16458] libc: endian.h and netinet/in.h byte order macros return values of
+ wrong type
+ [16628] dynamic-link: Segfault after a binary without pthread dlopen()s a
+ library linked with pthread
+ [16630] nptl: Use SYSENTER for pthread_cond_broadcast/signal() (i.e. fix
+ "FIXME: Ingo" issue)
+ [16907] libc: <argp.h> compiled with --std=cXX disables __attribute__
+ [17252] libc: getrandom and getentropy syscall
+ [17730] malloc: thread-local storage is sometimes improperly free()'d
+ after being __libc_memalign()'d
+ [18241] stdio: failed fseek on memstream does not set errno and can fail
+ when it shouldnt
+ [18243] nptl: sem_wait, sem_timedwait are cancellation points shm_open is
+ not
+ [18463] nptl: pthread_cond_broadcast issue when surrounded by
+ PTHREAD_PRIO_INHERIT mutex on ARM
+ [18784] network: res_query and related function crash for special record
+ type queries (CVE-2015-5180)
+ [19380] math: strtod does not raise "inexact"
+ [19387] string: Integer overflow in memchr
+ [19390] string: Integer overflow in strncat
+ [19398] build: linknamespace tests fail with massively parallel build
+ [19402] nptl: Deadlock with robust shared mutex and asynchronous
+ termination
+ [19469] malloc: M_PERTURB in test-skeleton.c invalidates malloc tests
+ [19473] malloc: Turn malloc_get_state etc. in compatibility symbols
+ [19514] libc: [PATCH] Fix spelling errors in spelling
+ "implement"/"implementation" in several places
+ [19582] network: Deprecate RES_USE_INET6
+ [19673] manual: clog10 docs appear to be erroneous
+ [19810] dynamic-link: dlopen with both RTLD_NOLOAD and RTLD_NODELETE
+ causes a segmentation fault
+ [19826] libc: invalid pointer returned from __tls_get_addr with static
+ linking
+ [20016] network: resolv: Remove hooks support from the API
+ [20019] dynamic-link: NULL pointer dereference in libc.so.6 IFUNC due to
+ uninitialized GOT
+ [20033] math: [x86_64] vectorized math function don't call the __finite
+ versions
+ [20116] nptl: use after free in pthread_create
+ [20181] stdio: open_memstream(): writes not at end of stream corrupt data
+ [20292] dynamic-link: Comparison in elf/dl-open.c _dl_addr_inside_object
+ is always true.
+ [20311] nptl: please install proc_service.h
+ [20366] libc: Compilation errors in installed headers in strict-compliance
+ modes
+ [20370] malloc: malloc: Arena free list management is still racy
+ (incorrect fix in bug 19243)
+ [20386] libc: assert (X = 0) does not result in GCC warning
+ [20432] malloc: malloc: Minimize interface required for interposition
+ [20435] libc: Missing unwind info in __startcontext causes infinite loop
+ in _Unwind_Backtrace (CVE-2016-6323)
+ [20444] hurd: recvmsg: PF_LOCAL sockets and msg_name lead to SIGLOST
+ [20452] nptl: Addition of sysdep.o to libpthread.a breaks relinking
+ libpthread.a
+ [20455] math: [powerpc] fesetexceptflag fails to clear FE_INVALID
+ [20459] localedata: et_EE: locale has wrong {p,n}_cs_precedes value
+ [20477] network: resolv: incorrect double-checked locking related to
+ _res_hconf
+ [20478] libc: libc_ifunc macro and similar usages leads to false debug-
+ information.
+ [20495] math: x86_64 performance degradation due to AVX/SSE transition
+ penalty
+ [20497] localedata: lt_LT: LC_TIME d_fmt used is obsolete
+ [20508] dynamic-link: _dl_runtime_resolve_avx/_dl_runtime_profile_avx512
+ cause transition penalty
+ [20517] math: sparcv9 missing fdiml compat symbol
+ [20524] manual: strverscmp is inconsistent
+ [20525] libc: <sys/quota.h> should be based on kernel headers
+ [20539] math: GCC 7 -static -lm fails to link at -O3
+ [20554] libc: ld: bss-plt forced due to /usr/lib/libc_nonshared.a(ppc-
+ mcount.oS)
+ [20558] string: POSIX bcopy/bzero decls do not implement Object Size
+ Checking
+ [20591] network: Remove obsolete DNSSEC support
+ [20592] network: DNS resource record type classification macros in
+ <arpa/nameser.h> are incorrect
+ [20593] network: Update DNS RR type definitions
+ [20611] network: getaddrinfo accepts invalid numeric scope IDs
+ [20615] build: glibc build fails when using --with-cpu=power9 --enable-
+ multi-arch
+ [20629] network: libresolv: Remove support for bitstring labels
+ (RES_USEBSTRING)
+ [20647] libc: GLIBC quitting every program - glibc on Pentium-S leads to
+ assertion: "maxidx >= 2"
+ [20660] math: [arm] Use VSQRT
+ [20662] libc: checking whether x86_64-pc-linux-gnu-gcc implicitly enables
+ -fstack-protector no (32bit gcc 6.2.0 pie and ssp enable)
+ [20689] libc: Test for FMA should also check for AVX.
+ [20707] glob: gl_pathv entries not set to NULL with GLOB_DOOFFS
+ [20715] math: iszero macro breaks existing code
+ [20718] math: [powerpc] copysignl raises "invalid" for sNaN
+ [20728] libc: powerpc: Missing TOC stub in clone
+ [20729] build: glibc-2.24 fails to build for i486 with -Os
+ [20750] build: Build fails with default PIE enabled gcc-6.x
+ [20768] math: [alpha] sqrt fegetenv namespace
+ [20785] libc: binutils 2.28 fails to assemble power6/memset.S file in
+ glibc
+ [20787] math: float_t is defined as float incorrectly on x86_64 even if
+ __FLT_EVAL_METHOD__ is 2
+ [20790] network: rpcgen buffer overrun in get_prog_declaration
+ [20822] nptl: race condition in __lll_unlock_elision on powerpc
+ [20829] libc: crypt snprintf namespace
+ [20847] libc: tst-vfork3 failure
+ [20855] math: Default bits/mathdef.h has inappropriate float_t
+ [20859] math: [sh4] FP_ILOGB0 invalid
+ [20864] localedata: iconv: cp936 missing single-byte euro sign (0x80,
+ U+20AC), not same as GBK
+ [20915] dynamic-link: global-dynamic TLS broken on aarch64
+ [20916] math: pow handling of sNaN arguments
+ [20918] build: Building with --enable-nss-crypt fails tst-linkall-static.
+ [20919] math: Bad pow (qNaN, 0) result with -lieee
+ [20940] math: hypot sNaN handling
+ [20947] math: fmax, fmin sNaN handling
+ [20956] libc: debug/tst-backtrace3-6 don't work with -O3 anymore
+ [20964] network: sunrpc: Stack-based buffer overflow in getrpcport with
+ RES_USE_INET6
+ [20971] string: powerpc64/power7 memchr overflows internal pointer check
+ [20973] nptl: robust mutexes: Lost wake-ups
+ [20974] locale: bs_BA: yesexpr/noexpr regexes accept any character
+ [20978] nis: strlen on null pointer in nss_nisplus
+ [20985] nptl: robust mutexes: lowlevelrobustlock assembly on x86 blocks on
+ wrong condition
+ [21014] string: i686 memchr overflows internal pointer check
+ [21019] libc: [mips] n32 lseek incorrect on overflow
+ [21022] libc: [microblaze] __backtrace get_frame_size namespace
+ [21026] libc: [MIPS] readahead syscall is broken on n64
+ [21028] math: Fallback fesetexceptflag should always succeed
+ [21045] libc: [powerpc-nofpu] swapcontext does not restore signal mask
+ [21047] math: arm: fpu_control.h: _FPU_GETCW/_FPU_SETCW is rejected by
+ clang
+ [21053] libc: [SH] Namespace pollution from sys/ucontext.h
+ [21061] librt: [microblaze] librt lost clock_* exports
+ [21073] libc: tunables: insecure environment variables passed to
+ subprocesses with AT_SECURE
+ [21081] string: Missing vzeroupper in memset-vec-unaligned-erms.S
+
+Version 2.24
+
+* The minimum Linux kernel version that this version of the GNU C Library
+ can be used with is 3.2, except on i[4567]86 and x86_64, where Linux
+ kernel version 2.6.32 or later suffices (on architectures that already
+ required kernel versions more recent than 3.2, those requirements remain
+ unchanged). Linux 3.2 or later kernel headers are required on all
+ architectures.
+
+* The pap_AN locale has been deleted. This has been deprecated for a long
+ time. It has been replaced by pap_AW & pap_CW, both of which have long
+ been included in previous releases.
+
+* The readdir_r and readdir64_r functions have been deprecated. It is
+ recommended to use readdir and readdir64 instead.
+
+* The type “union wait” has been removed. It was deprecated in the early
+ 1990s and never part of POSIX. Application code should use the int type
+ instead of “union wait”.
+
+* A new NSS action is added to facilitate large distributed system
+ administration. The action, MERGE, allows remote user stores like LDAP
+ to be merged into local user stores like /etc/groups in order to provide
+ easy to use, updated, and managed sets of merged credentials. The new
+ action can be used by configuring it in /etc/nsswitch.conf:
+ group: files [SUCCESS=merge] nis
+ Implemented by Stephen Gallagher (Red Hat).
+
+* The deprecated __malloc_initialize_hook variable has been removed from the
+ API.
+
+* The long unused localedef --old-style option has been removed. It hasn't
+ done anything in over 16 years. Scripts using this option can safely
+ drop it.
+
+* nextupl, nextup, nextupf, nextdownl, nextdown and nextdownf are added to
+ libm. They are defined by TS 18661 and IEEE754-2008. The nextup functions
+ return the next representable value in the direction of positive infinity
+ and the nextdown functions return the next representable value in the
+ direction of negative infinity. These are currently enabled as GNU
+ extensions.
+
+Security related changes:
+
+* An unnecessary stack copy in _nss_dns_getnetbyname_r was removed. It
+ could result in a stack overflow when getnetbyname was called with an
+ overly long name. (CVE-2016-3075)
+
+* Previously, getaddrinfo copied large amounts of address data to the stack,
+ even after the fix for CVE-2013-4458 has been applied, potentially
+ resulting in a stack overflow. getaddrinfo now uses a heap allocation
+ instead. Reported by Michael Petlan. (CVE-2016-3706)
+
+* The glob function suffered from a stack-based buffer overflow when it was
+ called with the GLOB_ALTDIRFUNC flag and encountered a long file name.
+ Reported by Alexander Cherepanov. (CVE-2016-1234)
+
+* The Sun RPC UDP client could exhaust all available stack space when
+ flooded with crafted ICMP and UDP messages. Reported by Aldy Hernandez'
+ alloca plugin for GCC. (CVE-2016-4429)
+
+* The IPv6 name server management code in libresolv could result in a memory
+ leak for each thread which is created, performs a failing naming lookup,
+ and exits. Over time, this could result in a denial of service due to
+ memory exhaustion. Reported by Matthias Schiffer. (CVE-2016-5417)
+
+The following bugs are resolved with this release:
+
+ [1170] localedata: ne_NP: update Nepali locale definition file
+ [3629] manual: stpcpy description in string.texi refers to MS-DOG instead
+ of MS-DOS.
+ [6527] malloc: [powerpc] Malloc alignment insufficient for PowerPC
+ [6796] math: fdim() does not set errno on overflow
+ [10354] libc: posix_spawn should use vfork() in more cases than presently
+ [11213] localedata: localedata: add copyright disclaimer to locale files
+ [12143] localedata: chr_US: new Cherokee locale
+ [12450] localedata: sgs_LT: new locale
+ [12676] localedata: ln_CD: new locale
+ [13237] localedata: LC_ADDRESS.country_name: update all locales w/latest
+ CLDR data
+ [13304] math: fma, fmaf, fmal produce wrong results
+ [14259] build: --localedir arg to configure is ignored
+ [14499] nptl: Does posix_spawn invoke atfork handlers / use vfork?
+ [14750] libc: Race condition in posix_spawn vfork usage vs signal handlers
+ [14934] localedata: es_CL: wrong first weekday chilean locale
+ [15262] localedata: LC_MESSAGES.yesexpr/noexpr: inconsistent use of
+ romanisation
+ [15263] localedata: LC_MESSAGES.yesexpr/noexpr: inconsistent use of 1/0
+ and +/-
+ [15264] localedata: LC_MESSAGES.yesstr/nostr: lacking in many locales
+ [15368] nptl: raise() is not async-signal-safe
+ [15479] math: ceil, floor, round and trunc raise inexact exception
+ [15578] localedata: kk_KZ: various updates
+ [16003] localedata: pap_AN: punt old locale
+ [16137] localedata: iw_IL: punt old locale
+ [16190] localedata: eo: new esperanto locale
+ [16374] localedata: lv_LV: change currency symbol in LC_MONETARY to euro
+ [16742] malloc: race condition: pthread_atfork() called before first
+ malloc() results in unexpected locking behaviour/deadlocks
+ [16975] localedata: LC_MESSAGES.yesexpr/noexpr: revisit capitalization in
+ all locales
+ [16983] localedata: postal_fmt does not allow %l and %n modifiers
+ [17565] localedata: pt_PT: wrong (work-)week start
+ [17899] math: [powerpc] floorl returns negative zero with FE_DOWNWARD
+ [17950] build: Build fails with -msse
+ [18205] localedata: be_BY*: wrong first_weekday and first_workday
+ [18433] libc: posix_spawn does not return correctly upon failure to
+ execute
+ [18453] localedata: charmaps/IBM875: incorrect codes
+ [18712] string: bits/string2.h incompatible with -O2 -Werror=packed
+ -Wsystem-headers
+ [18896] localedata: he_IL: improvements for currency
+ [18911] localedata: ro_RO: Correcting week day name for "Tuesday" in
+ Romanian locale data
+ [18960] locale: s390: _nl_locale_subfreeres uses larl opcode on misaligned
+ symbol
+ [19056] libc: Deprecate readdir_r
+ [19133] localedata: pt_*: days & months should be lowercase in Portuguese
+ language
+ [19198] localedata: nl_NL: small improvements for Dutch locales
+ [19257] network: Per-thread memory leak in __res_vinit with IPv6
+ nameservers (CVE-2016-5417)
+ [19269] build: tst-audit4 and tst-audit10 failures with gcc-6 on non avx
+ machine
+ [19400] locale: Language missing in "iso-639.def", trivial fix in
+ description
+ [19431] malloc: Deadlock between fflush, getdelim, and fork
+ [19505] libc: Incorrect file descriptor validity checks in
+ posix_spawn_file_actions_add{open,close,dup2}
+ [19509] dynamic-link: dlsym, dlvsym do not report errors through dlerror
+ when using RTLD_NEXT
+ [19512] locale: Stale `#ifndef HAVE_BUILTIN_EXPECT' in
+ `intl/{gettextP,loadinfo}.h'
+ [19534] libc: execle, execlp may use malloc
+ [19568] localedata: *_CH: Swiss locales have inconsistent start of week
+ [19573] network: res_nclose and __res_maybe_init disagree about name
+ server initialization, breaking Hesiod
+ [19575] localedata: Status of GB18030 tables
+ [19581] localedata: sr_* date_fmt string contains additional newline
+ [19583] string: SSSE3_Fast_Copy_Backward flag needs to be enabled for AMD
+ Excavator core
+ [19592] math: [ldbl-128ibm] ceill incorrect in non-default rounding modes
+ [19593] math: [ldbl-128ibm] truncl incorrect in non-default rounding modes
+ [19594] math: [ldbl-128ibm] roundl incorrect in non-default rounding modes
+ [19595] math: [ldbl-128ibm] fmodl incorrect for results in subnormal
+ double range
+ [19602] math: [ldbl-128ibm] fmodl handling of equal arguments with low
+ part zero incorrect
+ [19603] math: [ldbl-128ibm] remainderl, remquol incorrect sign handling in
+ equality tests
+ [19610] dynamic-link: ldconfig -X removes stale symbolic links
+ [19613] libc: s390x (64 bit) macro expansion WCOREDUMP and others
+ [19633] locale: strfmon_l applies global locale to number formatting
+ [19642] network: Memory leak in getnameinfo
+ [19648] libc: test-skeleton.c: Do not set RLIMIT_DATA
+ [19653] libc: Potential for NULL pointer dereference (CWE-476) in
+ glibc-2.22
+ [19654] math: [x86_64] Need testcase for BZ #19590 fix
+ [19671] localedata: Missing Sanity Check for malloc() in 'tst-fmon.c' &
+ 'tst-numeric.c'
+ [19674] math: [ldbl-128ibm] powl incorrect overflow handling
+ [19677] math: [ldbl-128ibm] remainderl equality test incorrect for zero
+ low part
+ [19678] math: [ldbl-128ibm] nextafterl, nexttowardl incorrect sign of zero
+ result
+ [19679] dynamic-link: gcc-4.9.3 C++ exception handling broken due to
+ unaligned stack
+ [19726] locale: Converting UCS4LE to INTERNAL with iconv() does not update
+ pointers and lengths in error-case.
+ [19727] locale: Converting from/to UTF-xx with iconv() does not always
+ report errors on UTF-16 surrogates values.
+ [19755] nscd: nscd assertion failure in gc
+ [19758] dynamic-link: Typo in EXTRA_LD_ENVVARS for x86-64
+ [19759] libc: mempcpy shouldn't be inlined
+ [19762] dynamic-link: HAS_CPU_FEATURE/HAS_ARCH_FEATURE are easy to misuse
+ [19765] libc: s390 needs an optimized mempcpy
+ [19779] glob: glob: buffer overflow with GLOB_ALTDIRFUNC due to incorrect
+ NAME_MAX limit assumption (CVE-2016-1234)
+ [19783] build: benchtests don't support --enable-hardcoded-path-in-tests
+ [19787] network: Missing and incorrect truncation checks in getnameinfo
+ [19790] math: [ldbl-128ibm] nearbyintl incorrect in non-default rounding
+ modes
+ [19791] network: Assertion failure in res_query.c with un-connectable name
+ server addresses
+ [19792] libc: MIPS: backtrace yields infinite backtrace with makecontext
+ [19822] math: libm.so install clobbers old version
+ [19825] network: resolv: send_vc can return uninitialized data in second
+ response to getaddrinfo
+ [19830] network: nss_dns: should check RDATA length against buffer length
+ [19831] network: nss_dns: getaddrinfo returns uninitialized data when
+ confronted with A/AAAA records of invalid size
+ [19837] nss: nss_db: No retries for some long lines with a larger buffer
+ [19848] math: powl(10,n) for n=-4,-5,-6,-7 is off by more than 1 ULP
+ [19853] stdio: Printing IBM long double in decimal with high precision is
+ sometimes incorrect
+ [19860] build: x86_64: compile errors for tst-audit10 and tst-auditmod10b
+ [19861] nptl: libpthread IFUNC resolver for fork can lead to crash
+ [19862] network: resolv, nss_dns: Remove remaining logging of unexpected
+ record types
+ [19865] network: Assertion failure or memory leak in
+ _nss_dns_getcanonname_r
+ [19868] network: nss_dns: netent code does not skip over non-PTR records
+ [19879] network: nss_dns: Stack overflow in getnetbyname implementation
+ (CVE-2016-3075)
+ [19881] string: Improve x86-64 memset
+ [19907] string: Incorrect memcpy tests
+ [19916] dynamic-link: S390: fprs/vrs are not saved/restored while
+ resolving symbols
+ [19925] libc: termios.h XCASE namespace
+ [19928] string: memmove-vec-unaligned-erms.S is slow with large data size
+ [19929] libc: limits.h NL_NMAX namespace
+ [19931] stdio: Memory leak in vfprintf
+ [19957] libc: clone(CLONE_VM) access invalid parent memory
+ [19963] localedata: en_IL: New locale
+ [19989] stdio: stdio.h cuserid namespace
+ [19994] network: getaddrinfo does not restore RES_USE_INET6 flag in
+ gethosts
+ [19996] locale: langinfo.h nl_langinfo_l namespace
+ [20005] stdio: fflush on a file opened with fmemopen resets position to 0
+ [20010] network: getaddrinfo: Stack overflow in hostent translation
+ (CVE-2016-3706)
+ [20012] stdio: libio: fmemopen append mode failure
+ [20014] stdio: stdio.h namespace for pre-threads POSIX
+ [20017] network: resolv: Use gmtime_r instead of gmtime in p_secstodate
+ [20023] libc: fcntl.h timespec namespace
+ [20024] math: [x86_64] vectorized sincos trashes the stack
+ [20031] network: nss_hesiod: Heap overflow in get_txt_records
+ [20041] time: sys/time.h timespec namespace
+ [20043] libc: unistd.h missing cuserid for UNIX98 and before
+ [20044] libc: unistd.h missing pthread_atfork for UNIX98
+ [20051] libc: ttyslot in wrong header under wrong conditions
+ [20054] libc: gethostname not declared for XPG4
+ [20055] libc: termios.h missing tcgetsid for XPG4
+ [20072] dynamic-link: x86 init_cpu_features is called twice in static
+ executable
+ [20073] libc: sys/stat.h fchmod namespace
+ [20074] libc: stdlib.h rand_r namespace
+ [20076] libc: sys/stat.h missing S_IFSOCK, S_ISSOCK for XPG4
+ [20094] libc: stdlib.h should not declare grantpt, ptsname, unlockpt for
+ XPG3
+ [20111] libc: struct sockaddr_storage cannot be aggregate-copied
+ [20112] network: sunrpc: stack (frame) overflow in Sun RPC clntudp_call
+ (CVE-2016-4429)
+ [20115] string: Extra alignment in memset-vec-unaligned-erms.S
+ [20119] libc: Wrong mask for processors level type from CPUID
+ [20139] dynamic-link: Upper part of zmm is zeroed if Glibc is built with
+ AS not supporting AVX512
+ [20151] math: [ldbl-128/ldbl-128ibm] j0l, j1l, y0l, y1l return sNaN for
+ sNaN argument
+ [20153] math: [ldbl-128ibm] sqrtl (sNaN) returns sNaN
+ [20156] math: [ldbl-128ibm] ceill, rintl etc. return sNaN for sNaN
+ argument
+ [20157] math: [powerpc] fabsl (sNaN) wrongly raises "invalid"
+ [20160] math: [powerpc] ceil, rint etc. return sNaN for sNaN input
+ [20178] libc: posix_spawn{p} should not call exit
+ [20191] stdio: libio: vtables hardening
+ [20195] string: FMA4 detection requires CPUID execution with register
+ eax=0x80000001
+ [20198] libc: quick_exit incorrectly destroys C++11 thread objects.
+ [20205] math: [i386/x86_64] nextafterl incorrect incrementing negative
+ subnormals
+ [20212] math: acos (sNaN) returns sNaN
+ [20213] math: asin (sNaN) returns sNaN
+ [20214] network: Linux header sync with linux/in6.h and ipv6.h again.
+ [20218] math: [i386] asinhl (sNaN) returns sNaN
+ [20219] math: [i386] atanhl (sNaN) returns sNaN
+ [20222] stdio: fopencookie: Mangle function pointers
+ [20224] math: [i386] cbrtl (sNaN) returns sNaN
+ [20225] math: ldexp, scalbn, scalbln return sNaN for sNaN input
+ [20226] math: [i386/x86_64] expl, exp10l, expm1l return sNaN for sNaN
+ input
+ [20227] math: [i386/x86_64] logl (sNaN) returns sNaN
+ [20228] math: [i386/x86_64] log10l (sNaN) returns sNaN
+ [20229] math: [i386/x86_64] log1pl (sNaN) returns sNaN
+ [20232] math: [ldbl-128] expm1l (sNaN) returns sNaN
+ [20233] math: [ldbl-128ibm] expm1l (sNaN) returns sNaN
+ [20234] math: [ldbl-128ibm] log1pl (sNaN) returns sNaN
+ [20235] math: [i386/x86_64] log2l (sNaN) returns sNaN
+ [20237] nss: nss_db: get*ent segfaults without preceding set*ent
+ [20240] math: modf (sNaN) returns sNaN
+ [20248] libc: debug/tst-longjump_chk2 calls printf from a signal handler
+ [20250] math: frexp (sNaN) returns sNaN
+ [20252] math: atan2 (sNaN, qNaN) fails to raise "invalid"
+ [20255] math: [i386] fdim, fdimf return with excess range and precision /
+ double rounding
+ [20256] math: [i386/x86_64] fdiml returns sNaN for sNaN input
+ [20260] string: ../sysdeps/x86/bits/string.h:1092:3: error: array
+ subscript is below array bounds [-Werror=array-bounds]
+ [20262] nis: _nss_nis_initgroups_dyn always returns NSS_STATUS_NOTFOUND
+ [20263] nptl: robust mutex deadlocks if other thread requests timedlock
+ (Only arm/linux)
+ [20277] libc: $dp is not initialized correctly in sysdeps/hppa/start.S
+ [20284] malloc: malloc: Corrupt arena avoidance causes unnecessary mmap
+ fallbacks
+ [20296] math: [i386/x86_64] scalbl returns sNaN for sNaN input, missing
+ "invalid" exceptions
+ [20314] nptl: make[4]: *** [/usr/include/stdlib.h] Error 1
+ [20316] localedata: id_ID: Februari instead of Pebruari
+ [20327] string: POWER8 strcasecmp returns incorrect result
+ [20347] math: Failure: Test: j0_downward (0xap+0)
+ [20348] libc: FAIL: misc/tst-preadvwritev64
+ [20349] libc: 64-bit value is passed differently in p{readv,writev}{64}
+ [20350] libc: There is no test for p{read,write}64
+ [20357] math: Incorrect cos result for 1.5174239687223976
+ [20384] build: Don't run libmvec-sincos-avx* tests on non avx machines
+
+Version 2.23
+
+* Unicode 8.0.0 Support: Character encoding, character type info, and
+ transliteration tables are all updated to Unicode 8.0.0, using new
+ and/or improved generator scripts contributed by Mike FABIAN (Red Hat).
+ These updates cause user visible changes, such as the fixes for bugs
+ 89, 16061, and 18568.
+
+* sched_setaffinity, pthread_setaffinity_np no longer attempt to guess the
+ kernel-internal CPU set size. This means that requests that change the
+ CPU affinity which failed before (for example, an all-ones CPU mask) will
+ now succeed. Applications that need to determine the effective CPU
+ affinities need to call sched_getaffinity or pthread_getaffinity_np after
+ setting it because the kernel can adjust it (and the previous size check
+ would not detect this in the majority of cases).
+
+* The fts.h header can now be used with -D_FILE_OFFSET_BITS=64. With LFS
+ the following new symbols are used: fts64_children, fts64_close,
+ fts64_open, fts64_read and fts64_set.
+
+* getaddrinfo now detects certain invalid responses on an internal netlink
+ socket. If such responses are received, an affected process will
+ terminate with an error message of "Unexpected error <number> on netlink
+ descriptor <number>" or "Unexpected netlink response of size <number> on
+ descriptor <number>". The most likely cause for these errors is a
+ multi-threaded application which erroneously closes and reuses the netlink
+ file descriptor while it is used by getaddrinfo.
+
+* A defect in the malloc implementation, present since glibc 2.15 (2012) or
+ glibc 2.10 via --enable-experimental-malloc (2009), could result in the
+ unnecessary serialization of memory allocation requests across threads.
+ The defect is now corrected. Users should see a substantial increase in
+ the concurent throughput of allocation requests for applications which
+ trigger this bug. Affected applications typically create and
+ destroy threads frequently. (Bug 19048 was reported and analyzed by
+ Ericsson.)
+
+* There is now a --disable-timezone-tools configure option for disabling the
+ building and installing of the timezone related utilities (zic, zdump, and
+ tzselect). This is useful for people who build the timezone data and code
+ independent of the GNU C Library.
+
+* The obsolete header <regexp.h> has been removed. Programs that require
+ this header must be updated to use <regex.h> instead.
+
+* The obsolete functions bdflush, create_module, get_kernel_syms,
+ query_module and uselib are no longer available to newly linked binaries;
+ the header <sys/kdaemon.h> has been removed. These functions and header
+ were specific to systems using the Linux kernel and could not usefully be
+ used with the GNU C Library on systems with version 2.6 or later of the
+ Linux kernel.
+
+* Optimized string, wcsmbs and memory functions for IBM z13.
+ Implemented by Stefan Liebler.
+
+* Newly linked programs that define a variable called signgam will no longer
+ have it set by the lgamma, lgammaf and lgammal functions. Programs that
+ require signgam to be set by those functions must ensure that they use the
+ variable provided by the GNU C Library and declared in <math.h>, without
+ defining their own copy.
+
+* The minimum GCC version that can be used to build this version of the GNU
+ C Library is GCC 4.7. Older GCC versions, and non-GNU compilers, can
+ still be used to compile programs using the GNU C Library.
+
+Security related changes:
+
+* An out-of-bounds value in a broken-out struct tm argument to strftime no
+ longer causes a crash. Reported by Adam Nielsen. (CVE-2015-8776)
+
+* The LD_POINTER_GUARD environment variable can no longer be used to disable
+ the pointer guard feature. It is always enabled. Previously,
+ LD_POINTER_GUARD could be used to disable security hardening in binaries
+ running in privileged AT_SECURE mode. Reported by Hector Marco-Gisbert.
+ (CVE-2015-8777)
+
+* An integer overflow in hcreate and hcreate_r could lead to an
+ out-of-bounds memory access. Reported by Szabolcs Nagy. (CVE-2015-8778)
+
+* The catopen function no longer has unbounded stack usage. Reported by
+ Max. (CVE-2015-8779)
+
+* The nan, nanf and nanl functions no longer have unbounded stack usage
+ depending on the length of the string passed as an argument to the
+ functions. Reported by Joseph Myers. (CVE-2014-9761)
+
+* A stack-based buffer overflow was found in libresolv when invoked from
+ libnss_dns, allowing specially crafted DNS responses to seize control
+ of execution flow in the DNS client. The buffer overflow occurs in
+ the functions send_dg (send datagram) and send_vc (send TCP) for the
+ NSS module libnss_dns.so.2 when calling getaddrinfo with AF_UNSPEC
+ family. The use of AF_UNSPEC triggers the low-level resolver code to
+ send out two parallel queries for A and AAAA. A mismanagement of the
+ buffers used for those queries could result in the response of a query
+ writing beyond the alloca allocated buffer created by
+ _nss_dns_gethostbyname4_r. Buffer management is simplified to remove
+ the overflow. Thanks to the Google Security Team and Red Hat for
+ reporting the security impact of this issue, and Robert Holiday of
+ Ciena for reporting the related bug 18665. (CVE-2015-7547)
+
+The following bugs are resolved with this release:
+
+ [89] localedata: Locales nb_NO and nn_NO should transliterate æøå
+ [887] math: Math library function "logb" and "nextafter" inconsistent
+ [2542] math: Incorrect return from float gamma (-0X1.FA471547C2FE5P+1)
+ [2543] math: Incorrect return from float gamma (-0X1.9260DCP+1)
+ [2558] math: Incorrect return from double gamma (-0X1.FA471547C2FE5P+1)
+ [2898] libc: [improve] warning: the use of `mktemp' is dangerous, better
+ use `mkstemp'
+ [4404] localedata: German translation of "Alarm clock" is misleading
+ [6799] math: nextafter() and nexttoward() doen't set errno on
+ overflow/underflow errors
+ [6803] math: scalb(), scalbln(), scalbn() do not set errno on
+ overflow/underflow
+ [10432] nis: _nss_nis_setnetgrent assertion failure
+ [11460] libc: fts has no LFS support
+ [12926] network: getaddrinfo()/make_request() may spin forever
+ [13065] nptl: Race condition in pthread barriers
+ [13690] nptl: pthread_mutex_unlock potentially cause invalid access
+ [14341] dynamic-link: Dynamic linker crash when DT_JMPREL and DT_REL{,A}
+ are not contiguous
+ [14551] math: [ldbl-128ibm] strtold overflow handling for IBM long double
+ [14912] libc: Rename non-installed bits/*.h headers
+ [15002] libc: Avoid undefined behavior in posix_fallocate overflow check
+ [15367] math: Let gcc use __builtin_isinf
+ [15384] math: One constant fewer in ieee754/dbl-64/wordsize-64/s_finite.c
+ [15421] math: lgamma wrongly sets signgam for ISO C
+ [15470] math: [arm] On ARM llrintl() and llroundl() do not raise
+ FE_INVALID with argument out of range
+ [15491] math: [i386/x86_64] x86 nearbyint implementations wrongly clear
+ all exceptions
+ [15786] dynamic-link: ifunc resolver functions can smash function
+ arguments
+ [15918] math: Unnecessary check for equality in hypotf()
+ [16061] localedata: Review / update transliteration data
+ [16068] math: [i386/x86_64] x86 and x86_64 fesetenv exclude state they
+ should include
+ [16141] time: strptime %z offset restriction
+ [16171] math: drem should be alias of remainder
+ [16296] math: fegetround is pure?
+ [16347] math: [ldbl-128ibm] ldbl-128/e_lgammal_r.c may not be suitable.
+ [16364] libc: sleep may leave SIGCHLD blocked on sync cancellation on
+ GNU/Linux
+ [16399] math: [mips] lrint / llrint / lround / llround missing exceptions
+ [16415] math: Clean up ldbl-128 / ldbl-128ibm expm1l for large positive
+ arguments
+ [16422] math: [powerpc] math-float, math-double failing llrint tests with
+ "Exception "Inexact" set" on ppc32
+ [16495] localedata: nl_NL: date_fmt: shuffle year/month around
+ [16517] math: Missing underflow exception from tanf/tan/tanl
+ [16519] math: Missing underflow exception from sinhf
+ [16520] math: Missing underflow exception from tanhf
+ [16521] math: Missing underflow exception from exp2
+ [16620] math: [ldbl-128ibm] exp10l spurious overflows / bad directed
+ rounding results
+ [16734] stdio: fopen calls mmap to allocate its buffer
+ [16961] math: nan function incorrect handling of bad sequences
+ [16962] math: nan function unbounded stack allocation (CVE-2014-9761)
+ [16973] localedata: Fix lang_lib/lang_term as per ISO 639-2
+ [16985] locale: localedef: confusing error message when opening output
+ fails
+ [17118] math: ctanh(INFINITY + 2 * I) returns incorrect value
+ [17197] locale: Redundant shift character in iconv conversion output at
+ block boundary
+ [17243] libc: trunk/posix/execl.c:53: va_args problem ?
+ [17244] libc: trunk/sysdeps/unix/sysv/linux/semctl.c:116: va_args muxup ?
+ [17250] dynamic-link: static linking breaks nss loading
+ (getaddrinfo/getpwnam/etc...)
+ [17404] libc: atomic_exchange_rel lacking a barrier on MIPS16, GCC before
+ 4.7?
+ [17441] math: isnan() should use __builtin_isnan() in GCC
+ [17514] nptl: Assert failure unlocking ERRORCHECK mutex after timedlock
+ (related to lock elision)
+ [17787] manual: Exponent on page 324 of the PDF ends prematurely
+ [17886] time: strptime should be able to parse "Z" as a timezone with %z
+ [17887] time: strptime should be able to parse "+01:00" style timezones
+ [17905] libc: catopen() Multiple unbounded stack allocations
+ (CVE-2015-8779)
+ [18084] libc: backtrace (..., 0) dumps core on x86
+ [18086] libc: nice() sets errno to 0 on success
+ [18240] libc: hcreate, hcreate_r should fail with ENOMEM if element count
+ is too large (CVE-2015-8778)
+ [18251] dynamic-link: SONAME missing when audit modules provides path
+ [18265] libc: add attributes for wchar string and memory functions
+ [18370] math: csqrt missing underflows
+ [18421] libc: [hppa] read-only segment has dynamic relocations
+ [18472] libc: Obsolete syscall wrappers should be compat symbols
+ [18480] libc: hppa glibc miscompilation in sched_setaffinity()
+ [18491] localedata: Update tr_TR LC_CTYPE as part of Unicode updates
+ [18525] localedata: Remove locale timezone information
+ [18560] libc: [powerpc] spurious bits/ipc.h definitions
+ [18568] localedata: Update locale data to Unicode 8.0
+ [18589] locale: sort-test.sh fails at random
+ [18595] math: ctan, ctanh missing underflows
+ [18604] libc: assert macro-expands its argument
+ [18610] math: S390: fetestexcept() reports any exception if DXC-code
+ contains a vector instruction exception.
+ [18611] math: j1, jn missing errno setting on underflow
+ [18618] localedata: sync Chechen locale definitions with other *_RU
+ locales
+ [18647] math: powf(-0x1.000002p0, 0x1p30) returns 0 instead of +inf
+ [18661] libc: Some x86-64 assembly codes don't align stack to 16 bytes
+ [18665] network: In send_dg, the recvfrom function is NOT always using the
+ buffer size of a newly created buffer (CVE-2015-7547)
+ [18674] libc: [i386] trunk/sysdeps/i386/tst-auditmod3b.c:84: possible
+ missing break ?
+ [18675] libc: fpathconf(_PC_NAME_MAX) fails against large filesystems for
+ 32bit processes
+ [18681] libc: regexp.h is obsolete and buggy, and should be desupported
+ [18699] math: tilegx cproj() for various complex infinities does not yield
+ infinity
+ [18724] libc: Harden put*ent functions against data injection
+ [18743] nptl: PowerPC: findutils testcase fails with --enable-lock-elision
+ [18755] build: build errors with -DNDEBUG
+ [18757] stdio: fmemopen fails to set errno on failure
+ [18778] dynamic-link: ld.so crashes if failed dlopen causes libpthread to
+ be forced unloaded
+ [18781] libc: openat64 lacks O_LARGEFILE
+ [18787] libc: [hppa] sysdeps/unix/sysv/linux/hppa/bits/atomic.h:71:6:
+ error: can’t find a register in class ‘R1_REGS’ while reloading ‘asm’
+ [18789] math: [ldbl-128ibm] sinhl inaccurate near 0
+ [18790] math: [ldbl-128ibm] tanhl inaccurate
+ [18795] libc: stpncpy fortification misses buffer lengths that are
+ statically too large
+ [18796] build: build fails for --disable-mathvec
+ [18803] math: hypot missing underflows
+ [18820] stdio: fmemopen may leak memory on failure
+ [18823] math: csqrt spurious underflows
+ [18824] math: fma spurious underflows
+ [18825] math: pow missing underflows
+ [18857] math: [ldbl-128ibm] nearbyintl wrongly uses signaling comparisons
+ [18868] nptl: pthread_barrier_init typo has in-theory-undefined behavior
+ [18870] build: sem_open.c fails to compile with missing symbol
+ FUTEX_SHARED
+ [18872] stdio: Fix memory leak in printf_positional
+ [18873] libc: posix_fallocate overflow check ineffective
+ [18875] math: Excess precision leads incorrect libm
+ [18877] libc: arm: mmap offset regression
+ [18887] libc: memory corruption when using getmntent on blank lines
+ [18918] localedata: hu_HU: change time to HH:MM:SS format
+ [18921] libc: Regression: extraneous stat() and fstat() performed by
+ opendir()
+ [18928] dynamic-link: LD_POINTER_GUARD is not ignored for privileged
+ binaries (CVE-2015-8777)
+ [18951] math: tgamma missing underflows
+ [18952] math: [ldbl-128/ldbl-128ibm] lgammal spurious "invalid", incorrect
+ signgam
+ [18953] localedata: lt_LT: change currency symbol to the euro
+ [18956] math: powf inaccuracy
+ [18961] math: [i386] exp missing underflows
+ [18966] math: [i386] exp10 missing underflows
+ [18967] math: math.h XSI POSIX namespace (gamma, isnan, scalb)
+ [18969] build: multiple string test failures due to missing locale
+ dependencies
+ [18970] libc: Reference of pthread_setcancelstate in libc.a
+ [18977] math: float / long double Bessel functions not in XSI POSIX
+ [18980] math: i386 libm functions return with excess range and precision
+ [18981] math: i386 scalb*, ldexp return with excess range and precision
+ [18982] stdio: va_list and vprintf
+ [18985] time: Passing out of range data to strftime() causes a segfault
+ (CVE-2015-8776)
+ [19003] math: [x86_64] fma4 version of pow inappropriate contraction
+ [19007] libc: FAIL: elf/check-localplt with -z now and binutils 2.26
+ [19012] locale: iconv_open leaks memory on error path
+ [19016] math: clog, clog10 inaccuracy
+ [19018] nptl: Mangle function pointers in tls_dtor_list
+ [19032] math: [i386] acosh (-qNaN) spurious "invalid" exception
+ [19046] math: ldbl-128 / ldbl-128ibm lgamma bad overflow handling
+ [19048] malloc: malloc: arena free list can become cyclic, increasing
+ contention
+ [19049] math: [powerpc] erfc incorrect zero sign
+ [19050] math: [powerpc] log* incorrect zero sign
+ [19058] math: [x86_64] Link fail with -fopenmp and -flto
+ [19059] math: nexttoward overflow incorrect in non-default rounding modes
+ [19071] math: ldbl-96 lroundl incorrect just below powers of 2
+ [19074] network: Data race in _res_hconf_reorder_addrs
+ [19076] math: [ldbl-128ibm] log1pl (-1) wrong sign of infinity
+ [19077] math: [ldbl-128ibm] logl (1) incorrect sign of zero result
+ [19078] math: [ldbl-128ibm] expl overflow incorrect in non-default
+ rounding modes
+ [19079] math: dbl-64/wordsize-64 lround based on llround incorrect for
+ ILP32
+ [19085] math: ldbl-128 lrintl, lroundl missing exceptions for 32-bit long
+ [19086] manual: posix_fallocate64 documented argument order is wrong.
+ [19088] math: lround, llround missing exceptions close to overflow
+ threshold
+ [19094] math: lrint, llrint missing exceptions close to overflow threshold
+ [19095] math: dbl-64 lrint incorrect for 64-bit long
+ [19122] dynamic-link: Unnecessary PLT relocations in librtld.os
+ [19124] dynamic-link: ld.so failed to build with older assmebler
+ [19125] math: [powerpc32] llroundf, llround incorrect exceptions
+ [19129] dynamic-link: [arm] Concurrent lazy TLSDESC resolution can crash
+ [19134] math: [powerpc32] lround, lroundf spurious exceptions
+ [19137] libc: i386/epoll_pwait.S doesn't support cancellation
+ [19143] nptl: Remove CPU set size checking from sched_setaffinity,
+ pthread_setaffinity_np
+ [19156] math: [ldbl-128] j0l spurious underflows
+ [19164] nptl: tst-getcpu fails with many possible CPUs
+ [19168] math: math/test-ildoubl and math/test-ldouble failure
+ [19174] nptl: PowerPC: TLE enabled pthread mutex performs poorly.
+ [19178] dynamic-link: ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA confuses
+ prelink
+ [19181] math: [i386/x86_64] fesetenv (FE_DFL_ENV), fesetenv
+ (FE_NOMASK_ENV) do not clear SSE exceptions
+ [19182] malloc: malloc deadlock between ptmalloc_lock_all and
+ _int_new_arena/reused_arena
+ [19189] math: [ldbl-128] log1pl (-qNaN) spurious "invalid" exception
+ [19201] math: dbl-64 remainder incorrect sign of zero result
+ [19205] math: bits/math-finite.h conditions do not match math.h and
+ bits/mathcalls.h
+ [19209] math: bits/math-finite.h wrongly maps ldexp to scalbn
+ [19211] math: lgamma functions do not set signgam for -ffinite-math-only
+ for C99-based standards
+ [19212] libc: features.h not -Wundef clean
+ [19213] math: [i386/x86_64] log* (1) incorrect zero sign for -ffinite-
+ math-only
+ [19214] libc: Family and model identification for AMD CPU's are incorrect.
+ [19219] libc: GLIBC build fails for ia64 with missing __nearbyintl
+ [19228] math: [powerpc] nearbyint wrongly clears "inexact", leaves traps
+ disabled
+ [19235] math: [powerpc64] lround, lroundf, llround, llroundf spurious
+ "inexact" exceptions
+ [19238] math: [powerpc] round, roundf spurious "inexact" for integer
+ arguments
+ [19242] libc: strtol incorrect in Turkish locales
+ [19243] malloc: reused_arena can pick an arena on the free list, leading
+ to an assertion failure and reference count corruption
+ [19253] time: tzset() ineffective when temporary TZ did not include DST
+ rules
+ [19266] math: strtod ("NAN(I)") incorrect in Turkish locales
+ [19270] math: [hppa] Shared libm missing __isnanl
+ [19285] libc: [hppa] sysdeps/unix/sysv/linux/hppa/bits/mman.h: missing
+ MAP_HUGETLB and MAP_STACK defines
+ [19313] nptl: Wrong __cpu_mask for x32
+ [19347] libc: grantpt: try to force a specific gid even without pt_chown
+ [19349] math: [ldbl-128ibm] tanhl inaccurate for small arguments
+ [19350] math: [ldbl-128ibm] sinhl spurious overflows
+ [19351] math: [ldbl-128ibm] logl inaccurate near 1
+ [19363] time: x32: times() return value wrongly truncates/sign extends
+ from 32bit
+ [19367] dynamic-link: Improve branch prediction on Silvermont
+ [19369] network: Default domain name not reset by res_ninit when "search"
+ / "domain" entry is removed from resolv.conf
+ [19375] math: powerpc: incorrect results for POWER7 logb with negative
+ subnormals
+ [19385] localedata: bg_BG: time separator should be colon, not comma
+ [19408] libc: linux personality syscall wrapper may erroneously return an
+ error on 32-bit architectures
+ [19415] libc: dladdr returns wrong names on hppa
+ [19432] libc: iconv rejects redundant escape sequences in IBM900, IBM903,
+ IBM905, IBM907, and IBM909
+ [19439] math: Unix98 isinf and isnan functions conflict with C++11
+ [19443] build: build failures with -DDEBUG
+ [19451] build: Make check fails on test-double-vlen2
+ [19462] libc: Glibc failed to build with -Os
+ [19465] math: Wrong code with -Os
+ [19466] time: time/tst-mktime2.c is compiled into an infinite loop with
+ -Os
+ [19467] string: Fast_Unaligned_Load needs to be enabled for Excavator core
+ CPU's.
+ [19475] libc: Glibc 2.22 doesn't build on sparc [PATCH]
+ [19486] math: S390: Math tests fail with "Exception Inexact set".
+ [19529] libc: [ARM]: FAIL: stdlib/tst-makecontext
+ [19550] libc: [mips] mmap negative offset handling inconsistent with other
+ architectures
+ [19590] math: Fail to build shared objects that use libmvec.so functions.
+
+Version 2.22
+
+* The following bugs are resolved with this release:
+
+ 438, 2981, 4719, 6544, 6792, 11216, 12836, 13028, 13064, 13151, 13152,
+ 14094, 14113, 14292, 14841, 14906, 14958, 15319, 15467, 15790, 15969,
+ 16159, 16339, 16350, 16351, 16352, 16353, 16361, 16512, 16526, 16538,
+ 16559, 16560, 16704, 16783, 16850, 17053, 17090, 17195, 17269, 17293,
+ 17322, 17403, 17475, 17523, 17542, 17569, 17581, 17588, 17596, 17620,
+ 17621, 17628, 17631, 17692, 17711, 17715, 17776, 17779, 17792, 17833,
+ 17836, 17841, 17912, 17916, 17930, 17932, 17944, 17949, 17964, 17965,
+ 17967, 17969, 17977, 17978, 17987, 17991, 17996, 17998, 17999, 18007,
+ 18019, 18020, 18029, 18030, 18032, 18034, 18036, 18038, 18039, 18042,
+ 18043, 18046, 18047, 18049, 18068, 18078, 18080, 18093, 18100, 18104,
+ 18110, 18111, 18116, 18125, 18128, 18134, 18138, 18185, 18196, 18197,
+ 18206, 18210, 18211, 18217, 18219, 18220, 18221, 18234, 18244, 18245,
+ 18247, 18287, 18319, 18324, 18333, 18346, 18371, 18383, 18397, 18400,
+ 18409, 18410, 18412, 18418, 18422, 18434, 18444, 18457, 18468, 18469,
+ 18470, 18479, 18483, 18495, 18496, 18497, 18498, 18502, 18507, 18508,
+ 18512, 18513, 18519, 18520, 18522, 18527, 18528, 18529, 18530, 18532,
+ 18533, 18534, 18536, 18539, 18540, 18542, 18544, 18545, 18546, 18547,
+ 18549, 18553, 18557, 18558, 18569, 18583, 18585, 18586, 18592, 18593,
+ 18594, 18602, 18612, 18613, 18619, 18633, 18635, 18641, 18643, 18648,
+ 18657, 18676, 18694, 18696, 18887.
+
+* Cache information can be queried via sysconf() function on s390 e.g. with
+ _SC_LEVEL1_ICACHE_SIZE as argument.
+
+* A buffer overflow in gethostbyname_r and related functions performing DNS
+ requests has been fixed. If the NSS functions were called with a
+ misaligned buffer, the buffer length change due to pointer alignment was
+ not taken into account. This could result in application crashes or,
+ potentially arbitrary code execution, using crafted, but syntactically
+ valid DNS responses. (CVE-2015-1781)
+
+* The time zone file parser has been made more robust against crafted time
+ zone files, avoiding heap buffer overflows related to the processing of
+ the tzh_ttisstdcnt and tzh_ttisgmtcnt fields, and a stack overflow due to
+ large time zone data files. Overly long time zone specifiers in the TZ
+ variable no longer result in stack overflows and crashes.
+
+* A powerpc and powerpc64 optimization for TLS, similar to TLS descriptors
+ for LD and GD on x86 and x86-64, has been implemented. You will need
+ binutils-2.24 or later to enable this optimization.
+
+* Character encoding and ctype tables were updated to Unicode 7.0.0, using
+ new generator scripts contributed by Pravin Satpute and Mike FABIAN (Red
+ Hat). These updates cause user visible changes, such as the fix for bug
+ 17998.
+
+* CVE-2014-8121 The NSS backends shared internal state between the getXXent
+ and getXXbyYY NSS calls for the same database, causing a denial-of-service
+ condition in some applications.
+
+* Added vector math library named libmvec with the following vectorized x86_64
+ implementations: cos, cosf, sin, sinf, sincos, sincosf, log, logf, exp, expf,
+ pow, powf.
+ The library can be disabled with --disable-mathvec. Use of the functions is
+ enabled with -fopenmp -ffast-math starting from -O1 for GCC version >= 4.9.0.
+ Shared library libmvec.so is linked in as needed when using -lm (no need to
+ specify -lmvec explicitly for not static builds).
+ Visit <https://sourceware.org/glibc/wiki/libmvec> for detailed information.
+
+* A new fmemopen implementation has been added with the goal of POSIX
+ compliance. The new implementation fixes the following long-standing
+ issues: BZ#6544, BZ#11216, BZ#12836, BZ#13151, BZ#13152, and BZ#14292. The
+ old implementation is still present for use be by existing binaries.
+
+* The 32-bit sparc sigaction ABI was inadvertently broken in the 2.20 and 2.21
+ releases. It has been fixed to match 2.19 and older, but binaries built
+ against 2.20 and 2.21 might need to be recompiled. See BZ#18694.
+
+* Port to Native Client running on ARMv7-A (--host=arm-nacl).
+ Contributed by Roland McGrath (Google).
+
+* The header <regexp.h> is deprecated, and will be removed in a future
+ release. Use of this header will trigger a deprecation warning.
+ Application developers should update their code to use <regex.h> instead.
+
+ This header was formerly part of SUS, but was deprecated in 1994 and
+ removed from the standard in 2001. Also, the glibc implementation
+ leaks memory. See BZ#18681 for more details.
+
+Version 2.21
+
+* The following bugs are resolved with this release:
+
+ 6652, 10672, 12674, 12847, 12926, 13862, 14132, 14138, 14171, 14498,
+ 15215, 15378, 15884, 16009, 16418, 16191, 16469, 16576, 16617, 16618,
+ 16619, 16657, 16740, 16857, 17192, 17266, 17273, 17344, 17363, 17370,
+ 17371, 17411, 17460, 17475, 17485, 17501, 17506, 17508, 17522, 17555,
+ 17570, 17571, 17572, 17573, 17574, 17582, 17583, 17584, 17585, 17589,
+ 17594, 17601, 17608, 17616, 17625, 17630, 17633, 17634, 17635, 17647,
+ 17653, 17657, 17658, 17664, 17665, 17668, 17682, 17702, 17717, 17719,
+ 17722, 17723, 17724, 17725, 17732, 17733, 17744, 17745, 17746, 17747,
+ 17748, 17775, 17777, 17780, 17781, 17782, 17791, 17793, 17796, 17797,
+ 17801, 17803, 17806, 17834, 17844, 17848, 17868, 17869, 17870, 17885,
+ 17892.
+
+* CVE-2015-1472 CVE-2015-1473 Under certain conditions wscanf can allocate
+ too little memory for the to-be-scanned arguments and overflow the
+ allocated buffer. The implementation now correctly computes the required
+ buffer size when using malloc, and switches to malloc from alloca as
+ intended.
+
+* A new semaphore algorithm has been implemented in generic C code for all
+ machines. Previous custom assembly implementations of semaphore were
+ difficult to reason about or ensure that they were safe. The new version
+ of semaphore supports machines with 64-bit or 32-bit atomic operations.
+ The new semaphore algorithm is used by sem_init, sem_open, sem_post,
+ sem_wait, sem_timedwait, sem_trywait, and sem_getvalue.
+
+* Port to Altera Nios II has been contributed by Mentor Graphics.
+
+* Optimized strcpy, stpcpy, strncpy, stpncpy, strcmp, and strncmp
+ implementations for powerpc64/powerpc64le.
+ Implemented by Adhemerval Zanella (IBM).
+
+* Added support for TSX lock elision of pthread mutexes on powerpc32, powerpc64
+ and powerpc64le. This may improve lock scaling of existing programs on
+ HTM capable systems. The lock elision code is only enabled with
+ --enable-lock-elision=yes. Also, the TSX lock elision implementation for
+ powerpc will issue a transaction abort on every syscall to avoid side
+ effects being visible outside transactions.
+
+* Optimized strcpy, stpcpy, strchrnul and strrchr implementations for
+ AArch64. Contributed by ARM Ltd.
+
+* i386 memcpy functions optimized with SSE2 unaligned load/store.
+
+* CVE-2104-7817 The wordexp function could ignore the WRDE_NOCMD flag
+ under certain input conditions resulting in the execution of a shell for
+ command substitution when the application did not request it. The
+ implementation now checks WRDE_NOCMD immediately before executing the
+ shell and returns the error WRDE_CMDSUB as expected.
+
+* CVE-2012-3406 printf-style functions could run into a stack overflow when
+ processing format strings with a large number of format specifiers.
+
+* CVE-2014-9402 The nss_dns implementation of getnetbyname could run into an
+ infinite loop if the DNS response contained a PTR record of an unexpected
+ format.
+
+* The minimum GCC version that can be used to build this version of the GNU
+ C Library is GCC 4.6. Older GCC versions, and non-GNU compilers, can
+ still be used to compile programs using the GNU C Library.
+
+* The GNU C Library is now built with -Werror by default. This can be
+ disabled by configuring with --disable-werror.
+
+* New locales: tu_IN, bh_IN, raj_IN, ce_RU.
+
+* The obsolete sigvec function has been removed. This was the original
+ 4.2BSD interface that inspired the POSIX.1 sigaction interface, which
+ programs have been using instead for about 25 years. Of course, ABI
+ compatibility for old binaries using sigvec remains intact.
+
+* Merged gettext 0.19.3 into the intl subdirectory. This fixes building
+ with newer versions of bison.
+
+* Support for MIPS o32 FPXX, FP64A and FP64 ABI Extensions.
+ The original MIPS o32 hard-float ABI requires an FPU where double-precision
+ registers overlay two consecutive single-precision registers. MIPS32R2
+ introduced a new FPU mode (FR=1) where double-precision registers extend the
+ corresponding single-precision registers which is incompatible with the
+ o32 hard-float ABI. The MIPS SIMD ASE and the MIPSR6 architecture both
+ require the use of FR=1 making a transition necessary. New o32 ABI
+ extensions enable users to migrate over time from the original o32 ABI
+ through to the updated o32 FP64 ABI. To achieve this the dynamic linker now
+ tracks the ABI of any loaded object and verifies that new objects are
+ compatible. Mode transitions will also be requested as required and
+ unsupportable objects will be rejected. The ABI checks include both soft and
+ hard float ABIs for o32, n32 and n64.
+
+ GCC 5 with GNU binutils 2.25 onwards:
+ It is strongly recommended that all o32 system libraries are built using the
+ new o32 FPXX ABI (-mfpxx) to facilitate the transition as this is compatible
+ with the original and all new o32 ABI extensions. Configure a MIPS GCC
+ compiler using --with-fp-32=xx to set this by default.
+
+Version 2.20
+
+* The following bugs are resolved with this release:
+
+ 6804, 9894, 11505, 12994, 13347, 13651, 14308, 14770, 15119, 15132, 15347,
+ 15514, 15698, 15804, 15894, 15946, 16002, 16064, 16095, 16194, 16198,
+ 16275, 16284, 16287, 16315, 16348, 16349, 16354, 16357, 16362, 16447,
+ 16516, 16532, 16539, 16545, 16561, 16562, 16564, 16574, 16599, 16600,
+ 16609, 16610, 16611, 16613, 16619, 16623, 16629, 16632, 16634, 16639,
+ 16642, 16648, 16649, 16670, 16674, 16677, 16680, 16681, 16683, 16689,
+ 16695, 16701, 16706, 16707, 16712, 16713, 16714, 16724, 16731, 16739,
+ 16740, 16743, 16754, 16758, 16759, 16760, 16770, 16786, 16789, 16791,
+ 16796, 16799, 16800, 16815, 16823, 16824, 16831, 16838, 16839, 16849,
+ 16854, 16876, 16877, 16878, 16882, 16885, 16888, 16890, 16892, 16912,
+ 16915, 16916, 16917, 16918, 16922, 16927, 16928, 16932, 16943, 16958,
+ 16965, 16966, 16967, 16977, 16978, 16984, 16990, 16996, 17009, 17022,
+ 17031, 17042, 17048, 17050, 17058, 17061, 17062, 17069, 17075, 17078,
+ 17079, 17084, 17086, 17088, 17092, 17097, 17125, 17135, 17137, 17150,
+ 17153, 17187, 17213, 17259, 17261, 17262, 17263, 17319, 17325, 17354.
+
+* Reverted change of ABI data structures for s390 and s390x:
+ On s390 and s390x the size of struct ucontext and jmp_buf was increased in
+ 2.19. This change is reverted in 2.20. The introduced 2.19 symbol versions
+ of getcontext, setjmp, _setjmp, __sigsetjmp, longjmp, _longjmp, siglongjmp
+ are preserved pointing straight to the same implementation as the old ones.
+ Given that, new callers will simply provide a too-big buffer to these
+ functions. Any applications/libraries out there that embed jmp_buf or
+ ucontext_t in an ABI-relevant data structure that have already been rebuilt
+ against 2.19 headers will have to rebuilt again. This is necessary in any
+ case to revert the breakage in their ABI caused by the glibc change.
+
+* Support for file description locks is added to systems running the
+ Linux kernel. The standard file locking interfaces are extended to
+ operate on file descriptions, not file descriptors, via the use of
+ F_OFD_GETLK, F_OFD_SETLK, and F_OFD_SETLKW. File description locks
+ are associated with an open file instead of a process.
+
+* Optimized strchr implementation for AArch64. Contributed by ARM Ltd.
+
+* The minimum Linux kernel version that this version of the GNU C Library
+ can be used with is 2.6.32.
+
+* Running the testsuite no longer terminates as soon as a test fails.
+ Instead, a file tests.sum (xtests.sum from "make xcheck") is generated,
+ with PASS or FAIL lines for individual tests. A summary of the results is
+ printed, including a list of failing lists, and "make check" exits with
+ error status if there were any unexpected failures. "make check
+ stop-on-test-failure=y" may be used to keep the old behavior.
+
+* The am33 port, which had not worked for several years, has been removed
+ from ports.
+
+* The _BSD_SOURCE and _SVID_SOURCE feature test macros are no longer
+ supported; they now act the same as _DEFAULT_SOURCE (but generate a
+ warning). Except for cases where _BSD_SOURCE enabled BSD interfaces that
+ conflicted with POSIX (support for which was removed in 2.19), the
+ interfaces those macros enabled remain available when compiling with
+ _GNU_SOURCE defined, with _DEFAULT_SOURCE defined, or without any feature
+ test macros defined.
+
+* Optimized strcmp implementation for ARMv7. Contributed by ARM Ltd.
+
+* Added support for TX lock elision of pthread mutexes on s390 and s390x.
+ This may improve lock scaling of existing programs on TX capable systems.
+ The lock elision code is only built with --enable-lock-elision=yes and
+ then requires a GCC version supporting the TX builtins. With lock elision
+ default mutexes are elided via __builtin_tbegin, if the cpu supports
+ transactions. By default lock elision is not enabled and the elision code
+ is not built.
+
+* CVE-2014-4043 The posix_spawn_file_actions_addopen implementation did not
+ copy the path argument. This allowed programs to cause posix_spawn to
+ deference a dangling pointer, or use an unexpected pathname argument if
+ the string was modified after the posix_spawn_file_actions_addopen
+ invocation.
+
+* All supported architectures now use the main glibc sysdeps directory
+ instead of some being in a separate "ports" directory (which was
+ distributed separately before glibc 2.17).
+
+* The NPTL implementation of POSIX pthreads is no longer an "add-on".
+ On configurations that support it (all Linux configurations), it's now
+ used regardless of the --enable-add-ons switch to configure. It is no
+ longer possible to build such configurations without pthreads support.
+
+* Locale names, including those obtained from environment variables (LANG
+ and the LC_* variables), are more tightly checked for proper syntax.
+ setlocale will now fail (with EINVAL) for locale names that are overly
+ long, contain slashes without starting with a slash, or contain ".." path
+ components. (CVE-2014-0475) Previously, some valid locale names were
+ silently replaced with the "C" locale when running in AT_SECURE mode
+ (e.g., in a SUID program). This is no longer necessary because of the
+ additional checks.
+
+* On x86-64, the dynamic linker's lazy-binding support is now compatible
+ with application code using Intel MPX instructions. (With all previous
+ versions, the MPX register state could be clobbered when making calls
+ into or out of a shared library.) Note that while the new dynamic
+ linker is compatible with all known x86 hardware whether or not it
+ supports Intel MPX, some x86 instruction-set emulators might fail to
+ handle the new instruction encodings. This is known to affect Valgrind
+ versions up through 3.9 (but will be fixed in the forthcoming 3.10
+ release), and might affect other tools that do instruction emulation.
+
+* Support for loadable gconv transliteration modules has been removed.
+ The support for transliteration modules has been non-functional for
+ over a decade, and the removal is prompted by security defects. The
+ normal gconv conversion modules are still supported. Transliteration
+ with //TRANSLIT is still possible, and the //IGNORE specifier
+ continues to be supported. (CVE-2014-5119)
+
+* Decoding a crafted input sequence in the character sets IBM933, IBM935,
+ IBM937, IBM939, IBM1364 could result in an out-of-bounds array read,
+ resulting a denial-of-service security vulnerability in applications which
+ use functions related to iconv. (CVE-2014-6040)
+
+Version 2.19
+
+* The following bugs are resolved with this release:
+
+ 156, 387, 431, 762, 832, 926, 2801, 4772, 6786, 6787, 6807, 6810, 6981,
+ 7003, 9721, 9954, 10253, 10278, 11087, 11157, 11214, 12100, 12486, 12751,
+ 12986, 13028, 13982, 13985, 14029, 14032, 14120, 14143, 14155, 14286,
+ 14547, 14699, 14752, 14782, 14876, 14910, 15004, 15048, 15073, 15089,
+ 15128, 15218, 15268, 15277, 15308, 15362, 15374, 15400, 15425, 15427,
+ 15483, 15522, 15531, 15532, 15593, 15601, 15608, 15609, 15610, 15632,
+ 15640, 15670, 15672, 15680, 15681, 15723, 15734, 15735, 15736, 15748,
+ 15749, 15754, 15760, 15763, 15764, 15797, 15799, 15825, 15843, 15844,
+ 15846, 15847, 15849, 15850, 15855, 15856, 15857, 15859, 15867, 15886,
+ 15887, 15890, 15892, 15893, 15895, 15897, 15901, 15905, 15909, 15915,
+ 15917, 15919, 15921, 15923, 15939, 15941, 15948, 15963, 15966, 15968,
+ 15985, 15988, 15997, 16032, 16034, 16036, 16037, 16038, 16041, 16046,
+ 16055, 16071, 16072, 16074, 16077, 16078, 16103, 16112, 16143, 16144,
+ 16146, 16150, 16151, 16153, 16167, 16169, 16172, 16195, 16214, 16245,
+ 16271, 16274, 16283, 16289, 16293, 16314, 16316, 16330, 16337, 16338,
+ 16356, 16365, 16366, 16369, 16372, 16375, 16379, 16381, 16384, 16385,
+ 16386, 16387, 16390, 16394, 16398, 16400, 16407, 16408, 16414, 16430,
+ 16431, 16453, 16474, 16506, 16510, 16529
+
+* Slovenian translations for glibc messages have been contributed by the
+ Translation Project's Slovenian team of translators.
+
+* The public headers no longer use __unused nor __block. This change is to
+ support compiling programs that are derived from BSD sources and use
+ __unused internally, and to support compiling with Clang's -fblock
+ extension which uses __block.
+
+* CVE-2012-4412 The strcoll implementation caches indices and rules for
+ large collation sequences to optimize multiple passes. This cache
+ computation may overflow for large collation sequences and may cause a
+ stack or buffer overflow. This is now fixed to use a slower algorithm
+ which does not use a cache if there is an integer overflow.
+
+* CVE-2012-4424 The strcoll implementation uses malloc to cache indices and
+ rules for large collation sequences to optimize multiple passes and falls
+ back to alloca if malloc fails, resulting in a possible stack overflow.
+ The implementation now falls back to an uncached collation sequence lookup
+ if malloc fails.
+
+* CVE-2013-4788 The pointer guard used for pointer mangling was not
+ initialized for static applications resulting in the security feature
+ being disabled. The pointer guard is now correctly initialized to a
+ random value for static applications. Existing static applications need
+ to be recompiled to take advantage of the fix (bug 15754).
+
+* CVE-2013-4237 The readdir_r function could write more than NAME_MAX bytes
+ to the d_name member of struct dirent, or omit the terminating NUL
+ character. (Bugzilla #14699).
+
+* CVE-2013-4332 The pvalloc, valloc, memalign, posix_memalign and
+ aligned_alloc functions could allocate too few bytes or corrupt the
+ heap when passed very large allocation size values (Bugzilla #15855,
+ #15856, #15857).
+
+* CVE-2013-4458 Stack overflow in getaddrinfo with large number of results
+ for AF_INET6 has been fixed (Bugzilla #16072).
+
+* New locales: ak_GH, anp_IN, ar_SS, cmn_TW, hak_TW, lzh_TW, nan_TW, pap_AW,
+ pap_CW, quz_PE, the_NP.
+
+* Substantially revised locales: gd_GB, ht_HT
+
+* The LC_ADDRESS field was updated to support country_car for almost all
+ supported locales.
+
+* ISO 1427 definitions were updated.
+
+* ISO 3166 definitions were updated.
+
+* The localedef utility now supports --big-endian and --little-endian
+ command-line options to generate locales for a different system from that
+ for which the C library was built.
+
+* Binary locale files now only depend on the endianness of the system for
+ which they are generated and not on other properties of that system. As a
+ consequence, binary files generated with new localedef may be incompatible
+ with old versions of the GNU C Library, and binary files generated with
+ old localedef may be incompatible with this version of the GNU C Library,
+ in the following circumstances:
+
+ + Locale files may be incompatible on m68k systems.
+
+ + Locale archive files (but not separate files for individual locales) may
+ be incompatible on systems where plain "char" is signed.
+
+* The configure option --disable-versioning has been removed. Builds with
+ --disable-versioning had not worked for several years.
+
+* ISO 639 definitions were updated for Chiga (cgg) and Chinese (gan, hak, czh,
+ cjy, lzh, cmn, mnp, cdo, czo, cpx, wuu, hsn, yue).
+
+* SystemTap probes for malloc have been introduced.
+
+* SystemTap probes for slow multiple precision fallback paths of
+ transcendental functions have been introduced.
+
+* Support for powerpc64le has been added.
+
+* The soft-float powerpc port now supports e500 processors.
+
+* Support for STT_GNU_IFUNC symbols added for ppc32/power4+ and ppc64.
+
+* A new feature test macro _DEFAULT_SOURCE is available to enable the same
+ set of header declarations that are enabled by default, even when other
+ feature test macros or compiler options such as -std=c99 would otherwise
+ disable some of those declarations.
+
+* The _BSD_SOURCE feature test macro no longer enables BSD interfaces that
+ conflict with POSIX. The libbsd-compat library (which was a dummy library
+ that did nothing) has also been removed.
+
+* Preliminary documentation about Multi-Thread, Async-Signal and
+ Async-Cancel Safety has been added.
+
+* Change of ABI data structures for s390 and s390x:
+ On s390 and s390x the size of struct ucontext and jmp_buf was increased to
+ allow for future hardware extensions. All library functions that accept or
+ return these structures were versioned in order to provide backwards
+ compatibility with existing code. However, not all cases can be handled
+ with interface versioning. If an application embeds either structure into
+ another structure and that structure is passed to another compilation unit
+ which expects the newer larger-sized object then any access to the new
+ fields will result in undefined behaviour. Similarly any access to fields
+ that were moved by the enlarging of the structures will cause undefined
+ behaviour. To fix the undefined behaviour all objects that are part of the
+ final in-memory image must agree on the size of structures, and this may
+ require recompilation.
+
+Version 2.18
+
+* The following bugs are resolved with this release:
+
+ 2546, 2560, 5159, 6809, 7006, 10060, 10062, 10283, 10357, 10686, 11120,
+ 11561, 12310, 12387, 12492, 12515, 12723, 13550, 13889, 13951, 13988,
+ 14142, 14176, 14200, 14256, 14280, 14293, 14317, 14327, 14478, 14496,
+ 14582, 14686, 14812, 14888, 14894, 14907, 14908, 14909, 14920, 14941,
+ 14952, 14964, 14981, 14982, 14985, 14991, 14994, 14996, 15000, 15003,
+ 15006, 15007, 15014, 15020, 15022, 15023, 15036, 15054, 15055, 15062,
+ 15078, 15084, 15085, 15086, 15100, 15160, 15214, 15221, 15232, 15234,
+ 15283, 15285, 15287, 15304, 15305, 15307, 15309, 15327, 15330, 15335,
+ 15336, 15337, 15339, 15342, 15346, 15359, 15361, 15366, 15380, 15381,
+ 15394, 15395, 15405, 15406, 15409, 15416, 15418, 15419, 15423, 15424,
+ 15426, 15429, 15431, 15432, 15441, 15442, 15448, 15465, 15480, 15485,
+ 15488, 15490, 15492, 15493, 15497, 15506, 15529, 15536, 15553, 15577,
+ 15583, 15618, 15627, 15631, 15654, 15655, 15666, 15667, 15674, 15711,
+ 15755, 15759.
+
+* CVE-2013-2207 Incorrectly granting access to another user's pseudo-terminal
+ has been fixed by disabling the use of pt_chown (Bugzilla #15755).
+ Distributions can re-enable building and using pt_chown via the new configure
+ option `--enable-pt_chown'. Enabling the use of pt_chown carries with it
+ considerable security risks and should only be used if the distribution
+ understands and accepts the risks.
+
+* CVE-2013-0242 Buffer overrun in regexp matcher has been fixed (Bugzilla
+ #15078).
+
+* CVE-2013-1914 Stack overflow in getaddrinfo with many results has been
+ fixed (Bugzilla #15330).
+
+* Add support for calling C++11 thread_local object destructors on thread
+ and program exit. This needs compiler support for offloading C++11
+ destructor calls to glibc.
+
+* Improved worst case performance of libm functions with double inputs and
+ output.
+
+* Support for priority inherited mutexes in pthread condition variables on
+ non-x86 architectures.
+
+* Port to Xilinx MicroBlaze contributed by David Holsgrove.
+
+* Optimized string functions for AArch64. Implemented by Marcus Shawcroft.
+
+* Optimized string functions for ARM. Implemented by Will Newton and
+ Richard Henderson.
+
+* Optimized libm functions for SPARC. Implemented by David S. Miller.
+
+* Support for building more of ARM glibc as Thumb-2 code. Implemented by
+ Richard Henderson.
+
+* Support for building most of MIPS glibc as MIPS16 code. Implemented by
+ Chung-Lin Tang, Maciej W. Rozycki and Maxim Kuvyrkov.
+
+* Added a benchmark framework to track performance of functions in glibc.
+
+* New <math.h> macro named issignaling to check for a signaling NaN (sNaN).
+ It is based on draft TS 18661 and currently enabled as a GNU extension.
+
+* On Linux, the clock function now uses the clock_gettime system call
+ for improved precision, rather than old times system call.
+
+* Added support for version-3 tz format files. This is needed when using
+ the tz database release 2013e or later, and affects a few unusual cases --
+ currently only TZ='America/Godthab' for time stamps after 2037.
+
+* Added new API functions pthread_getattr_default_np and
+ pthread_setattr_default_np to get and set the default pthread
+ attributes of a process.
+
+* Added support for TSX lock elision for pthread mutexes on i386 and x86-64.
+ This may improve lock scaling of existing programs on TSX capable systems.
+ When the --enable-lock-elision=yes parameter is specified at configure
+ time lock elision will be enabled by default for all PTHREAD_MUTEX_DEFAULT
+ mutexes.
+
+* Support added for AT_HWCAP2 (to coincide with Linux kernel 3.10
+ availability). Implemented by Ryan S. Arnold.
+
+* Support added for POWER8 platform. Implemented by Ryan S. Arnold.
+
+Version 2.17
+
+* The following bugs are resolved with this release:
+
+ 1349, 3439, 3479, 3665, 5044, 5246, 5298, 5400, 6530, 6677, 6778, 6808,
+ 9685, 9914, 10014, 10038, 10114, 10191, 10631, 10873, 11438, 11607, 11638,
+ 11741, 12140, 13013, 13412, 13542, 13601, 13603, 13604, 13629, 13679,
+ 13696, 13698, 13717, 13741, 13759, 13761, 13763, 13881, 13939, 13950,
+ 13952, 13966, 14042, 14047, 14090, 14150, 14151, 14152, 14154, 14157,
+ 14166, 14173, 14195, 14197, 14237, 14246, 14251, 14252, 14283, 14298,
+ 14303, 14307, 14328, 14331, 14336, 14337, 14347, 14349, 14368, 14376,
+ 14417, 14447, 14459, 14476, 14477, 14501, 14505, 14510, 14516, 14518,
+ 14519, 14530, 14532, 14538, 14543, 14544, 14545, 14557, 14562, 14568,
+ 14576, 14579, 14583, 14587, 14595, 14602, 14610, 14621, 14638, 14645,
+ 14648, 14652, 14660, 14661, 14669, 14672, 14683, 14694, 14716, 14719,
+ 14743, 14767, 14783, 14784, 14785, 14793, 14796, 14797, 14801, 14803,
+ 14805, 14807, 14811, 14815, 14821, 14822, 14824, 14828, 14831, 14833,
+ 14835, 14838, 14856, 14863, 14865, 14866, 14868, 14869, 14871, 14872,
+ 14879, 14889, 14893, 14898, 14914.
+
+* Optimization of memcpy for MIPS.
+
+* CVE-2011-4609 svc_run() produces high cpu usage when accept fails with
+ EMFILE has been fixed (Bugzilla #14889).
+
+* The add-on ports collection is now distributed in the "ports" subdirectory
+ of the main GNU C Library distribution, rather than separately.
+
+* Port to ARM AArch64 contributed by Linaro.
+
+* Support for STT_GNU_IFUNC symbols added for s390 and s390x.
+ Optimized versions of memcpy, memset, and memcmp added for System z10 and
+ zEnterprise z196.
+ Implemented by Andreas Krebbel.
+
+* The new function secure_getenv allows secure access to the environment,
+ returning NULL if running in a SUID/SGID process. This function replaces
+ the internal function __secure_getenv.
+
+* SystemTap static probes have been added into the dynamic linker.
+ Implemented by Gary Benson.
+
+* Optimizations of string functions strstr, strcasestr and memmem.
+ Implemented by Maxim Kuvyrkov.
+
+* The minimum Linux kernel version that this version of the GNU C Library
+ can be used with is 2.6.16.
+
+* Optimizations of string functions memchr, wcschr, wcscpy, and wcsrchr for
+ powerpc POWER7. Implemented by Will Schmidt.
+
+* New configure option --disable-nscd builds the C library such that it
+ never attempts to contact the Name Service Caching Daemon (nscd).
+ New configure option --disable-build-nscd avoids building nscd itself;
+ this is the default if --disable-nscd is used.
+
+* Improved support for cross-compilation, including cross-testing and
+ bootstrap builds without a previously built glibc.
+
+* Several testsuite tests are now able to test multiple IFUNC variants of an
+ interface, rather than just testing the one that would be chooen by
+ default.
+
+* New configure options --with-bugurl and --with-pkgversion, for
+ distributors to use to embed their bug-reporting and package version
+ information in --help and --version output.
+
+* The ttyname and ttyname_r functions on Linux now fall back to searching for
+ the tty file descriptor in /dev/pts or /dev if /proc is not available. This
+ allows creation of chroots without the procfs mounted on /proc.
+
+* The `crypt' function now fails if passed salt bytes that violate the
+ specification for those values. On Linux, the `crypt' function will
+ consult /proc/sys/crypto/fips_enabled to determine if "FIPS mode" is
+ enabled, and fail on encrypted strings using the MD5 or DES algorithm
+ when the mode is enabled.
+
+* The `clock_*' suite of functions (declared in <time.h>) is now available
+ directly in the main C library. Previously it was necessary to link with
+ -lrt to use these functions. This change has the effect that a
+ single-threaded program that uses a function such as `clock_gettime' (and
+ is not linked with -lrt) will no longer implicitly load the pthreads
+ library at runtime and so will not suffer the overheads associated with
+ multi-thread support in other code such as the C++ runtime library.
+
+* New locales: ayc_PE, doi_IN, ia_FR, mni_IN, nhn_MX, niu_NU, niu_NZ,
+ sat_IN, and szl_PL.
+
+Version 2.16
+
+* The following bugs are resolved with this release:
+
+ 174, 208, 350, 369, 411, 706, 766, 2074, 2541, 2547, 2548, 2550, 2551,
+ 2552, 2553, 2554, 2562, 2563, 2565, 2566, 2570, 2576, 2636, 2678, 3335,
+ 3440, 3748, 3768, 3866, 3868, 3906, 3976, 3992, 4026, 4108, 4596, 4822,
+ 5077, 5461, 5805, 5993, 6471, 6486, 6578, 6649, 6730, 6770, 6794, 6884,
+ 6890, 6894, 6895, 6907, 6911, 6959, 7064, 9739, 9902, 10110, 10135, 10140,
+ 10153, 10210, 10254, 10346, 10375, 10545, 10716, 10846, 10882, 11174,
+ 11261, 11322, 11365, 11451, 11494, 11521, 11677, 11837, 11959, 12047,
+ 12097, 12193, 12194, 12297, 12298, 12301, 12340, 12354, 12416, 12495,
+ 13058, 13223, 13361, 13525, 13526, 13527, 13528, 13529, 13530, 13531,
+ 13532, 13533, 13547, 13551, 13552, 13553, 13555, 13556, 13559, 13563,
+ 13566, 13576, 13579, 13583, 13592, 13594, 13613, 13618, 13637, 13656,
+ 13658, 13673, 13691, 13695, 13704, 13705, 13706, 13718, 13726, 13738,
+ 13739, 13743, 13750, 13758, 13760, 13761, 13775, 13786, 13787, 13792,
+ 13806, 13824, 13840, 13841, 13844, 13846, 13848, 13851, 13852, 13854,
+ 13871, 13872, 13873, 13879, 13882, 13883, 13884, 13885, 13886, 13892,
+ 13895, 13908, 13910, 13911, 13912, 13913, 13914, 13915, 13916, 13917,
+ 13918, 13919, 13920, 13921, 13922, 13923, 13924, 13926, 13927, 13928,
+ 13938, 13941, 13942, 13954, 13955, 13956, 13963, 13967, 13968, 13970,
+ 13973, 13979, 13983, 13986, 13996, 14012, 14027, 14033, 14034, 14036,
+ 14040, 14043, 14044, 14048, 14049, 14050, 14053, 14055, 14059, 14064,
+ 14075, 14080, 14083, 14103, 14104, 14109, 14112, 14117, 14122, 14123,
+ 14134, 14153, 14183, 14188, 14199, 14210, 14218, 14229, 14241, 14273,
+ 14277, 14278.
+
+* Support for the x32 ABI on x86-64 added. The x32 target is selected by
+ configuring glibc with:
+ BUILD_CC='gcc' CC='gcc -mx32' CXX='g++ -mx32'
+ Visit <https://sites.google.com/site/x32abi/> for more x32 ABI info.
+ Implemented by H.J. Lu.
+
+* ISO C11 support:
+
+ + define static_assert
+
+ + do not declare gets
+
+ + declare at_quick_exit and quick_exit also for ISO C11
+
+ + aligned_alloc. NB: The code is deliberately allows the size parameter
+ to not be a multiple of the alignment. This is a moronic requirement
+ in the standard but it is only a requirement on the caller, not the
+ implementation.
+
+ + timespec_get added
+
+ + uchar.h support added
+
+ + CMPLX, CMPLXF, CMPLXL added
+
+ Implemented by Ulrich Drepper.
+
+* Support for the IA-64 has been moved to ports.
+
+* Remove support for anything but ELF binary format
+
+* Checking versions of poll, ppoll added.
+ Implemented by Ulrich Drepper.
+
+* More generic and 64-bit performance optimizations to math functions.
+ Implemented by Ulrich Drepper.
+
+* New configure option --enable-obsolete-rpc makes the deprecated RPC
+ headers and functions available at compile time as they were before
+ version 2.14. This option will be removed at some time in the future
+ after the TI-RPC library becomes fully sufficient for the needs of
+ existing applications.
+
+* Compatibility code for Linux kernel versions before 2.4 has been removed.
+ Note that glibc is not expected to work with any Linux kernel version
+ before 2.6.
+
+* New header <sys/auxv.h> and function getauxval allowing easy access to
+ the AT_* key-value pairs passed from the Linux kernel. The header also
+ defines the HWCAP_* bits associated with the AT_HWCAP key.
+
+* New locales: mag_IN
+
+* New configure option --enable-systemtap builds SystemTap static probes
+ into libc for setjmp and longjmp and into libpthread for various operations.
+ So far the setjmp/longjmp probes and some of the libpthread probes are
+ provided only for i*86 and x86_64.
+ Implemented by Roland McGrath and Rayson Ho.
+
+* Optimized expf for x86-32 and x86-64. Implemented by Liubov Dmitrieva.
+
+* More optimized functions for PowerPC. Implemented by Adhemerval Zanella
+ and Will Schmidt.
+
+* More optimized functions for SPARC. Implemented by David S. Miller.
+
+* Improved support for cross-compilation, especially bootstrap builds
+ without a previously built glibc.
+
+* Ports for the TILE-Gx and TILEPro families of processors. Contributed by
+ Chris Metcalf from Tilera.
+
+* Support for the old ARM ABI has been removed from ports. Only the EABI is
+ now supported for ARM processors.
+
+* The hard-float variant of the ARM EABI now uses /lib/ld-linux-armhf.so.3
+ as the name of the dynamic linker, to distinguish it from the
+ /lib/ld-linux.so.3 dynamic linker used for the base EABI.
+
+* Support for CRIS has been removed from ports.
+
+* A new class of installed header has been documented for low-level
+ platform-specific functionality. PowerPC added the first instance with a
+ function to provide time base register access. Contributed by Tulio
+ Magno Quites Machado Filho.
+
+* ix86 configurations now install header files that are consistent with
+ what x86-64 configurations install. These same header files can be used
+ for -m32, -m64, or -mx32 builds.
+ Contributed by H.J. Lu.
+
+* Math library bug fixes. A thorough audit of all open math library bugs was
+ conducted by Joseph Myers. Significant progress was made on many math
+ library bugs resulting in more accurate exceptions and function results.
+ Many thanks to all those that contributed including Andreas Jaeger for his
+ patch review and work on the x87 trigonometric instruction issues.
+
+* Timezone data is no longer installed. Timezone-related binaries and scripts
+ will continue to be installed. Users should obtain their timezone data from
+ their distribution provider or from the tzdata package at
+ <ftp://munnari.oz.au/pub/>.
+
+Version 2.15
+
+* The following bugs are resolved with this release:
+
+ 6779, 6783, 9696, 10103, 10709, 11589, 11929, 12403, 12786, 12840, 12847,
+ 12868, 12852, 12874, 12885, 12892, 12906, 12907, 12922, 12935, 12962,
+ 13007, 13021, 13061, 13062, 13067, 13068, 13085, 13088, 13090, 13092,
+ 13096, 13114, 13118, 13123, 13134, 13138, 13147, 13150, 13166, 13179,
+ 13185, 13189, 13192, 13268, 13276, 13282, 13291, 13305, 13328, 13335,
+ 13337, 13344, 13358, 13367, 13413, 13416, 13423, 13439, 13446, 13472,
+ 13484, 13506, 13515, 13523, 13524, 13538, 13540
+
+* New program pldd to list loaded object of a process
+ Implemented by Ulrich Drepper.
+
+* Add nss_db support back to glibc. No more dependency on Berkeley db
+ and support for initgroups lookups.
+ Implemented by Ulrich Drepper.
+
+* Optimized strcpy, strncpy, stpcpy, stpncpy for SSE2 and SSSE3 on x86-32.
+ Contributed by HJ Lu.
+
+* Improved strcpy, strncpy, stpcpy, stpncpy for SSE2 and SSSE3 on x86-64.
+ Contributed by HJ Lu.
+
+* Optimized strcat, strncat on x86-64 and optimized wcscmp, wcslen, strnlen
+ on x86-32 and x86-64.
+ Contributed by Liubov Dmitrieva.
+
+* Optimized strchr and strrchr for SSE on x86-32.
+ Contributed by Liubov Dmitrieva.
+
+* Optimized memchr, memrchr, rawmemchr, memcmp, wmemcmp, wcschr, wcscpy
+ for x86-64 and x86-32.
+ Contributed by Liubov Dmitrieva.
+
+* New interfaces: scandirat, scandirat64
+ Implemented by Ulrich Drepper.
+
+* Checking versions of FD_SET, FD_CLR, and FD_ISSET added.
+ Implemented by Ulrich Drepper.
+
+* nscd now also caches the netgroup database.
+ Implemented by Ulrich Drepper.
+
+* Integrate libm with gcc's -ffinite-math-only option.
+ Implemented by Ulrich Drepper.
+
+* Lots of generic, 64-bit, and x86-64-specific performance optimizations
+ to math functions. Implemented by Ulrich Drepper.
+
+* Optimized strcasecmp and strncasecmp for AVX on x86-64.
+ Implemented by Ulrich Drepper.
+
+* New Linux interfaces: process_vm_readv, process_vm_writev
+
+* Optimized strcasecmp and strncasecmp for SSSE3 and SSE4.2 on x86-32.
+ Implemented by Ulrich Drepper.
+
+* Optimized nearbyint and strcasecmp for PPC.
+ Implemented by Adhemerval Zanella.
+
+* New locales: bho_IN, unm_US, es_CU, ta_LK
+
+Version 2.14
+
+* The following bugs are resolved with this release:
+
+ 386, 6420, 7101, 9730, 9732, 9809, 10138, 10149, 10157, 11099, 11257,
+ 11258, 11487, 11532, 11558, 11578, 11634, 11653, 11668, 11697, 11724,
+ 11781, 11799, 11820, 11837, 11857, 11884, 11892, 11895, 11901, 11945,
+ 11947, 11952, 11987, 12052, 12083, 12158, 12178, 12200, 12346, 12350,
+ 12393, 12420, 12432, 12445, 12449, 12453, 12454, 12460, 12469, 12489,
+ 12509, 12510, 12511, 12518, 12527, 12541, 12545, 12551, 12582, 12583,
+ 12587, 12597, 12601, 12611, 12625, 12626, 12631, 12650, 12653, 12655,
+ 12660, 12671, 12681, 12684, 12685, 12711, 12713, 12714, 12717, 12723,
+ 12724, 12734, 12738, 12746, 12766, 12775, 12777, 12782, 12788, 12792,
+ 12795, 12811, 12813, 12814, 12841
+
+* The RPC implementation in libc is obsoleted. Old programs keep working
+ but new programs cannot be linked with the routines in libc anymore.
+ Programs in need of RPC functionality must be linked against TI-RPC.
+ The TI-RPC implementation is IPv6 enabled and there are other benefits.
+
+ Visible changes of this change include (obviously) the inability to link
+ programs using RPC functions without referencing the TI-RPC library and the
+ removal of the RPC headers from the glibc headers.
+ Implemented by Ulrich Drepper.
+
+* New Linux interfaces: clock_adjtime, name_to_handle_at, open_by_handle_at,
+ syncfs, setns, sendmmsg
+
+* New locales: os_RU, bem_ZA, en_ZA, ff_SN, sw_KE, sw_TZ, lb_LU, wae_CH,
+ yue_HK, lij_IT, mhr_RU
+
+* New encodings: CP770, CP771, CP772, CP773, CP774
+
+* New program sotruss to trace calls through PLTs
+ Implemented by Ulrich Drepper.
+
+* The malloc hook implementation is marked deprecated and will be removed
+ from the default implementation in the next version. The design never
+ worked ever since the introduction of threads. Even programs which do
+ not create threads themselves can use multiple threads created internally.
+
+Version 2.13
+
+* The following bugs are resolved with this release:
+
+ 3268, 6812, 7066, 10085, 10484, 10563, 10851, 11149, 11155, 11577, 11611,
+ 11640, 11655, 11701, 11840, 11856, 11883, 11903, 11904, 11968, 11979,
+ 12005, 12037, 12067, 12077, 12078, 12092, 12093, 12107, 12108, 12113,
+ 12140, 12159, 12167, 12191, 12194, 12201, 12204, 12205, 12207, 12348,
+ 12378, 12394, 12397
+
+* New Linux interfaces: prlimit, prlimit64, fanotify_init, fanotify_mark
+
+* POWER7 optimizations: memset, memcmp, strncmp
+
+* New optimized string functions for x86-64: strnlen (SSE2),
+ strcasecmp (SSE2, SSSE3, SSE4.2), strncasecmp (SSE2, SSSE3, SSE4.2)
+ Implemented by Ulrich Drepper.
+
+Version 2.12
+
+* The following bugs are resolved with this release:
+
+ 3662, 4457, 5553, 10162, 10401, 10414, 10554, 10824, 10864, 10915,
+ 10918, 10936, 10939, 10958, 10968, 10969, 10972, 10992, 11000, 11001,
+ 11007, 11010, 11027, 11039, 11040, 11041, 11043, 11046, 11056, 11070,
+ 11093, 11115, 11125, 11126, 11127, 11134, 11141, 11149, 11183, 11184,
+ 11185, 11186, 11187, 11188, 11189, 11190, 11191, 11192, 11193, 11194,
+ 11200, 11230, 11235, 11242, 11254, 11258, 11271, 11272, 11276, 11279,
+ 11287, 11292, 11319, 11332, 11333, 11387, 11389, 11390, 11394, 11397,
+ 11410, 11438, 11449, 11470, 11471, 11520, 11537, 11538, 11571
+
+* New interfaces: pthread_getname_np, pthread_setname_np
+
+* New Linux interface: recvmmsg
+
+* STT_GNU_IFUNC implemented for Sparc by David Miller.
+
+* The dynamic linker now recognizes supported ABI versions from the
+ EI_ABIVERSION field in the ELF header.
+ Implemented by Ulrich Drepper.
+
+* New NIS mode selector ADJUNCT_AS_SHADOW. The passwd.adjunct.byname table
+ will not be used to fill in password fields in the passwd.byname replies.
+ Instead it is used to synthesize the shadow.byname table, should it be
+ missing. This is a useful mode in some installations involving Solaris.
+ Implemented by Ulrich Drepper.
+
+* New locales: kok_IN, sq_MK, cv_RU
+
+Version 2.11
+
+* The following bugs are resolved with this release:
+
+ 3270, 7094, 9924, 9986, 10011, 10085, 10107, 10159, 10162, 10166, 10183,
+ 10195, 10196, 10200, 10203, 10207, 10211, 10213, 10217, 10221, 10229,
+ 10262, 10286, 10312, 10315, 10319, 10349, 10360, 10391, 10402, 10416,
+ 10418, 10422, 10425, 10446, 10448, 10452, 10540, 10553, 10560, 10564,
+ 10609, 10643, 10692, 10713, 10717, 10730, 10731, 10742, 10780, 10784,
+ 10789, 10817, 10823, 10840, 10847
+
+* New interfaces: execvpe, pthread_sigqueue, mkstemps, mkstemps64, mkostemps,
+ mkostemps64
+ Implemented by Ulrich Drepper.
+
+* Checking version of longjmp added that fails if an uninitialized stack
+ frame would be created. Implemented by Ulrich Drepper.
+
+* STT_GNU_IFUNC is now supported in static executables.
+ Implemented by H.J. Lu.
+
+* STT_GNU_IFUNC implemented for PPC by Alan Modra.
+
+* New optimized string functions for x86-64: strstr, strcasestr, memcmp,
+ strcspn, strpbrk, strspn, strcpy, stpcpy, strncpy, strcmp (SSE2, SSE4.2),
+ strncmp (SSE2, SSE4.2), strchr (SSE4.2), strrchr (SSE4.2).
+ Contributed by H.J. Lu.
+
+ strlen, rawmemchr, strcmp (SSSE3), strncmp (SSSE3).
+ Implemented by Ulrich Drepper.
+
+* New optimized string functions for x86: strlen, strcspn, strspn, strpbrk,
+ strstr, strcasestr.
+ Contributed by H.J. Lu.
+
+* Support for fma instruction in AVX on x86-64.
+ Implemented by H.J. Lu and Ulrich Drepper.
+
+* AVX support in x86-64 auditing support in ld.so.
+ Implemented by H.J. Lu.
+
+* STB_GNU_UNIQUE support added.
+ Implemented by Ulrich Drepper.
+
+* Implement second fallback mode for optimized DNS lookup for even more
+ broken environments. If two requests from the same port are not
+ handled correctly close the socket and open a new one before sending
+ the second request. The 'single-request-reopen' option in /etc/resolv.conf
+ can be used to select this mode right away, instead of rediscovering the
+ necessity is every process again.
+ Implemented by Ulrich Drepper.
+
+* New resolver flag RES_USE_DNSSEC to enable use of verified lookup.
+ Implemented by Adam Tkac.
+
+* Optimized iconv conversions for S390x.
+ Implemented by Andreas Krebbel.
+
+* Using condvars with PI mutexes is now more efficient due to kernel
+ support for requeueing to PI futexes. NPTL support added for x86-64.
+ Implemented by Ulrich Drepper.
+
+* New locales: ps_AF, my_MM
+
+Version 2.10
+
+* The following bugs are resolved with this release:
+
+ 697, 5381, 5807, 6411, 6545, 7040, 7058, 7067, 7080, 7083, 7095, 7098,
+ 9677, 9694, 9697, 9701, 9704, 9705, 9706, 9720, 9726, 9730, 9733, 9736,
+ 9741, 9750, 9753, 9759, 9781, 9791, 9793, 9823, 9833, 9844, 9880, 9881,
+ 9891, 9893, 9895, 9913, 9916, 9920, 9948, 9955, 9957, 9963, 9985, 10052,
+ 10069, 10086, 10087, 10090, 10092, 10093, 10100, 10118, 10128
+
+* New interfaces: preadv, preadv64, pwritev, pwritev64, malloc_info
+ Implemented by Ulrich Drepper.
+
+* New Linux interfaces: accept4, fallocate, fallocate64.
+ Implemented by Ulrich Drepper.
+
+* Correct declarations of string function when used in C++ code. This
+ could lead to compile errors for invalid C++ code.
+
+* XPG7/POSIX 2008 compilation environment. Many GNU-specific functions are
+ now in POSIX.
+
+* New POSIX 2008 interface: psiginfo
+ Implemented by Ulrich Drepper.
+
+* New ISO C++1x interfaces: quick_exit, at_quick_exit
+ Implemented by Ulrich Drepper.
+
+* Support for selecting between multiple function definitions at runtime
+ using STT_GNU_IFUNC symbols. Implemented by Ulrich Drepper.
+
+* The libcrypt library can now use the hash function implementations in
+ NSS. Implemented by Ulrich Drepper.
+
+* The malloc implementation can be compiled to be less memory efficient
+ but higher performing in multi-threaded programs.
+ Implemented by Ulrich Drepper.
+
+* New locales: nan_TW@latin, ks_IN
+
+* Faster strlen, strchr, strchrnul, strrchr, memchr, and rawmemchr for x86-64.
+ Implemented by Ulrich Drepper.
+
+* Extended printf hook support. It is possible to use user-defined types
+ and extend existing format specifiers.
+ Implemented by Ulrich Drepper.
+
+* Handling for group shadow files has been added.
+ Implemented by Ulrich Drepper.
+
+* DNS IPv4-IPv6 parallel lookup now deals better with broken DNS
+ servers (the case, e.g., for some people using the built-in DNS
+ server in ADSL modems/routers). There is a once-per-process timeout
+ in case of a broken server. To avoid it, users can run nscd or put
+ 'options single-request' in /etc/resolv.conf.
+ Implemented by Ulrich Drepper.
+
+Version 2.9
+
+* The following bugs are resolved with this release:
+
+ 2447, 3406, 5209, 5210, 5381, 5794, 5814, 5911, 6428, 6438, 6442, 6447,
+ 6461, 6472, 6505, 6544, 6589, 6612, 6634, 6653, 6654, 6657, 6698, 6712,
+ 6713, 6719, 6723, 6724, 6740, 6763, 6771, 6790, 6791, 6817, 6824, 6839,
+ 6843, 6845, 6856, 6857, 6860, 6867, 6875, 6919, 6920, 6942, 6947, 6955,
+ 6966, 6968, 6974, 6980, 6995, 7008, 7009, 7029
+
+* Unified lookup for getaddrinfo: IPv4 and IPv6 addresses are now looked
+ up at the same time. Implemented by Ulrich Drepper.
+
+* TLS descriptors for LD and GD on x86 and x86-64.
+ Implemented by Alexandre Oliva.
+
+* getaddrinfo now handles DCCP and UDPlite.
+ Implemented by Ulrich Drepper.
+
+* New fixed-size conversion macros: htobe16, htole16, be16toh, le16toh,
+ htobe32, htole32, be32toh, le32toh, htobe64, htole64, be64toh, le64toh.
+ Implemented by Ulrich Drepper.
+
+* New implementation of memmem, strstr, and strcasestr which is O(n).
+ Implemented by Eric Blake.
+
+* New Linux interfaces: inotify_init1, dup3, epoll_create1, pipe2
+
+* Implement "e" option for popen to open file descriptor with the
+ close-on-exec flag set. Implemented by Ulrich Drepper.
+
+* Implement "b" mode for fmemopen. In this mode writes writes don't
+ implicitly add a NUL byte and seeks from the end of the buffer really
+ use the buffer end, not the string length as the basis.
+ Implemented by Ulrich Drepper.
+
+* Many functions, exported and internal, now atomically set the close-on-exec
+ flag when run on a sufficiently new kernel. Implemented by Ulrich Drepper.
+
+* Sorting rules for some Indian languages (Kannada, Gurumukhi, Telugu,
+ Sinhala)
+ Implemented by Pravin Satpute.
+
+* New locales: sd_IN, sd_IN@devanagari, ks_IN@devanagari, ht_HT, en_AG, nl_AW.
+
+Version 2.8
+
+* The following bugs are resolved with this release:
+
+ 2549, 3112, 4314, 4407, 4997, 5012, 5040, 5112, 5204, 5208, 5209, 5220,
+ 5222, 5224, 5225, 5237, 5238, 5240, 5245, 5277, 5346, 5375, 5378, 5382,
+ 5424, 5427, 5428, 5435, 5436, 5439, 5441, 5442, 5443, 5451, 5452, 5454,
+ 5455, 5463, 5464, 5465, 5475, 5477, 5478, 5520, 5541, 5545, 5553, 5600,
+ 5602, 5607, 5614, 5627, 5628, 5736, 5737, 5741, 5753, 5760, 5762, 5768,
+ 5774, 5777, 5778, 5779, 5786, 5790, 5818, 5854, 5857, 5903, 5939, 5979,
+ 5983, 5995, 5998, 6004, 6007, 6020, 6021, 6024, 6040, 6042
+
+* New locales: bo_CN, bo_IN, shs_CA.
+
+* New encoding: HP-ROMAN9, HP-GREEK8, HP-THAI8, HP-TURKISH8.
+
+* Sorting rules for some Indian languages (Devanagari and Gujarati).
+ Implemented by Pravin Satpute.
+
+* IPV6 addresses in /etc/resolv.conf can now have a scope ID
+
+* nscd caches now all timeouts for DNS entries
+ Implemented by Ulrich Drepper.
+
+* nscd is more efficient and wakes up less often.
+ Implemented by Ulrich Drepper.
+
+* More checking functions: asprintf, dprintf, obstack_printf, vasprintf,
+ vdprintf, and obstack_vprintf.
+ Implemented by Jakub Jelinek.
+
+* Faster memset for x86-64.
+ Implemented by Harsha Jagasia and H.J. Lu.
+
+* Faster memcpy on x86.
+ Implemented by Ulrich Drepper.
+
+* ARG_MAX is not anymore constant on Linux. Use sysconf(_SC_ARG_MAX).
+ Implemented by Ulrich Drepper.
+
+* Faster sqrt and sqrtf implemention for some PPC variants.
+ Implemented by Steven Munroe.
+
+Version 2.7
+
+* The following bugs are resolved with this release:
+
+ 4125, 4126, 4178, 4359, 4407, 4512, 4514, 4525, 4554, 4556, 4557, 4566,
+ 4582, 4586, 4588, 4599, 4610, 4647, 4702, 4705, 4726, 4745, 4772, 4773,
+ 4775, 4776, 4792, 4813, 4814, 4816, 4833, 4858, 4860, 4896, 4905, 4925,
+ 4936, 4937, 4938, 4941, 4946, 4963, 4972, 5010, 5028, 5043, 5058, 5063,
+ 5071, 5103, 5104, 5112, 5113, 5184, 5186
+
+* More checking functions: fread, fread_unlocked, open*, mq_open.
+ Implemented by Jakub Jelinek and Ulrich Drepper.
+
+* Extend fortification to C++. Implemented by Jakub Jelinek.
+
+* Implement 'm' modifier for scanf. Add stricter C99/SUS compliance
+ by not recognizing 'a' as a modifier when those specs are requested.
+ Implemented by Jakub Jelinek.
+
+* PPC optimizations to math and string functions.
+ Implemented by Steven Munroe.
+
+* New interfaces: mkostemp, mkostemp64. Like mkstemp* but allow additional
+ options to be passed. Implemented by Ulrich Drepper.
+
+* More CPU set manipulation functions. Implemented by Ulrich Drepper.
+
+* New Linux interfaces: signalfd, eventfd, eventfd_read, and eventfd_write.
+ Implemented by Ulrich Drepper.
+
+* Handle private futexes in the NPTL implementation.
+ Implemented by Jakub Jelinek and Ulrich Drepper.
+
+* Add support for O_CLOEXEC. Implement in Hurd. Use throughout libc.
+ Implemented by Roland McGrath and Ulrich Drepper.
+
+* Linux/x86-64 vDSO support. Implemented by Ulrich Drepper.
+
+* SHA-256 and SHA-512 based password encryption.
+ Implemented by Ulrich Drepper.
+
+* New locales: ber_DZ, ber_MA, en_NG, fil_PH, fur_IT, fy_DE, ha_NG, ig_NG,
+ ik_CA, iu_CA, li_BE, li_NL, nds_DE, nds_NL, pap_AN, sc_IT, tk_TM, ug_CN,
+ yo_NG.
+
++ New iconv modules: MAC-CENTRALEUROPE, ISO-8859-9E, KOI8-RU.
+ Implemented by Ulrich Drepper.
+
+Version 2.6
+
+* The following bugs are resolved with this release:
+
+ 3156, 3213, 3285, 3291, 3306, 3313, 3320, 3322, 3325, 3326, 3334, 3348,
+ 3352, 3363, 3369, 3426, 3427, 3429, 3451, 3458, 3465, 3480, 3483, 3493,
+ 3514, 3515, 3559, 3632, 3664, 3673, 3674, 3745, 3747, 3818, 3840, 3842,
+ 3851, 3855, 3884, 3885, 3902, 3905, 3919, 3944, 3954, 3955, 3957, 3991,
+ 3995, 3996, 4024, 4040, 4069, 4070, 4074, 4076, 4096, 4101, 4102, 4114,
+ 4130, 4131, 4181, 4276, 4306, 4342, 4344, 4349, 4364, 4368, 4381, 4392,
+ 4403, 4405, 4406, 4411, 4438, 4439, 4455, 4456, 4465, 4512, 4514, 4586,
+ 4702, 4858
+
+* New Linux interfaces: epoll_pwait, sched_getcpu.
+
+* New generic interfaces: strerror_l.
+
+* nscd can now cache the services database. Implemented by Ulrich Drepper.
+
+Version 2.5
+
+* The following bugs are resolved with this release:
+
+ 39, 68, 192, 352, 388, 531, 935, 1006, 1201, 1203, 1386, 1782, 1783, 1784,
+ 1785, 1786, 1787, 1951, 1974, 1996, 2072, 2098, 2125, 2134, 2158, 2182,
+ 2349, 2376, 2386, 2389, 2415, 2418, 2420, 2423, 2450, 2451, 2466, 2472,
+ 2473, 2477, 2498, 2499, 2501, 2502, 2505, 2507, 2508, 2509, 2517, 2526,
+ 2569, 2571, 2592, 2611, 2625, 2632, 2644, 2662, 2680, 2683, 2684, 2693,
+ 2695, 2703, 2734, 2751, 2764, 2766, 2775, 2792, 2821, 2823, 2832, 2841,
+ 2843, 2883, 2892, 2908, 2914, 2926, 2961, 2978, 2980, 2987, 2997, 2998,
+ 3013, 3018, 3034, 3040, 3044, 3123, 3124, 3137, 3138, 3143, 3155, 3189,
+ 3225, 3251, 3252, 3253, 3273
+
+* For Linux, the sorting of addresses returned by getaddrinfo now also
+ handles rules 3, 4, and 7 from RFC 3484. I.e., all rules are handled.
+ Implemented by Ulrich Drepper.
+
+* Allow system admin to configure getaddrinfo with the /etc/gai.conf file.
+ Implemented by Ulrich Drepper.
+
+* New Linux interfaces: splice, tee, sync_file_range, vmsplice.
+
+* New iconv module for MIK. Contributed by Alexander Shopov.
+
+* For sites with broken group and/or passwd database, the auto-propagate
+ option of nscd can prevent creating ID lookup entries from the results
+ of a name lookup and vice versa. This usually is no problem but some
+ site might have problems with the default behavior.
+ Implemented by Ulrich Drepper.
+
+* Iterating over entire database in NIS can be slow. With the
+ SETENT_BATCH_READ option in /etc/default/nss a system admin can decide
+ to trade time for memory. The entire database will be read at once.
+ Implemented by Ulrich Drepper.
+
+* The interfaces introduced in RFC 3542 have been implemented by
+ Ulrich Drepper.
+
+* Support for the new ELF hash table format was added by Ulrich Drepper.
+
+* Support for priority inheritance mutexes added by Jakub Jelinek and
+ Ulrich Drepper.
+
+* Support for priority protected mutexes added by Jakub Jelinek.
+
+* New locales: nr_ZA, pa_PK, ca_AD, ca_FR, ca_IT, el_CY, tr_CY, as_IN,
+ or_IN, csb_PL, fy_NL, sr_ME.
+
+Version 2.4
+
+* More overflow detection functions.
+
+* New iconv converters for IBM1025, IBM1122, IBM1137, IBM1153,
+ IBM1154, IBM1155, IBM1156, IBM1157, and IBM1158 contributed by Jiro Sekiba.
+
+ More converters for IBM803, IBM901, IBM902, IBM921, IBM1008, IBM1097,
+ IBM1112, IBM1123, IBM1130, IBM1140, IBM1141, IBM1142, IBM1143, IBM1144,
+ IBM1145, IBM1146, IBM1147, IBM1148, IBM1149, IBM1166, IBM1167, IBM4517,
+ IBM4899, IBM4909, IBM4971, IBM5347, IBM9030, IBM9066, IBM9448, IBM12712,
+ IBM16804, IBM1364, IBM1371, IBM1388, IBM1390, and IBM1399 contributed
+ by Masahide Washizawa.
+
+* It is now possible to install audit libraries for the dynamic linker using
+ LD_AUDIT. Implemented by Ulrich Drepper.
+
+* The LinuxThreads add-on, providing pthreads on Linux 2.4 kernels, is no
+ longer supported. The new NPTL implementation requires Linux 2.6 kernels.
+ For a libc and libpthread that works well on Linux 2.4 kernels, we
+ recommend using the stable 2.3 branch.
+
+* The new function open_wmemstream acts like open_memstream,
+ but uses a wchar_t wide character buffer.
+
+* The new function ppoll is an improved version of poll, similar to pselect.
+
+* New interfaces: fdopendir, openat, fstatat, fchmodat, fchownat,
+ futimesat, faccessat, mkdirat, mkfifoat, mknodat,
+ renameat, unlinkat, linkat, symlinkat, readlinkat.
+
+* New Linux kernel system calls: unshare,
+ inotify_init, inotify_add_watch, inotify_rm_watch.
+
+* The euidaccess function is now also known by the alias eaccess,
+ for compatibility with some other systems.
+
+* Timezone data updated to 2006b version.
+
+Version 2.3.6
+
+* The following bugs are resolved with this release:
+
+ 38, 253, 549, 622, 653, 721, 758, 851, 877, 915, 934, 955, 961,
+ 1016, 1037, 1076, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086,
+ 1087, 1088, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098,
+ 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109,
+ 1110, 1111, 1112, 1113, 1125, 1137, 1138, 1249, 1250, 1251, 1252,
+ 1253, 1254, 1350, 1358, 1394, 1438, 1498, 1534
+
+ Visit <https://sourceware.org/bugzilla/> for the details of each bug.
+
+* As of this release, GCC 4 can be used to compile the C Library.
+
+* Timezone data updated to 2005m version.
+
+Version 2.3.5
+
+* The following bugs are resolved with this release:
+
+ 284, 592, 602, 626, 633, 640, 650, 661, 671, 681, 693, 700, 710, 719,
+ 722, 723, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736,
+ 737, 738, 739, 740, 741, 742, 743, 744, 745, 765, 767, 768, 769, 776,
+ 777, 787, 821, 822, 823, 825
+
+ Visit <https://sourceware.org/bugzilla/> for the details of each bug.
+
+Version 2.3.4
+
+* Support for RFC 3678. Real implementations exist only for Linux so far.
+ Implemented by Ulrich Drepper.
+
+* nscd can now cache entries persistently. Expiring entries are reloaded.
+ For speedups the cache can be shared in memory with client processes.
+ Implemented by Ulrich Drepper.
+
+* nscd can now perform SELinux checks.
+ Implemented by Matthew Rickard <mjricka@epoch.ncsc.mil>.
+
+* getaddrinfo queries are now cached. Canonical name lookup is performed
+ efficiently.
+ Implemented by Ulrich Drepper.
+
+* The nothrow function attribute is used when headers are used by gcc when
+ compiling C code. This can avoid significant amounts of exception
+ handling data.
+
+* The malloc functions perform more error checking and are stricter when
+ it comes to reacting on errors. The default action is to terminate
+ the process after showing an error message. Implemented by Ulrich Drepper.
+
+* Reverse lookups of IPv6 addresses does not use bit string or .ip6.int
+ lookups anymore unless explicitly requested. Implemented by Ulrich Drepper.
+
+* Namespaces in ld.so are implemented. DSOs can be loaded in separate
+ namespaces using the new function dlmopen(). This feature is of course,
+ like most other dynamic loading functionality, not available in statically
+ linked applications. Implemented by Ulrich Drepper.
+
+* Low-overhead boundary checking variants of string and some stdio functions
+ were added. These are to be used in conjunction with a gcc patch by
+ Jakub Jelinek which adds calls to these functions if possible.
+ Implemented by Jakub Jelinek and Ulrich Drepper.
+
+* Old code for several operating systems and machine architectures that
+ have not been in working condition in a long time have been removed from
+ the main source tree maintained by the GNU C Library's maintainers.
+ These files are now reside in the separate `ports' source module
+ that is usable as an add-on when building the library.
+
+Version 2.3.3
+
+* New functions `dladdr1' and `dlinfo' in <dlfcn.h> provide more ways to
+ interrogate the dynamic linker, compatible with the Solaris interface.
+
+* ELF thread-local storage support (TLS) now works on PowerPC and PowerPC64;
+ implemented by Paul Mackerras, Steven Munroe, and Roland McGrath.
+
+* getifaddrs now uses the netlink interface on Linux to get its information.
+ Implemented by Thorsten Kukuk.
+
+* getaddrinfo now implements AI_V4MAPPED, AI_ALL, and AI_ADDRCONF.
+ Implemented by Ulrich Drepper.
+
+* support for non-executable stacks on x86 has been added. Changes mostly
+ by Roland McGrath.
+
+* regex is now much faster for multibyte locales. Changes by Jakub Jelinek
+ and Ulrich Drepper.
+
+* getaddrinfo now performs destination address selection according to
+ RFC 3484.
+
+Version 2.3.2
+
+* Thread-safe interfaces for many functions that access locale data
+ were added in version 2.3, but these features were omitted from NEWS.
+ Many functions have variants with an `_l' suffix that take a `locale_t'
+ object as a parameter rather than consulting the current locale.
+ The new functions `newlocale', `duplocale', and `freelocale' in <locale.h>
+ create and maintain `locale_t' objects. Additionally, the new function
+ `uselocale' sets "the current locale" (as used by functions not so
+ parameterized) set for an individual thread. These features were added
+ in version 2.3, implemented by Ulrich Drepper and Roland McGrath.
+
+* The functions getresuid, getresgid, setresuid, and setresgid, which
+ have long been available on Linux, are now declared in <unistd.h>
+ and are now also available on the Hurd.
+
+* ELF thread-local storage support (TLS) now works on x86-64.
+
+* The new dynamic string token $LIB is expanded in shared library names.
+ This normally expands to lib, but on some 64-bit platforms to lib64 instead.
+
+* Aldy Hernandez contributed complete software floating point support for
+ PowerPC machines with no FPU.
+
+* fexecve is implemented on Linux.
+
+* The `btowc' function should work at least twice as fast due to
+ specialized callbacks in the iconv modules. Implemented by Bruno Haible.
+
+* With approriate thread add-ons cancelable functions are now implemented
+ in libc.so as well. No need to call the function in libpthread. This
+ change allowed to finally disable the incorrect and expensive handling
+ of weak definition in ld.so.
+
+* Yet more PLT entries in libc.so have been removed. We finally arrived
+ at the bare minimum. Startup times improved appropriately.
+
+* Support for the new Linux/x86 system call interface was added. The
+ AT_SYSINFO auxiliary vector entry is recognized and handled.
+
+Version 2.3
+
+* Masahide Washizawa contributed iconv modules for IBM1163 and IBM1164
+ charsets.
+
+* iconv (the program and the interface) now accepts empty names (excluding
+ options like //TRANSLIT) to mean "use charset of current locale".
+
+* localedef can now transliterate characters in strings which are not in
+ the provided charmap. The information from the input locale is used.
+
+* Prelinking support was added for ELF targets. This requires additional
+ tools and recent versions of the GNU binutils. Contributed by Jakub Jelinek.
+
+* Read-only stdio streams now use mmap to speed up operation by eliminating
+ copying and buffer underflows. To use add 'm' to the mode string of
+ the fopen/fdopen/freopen call. Implemented by Ulrich Drepper.
+
+* The malloc functions were completely rewritten by Wolfram Gloger based
+ on Doug Lea's malloc-2.7.0.c.
+
+* Isamu Hasegawa contributed a completely new and POSIX-conformant
+ implementation of regex.
+
+* Bruno Haible upgraded the iconv and locale implementation to support
+ Unicode 3.2.
+
+* Contents of the LC_* and LANG environment variables in the CEN style are
+ not recognized anymore. It never was used. Change by Ulrich Drepper.
+
+* The runtime (ld.so, libc, libpthread for Linux) now can handle the ELF
+ thread-local storage (TLS) ABI on some platforms.
+ Changes by Ulrich Drepper. SH support by Kaz Kojima.
+
+* Bruno Haible contributed iconv converters for ISO-2022-JP-3, SHIFT JIS-X0213,
+ EUC-JISX0213, and TSCII.
+
+* New header <ifaddrs.h> with functions `getifaddrs' and `freeifaddrs':
+ BSD-compatible interface for getting all network interface addresses.
+ Implementation for IPv4 by Roland McGrath.
+
+* Loading of locale data is faster due to the introduction of a locale
+ archive. Implemented by Roland McGrath and Ulrich Drepper.
+
+* Startup times are significantly reduced by not using exported functions
+ inside the library itself. Changes by Jakub Jelinek, Roland McGrath,
+ and Ulrich Drepper.
+
+* Steven Munroe contributed a port to PowerPC64/Linux.
+
+Version 2.2.6
+
+* The Hurd now uses the GNU libio implementation of stdio rather than the
+ old GNU stdio implementation, and uses a new ABI (libc.so.0.3).
+
+* The Hurd on x86 now has the `ioperm' function and <sys/io.h> header file
+ with the same behavior as the Linux system call of the same name.
+
+Version 2.2.5
+
+* Stephen Moshier implemented log2, log10, powl and cbrtl for the
+ 128-bit long double format.
+
+* Masahide Washizawa contributed iconv modules for IBM1132, IBM1133, IBM1160,
+ IBM1161, and IBM1162 charsets.
+
+* Andreas Jaeger contributed a port to x86-64/Linux.
+
+* Peter Bruin contributed a port to PowerPC/Hurd.
+
+* libc functions using I/O streams now can handle wide-oriented streams
+ as well.
+
+* optimizations in the dynamic linker. Binaries created by recent binutils
+ versions start up quicker due to reduced time spent on relocations.
+
+* Support for use of gcc3 added by Jakub Jelinek and HJ Lu.
+
+Version 2.2.4
+
+* Stephen Moshier implemented cosh, expm1, log1p, acos, sinh, tanh,
+ asinh, atanh, j0 for the 128-bit long double format.
+
+* Bruno Haible updated all the code handling Unicode in some form to
+ support Unicode 3.1.
+
+* Speed of regex for single-byte locales is back to previous levels.
+ Patch by Isamu Hasegawa.
+
+* Alpha, SPARC, and IA-64 now also using floating stacks.
+
+* Startup time of internationalized applications greatly improved through
+ iconv cache. Use iconvconfig to generate the cache file.
+ Contributed by Ulrich Drepper.
+
+* The IA-64 specific part of ld.so was rewritten to eliminate some pretty
+ severe performance problems. Patch by David Mosberger.
+
+* The Hurd port got a lot more functionality like AIO, various stdio
+ extensions, etc. Mainly done by Roland McGrath.
+
+* mtrace can now lookup symbols in shared libraries.
+
+Version 2.2.3
+
+* Intel's IA-64 math library is largely integrated. It provides fast and
+ accurate implementatations for most basic and standard math functions
+ in float, double, and long double format.
+
+* Stephen Moshier implemented j0, j1, jn, y0, y1, yn, lgamma, erf, erfc,
+ and asin for the 96-bit long double format and asin, log, tan for the
+ 128-bit long double format.
+
+* The beginning of a last-bit accurate math library by IBM Haifa were added.
+ The basic double functions exist today. Contributed by Abraham Ziv
+ <ziv@il.ibm.com>, Moshe Olshansky <olshansk@il.ibm.com>, Ealan Henis
+ <ealan@il.ibm.com>, and Anna Reitman <reitman@il.ibm.com>.
+
+* An asynchronous name lookup library was added. The interface is designed
+ after POSIX AIO. The proposal was circulated beforehand to get comments.
+ No negative ones came in. Implemented by Ulrich Drepper.
+
+* Port to S390/64bit contributed by Martin Schwidefsky
+ <schwidefsky@de.ibm.com>.
+
+* David Mosberger <davidm@hpl.hp.com> implemented the setcontext family
+ of functions for Linux/IA-64.
+
+* The RPC code is now thread safe. Threads can now use the same service
+ of different services at the same time. Patch by Eric Norum
+ <eric.norum@usask.ca> with some help by Ulrich Drepper.
+
+* Martin Schwidefsky <schwidefsky@de.ibm.com> implemented the setcontext
+ family of functions for Linux/S390.
+
+* Ulrich Drepper <drepper@redhat.com> implemented the setcontext family
+ of functions for Linux/x86.
+
+* Port to Linux/CRIS contributed by Axis Communications.
+
+Version 2.2.2
+
+* Lots of headers were cleaned up. Using the tool in the conform/ subdir
+ we can now check for namespace violations and missing declarations. The
+ result is that almost all headers are now Unix-compliant (as defined in
+ the upcoming XPG6). The negative side is that some programs might need
+ corrections, too, if they depend on the incorrect form of the headers in
+ previous versions which defined too many symbols and included too many
+ other headers.
+
+* regex now handles multibyte character sets correctly.
+ Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
+
+* iconv (the program) does now conform to the upcoming XPG6 and handles
+ charmaps. Instead of the charset names the path of charmaps can be
+ provided and the conversion happens based on this data.
+ Contributed by Ulrich Drepper.
+
+* The locale program now provides detailed information about the installed
+ locales. While
+
+ locale -a
+
+ only lists the names of the supported locales
+
+ locale -a --verbose
+
+ provides details such as country, language, and codeset name.
+ Contributed by Ulrich Drepper.
+
+Version 2.2.1
+
+* The gencat program now parses the input file according to the charset
+ selected by the LC_CTYPE category. This is important for stateful
+ character sets. To make generating catalogs easier there is a way
+ to overwrite the charset selected by the locale: before the first
+ message or $ quote line the catalog can contain a line like
+
+ $ codeset=ISO-8859-2
+
+ to select the charset (ISO-8859-2 in this case).
+
+ Implemented by Shinya Hanataka and Ulrich Drepper.
+
+* New codeset conversion modules: IBM-922 (Estonia PC codeset),
+ IBM-1124 (Ukraine PC codeset), IBM-1129 (Vietnamese PC codeset).
+ Contributed by Masahide Washizawa <washi@jp.ibm.com>.
+
+* Optimized string functions for Alpha ev6 and ev67 by Richard Henderson
+ <rth@redhat.com> and Rick Gorton <rick.gorton@alpha-processor.com>.
+
+* The LANGUAGE environment variable is now ignored unless the locale is
+ changed from the default "C" locale.
+
+* The usual bug fixes.
+
+Version 2.2
+
+* Greg McGary added runtime support for bounds checking using gcc's
+ new -fbounded-pointers option. ix86 target is complete. PowerPC
+ is in progress.
+
+* Thorsten Kukuk added secure mode support to nscd.
+
+* The Berkeley db libraries have been removed.
+
+ Related, the nss_db module is now in a separate package since it
+ obviously requires a database library being available.
+
+* Wide character I/O streams implemented by Ulrich Drepper.
+
+* Functions from the extended socket API added by Ulrich Drepper.
+
+* Functions feenableexcept and fedisableexcept to control the
+ behaviour of individual exceptions have been added by Andreas Jaeger.
+
+* ldconfig program added by Andreas Jaeger and Jakub Jelinek.
+
+* The resolver code has been updated from bind 8.2.3-T5B which supports
+ threads. The integration was done by Andreas Jaeger, Adam D. Bradley,
+ and Mark Kettenis.
+
+ This change could in some situations effect backward compatibility. Since
+ now `_res' is a thread-local instead of a global variable, modifying it
+ in one thread does not have any effect in other threads.
+
+ The resolver library was also extended to allow IPv6 as the transport
+ protocol for the requests. This work was done by Stig Venaas.
+
+* Compatibility code for K&R C compilers has been removed from the
+ header files. A ISO C compiler is needed to use the library
+ (conforming to either C89 or C99 standard).
+
+* Complete rewrite of the localedef program to support multibyte character
+ sets. Implement handling of ISO 14651 and ISO 14652. Rewrite strcoll,
+ strxfrm, wcscoll, and wcsxfrm functions. Make isw*() functions work.
+ Implemented by Ulrich Drepper.
+
+ Bruno Haible significantly improved the generation and use of the data
+ structures for the wide character tables.
+
+* Plural handling in gettext implemented by Ulrich Drepper.
+
+* The utmp daemon has been removed.
+
+* The port to MIPS-Linux has been finished by Andreas Jaeger.
+
+* A port to Hitachi SH3 and SH4 has been contributed by Kazumoto Kojima
+ and Yutaka Niibe.
+
+* POSIX clocks and timers implemented by Kaz Kylheku and Ulrich Drepper.
+
+* POSIX barriers implemented by Kaz Kylheku.
+
+* POSIX spawn function family implemented by Ulrich Drepper.
+
+* POSIX spinlocks are now available.
+
+* Timed wait functions for mutex, rwlock, and semaphores are implemented.
+
+* the configure option --enable-kernel=X.Y.Z allows to strip out
+ compatibility for kernel versions before X.Y.Z. This is currently only
+ implemented for Linux.
+
+* the sockaddr_in6 structure changed. The IPv6 working group added a new
+ field sin6_scope_id. This means that all programs using IPv6 should be
+ recompiled. Don't expect binary compatibility with previous glibc
+ versions.
+
+* various conversion modules for IBM character sets contributed by
+ Masahide Washizawa.
+
+* IA-64 port by Jes Sorensen and HJ Lu.
+
+Version 2.1.3
+
+* bug fixes
+
+
+Version 2.1.2
+
+* bug fixes
+
+
+Version 2.1.1
+
+* New ISO C 9x function _Exit, imaxabs, and imaxdiv are added.
+
+* New xdr functions are added; some rpc functions are now 64bit clean.
+
+* Fixed a number of bugs and memory leaks (especially in NIS+ code).
+
+* Fixed known incompatibilities with glibc 2.0.
+
+* New functions lock64, strchrnul, rawmemchr, getutmp and getutmpx.
+
+* Optimized a number of functions (especially the ELF dynamic loader).
+
+* Update timezone data files.
+
+* lots of charmaps corrections
+
+* some new locale definitions and charmaps
+
+
+Version 2.1
+
+* Richard Henderson corrected size of struct timeval on Linux/Alpha to
+ conform to POSIX member type requirements. Symbol versions have been
+ adjusted as needed within the library, and for direct use by applications,
+ but there is potential for problems if third-party libraries use
+ struct timeval as part of their interface. This does not present
+ a problem for X and other "essential" system libraries.
+
+* An additional locale model to support C++ Standard Library locale
+ model and probably more was implemented by Ulrich Drepper.
+
+* Eric Youngdale and Ulrich Drepper implemented versioning of objects on
+ symbol level.
+
+* Miles Bader provided the `argp' function family to support hierachical
+ command line argument parsing, layered on top of getopt.
+
+* strtod accepts new hexadecimal floating-point format from ISO C 9X.
+
+* printf has two new specifiers %a and %A to print hexadecimal flaoting-point
+ numbers.
+
+* scanf recognizes the %a and %A format for scanning floating point numbers.
+
+* the new headers <stdint.h> and <inttypes.h> from ISO C 9X provides
+ information and interfaces for the available integer types.
+
+* about 130 new math functions were added to implement the ISO C9x math
+ library.
+
+* the new header <complex.h> contains definitions of the complex math
+ functions from ISO C 9X.
+
+* the new header <tgmath.h> defines generic macros to use complex or
+ real valued functions.
+
+* Thorsten Kukuk provided an implementation for NIS+, securelevel 0, 1 and 2.
+
+* Andreas Jaeger provided a test suite for the math library.
+
+* Mark Kettenis implemented the utmpx interface and an utmp daemon.
+
+* Ulrich Drepper added character set conversion functions (iconv).
+
+* Optimized string functions have been added.
+
+* The localedata addon is now part of glibc.
+
+* An implementation of profiling shared libraries was added by Ulrich Drepper.
+
+* Thorsten Kukuk and Ulrich Drepper provided an implementation for a caching
+ daemon for NSS (nscd).
+
+ Missing a better place here are some numbers on improvements. Under
+ Linux 2.1.125 un-tar-ing the kernel sources takes
+
+ user system wall
+
+ using local files 12.19s 6.88s 22.91s
+
+ using NIS 13.92s 8.91s 26.34s
+
+ using NIS & nscd 10.37s 7.34s 25.30s
+
+ using NIS+ 27.57s 30.37s 640.46s
+
+ using NIS+ & nscd 10.25s 7.83s 26.51s
+
+ using NIS & old nscd [1] 13.83s 8.32s 29.60s
+
+ Keep in mind that non-namelookup related operations dominate above times.
+ It was just a common complain that using NIS+ unpacking the kernel is
+ horribly slow.
+
+ [1] The old nscd implementation is not available anymore since it was
+ distributed with glibc up to version 2.0.98 and thus is now replaced.
+
+* Tim Waugh provided an implementation of the POSIX.2 wordexp function family.
+
+* Mark Kettenis provided a Hesiod NSS module.
+
+* The ELF dynamic loader knows how to process dynamic string tokens ($ORIGIN
+ and $PLATFORM) in RPATHs and similar strings (Ulrich Drepper).
+
+* rcmd can now handle netgroups (Dick Streefland).
+
+* A port to the ARM was contributed by Phil Blundell, Pat Beirne and Scott
+ Bambrough.
+
+* Support for the IPv6 protocol has been added to the socket API, as per the
+ latest draft standards.
+
+* Support for Linux 2.2 has been added.
+
+* Interface changes relative to the latest 2.0.x release:
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+addseverity NEW: Unix98
+alphasort64 NEW: LFS
+argp_err_exit_status NEW: argp, GNU ext
+argp_error NEW: argp, GNU ext
+argp_failure NEW: argp, GNU ext
+argp_help NEW: argp, GNU ext
+argp_parse NEW: argp, GNU ext
+argp_program_bug_address NEW: argp, GNU ext
+argp_program_version NEW: argp, GNU ext
+argp_program_version_hook NEW: argp, GNU ext
+argp_state_help NEW: argp, GNU ext
+argp_usage NEW: argp, GNU ext
+authdes_create NEW: Secure RPC
+authdes_getucred NEW: Secure RPC
+authdes_pk_create NEW: Secure RPC
+backtrace NEW: GNU ext.
+backtrace_symbols NEW: GNU ext.
+backtrace_symbols_fd NEW: GNU ext.
+cacos NEW: ISO C 9x
+cacosf NEW: ISO C 9x
+cacosh NEW: ISO C 9x
+cacoshf NEW: ISO C 9x
+cacoshl NEW: ISO C 9x
+cacosl NEW: ISO C 9x
+capget NEW: kernel
+capset NEW: kernel
+carg NEW: ISO C 9x
+cargf NEW: ISO C 9x
+cargl NEW: ISO C 9x
+casin NEW: ISO C 9x
+casinf NEW: ISO C 9x
+casinh NEW: ISO C 9x
+casinhf NEW: ISO C 9x
+casinhl NEW: ISO C 9x
+casinl NEW: ISO C 9x
+catan NEW: ISO C 9x
+catanf NEW: ISO C 9x
+catanh NEW: ISO C 9x
+catanhf NEW: ISO C 9x
+catanhl NEW: ISO C 9x
+catanl NEW: ISO C 9x
+cbc_crypt NEW: Secure RPC
+ccos NEW: ISO C 9x
+ccosf NEW: ISO C 9x
+ccosh NEW: ISO C 9x
+ccoshf NEW: ISO C 9x
+ccoshl NEW: ISO C 9x
+ccosl NEW: ISO C 9x
+cexp NEW: ISO C 9x
+cexpf NEW: ISO C 9x
+cexpl NEW: ISO C 9x
+cimag NEW: ISO C 9x
+cimagf NEW: ISO C 9x
+cimagl NEW: ISO C 9x
+clearerr_locked REMOVED
+clntunix_create NEW: sunrpc ext
+clog NEW: ISO C 9x
+clog10 NEW: ISO C 9x
+clog10f NEW: ISO C 9x
+clog10l NEW: ISO C 9x
+clogf NEW: ISO C 9x
+clogl NEW: ISO C 9x
+conj NEW: ISO C 9x
+conjf NEW: ISO C 9x
+conjl NEW: ISO C 9x
+cpow NEW: ISO C 9x
+cpowf NEW: ISO C 9x
+cpowl NEW: ISO C 9x
+cproj NEW: ISO C 9x
+cprojf NEW: ISO C 9x
+cprojl NEW: ISO C 9x
+creal NEW: ISO C 9x
+crealf NEW: ISO C 9x
+creall NEW: ISO C 9x
+creat64 NEW: LFS
+csin NEW: ISO C 9x
+csinf NEW: ISO C 9x
+csinh NEW: ISO C 9x
+csinhf NEW: ISO C 9x
+csinhl NEW: ISO C 9x
+csinl NEW: ISO C 9x
+csqrt NEW: ISO C 9x
+csqrtf NEW: ISO C 9x
+csqrtl NEW: ISO C 9x
+ctan NEW: ISO C 9x
+ctanf NEW: ISO C 9x
+ctanh NEW: ISO C 9x
+ctanhf NEW: ISO C 9x
+ctanhl NEW: ISO C 9x
+ctanl NEW: ISO C 9x
+des_setparity NEW: Secure RPC
+ecb_crypt NEW: Secure RPC
+endutxent NEW: Unix98
+exp10 NEW: ISO C 9x
+exp10f NEW: ISO C 9x
+exp10l NEW: ISO C 9x
+exp2 NEW: ISO C 9x
+exp2f NEW: ISO C 9x
+exp2l NEW: ISO C 9x
+fattach NEW: STREAMS
+fdetach NEW: STREAMS
+fdim NEW: ISO C 9x
+fdimf NEW: ISO C 9x
+fdiml NEW: ISO C 9x
+feclearexcept NEW: ISO C 9x
+fegetenv NEW: ISO C 9x
+fegetexceptflag NEW: ISO C 9x
+fegetround NEW: ISO C 9x
+feholdexcept NEW: ISO C 9x
+feof_locked REMOVED
+feraiseexcept NEW: ISO C 9x
+ferror_locked REMOVED
+fesetenv NEW: ISO C 9x
+fesetexceptflag NEW: ISO C 9x
+fesetround NEW: ISO C 9x
+fetestexcept NEW: ISO C 9x
+feupdateenv NEW: ISO C 9x
+fflush_locked REMOVED
+ffsl NEW: GNU ext.
+ffsll NEW: GNU ext.
+fgetpos64 NEW: LFS
+fgets_unlocked NEW: GNU ext.
+fileno_locked REMOVED
+fma NEW: ISO C 9x
+fmaf NEW: ISO C 9x
+fmal NEW: ISO C 9x
+fmax NEW: ISO C 9x
+fmaxf NEW: ISO C 9x
+fmaxl NEW: ISO C 9x
+fmin NEW: ISO C 9x
+fminf NEW: ISO C 9x
+fminl NEW: ISO C 9x
+fmtmsg NEW: Unix98
+fopen64 NEW: LFS
+fputc_locked REMOVED
+fputs_unlocked NEW: GNU ext.
+fread_unlocked NEW: GNU ext.
+freopen64 NEW: LFS
+fseeko NEW: Unix98
+fsetpos64 NEW: LFS
+fstatfs64 NEW: LFS
+fstatvfs NEW: Unix98
+fstatvfs64 NEW: LFS
+ftello NEW: Unix98
+ftello64 NEW: LFS
+ftruncate64 NEW: LFS
+ftw64 NEW: LFS
+fwrite_unlocked NEW: GNU ext.
+gai_strerror NEW: IPv6
+gamma_r REMOVED
+gammaf_r REMOVED
+gammal_r REMOVED
+getchar_locked REMOVED
+getdate NEW: Unix98
+getdate_err NEW: Unix98
+getdate_r NEW: GNU ext.
+getmsg NEW: STREAMS
+getnameinfo NEW: IPv6
+getnetname NEW: Secure RPC
+getpmsg NEW: STREAMS
+getpt NEW: Unix98 PTY
+getrlimit64 NEW: LFS
+getutxent NEW: Unix98
+getutxid NEW: Unix98
+getutxline NEW: Unix98
+glob64 NEW: GNU ext.
+globfree64 NEW: GNU ext.
+gnu_get_libc_release NEW: GNU ext.
+gnu_get_libc_version NEW: GNU ext.
+grantpt NEW: Unix98 PTY
+host2netname NEW: Secure RPC
+iconv NEW: iconv
+iconv_close NEW: iconv
+iconv_open NEW: iconv
+if_freenameindex NEW: IPv6
+if_indextoname NEW: IPv6
+if_nameindex NEW: IPv6
+if_nametoindex NEW: IPv6
+in6addr_any NEW: IPv6
+in6addr_loopback NEW: IPv6
+inet6_isipv4mapped NEW: IPv6
+isastream NEW: STREAMS
+iswblank NEW: GNU ext.
+key_decryptsession NEW: Secure RPC
+key_decryptsession_pk NEW: Secure RPC
+key_encryptsession NEW: Secure RPC
+key_encryptsession_pk NEW: Secure RPC
+key_gendes NEW: Secure RPC
+key_get_conv NEW: Secure RPC
+key_secretkey_is_set NEW: Secure RPC
+key_setnet NEW: Secure RPC
+key_setsecret NEW: Secure RPC
+llrint NEW: ISO C 9x
+llrintf NEW: ISO C 9x
+llrintl NEW: ISO C 9x
+llround NEW: ISO C 9x
+llroundf NEW: ISO C 9x
+llroundl NEW: ISO C 9x
+log2 NEW: ISO C 9x
+log2f NEW: ISO C 9x
+log2l NEW: ISO C 9x
+lrint NEW: ISO C 9x
+lrintf NEW: ISO C 9x
+lrintl NEW: ISO C 9x
+lround NEW: ISO C 9x
+lroundf NEW: ISO C 9x
+lroundl NEW: ISO C 9x
+lseek64 NEW: LFS
+makecontext NEW: Unix98
+mempcpy NEW: GNU ext.
+mmap64 NEW: LFS
+moncontrol REMOVED
+modify_ldt NEW: kernel
+nan NEW: ISO C 9x
+nanf NEW: ISO C 9x
+nanl NEW: ISO C 9x
+nearbyint NEW: ISO C 9x
+nearbyintf NEW: ISO C 9x
+nearbyintl NEW: ISO C 9x
+netname2host NEW: Secure RPC
+netname2user NEW: Secure RPC
+nexttoward NEW: ISO C 9x
+nexttowardf NEW: ISO C 9x
+nexttowardl NEW: ISO C 9x
+nftw NEW: Unix98
+nftw64 NEW: LFS
+open64 NEW: LFS
+passwd2des NEW: Secure RPC
+pow10 NEW: GNU ext.
+pow10f NEW: GNU ext.
+pow10l NEW: GNU ext.
+pread NEW: Unix98
+pread64 NEW: LFS
+printf_size NEW: GNU ext.
+printf_size_info NEW: GNU ext.
+profil_counter REMOVED
+pthread_mutexattr_getkind_np REPLACED
+pthread_mutexattr_setkind_np REPLACED
+ptsname NEW: Unix98 PTY
+ptsname_r NEW: Unix98 PTY
+putc_locked REMOVED
+putchar_locked REMOVED
+putgrent NEW: GNU ext.
+putmsg NEW: STREAMS
+putpmsg NEW: STREAMS
+pututxline NEW: Unix98
+pwrite NEW: Unix98
+pwrite64 NEW: LFS
+readdir64 NEW: LFS
+readdir64_r NEW: LFS
+remquo NEW: ISO C 9x
+remquof NEW: ISO C 9x
+remquol NEW: ISO C 9x
+round NEW: ISO C 9x
+roundf NEW: ISO C 9x
+roundl NEW: ISO C 9x
+rtime NEW: GNU ext.
+scalbln NEW: ISO C 9x
+scalblnf NEW: ISO C 9x
+scalblnl NEW: ISO C 9x
+scandir64 NEW: LFS
+sendfile NEW: kernel
+setcontext NEW: Unix98
+setrlimit64 NEW: LFS
+setutxent NEW: Unix98
+sighold NEW: Unix98
+sigignore NEW: Unix98
+sigqueue NEW: POSIX.1b
+sigrelse NEW: Unix98
+sigset NEW: POSIX.1b
+sigtimedwait NEW: POSIX.1b
+sigwaitinfo NEW: POSIX.1b
+sincos NEW: GNU ext.
+sincosf NEW: GNU ext.
+sincosl NEW: GNU ext.
+statfs64 NEW: LFS
+statvfs NEW: Unix98
+statvfs64 NEW: LFS
+strcasestr NEW: GNU ext.
+strtoimax NEW: ISO C 9x
+strtoumax NEW: ISO C 9x
+strverscmp NEW: GNU ext.
+svcauthdes_stats NEW: Secure RPC
+svcunix_create NEW: sunrpc etx
+svcunixfd_create NEW: sunrpc ext
+swapcontext NEW: Unix98
+tcgetsid NEW: Unix98 PTY
+tdestroy NEW: GNU ext.
+tgamma NEW: ISO C 9x
+tgammaf NEW: ISO C 9x
+tgammal NEW: ISO C 9x
+tmpfile64 NEW: LFS
+trunc NEW: ISO C 9x
+truncate64 NEW: LFS
+truncf NEW: ISO C 9x
+truncl NEW: ISO C 9x
+umount2 NEW: kernel
+unlockpt NEW: Unix98 PTY
+updwtmpx NEW: Unix98
+user2netname NEW: Secure RPC
+utmpxname NEW: Unix98
+versionsort NEW: GNU ext.
+versionsort64 NEW: GNU ext.
+waitid NEW: Unix98
+wcscasecmp NEW: GNU ext.
+wcsncasecmp NEW: GNU ext.
+wcsnlen NEW: GNU ext.
+wcstoimax NEW: ISO C 9x
+wcstoll NEW: ISO C 9x
+wcstoull NEW: ISO C 9x
+wcstoumax NEW: ISO C 9x
+wcswcs NEW: Unix98
+wordexp NEW: POSIX.2
+wordfree NEW: POSIX.2
+write_profiling REMOVED
+xdecrypt NEW: Secure RPC
+xdr_authdes_cred NEW: Secure RPC
+xdr_authdes_verf NEW: Secure RPC
+xdr_cryptkeyarg NEW: Secure RPC
+xdr_cryptkeyarg2 NEW: Secure RPC
+xdr_cryptkeyres NEW: Secure RPC
+xdr_getcredres NEW: Secure RPC
+xdr_key_netstarg NEW: Secure RPC
+xdr_key_netstres NEW: Secure RPC
+xdr_keybuf NEW: Secure RPC
+xdr_keystatus NEW: Secure RPC
+xdr_netnamestr NEW: Secure RPC
+xdr_sizeof NEW: Secure RPC
+xdr_unixcred NEW: sunrpc ext
+xencrypt NEW: Secure RPC
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Version 2.0.6
+
+* more bug fixes
+
+
+Version 2.0.5
+
+* more bug fixes
+
+* inet_ntoa is thread-safe
+
+* updwtmp is moved from libutil to libc
+
+* rewrite of cbrt function
+
+* update of timezone data
+
+Version 2.0.4
+
+* more bug fixes
+
+Version 2.0.3
+
+* more bug fixes
+
+Version 2.0.2
+
+* more bug fixes
+
+* add atoll function
+
+* fix complex problems in Berkeley DB code
+
+* fix math functions
+
+Version 2.0.1
+
+* fixed lots of header problems (especially Linux/GNU specific)
+
+* dynamic loader preserves all registers
+
+* Roland McGrath provided support for handling of auxiliary objects in
+ the ELF dynamic loader.
+
+* support for parallel builds is improved
+
+Version 2.0
+
+* GNU extensions are no longer declared by default. To enable them you
+ must define the macro `_GNU_SOURCE' in your program or compile with
+ `-D_GNU_SOURCE'.
+
+* The library has changed from using GNU ld symbol aliases to using weak
+ symbols where available. The ELF object file format supports weak
+ symbols; GNU ld also supports weak symbols in the a.out format. (There
+ is also now support for other GNU ld extensions in ELF. Use the
+ `--with-elf' option to configure to indicate you have ELF, and
+ `--with-gnu-ld' if using GNU ld.) This change resulted in the deletion
+ of many files which contained only symbol aliases, reducing the size of
+ the source and the compiled library; many other files were renamed to
+ less cryptic names previously occupied by the symbol alias files.
+ There is a new header file <elf.h> for programs which operate on
+ files in the ELF format.
+
+* Converted to Autoconf version 2, so `configure' has more options.
+ Run `configure --help' to see the details.
+
+* The library can now be configured to build profiling, highly-optimized
+ (but undebuggable), and/or shared libraries (ELF with GNU ld only). The
+ `--enable-profile', `--enable-omitfp', and `--enable-shared' options to
+ `configure' enable building these extra libraries. The shared library is
+ built by default when using both ELF and GNU ld. When shared libraries
+ are enabled, the new library `-ldl' is available for arbitrary run-time
+ loading of shared objects; its interface is defined in <dlfcn.h>. The
+ new header file <link.h> gives access to the internals of the run-time
+ dynamic linker, `ld.so'. The shell script `ldd' is similar to the
+ application of same name on other systems and it provides information
+ about dynamically linked binaries.
+
+* The C library now provides the run-time support code for profiling
+ executables compiled with `-pg'. Programs can control the profiling code
+ through the interface in <sys/gmon.h>. The `gmon.out' files written by
+ the GNU C library can be read only by GNU `gprof' (from GNU binutils);
+ the support for this file format was contributed by David Mosberger-Tang.
+
+* The math code has been replaced with a math library based on fdlibm from
+ Sun, and modified by JT Conklin and Ulrich Drepper with i387 support, by
+ Ian Taylor with `float' functions and by Ulrich Drepper with `long double'
+ functions. The math functions now reside in a separate library, so
+ programs using them will need to use `-lm' their linking commands.
+
+* John C. Bowman contributed optimized ix87 assembler inline functions.
+
+* Ulrich Drepper has contributed support for an `/etc/nsswitch.conf'
+ mechanism similar to that found in Solaris 2. This is now used for the
+ group, passwd, hosts, networks, services, protocols, rpc, ethers,
+ shadow, netgroup, publickey, and alias databases. The `nsswitch.conf'
+ file controls what services are used for each individual database. This
+ works by loading shared libraries with names specified in `nsswitch.conf',
+ so service modules can be changed or added at any time without even
+ relinking any program. Currently there are the file, db, and NIS based
+ NSS services available.
+
+* The new functions `strtoq' and `strtouq' parse integer values from
+ strings, like `strtol' and `strtoul', but they return `long long int' and
+ `unsigned long long int' values, respectively (64-bit quantities).
+
+* The new functions `strtof' and `strtold' parse floating-point values from
+ strings, like `strtod', but they return `float' and `long double' values,
+ respectively (on some machines `double' and `long double' are the same).
+
+* Ulrich Drepper has contributed new implementations of the floating-point
+ printing and reading code used in the `printf' family of functions and
+ `strtod', `strtof', and `strtold'. These new functions are perfectly
+ accurate, and much faster than the old ones.
+
+* The implementation of the POSIX locale model was completely rewritten by
+ Ulrich Drepper. This includes the new programs `localedef' and `locale'
+ to compile the POSIX locale definition.
+
+* The former dummy implementations of the strcoll and strxfrm function are
+ now replaced by fully functional code contributed by Ulrich Drepper. The
+ collation information comes from the POSIX locale definitions.
+
+* The new header <langinfo.h> defines an interface for accessing
+ various locale-dependent data (using the locale chosen with `setlocale').
+
+* Ulrich Drepper has contributed a new suite of functions for operation on
+ wide-character and multibyte-character strings, in <wchar.h>;
+ and classification and case conversion of wide characters, in <wctype.h>.
+ These new functions are conforming to the ISO C, Amendement 1 specification.
+
+* There is now a second implementation of the standard I/O library available.
+ It comes from GNU libg++ as was written by Per Bothner, heavily modified
+ by Hongjiu Lu and made thread safe by Ulrich Drepper.
+
+* You can now use positional parameter specifications in format strings
+ for the `printf' and `scanf' families of functions. For example,
+ `printf ("Number %2$d, Mr %1$s\n", "Jones", 6);'' prints
+ ``Number 6, Mr Jones''. This is mainly useful when providing different
+ format strings for different languages, whose grammars may dictate
+ different orderings of the values being printed. To support this
+ feature, the interface for `register_printf_handler' has changed; see
+ the header file <printf.h> for details.
+
+* The `printf' and `scanf' families of functions now understand a new
+ formatting flag for numeric conversions: the ' flag (e.g. %'d or %'f) says
+ to group numbers as indicated by the locale; for `scanf' and friends, this
+ says to accept as valid only a number with all the proper grouping
+ separators in the right places. In the default "C" locale, numbers are
+ not grouped; but locales for specific countries will define the usual
+ conventions (i.e. separate thousands with `,' in the US locale).
+
+* The pgrp functions have been regularized, slightly incompatibly but much
+ less confusingly. The core functions are now `getpgid' and `setpgid',
+ which take arguments for the PID to operate on; the POSIX.1 `getpgrp' (no
+ argument) and BSD `setpgrp' (identical to `setpgid') functions are
+ provided for compatibility. There is no longer an incompatible `getpgrp'
+ with an argument declared under _BSD_SOURCE; no BSD code uses it.
+
+* The new header file <fts.h> and suite of functions simplify programs that
+ operate on directory trees. This code comes from 4.4 BSD.
+
+* The resolver code has been updated from the BIND 4.9.5-P1 release.
+ Parts of the code were heavily modified by Ulrich Drepper to fit in the
+ NSS scheme used in glibc.
+
+* There is a new malloc debugging hook `__memalign_hook'.
+
+* There are new typedefs `ushort' for `unsigned short int' and `uint' for
+ `unsigned int' in <sys/types.h>. These are for compatibility only and
+ their use is discouraged.
+
+* The `-lmcheck' library to enable standard malloc debugging hooks is now
+ done differently, so that it works even without GNU ld.
+
+* New function `euidaccess' checks allowed access to a file like `access',
+ but using the effective IDs instead of the real IDs.
+
+* The time zone data files have been updated for the latest and greatest
+ local time conventions of the countries of the world.
+
+* The new function `dirfd' extracts the file descriptor used by a DIR stream;
+ see <dirent.h>.
+
+* The new functions `ecvt', `fcvt', and `gcvt' provide an obsolete interface
+ for formatting floating-point numbers. They are provided only for
+ compatibility; new programs should use `sprintf' instead. There are
+ also equivalent function for the `long double' floating-point type and
+ all functions also exist in a reentrant form.
+
+* The new auxiliary library `-lutil' from 4.4 BSD contains various
+ functions for maintaining the login-record files (primarily of use to
+ system programs such as `login'), and convenient functions for
+ allocating and initializing a pseudo-terminal (pty) device.
+
+* Ulrich Drepper has contributed new support for System V style
+ shared memory and IPC on systems that support it.
+
+* Ulrich Drepper has contributed several miscellaneous new functions found
+ in System V: The `hsearch' family of functions provide an effective
+ implementation of hash tables; `a64l' and `l64a' provide a very simple
+ binary to ASCII mapping; `drand48' and friends provide a 48-bit random
+ number generator.
+
+* Ulrich Drepper has contributed new reentrant counterparts for the
+ `random' and `hsearch' families of functions; `random_r', `hsearch_r', etc.
+
+* Ulrich Drepper has contributed new, highly-optimized versions of several
+ string functions for the i486/Pentium family of processors.
+
+* Ulrich Drepper has updated the Linux-specific code, based largely
+ on work done in Hongjiu Lu's version of GNU libc for Linux.
+ The GNU library now supports Linux versions 2.0.10 and later,
+ using the ELF object file format (i[3456]86-*-linux).
+
+* Andreas Schwab has ported the C library to Linux/m68k (m68k-*-linux).
+
+* David Mosberger-Tang and Richard Henderson have ported the C library
+ to Linux/Alpha (alpha-*-linux). Richard Henderson contributed the
+ dynamic linking support for ELF/Alpha.
+
+* Richard Henderson contributed several Alpha optimized assembler function
+ for arithmetic and string handling.
+
+* Ulrich Drepper has contributed a new set of message catalog functions to
+ support multiple languages using the <libintl.h> interface, for use with
+ his new package GNU gettext. Translation volunteers have contributed
+ catalogs of the library's messages in Spanish, German, and Korean.
+
+* For compatibility with XPG4, Ulrich Drepper has contributed the `gencat'
+ program and the `catgets' function for reading the catalog files it
+ creates. (The <libintl.h> interface is preferred; we include the
+ <nl_types.h> interface using `catgets' only for source compatibility with
+ programs already written to use it.)
+
+* New header file <values.h> gives SVID-compatible names for <limits.h>
+ constants.
+
+* Various new macros, declarations, and small header files for compatibility
+ with 4.4 BSD.
+
+* New function `group_member' is a convenient way to check if a process has
+ a given effective group ID.
+
+* When using GCC 2.7 and later, the socket functions are now declared in a
+ special way so that passing an argument of type `struct sockaddr_in *',
+ `struct sockaddr_ns *', or `struct sockaddr_un *' instead of the generic
+ `struct sockaddr *' type, does not generate a type-clash warning.
+
+* New function `error' declared in header file <error.h> is a convenient
+ function for printing error messages and optionally exiting; this is the
+ canonical function used in GNU programs. The new functions `err', `warn',
+ and friends in header file <err.h> are the canonical 4.4 BSD interface for
+ doing the same thing.
+
+* The <glob.h> interface has several new flags from 4.4 BSD that extend the
+ POSIX.2 `glob' function to do ~ and {...} expansion.
+
+* New function `unsetenv' complements `setenv' for compatibility with 4.4 BSD.
+ `clearenv' which is used in POSIX.9 is also available.
+
+* New function `getsid' returns session ID number on systems that support it.
+
+* We have incorporated the 4.4 BSD `db' library (version 1.85). New header
+ files <db.h> and <mpool.h> provide a rich set of functions for several
+ types of simple databases stored in memory and in files, and <ndbm.h> is
+ an old `ndbm'-compatible interface using the `db' functions. Link with
+ `-ldb' to get these functions.
+
+* New macro `strdupa' copies a string like `strdup', but uses local stack
+ space from `alloca' instead of dynamic heap space from `malloc'.
+
+* New function `strnlen' is like `strlen' but searches only a given maximum
+ number of characters for the null terminator. `stpncpy', `strndup' and
+ `strndupa' are similar variants for the `stpcpy', `strdup' and `strdupa'
+ function.
+
+* New function `statfs' in header <sys/statfs.h>.
+
+* The new <argz.h> and <envz.h> interfaces contributed by Miles Bader
+ provide convenient functions for operating on blocks of null-terminated
+ strings.
+
+* A new suite of functions in <utmp.h> handle all the details of reading
+ and writing the utmp file.
+
+* An implementation of the NIS/YP(tm) based NSS service was contributed by
+ Thorsten Kukuk.
+
+* Paul Eggert and Ulrich Drepper modified the `strftime' function to be
+ completely POSIX compliant and also implemented the extended functionality
+ to handle alternate digit representation and alternate era date formats.
+
+* Ulrich Drepper provided an implementation of the `strptime' function
+ defined in XPG4.2 which transforms a string into a `struct tm' value.
+
+* Paul Eggert provided the tzselect shell script as part of the timezone
+ code. The shell script makes it easy to select the correct timezone
+ specification.
+
+* The implementation of the malloc family of functions is completely replaced
+ by a new implementation by Doug Lea with many improvements by Wolfram Gloger.
+ The implementation uses the mmap function (if available) and it is
+ optimized for the use in multi threaded programs.
+
+* Ulrich Drepper contributed a MD5 "encryption" for the crypt family of
+ functions. This new functionality is usable by specifying a special
+ salt string and it is compatible with implementation on *BSD systems.
+
+* Lots of functions from the XPG4.2 standard were added by Ulrich Drepper:
+ `getsubopt' to handle second level command line options, `bsd_signal'
+ to access BSD style `signal' functionality, the obsolete `regexp' style
+ expression matcher.
+
+* the `lchown' function is available on system which support this
+ functionality.
+
+* The implementation of the shadow password handling function was contributed
+ by Ulrich Drepper.
+
+* David Mosberger-Tang changed the SunRPC implementation to be 64bit safe.
+
+* POSIX.1g support was added. The <sys/select.h> header is available,
+ `isfdtype' and `pselect' are implemented. Craig Metz contributed an
+ implementation of `getaddrinfo'.
+
+Version 1.09
+
+* For cross-compilation you should now set `BUILD_CC' instead of `HOST_CC'.
+
+* New header file <fstab.h> and new functions `getfsspec', `getfsent' and
+ friends, for parsing /etc/fstab. This code comes from 4.4 BSD.
+
+* The new function `daemon' from 4.4 BSD is useful for server programs that
+ want to put themselves in the background.
+
+* Joel Sherrill has contributed support for several standalone boards that
+ run without an operating system.
+
+* `printf', `scanf' and friends now accept a `q' type modifier for long
+ long int as well as `ll'. Formats using these might be `%qu' or `%lld'.
+
+* All of the code taken from BSD (notably most of the math and networking
+ routines) has been updated from the BSD 4.4-Lite release.
+
+* The resolver code has been updated from the BIND-4.9.3-BETA9 release.
+
+* The new functions `getdomainname' and `setdomainname' fetch or change the
+ YP/NIS domain name. These are system calls which exist on systems which
+ have YP (aka NIS).
+
+* The time zone data files have been updated for the latest international
+ conventions.
+
+* The SunRPC programs `portmap' and `rpcinfo' are now installed in
+ $(sbindir) (usually /usr/local/sbin) instead of $(bindir).
+
+Version 1.08
+
+* The C library now includes support for Sun RPC, from Sun's free
+ RPCSRC-4.0 distribution. The `portmap', `rpcinfo', and `rpcgen' programs
+ are included. (There is still no support for YP.)
+
+* Tom Quinn has contributed a port of the C library to SGI machines running
+ Irix 4 (mips-sgi-irix4).
+
+* The new `lockf' function is a simplified interface to the locking
+ facilities of `fcntl', included for compatibility.
+
+* New time functions `timegm', `timelocal', and `dysize' for compatibility.
+
+* New header file <sys/timeb.h> and new function `ftime' for compatibility.
+
+* New header files <poll.h> and <sys/poll.h> and new function `poll' for
+ compatibility.
+
+* The error message printed by `assert' for a failed assertion now includes
+ the name of the program (if using GNU ld) and the name of the calling
+ function (with versions of GCC that support this).
+
+* The `psignal' function is now declared in <signal.h>, not <stdio.h>.
+
+* The library now includes the <sys/mman.h> header file and memory
+ management functions `mmap', `munmap', `mprotect', `msync', and
+ `madvise', on systems that support those facilities.
+
+* The interface for `mcheck' has changed slightly: the function called to
+ abort the program when an allocation inconsistency is detected now takes
+ an argument that indicates the type of failure. The new function
+ `mprobe' lets you request a consistency check for a particular block at
+ any time (checks are normally done only when you call `free' or `realloc'
+ on a block).
+
+* It is now possible to easily cross-compile the C library, building on one
+ system a library to run on another machine and/or operating system. All
+ you need to do is set the variable `HOST_CC' in `configparms' to the
+ native compiler for programs to run on the machine you are building on (a
+ few generator programs are used on Unix systems); set `CC' to the
+ cross-compiler.
+
+* The new function `fexecve' (only implemented on the GNU system) executes
+ a program file given a file descriptor already open on the file.
+
+Version 1.07
+
+* Brendan Kehoe has contributed most of a port to the DEC Alpha
+ running OSF/1 (alpha-dec-osf1). He says it is 75% complete.
+
+* You can set the variable `libprefix' in `configparms' to specify a prefix
+ to be prepended to installed library files; this makes it easy to install
+ the GNU C library to be linked as `-lgnuc' or whatever.
+
+* The new `stpncpy' is a cross between `stpcpy' and `strncpy': It
+ copies a limited number of characters from a string, and returns the
+ address of the last character written.
+
+* You no longer need to check for whether the installed `stddef.h' is
+ compatible with the GNU C library. configure now checks for you.
+
+* You can now define a per-stream `fileno' function to convert the
+ stream's cookie into an integral file descriptor.
+
+* ``malloc (0)'' no longer returns a null pointer. Instead, it
+ allocates zero bytes of storage, and returns a unique pointer which
+ you can pass to `realloc' or `free'. The behavior is undefined if
+ you dereference this pointer.
+
+* The C library now runs on Sony NEWS m68k machines running either
+ NewsOS 3 or NewsOS 4.
+
+* The new `syscall' function is a system-dependent primitive function
+ for invoking system calls. It has the canonical behavior on Unix
+ systems, including unreliable return values for some calls (such as
+ `pipe', `fork' and `getppid').
+
+* The error code `EWOULDBLOCK' is now obsolete; it is always defined
+ to `EAGAIN', which is the preferred name. On systems whose kernels
+ use two distinct codes, the C library now translates EWOULDBLOCK to
+ EAGAIN in every system call function.
+
+Version 1.06
+
+* The GNU C Library Reference Manual is now distributed with the library.
+ `make dvi' will produce a DVI file of the printed manual.
+ `make info' will produce Info files that you can read on line using C-h i
+ in Emacs or the `info' program.
+ Please send comments on the manual to bug-glibc-manual@gnu.org.
+
+* The library now supports SVR4 on i386s (i386-unknown-sysv4).
+
+* Brendan Kehoe has contributed a port to Sun SPARCs running Solaris 2.
+
+* Jason Merrill has contributed a port to the Sequent Symmetry running
+ Dynix version 3 (i386-sequent-dynix).
+
+* The library has been ported to i386s running SCO 3.2.4 (also known as SCO
+ ODT 2.0; i386-unknown-sco3.2.4) or SCO 3.2 (i386-unknown-sco3.2).
+
+* New function `memory_warnings' lets you arrange to get warnings when
+ malloc is running out of memory to allocate, like Emacs gives you.
+
+* The C library now contains the relocating allocator used in Emacs 19 for
+ its editing buffers. This allocator (ralloc) minimizes allocation
+ overhead and fragmentation by moving allocated regions around whenever it
+ needs to. You always refer to a ralloc'd region with a "handle" (a
+ pointer to a pointer--an object of type `void **').
+
+* There is a new `printf' format: `%m' gives you the string corresponding
+ to the error code in `errno'.
+
+* In `scanf' formats, you can now use `%as' or `%a[' to do the normal `%s'
+ or `%[' conversion, but instead of filling in a fixed-sized buffer you
+ pass, the `a' modifier says to fill in a `char **' you pass with a
+ malloc'd string.
+
+* The `fnmatch' function supports the new flag bits `FNM_LEADING_DIR' and
+ `FNM_CASEFOLD'. `FNM_LEADING_DIR' lets a pattern like `foo*' match a
+ name like `foo/bar'. `FNM_CASEFOLD' says to ignore case in matching.
+
+* `mkstemp' is a traditional Unix function to atomically create and open a
+ uniquely-named temporary file.
+
+Version 1.05
+
+* The standard location for the file that says what the local timezone is
+ has changed again. It is now `/usr/local/etc/localtime' (or more
+ precisely, `${prefix}/etc/localtime') rather than `/etc/localtime'.
+
+* The distribution no longer contains any files with names longer than 14
+ characters.
+
+* `struct ttyent' has two new flag bits: TTY_TRUSTED and TTY_CONSOLE.
+ These are set by the new `trusted' and `console' keywords in `/etc/ttys'.
+
+* New functions `ttyslot' and `syslog' from 4.4 BSD.
+
+Version 1.04
+
+* The configuration process has changed quite a bit. The `configure'
+ script is now used just like the configuration scripts for other GNU
+ packages. The `sysdeps' directory hierarchy is much rearranged.
+ The file `INSTALL' explains the new scheme in detail.
+
+* The header files no longer need to be processed into ANSI C and
+ traditional C versions. There is just one set of files to install, and
+ it will work with ANSI or old C compilers (including `gcc -traditional').
+
+* Brendan Kehoe and Ian Lance Taylor have ported the library to the
+ MIPS DECStation running Ultrix 4.
+
+* The Sun 4 startup code (crt0) can now properly load SunOS 4 shared libraries.
+ Tom Quinn contributed the initial code. The GNU C library can NOT yet be
+ made itself into a shared library.
+
+* Yet further improved support for the i386, running 4.3 BSD-like systems
+ (such as Mach 3 with the Unix single-server), or System V.
+
+* New function `strncasecmp' to do case-insensitive string comparison
+ with limited length.
+
+* New function `strsep' is a reentrant alternative to `strtok'.
+
+* New functions `scandir' and `alphasort' for searching directories.
+
+* New function `setenv' is a better interface to `putenv'.
+
+* Ian Lance Taylor has contributed an implementation of the SVID `ftw'
+ function for traversing a directory tree.
+
+* The GNU obstack package is now also part of the C library.
+ The new function `open_obstack_stream' creates a stdio stream that
+ writes onto an obstack; `obstack_printf' and `obstack_vprintf' do
+ formatted output directly to an obstack.
+
+* Miscellaneous new functions: reboot, nice, sigaltstack (4.4 BSD only),
+ cfmakeraw, getusershell, getpass, swab, getttyent, seteuid, setegid.
+
+* `FNM_FILE_NAME' is another name for `FNM_PATHNAME', used with `fnmatch'.
+
+* The new functions `strfry' and `memfrob' do mysterious and wonderful
+ things to your strings.
+
+* There are some new test programs: test-fseek, testmb, and testrand.
+
+* Some work has been done to begin porting the library to 4.4 BSD and Linux.
+ These ports are not finished, but are a good starting place for really
+ supporting those systems.
+
+* `/etc/localtime' is now the standard location for the file that says what
+ the local timezone is, rather than `/usr/local/lib/zoneinfo/localtime'.
+ This follows the general principle that `/etc' is the place for all local
+ configuration files.
+
+* The C library header files now use `extern "C"' when used by the C++
+ compiler, so the C library should now work with C++ code.
+
+* The header file <bstring.h> is gone. <string.h> now declares bcopy,
+ bcmp, bzero, and ffs. (Update: nowadays these functions are declared
+ in <strings.h>.)
+
+* Mike Haertel (of GNU e?grep and malloc fame) has written a new sorting
+ function which uses the `merge sort' algorithm, and is said to be
+ significantly faster than the old GNU `qsort' function. Merge sort is
+ now the standard `qsort' function. The new algorithm can require a lot
+ of temporary storage; so, the old sorting function is called when the
+ required storage is not available.
+
+* The C library now includes Michael Glad's Ultra Fast Crypt, which
+ provides the Unix `crypt' function, plus some other entry points.
+
+* The code and header files taken from 4.4 BSD have been updated with the
+ latest files released from Berkeley.
+
+----------------------------------------------------------------------
+Copying conditions:
+
+ Permission is granted to anyone to make or distribute verbatim copies
+ of this document as received, in any medium, provided that the
+ copyright notice and this permission notice are preserved,
+ thus giving the recipient permission to redistribute in turn.
+
+ Permission is granted to distribute modified versions
+ of this document, or of portions of it,
+ under the above conditions, provided also that they
+ carry prominent notices stating who last changed them.
+
+Local variables:
+version-control: never
+fill-column: 72
+End:
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3999-patch/glibc-2.34-new/sysdeps/posix/getcwd.c
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3999-patch/glibc-2.34-new/sysdeps/posix/getcwd.c (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3999-patch/glibc-2.34-new/sysdeps/posix/getcwd.c (revision 348)
@@ -0,0 +1,502 @@
+/* Copyright (C) 1991-2021 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
+ <https://www.gnu.org/licenses/>. */
+
+#if !_LIBC
+# include <config.h>
+# include <unistd.h>
+# include "pathmax.h"
+#else
+# define HAVE_OPENAT 1
+# define D_INO_IN_DIRENT 1
+# define HAVE_MSVC_INVALID_PARAMETER_HANDLER 0
+# define HAVE_MINIMALLY_WORKING_GETCWD 0
+#endif
+
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdbool.h>
+#include <stddef.h>
+
+#include <fcntl.h> /* For AT_FDCWD on Solaris 9. */
+
+/* If this host provides the openat function or if we're using the
+ gnulib replacement function with a native fdopendir, then enable
+ code below to make getcwd more efficient and robust. */
+#if defined HAVE_OPENAT || (defined GNULIB_OPENAT && defined HAVE_FDOPENDIR)
+# define HAVE_OPENAT_SUPPORT 1
+#else
+# define HAVE_OPENAT_SUPPORT 0
+#endif
+
+#ifndef __set_errno
+# define __set_errno(val) (errno = (val))
+#endif
+
+#include <dirent.h>
+#ifndef _D_EXACT_NAMLEN
+# define _D_EXACT_NAMLEN(d) strlen ((d)->d_name)
+#endif
+#ifndef _D_ALLOC_NAMLEN
+# define _D_ALLOC_NAMLEN(d) (_D_EXACT_NAMLEN (d) + 1)
+#endif
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if _LIBC
+# ifndef mempcpy
+# define mempcpy __mempcpy
+# endif
+#endif
+
+#ifndef MAX
+# define MAX(a, b) ((a) < (b) ? (b) : (a))
+#endif
+#ifndef MIN
+# define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif
+
+/* In this file, PATH_MAX only serves as a threshold for choosing among two
+ algorithms. */
+#ifndef PATH_MAX
+# define PATH_MAX 8192
+#endif
+
+#if D_INO_IN_DIRENT
+# define MATCHING_INO(dp, ino) ((dp)->d_ino == (ino))
+#else
+# define MATCHING_INO(dp, ino) true
+#endif
+
+#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+# include "msvc-inval.h"
+#endif
+
+#if !_LIBC
+# define __close_nocancel_nostatus close
+# define __getcwd_generic rpl_getcwd
+# define stat64 stat
+# define __fstat64 fstat
+# define __fstatat64 fstatat
+# define __lstat64 lstat
+# define __closedir closedir
+# define __opendir opendir
+# define __readdir64 readdir
+# define __fdopendir fdopendir
+# define __openat openat
+# define __rewinddir rewinddir
+# define __openat64 openat
+# define dirent64 dirent
+#else
+# include <not-cancel.h>
+#endif
+
+/* The results of opendir() in this file are not used with dirfd and fchdir,
+ and we do not leak fds to any single-threaded code that could use stdio,
+ therefore save some unnecessary recursion in fchdir.c.
+ FIXME - if the kernel ever adds support for multi-thread safety for
+ avoiding standard fds, then we should use opendir_safer and
+ openat_safer. */
+#ifdef GNULIB_defined_opendir
+# undef opendir
+#endif
+#ifdef GNULIB_defined_closedir
+# undef closedir
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__
+# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+static char *
+getcwd_nothrow (char *buf, size_t size)
+{
+ char *result;
+
+ TRY_MSVC_INVAL
+ {
+ result = _getcwd (buf, size);
+ }
+ CATCH_MSVC_INVAL
+ {
+ result = NULL;
+ errno = ERANGE;
+ }
+ DONE_MSVC_INVAL;
+
+ return result;
+}
+# else
+# define getcwd_nothrow _getcwd
+# endif
+# define getcwd_system getcwd_nothrow
+#else
+# define getcwd_system getcwd
+#endif
+
+/* Get the name of the current working directory, and put it in SIZE
+ bytes of BUF. Returns NULL with errno set if the directory couldn't be
+ determined or SIZE was too small. If successful, returns BUF. In GNU,
+ if BUF is NULL, an array is allocated with 'malloc'; the array is SIZE
+ bytes long, unless SIZE == 0, in which case it is as big as necessary. */
+
+GETCWD_RETURN_TYPE
+__getcwd_generic (char *buf, size_t size)
+{
+ /* Lengths of big file name components and entire file names, and a
+ deep level of file name nesting. These numbers are not upper
+ bounds; they are merely large values suitable for initial
+ allocations, designed to be large enough for most real-world
+ uses. */
+ enum
+ {
+ BIG_FILE_NAME_COMPONENT_LENGTH = 255,
+ BIG_FILE_NAME_LENGTH = MIN (4095, PATH_MAX - 1),
+ DEEP_NESTING = 100
+ };
+
+#if HAVE_OPENAT_SUPPORT
+ int fd = AT_FDCWD;
+ bool fd_needs_closing = false;
+#else
+ char dots[DEEP_NESTING * sizeof ".." + BIG_FILE_NAME_COMPONENT_LENGTH + 1];
+ char *dotlist = dots;
+ size_t dotsize = sizeof dots;
+ size_t dotlen = 0;
+#endif
+ DIR *dirstream = NULL;
+ dev_t rootdev, thisdev;
+ ino_t rootino, thisino;
+ char *dir;
+ register char *dirp;
+ struct __stat64_t64 st;
+ size_t allocated = size;
+ size_t used;
+
+ /* A size of 1 byte is never useful. */
+ if (allocated == 1)
+ {
+ __set_errno (ERANGE);
+ return NULL;
+ }
+
+#if HAVE_MINIMALLY_WORKING_GETCWD
+ /* If AT_FDCWD is not defined, the algorithm below is O(N**2) and
+ this is much slower than the system getcwd (at least on
+ GNU/Linux). So trust the system getcwd's results unless they
+ look suspicious.
+
+ Use the system getcwd even if we have openat support, since the
+ system getcwd works even when a parent is unreadable, while the
+ openat-based approach does not.
+
+ But on AIX 5.1..7.1, the system getcwd is not even minimally
+ working: If the current directory name is slightly longer than
+ PATH_MAX, it omits the first directory component and returns
+ this wrong result with errno = 0. */
+
+# undef getcwd
+ dir = getcwd_system (buf, size);
+ if (dir || (size && errno == ERANGE))
+ return dir;
+
+ /* Solaris getcwd (NULL, 0) fails with errno == EINVAL, but it has
+ internal magic that lets it work even if an ancestor directory is
+ inaccessible, which is better in many cases. So in this case try
+ again with a buffer that's almost always big enough. */
+ if (errno == EINVAL && buf == NULL && size == 0)
+ {
+ char big_buffer[BIG_FILE_NAME_LENGTH + 1];
+ dir = getcwd_system (big_buffer, sizeof big_buffer);
+ if (dir)
+ return strdup (dir);
+ }
+
+# if HAVE_PARTLY_WORKING_GETCWD
+ /* The system getcwd works, except it sometimes fails when it
+ shouldn't, setting errno to ERANGE, ENAMETOOLONG, or ENOENT. */
+ if (errno != ERANGE && errno != ENAMETOOLONG && errno != ENOENT)
+ return NULL;
+# endif
+#endif
+ if (size == 0)
+ {
+ if (buf != NULL)
+ {
+ __set_errno (EINVAL);
+ return NULL;
+ }
+
+ allocated = BIG_FILE_NAME_LENGTH + 1;
+ }
+
+ if (buf == NULL)
+ {
+ dir = malloc (allocated);
+ if (dir == NULL)
+ return NULL;
+ }
+ else
+ dir = buf;
+
+ dirp = dir + allocated;
+ *--dirp = '\0';
+
+ if (__lstat64_time64 (".", &st) < 0)
+ goto lose;
+ thisdev = st.st_dev;
+ thisino = st.st_ino;
+
+ if (__lstat64_time64 ("/", &st) < 0)
+ goto lose;
+ rootdev = st.st_dev;
+ rootino = st.st_ino;
+
+ while (!(thisdev == rootdev && thisino == rootino))
+ {
+ struct dirent64 *d;
+ dev_t dotdev;
+ ino_t dotino;
+ bool mount_point;
+ int parent_status;
+ size_t dirroom;
+ size_t namlen;
+ bool use_d_ino = true;
+
+ /* Look at the parent directory. */
+#if HAVE_OPENAT_SUPPORT
+ fd = __openat64 (fd, "..", O_RDONLY);
+ if (fd < 0)
+ goto lose;
+ fd_needs_closing = true;
+ parent_status = __fstat64_time64 (fd, &st);
+#else
+ dotlist[dotlen++] = '.';
+ dotlist[dotlen++] = '.';
+ dotlist[dotlen] = '\0';
+ parent_status = __lstat64_time64 (dotlist, &st);
+#endif
+ if (parent_status != 0)
+ goto lose;
+
+ if (dirstream && __closedir (dirstream) != 0)
+ {
+ dirstream = NULL;
+ goto lose;
+ }
+
+ /* Figure out if this directory is a mount point. */
+ dotdev = st.st_dev;
+ dotino = st.st_ino;
+ mount_point = dotdev != thisdev;
+
+ /* Search for the last directory. */
+#if HAVE_OPENAT_SUPPORT
+ dirstream = __fdopendir (fd);
+ if (dirstream == NULL)
+ goto lose;
+ fd_needs_closing = false;
+#else
+ dirstream = __opendir (dotlist);
+ if (dirstream == NULL)
+ goto lose;
+ dotlist[dotlen++] = '/';
+#endif
+ for (;;)
+ {
+ /* Clear errno to distinguish EOF from error if readdir returns
+ NULL. */
+ __set_errno (0);
+ d = __readdir64 (dirstream);
+
+ /* When we've iterated through all directory entries without finding
+ one with a matching d_ino, rewind the stream and consider each
+ name again, but this time, using lstat. This is necessary in a
+ chroot on at least one system (glibc-2.3.6 + linux 2.6.12), where
+ .., ../.., ../../.., etc. all had the same device number, yet the
+ d_ino values for entries in / did not match those obtained
+ via lstat. */
+ if (d == NULL && errno == 0 && use_d_ino)
+ {
+ use_d_ino = false;
+ __rewinddir (dirstream);
+ d = __readdir64 (dirstream);
+ }
+
+ if (d == NULL)
+ {
+ if (errno == 0)
+ /* EOF on dirstream, which can mean e.g., that the current
+ directory has been removed. */
+ __set_errno (ENOENT);
+ goto lose;
+ }
+ if (d->d_name[0] == '.' &&
+ (d->d_name[1] == '\0' ||
+ (d->d_name[1] == '.' && d->d_name[2] == '\0')))
+ continue;
+
+ if (use_d_ino)
+ {
+ bool match = (MATCHING_INO (d, thisino) || mount_point);
+ if (! match)
+ continue;
+ }
+
+ {
+ int entry_status;
+#if HAVE_OPENAT_SUPPORT
+ entry_status = __fstatat64_time64 (fd, d->d_name, &st,
+ AT_SYMLINK_NOFOLLOW);
+#else
+ /* Compute size needed for this file name, or for the file
+ name ".." in the same directory, whichever is larger.
+ Room for ".." might be needed the next time through
+ the outer loop. */
+ size_t name_alloc = _D_ALLOC_NAMLEN (d);
+ size_t filesize = dotlen + MAX (sizeof "..", name_alloc);
+
+ if (filesize < dotlen)
+ goto memory_exhausted;
+
+ if (dotsize < filesize)
+ {
+ /* My, what a deep directory tree you have, Grandma. */
+ size_t newsize = MAX (filesize, dotsize * 2);
+ size_t i;
+ if (newsize < dotsize)
+ goto memory_exhausted;
+ if (dotlist != dots)
+ free (dotlist);
+ dotlist = malloc (newsize);
+ if (dotlist == NULL)
+ goto lose;
+ dotsize = newsize;
+
+ i = 0;
+ do
+ {
+ dotlist[i++] = '.';
+ dotlist[i++] = '.';
+ dotlist[i++] = '/';
+ }
+ while (i < dotlen);
+ }
+
+ memcpy (dotlist + dotlen, d->d_name, _D_ALLOC_NAMLEN (d));
+ entry_status = __lstat64_time64 (dotlist, &st);
+#endif
+ /* We don't fail here if we cannot stat() a directory entry.
+ This can happen when (network) file systems fail. If this
+ entry is in fact the one we are looking for we will find
+ out soon as we reach the end of the directory without
+ having found anything. */
+ if (entry_status == 0 && S_ISDIR (st.st_mode)
+ && st.st_dev == thisdev && st.st_ino == thisino)
+ break;
+ }
+ }
+
+ dirroom = dirp - dir;
+ namlen = _D_EXACT_NAMLEN (d);
+
+ if (dirroom <= namlen)
+ {
+ if (size != 0)
+ {
+ __set_errno (ERANGE);
+ goto lose;
+ }
+ else
+ {
+ char *tmp;
+ size_t oldsize = allocated;
+
+ allocated += MAX (allocated, namlen);
+ if (allocated < oldsize
+ || ! (tmp = realloc (dir, allocated)))
+ goto memory_exhausted;
+
+ /* Move current contents up to the end of the buffer.
+ This is guaranteed to be non-overlapping. */
+ dirp = memcpy (tmp + allocated - (oldsize - dirroom),
+ tmp + dirroom,
+ oldsize - dirroom);
+ dir = tmp;
+ }
+ }
+ dirp -= namlen;
+ memcpy (dirp, d->d_name, namlen);
+ *--dirp = '/';
+
+ thisdev = dotdev;
+ thisino = dotino;
+ }
+
+ if (dirstream && __closedir (dirstream) != 0)
+ {
+ dirstream = NULL;
+ goto lose;
+ }
+
+ if (dirp == &dir[allocated - 1])
+ *--dirp = '/';
+
+#if ! HAVE_OPENAT_SUPPORT
+ if (dotlist != dots)
+ free (dotlist);
+#endif
+
+ used = dir + allocated - dirp;
+ memmove (dir, dirp, used);
+
+ if (size == 0)
+ /* Ensure that the buffer is only as large as necessary. */
+ buf = (used < allocated ? realloc (dir, used) : dir);
+
+ if (buf == NULL)
+ /* Either buf was NULL all along, or 'realloc' failed but
+ we still have the original string. */
+ buf = dir;
+
+ return buf;
+
+ memory_exhausted:
+ __set_errno (ENOMEM);
+ lose:
+ {
+ int save = errno;
+ if (dirstream)
+ __closedir (dirstream);
+#if HAVE_OPENAT_SUPPORT
+ if (fd_needs_closing)
+ __close_nocancel_nostatus (fd);
+#else
+ if (dotlist != dots)
+ free (dotlist);
+#endif
+ if (buf == NULL)
+ free (dir);
+ __set_errno (save);
+ }
+ return NULL;
+}
+
+#if defined _LIBC && !defined GETCWD_RETURN_TYPE
+libc_hidden_def (__getcwd)
+weak_alias (__getcwd, getcwd)
+#endif
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3999-patch/glibc-2.34-new/sysdeps/unix/sysv/linux/Makefile
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3999-patch/glibc-2.34-new/sysdeps/unix/sysv/linux/Makefile (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3999-patch/glibc-2.34-new/sysdeps/unix/sysv/linux/Makefile (revision 348)
@@ -0,0 +1,359 @@
+# Option to pass to Python scripts to set the C compiler. Rewriting
+# MODULE_NAME is required to enable the _ISOMAC verbatim header
+# environment.
+sysdeps-linux-python-cc = \
+ --cc="$(CC) $(patsubst -DMODULE_NAME=%,-DMODULE_NAME=testsuite,$(CPPFLAGS))"
+
+# Additional dependencies for Python scripts.
+sysdeps-linux-python-deps = \
+ $(..)sysdeps/unix/sysv/linux/glibcsyscalls.py \
+ $(..)scripts/glibcextract.py
+
+# Invocation of the Python interpreter with the Python search path.
+sysdeps-linux-python = \
+ PYTHONPATH=$(..)scripts:$(..)sysdeps/unix/sysv/linux $(PYTHON)
+
+ifndef subdir
+# This target performs two actions:
+#
+# Replace <arch-syscall.h> with a file generated from kernel headers
+# and <fixup-asm-unistd.h>. Both files are located via the sysdeps
+# override search path.
+#
+# Update sysdeps/unix/sysv/linux/syscall-names.list with additional
+# names found in the generated <arch-syscall.h> file, so that the
+# global system call names list is a superset of the
+# architecture-specific system call names.
+#
+# To bootstrap a new architecture, create an empty file in the right
+# place and run `make update-syscall-lists' from the top-level of a
+# configured, but not-yet-built glibc tree.
+#
+# --lock points to a file not replaced during the update operation, so
+# that mutual exclusion is achieved.
+.PHONY: update-syscall-lists
+update-syscall-lists: arch-syscall.h
+ $(sysdeps-linux-python) \
+ sysdeps/unix/sysv/linux/update-syscall-lists.py \
+ $(sysdeps-linux-python-cc) \
+ --lock=sysdeps/unix/sysv/linux/update-syscall-lists.py $< \
+ sysdeps/unix/sysv/linux/syscall-names.list
+endif
+
+ifeq ($(subdir),csu)
+sysdep_routines += errno-loc
+endif
+
+ifeq ($(subdir),assert)
+CFLAGS-assert.c += -DFATAL_PREPARE_INCLUDE='<fatal-prepare.h>'
+CFLAGS-assert-perr.c += -DFATAL_PREPARE_INCLUDE='<fatal-prepare.h>'
+endif
+
+ifeq ($(subdir),malloc)
+CFLAGS-malloc.c += -DMORECORE_CLEARS=2
+endif
+
+ifeq ($(subdir),misc)
+sysdep_routines += adjtimex clone umount umount2 readahead sysctl \
+ setfsuid setfsgid epoll_pwait signalfd \
+ eventfd eventfd_read eventfd_write prlimit \
+ personality epoll_wait tee vmsplice splice \
+ open_by_handle_at mlock2 pkey_mprotect pkey_set pkey_get \
+ timerfd_gettime timerfd_settime prctl \
+ process_vm_readv process_vm_writev clock_adjtime \
+ pselect32 \
+ xstat fxstat lxstat xstat64 fxstat64 lxstat64 \
+ fxstatat fxstatat64 \
+ xmknod xmknodat convert_scm_timestamps \
+ closefrom_fallback \
+ clone3 clone-internal
+
+CFLAGS-gethostid.c = -fexceptions
+CFLAGS-tee.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-vmsplice.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-splice.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-open_by_handle_at.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-sync_file_range.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-pselect32.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-tst-writev.c += "-DARTIFICIAL_LIMIT=(0x80000000-sysconf(_SC_PAGESIZE))"
+
+sysdep_headers += sys/mount.h sys/acct.h \
+ sys/klog.h \
+ sys/user.h sys/prctl.h \
+ sys/kd.h sys/soundcard.h sys/vt.h \
+ sys/quota.h sys/fsuid.h \
+ scsi/sg.h scsi/scsi.h scsi/scsi_ioctl.h sys/pci.h \
+ sys/raw.h sys/personality.h sys/epoll.h \
+ bits/a.out.h sys/inotify.h sys/signalfd.h sys/eventfd.h \
+ sys/timerfd.h sys/fanotify.h bits/eventfd.h bits/inotify.h \
+ bits/signalfd.h bits/timerfd.h bits/epoll.h \
+ bits/socket_type.h bits/syscall.h \
+ bits/mman-linux.h bits/mman-shared.h bits/ptrace-shared.h \
+ bits/siginfo-arch.h bits/siginfo-consts-arch.h \
+ bits/procfs.h bits/procfs-id.h bits/procfs-extra.h \
+ bits/procfs-prregset.h bits/mman-map-flags-generic.h \
+ bits/shmlba.h \
+ bits/termios-struct.h bits/termios-c_cc.h \
+ bits/termios-c_iflag.h bits/termios-c_oflag.h \
+ bits/termios-baud.h bits/termios-c_cflag.h \
+ bits/termios-c_lflag.h bits/termios-tcflow.h \
+ bits/termios-misc.h \
+ bits/types/struct_semid_ds.h \
+ bits/types/struct_msqid_ds.h \
+ bits/types/struct_shmid_ds.h \
+ bits/ipc-perm.h \
+ bits/struct_stat.h \
+ bits/struct_stat_time64_helper.h \
+ bits/types/struct_msqid64_ds.h \
+ bits/types/struct_msqid64_ds_helper.h \
+ bits/types/struct_semid64_ds.h \
+ bits/types/struct_semid64_ds_helper.h \
+ bits/types/struct_shmid64_ds.h \
+ bits/types/struct_shmid64_ds_helper.h \
+ bits/pthread_stack_min.h bits/pthread_stack_min-dynamic.h
+
+tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \
+ tst-quota tst-sync_file_range tst-sysconf-iov_max tst-ttyname \
+ test-errno-linux tst-memfd_create tst-mlock2 tst-pkey \
+ tst-rlimit-infinity tst-ofdlocks tst-gettid tst-gettid-kill \
+ tst-tgkill tst-sysvsem-linux tst-sysvmsg-linux tst-sysvshm-linux \
+ tst-timerfd tst-ppoll \
+ tst-clock_adjtime tst-adjtimex tst-ntp_adjtime tst-ntp_gettime \
+ tst-ntp_gettimex tst-sigtimedwait tst-misalign-clone \
+ tst-close_range \
+ tst-prctl \
+ tst-scm_rights \
+ # tests
+
+# Test for the symbol version of fcntl that was replaced in glibc 2.28.
+ifeq ($(have-GLIBC_2.27)$(build-shared),yesyes)
+tests += tst-ofdlocks-compat
+endif
+
+tests-internal += tst-sigcontext-get_pc
+
+tests-time64 += \
+ tst-adjtimex-time64 \
+ tst-clock_adjtime-time64 \
+ tst-ntp_adjtime-time64 \
+ tst-ntp_gettime-time64 \
+ tst-ntp_gettimex-time64 \
+ tst-ppoll-time64 \
+ tst-sigtimedwait-time64 \
+ tst-timerfd-time64 \
+ tst-prctl-time64 \
+ tst-scm_rights-time64 \
+ # tests-time64
+
+tests-clone-internal = \
+ tst-align-clone-internal \
+ tst-clone2-internal \
+ tst-clone3-internal \
+ tst-getpid1-internal \
+ tst-misalign-clone-internal
+tests-internal += $(tests-clone-internal)
+tests-static += $(tests-clone-internal)
+
+CFLAGS-tst-sigcontext-get_pc.c = -fasynchronous-unwind-tables
+
+# Generate the list of SYS_* macros for the system calls (__NR_*
+# macros). The file syscall-names.list contains all possible system
+# call names, and the generated header file produces SYS_* macros for
+# the __NR_* macros which are actually defined.
+
+generated += bits/syscall.h
+$(objpfx)bits/syscall.h: \
+ ../sysdeps/unix/sysv/linux/gen-syscall-h.awk \
+ ../sysdeps/unix/sysv/linux/syscall-names.list
+ $(make-target-directory)
+ LC_ALL=C $(AWK) -f $^ > $@-tmp
+ $(move-if-change) $@-tmp $@
+before-compile += $(objpfx)bits/syscall.h
+
+# All macros defined by <sys/syscall.h>. Include <bits/syscall.h>
+# explicitly because <sys/sycall.h> skips it if _LIBC is defined.
+$(objpfx)tst-syscall-list-macros.list: \
+ $(objpfx)bits/syscall.h ../sysdeps/unix/sysv/linux/sys/syscall.h
+ printf '#include <linux/version.h>\n\
+#include <sys/syscall.h>\n#include <bits/syscall.h>\n' | \
+ $(CC) -E -o $@-tmp $(CFLAGS) $(CPPFLAGS) -x c - -dM
+ $(move-if-change) $@-tmp $@
+
+# __NR_* system call names. Used by the test below.
+$(objpfx)tst-syscall-list-nr.list: \
+ ../sysdeps/unix/sysv/linux/filter-nr-syscalls.awk \
+ $(objpfx)tst-syscall-list-macros.list
+ LC_ALL=C $(AWK) -f $^ > $@-tmp
+ $(move-if-change) $@-tmp $@
+
+# SYS_* system call names. Used by the test below.
+$(objpfx)tst-syscall-list-sys.list: $(objpfx)tst-syscall-list-macros.list
+ LC_ALL=C $(AWK) '/^#define SYS_/ { print substr($$2, 5) }' $< > $@-tmp
+ $(move-if-change) $@-tmp $@
+
+tests-special += $(objpfx)tst-syscall-list.out
+$(objpfx)tst-syscall-list.out: \
+ ../sysdeps/unix/sysv/linux/tst-syscall-list.sh \
+ $(objpfx)tst-syscall-list-macros.list \
+ $(objpfx)tst-syscall-list-nr.list \
+ $(objpfx)tst-syscall-list-sys.list
+ $(BASH) $^ $(AWK) > $@; $(evaluate-test)
+
+tests-special += $(objpfx)tst-glibcsyscalls.out
+# arch-syscall.h is located via the sysdeps override search path.
+$(objpfx)tst-glibcsyscalls.out: arch-syscall.h \
+ ../sysdeps/unix/sysv/linux/syscall-names.list
+ $(sysdeps-linux-python) \
+ ../sysdeps/unix/sysv/linux/tst-glibcsyscalls.py \
+ $(sysdeps-linux-python-cc) $< \
+ ../sysdeps/unix/sysv/linux/syscall-names.list \
+ < /dev/null > $@ 2>&1; $(evaluate-test)
+$(objpfx)tst-glibcsyscalls.out: \
+ ../sysdeps/unix/sysv/linux/tst-glibcsyscalls.py \
+ $(sysdeps-linux-python-deps)
+
+# Separate object file for access to the constant from the UAPI header.
+$(objpfx)tst-sysconf-iov_max: $(objpfx)tst-sysconf-iov_max-uapi.o
+
+tests-special += $(objpfx)tst-mman-consts.out
+$(objpfx)tst-mman-consts.out: ../sysdeps/unix/sysv/linux/tst-mman-consts.py
+ $(sysdeps-linux-python) \
+ ../sysdeps/unix/sysv/linux/tst-mman-consts.py \
+ $(sysdeps-linux-python-cc) \
+ < /dev/null > $@ 2>&1; $(evaluate-test)
+$(objpfx)tst-mman-consts.out: $(sysdeps-linux-python-deps)
+
+endif # $(subdir) == misc
+
+ifeq ($(subdir),time)
+sysdep_headers += sys/timex.h bits/timex.h
+
+sysdep_routines += ntp_gettime ntp_gettimex
+
+tests += \
+ tst-clock_gettime-clobber \
+ tst-gettimeofday-clobber \
+ tst-time-clobber \
+ # tests
+endif
+
+ifeq ($(subdir),signal)
+tests-special += $(objpfx)tst-signal-numbers.out
+# Depending on signal.o* is a hack. What we actually want is a dependency
+# on signal.h and everything it includes. That's impractical to write
+# in this context, but signal.c includes signal.h and not much else so it'll
+# be conservatively correct.
+$(objpfx)tst-signal-numbers.out: \
+ ../sysdeps/unix/sysv/linux/tst-signal-numbers.py \
+ $(objpfx)signal.o*
+ $(sysdeps-linux-python) \
+ ../sysdeps/unix/sysv/linux/tst-signal-numbers.py \
+ $(sysdeps-linux-python-cc) \
+ < /dev/null > $@ 2>&1; $(evaluate-test)
+$(objpfx)tst-signal-numbers.out: $(sysdeps-linux-python-deps)
+endif
+
+ifeq ($(subdir),socket)
+sysdep_headers += net/if_ppp.h net/ppp-comp.h \
+ net/ppp_defs.h net/if_arp.h net/route.h net/ethernet.h \
+ net/if_slip.h net/if_packet.h net/if_shaper.h \
+ bits/socket-constants.h
+sysdep_routines += cmsg_nxthdr
+CFLAGS-recvmmsg.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-sendmmsg.c = -fexceptions -fasynchronous-unwind-tables
+
+tests-special += $(objpfx)tst-socket-consts.out
+$(objpfx)tst-socket-consts.out: ../sysdeps/unix/sysv/linux/tst-socket-consts.py
+ PYTHONPATH=../scripts \
+ $(PYTHON) ../sysdeps/unix/sysv/linux/tst-socket-consts.py \
+ --cc="$(CC) $(patsubst -DMODULE_NAME=%, \
+ -DMODULE_NAME=testsuite, \
+ $(CPPFLAGS)) -D_ISOMAC" \
+ < /dev/null > $@ 2>&1; $(evaluate-test)
+endif # $(subdir) == socket
+
+ifeq ($(subdir),sunrpc)
+sysdep_headers += nfs/nfs.h
+endif
+
+ifeq ($(subdir),termios)
+sysdep_headers += termio.h
+endif
+
+ifeq ($(subdir),posix)
+sysdep_headers += bits/initspin.h
+
+sysdep_routines += sched_getcpu oldglob getcpu
+
+tests += tst-affinity tst-affinity-pid
+
+tests-static := tst-affinity-static
+tests += $(tests-static)
+
+CFLAGS-fork.c = $(libio-mtsafe)
+CFLAGS-getpid.o = -fomit-frame-pointer
+CFLAGS-getpid.os = -fomit-frame-pointer
+endif
+
+ifeq ($(subdir),inet)
+sysdep_headers += netinet/if_fddi.h netinet/if_tr.h \
+ netipx/ipx.h netash/ash.h netax25/ax25.h netatalk/at.h \
+ netrom/netrom.h netpacket/packet.h netrose/rose.h \
+ neteconet/ec.h netiucv/iucv.h
+sysdep_routines += netlink_assert_response
+endif
+
+# Don't compile the ctype glue code, since there is no old non-GNU C library.
+inhibit-glue = yes
+
+ifeq ($(subdir),dirent)
+sysdep_routines += getdirentries getdirentries64
+tests += tst-getdents64
+
+# The tested readdir64 symbol was replaced in glibc 2.2.
+ifeq ($(have-GLIBC_2.1.3)$(build-shared),yesyes)
+tests += tst-readdir64-compat
+endif
+endif # $(subdir) == dirent
+
+ifeq ($(subdir),nis)
+CFLAGS-ypclnt.c = -DUSE_BINDINGDIR=1
+endif
+
+ifeq ($(subdir),io)
+sysdep_routines += xstatconv internal_statvfs \
+ sync_file_range fallocate fallocate64 \
+ close_nocancel fcntl_nocancel \
+ open_nocancel open64_nocancel \
+ openat_nocancel openat64_nocancel \
+ read_nocancel pread64_nocancel \
+ write_nocancel statx_cp stat_t64_cp
+
+sysdep_headers += bits/fcntl-linux.h
+
+tests += tst-fallocate tst-fallocate64 tst-getcwd-smallbuff tst-o_path-locks
+endif
+
+ifeq ($(subdir),elf)
+sysdep-rtld-routines += dl-brk dl-sbrk dl-getcwd dl-openat64 dl-opendir
+
+libof-lddlibc4 = lddlibc4
+
+others += pldd
+install-bin += pldd
+$(objpfx)pldd: $(objpfx)xmalloc.o
+endif
+
+ifeq ($(subdir),rt)
+CFLAGS-mq_send.c += -fexceptions
+CFLAGS-mq_receive.c += -fexceptions
+endif
+
+ifeq ($(subdir),nscd)
+sysdep-CFLAGS += -DHAVE_EPOLL -DHAVE_INOTIFY -DHAVE_NETLINK
+CFLAGS-gai.c += -DNEED_NETLINK
+endif
+
+ifeq ($(subdir),nptl)
+tests += tst-align-clone tst-getpid1
+endif
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3999-patch/glibc-2.34-new/sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3999-patch/glibc-2.34-new/sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-3999-patch/glibc-2.34-new/sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c (revision 348)
@@ -0,0 +1,241 @@
+/* Verify that getcwd returns ERANGE for size 1 byte and does not underflow
+ buffer when the CWD is too long and is also a mount target of /. See bug
+ #28769 or CVE-2021-3999 for more context.
+ Copyright The GNU Toolchain Authors.
+ 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
+ <https://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <intprops.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mount.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <support/check.h>
+#include <support/temp_file.h>
+#include <support/xsched.h>
+#include <support/xunistd.h>
+
+static char *base;
+#define BASENAME "tst-getcwd-smallbuff"
+#define MOUNT_NAME "mpoint"
+static int sockfd[2];
+
+static void
+do_cleanup (void)
+{
+ support_chdir_toolong_temp_directory (base);
+ TEST_VERIFY_EXIT (rmdir (MOUNT_NAME) == 0);
+ free (base);
+}
+
+static void
+send_fd (const int sock, const int fd)
+{
+ struct msghdr msg = {0};
+ union
+ {
+ struct cmsghdr hdr;
+ char buf[CMSG_SPACE (sizeof (int))];
+ } cmsgbuf = {0};
+ struct cmsghdr *cmsg;
+ struct iovec vec;
+ char ch = 'A';
+ ssize_t n;
+
+ msg.msg_control = &cmsgbuf.buf;
+ msg.msg_controllen = sizeof (cmsgbuf.buf);
+
+ cmsg = CMSG_FIRSTHDR (&msg);
+ cmsg->cmsg_len = CMSG_LEN (sizeof (int));
+ cmsg->cmsg_level = SOL_SOCKET;
+ cmsg->cmsg_type = SCM_RIGHTS;
+ memcpy (CMSG_DATA (cmsg), &fd, sizeof (fd));
+
+ vec.iov_base = &ch;
+ vec.iov_len = 1;
+ msg.msg_iov = &vec;
+ msg.msg_iovlen = 1;
+
+ while ((n = sendmsg (sock, &msg, 0)) == -1 && errno == EINTR);
+
+ TEST_VERIFY_EXIT (n == 1);
+}
+
+static int
+recv_fd (const int sock)
+{
+ struct msghdr msg = {0};
+ union
+ {
+ struct cmsghdr hdr;
+ char buf[CMSG_SPACE(sizeof(int))];
+ } cmsgbuf = {0};
+ struct cmsghdr *cmsg;
+ struct iovec vec;
+ ssize_t n;
+ char ch = '\0';
+ int fd = -1;
+
+ vec.iov_base = &ch;
+ vec.iov_len = 1;
+ msg.msg_iov = &vec;
+ msg.msg_iovlen = 1;
+
+ msg.msg_control = &cmsgbuf.buf;
+ msg.msg_controllen = sizeof (cmsgbuf.buf);
+
+ while ((n = recvmsg (sock, &msg, 0)) == -1 && errno == EINTR);
+ if (n != 1 || ch != 'A')
+ return -1;
+
+ cmsg = CMSG_FIRSTHDR (&msg);
+ if (cmsg == NULL)
+ return -1;
+ if (cmsg->cmsg_type != SCM_RIGHTS)
+ return -1;
+ memcpy (&fd, CMSG_DATA (cmsg), sizeof (fd));
+ if (fd < 0)
+ return -1;
+ return fd;
+}
+
+static int
+child_func (void * const arg)
+{
+ xclose (sockfd[0]);
+ const int sock = sockfd[1];
+ char ch;
+
+ TEST_VERIFY_EXIT (read (sock, &ch, 1) == 1);
+ TEST_VERIFY_EXIT (ch == '1');
+
+ if (mount ("/", MOUNT_NAME, NULL, MS_BIND | MS_REC, NULL))
+ FAIL_EXIT1 ("mount failed: %m\n");
+ const int fd = xopen ("mpoint",
+ O_RDONLY | O_PATH | O_DIRECTORY | O_NOFOLLOW, 0);
+
+ send_fd (sock, fd);
+ xclose (fd);
+
+ TEST_VERIFY_EXIT (read (sock, &ch, 1) == 1);
+ TEST_VERIFY_EXIT (ch == 'a');
+
+ xclose (sock);
+ return 0;
+}
+
+static void
+update_map (char * const mapping, const char * const map_file)
+{
+ const size_t map_len = strlen (mapping);
+
+ const int fd = xopen (map_file, O_WRONLY, 0);
+ xwrite (fd, mapping, map_len);
+ xclose (fd);
+}
+
+static void
+proc_setgroups_write (const long child_pid, const char * const str)
+{
+ const size_t str_len = strlen(str);
+
+ char setgroups_path[sizeof ("/proc//setgroups") + INT_STRLEN_BOUND (long)];
+
+ snprintf (setgroups_path, sizeof (setgroups_path),
+ "/proc/%ld/setgroups", child_pid);
+
+ const int fd = open (setgroups_path, O_WRONLY);
+
+ if (fd < 0)
+ {
+ TEST_VERIFY_EXIT (errno == ENOENT);
+ FAIL_UNSUPPORTED ("/proc/%ld/setgroups not found\n", child_pid);
+ }
+
+ xwrite (fd, str, str_len);
+ xclose(fd);
+}
+
+static char child_stack[1024 * 1024];
+
+int
+do_test (void)
+{
+ base = support_create_and_chdir_toolong_temp_directory (BASENAME);
+
+ xmkdir (MOUNT_NAME, S_IRWXU);
+ atexit (do_cleanup);
+
+ TEST_VERIFY_EXIT (socketpair (AF_UNIX, SOCK_STREAM, 0, sockfd) == 0);
+ pid_t child_pid = xclone (child_func, NULL, child_stack,
+ sizeof (child_stack),
+ CLONE_NEWUSER | CLONE_NEWNS | SIGCHLD);
+
+ xclose (sockfd[1]);
+ const int sock = sockfd[0];
+
+ char map_path[sizeof ("/proc//uid_map") + INT_STRLEN_BOUND (long)];
+ char map_buf[sizeof ("0 1") + INT_STRLEN_BOUND (long)];
+
+ snprintf (map_path, sizeof (map_path), "/proc/%ld/uid_map",
+ (long) child_pid);
+ snprintf (map_buf, sizeof (map_buf), "0 %ld 1", (long) getuid());
+ update_map (map_buf, map_path);
+
+ proc_setgroups_write ((long) child_pid, "deny");
+ snprintf (map_path, sizeof (map_path), "/proc/%ld/gid_map",
+ (long) child_pid);
+ snprintf (map_buf, sizeof (map_buf), "0 %ld 1", (long) getgid());
+ update_map (map_buf, map_path);
+
+ TEST_VERIFY_EXIT (send (sock, "1", 1, MSG_NOSIGNAL) == 1);
+ const int fd = recv_fd (sock);
+ TEST_VERIFY_EXIT (fd >= 0);
+ TEST_VERIFY_EXIT (fchdir (fd) == 0);
+
+ static char buf[2 * 10 + 1];
+ memset (buf, 'A', sizeof (buf));
+
+ /* Finally, call getcwd and check if it resulted in a buffer underflow. */
+ char * cwd = getcwd (buf + sizeof (buf) / 2, 1);
+ TEST_VERIFY (cwd == NULL);
+ TEST_VERIFY (errno == ERANGE);
+
+ for (int i = 0; i < sizeof (buf); i++)
+ if (buf[i] != 'A')
+ {
+ printf ("buf[%d] = %02x\n", i, (unsigned int) buf[i]);
+ support_record_failure ();
+ }
+
+ TEST_VERIFY_EXIT (send (sock, "a", 1, MSG_NOSIGNAL) == 1);
+ xclose (sock);
+ TEST_VERIFY_EXIT (xwaitpid (child_pid, NULL, 0) == child_pid);
+
+ return 0;
+}
+
+#define CLEANUP_HANDLER do_cleanup
+#include <support/test-driver.c>
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-38604-patch/create.patch.sh
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-38604-patch/create.patch.sh (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-38604-patch/create.patch.sh (revision 348)
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+VERSION=2.34
+
+tar --files-from=file.list -xJvf ../glibc-$VERSION.tar.xz
+mv glibc-$VERSION glibc-$VERSION-orig
+
+cp -rf ./glibc-$VERSION-new ./glibc-$VERSION
+
+diff -b --unified -Nr glibc-$VERSION-orig glibc-$VERSION > glibc-$VERSION-CVE-2021-38604.patch
+
+mv glibc-$VERSION-CVE-2021-38604.patch ../patches
+
+rm -rf ./glibc-$VERSION
+rm -rf ./glibc-$VERSION-orig
Property changes on: toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-38604-patch/create.patch.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-38604-patch/file.list
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-38604-patch/file.list (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-38604-patch/file.list (revision 348)
@@ -0,0 +1 @@
+glibc-2.34/sysdeps/unix/sysv/linux/mq_notify.c
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-38604-patch/glibc-2.34-new/sysdeps/unix/sysv/linux/mq_notify.c
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-38604-patch/glibc-2.34-new/sysdeps/unix/sysv/linux/mq_notify.c (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-CVE-2021-38604-patch/glibc-2.34-new/sysdeps/unix/sysv/linux/mq_notify.c (revision 348)
@@ -0,0 +1,275 @@
+/* Copyright (C) 2004-2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contribute by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+ 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
+ <https://www.gnu.org/licenses/>. */
+
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <mqueue.h>
+#include <pthread.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysdep.h>
+#include <unistd.h>
+#include <sys/socket.h>
+#include <not-cancel.h>
+#include <pthreadP.h>
+#include <shlib-compat.h>
+
+/* Defined in the kernel headers: */
+#define NOTIFY_COOKIE_LEN 32 /* Length of the cookie used. */
+#define NOTIFY_WOKENUP 1 /* Code for notifcation. */
+#define NOTIFY_REMOVED 2 /* Code for closed message queue
+ of de-notifcation. */
+
+
+/* Data structure for the queued notification requests. */
+union notify_data
+{
+ struct
+ {
+ void (*fct) (union sigval); /* The function to run. */
+ union sigval param; /* The parameter to pass. */
+ pthread_attr_t *attr; /* Attributes to create the thread with. */
+ /* NB: on 64-bit machines the struct as a size of 24 bytes. Which means
+ byte 31 can still be used for returning the status. */
+ };
+ char raw[NOTIFY_COOKIE_LEN];
+};
+
+
+/* Keep track of the initialization. */
+static pthread_once_t once = PTHREAD_ONCE_INIT;
+
+
+/* The netlink socket. */
+static int netlink_socket = -1;
+
+
+/* Barrier used to make sure data passed to the new thread is not
+ resused by the parent. */
+static pthread_barrier_t notify_barrier;
+
+
+/* Modify the signal mask. We move this into a separate function so
+ that the stack space needed for sigset_t is not deducted from what
+ the thread can use. */
+static int
+__attribute__ ((noinline))
+change_sigmask (int how, sigset_t *oss)
+{
+ sigset_t ss;
+ sigfillset (&ss);
+ return __pthread_sigmask (how, &ss, oss);
+}
+
+
+/* The function used for the notification. */
+static void *
+notification_function (void *arg)
+{
+ /* Copy the function and parameter so that the parent thread can go
+ on with its life. */
+ volatile union notify_data *data = (volatile union notify_data *) arg;
+ void (*fct) (union sigval) = data->fct;
+ union sigval param = data->param;
+
+ /* Let the parent go. */
+ (void) __pthread_barrier_wait (¬ify_barrier);
+
+ /* Make the thread detached. */
+ __pthread_detach (__pthread_self ());
+
+ /* The parent thread has all signals blocked. This is probably a
+ bit surprising for this thread. So we unblock all of them. */
+ (void) change_sigmask (SIG_UNBLOCK, NULL);
+
+ /* Now run the user code. */
+ fct (param);
+
+ /* And we are done. */
+ return NULL;
+}
+
+
+/* Helper thread. */
+static void *
+helper_thread (void *arg)
+{
+ while (1)
+ {
+ union notify_data data;
+
+ ssize_t n = __recv (netlink_socket, &data, sizeof (data),
+ MSG_NOSIGNAL | MSG_WAITALL);
+ if (n < NOTIFY_COOKIE_LEN)
+ continue;
+
+ if (data.raw[NOTIFY_COOKIE_LEN - 1] == NOTIFY_WOKENUP)
+ {
+ /* Just create the thread as instructed. There is no way to
+ report a problem with creating a thread. */
+ pthread_t th;
+ if (__pthread_create (&th, data.attr, notification_function, &data)
+ == 0)
+ /* Since we passed a pointer to DATA to the new thread we have
+ to wait until it is done with it. */
+ (void) __pthread_barrier_wait (¬ify_barrier);
+ }
+ else if (data.raw[NOTIFY_COOKIE_LEN - 1] == NOTIFY_REMOVED && data.attr != NULL)
+ {
+ /* The only state we keep is the copy of the thread attributes. */
+ __pthread_attr_destroy (data.attr);
+ free (data.attr);
+ }
+ }
+ return NULL;
+}
+
+
+void
+__mq_notify_fork_subprocess (void)
+{
+ once = PTHREAD_ONCE_INIT;
+}
+
+
+static void
+init_mq_netlink (void)
+{
+ /* This code might be called a second time after fork(). The file
+ descriptor is inherited from the parent. */
+ if (netlink_socket == -1)
+ {
+ /* Just a normal netlink socket, not bound. */
+ netlink_socket = __socket (AF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, 0);
+ /* No need to do more if we have no socket. */
+ if (netlink_socket == -1)
+ return;
+ }
+
+ int err = 1;
+
+ /* Initialize the barrier. */
+ if (__pthread_barrier_init (¬ify_barrier, NULL, 2) == 0)
+ {
+ /* Create the helper thread. */
+ pthread_attr_t attr;
+ __pthread_attr_init (&attr);
+ __pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
+ /* We do not need much stack space, the bare minimum will be enough. */
+ __pthread_attr_setstacksize (&attr, __pthread_get_minstack (&attr));
+
+ /* Temporarily block all signals so that the newly created
+ thread inherits the mask. */
+ sigset_t oss;
+ int have_no_oss = change_sigmask (SIG_BLOCK, &oss);
+
+ pthread_t th;
+ err = __pthread_create (&th, &attr, helper_thread, NULL);
+
+ /* Reset the signal mask. */
+ if (!have_no_oss)
+ __pthread_sigmask (SIG_SETMASK, &oss, NULL);
+
+ __pthread_attr_destroy (&attr);
+ }
+
+ if (err != 0)
+ {
+ __close_nocancel_nostatus (netlink_socket);
+ netlink_socket = -1;
+ }
+}
+
+
+/* Register notification upon message arrival to an empty message queue
+ MQDES. */
+int
+__mq_notify (mqd_t mqdes, const struct sigevent *notification)
+{
+ /* Make sure the type is correctly defined. */
+ assert (sizeof (union notify_data) == NOTIFY_COOKIE_LEN);
+
+ /* Special treatment needed for SIGEV_THREAD. */
+ if (notification == NULL || notification->sigev_notify != SIGEV_THREAD)
+ return INLINE_SYSCALL (mq_notify, 2, mqdes, notification);
+
+ /* The kernel cannot directly start threads. This will have to be
+ done at userlevel. Since we cannot start threads from signal
+ handlers we have to create a dedicated thread which waits for
+ notifications for arriving messages and creates threads in
+ response. */
+
+ /* Initialize only once. */
+ __pthread_once (&once, init_mq_netlink);
+
+ /* If we cannot create the netlink socket we cannot provide
+ SIGEV_THREAD support. */
+ if (__glibc_unlikely (netlink_socket == -1))
+ {
+ __set_errno (ENOSYS);
+ return -1;
+ }
+
+ /* Create the cookie. It will hold almost all the state. */
+ union notify_data data;
+ memset (&data, '\0', sizeof (data));
+ data.fct = notification->sigev_notify_function;
+ data.param = notification->sigev_value;
+
+ if (notification->sigev_notify_attributes != NULL)
+ {
+ /* The thread attribute has to be allocated separately. */
+ data.attr = (pthread_attr_t *) malloc (sizeof (pthread_attr_t));
+ if (data.attr == NULL)
+ return -1;
+
+ int ret = __pthread_attr_copy (data.attr,
+ notification->sigev_notify_attributes);
+ if (ret != 0)
+ {
+ free (data.attr);
+ __set_errno (ret);
+ return -1;
+ }
+ }
+
+ /* Construct the new request. */
+ struct sigevent se;
+ se.sigev_notify = SIGEV_THREAD;
+ se.sigev_signo = netlink_socket;
+ se.sigev_value.sival_ptr = &data;
+
+ /* Tell the kernel. */
+ int retval = INLINE_SYSCALL (mq_notify, 2, mqdes, &se);
+
+ /* If it failed, free the allocated memory. */
+ if (retval != 0 && data.attr != NULL)
+ {
+ __pthread_attr_destroy (data.attr);
+ free (data.attr);
+ }
+
+ return retval;
+}
+versioned_symbol (libc, __mq_notify, mq_notify, GLIBC_2_34);
+libc_hidden_ver (__mq_notify, mq_notify)
+#if OTHER_SHLIB_COMPAT (librt, GLIBC_2_3_4, GLIBC_2_34)
+compat_symbol (librt, __mq_notify, mq_notify, GLIBC_2_3_4);
+#endif
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-c-utf8-locale-patch/create.patch.sh
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-c-utf8-locale-patch/create.patch.sh (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-c-utf8-locale-patch/create.patch.sh (revision 348)
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+VERSION=2.34
+
+tar --files-from=file.list -xJvf ../glibc-$VERSION.tar.xz
+mv glibc-$VERSION glibc-$VERSION-orig
+
+cp -rf ./glibc-$VERSION-new ./glibc-$VERSION
+
+diff -b --unified -Nr glibc-$VERSION-orig glibc-$VERSION > glibc-$VERSION-c-utf8-locale.patch
+
+mv glibc-$VERSION-c-utf8-locale.patch ../patches
+
+rm -rf ./glibc-$VERSION
+rm -rf ./glibc-$VERSION-orig
Property changes on: toolchains-1.7.2/sources/GNU/glibc/create-2.34-c-utf8-locale-patch/create.patch.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-c-utf8-locale-patch/file.list
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-c-utf8-locale-patch/file.list (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-c-utf8-locale-patch/file.list (revision 348)
@@ -0,0 +1 @@
+glibc-2.34/localedata/SUPPORTED
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-c-utf8-locale-patch/glibc-2.34-new/localedata/SUPPORTED
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-c-utf8-locale-patch/glibc-2.34-new/localedata/SUPPORTED (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-c-utf8-locale-patch/glibc-2.34-new/localedata/SUPPORTED (revision 348)
@@ -0,0 +1,492 @@
+# This file names the currently supported and somewhat tested locales.
+# If you have any additions please file a glibc bug report.
+SUPPORTED-LOCALES=\
+C.UTF-8/UTF-8 \
+aa_DJ.UTF-8/UTF-8 \
+aa_DJ/ISO-8859-1 \
+aa_ER/UTF-8 \
+aa_ER@saaho/UTF-8 \
+aa_ET/UTF-8 \
+af_ZA.UTF-8/UTF-8 \
+af_ZA/ISO-8859-1 \
+agr_PE/UTF-8 \
+ak_GH/UTF-8 \
+am_ET/UTF-8 \
+an_ES.UTF-8/UTF-8 \
+an_ES/ISO-8859-15 \
+anp_IN/UTF-8 \
+ar_AE.UTF-8/UTF-8 \
+ar_AE/ISO-8859-6 \
+ar_BH.UTF-8/UTF-8 \
+ar_BH/ISO-8859-6 \
+ar_DZ.UTF-8/UTF-8 \
+ar_DZ/ISO-8859-6 \
+ar_EG.UTF-8/UTF-8 \
+ar_EG/ISO-8859-6 \
+ar_IN/UTF-8 \
+ar_IQ.UTF-8/UTF-8 \
+ar_IQ/ISO-8859-6 \
+ar_JO.UTF-8/UTF-8 \
+ar_JO/ISO-8859-6 \
+ar_KW.UTF-8/UTF-8 \
+ar_KW/ISO-8859-6 \
+ar_LB.UTF-8/UTF-8 \
+ar_LB/ISO-8859-6 \
+ar_LY.UTF-8/UTF-8 \
+ar_LY/ISO-8859-6 \
+ar_MA.UTF-8/UTF-8 \
+ar_MA/ISO-8859-6 \
+ar_OM.UTF-8/UTF-8 \
+ar_OM/ISO-8859-6 \
+ar_QA.UTF-8/UTF-8 \
+ar_QA/ISO-8859-6 \
+ar_SA.UTF-8/UTF-8 \
+ar_SA/ISO-8859-6 \
+ar_SD.UTF-8/UTF-8 \
+ar_SD/ISO-8859-6 \
+ar_SS/UTF-8 \
+ar_SY.UTF-8/UTF-8 \
+ar_SY/ISO-8859-6 \
+ar_TN.UTF-8/UTF-8 \
+ar_TN/ISO-8859-6 \
+ar_YE.UTF-8/UTF-8 \
+ar_YE/ISO-8859-6 \
+ayc_PE/UTF-8 \
+az_AZ/UTF-8 \
+az_IR/UTF-8 \
+as_IN/UTF-8 \
+ast_ES.UTF-8/UTF-8 \
+ast_ES/ISO-8859-15 \
+be_BY.UTF-8/UTF-8 \
+be_BY/CP1251 \
+be_BY@latin/UTF-8 \
+bem_ZM/UTF-8 \
+ber_DZ/UTF-8 \
+ber_MA/UTF-8 \
+bg_BG.UTF-8/UTF-8 \
+bg_BG/CP1251 \
+bhb_IN.UTF-8/UTF-8 \
+bho_IN/UTF-8 \
+bho_NP/UTF-8 \
+bi_VU/UTF-8 \
+bn_BD/UTF-8 \
+bn_IN/UTF-8 \
+bo_CN/UTF-8 \
+bo_IN/UTF-8 \
+br_FR.UTF-8/UTF-8 \
+br_FR/ISO-8859-1 \
+br_FR@euro/ISO-8859-15 \
+brx_IN/UTF-8 \
+bs_BA.UTF-8/UTF-8 \
+bs_BA/ISO-8859-2 \
+byn_ER/UTF-8 \
+ca_AD.UTF-8/UTF-8 \
+ca_AD/ISO-8859-15 \
+ca_ES.UTF-8/UTF-8 \
+ca_ES/ISO-8859-1 \
+ca_ES@euro/ISO-8859-15 \
+ca_ES@valencia/UTF-8 \
+ca_FR.UTF-8/UTF-8 \
+ca_FR/ISO-8859-15 \
+ca_IT.UTF-8/UTF-8 \
+ca_IT/ISO-8859-15 \
+ce_RU/UTF-8 \
+chr_US/UTF-8 \
+ckb_IQ/UTF-8 \
+cmn_TW/UTF-8 \
+crh_UA/UTF-8 \
+cs_CZ.UTF-8/UTF-8 \
+cs_CZ/ISO-8859-2 \
+csb_PL/UTF-8 \
+cv_RU/UTF-8 \
+cy_GB.UTF-8/UTF-8 \
+cy_GB/ISO-8859-14 \
+da_DK.UTF-8/UTF-8 \
+da_DK/ISO-8859-1 \
+de_AT.UTF-8/UTF-8 \
+de_AT/ISO-8859-1 \
+de_AT@euro/ISO-8859-15 \
+de_BE.UTF-8/UTF-8 \
+de_BE/ISO-8859-1 \
+de_BE@euro/ISO-8859-15 \
+de_CH.UTF-8/UTF-8 \
+de_CH/ISO-8859-1 \
+de_DE.UTF-8/UTF-8 \
+de_DE/ISO-8859-1 \
+de_DE@euro/ISO-8859-15 \
+de_IT.UTF-8/UTF-8 \
+de_IT/ISO-8859-1 \
+de_LI.UTF-8/UTF-8 \
+de_LU.UTF-8/UTF-8 \
+de_LU/ISO-8859-1 \
+de_LU@euro/ISO-8859-15 \
+doi_IN/UTF-8 \
+dsb_DE/UTF-8 \
+dv_MV/UTF-8 \
+dz_BT/UTF-8 \
+el_GR.UTF-8/UTF-8 \
+el_GR/ISO-8859-7 \
+el_GR@euro/ISO-8859-7 \
+el_CY.UTF-8/UTF-8 \
+el_CY/ISO-8859-7 \
+en_AG/UTF-8 \
+en_AU.UTF-8/UTF-8 \
+en_AU/ISO-8859-1 \
+en_BW.UTF-8/UTF-8 \
+en_BW/ISO-8859-1 \
+en_CA.UTF-8/UTF-8 \
+en_CA/ISO-8859-1 \
+en_DK.UTF-8/UTF-8 \
+en_DK/ISO-8859-1 \
+en_GB.UTF-8/UTF-8 \
+en_GB/ISO-8859-1 \
+en_HK.UTF-8/UTF-8 \
+en_HK/ISO-8859-1 \
+en_IE.UTF-8/UTF-8 \
+en_IE/ISO-8859-1 \
+en_IE@euro/ISO-8859-15 \
+en_IL/UTF-8 \
+en_IN/UTF-8 \
+en_NG/UTF-8 \
+en_NZ.UTF-8/UTF-8 \
+en_NZ/ISO-8859-1 \
+en_PH.UTF-8/UTF-8 \
+en_PH/ISO-8859-1 \
+en_SC.UTF-8/UTF-8 \
+en_SG.UTF-8/UTF-8 \
+en_SG/ISO-8859-1 \
+en_US.UTF-8/UTF-8 \
+en_US/ISO-8859-1 \
+en_ZA.UTF-8/UTF-8 \
+en_ZA/ISO-8859-1 \
+en_ZM/UTF-8 \
+en_ZW.UTF-8/UTF-8 \
+en_ZW/ISO-8859-1 \
+eo/UTF-8 \
+es_AR.UTF-8/UTF-8 \
+es_AR/ISO-8859-1 \
+es_BO.UTF-8/UTF-8 \
+es_BO/ISO-8859-1 \
+es_CL.UTF-8/UTF-8 \
+es_CL/ISO-8859-1 \
+es_CO.UTF-8/UTF-8 \
+es_CO/ISO-8859-1 \
+es_CR.UTF-8/UTF-8 \
+es_CR/ISO-8859-1 \
+es_CU/UTF-8 \
+es_DO.UTF-8/UTF-8 \
+es_DO/ISO-8859-1 \
+es_EC.UTF-8/UTF-8 \
+es_EC/ISO-8859-1 \
+es_ES.UTF-8/UTF-8 \
+es_ES/ISO-8859-1 \
+es_ES@euro/ISO-8859-15 \
+es_GT.UTF-8/UTF-8 \
+es_GT/ISO-8859-1 \
+es_HN.UTF-8/UTF-8 \
+es_HN/ISO-8859-1 \
+es_MX.UTF-8/UTF-8 \
+es_MX/ISO-8859-1 \
+es_NI.UTF-8/UTF-8 \
+es_NI/ISO-8859-1 \
+es_PA.UTF-8/UTF-8 \
+es_PA/ISO-8859-1 \
+es_PE.UTF-8/UTF-8 \
+es_PE/ISO-8859-1 \
+es_PR.UTF-8/UTF-8 \
+es_PR/ISO-8859-1 \
+es_PY.UTF-8/UTF-8 \
+es_PY/ISO-8859-1 \
+es_SV.UTF-8/UTF-8 \
+es_SV/ISO-8859-1 \
+es_US.UTF-8/UTF-8 \
+es_US/ISO-8859-1 \
+es_UY.UTF-8/UTF-8 \
+es_UY/ISO-8859-1 \
+es_VE.UTF-8/UTF-8 \
+es_VE/ISO-8859-1 \
+et_EE.UTF-8/UTF-8 \
+et_EE/ISO-8859-1 \
+et_EE.ISO-8859-15/ISO-8859-15 \
+eu_ES.UTF-8/UTF-8 \
+eu_ES/ISO-8859-1 \
+eu_ES@euro/ISO-8859-15 \
+fa_IR/UTF-8 \
+ff_SN/UTF-8 \
+fi_FI.UTF-8/UTF-8 \
+fi_FI/ISO-8859-1 \
+fi_FI@euro/ISO-8859-15 \
+fil_PH/UTF-8 \
+fo_FO.UTF-8/UTF-8 \
+fo_FO/ISO-8859-1 \
+fr_BE.UTF-8/UTF-8 \
+fr_BE/ISO-8859-1 \
+fr_BE@euro/ISO-8859-15 \
+fr_CA.UTF-8/UTF-8 \
+fr_CA/ISO-8859-1 \
+fr_CH.UTF-8/UTF-8 \
+fr_CH/ISO-8859-1 \
+fr_FR.UTF-8/UTF-8 \
+fr_FR/ISO-8859-1 \
+fr_FR@euro/ISO-8859-15 \
+fr_LU.UTF-8/UTF-8 \
+fr_LU/ISO-8859-1 \
+fr_LU@euro/ISO-8859-15 \
+fur_IT/UTF-8 \
+fy_NL/UTF-8 \
+fy_DE/UTF-8 \
+ga_IE.UTF-8/UTF-8 \
+ga_IE/ISO-8859-1 \
+ga_IE@euro/ISO-8859-15 \
+gd_GB.UTF-8/UTF-8 \
+gd_GB/ISO-8859-15 \
+gez_ER/UTF-8 \
+gez_ER@abegede/UTF-8 \
+gez_ET/UTF-8 \
+gez_ET@abegede/UTF-8 \
+gl_ES.UTF-8/UTF-8 \
+gl_ES/ISO-8859-1 \
+gl_ES@euro/ISO-8859-15 \
+gu_IN/UTF-8 \
+gv_GB.UTF-8/UTF-8 \
+gv_GB/ISO-8859-1 \
+ha_NG/UTF-8 \
+hak_TW/UTF-8 \
+he_IL.UTF-8/UTF-8 \
+he_IL/ISO-8859-8 \
+hi_IN/UTF-8 \
+hif_FJ/UTF-8 \
+hne_IN/UTF-8 \
+hr_HR.UTF-8/UTF-8 \
+hr_HR/ISO-8859-2 \
+hsb_DE/ISO-8859-2 \
+hsb_DE.UTF-8/UTF-8 \
+ht_HT/UTF-8 \
+hu_HU.UTF-8/UTF-8 \
+hu_HU/ISO-8859-2 \
+hy_AM/UTF-8 \
+hy_AM.ARMSCII-8/ARMSCII-8 \
+ia_FR/UTF-8 \
+id_ID.UTF-8/UTF-8 \
+id_ID/ISO-8859-1 \
+ig_NG/UTF-8 \
+ik_CA/UTF-8 \
+is_IS.UTF-8/UTF-8 \
+is_IS/ISO-8859-1 \
+it_CH.UTF-8/UTF-8 \
+it_CH/ISO-8859-1 \
+it_IT.UTF-8/UTF-8 \
+it_IT/ISO-8859-1 \
+it_IT@euro/ISO-8859-15 \
+iu_CA/UTF-8 \
+ja_JP.EUC-JP/EUC-JP \
+ja_JP.UTF-8/UTF-8 \
+ka_GE.UTF-8/UTF-8 \
+ka_GE/GEORGIAN-PS \
+kab_DZ/UTF-8 \
+kk_KZ.UTF-8/UTF-8 \
+kk_KZ/PT154 \
+kl_GL.UTF-8/UTF-8 \
+kl_GL/ISO-8859-1 \
+km_KH/UTF-8 \
+kn_IN/UTF-8 \
+ko_KR.EUC-KR/EUC-KR \
+ko_KR.UTF-8/UTF-8 \
+kok_IN/UTF-8 \
+ks_IN/UTF-8 \
+ks_IN@devanagari/UTF-8 \
+ku_TR.UTF-8/UTF-8 \
+ku_TR/ISO-8859-9 \
+kw_GB.UTF-8/UTF-8 \
+kw_GB/ISO-8859-1 \
+ky_KG/UTF-8 \
+lb_LU/UTF-8 \
+lg_UG.UTF-8/UTF-8 \
+lg_UG/ISO-8859-10 \
+li_BE/UTF-8 \
+li_NL/UTF-8 \
+lij_IT/UTF-8 \
+ln_CD/UTF-8 \
+lo_LA/UTF-8 \
+lt_LT.UTF-8/UTF-8 \
+lt_LT/ISO-8859-13 \
+lv_LV.UTF-8/UTF-8 \
+lv_LV/ISO-8859-13 \
+lzh_TW/UTF-8 \
+mag_IN/UTF-8 \
+mai_IN/UTF-8 \
+mai_NP/UTF-8 \
+mfe_MU/UTF-8 \
+mg_MG.UTF-8/UTF-8 \
+mg_MG/ISO-8859-15 \
+mhr_RU/UTF-8 \
+mi_NZ.UTF-8/UTF-8 \
+mi_NZ/ISO-8859-13 \
+miq_NI/UTF-8 \
+mjw_IN/UTF-8 \
+mk_MK.UTF-8/UTF-8 \
+mk_MK/ISO-8859-5 \
+ml_IN/UTF-8 \
+mn_MN/UTF-8 \
+mni_IN/UTF-8 \
+mnw_MM/UTF-8 \
+mr_IN/UTF-8 \
+ms_MY.UTF-8/UTF-8 \
+ms_MY/ISO-8859-1 \
+mt_MT.UTF-8/UTF-8 \
+mt_MT/ISO-8859-3 \
+my_MM/UTF-8 \
+nan_TW/UTF-8 \
+nan_TW@latin/UTF-8 \
+nb_NO.UTF-8/UTF-8 \
+nb_NO/ISO-8859-1 \
+nds_DE/UTF-8 \
+nds_NL/UTF-8 \
+ne_NP/UTF-8 \
+nhn_MX/UTF-8 \
+niu_NU/UTF-8 \
+niu_NZ/UTF-8 \
+nl_AW/UTF-8 \
+nl_BE.UTF-8/UTF-8 \
+nl_BE/ISO-8859-1 \
+nl_BE@euro/ISO-8859-15 \
+nl_NL.UTF-8/UTF-8 \
+nl_NL/ISO-8859-1 \
+nl_NL@euro/ISO-8859-15 \
+nn_NO.UTF-8/UTF-8 \
+nn_NO/ISO-8859-1 \
+nr_ZA/UTF-8 \
+nso_ZA/UTF-8 \
+oc_FR.UTF-8/UTF-8 \
+oc_FR/ISO-8859-1 \
+om_ET/UTF-8 \
+om_KE.UTF-8/UTF-8 \
+om_KE/ISO-8859-1 \
+or_IN/UTF-8 \
+os_RU/UTF-8 \
+pa_IN/UTF-8 \
+pa_PK/UTF-8 \
+pap_AW/UTF-8 \
+pap_CW/UTF-8 \
+pl_PL.UTF-8/UTF-8 \
+pl_PL/ISO-8859-2 \
+ps_AF/UTF-8 \
+pt_BR.UTF-8/UTF-8 \
+pt_BR/ISO-8859-1 \
+pt_PT.UTF-8/UTF-8 \
+pt_PT/ISO-8859-1 \
+pt_PT@euro/ISO-8859-15 \
+quz_PE/UTF-8 \
+raj_IN/UTF-8 \
+ro_RO.UTF-8/UTF-8 \
+ro_RO/ISO-8859-2 \
+ru_RU.KOI8-R/KOI8-R \
+ru_RU.UTF-8/UTF-8 \
+ru_RU/ISO-8859-5 \
+ru_UA.UTF-8/UTF-8 \
+ru_UA/KOI8-U \
+rw_RW/UTF-8 \
+sa_IN/UTF-8 \
+sah_RU/UTF-8 \
+sat_IN/UTF-8 \
+sc_IT/UTF-8 \
+sd_IN/UTF-8 \
+sd_IN@devanagari/UTF-8 \
+se_NO/UTF-8 \
+sgs_LT/UTF-8 \
+shn_MM/UTF-8 \
+shs_CA/UTF-8 \
+si_LK/UTF-8 \
+sid_ET/UTF-8 \
+sk_SK.UTF-8/UTF-8 \
+sk_SK/ISO-8859-2 \
+sl_SI.UTF-8/UTF-8 \
+sl_SI/ISO-8859-2 \
+sm_WS/UTF-8 \
+so_DJ.UTF-8/UTF-8 \
+so_DJ/ISO-8859-1 \
+so_ET/UTF-8 \
+so_KE.UTF-8/UTF-8 \
+so_KE/ISO-8859-1 \
+so_SO.UTF-8/UTF-8 \
+so_SO/ISO-8859-1 \
+sq_AL.UTF-8/UTF-8 \
+sq_AL/ISO-8859-1 \
+sq_MK/UTF-8 \
+sr_ME/UTF-8 \
+sr_RS/UTF-8 \
+sr_RS@latin/UTF-8 \
+ss_ZA/UTF-8 \
+st_ZA.UTF-8/UTF-8 \
+st_ZA/ISO-8859-1 \
+sv_FI.UTF-8/UTF-8 \
+sv_FI/ISO-8859-1 \
+sv_FI@euro/ISO-8859-15 \
+sv_SE.UTF-8/UTF-8 \
+sv_SE/ISO-8859-1 \
+sw_KE/UTF-8 \
+sw_TZ/UTF-8 \
+szl_PL/UTF-8 \
+ta_IN/UTF-8 \
+ta_LK/UTF-8 \
+tcy_IN.UTF-8/UTF-8 \
+te_IN/UTF-8 \
+tg_TJ.UTF-8/UTF-8 \
+tg_TJ/KOI8-T \
+th_TH.UTF-8/UTF-8 \
+th_TH/TIS-620 \
+the_NP/UTF-8 \
+ti_ER/UTF-8 \
+ti_ET/UTF-8 \
+tig_ER/UTF-8 \
+tk_TM/UTF-8 \
+tl_PH.UTF-8/UTF-8 \
+tl_PH/ISO-8859-1 \
+tn_ZA/UTF-8 \
+to_TO/UTF-8 \
+tpi_PG/UTF-8 \
+tr_CY.UTF-8/UTF-8 \
+tr_CY/ISO-8859-9 \
+tr_TR.UTF-8/UTF-8 \
+tr_TR/ISO-8859-9 \
+ts_ZA/UTF-8 \
+tt_RU/UTF-8 \
+tt_RU@iqtelif/UTF-8 \
+ug_CN/UTF-8 \
+uk_UA.UTF-8/UTF-8 \
+uk_UA/KOI8-U \
+unm_US/UTF-8 \
+ur_IN/UTF-8 \
+ur_PK/UTF-8 \
+uz_UZ.UTF-8/UTF-8 \
+uz_UZ/ISO-8859-1 \
+uz_UZ@cyrillic/UTF-8 \
+ve_ZA/UTF-8 \
+vi_VN/UTF-8 \
+wa_BE/ISO-8859-1 \
+wa_BE@euro/ISO-8859-15 \
+wa_BE.UTF-8/UTF-8 \
+wae_CH/UTF-8 \
+wal_ET/UTF-8 \
+wo_SN/UTF-8 \
+xh_ZA.UTF-8/UTF-8 \
+xh_ZA/ISO-8859-1 \
+yi_US.UTF-8/UTF-8 \
+yi_US/CP1255 \
+yo_NG/UTF-8 \
+yue_HK/UTF-8 \
+yuw_PG/UTF-8 \
+zh_CN.GB18030/GB18030 \
+zh_CN.GBK/GBK \
+zh_CN.UTF-8/UTF-8 \
+zh_CN/GB2312 \
+zh_HK.UTF-8/UTF-8 \
+zh_HK/BIG5-HKSCS \
+zh_SG.UTF-8/UTF-8 \
+zh_SG.GBK/GBK \
+zh_SG/GB2312 \
+zh_TW.EUC-TW/EUC-TW \
+zh_TW.UTF-8/UTF-8 \
+zh_TW/BIG5 \
+zu_ZA.UTF-8/UTF-8 \
+zu_ZA/ISO-8859-1 \
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-c-utf8-locale-patch/glibc-2.34-new/localedata/locales/C
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-c-utf8-locale-patch/glibc-2.34-new/localedata/locales/C (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-c-utf8-locale-patch/glibc-2.34-new/localedata/locales/C (revision 348)
@@ -0,0 +1,237 @@
+escape_char /
+comment_char %
+% Locale for C locale in UTF-8
+
+LC_IDENTIFICATION
+title "C locale"
+source ""
+address ""
+contact ""
+email "mfabian@redhat.com"
+tel ""
+fax ""
+language "C"
+territory ""
+revision "1.0"
+date "2015-08-10"
+%
+category "i18n:2012";LC_IDENTIFICATION
+category "i18n:2012";LC_CTYPE
+category "i18n:2012";LC_COLLATE
+category "i18n:2012";LC_TIME
+category "i18n:2012";LC_NUMERIC
+category "i18n:2012";LC_MONETARY
+category "i18n:2012";LC_MESSAGES
+category "i18n:2012";LC_PAPER
+category "i18n:2012";LC_NAME
+category "i18n:2012";LC_ADDRESS
+category "i18n:2012";LC_TELEPHONE
+category "i18n:2012";LC_MEASUREMENT
+END LC_IDENTIFICATION
+
+LC_CTYPE
+copy "i18n"
+
+translit_start
+include "translit_combining";""
+translit_end
+
+END LC_CTYPE
+
+LC_COLLATE
+order_start forward
+<U0000>
+..
+<UFFFF>
+<U10000>
+..
+<U1FFFF>
+<U20000>
+..
+<U2FFFF>
+<UE0000>
+..
+<UEFFFF>
+<UF0000>
+..
+<UFFFFF>
+<U100000>
+..
+<U10FFFF>
+UNDEFINED
+order_end
+END LC_COLLATE
+
+LC_MONETARY
+% This is the 14652 i18n fdcc-set definition for
+% the LC_MONETARY category
+% (except for the int_curr_symbol and currency_symbol, they are empty in
+% the 14652 i18n fdcc-set definition and also empty in
+% glibc/locale/C-monetary.c. But localedef complains in that case).
+%
+% Using "USD" for int_curr_symbol. But maybe "XXX" would be better?
+% XXX is "No currency" (https://en.wikipedia.org/wiki/ISO_4217)
+int_curr_symbol "<U0055><U0053><U0044><U0020>"
+% Using "$" for currency_symbol. But maybe <U00A4> would be better?
+% U+00A4 is the "generic currency symbol"
+% (https://en.wikipedia.org/wiki/Currency_sign_%28typography%29)
+currency_symbol "<U0024>"
+mon_decimal_point "<U002E>"
+mon_thousands_sep ""
+mon_grouping -1
+positive_sign ""
+negative_sign "<U002D>"
+int_frac_digits -1
+frac_digits -1
+p_cs_precedes -1
+int_p_sep_by_space -1
+p_sep_by_space -1
+n_cs_precedes -1
+int_n_sep_by_space -1
+n_sep_by_space -1
+p_sign_posn -1
+n_sign_posn -1
+%
+END LC_MONETARY
+
+LC_NUMERIC
+% This is the POSIX Locale definition for
+% the LC_NUMERIC category.
+%
+decimal_point "<U002E>"
+thousands_sep ""
+grouping -1
+END LC_NUMERIC
+
+LC_TIME
+% This is the POSIX Locale definition for
+% the LC_TIME category.
+%
+% Abbreviated weekday names (%a)
+abday "<U0053><U0075><U006E>";"<U004D><U006F><U006E>";/
+ "<U0054><U0075><U0065>";"<U0057><U0065><U0064>";/
+ "<U0054><U0068><U0075>";"<U0046><U0072><U0069>";/
+ "<U0053><U0061><U0074>"
+
+% Full weekday names (%A)
+day "<U0053><U0075><U006E><U0064><U0061><U0079>";/
+ "<U004D><U006F><U006E><U0064><U0061><U0079>";/
+ "<U0054><U0075><U0065><U0073><U0064><U0061><U0079>";/
+ "<U0057><U0065><U0064><U006E><U0065><U0073><U0064><U0061><U0079>";/
+ "<U0054><U0068><U0075><U0072><U0073><U0064><U0061><U0079>";/
+ "<U0046><U0072><U0069><U0064><U0061><U0079>";/
+ "<U0053><U0061><U0074><U0075><U0072><U0064><U0061><U0079>"
+
+% Abbreviated month names (%b)
+abmon "<U004A><U0061><U006E>";"<U0046><U0065><U0062>";/
+ "<U004D><U0061><U0072>";"<U0041><U0070><U0072>";/
+ "<U004D><U0061><U0079>";"<U004A><U0075><U006E>";/
+ "<U004A><U0075><U006C>";"<U0041><U0075><U0067>";/
+ "<U0053><U0065><U0070>";"<U004F><U0063><U0074>";/
+ "<U004E><U006F><U0076>";"<U0044><U0065><U0063>"
+
+% Full month names (%B)
+mon "<U004A><U0061><U006E><U0075><U0061><U0072><U0079>";/
+ "<U0046><U0065><U0062><U0072><U0075><U0061><U0072><U0079>";/
+ "<U004D><U0061><U0072><U0063><U0068>";/
+ "<U0041><U0070><U0072><U0069><U006C>";/
+ "<U004D><U0061><U0079>";/
+ "<U004A><U0075><U006E><U0065>";/
+ "<U004A><U0075><U006C><U0079>";/
+ "<U0041><U0075><U0067><U0075><U0073><U0074>";/
+ "<U0053><U0065><U0070><U0074><U0065><U006D><U0062><U0065><U0072>";/
+ "<U004F><U0063><U0074><U006F><U0062><U0065><U0072>";/
+ "<U004E><U006F><U0076><U0065><U006D><U0062><U0065><U0072>";/
+ "<U0044><U0065><U0063><U0065><U006D><U0062><U0065><U0072>"
+
+% Week description, consists of three fields:
+% 1. Number of days in a week.
+% 2. Gregorian date that is a first weekday (19971130 for Sunday, 19971201 for Monday).
+% 3. The weekday number to be contained in the first week of the year.
+%
+% ISO 8601 conforming applications should use the values 7, 19971201 (a
+% Monday), and 4 (Thursday), respectively.
+week 7;19971201;4
+first_weekday 1
+first_workday 1
+
+% Appropriate date and time representation (%c)
+% "%a %b %e %H:%M:%S %Y"
+d_t_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065><U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U0059>"
+
+% Appropriate date representation (%x)
+% "%m/%d/%y"
+d_fmt "<U0025><U006D><U002F><U0025><U0064><U002F><U0025><U0079>"
+
+% Appropriate time representation (%X)
+% "%H:%M:%S"
+t_fmt "<U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053>"
+
+% Appropriate AM/PM time representation (%r)
+% "%I:%M:%S %p"
+t_fmt_ampm "<U0025><U0049><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U0070>"
+
+% Equivalent of AM/PM (%p) "AM"/"PM"
+%
+am_pm "<U0041><U004D>";"<U0050><U004D>"
+
+% Appropriate date representation (date(1)) "%a %b %e %H:%M:%S %Z %Y"
+date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065><U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020><U0025><U005A><U0020><U0025><U0059>"
+END LC_TIME
+
+LC_MESSAGES
+% This is the POSIX Locale definition for
+% the LC_NUMERIC category.
+%
+yesexpr "<U005E><U005B><U0079><U0059><U005D>"
+noexpr "<U005E><U005B><U006E><U004E><U005D>"
+yesstr "<U0059><U0065><U0073>"
+nostr "<U004E><U006F>"
+END LC_MESSAGES
+
+LC_PAPER
+% This is the ISO/IEC 14652 "i18n" definition for
+% the LC_PAPER category.
+% (A4 paper, this is also used in the built in C/POSIX
+% locale in glibc/locale/C-paper.c)
+height 297
+width 210
+END LC_PAPER
+
+LC_NAME
+% This is the ISO/IEC 14652 "i18n" definition for
+% the LC_NAME category.
+% "%p%t%g%t%m%t%f"
+% (also used in the built in C/POSIX locale in glibc/locale/C-name.c)
+name_fmt "<U0025><U0070><U0025><U0074><U0025><U0067><U0025><U0074>/
+<U0025><U006D><U0025><U0074><U0025><U0066>"
+END LC_NAME
+
+LC_ADDRESS
+% This is the ISO/IEC 14652 "i18n" definition for
+% the LC_ADDRESS category.
+% "%a%N%f%N%d%N%b%N%s %h %e %r%N%C-%z %T%N%c%N"
+% (also used in the built in C/POSIX locale in glibc/locale/C-address.c)
+postal_fmt "<U0025><U0061><U0025><U004E><U0025><U0066><U0025><U004E>/
+<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073>/
+<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
+<U004E><U0025><U0043><U002D><U0025><U007A><U0020><U0025><U0054><U0025>/
+<U004E><U0025><U0063><U0025><U004E>"
+END LC_ADDRESS
+
+LC_TELEPHONE
+% This is the ISO/IEC 14652 "i18n" definition for
+% the LC_TELEPHONE category.
+% "+%c %a %l"
+tel_int_fmt "<U002B><U0025><U0063><U0020><U0025><U0061><U0020><U0025>/
+<U006C>"
+% (also used in the built in C/POSIX locale in glibc/locale/C-telephone.c)
+END LC_TELEPHONE
+
+LC_MEASUREMENT
+% This is the ISO/IEC 14652 "i18n" definition for
+% the LC_MEASUREMENT category.
+% (same as in the built in C/POSIX locale in glibc/locale/C-measurement.c)
+%metric
+measurement 1
+END LC_MEASUREMENT
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-en_US-no-am-pm-patch/create.patch.sh
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-en_US-no-am-pm-patch/create.patch.sh (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-en_US-no-am-pm-patch/create.patch.sh (revision 348)
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+VERSION=2.34
+
+tar --files-from=file.list -xJvf ../glibc-$VERSION.tar.xz
+mv glibc-$VERSION glibc-$VERSION-orig
+
+cp -rf ./glibc-$VERSION-new ./glibc-$VERSION
+
+diff -b --unified -Nr glibc-$VERSION-orig glibc-$VERSION > glibc-$VERSION-en_US-no-am-pm.patch
+
+mv glibc-$VERSION-en_US-no-am-pm.patch ../patches
+
+rm -rf ./glibc-$VERSION
+rm -rf ./glibc-$VERSION-orig
Property changes on: toolchains-1.7.2/sources/GNU/glibc/create-2.34-en_US-no-am-pm-patch/create.patch.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-en_US-no-am-pm-patch/file.list
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-en_US-no-am-pm-patch/file.list (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-en_US-no-am-pm-patch/file.list (revision 348)
@@ -0,0 +1 @@
+glibc-2.34/localedata/locales/en_US
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-en_US-no-am-pm-patch/glibc-2.34-new/localedata/locales/en_US
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-en_US-no-am-pm-patch/glibc-2.34-new/localedata/locales/en_US (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-en_US-no-am-pm-patch/glibc-2.34-new/localedata/locales/en_US (revision 348)
@@ -0,0 +1,180 @@
+comment_char %
+escape_char /
+
+% This file is part of the GNU C Library and contains locale data.
+% The Free Software Foundation does not claim any copyright interest
+% in the locale data contained in this file. The foregoing does not
+% affect the license of the GNU C Library as a whole. It does not
+% exempt you from the conditions of the license if your use would
+% otherwise be governed by that license.
+
+% Locale for English locale in the USA
+% Contributed by Ulrich Drepper <drepper@redhat.com>, 2000
+
+LC_IDENTIFICATION
+title "English locale for the USA"
+source "Free Software Foundation, Inc."
+address "https:////www.gnu.org//software//libc//"
+contact ""
+email "bug-glibc-locales@gnu.org"
+tel ""
+fax ""
+language "American English"
+territory "United States"
+revision "1.0"
+date "2000-06-24"
+
+category "i18n:2012";LC_IDENTIFICATION
+category "i18n:2012";LC_CTYPE
+category "i18n:2012";LC_COLLATE
+category "i18n:2012";LC_TIME
+category "i18n:2012";LC_NUMERIC
+category "i18n:2012";LC_MONETARY
+category "i18n:2012";LC_MESSAGES
+category "i18n:2012";LC_PAPER
+category "i18n:2012";LC_NAME
+category "i18n:2012";LC_ADDRESS
+category "i18n:2012";LC_TELEPHONE
+category "i18n:2012";LC_MEASUREMENT
+END LC_IDENTIFICATION
+
+LC_CTYPE
+copy "en_GB"
+END LC_CTYPE
+
+LC_COLLATE
+
+% Copy the template from ISO/IEC 14651
+copy "iso14651_t1"
+
+END LC_COLLATE
+
+LC_MONETARY
+int_curr_symbol "USD "
+currency_symbol "$"
+mon_decimal_point "."
+mon_thousands_sep ","
+mon_grouping 3;3
+positive_sign ""
+negative_sign "-"
+int_frac_digits 2
+frac_digits 2
+p_cs_precedes 1
+int_p_sep_by_space 1
+p_sep_by_space 0
+n_cs_precedes 1
+int_n_sep_by_space 1
+n_sep_by_space 0
+p_sign_posn 1
+n_sign_posn 1
+%
+END LC_MONETARY
+
+LC_NUMERIC
+decimal_point "."
+thousands_sep ","
+grouping 3;3
+END LC_NUMERIC
+
+LC_TIME
+abday "Sun";"Mon";"Tue";"Wed";"Thu";"Fri";"Sat"
+day "Sunday";/
+ "Monday";/
+ "Tuesday";/
+ "Wednesday";/
+ "Thursday";/
+ "Friday";/
+ "Saturday"
+
+week 7;19971130;1
+abmon "Jan";"Feb";/
+ "Mar";"Apr";/
+ "May";"Jun";/
+ "Jul";"Aug";/
+ "Sep";"Oct";/
+ "Nov";"Dec"
+mon "January";/
+ "February";/
+ "March";/
+ "April";/
+ "May";/
+ "June";/
+ "July";/
+ "August";/
+ "September";/
+ "October";/
+ "November";/
+ "December"
+% Appropriate date and time representation (%c)
+d_t_fmt "%a %d %b %Y %r %Z"
+%
+% Appropriate date representation (%x)
+d_fmt "%m//%d//%Y"
+%
+% Appropriate time representation (%X)
+t_fmt "%r"
+%
+% Appropriate AM/PM time representation (%r)
+t_fmt_ampm "%I:%M:%S %p"
+%
+% Appropriate date and time representation for date(1). This is
+% different from d_t_fmt for historical reasons and has been different
+% since 2000 when date_fmt was added as a GNU extension. At the end
+% of 2018 it was adjusted to use 12H time (bug 24046) instead of 24H.
+% [ Slackware editor's note - no thank you, US users
+% of UNIX-like systems expect a 24 hour clock, just
+% like users in the vast majority of other locales. ]
+%date_fmt "%a %d %b %Y %r %Z"
+%
+% Strings for AM/PM
+%
+am_pm "AM";"PM"
+END LC_TIME
+
+LC_MESSAGES
+yesexpr "^[+1yY]"
+noexpr "^[-0nN]"
+yesstr "yes"
+nostr "no"
+END LC_MESSAGES
+
+LC_PAPER
+height 279
+width 216
+END LC_PAPER
+
+LC_NAME
+name_fmt "%d%t%g%t%m%t%f"
+name_miss "Miss."
+name_mr "Mr."
+name_mrs "Mrs."
+name_ms "Ms."
+END LC_NAME
+
+
+LC_ADDRESS
+postal_fmt "%a%N%f%N%d%N%b%N%h %s %e %r%N%T, %S %z%N%c%N"
+country_name "United States"
+country_post "USA"
+country_ab2 "US"
+country_ab3 "USA"
+country_num 840
+country_car "USA"
+country_isbn 0
+lang_name "English"
+lang_ab "en"
+lang_term "eng"
+lang_lib "eng"
+END LC_ADDRESS
+
+LC_TELEPHONE
+tel_int_fmt "+%c (%a) %l"
+tel_dom_fmt "(%a) %l"
+int_select "11"
+int_prefix "1"
+END LC_TELEPHONE
+
+LC_MEASUREMENT
+% US customary units.
+measurement 2
+END LC_MEASUREMENT
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-i18n-patch/create.patch.sh
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-i18n-patch/create.patch.sh (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-i18n-patch/create.patch.sh (revision 348)
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+VERSION=2.34
+
+tar --files-from=file.list -xJvf ../glibc-$VERSION.tar.xz
+mv glibc-$VERSION glibc-$VERSION-orig
+
+cp -rf ./glibc-$VERSION-new ./glibc-$VERSION
+
+diff -b --unified -Nr glibc-$VERSION-orig glibc-$VERSION > glibc-$VERSION-i18n.patch
+
+mv glibc-$VERSION-i18n.patch ../patches
+
+rm -rf ./glibc-$VERSION
+rm -rf ./glibc-$VERSION-orig
Property changes on: toolchains-1.7.2/sources/GNU/glibc/create-2.34-i18n-patch/create.patch.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-i18n-patch/file.list
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-i18n-patch/file.list (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-i18n-patch/file.list (revision 348)
@@ -0,0 +1,2 @@
+glibc-2.34/localedata/SUPPORTED
+glibc-2.34/localedata/locales/ru_RU
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-i18n-patch/glibc-2.34-new/localedata/SUPPORTED
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-i18n-patch/glibc-2.34-new/localedata/SUPPORTED (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-i18n-patch/glibc-2.34-new/localedata/SUPPORTED (revision 348)
@@ -0,0 +1,498 @@
+# This file names the currently supported and somewhat tested locales.
+# If you have any additions please file a glibc bug report.
+SUPPORTED-LOCALES=\
+aa_DJ.UTF-8/UTF-8 \
+aa_DJ/ISO-8859-1 \
+aa_ER/UTF-8 \
+aa_ER@saaho/UTF-8 \
+aa_ET/UTF-8 \
+af_ZA.UTF-8/UTF-8 \
+af_ZA/ISO-8859-1 \
+agr_PE/UTF-8 \
+ak_GH/UTF-8 \
+am_ET/UTF-8 \
+an_ES.UTF-8/UTF-8 \
+an_ES/ISO-8859-15 \
+anp_IN/UTF-8 \
+ar_AE.UTF-8/UTF-8 \
+ar_AE/ISO-8859-6 \
+ar_BH.UTF-8/UTF-8 \
+ar_BH/ISO-8859-6 \
+ar_DZ.UTF-8/UTF-8 \
+ar_DZ/ISO-8859-6 \
+ar_EG.UTF-8/UTF-8 \
+ar_EG/ISO-8859-6 \
+ar_IN/UTF-8 \
+ar_IQ.UTF-8/UTF-8 \
+ar_IQ/ISO-8859-6 \
+ar_JO.UTF-8/UTF-8 \
+ar_JO/ISO-8859-6 \
+ar_KW.UTF-8/UTF-8 \
+ar_KW/ISO-8859-6 \
+ar_LB.UTF-8/UTF-8 \
+ar_LB/ISO-8859-6 \
+ar_LY.UTF-8/UTF-8 \
+ar_LY/ISO-8859-6 \
+ar_MA.UTF-8/UTF-8 \
+ar_MA/ISO-8859-6 \
+ar_OM.UTF-8/UTF-8 \
+ar_OM/ISO-8859-6 \
+ar_QA.UTF-8/UTF-8 \
+ar_QA/ISO-8859-6 \
+ar_SA.UTF-8/UTF-8 \
+ar_SA/ISO-8859-6 \
+ar_SD.UTF-8/UTF-8 \
+ar_SD/ISO-8859-6 \
+ar_SS/UTF-8 \
+ar_SY.UTF-8/UTF-8 \
+ar_SY/ISO-8859-6 \
+ar_TN.UTF-8/UTF-8 \
+ar_TN/ISO-8859-6 \
+ar_YE.UTF-8/UTF-8 \
+ar_YE/ISO-8859-6 \
+ayc_PE/UTF-8 \
+az_AZ/UTF-8 \
+az_IR/UTF-8 \
+as_IN/UTF-8 \
+ast_ES.UTF-8/UTF-8 \
+ast_ES/ISO-8859-15 \
+be_BY.UTF-8/UTF-8 \
+be_BY/CP1251 \
+be_BY@latin/UTF-8 \
+bem_ZM/UTF-8 \
+ber_DZ/UTF-8 \
+ber_MA/UTF-8 \
+bg_BG.UTF-8/UTF-8 \
+bg_BG/CP1251 \
+bhb_IN.UTF-8/UTF-8 \
+bho_IN/UTF-8 \
+bho_NP/UTF-8 \
+bi_VU/UTF-8 \
+bn_BD/UTF-8 \
+bn_IN/UTF-8 \
+bo_CN/UTF-8 \
+bo_IN/UTF-8 \
+br_FR.UTF-8/UTF-8 \
+br_FR/ISO-8859-1 \
+br_FR@euro/ISO-8859-15 \
+brx_IN/UTF-8 \
+bs_BA.UTF-8/UTF-8 \
+bs_BA/ISO-8859-2 \
+byn_ER/UTF-8 \
+ca_AD.UTF-8/UTF-8 \
+ca_AD/ISO-8859-15 \
+ca_ES.UTF-8/UTF-8 \
+ca_ES/ISO-8859-1 \
+ca_ES@euro/ISO-8859-15 \
+ca_ES@valencia/UTF-8 \
+ca_FR.UTF-8/UTF-8 \
+ca_FR/ISO-8859-15 \
+ca_IT.UTF-8/UTF-8 \
+ca_IT/ISO-8859-15 \
+ce_RU/UTF-8 \
+chr_US/UTF-8 \
+ckb_IQ/UTF-8 \
+cmn_TW/UTF-8 \
+crh_UA/UTF-8 \
+cs_CZ.UTF-8/UTF-8 \
+cs_CZ/ISO-8859-2 \
+csb_PL/UTF-8 \
+cv_RU/UTF-8 \
+cy_GB.UTF-8/UTF-8 \
+cy_GB/ISO-8859-14 \
+da_DK.UTF-8/UTF-8 \
+da_DK/ISO-8859-1 \
+de_AT.UTF-8/UTF-8 \
+de_AT/ISO-8859-1 \
+de_AT@euro/ISO-8859-15 \
+de_BE.UTF-8/UTF-8 \
+de_BE/ISO-8859-1 \
+de_BE@euro/ISO-8859-15 \
+de_CH.UTF-8/UTF-8 \
+de_CH/ISO-8859-1 \
+de_DE.UTF-8/UTF-8 \
+de_DE/ISO-8859-1 \
+de_DE@euro/ISO-8859-15 \
+de_IT.UTF-8/UTF-8 \
+de_IT/ISO-8859-1 \
+de_LI.UTF-8/UTF-8 \
+de_LU.UTF-8/UTF-8 \
+de_LU/ISO-8859-1 \
+de_LU@euro/ISO-8859-15 \
+doi_IN/UTF-8 \
+dsb_DE/UTF-8 \
+dv_MV/UTF-8 \
+dz_BT/UTF-8 \
+el_GR.UTF-8/UTF-8 \
+el_GR/ISO-8859-7 \
+el_GR@euro/ISO-8859-7 \
+el_CY.UTF-8/UTF-8 \
+el_CY/ISO-8859-7 \
+en_AG/UTF-8 \
+en_AU.UTF-8/UTF-8 \
+en_AU/ISO-8859-1 \
+en_BW.UTF-8/UTF-8 \
+en_BW/ISO-8859-1 \
+en_CA.UTF-8/UTF-8 \
+en_CA/ISO-8859-1 \
+en_DK.UTF-8/UTF-8 \
+en_DK/ISO-8859-1 \
+en_GB.UTF-8/UTF-8 \
+en_GB/ISO-8859-1 \
+en_HK.UTF-8/UTF-8 \
+en_HK/ISO-8859-1 \
+en_IE.UTF-8/UTF-8 \
+en_IE/ISO-8859-1 \
+en_IE@euro/ISO-8859-15 \
+en_IL/UTF-8 \
+en_IN/UTF-8 \
+en_NG/UTF-8 \
+en_NZ.UTF-8/UTF-8 \
+en_NZ/ISO-8859-1 \
+en_PH.UTF-8/UTF-8 \
+en_PH/ISO-8859-1 \
+en_RU.KOI8-R/KOI8-R \
+en_RU.UTF-8/UTF-8 \
+en_RU.CP1251/CP1251 \
+en_RU.ISO-8859-5/ISO-8859-5 \
+en_RU/ISO-8859-5 \
+en_SC.UTF-8/UTF-8 \
+en_SG.UTF-8/UTF-8 \
+en_SG/ISO-8859-1 \
+en_US.UTF-8/UTF-8 \
+en_US/ISO-8859-1 \
+en_ZA.UTF-8/UTF-8 \
+en_ZA/ISO-8859-1 \
+en_ZM/UTF-8 \
+en_ZW.UTF-8/UTF-8 \
+en_ZW/ISO-8859-1 \
+eo/UTF-8 \
+es_AR.UTF-8/UTF-8 \
+es_AR/ISO-8859-1 \
+es_BO.UTF-8/UTF-8 \
+es_BO/ISO-8859-1 \
+es_CL.UTF-8/UTF-8 \
+es_CL/ISO-8859-1 \
+es_CO.UTF-8/UTF-8 \
+es_CO/ISO-8859-1 \
+es_CR.UTF-8/UTF-8 \
+es_CR/ISO-8859-1 \
+es_CU/UTF-8 \
+es_DO.UTF-8/UTF-8 \
+es_DO/ISO-8859-1 \
+es_EC.UTF-8/UTF-8 \
+es_EC/ISO-8859-1 \
+es_ES.UTF-8/UTF-8 \
+es_ES/ISO-8859-1 \
+es_ES@euro/ISO-8859-15 \
+es_GT.UTF-8/UTF-8 \
+es_GT/ISO-8859-1 \
+es_HN.UTF-8/UTF-8 \
+es_HN/ISO-8859-1 \
+es_MX.UTF-8/UTF-8 \
+es_MX/ISO-8859-1 \
+es_NI.UTF-8/UTF-8 \
+es_NI/ISO-8859-1 \
+es_PA.UTF-8/UTF-8 \
+es_PA/ISO-8859-1 \
+es_PE.UTF-8/UTF-8 \
+es_PE/ISO-8859-1 \
+es_PR.UTF-8/UTF-8 \
+es_PR/ISO-8859-1 \
+es_PY.UTF-8/UTF-8 \
+es_PY/ISO-8859-1 \
+es_SV.UTF-8/UTF-8 \
+es_SV/ISO-8859-1 \
+es_US.UTF-8/UTF-8 \
+es_US/ISO-8859-1 \
+es_UY.UTF-8/UTF-8 \
+es_UY/ISO-8859-1 \
+es_VE.UTF-8/UTF-8 \
+es_VE/ISO-8859-1 \
+et_EE.UTF-8/UTF-8 \
+et_EE/ISO-8859-1 \
+et_EE.ISO-8859-15/ISO-8859-15 \
+eu_ES.UTF-8/UTF-8 \
+eu_ES/ISO-8859-1 \
+eu_ES@euro/ISO-8859-15 \
+fa_IR/UTF-8 \
+ff_SN/UTF-8 \
+fi_FI.UTF-8/UTF-8 \
+fi_FI/ISO-8859-1 \
+fi_FI@euro/ISO-8859-15 \
+fil_PH/UTF-8 \
+fo_FO.UTF-8/UTF-8 \
+fo_FO/ISO-8859-1 \
+fr_BE.UTF-8/UTF-8 \
+fr_BE/ISO-8859-1 \
+fr_BE@euro/ISO-8859-15 \
+fr_CA.UTF-8/UTF-8 \
+fr_CA/ISO-8859-1 \
+fr_CH.UTF-8/UTF-8 \
+fr_CH/ISO-8859-1 \
+fr_FR.UTF-8/UTF-8 \
+fr_FR/ISO-8859-1 \
+fr_FR@euro/ISO-8859-15 \
+fr_LU.UTF-8/UTF-8 \
+fr_LU/ISO-8859-1 \
+fr_LU@euro/ISO-8859-15 \
+fur_IT/UTF-8 \
+fy_NL/UTF-8 \
+fy_DE/UTF-8 \
+ga_IE.UTF-8/UTF-8 \
+ga_IE/ISO-8859-1 \
+ga_IE@euro/ISO-8859-15 \
+gd_GB.UTF-8/UTF-8 \
+gd_GB/ISO-8859-15 \
+gez_ER/UTF-8 \
+gez_ER@abegede/UTF-8 \
+gez_ET/UTF-8 \
+gez_ET@abegede/UTF-8 \
+gl_ES.UTF-8/UTF-8 \
+gl_ES/ISO-8859-1 \
+gl_ES@euro/ISO-8859-15 \
+gu_IN/UTF-8 \
+gv_GB.UTF-8/UTF-8 \
+gv_GB/ISO-8859-1 \
+ha_NG/UTF-8 \
+hak_TW/UTF-8 \
+he_IL.UTF-8/UTF-8 \
+he_IL/ISO-8859-8 \
+hi_IN/UTF-8 \
+hif_FJ/UTF-8 \
+hne_IN/UTF-8 \
+hr_HR.UTF-8/UTF-8 \
+hr_HR/ISO-8859-2 \
+hsb_DE/ISO-8859-2 \
+hsb_DE.UTF-8/UTF-8 \
+ht_HT/UTF-8 \
+hu_HU.UTF-8/UTF-8 \
+hu_HU/ISO-8859-2 \
+hy_AM/UTF-8 \
+hy_AM.ARMSCII-8/ARMSCII-8 \
+ia_FR/UTF-8 \
+id_ID.UTF-8/UTF-8 \
+id_ID/ISO-8859-1 \
+ig_NG/UTF-8 \
+ik_CA/UTF-8 \
+is_IS.UTF-8/UTF-8 \
+is_IS/ISO-8859-1 \
+it_CH.UTF-8/UTF-8 \
+it_CH/ISO-8859-1 \
+it_IT.UTF-8/UTF-8 \
+it_IT/ISO-8859-1 \
+it_IT@euro/ISO-8859-15 \
+iu_CA/UTF-8 \
+ja_JP.EUC-JP/EUC-JP \
+ja_JP.UTF-8/UTF-8 \
+ka_GE.UTF-8/UTF-8 \
+ka_GE/GEORGIAN-PS \
+kab_DZ/UTF-8 \
+kk_KZ.UTF-8/UTF-8 \
+kk_KZ/PT154 \
+kl_GL.UTF-8/UTF-8 \
+kl_GL/ISO-8859-1 \
+km_KH/UTF-8 \
+kn_IN/UTF-8 \
+ko_KR.EUC-KR/EUC-KR \
+ko_KR.UTF-8/UTF-8 \
+kok_IN/UTF-8 \
+ks_IN/UTF-8 \
+ks_IN@devanagari/UTF-8 \
+ku_TR.UTF-8/UTF-8 \
+ku_TR/ISO-8859-9 \
+kw_GB.UTF-8/UTF-8 \
+kw_GB/ISO-8859-1 \
+ky_KG/UTF-8 \
+lb_LU/UTF-8 \
+lg_UG.UTF-8/UTF-8 \
+lg_UG/ISO-8859-10 \
+li_BE/UTF-8 \
+li_NL/UTF-8 \
+lij_IT/UTF-8 \
+ln_CD/UTF-8 \
+lo_LA/UTF-8 \
+lt_LT.UTF-8/UTF-8 \
+lt_LT/ISO-8859-13 \
+lv_LV.UTF-8/UTF-8 \
+lv_LV/ISO-8859-13 \
+lzh_TW/UTF-8 \
+mag_IN/UTF-8 \
+mai_IN/UTF-8 \
+mai_NP/UTF-8 \
+mfe_MU/UTF-8 \
+mg_MG.UTF-8/UTF-8 \
+mg_MG/ISO-8859-15 \
+mhr_RU/UTF-8 \
+mi_NZ.UTF-8/UTF-8 \
+mi_NZ/ISO-8859-13 \
+miq_NI/UTF-8 \
+mjw_IN/UTF-8 \
+mk_MK.UTF-8/UTF-8 \
+mk_MK/ISO-8859-5 \
+ml_IN/UTF-8 \
+mn_MN/UTF-8 \
+mni_IN/UTF-8 \
+mnw_MM/UTF-8 \
+mr_IN/UTF-8 \
+ms_MY.UTF-8/UTF-8 \
+ms_MY/ISO-8859-1 \
+mt_MT.UTF-8/UTF-8 \
+mt_MT/ISO-8859-3 \
+my_MM/UTF-8 \
+nan_TW/UTF-8 \
+nan_TW@latin/UTF-8 \
+nb_NO.UTF-8/UTF-8 \
+nb_NO/ISO-8859-1 \
+nds_DE/UTF-8 \
+nds_NL/UTF-8 \
+ne_NP/UTF-8 \
+nhn_MX/UTF-8 \
+niu_NU/UTF-8 \
+niu_NZ/UTF-8 \
+nl_AW/UTF-8 \
+nl_BE.UTF-8/UTF-8 \
+nl_BE/ISO-8859-1 \
+nl_BE@euro/ISO-8859-15 \
+nl_NL.UTF-8/UTF-8 \
+nl_NL/ISO-8859-1 \
+nl_NL@euro/ISO-8859-15 \
+nn_NO.UTF-8/UTF-8 \
+nn_NO/ISO-8859-1 \
+nr_ZA/UTF-8 \
+nso_ZA/UTF-8 \
+oc_FR.UTF-8/UTF-8 \
+oc_FR/ISO-8859-1 \
+om_ET/UTF-8 \
+om_KE.UTF-8/UTF-8 \
+om_KE/ISO-8859-1 \
+or_IN/UTF-8 \
+os_RU/UTF-8 \
+pa_IN/UTF-8 \
+pa_PK/UTF-8 \
+pap_AW/UTF-8 \
+pap_CW/UTF-8 \
+pl_PL.UTF-8/UTF-8 \
+pl_PL/ISO-8859-2 \
+ps_AF/UTF-8 \
+pt_BR.UTF-8/UTF-8 \
+pt_BR/ISO-8859-1 \
+pt_PT.UTF-8/UTF-8 \
+pt_PT/ISO-8859-1 \
+pt_PT@euro/ISO-8859-15 \
+quz_PE/UTF-8 \
+raj_IN/UTF-8 \
+ro_RO.UTF-8/UTF-8 \
+ro_RO/ISO-8859-2 \
+ru_RU.KOI8-R/KOI8-R \
+ru_RU.UTF-8/UTF-8 \
+ru_RU.CP1251/CP1251 \
+ru_RU.ISO-8859-5/ISO-8859-5 \
+ru_RU/ISO-8859-5 \
+ru_UA.UTF-8/UTF-8 \
+ru_UA/KOI8-U \
+rw_RW/UTF-8 \
+sa_IN/UTF-8 \
+sah_RU/UTF-8 \
+sat_IN/UTF-8 \
+sc_IT/UTF-8 \
+sd_IN/UTF-8 \
+sd_IN@devanagari/UTF-8 \
+se_NO/UTF-8 \
+sgs_LT/UTF-8 \
+shn_MM/UTF-8 \
+shs_CA/UTF-8 \
+si_LK/UTF-8 \
+sid_ET/UTF-8 \
+sk_SK.UTF-8/UTF-8 \
+sk_SK/ISO-8859-2 \
+sl_SI.UTF-8/UTF-8 \
+sl_SI/ISO-8859-2 \
+sm_WS/UTF-8 \
+so_DJ.UTF-8/UTF-8 \
+so_DJ/ISO-8859-1 \
+so_ET/UTF-8 \
+so_KE.UTF-8/UTF-8 \
+so_KE/ISO-8859-1 \
+so_SO.UTF-8/UTF-8 \
+so_SO/ISO-8859-1 \
+sq_AL.UTF-8/UTF-8 \
+sq_AL/ISO-8859-1 \
+sq_MK/UTF-8 \
+sr_ME/UTF-8 \
+sr_RS/UTF-8 \
+sr_RS@latin/UTF-8 \
+ss_ZA/UTF-8 \
+st_ZA.UTF-8/UTF-8 \
+st_ZA/ISO-8859-1 \
+sv_FI.UTF-8/UTF-8 \
+sv_FI/ISO-8859-1 \
+sv_FI@euro/ISO-8859-15 \
+sv_SE.UTF-8/UTF-8 \
+sv_SE/ISO-8859-1 \
+sw_KE/UTF-8 \
+sw_TZ/UTF-8 \
+szl_PL/UTF-8 \
+ta_IN/UTF-8 \
+ta_LK/UTF-8 \
+tcy_IN.UTF-8/UTF-8 \
+te_IN/UTF-8 \
+tg_TJ.UTF-8/UTF-8 \
+tg_TJ/KOI8-T \
+th_TH.UTF-8/UTF-8 \
+th_TH/TIS-620 \
+the_NP/UTF-8 \
+ti_ER/UTF-8 \
+ti_ET/UTF-8 \
+tig_ER/UTF-8 \
+tk_TM/UTF-8 \
+tl_PH.UTF-8/UTF-8 \
+tl_PH/ISO-8859-1 \
+tn_ZA/UTF-8 \
+to_TO/UTF-8 \
+tpi_PG/UTF-8 \
+tr_CY.UTF-8/UTF-8 \
+tr_CY/ISO-8859-9 \
+tr_TR.UTF-8/UTF-8 \
+tr_TR/ISO-8859-9 \
+ts_ZA/UTF-8 \
+tt_RU/UTF-8 \
+tt_RU@iqtelif/UTF-8 \
+ug_CN/UTF-8 \
+uk_UA.UTF-8/UTF-8 \
+uk_UA/KOI8-U \
+unm_US/UTF-8 \
+ur_IN/UTF-8 \
+ur_PK/UTF-8 \
+uz_UZ.UTF-8/UTF-8 \
+uz_UZ/ISO-8859-1 \
+uz_UZ@cyrillic/UTF-8 \
+ve_ZA/UTF-8 \
+vi_VN/UTF-8 \
+wa_BE/ISO-8859-1 \
+wa_BE@euro/ISO-8859-15 \
+wa_BE.UTF-8/UTF-8 \
+wae_CH/UTF-8 \
+wal_ET/UTF-8 \
+wo_SN/UTF-8 \
+xh_ZA.UTF-8/UTF-8 \
+xh_ZA/ISO-8859-1 \
+yi_US.UTF-8/UTF-8 \
+yi_US/CP1255 \
+yo_NG/UTF-8 \
+yue_HK/UTF-8 \
+yuw_PG/UTF-8 \
+zh_CN.GB18030/GB18030 \
+zh_CN.GBK/GBK \
+zh_CN.UTF-8/UTF-8 \
+zh_CN/GB2312 \
+zh_HK.UTF-8/UTF-8 \
+zh_HK/BIG5-HKSCS \
+zh_SG.UTF-8/UTF-8 \
+zh_SG.GBK/GBK \
+zh_SG/GB2312 \
+zh_TW.EUC-TW/EUC-TW \
+zh_TW.UTF-8/UTF-8 \
+zh_TW/BIG5 \
+zu_ZA.UTF-8/UTF-8 \
+zu_ZA/ISO-8859-1 \
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-i18n-patch/glibc-2.34-new/localedata/locales/en_RU
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-i18n-patch/glibc-2.34-new/localedata/locales/en_RU (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-i18n-patch/glibc-2.34-new/localedata/locales/en_RU (revision 348)
@@ -0,0 +1,167 @@
+comment_char %
+escape_char /
+
+% English Language Locale for Russia
+% Source: RADIX.PRO
+% Address: Russia, 193231, St. Petersburg, Solidarnosty av., 25-1-105
+% Contact: Andrey V.Kosteltsev
+% Email: kosteltsev@gmail.com
+% Tel: +7 (911) 970-91-61
+% Fax: +7 (911) 970-91-61
+% Language: en
+% Territory: RU
+% Revision: 1.0
+% Date: 2012-09-24
+% Application: general
+% Users: general
+% Charset: ISO-8859-5
+% Distribution and use is free, also
+% for commercial purposes.
+
+LC_IDENTIFICATION
+title "English locale for Russia"
+source "RADIX.PRO"
+address "Russia, 193231, St. Petersburg, Solidarnosty av., 25-1-105"
+contact ""
+email "bug-glibc-locales@gnu.org"
+tel ""
+fax ""
+language "English"
+territory "Russia"
+revision "1.0"
+date "2016-07-29"
+%
+category "i18n:2012";LC_IDENTIFICATION
+category "i18n:2012";LC_CTYPE
+category "i18n:2012";LC_COLLATE
+category "i18n:2012";LC_TIME
+category "i18n:2012";LC_NUMERIC
+category "i18n:2012";LC_MONETARY
+category "i18n:2012";LC_MESSAGES
+category "i18n:2012";LC_PAPER
+category "i18n:2012";LC_NAME
+category "i18n:2012";LC_ADDRESS
+category "i18n:2012";LC_TELEPHONE
+
+END LC_IDENTIFICATION
+
+LC_COLLATE
+% Copy the template from ISO/IEC 14651
+copy "iso14651_t1"
+END LC_COLLATE
+
+LC_CTYPE
+copy "i18n"
+
+translit_start
+include "translit_combining";""
+translit_end
+END LC_CTYPE
+
+LC_MESSAGES
+yesexpr "<U005E><U005B><U0079><U0059><U005D><U002E><U002A>"
+noexpr "<U005E><U005B><U006E><U004E><U005D><U002E><U002A>"
+yesstr "<U0059><U0065><U0073>"
+nostr "<U004E><U006F>"
+END LC_MESSAGES
+
+LC_MONETARY
+int_curr_symbol "<U0052><U0055><U0042><U0020>"
+currency_symbol "<U0072><U0075><U0062>"
+mon_decimal_point "<U002E>"
+mon_thousands_sep "<U00A0>"
+mon_grouping 3;3
+positive_sign ""
+negative_sign "<U002D>"
+int_frac_digits 2
+frac_digits 2
+p_cs_precedes 0
+p_sep_by_space 1
+n_cs_precedes 0
+n_sep_by_space 1
+p_sign_posn 1
+n_sign_posn 1
+END LC_MONETARY
+
+LC_NUMERIC
+decimal_point "<U002E>"
+thousands_sep "<U00A0>"
+grouping 3;3
+END LC_NUMERIC
+
+LC_TIME
+abday "<U0053><U0075><U006E>";"<U004D><U006F><U006E>";/
+ "<U0054><U0075><U0065>";"<U0057><U0065><U0064>";/
+ "<U0054><U0068><U0075>";"<U0046><U0072><U0069>";/
+ "<U0053><U0061><U0074>"
+day "<U0053><U0075><U006E><U0064><U0061><U0079>";/
+ "<U004D><U006F><U006E><U0064><U0061><U0079>";/
+ "<U0054><U0075><U0065><U0073><U0064><U0061><U0079>";/
+ "<U0057><U0065><U0064><U006E><U0065><U0073><U0064><U0061><U0079>";/
+ "<U0054><U0068><U0075><U0072><U0073><U0064><U0061><U0079>";/
+ "<U0046><U0072><U0069><U0064><U0061><U0079>";/
+ "<U0053><U0061><U0074><U0075><U0072><U0064><U0061><U0079>"
+abmon "<U004A><U0061><U006E>";"<U0046><U0065><U0062>";/
+ "<U004D><U0061><U0072>";"<U0041><U0070><U0072>";/
+ "<U004D><U0061><U0079>";"<U004A><U0075><U006E>";/
+ "<U004A><U0075><U006C>";"<U0041><U0075><U0067>";/
+ "<U0053><U0065><U0070>";"<U004F><U0063><U0074>";/
+ "<U004E><U006F><U0076>";"<U0044><U0065><U0063>"
+mon "<U004A><U0061><U006E><U0075><U0061><U0072><U0079>";/
+ "<U0046><U0065><U0062><U0072><U0075><U0061><U0072><U0079>";/
+ "<U004D><U0061><U0072><U0063><U0068>";/
+ "<U0041><U0070><U0072><U0069><U006C>";/
+ "<U004D><U0061><U0079>";/
+ "<U004A><U0075><U006E><U0065>";/
+ "<U004A><U0075><U006C><U0079>";/
+ "<U0041><U0075><U0067><U0075><U0073><U0074>";/
+ "<U0053><U0065><U0070><U0074><U0065><U006D><U0062><U0065><U0072>";/
+ "<U004F><U0063><U0074><U006F><U0062><U0065><U0072>";/
+ "<U004E><U006F><U0076><U0065><U006D><U0062><U0065><U0072>";/
+ "<U0044><U0065><U0063><U0065><U006D><U0062><U0065><U0072>"
+d_t_fmt "<U0025><U0061><U0020><U0025><U0064><U0020><U0025><U0062>/
+<U0020><U0025><U0059><U0020><U0025><U0054>"
+d_fmt "<U0025><U0064><U002E><U0025><U006D><U002E><U0025><U0059>"
+t_fmt "<U0025><U0054>"
+am_pm "";""
+t_fmt_ampm ""
+date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
+<U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
+<U0025><U005A><U0020><U0025><U0059>"
+week 7;19971130;4
+first_weekday 2
+first_workday 2
+END LC_TIME
+
+LC_PAPER
+height 297
+width 210
+END LC_PAPER
+
+LC_TELEPHONE
+tel_int_fmt "<U002B><U0025><U0063><U0020><U0028><U0025><U0061><U0029>/
+<U0020><U0025><U006C>"
+int_prefix "<U0037>"
+int_select "<U0030><U007E><U0031><U0030>"
+END LC_TELEPHONE
+
+LC_MEASUREMENT
+% 1 for Metric system, 2 for US
+measurement 1
+END LC_MEASUREMENT
+
+LC_NAME
+name_fmt "<U0025><U0064><U0025><U0074><U0025><U0067><U0025><U0074>/
+<U0025><U006D><U0025><U0074><U0025><U0066>"
+END LC_NAME
+
+LC_ADDRESS
+postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
+<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073>/
+<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
+<U004E><U0025><U007A><U0020><U0025><U0054><U0025>/
+<U004E><U0025><U0063><U0025><U004E>"
+country_ab2 "<U0052><U0055>"
+country_ab3 "<U0052><U0055><U0053>"
+country_num 643
+END LC_ADDRESS
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-i18n-patch/glibc-2.34-new/localedata/locales/ru_RU
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-i18n-patch/glibc-2.34-new/localedata/locales/ru_RU (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-i18n-patch/glibc-2.34-new/localedata/locales/ru_RU (revision 348)
@@ -0,0 +1,208 @@
+comment_char %
+escape_char /
+
+% This file is part of the GNU C Library and contains locale data.
+% The Free Software Foundation does not claim any copyright interest
+% in the locale data contained in this file. The foregoing does not
+% affect the license of the GNU C Library as a whole. It does not
+% exempt you from the conditions of the license if your use would
+% otherwise be governed by that license.
+
+% Russian Language Locale for Russia
+% Source: RAP
+% Address: Sankt Jo//rgens Alle 8
+% DK-1615 Ko//benhavn V, Danmark
+% Contact: Keld Simonsen
+% Email: Keld.Simonsen@dkuug.dk
+% Tel: +45 - 31226543
+% Fax: +45 - 33256543
+% Language: ru
+% Territory: RU
+% Revision: 4.3
+% Date: 1996-10-15
+% Application: general
+% Users: general
+
+LC_IDENTIFICATION
+title "Russian locale for Russia"
+source "RAP"
+address "Sankt Jorgens Alle 8, DK-1615 Kobenhavn V, Danmark"
+contact ""
+email "bug-glibc-locales@gnu.org"
+tel ""
+fax ""
+language "Russian"
+territory "Russia"
+revision "1.0"
+date "2000-06-29"
+
+category "i18n:2012";LC_IDENTIFICATION
+category "i18n:2012";LC_CTYPE
+category "i18n:2012";LC_COLLATE
+category "i18n:2012";LC_TIME
+category "i18n:2012";LC_NUMERIC
+category "i18n:2012";LC_MONETARY
+category "i18n:2012";LC_MESSAGES
+category "i18n:2012";LC_PAPER
+category "i18n:2012";LC_NAME
+category "i18n:2012";LC_ADDRESS
+category "i18n:2012";LC_TELEPHONE
+category "i18n:2012";LC_MEASUREMENT
+END LC_IDENTIFICATION
+
+LC_COLLATE
+% CLDR collation rules for Russian:
+% (see: https://unicode.org/cldr/trac/browser/trunk/common/collation/ru.xml)
+%
+% <collation type="standard">
+% <cr><![CDATA[
+% [reorder Cyrl]
+% # The root collation already sorts й/Й as a base letter.
+% ]]></cr>
+% </collation>
+%
+copy "iso14651_t1"
+END LC_COLLATE
+
+LC_CTYPE
+copy "i18n"
+
+translit_start
+include "translit_combining";""
+translit_end
+END LC_CTYPE
+
+LC_MESSAGES
+yesexpr "^[+1yY<U0414><U0434>]"
+noexpr "^[-0nN<U041D><U043D>]"
+yesstr "<U0434><U0430>"
+nostr "<U043D><U0435><U0442>"
+END LC_MESSAGES
+
+LC_MONETARY
+int_curr_symbol "RUB "
+currency_symbol "<U20BD>"
+mon_decimal_point ","
+mon_thousands_sep "<U202F>"
+mon_grouping 3;3
+positive_sign ""
+negative_sign "-"
+int_frac_digits 2
+frac_digits 2
+p_cs_precedes 0
+p_sep_by_space 1
+n_cs_precedes 0
+n_sep_by_space 1
+p_sign_posn 1
+n_sign_posn 1
+END LC_MONETARY
+
+LC_NUMERIC
+decimal_point "."
+thousands_sep "<U202F>"
+grouping 3;3
+END LC_NUMERIC
+
+LC_TIME
+day "<U0412><U043E><U0441><U043A><U0440><U0435><U0441><U0435><U043D><U044C><U0435>";/
+ "<U041F><U043E><U043D><U0435><U0434><U0435><U043B><U044C><U043D><U0438><U043A>";/
+ "<U0412><U0442><U043E><U0440><U043D><U0438><U043A>";/
+ "<U0421><U0440><U0435><U0434><U0430>";/
+ "<U0427><U0435><U0442><U0432><U0435><U0440><U0433>";/
+ "<U041F><U044F><U0442><U043D><U0438><U0446><U0430>";/
+ "<U0421><U0443><U0431><U0431><U043E><U0442><U0430>"
+abday "<U0412><U0441>";/
+ "<U041F><U043D>";/
+ "<U0412><U0442>";/
+ "<U0421><U0440>";/
+ "<U0427><U0442>";/
+ "<U041F><U0442>";/
+ "<U0421><U0431>"
+alt_mon "<U042F><U043D><U0432><U0430><U0440><U044C>";/
+ "<U0424><U0435><U0432><U0440><U0430><U043B><U044C>";/
+ "<U041C><U0430><U0440><U0442>";/
+ "<U0410><U043F><U0440><U0435><U043B><U044C>";/
+ "<U041C><U0430><U0439>";/
+ "<U0418><U044E><U043D><U044C>";/
+ "<U0418><U044E><U043B><U044C>";/
+ "<U0410><U0432><U0433><U0443><U0441><U0442>";/
+ "<U0421><U0435><U043D><U0442><U044F><U0431><U0440><U044C>";/
+ "<U041E><U043A><U0442><U044F><U0431><U0440><U044C>";/
+ "<U041D><U043E><U044F><U0431><U0440><U044C>";/
+ "<U0414><U0435><U043A><U0430><U0431><U0440><U044C>"
+mon "<U044F><U043D><U0432><U0430><U0440><U044F>";/
+ "<U0444><U0435><U0432><U0440><U0430><U043B><U044F>";/
+ "<U043C><U0430><U0440><U0442><U0430>";/
+ "<U0430><U043F><U0440><U0435><U043B><U044F>";/
+ "<U043C><U0430><U044F>";/
+ "<U0438><U044E><U043D><U044F>";/
+ "<U0438><U044E><U043B><U044F>";/
+ "<U0430><U0432><U0433><U0443><U0441><U0442><U0430>";/
+ "<U0441><U0435><U043D><U0442><U044F><U0431><U0440><U044F>";/
+ "<U043E><U043A><U0442><U044F><U0431><U0440><U044F>";/
+ "<U043D><U043E><U044F><U0431><U0440><U044F>";/
+ "<U0434><U0435><U043A><U0430><U0431><U0440><U044F>"
+ab_alt_mon "<U044F><U043D><U0432>";/
+ "<U0444><U0435><U0432>";/
+ "<U043C><U0430><U0440>";/
+ "<U0430><U043F><U0440>";/
+ "<U043C><U0430><U0439>";/
+ "<U0438><U044E><U043D>";/
+ "<U0438><U044E><U043B>";/
+ "<U0430><U0432><U0433>";/
+ "<U0441><U0435><U043D>";/
+ "<U043E><U043A><U0442>";/
+ "<U043D><U043E><U044F>";/
+ "<U0434><U0435><U043A>"
+abmon "<U044F><U043D><U0432>";/
+ "<U0444><U0435><U0432>";/
+ "<U043C><U0430><U0440>";/
+ "<U0430><U043F><U0440>";/
+ "<U043C><U0430><U044F>";/
+ "<U0438><U044E><U043D>";/
+ "<U0438><U044E><U043B>";/
+ "<U0430><U0432><U0433>";/
+ "<U0441><U0435><U043D>";/
+ "<U043E><U043A><U0442>";/
+ "<U043D><U043E><U044F>";/
+ "<U0434><U0435><U043A>"
+d_t_fmt "%a %d %b %Y %T"
+date_fmt "%a %d %b %Y %T %Z"
+d_fmt "%d.%m.%Y"
+t_fmt "%T"
+am_pm "";""
+t_fmt_ampm ""
+week 7;19971130;1
+first_weekday 2
+END LC_TIME
+
+LC_PAPER
+copy "i18n"
+END LC_PAPER
+
+LC_TELEPHONE
+tel_int_fmt "+%c %a %l"
+int_prefix "7"
+int_select "0~10"
+END LC_TELEPHONE
+
+LC_MEASUREMENT
+copy "i18n"
+END LC_MEASUREMENT
+
+LC_NAME
+name_fmt "%d%t%g%t%m%t%f"
+END LC_NAME
+
+LC_ADDRESS
+postal_fmt "%f%N%a%N%d%N%b%N%s %h %e %r%N%z %T%N%c%N"
+country_name "<U0420><U043E><U0441><U0441><U0438><U044F>"
+country_ab2 "RU"
+country_ab3 "RUS"
+country_num 643
+country_car "RUS"
+lang_name "<U0440><U0443><U0441><U0441><U043A><U0438><U0439>"
+lang_ab "ru"
+lang_term "rus"
+lang_lib "rus"
+END LC_ADDRESS
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-locale-no-archive-patch/create.patch.sh
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-locale-no-archive-patch/create.patch.sh (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-locale-no-archive-patch/create.patch.sh (revision 348)
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+VERSION=2.34
+
+tar --files-from=file.list -xJvf ../glibc-$VERSION.tar.xz
+mv glibc-$VERSION glibc-$VERSION-orig
+
+cp -rf ./glibc-$VERSION-new ./glibc-$VERSION
+
+diff -b --unified -Nr glibc-$VERSION-orig glibc-$VERSION > glibc-$VERSION-locale-no-archive.patch
+
+mv glibc-$VERSION-locale-no-archive.patch ../patches
+
+rm -rf ./glibc-$VERSION
+rm -rf ./glibc-$VERSION-orig
Property changes on: toolchains-1.7.2/sources/GNU/glibc/create-2.34-locale-no-archive-patch/create.patch.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-locale-no-archive-patch/file.list
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-locale-no-archive-patch/file.list (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-locale-no-archive-patch/file.list (revision 348)
@@ -0,0 +1 @@
+glibc-2.34/localedata/Makefile
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-locale-no-archive-patch/glibc-2.34-new/localedata/Makefile
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-locale-no-archive-patch/glibc-2.34-new/localedata/Makefile (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-locale-no-archive-patch/glibc-2.34-new/localedata/Makefile (revision 348)
@@ -0,0 +1,470 @@
+# Copyright (C) 1996-2021 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
+# <https://www.gnu.org/licenses/>.
+
+# Makefile for installing locale data source files.
+
+subdir := localedata
+
+include ../Makeconfig
+
+# List with all available character set descriptions.
+charmaps := $(wildcard charmaps/[A-I]*) $(wildcard charmaps/[J-Z]*)
+
+# List with all available character set descriptions.
+locales := $(wildcard locales/*)
+
+
+subdir-dirs = tests-mbwc
+vpath %.c tests-mbwc
+vpath %.h tests-mbwc
+
+
+test-srcs := collate-test xfrm-test tst-fmon tst-rpmatch tst-trans \
+ tst-ctype tst-langinfo-newlocale tst-langinfo-setlocale \
+ tst-langinfo-newlocale-static tst-langinfo-setlocale-static \
+ tst-numeric
+# List of test input files (list sorted alphabetically):
+test-input := \
+ am_ET.UTF-8 \
+ az_AZ.UTF-8 \
+ be_BY.UTF-8 \
+ ber_DZ.UTF-8 \
+ ber_MA.UTF-8 \
+ bg_BG.UTF-8 \
+ br_FR.UTF-8 \
+ bs_BA.UTF-8 \
+ ckb_IQ.UTF-8 \
+ cmn_TW.UTF-8 \
+ crh_UA.UTF-8 \
+ cs_CZ.UTF-8 \
+ csb_PL.UTF-8 \
+ cv_RU.UTF-8 \
+ cy_GB.UTF-8 \
+ da_DK.ISO-8859-1 \
+ de_DE.ISO-8859-1 \
+ dsb_DE.UTF-8 \
+ dz_BT.UTF-8 \
+ en_US.ISO-8859-1 \
+ en_US.UTF-8 \
+ eo.UTF-8 \
+ es_ES.UTF-8 \
+ et_EE.UTF-8 \
+ fa_IR.UTF-8 \
+ fi_FI.UTF-8 \
+ fil_PH.UTF-8 \
+ fr_CA.UTF-8 \
+ fr_FR.UTF-8 \
+ fur_IT.UTF-8 \
+ gez_ER.UTF-8@abegede \
+ ha_NG.UTF-8 \
+ hr_HR.ISO-8859-2 \
+ hr_HR.UTF-8 \
+ hsb_DE.UTF-8 \
+ hu_HU.UTF-8 \
+ ig_NG.UTF-8 \
+ ik_CA.UTF-8 \
+ is_IS.UTF-8 \
+ kk_KZ.UTF-8 \
+ ku_TR.UTF-8 \
+ ky_KG.UTF-8 \
+ ln_CD.UTF-8 \
+ lt_LT.UTF-8 \
+ lv_LV.UTF-8 \
+ mi_NZ.UTF-8 \
+ ml_IN.UTF-8 \
+ mn_MN.UTF-8 \
+ mr_IN.UTF-8 \
+ mt_MT.UTF-8 \
+ nan_TW.UTF-8@latin \
+ nb_NO.UTF-8 \
+ om_KE.UTF-8 \
+ or_IN.UTF-8 \
+ os_RU.UTF-8 \
+ pl_PL.UTF-8 \
+ ps_AF.UTF-8 \
+ ro_RO.UTF-8 \
+ ru_RU.UTF-8 \
+ sah_RU.UTF-8 \
+ sc_IT.UTF-8 \
+ se_NO.UTF-8 \
+ si_LK.UTF-8 \
+ sq_AL.UTF-8 \
+ sr_RS.UTF-8 \
+ sv_SE.ISO-8859-1 \
+ sv_SE.UTF-8 \
+ szl_PL.UTF-8 \
+ tg_TJ.UTF-8 \
+ tk_TM.UTF-8 \
+ tr_TR.UTF-8 \
+ tt_RU.UTF-8 \
+ tt_RU.UTF-8@iqtelif \
+ ug_CN.UTF-8 \
+ uk_UA.UTF-8 \
+ uz_UZ.UTF-8 \
+ vi_VN.UTF-8 \
+ yi_US.UTF-8 \
+ yo_NG.UTF-8 \
+ zh_CN.UTF-8 \
+ $(NULL)
+
+test-input-data = $(addsuffix .in, $(test-input))
+test-output := $(foreach s, .out .xout, \
+ $(addsuffix $s, $(basename $(test-input))))
+ld-test-names := test1 test2 test3 test4 test5 test6 test7
+ld-test-srcs := $(addprefix tests/,$(addsuffix .cm,$(ld-test-names)) \
+ $(addsuffix .def,$(ld-test-names)) \
+ $(addsuffix .ds,test5 test6) \
+ test6.c trans.def)
+
+fmon-tests = n01y12 n02n40 n10y31 n11y41 n12y11 n20n32 n30y20 n41n00 \
+ y01y10 y02n22 y22n42 y30y21 y32n31 y40y00 y42n21
+
+generated += $(test-input) $(test-output) sort-test.out tst-locale.out \
+ tst-leaks.mtrace mtrace-tst-leaks.out
+generated-dirs += $(ld-test-names) tt_TT de_DE.437 \
+ $(addprefix tstfmon_,$(fmon-tests)) \
+
+ifeq ($(run-built-tests),yes)
+locale_test_suite := tst_iswalnum tst_iswalpha tst_iswcntrl \
+ tst_iswctype tst_iswdigit tst_iswgraph \
+ tst_iswlower tst_iswprint tst_iswpunct \
+ tst_iswspace tst_iswupper tst_iswxdigit tst_mblen \
+ tst_mbrlen tst_mbrtowc tst_mbsrtowcs tst_mbstowcs \
+ tst_mbtowc tst_strcoll tst_strfmon tst_strxfrm \
+ tst_swscanf tst_towctrans tst_towlower \
+ tst_towupper tst_wcrtomb tst_wcscat tst_wcschr \
+ tst_wcscmp tst_wcscoll tst_wcscpy tst_wcscspn \
+ tst_wcslen tst_wcsncat tst_wcsncmp tst_wcsncpy \
+ tst_wcspbrk tst_wcsrtombs tst_wcsspn tst_wcsstr \
+ tst_wcstod tst_wcstok tst_wcstombs tst_wcswidth \
+ tst_wcsxfrm tst_wctob tst_wctomb tst_wctrans \
+ tst_wctype tst_wcwidth
+
+tests = $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \
+ tst-leaks tst-mbswcs1 tst-mbswcs2 tst-mbswcs3 tst-mbswcs4 tst-mbswcs5 \
+ tst-mbswcs6 tst-xlocale1 tst-xlocale2 bug-usesetlocale \
+ tst-strfmon1 tst-sscanf bug-setlocale1 tst-setlocale2 tst-setlocale3 \
+ tst-wctype tst-iconv-math-trans
+tests-static = bug-setlocale1-static
+tests += $(tests-static)
+ifeq (yes,$(build-shared))
+ifneq (no,$(PERL))
+tests-special += $(objpfx)mtrace-tst-leaks.out
+endif
+endif
+endif
+tests-container = \
+ tst-localedef-hardlinks
+
+# Files to install.
+ifeq ($(INSTALL_UNCOMPRESSED),yes)
+# This option is for testing inside the testroot container, as the
+# container does not include a working gunzip program.
+install-others := $(addprefix $(inst_i18ndir)/, \
+ $(charmaps) \
+ $(locales))
+else
+install-others := $(addprefix $(inst_i18ndir)/, \
+ $(addsuffix .gz, $(charmaps)) \
+ $(locales))
+endif
+
+tests: $(objdir)/iconvdata/gconv-modules
+
+tests-static += tst-langinfo-newlocale-static tst-langinfo-setlocale-static
+
+ifeq ($(run-built-tests),yes)
+tests-special += $(objpfx)sort-test.out $(objpfx)tst-fmon.out \
+ $(objpfx)tst-locale.out $(objpfx)tst-rpmatch.out \
+ $(objpfx)tst-trans.out $(objpfx)tst-ctype.out \
+ $(objpfx)tst-langinfo-newlocale.out \
+ $(objpfx)tst-langinfo-setlocale.out \
+ $(objpfx)tst-langinfo-newlocale-static.out \
+ $(objpfx)tst-langinfo-setlocale-static.out \
+ $(objpfx)tst-numeric.out
+# We have to generate locales (list sorted alphabetically)
+LOCALES := \
+ am_ET.UTF-8 \
+ az_AZ.UTF-8 \
+ be_BY.UTF-8 \
+ ber_DZ.UTF-8 \
+ ber_MA.UTF-8 \
+ bg_BG.UTF-8 \
+ br_FR.UTF-8 \
+ bs_BA.UTF-8 \
+ ckb_IQ.UTF-8 \
+ cmn_TW.UTF-8 \
+ crh_UA.UTF-8 \
+ cs_CZ.UTF-8 \
+ csb_PL.UTF-8 \
+ cv_RU.UTF-8 \
+ cy_GB.UTF-8 \
+ da_DK.ISO-8859-1 \
+ de_DE.ISO-8859-1 \
+ de_DE.UTF-8 \
+ dsb_DE.UTF-8 \
+ dz_BT.UTF-8 \
+ en_GB.UTF-8 \
+ en_US.ANSI_X3.4-1968 \
+ en_US.ISO-8859-1\
+ en_US.UTF-8 \
+ eo.UTF-8 \
+ es_ES.UTF-8 \
+ et_EE.UTF-8 \
+ fa_IR.UTF-8 \
+ fi_FI.UTF-8 \
+ fil_PH.UTF-8 \
+ fr_CA.UTF-8 \
+ fr_FR.ISO-8859-1 \
+ fr_FR.UTF-8 \
+ fur_IT.UTF-8 \
+ gez_ER.UTF-8@abegede \
+ ha_NG.UTF-8 \
+ hr_HR.ISO-8859-2 \
+ hr_HR.UTF-8 \
+ hsb_DE.UTF-8 \
+ hu_HU.UTF-8 \
+ ig_NG.UTF-8 \
+ ik_CA.UTF-8 \
+ is_IS.UTF-8 \
+ ja_JP.EUC-JP \
+ ja_JP.SJIS \
+ ja_JP.UTF-8 \
+ kk_KZ.UTF-8 \
+ ku_TR.UTF-8 \
+ ky_KG.UTF-8 \
+ ln_CD.UTF-8 \
+ lt_LT.UTF-8 \
+ lv_LV.UTF-8 \
+ mi_NZ.UTF-8 \
+ ml_IN.UTF-8 \
+ mn_MN.UTF-8 \
+ mr_IN.UTF-8 \
+ mt_MT.UTF-8 \
+ nan_TW.UTF-8@latin \
+ nb_NO.ISO-8859-1 \
+ nb_NO.UTF-8 \
+ nl_NL.UTF-8 \
+ nn_NO.ISO-8859-1 \
+ om_KE.UTF-8 \
+ or_IN.UTF-8 \
+ os_RU.UTF-8 \
+ pl_PL.UTF-8 \
+ ps_AF.UTF-8 \
+ ro_RO.UTF-8 \
+ ru_RU.UTF-8 \
+ sah_RU.UTF-8 \
+ sc_IT.UTF-8 \
+ se_NO.UTF-8 \
+ si_LK.UTF-8 \
+ sq_AL.UTF-8 \
+ sr_RS.UTF-8 \
+ sv_SE.ISO-8859-1 \
+ sv_SE.UTF-8 \
+ szl_PL.UTF-8 \
+ tg_TJ.UTF-8 \
+ tk_TM.UTF-8 \
+ tr_TR.ISO-8859-9 \
+ tr_TR.UTF-8 \
+ tt_RU.UTF-8 \
+ tt_RU.UTF-8@iqtelif \
+ ug_CN.UTF-8 \
+ uk_UA.UTF-8 \
+ uz_UZ.UTF-8 \
+ vi_VN.UTF-8 \
+ yi_US.UTF-8 \
+ yo_NG.UTF-8 \
+ zh_CN.UTF-8 \
+ zh_TW.EUC-TW \
+ $(NULL)
+
+include ../gen-locales.mk
+
+$(objpfx)tst-iconv-math-trans.out: $(gen-locales)
+endif
+
+include ../Rules
+
+ifeq ($(INSTALL_UNCOMPRESSED),yes)
+# Install the charmap files as-is. This option is for testing inside
+# the testroot container, as the container does not include a working
+# gunzip program.
+$(inst_i18ndir)/charmaps/%: charmaps/% $(+force)
+ $(make-target-directory)
+ rm -f $@
+ $(INSTALL_DATA) $< $@
+else
+# Install the charmap files in gzipped format.
+$(inst_i18ndir)/charmaps/%.gz: charmaps/% $(+force)
+ $(make-target-directory)
+ rm -f $(@:.gz=) $@
+ $(INSTALL_DATA) $< $(@:.gz=)
+ gzip -9n $(@:.gz=)
+endif
+
+# Install the locale source files in the appropriate directory.
+$(inst_i18ndir)/locales/%: locales/% $(+force); $(do-install)
+
+ifeq ($(run-built-tests),yes)
+generated-dirs += $(LOCALES)
+
+$(addsuffix .out,$(addprefix $(objpfx),$(tests))): %: \
+ $(addprefix $(objpfx),$(CTYPE_FILES))
+
+$(objpfx)sort-test.out: sort-test.sh $(objpfx)collate-test $(objpfx)xfrm-test \
+ $(test-input-data) $(addprefix $(objpfx),$(CTYPE_FILES))
+ $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
+ '$(run-program-env)' '$(test-program-prefix-after-env)' \
+ $(test-input) \
+ > $@; \
+ $(evaluate-test)
+$(objpfx)tst-fmon.out: tst-fmon.sh $(objpfx)tst-fmon tst-fmon.data \
+ $(objpfx)sort-test.out \
+ $(addprefix $(objpfx),$(CTYPE_FILES))
+ $(SHELL) $< $(common-objpfx) '$(run-program-prefix-before-env)' \
+ '$(run-program-env)' '$(run-program-prefix-after-env)' \
+ '$(test-program-prefix)' tst-fmon.data \
+ > $@; \
+ $(evaluate-test)
+$(objpfx)tst-numeric.out: tst-numeric.sh $(objpfx)tst-numeric tst-numeric.data \
+ $(objpfx)sort-test.out \
+ $(addprefix $(objpfx),$(CTYPE_FILES))
+ $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' tst-numeric.data \
+ > $@; \
+ $(evaluate-test)
+$(objpfx)tst-locale.out: tst-locale.sh $(common-objpfx)locale/localedef \
+ $(ld-test-srcs) $(addprefix $(objpfx),$(CTYPE_FILES))
+ $(SHELL) $< $(common-objpfx) '$(built-program-cmd-before-env)' \
+ '$(run-program-env)' '$(built-program-cmd-after-env)' > $@; \
+ $(evaluate-test)
+$(objpfx)tst-rpmatch.out: tst-rpmatch.sh $(objpfx)tst-rpmatch \
+ $(objpfx)tst-fmon.out \
+ $(addprefix $(objpfx),$(CTYPE_FILES))
+ $(SHELL) $< $(common-objpfx) '$(test-program-cmd)' > $@; \
+ $(evaluate-test)
+$(objpfx)tst-trans.out: tst-trans.sh $(objpfx)tst-trans \
+ $(addprefix $(objpfx),$(CTYPE_FILES))
+ $(SHELL) $< $(common-objpfx) '$(run-program-prefix-before-env)' \
+ '$(run-program-env)' '$(run-program-prefix-after-env)' \
+ '$(test-program-prefix-before-env)' \
+ '$(test-program-prefix-after-env)'; \
+ $(evaluate-test)
+$(objpfx)tst-ctype.out: tst-ctype.sh $(objpfx)tst-ctype \
+ $(objpfx)sort-test.out \
+ $(addprefix $(objpfx),$(CTYPE_FILES))
+ $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
+ '$(run-program-env)' '$(test-program-cmd-after-env)'; \
+ $(evaluate-test)
+$(objpfx)tst-langinfo-newlocale.out: tst-langinfo.sh \
+ $(objpfx)tst-langinfo-newlocale \
+ $(objpfx)sort-test.out \
+ $(addprefix $(objpfx),$(CTYPE_FILES))
+ $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
+ '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
+ $(evaluate-test)
+$(objpfx)tst-langinfo-newlocale-static.out: tst-langinfo.sh \
+ $(objpfx)tst-langinfo-newlocale-static \
+ $(objpfx)sort-test.out \
+ $(addprefix $(objpfx),$(CTYPE_FILES))
+ $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
+ '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
+ $(evaluate-test)
+# Static use of newlocale is known not to work. See Bug 23164.
+test-xfail-tst-langinfo-newlocale-static = yes
+
+$(objpfx)tst-langinfo-setlocale.out: tst-langinfo.sh \
+ $(objpfx)tst-langinfo-setlocale \
+ $(objpfx)sort-test.out \
+ $(addprefix $(objpfx),$(CTYPE_FILES))
+ $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
+ '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
+ $(evaluate-test)
+$(objpfx)tst-langinfo-setlocale-static.out: tst-langinfo.sh \
+ $(objpfx)tst-langinfo-setlocale-static \
+ $(objpfx)sort-test.out \
+ $(addprefix $(objpfx),$(CTYPE_FILES))
+ $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
+ '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
+ $(evaluate-test)
+
+$(objpfx)tst-digits.out: $(objpfx)tst-locale.out
+$(objpfx)tst-mbswcs6.out: $(addprefix $(objpfx),$(CTYPE_FILES))
+endif
+
+include SUPPORTED
+
+INSTALL-SUPPORTED-LOCALE-ARCHIVE=$(addprefix install-archive-, $(SUPPORTED-LOCALES))
+INSTALL-SUPPORTED-LOCALE-FILES=$(addprefix install-files-, $(SUPPORTED-LOCALES))
+
+# Sometimes the whole collection of locale files should be installed.
+LOCALEDEF=I18NPATH=. GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
+$(rtld-prefix) $(common-objpfx)locale/localedef
+install-locales: install-locale-archive
+
+# Create and install the locale-archive file.
+install-locale-archive: $(INSTALL-SUPPORTED-LOCALE-ARCHIVE)
+# Create and install the locales individually (no archive).
+install-locale-files: $(INSTALL-SUPPORTED-LOCALE-FILES)
+
+install-locales-dir:
+ $(..)./scripts/mkinstalldirs $(inst_complocaledir)
+
+# The SHIFT_JIS and SHIFT_JISX0213 character maps are not ASCII compatible,
+# therefore we have to use --no-warnings=ascii to disable the ASCII check.
+# See localedata/gen-locale.sh for the same logic.
+define build-one-locale
+ locale=`echo $@ | sed -e 's/^install-[a-z]*-//'`; \
+ charset=`echo $$locale | sed -e 's,.*/,,'`; \
+ locale=`echo $$locale | sed -e 's,/[^/]*,,'`; \
+ if [ "$$charset" = 'SHIFT_JIS' ] \
+ || [ "$$charset" = 'SHIFT_JISX0213' ]; then \
+ flags="$$flags --no-warnings=ascii"; \
+ fi; \
+ echo -n `echo $$locale | sed 's/\([^.\@]*\).*/\1/'`; \
+ echo -n ".$$charset"; \
+ echo -n `echo $$locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \
+ echo -n '...'; \
+ input=`echo $$locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; \
+ $(LOCALEDEF) $$flags --alias-file=../intl/locale.alias \
+ --no-archive \
+ -i locales/$$input -f charmaps/$$charset \
+ $(addprefix --prefix=,$(install_root)) $$locale \
+ && echo ' done';
+endef
+
+$(INSTALL-SUPPORTED-LOCALE-ARCHIVE): install-locales-dir
+ @flags="-c"; \
+ $(build-one-locale)
+
+$(INSTALL-SUPPORTED-LOCALE-FILES): install-locales-dir
+ @flags="-c --no-archive --no-hard-links"; \
+ $(build-one-locale)
+
+tst-setlocale-ENV = LC_ALL=ja_JP.EUC-JP
+tst-wctype-ENV = LC_ALL=ja_JP.EUC-JP
+
+tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace \
+ LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
+$(objpfx)mtrace-tst-leaks.out: $(objpfx)tst-leaks.out
+ $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@; \
+ $(evaluate-test)
+
+bug-setlocale1-ENV-only = LOCPATH=$(objpfx) LC_CTYPE=de_DE.UTF-8
+bug-setlocale1-static-ENV-only = $(bug-setlocale1-ENV-only)
+
+$(objdir)/iconvdata/gconv-modules:
+ $(MAKE) -C ../iconvdata subdir=iconvdata $@
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-malloc-hooks-patch/create.patch.sh
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-malloc-hooks-patch/create.patch.sh (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-malloc-hooks-patch/create.patch.sh (revision 348)
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+VERSION=2.34
+
+tar --files-from=file.list -xJvf ../glibc-$VERSION.tar.xz
+mv glibc-$VERSION glibc-$VERSION-orig
+
+cp -rf ./glibc-$VERSION-new ./glibc-$VERSION
+
+diff -b --unified -Nr glibc-$VERSION-orig glibc-$VERSION > glibc-$VERSION-malloc-hooks.patch
+
+mv glibc-$VERSION-malloc-hooks.patch ../patches
+
+rm -rf ./glibc-$VERSION
+rm -rf ./glibc-$VERSION-orig
Property changes on: toolchains-1.7.2/sources/GNU/glibc/create-2.34-malloc-hooks-patch/create.patch.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-malloc-hooks-patch/file.list
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-malloc-hooks-patch/file.list (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-malloc-hooks-patch/file.list (revision 348)
@@ -0,0 +1 @@
+glibc-2.34/malloc/malloc-check.c
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-malloc-hooks-patch/glibc-2.34-new/malloc/malloc-check.c
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-malloc-hooks-patch/glibc-2.34-new/malloc/malloc-check.c (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-malloc-hooks-patch/glibc-2.34-new/malloc/malloc-check.c (revision 348)
@@ -0,0 +1,403 @@
+/* glibc.malloc.check implementation.
+ Copyright (C) 2001-2021 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Wolfram Gloger <wg@malloc.de>, 2001.
+
+ 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; see the file COPYING.LIB. If
+ not, see <https://www.gnu.org/licenses/>. */
+
+#define __mremap mremap
+#include "malloc.c"
+
+/* When memory is tagged, the checking data is stored in the user part
+ of the chunk. We can't rely on the user not having modified the
+ tags, so fetch the tag at each location before dereferencing
+ it. */
+#define SAFE_CHAR_OFFSET(p,offset) \
+ ((unsigned char *) tag_at (((unsigned char *) p) + offset))
+
+/* A simple, standard set of debugging hooks. Overhead is `only' one
+ byte per chunk; still this will catch most cases of double frees or
+ overruns. The goal here is to avoid obscure crashes due to invalid
+ usage, unlike in the MALLOC_DEBUG code. */
+
+static unsigned char
+magicbyte (const void *p)
+{
+ unsigned char magic;
+
+ magic = (((uintptr_t) p >> 3) ^ ((uintptr_t) p >> 11)) & 0xFF;
+ /* Do not return 1. See the comment in mem2mem_check(). */
+ if (magic == 1)
+ ++magic;
+ return magic;
+}
+
+/* Visualize the chunk as being partitioned into blocks of 255 bytes from the
+ highest address of the chunk, downwards. The end of each block tells
+ us the size of that block, up to the actual size of the requested
+ memory. Our magic byte is right at the end of the requested size, so we
+ must reach it with this iteration, otherwise we have witnessed a memory
+ corruption. */
+static size_t
+malloc_check_get_size (void *mem)
+{
+ size_t size;
+ unsigned char c;
+ mchunkptr p = mem2chunk (mem);
+ unsigned char magic = magicbyte (p);
+
+ for (size = CHUNK_HDR_SZ + memsize (p) - 1;
+ (c = *SAFE_CHAR_OFFSET (p, size)) != magic;
+ size -= c)
+ {
+ if (c <= 0 || size < (c + CHUNK_HDR_SZ))
+ malloc_printerr ("malloc_check_get_size: memory corruption");
+ }
+
+ /* chunk2mem size. */
+ return size - CHUNK_HDR_SZ;
+}
+
+/* Instrument a chunk with overrun detector byte(s) and convert it
+ into a user pointer with requested size req_sz. */
+
+static void *
+mem2mem_check (void *ptr, size_t req_sz)
+{
+ mchunkptr p;
+ unsigned char *m_ptr = ptr;
+ size_t max_sz, block_sz, i;
+ unsigned char magic;
+
+ if (!ptr)
+ return ptr;
+
+ p = mem2chunk (ptr);
+ magic = magicbyte (p);
+ max_sz = memsize (p);
+
+ for (i = max_sz - 1; i > req_sz; i -= block_sz)
+ {
+ block_sz = MIN (i - req_sz, 0xff);
+ /* Don't allow the magic byte to appear in the chain of length bytes.
+ For the following to work, magicbyte cannot return 0x01. */
+ if (block_sz == magic)
+ --block_sz;
+
+ *SAFE_CHAR_OFFSET (m_ptr, i) = block_sz;
+ }
+ *SAFE_CHAR_OFFSET (m_ptr, req_sz) = magic;
+ return (void *) m_ptr;
+}
+
+/* Convert a pointer to be free()d or realloc()ed to a valid chunk
+ pointer. If the provided pointer is not valid, return NULL. */
+
+static mchunkptr
+mem2chunk_check (void *mem, unsigned char **magic_p)
+{
+ mchunkptr p;
+ INTERNAL_SIZE_T sz, c;
+ unsigned char magic;
+
+ if (!aligned_OK (mem))
+ return NULL;
+
+ p = mem2chunk (mem);
+ sz = chunksize (p);
+ magic = magicbyte (p);
+ if (!chunk_is_mmapped (p))
+ {
+ /* Must be a chunk in conventional heap memory. */
+ int contig = contiguous (&main_arena);
+ if ((contig &&
+ ((char *) p < mp_.sbrk_base ||
+ ((char *) p + sz) >= (mp_.sbrk_base + main_arena.system_mem))) ||
+ sz < MINSIZE || sz & MALLOC_ALIGN_MASK || !inuse (p) ||
+ (!prev_inuse (p) && ((prev_size (p) & MALLOC_ALIGN_MASK) != 0 ||
+ (contig && (char *) prev_chunk (p) < mp_.sbrk_base) ||
+ next_chunk (prev_chunk (p)) != p)))
+ return NULL;
+
+ for (sz = CHUNK_HDR_SZ + memsize (p) - 1;
+ (c = *SAFE_CHAR_OFFSET (p, sz)) != magic;
+ sz -= c)
+ {
+ if (c == 0 || sz < (c + CHUNK_HDR_SZ))
+ return NULL;
+ }
+ }
+ else
+ {
+ unsigned long offset, page_mask = GLRO (dl_pagesize) - 1;
+
+ /* mmap()ed chunks have MALLOC_ALIGNMENT or higher power-of-two
+ alignment relative to the beginning of a page. Check this
+ first. */
+ offset = (unsigned long) mem & page_mask;
+ if ((offset != MALLOC_ALIGNMENT && offset != 0 && offset != 0x10 &&
+ offset != 0x20 && offset != 0x40 && offset != 0x80 && offset != 0x100 &&
+ offset != 0x200 && offset != 0x400 && offset != 0x800 && offset != 0x1000 &&
+ offset < 0x2000) ||
+ !chunk_is_mmapped (p) || prev_inuse (p) ||
+ ((((unsigned long) p - prev_size (p)) & page_mask) != 0) ||
+ ((prev_size (p) + sz) & page_mask) != 0)
+ return NULL;
+
+ for (sz = CHUNK_HDR_SZ + memsize (p) - 1;
+ (c = *SAFE_CHAR_OFFSET (p, sz)) != magic;
+ sz -= c)
+ {
+ if (c == 0 || sz < (c + CHUNK_HDR_SZ))
+ return NULL;
+ }
+ }
+
+ unsigned char* safe_p = SAFE_CHAR_OFFSET (p, sz);
+ *safe_p ^= 0xFF;
+ if (magic_p)
+ *magic_p = safe_p;
+ return p;
+}
+
+/* Check for corruption of the top chunk. */
+static void
+top_check (void)
+{
+ mchunkptr t = top (&main_arena);
+
+ if (t == initial_top (&main_arena) ||
+ (!chunk_is_mmapped (t) &&
+ chunksize (t) >= MINSIZE &&
+ prev_inuse (t) &&
+ (!contiguous (&main_arena) ||
+ (char *) t + chunksize (t) == mp_.sbrk_base + main_arena.system_mem)))
+ return;
+
+ malloc_printerr ("malloc: top chunk is corrupt");
+}
+
+static void *
+malloc_check (size_t sz)
+{
+ void *victim;
+ size_t nb;
+
+ if (__builtin_add_overflow (sz, 1, &nb))
+ {
+ __set_errno (ENOMEM);
+ return NULL;
+ }
+
+ __libc_lock_lock (main_arena.mutex);
+ top_check ();
+ victim = _int_malloc (&main_arena, nb);
+ __libc_lock_unlock (main_arena.mutex);
+ return mem2mem_check (tag_new_usable (victim), sz);
+}
+
+static void
+free_check (void *mem)
+{
+ mchunkptr p;
+
+ if (!mem)
+ return;
+
+ int err = errno;
+
+ /* Quickly check that the freed pointer matches the tag for the memory.
+ This gives a useful double-free detection. */
+ if (__glibc_unlikely (mtag_enabled))
+ *(volatile char *)mem;
+
+ __libc_lock_lock (main_arena.mutex);
+ p = mem2chunk_check (mem, NULL);
+ if (!p)
+ malloc_printerr ("free(): invalid pointer");
+ if (chunk_is_mmapped (p))
+ {
+ __libc_lock_unlock (main_arena.mutex);
+ munmap_chunk (p);
+ }
+ else
+ {
+ /* Mark the chunk as belonging to the library again. */
+ (void)tag_region (chunk2mem (p), memsize (p));
+ _int_free (&main_arena, p, 1);
+ __libc_lock_unlock (main_arena.mutex);
+ }
+ __set_errno (err);
+}
+
+static void *
+realloc_check (void *oldmem, size_t bytes)
+{
+ INTERNAL_SIZE_T chnb;
+ void *newmem = 0;
+ unsigned char *magic_p = NULL;
+ size_t rb;
+
+ if (__builtin_add_overflow (bytes, 1, &rb))
+ {
+ __set_errno (ENOMEM);
+ return NULL;
+ }
+ if (oldmem == 0)
+ return malloc_check (bytes);
+
+ if (bytes == 0)
+ {
+ free_check (oldmem);
+ return NULL;
+ }
+
+ /* Quickly check that the freed pointer matches the tag for the memory.
+ This gives a useful double-free detection. */
+ if (__glibc_unlikely (mtag_enabled))
+ *(volatile char *)oldmem;
+
+ __libc_lock_lock (main_arena.mutex);
+ const mchunkptr oldp = mem2chunk_check (oldmem, &magic_p);
+ __libc_lock_unlock (main_arena.mutex);
+ if (!oldp)
+ malloc_printerr ("realloc(): invalid pointer");
+ const INTERNAL_SIZE_T oldsize = chunksize (oldp);
+
+ if (!checked_request2size (rb, &chnb))
+ {
+ __set_errno (ENOMEM);
+ goto invert;
+ }
+
+ __libc_lock_lock (main_arena.mutex);
+
+ if (chunk_is_mmapped (oldp))
+ {
+#if HAVE_MREMAP
+ mchunkptr newp = mremap_chunk (oldp, chnb);
+ if (newp)
+ newmem = chunk2mem_tag (newp);
+ else
+#endif
+ {
+ /* Note the extra SIZE_SZ overhead. */
+ if (oldsize - SIZE_SZ >= chnb)
+ newmem = oldmem; /* do nothing */
+ else
+ {
+ /* Must alloc, copy, free. */
+ top_check ();
+ newmem = _int_malloc (&main_arena, rb);
+ if (newmem)
+ {
+ memcpy (newmem, oldmem, oldsize - CHUNK_HDR_SZ);
+ munmap_chunk (oldp);
+ }
+ }
+ }
+ }
+ else
+ {
+ top_check ();
+ newmem = _int_realloc (&main_arena, oldp, oldsize, chnb);
+ }
+
+ DIAG_PUSH_NEEDS_COMMENT;
+#if __GNUC_PREREQ (7, 0)
+ /* GCC 7 warns about magic_p may be used uninitialized. But we never
+ reach here if magic_p is uninitialized. */
+ DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+#endif
+ /* mem2chunk_check changed the magic byte in the old chunk.
+ If newmem is NULL, then the old chunk will still be used though,
+ so we need to invert that change here. */
+invert:
+ if (newmem == NULL)
+ *magic_p ^= 0xFF;
+ DIAG_POP_NEEDS_COMMENT;
+
+ __libc_lock_unlock (main_arena.mutex);
+
+ return mem2mem_check (tag_new_usable (newmem), bytes);
+}
+
+static void *
+memalign_check (size_t alignment, size_t bytes)
+{
+ void *mem;
+
+ if (alignment <= MALLOC_ALIGNMENT)
+ return malloc_check (bytes);
+
+ if (alignment < MINSIZE)
+ alignment = MINSIZE;
+
+ /* If the alignment is greater than SIZE_MAX / 2 + 1 it cannot be a
+ power of 2 and will cause overflow in the check below. */
+ if (alignment > SIZE_MAX / 2 + 1)
+ {
+ __set_errno (EINVAL);
+ return NULL;
+ }
+
+ /* Check for overflow. */
+ if (bytes > SIZE_MAX - alignment - MINSIZE)
+ {
+ __set_errno (ENOMEM);
+ return NULL;
+ }
+
+ /* Make sure alignment is power of 2. */
+ if (!powerof2 (alignment))
+ {
+ size_t a = MALLOC_ALIGNMENT * 2;
+ while (a < alignment)
+ a <<= 1;
+ alignment = a;
+ }
+
+ __libc_lock_lock (main_arena.mutex);
+ top_check ();
+ mem = _int_memalign (&main_arena, alignment, bytes + 1);
+ __libc_lock_unlock (main_arena.mutex);
+ return mem2mem_check (tag_new_usable (mem), bytes);
+}
+
+#if HAVE_TUNABLES
+static void
+TUNABLE_CALLBACK (set_mallopt_check) (tunable_val_t *valp)
+{
+ int32_t value = (int32_t) valp->numval;
+ if (value != 0)
+ __malloc_debug_enable (MALLOC_CHECK_HOOK);
+}
+#endif
+
+static bool
+initialize_malloc_check (void)
+{
+ /* This is the copy of the malloc initializer that we pulled in along with
+ malloc-check. This does not affect any of the libc malloc structures. */
+ ptmalloc_init ();
+#if HAVE_TUNABLES
+ TUNABLE_GET (check, int32_t, TUNABLE_CALLBACK (set_mallopt_check));
+#else
+ const char *s = secure_getenv ("MALLOC_CHECK_");
+ if (s && s[0] != '\0' && s[0] != '0')
+ __malloc_debug_enable (MALLOC_CHECK_HOOK);
+#endif
+ return __is_malloc_debug_enabled (MALLOC_CHECK_HOOK);
+}
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-ppc64-interpreter-patch/create.patch.sh
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-ppc64-interpreter-patch/create.patch.sh (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-ppc64-interpreter-patch/create.patch.sh (revision 348)
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+VERSION=2.34
+
+tar --files-from=file.list -xJvf ../glibc-$VERSION.tar.xz
+mv glibc-$VERSION glibc-$VERSION-orig
+
+cp -rf ./glibc-$VERSION-new ./glibc-$VERSION
+
+diff -b --unified -Nr glibc-$VERSION-orig glibc-$VERSION > glibc-$VERSION-ppc64-interpreter.patch
+
+mv glibc-$VERSION-ppc64-interpreter.patch ../patches
+
+rm -rf ./glibc-$VERSION
+rm -rf ./glibc-$VERSION-orig
Property changes on: toolchains-1.7.2/sources/GNU/glibc/create-2.34-ppc64-interpreter-patch/create.patch.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-ppc64-interpreter-patch/file.list
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-ppc64-interpreter-patch/file.list (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-ppc64-interpreter-patch/file.list (revision 348)
@@ -0,0 +1,2 @@
+glibc-2.34/sysdeps/unix/sysv/linux/powerpc/ldconfig.h
+glibc-2.34/sysdeps/unix/sysv/linux/powerpc/ldd-rewrite.sed
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-ppc64-interpreter-patch/glibc-2.34-new/sysdeps/unix/sysv/linux/powerpc/ldconfig.h
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-ppc64-interpreter-patch/glibc-2.34-new/sysdeps/unix/sysv/linux/powerpc/ldconfig.h (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-ppc64-interpreter-patch/glibc-2.34-new/sysdeps/unix/sysv/linux/powerpc/ldconfig.h (revision 348)
@@ -0,0 +1,27 @@
+/* ldconfig default paths and libraries. Linux/PowerPC version.
+ Copyright (C) 2002-2021 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
+ <https://www.gnu.org/licenses/>. */
+
+#include <sysdeps/generic/ldconfig.h>
+
+#define SYSDEP_KNOWN_INTERPRETER_NAMES \
+ { "/lib/ld64.so.1", FLAG_ELF_LIBC6 }, \
+ { "/lib/ld64.so.2", FLAG_ELF_LIBC6 }, \
+ { "/lib32/ld.so.1", FLAG_ELF_LIBC6 },
+#define SYSDEP_KNOWN_LIBRARY_NAMES \
+ { "libc.so.6", FLAG_ELF_LIBC6 }, \
+ { "libm.so.6", FLAG_ELF_LIBC6 },
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-ppc64-interpreter-patch/glibc-2.34-new/sysdeps/unix/sysv/linux/powerpc/ldd-rewrite.sed
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-ppc64-interpreter-patch/glibc-2.34-new/sysdeps/unix/sysv/linux/powerpc/ldd-rewrite.sed (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-ppc64-interpreter-patch/glibc-2.34-new/sysdeps/unix/sysv/linux/powerpc/ldd-rewrite.sed (revision 348)
@@ -0,0 +1,15 @@
+/LD_TRACE_LOADED_OBJECTS=1/a\
+add_env="$add_env LD_LIBRARY_VERSION=\\$verify_out"
+
+# ldd is generated from elf/ldd.bash.in with the name
+# of ld.so as generated in Makeconfig
+
+# that name is replaced by a pair referring to both
+# the 32bit and 64bit dynamic linker.
+
+# /lib(64|)/*(64|).so.(1|2) is replaced with /lib64/*64.so.(1|2) and /lib/*.so.1
+# this works for /lib/ld64.so.x and /lib32/ld.so.x as input
+s_lib64_lib_
+s_64\.so_\.so_
+s_^RTLDLIST=\(.*lib\)\(\|64\|32\)\(/[^/]*\)\(\.so\.[0-9.]*\)[[:blank:]]*$_RTLDLIST="\1\364\4 \132\3\.so\.1"_
+
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-x86_64-interpreter-patch/create.patch.sh
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-x86_64-interpreter-patch/create.patch.sh (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-x86_64-interpreter-patch/create.patch.sh (revision 348)
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+VERSION=2.34
+
+tar --files-from=file.list -xJvf ../glibc-$VERSION.tar.xz
+mv glibc-$VERSION glibc-$VERSION-orig
+
+cp -rf ./glibc-$VERSION-new ./glibc-$VERSION
+
+diff -b --unified -Nr glibc-$VERSION-orig glibc-$VERSION > glibc-$VERSION-x86_64-interpreter.patch
+
+mv glibc-$VERSION-x86_64-interpreter.patch ../patches
+
+rm -rf ./glibc-$VERSION
+rm -rf ./glibc-$VERSION-orig
Property changes on: toolchains-1.7.2/sources/GNU/glibc/create-2.34-x86_64-interpreter-patch/create.patch.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-x86_64-interpreter-patch/file.list
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-x86_64-interpreter-patch/file.list (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-x86_64-interpreter-patch/file.list (revision 348)
@@ -0,0 +1,2 @@
+glibc-2.34/sysdeps/unix/sysv/linux/x86_64/ldconfig.h
+glibc-2.34/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-x86_64-interpreter-patch/glibc-2.34-new/sysdeps/unix/sysv/linux/x86_64/ldconfig.h
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-x86_64-interpreter-patch/glibc-2.34-new/sysdeps/unix/sysv/linux/x86_64/ldconfig.h (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-x86_64-interpreter-patch/glibc-2.34-new/sysdeps/unix/sysv/linux/x86_64/ldconfig.h (revision 348)
@@ -0,0 +1,26 @@
+/* Copyright (C) 2001-2021 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
+ <https://www.gnu.org/licenses/>. */
+
+#include <sysdeps/generic/ldconfig.h>
+
+#define SYSDEP_KNOWN_INTERPRETER_NAMES \
+ { "/lib/ld-linux-x86-64.so.2", FLAG_ELF_LIBC6 }, \
+ { "/lib32/ld-linux.so.2", FLAG_ELF_LIBC6 }, \
+ { "/libx32/ld-linux-x32.so.2", FLAG_ELF_LIBC6 },
+#define SYSDEP_KNOWN_LIBRARY_NAMES \
+ { "libc.so.6", FLAG_ELF_LIBC6 }, \
+ { "libm.so.6", FLAG_ELF_LIBC6 },
Index: toolchains-1.7.2/sources/GNU/glibc/create-2.34-x86_64-interpreter-patch/glibc-2.34-new/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc/create-2.34-x86_64-interpreter-patch/glibc-2.34-new/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc/create-2.34-x86_64-interpreter-patch/glibc-2.34-new/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed (revision 348)
@@ -0,0 +1,3 @@
+/LD_TRACE_LOADED_OBJECTS=1/a\
+add_env="$add_env LD_LIBRARY_VERSION=\\$verify_out"
+s_^\(RTLDLIST=\)\(.*lib\)\(\|64\|32\|x32\)\(/ld-linux\)\(\|-x86-64\|-x32\)\(\.so\.[0-9.]*\)[ ]*$_\1"\2\4-x86-64\6 \232\4\6 \2x32\4-x32\6"_
Index: toolchains-1.7.2/sources/GNU/glibc
===================================================================
--- toolchains-1.7.2/sources/GNU/glibc (nonexistent)
+++ toolchains-1.7.2/sources/GNU/glibc (revision 348)
Property changes on: toolchains-1.7.2/sources/GNU/glibc
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,77 ##
+
+# Target build dirs
+.noarch
+.host
+
+.arm32-newlib
+.a33xx-newlib
+.a9xx-newlib
+.h5-newlib
+.s9xx-newlib
+.rk33xx-newlib
+.m1000-newlib
+.riscv64-newlib
+.at91sam7s-newlib
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.imx6-glibc
+.jz47xx-glibc
+.p5600-glibc
+.m1000-glibc
+.omap543x-glibc
+.am335x-glibc
+.rk328x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.a9xx-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.a33xx-glibc
+.power8-glibc
+.power9-glibc
+.power8le-glibc
+.power9le-glibc
+.riscv64-glibc
+.i686-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.src_requires
+.src_requires_depend
+.dist
+
+# Destinations
+dist
+
+
+# Tarballs
+*.gz
+*.bz2
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Text files
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# Object Files
+*.[ao]
+
+# backup copies
+*~
Index: toolchains-1.7.2/sources/GNU/binutils/Makefile
===================================================================
--- toolchains-1.7.2/sources/GNU/binutils/Makefile (nonexistent)
+++ toolchains-1.7.2/sources/GNU/binutils/Makefile (revision 348)
@@ -0,0 +1,106 @@
+#
+# Download: http://www.gnu.org/prep/ftp.html
+#
+# You can use the generic url http://ftpmirror.gnu.org
+# to automatically choose a nearby and up-to-date mirror.
+#
+# original url: http://ftp.gnu.org/gnu/binutils
+#
+
+COMPONENT_TARGETS = $(TOOLCHAIN_NOARCH)
+
+
+include ../../../build-system/config.mk
+
+
+url = $(DOWNLOAD_SERVER)/sources/GNU/binutils
+
+versions = 2.37
+
+tarballs = $(addsuffix .tar.xz, $(addprefix binutils-, $(versions)))
+sha1s = $(addsuffix .sha1sum, $(tarballs))
+
+patches = $(CURDIR)/patches/binutils-2.37-CVE-2019-1010204.patch
+patches += $(CURDIR)/patches/binutils-2.37-aarch64-ifunc.patch
+patches += $(CURDIR)/patches/binutils-2.37-bfd-close-fds.patch
+patches += $(CURDIR)/patches/binutils-2.37-not-link-static-libstdc++.patch
+patches += $(CURDIR)/patches/binutils-2.37-dwarf-5-dir0.patch
+patches += $(CURDIR)/patches/binutils-2.37-fname-in-error-messages.patch
+patches += $(CURDIR)/patches/binutils-2.37-gold-i386-gnu-property-notes.patch
+patches += $(CURDIR)/patches/binutils-2.37-gold-mismatched-section-flags.patch
+patches += $(CURDIR)/patches/binutils-2.37-gold-warn-unsupported.patch
+patches += $(CURDIR)/patches/binutils-2.37-missing-man-pages.patch
+patches += $(CURDIR)/patches/binutils-2.37-readelf-other-sym-info.patch
+patches += $(CURDIR)/patches/binutils-2.37-revert-PLT-elision.patch
+patches += $(CURDIR)/patches/binutils-2.37-special-sections-in-groups.patch
+patches += $(CURDIR)/patches/binutils-2.37-testsuite-fixes.patch
+
+patches += $(CURDIR)/patches/binutils-2.37-cleansweep.patch
+patches += $(CURDIR)/patches/binutils-2.37-copy-osabi.patch
+patches += $(CURDIR)/patches/binutils-2.37-export-demangle.patch
+patches += $(CURDIR)/patches/binutils-2.37-ldforcele.patch
+patches += $(CURDIR)/patches/binutils-2.37-libtool-lib64.patch
+patches += $(CURDIR)/patches/binutils-2.37-no-config-check.patch
+patches += $(CURDIR)/patches/binutils-2.37-sec-merge-omit.patch
+patches += $(CURDIR)/patches/binutils-2.37-set-long-long.patch
+
+
+.NOTPARALLEL: $(patches)
+
+
+BUILD_TARGETS = $(tarballs) $(sha1s) $(patches)
+
+
+include ../../../build-system/core.mk
+
+
+.PHONY: download_clean
+
+
+$(tarballs):
+ @echo -e "\n======= Downloading source tarballs =======" ; \
+ for tarball in $(tarballs) ; do \
+ echo "$(url)/$$tarball" | xargs -n 1 -P 100 wget $(WGET_OPTIONS) - & \
+ done ; wait
+
+$(sha1s): $(tarballs)
+ @for sha in $@ ; do \
+ echo -e "\n======= Downloading '$$sha' signature =======\n" ; \
+ echo "$(url)/$$sha" | xargs -n 1 -P 100 wget $(WGET_OPTIONS) - & wait %1 ; \
+ touch $$sha ; \
+ echo -e "\n======= Check the '$$sha' sha1sum =======\n" ; \
+ sha1sum --check $$sha ; ret="$$?" ; \
+ if [ "$$ret" == "1" ]; then \
+ echo -e "\n======= ERROR: Bad '$$sha' sha1sum =======\n" ; \
+ exit 1 ; \
+ fi ; \
+ done
+
+$(patches): $(sha1s)
+ @echo -e "\n======= Create Patches =======\n" ; \
+ ( cd create-2.37-CVE-2019-1010204-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.37-aarch64-ifunc-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.37-bfd-close-fds-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.37-not-link-static-libstdc++-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.37-dwarf-5-dir0-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.37-fname-in-error-messages-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.37-gold-i386-gnu-property-notes-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.37-gold-mismatched-section-flags-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.37-gold-warn-unsupported-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.37-missing-man-pages-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.37-readelf-other-sym-info-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.37-revert-PLT-elision-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.37-special-sections-in-groups-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.37-testsuite-fixes-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.37-cleansweep-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.37-copy-osabi-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.37-export-demangle-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.37-ldforcele-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.37-libtool-lib64-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.37-no-config-check-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.37-sec-merge-emit-patch ; ./create.patch.sh ) ; \
+ ( cd create-2.37-set-long-long-patch ; ./create.patch.sh ) ; \
+ echo -e "\n"
+
+download_clean:
+ @rm -f $(tarballs) $(sha1s) $(patches)
Index: toolchains-1.7.2/sources/GNU/binutils/patches/README
===================================================================
--- toolchains-1.7.2/sources/GNU/binutils/patches/README (nonexistent)
+++ toolchains-1.7.2/sources/GNU/binutils/patches/README (revision 348)
@@ -0,0 +1,47 @@
+
+/* begin *
+
+ Various upstream patches:
+
+ binutils-2.37-cleansweep.patch
+ binutils-2.37-copy-osabi.patch
+ binutils-2.37-ldforcele.patch
+ binutils-2.37-set-long-long.patch
+ binutils-2.37-sec-merge-omit.patch
+
+ Various regression fixes:
+
+ binutils-2.37-CVE-2019-1010204.patch
+ binutils-2.37-aarch64-ifunc.patch
+ binutils-2.37-bfd-close-fds.patch - strongly after binutils-2.37-cleansweep.patch
+ binutils-2.37-not-link-static-libstdc++.patch
+ binutils-2.37-dwarf-5-dir0.patch
+ binutils-2.37-fname-in-error-messages.patch - strongly after binutils-2.37-readelf-other-sym-info.patch
+ binutils-2.37-gold-i386-gnu-property-notes.patch
+ binutils-2.37-gold-mismatched-section-flags.patch
+ binutils-2.37-gold-warn-unsupported.patch
+ binutils-2.37-missing-man-pages.patch
+ binutils-2.37-readelf-other-sym-info.patch
+ binutils-2.37-special-sections-in-groups.patch - strongly after binutils-2.37-copy-osabi.patch
+ binutils-2.37-testsuite-fixes.patch
+
+
+ binutils-2.37-export-demangle.patch - Export the demangle.h header file;
+ binutils-2.37-no-config-check.patch - Don't check to see if 'config.h' was included in the installed headers;
+ binutils-2.37-ldforcele.patch - use LD_FORCE_LE environment variable;
+ binutils-2.37-libtool-lib64.patch - Work around a bug caused by binutils using an ancient libtool;
+
+ README.TXT - this file.
+
+
+ NOTE:
+ ====
+ On ppc64 and aarch64, we might use 64KiB pages. Following command can be used
+ to set common page size to 64KiB:
+
+ sed -i -e '/#define.*ELF_COMMONPAGESIZE/s/0x1000$/0x10000/' bfd/elf*ppc.c
+ sed -i -e '/#define.*ELF_COMMONPAGESIZE/s/0x1000$/0x10000/' bfd/elf*aarch64.c
+ sed -i -e '/common_pagesize/s/4 /64 /' gold/powerpc.cc
+ sed -i -e '/pagesize/s/0x1000,/0x10000,/' gold/aarch64.cc
+
+ * end */
Index: toolchains-1.7.2/sources/GNU/binutils/patches
===================================================================
--- toolchains-1.7.2/sources/GNU/binutils/patches (nonexistent)
+++ toolchains-1.7.2/sources/GNU/binutils/patches (revision 348)
Property changes on: toolchains-1.7.2/sources/GNU/binutils/patches
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,77 ##
+
+# Target build dirs
+.noarch
+.host
+
+.arm32-newlib
+.a33xx-newlib
+.a9xx-newlib
+.h5-newlib
+.s9xx-newlib
+.rk33xx-newlib
+.m1000-newlib
+.riscv64-newlib
+.at91sam7s-newlib
+
+.a1x-glibc
+.a2x-glibc
+.h3-glibc
+.h5-glibc
+.imx6-glibc
+.jz47xx-glibc
+.p5600-glibc
+.m1000-glibc
+.omap543x-glibc
+.am335x-glibc
+.rk328x-glibc
+.s8xx-glibc
+.s9xx-glibc
+.a9xx-glibc
+.rk33xx-glibc
+.rk339x-glibc
+.a33xx-glibc
+.power8-glibc
+.power9-glibc
+.power8le-glibc
+.power9le-glibc
+.riscv64-glibc
+.i686-glibc
+.x86_64-glibc
+
+# Hidden files (each file)
+.makefile
+.src_requires
+.src_requires_depend
+.dist
+
+# Destinations
+dist
+
+
+# Tarballs
+*.gz
+*.bz2
+*.xz
+*.tgz
+*.txz
+
+# Signatures
+*.asc
+*.sig
+*.sign
+*.sha1sum
+
+# Patches
+*.patch
+
+# Text files
+*.txt
+
+# Default linux config files
+*.defconfig
+
+# Object Files
+*.[ao]
+
+# backup copies
+*~
Index: toolchains-1.7.2/sources/GNU/binutils/create-2.37-CVE-2019-1010204-patch/binutils-2.37-new/gold/fileread.cc
===================================================================
--- toolchains-1.7.2/sources/GNU/binutils/create-2.37-CVE-2019-1010204-patch/binutils-2.37-new/gold/fileread.cc (nonexistent)
+++ toolchains-1.7.2/sources/GNU/binutils/create-2.37-CVE-2019-1010204-patch/binutils-2.37-new/gold/fileread.cc (revision 348)
@@ -0,0 +1,1178 @@
+// fileread.cc -- read files for gold
+
+// Copyright (C) 2006-2021 Free Software Foundation, Inc.
+// Written by Ian Lance Taylor <iant@google.com>.
+
+// This file is part of gold.
+
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+// MA 02110-1301, USA.
+
+#include "gold.h"
+
+#include <cstring>
+#include <cerrno>
+#include <climits>
+#include <fcntl.h>
+#include <unistd.h>
+
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+
+#ifdef HAVE_READV
+#include <sys/uio.h>
+#endif
+
+#include <sys/stat.h>
+#include "filenames.h"
+
+#include "debug.h"
+#include "parameters.h"
+#include "options.h"
+#include "dirsearch.h"
+#include "target.h"
+#include "binary.h"
+#include "descriptors.h"
+#include "gold-threads.h"
+#include "fileread.h"
+
+// For systems without mmap support.
+#ifndef HAVE_MMAP
+# define mmap gold_mmap
+# define munmap gold_munmap
+# ifndef MAP_FAILED
+# define MAP_FAILED (reinterpret_cast<void*>(-1))
+# endif
+# ifndef PROT_READ
+# define PROT_READ 0
+# endif
+# ifndef MAP_PRIVATE
+# define MAP_PRIVATE 0
+# endif
+
+# ifndef ENOSYS
+# define ENOSYS EINVAL
+# endif
+
+static void *
+gold_mmap(void *, size_t, int, int, int, off_t)
+{
+ errno = ENOSYS;
+ return MAP_FAILED;
+}
+
+static int
+gold_munmap(void *, size_t)
+{
+ errno = ENOSYS;
+ return -1;
+}
+
+#endif
+
+#ifndef HAVE_READV
+struct iovec { void* iov_base; size_t iov_len; };
+ssize_t
+readv(int, const iovec*, int)
+{
+ gold_unreachable();
+}
+#endif
+
+namespace gold
+{
+
+// Get the last modified time of an unopened file.
+
+bool
+get_mtime(const char* filename, Timespec* mtime)
+{
+ struct stat file_stat;
+
+ if (stat(filename, &file_stat) < 0)
+ return false;
+#ifdef HAVE_STAT_ST_MTIM
+ mtime->seconds = file_stat.st_mtim.tv_sec;
+ mtime->nanoseconds = file_stat.st_mtim.tv_nsec;
+#else
+ mtime->seconds = file_stat.st_mtime;
+ mtime->nanoseconds = 0;
+#endif
+ return true;
+}
+
+// Class File_read.
+
+// A lock for the File_read static variables.
+static Lock* file_counts_lock = NULL;
+static Initialize_lock file_counts_initialize_lock(&file_counts_lock);
+
+// The File_read static variables.
+unsigned long long File_read::total_mapped_bytes;
+unsigned long long File_read::current_mapped_bytes;
+unsigned long long File_read::maximum_mapped_bytes;
+std::vector<std::string> File_read::files_read;
+
+// Class File_read::View.
+
+File_read::View::~View()
+{
+ gold_assert(!this->is_locked());
+ switch (this->data_ownership_)
+ {
+ case DATA_ALLOCATED_ARRAY:
+ free(const_cast<unsigned char*>(this->data_));
+ break;
+ case DATA_MMAPPED:
+ if (::munmap(const_cast<unsigned char*>(this->data_), this->size_) != 0)
+ gold_warning(_("munmap failed: %s"), strerror(errno));
+ if (!parameters->options_valid() || parameters->options().stats())
+ {
+ file_counts_initialize_lock.initialize();
+ Hold_optional_lock hl(file_counts_lock);
+ File_read::current_mapped_bytes -= this->size_;
+ }
+ break;
+ case DATA_NOT_OWNED:
+ break;
+ default:
+ gold_unreachable();
+ }
+}
+
+void
+File_read::View::lock()
+{
+ ++this->lock_count_;
+}
+
+void
+File_read::View::unlock()
+{
+ gold_assert(this->lock_count_ > 0);
+ --this->lock_count_;
+}
+
+bool
+File_read::View::is_locked()
+{
+ return this->lock_count_ > 0;
+}
+
+// Class File_read.
+
+File_read::~File_read()
+{
+ gold_assert(this->token_.is_writable());
+ if (this->is_descriptor_opened_)
+ {
+ release_descriptor(this->descriptor_, true);
+ this->descriptor_ = -1;
+ this->is_descriptor_opened_ = false;
+ }
+ this->name_.clear();
+ this->clear_views(CLEAR_VIEWS_ALL);
+}
+
+// Open the file.
+
+bool
+File_read::open(const Task* task, const std::string& name)
+{
+ gold_assert(this->token_.is_writable()
+ && this->descriptor_ < 0
+ && !this->is_descriptor_opened_
+ && this->name_.empty());
+ this->name_ = name;
+
+ this->descriptor_ = open_descriptor(-1, this->name_.c_str(),
+ O_RDONLY);
+
+ if (this->descriptor_ >= 0)
+ {
+ this->is_descriptor_opened_ = true;
+ struct stat s;
+ if (::fstat(this->descriptor_, &s) < 0)
+ gold_error(_("%s: fstat failed: %s"),
+ this->name_.c_str(), strerror(errno));
+ this->size_ = s.st_size;
+ gold_debug(DEBUG_FILES, "Attempt to open %s succeeded",
+ this->name_.c_str());
+ this->token_.add_writer(task);
+ file_counts_initialize_lock.initialize();
+ Hold_optional_lock hl(file_counts_lock);
+ record_file_read(this->name_);
+ }
+
+ return this->descriptor_ >= 0;
+}
+
+// Open the file with the contents in memory.
+
+bool
+File_read::open(const Task* task, const std::string& name,
+ const unsigned char* contents, off_t size)
+{
+ gold_assert(this->token_.is_writable()
+ && this->descriptor_ < 0
+ && !this->is_descriptor_opened_
+ && this->name_.empty());
+ this->name_ = name;
+ this->whole_file_view_ = new View(0, size, contents, 0, false,
+ View::DATA_NOT_OWNED);
+ this->add_view(this->whole_file_view_);
+ this->size_ = size;
+ this->token_.add_writer(task);
+ return true;
+}
+
+// Reopen a descriptor if necessary.
+
+void
+File_read::reopen_descriptor()
+{
+ if (!this->is_descriptor_opened_)
+ {
+ this->descriptor_ = open_descriptor(this->descriptor_,
+ this->name_.c_str(),
+ O_RDONLY);
+ if (this->descriptor_ < 0)
+ gold_fatal(_("could not reopen file %s"), this->name_.c_str());
+ this->is_descriptor_opened_ = true;
+ }
+}
+
+// Release the file. This is called when we are done with the file in
+// a Task.
+
+void
+File_read::release()
+{
+ gold_assert(this->is_locked());
+
+ if (!parameters->options_valid() || parameters->options().stats())
+ {
+ file_counts_initialize_lock.initialize();
+ Hold_optional_lock hl(file_counts_lock);
+ File_read::total_mapped_bytes += this->mapped_bytes_;
+ File_read::current_mapped_bytes += this->mapped_bytes_;
+ if (File_read::current_mapped_bytes > File_read::maximum_mapped_bytes)
+ File_read::maximum_mapped_bytes = File_read::current_mapped_bytes;
+ }
+
+ this->mapped_bytes_ = 0;
+
+ // Only clear views if there is only one attached object. Otherwise
+ // we waste time trying to clear cached archive views. Similarly
+ // for releasing the descriptor.
+ if (this->object_count_ <= 1)
+ {
+ this->clear_views(CLEAR_VIEWS_NORMAL);
+ if (this->is_descriptor_opened_)
+ {
+ release_descriptor(this->descriptor_, false);
+ this->is_descriptor_opened_ = false;
+ }
+ }
+
+ this->released_ = true;
+}
+
+// Lock the file.
+
+void
+File_read::lock(const Task* task)
+{
+ gold_assert(this->released_);
+ gold_debug(DEBUG_FILES, "Locking file \"%s\"", this->name_.c_str());
+ this->token_.add_writer(task);
+ this->released_ = false;
+}
+
+// Unlock the file.
+
+void
+File_read::unlock(const Task* task)
+{
+ gold_debug(DEBUG_FILES, "Unlocking file \"%s\"", this->name_.c_str());
+ this->release();
+ this->token_.remove_writer(task);
+}
+
+// Return whether the file is locked.
+
+bool
+File_read::is_locked() const
+{
+ if (!this->token_.is_writable())
+ return true;
+ // The file is not locked, so it should have been released.
+ gold_assert(this->released_);
+ return false;
+}
+
+// See if we have a view which covers the file starting at START for
+// SIZE bytes. Return a pointer to the View if found, NULL if not.
+// If BYTESHIFT is not -1U, the returned View must have the specified
+// byte shift; otherwise, it may have any byte shift. If VSHIFTED is
+// not NULL, this sets *VSHIFTED to a view which would have worked if
+// not for the requested BYTESHIFT.
+
+inline File_read::View*
+File_read::find_view(off_t start, section_size_type size,
+ unsigned int byteshift, File_read::View** vshifted) const
+{
+ gold_assert(start <= this->size_
+ && (static_cast<unsigned long long>(size)
+ <= static_cast<unsigned long long>(this->size_ - start)));
+
+ if (vshifted != NULL)
+ *vshifted = NULL;
+
+ // If we have the whole file mmapped, and the alignment is right,
+ // we can return it.
+ if (this->whole_file_view_)
+ if (byteshift == -1U || byteshift == 0)
+ return this->whole_file_view_;
+
+ off_t page = File_read::page_offset(start);
+
+ unsigned int bszero = 0;
+ Views::const_iterator p = this->views_.upper_bound(std::make_pair(page - 1,
+ bszero));
+
+ while (p != this->views_.end() && p->first.first <= page)
+ {
+ if (p->second->start() <= start
+ && (p->second->start() + static_cast<off_t>(p->second->size())
+ >= start + static_cast<off_t>(size)))
+ {
+ if (byteshift == -1U || byteshift == p->second->byteshift())
+ {
+ p->second->set_accessed();
+ return p->second;
+ }
+
+ if (vshifted != NULL && *vshifted == NULL)
+ *vshifted = p->second;
+ }
+
+ ++p;
+ }
+
+ return NULL;
+}
+
+// Read SIZE bytes from the file starting at offset START. Read into
+// the buffer at P.
+
+void
+File_read::do_read(off_t start, section_size_type size, void* p)
+{
+ ssize_t bytes;
+ if (this->whole_file_view_ != NULL)
+ {
+ // See PR 23765 for an example of a testcase that triggers this error.
+ if (((ssize_t) start) < 0)
+ gold_fatal(_("%s: read failed, starting offset (%#llx) less than zero"),
+ this->filename().c_str(),
+ static_cast<long long>(start));
+
+ bytes = this->size_ - start;
+ if (static_cast<section_size_type>(bytes) >= size)
+ {
+ memcpy(p, this->whole_file_view_->data() + start, size);
+ return;
+ }
+ }
+ else
+ {
+ this->reopen_descriptor();
+
+ char *read_ptr = static_cast<char *>(p);
+ off_t read_pos = start;
+ size_t to_read = size;
+ do
+ {
+ bytes = ::pread(this->descriptor_, read_ptr, to_read, read_pos);
+ if (bytes < 0)
+ gold_fatal(_("%s: pread failed: %s"),
+ this->filename().c_str(), strerror(errno));
+
+ read_pos += bytes;
+ read_ptr += bytes;
+ to_read -= bytes;
+ if (to_read == 0)
+ return;
+ }
+ while (bytes > 0);
+
+ bytes = size - to_read;
+ }
+
+ gold_fatal(_("%s: file too short: read only %lld of %lld bytes at %lld"),
+ this->filename().c_str(),
+ static_cast<long long>(bytes),
+ static_cast<long long>(size),
+ static_cast<long long>(start));
+}
+
+// Read data from the file.
+
+void
+File_read::read(off_t start, section_size_type size, void* p)
+{
+ const File_read::View* pv = this->find_view(start, size, -1U, NULL);
+ if (pv != NULL)
+ {
+ memcpy(p, pv->data() + (start - pv->start() + pv->byteshift()), size);
+ return;
+ }
+
+ this->do_read(start, size, p);
+}
+
+// Add a new view. There may already be an existing view at this
+// offset. If there is, the new view will be larger, and should
+// replace the old view.
+
+void
+File_read::add_view(File_read::View* v)
+{
+ std::pair<Views::iterator, bool> ins =
+ this->views_.insert(std::make_pair(std::make_pair(v->start(),
+ v->byteshift()),
+ v));
+ if (ins.second)
+ return;
+
+ // There was an existing view at this offset. It must not be large
+ // enough. We can't delete it here, since something might be using
+ // it; we put it on a list to be deleted when the file is unlocked.
+ File_read::View* vold = ins.first->second;
+ gold_assert(vold->size() < v->size());
+ if (vold->should_cache())
+ {
+ v->set_cache();
+ vold->clear_cache();
+ }
+ this->saved_views_.push_back(vold);
+
+ ins.first->second = v;
+}
+
+// Make a new view with a specified byteshift, reading the data from
+// the file.
+
+File_read::View*
+File_read::make_view(off_t start, section_size_type size,
+ unsigned int byteshift, bool cache)
+{
+ gold_assert(size > 0);
+ gold_assert(start <= this->size_
+ && (static_cast<unsigned long long>(size)
+ <= static_cast<unsigned long long>(this->size_ - start)));
+
+ off_t poff = File_read::page_offset(start);
+
+ section_size_type psize = File_read::pages(size + (start - poff));
+
+ if (poff + static_cast<off_t>(psize) >= this->size_)
+ {
+ psize = this->size_ - poff;
+ gold_assert(psize >= size);
+ }
+
+ void* p;
+ View::Data_ownership ownership;
+ if (byteshift != 0)
+ {
+ p = malloc(psize + byteshift);
+ if (p == NULL)
+ gold_nomem();
+ memset(p, 0, byteshift);
+ this->do_read(poff, psize, static_cast<unsigned char*>(p) + byteshift);
+ ownership = View::DATA_ALLOCATED_ARRAY;
+ }
+ else
+ {
+ this->reopen_descriptor();
+ p = ::mmap(NULL, psize, PROT_READ, MAP_PRIVATE, this->descriptor_, poff);
+ if (p != MAP_FAILED)
+ {
+ ownership = View::DATA_MMAPPED;
+ this->mapped_bytes_ += psize;
+ }
+ else
+ {
+ p = malloc(psize);
+ if (p == NULL)
+ gold_nomem();
+ this->do_read(poff, psize, p);
+ ownership = View::DATA_ALLOCATED_ARRAY;
+ }
+ }
+
+ const unsigned char* pbytes = static_cast<const unsigned char*>(p);
+ File_read::View* v = new File_read::View(poff, psize, pbytes, byteshift,
+ cache, ownership);
+
+ this->add_view(v);
+
+ return v;
+}
+
+// Find a View or make a new one, shifted as required by the file
+// offset OFFSET and ALIGNED.
+
+File_read::View*
+File_read::find_or_make_view(off_t offset, off_t start,
+ section_size_type size, bool aligned, bool cache)
+{
+ // Check that start and end of the view are within the file.
+ if (start > this->size_
+ || (static_cast<unsigned long long>(size)
+ > static_cast<unsigned long long>(this->size_ - start)))
+ gold_fatal(_("%s: attempt to map %lld bytes at offset %lld exceeds "
+ "size of file; the file may be corrupt"),
+ this->filename().c_str(),
+ static_cast<long long>(size),
+ static_cast<long long>(start));
+
+ unsigned int byteshift;
+ if (offset == 0)
+ byteshift = 0;
+ else
+ {
+ unsigned int target_size = (!parameters->target_valid()
+ ? 64
+ : parameters->target().get_size());
+ byteshift = offset & ((target_size / 8) - 1);
+
+ // Set BYTESHIFT to the number of dummy bytes which must be
+ // inserted before the data in order for this data to be
+ // aligned.
+ if (byteshift != 0)
+ byteshift = (target_size / 8) - byteshift;
+ }
+
+ // If --map-whole-files is set, make sure we have a
+ // whole file view. Options may not yet be ready, e.g.,
+ // when reading a version script. We then default to
+ // --no-map-whole-files.
+ if (this->whole_file_view_ == NULL
+ && parameters->options_valid()
+ && parameters->options().map_whole_files())
+ this->whole_file_view_ = this->make_view(0, this->size_, 0, cache);
+
+ // Try to find a View with the required BYTESHIFT.
+ File_read::View* vshifted;
+ File_read::View* v = this->find_view(offset + start, size,
+ aligned ? byteshift : -1U,
+ &vshifted);
+ if (v != NULL)
+ {
+ if (cache)
+ v->set_cache();
+ return v;
+ }
+
+ // If VSHIFTED is not NULL, then it has the data we need, but with
+ // the wrong byteshift.
+ v = vshifted;
+ if (v != NULL)
+ {
+ gold_assert(aligned);
+
+ unsigned char* pbytes;
+ pbytes = static_cast<unsigned char*>(malloc(v->size() + byteshift));
+ if (pbytes == NULL)
+ gold_nomem();
+ memset(pbytes, 0, byteshift);
+ memcpy(pbytes + byteshift, v->data() + v->byteshift(), v->size());
+
+ File_read::View* shifted_view =
+ new File_read::View(v->start(), v->size(), pbytes, byteshift,
+ cache, View::DATA_ALLOCATED_ARRAY);
+
+ this->add_view(shifted_view);
+ return shifted_view;
+ }
+
+ // Make a new view. If we don't need an aligned view, use a
+ // byteshift of 0, so that we can use mmap.
+ return this->make_view(offset + start, size,
+ aligned ? byteshift : 0,
+ cache);
+}
+
+// Get a view into the file.
+
+const unsigned char*
+File_read::get_view(off_t offset, off_t start, section_size_type size,
+ bool aligned, bool cache)
+{
+ File_read::View* pv = this->find_or_make_view(offset, start, size,
+ aligned, cache);
+ return pv->data() + (offset + start - pv->start() + pv->byteshift());
+}
+
+File_view*
+File_read::get_lasting_view(off_t offset, off_t start, section_size_type size,
+ bool aligned, bool cache)
+{
+ File_read::View* pv = this->find_or_make_view(offset, start, size,
+ aligned, cache);
+ pv->lock();
+ return new File_view(*this, pv,
+ (pv->data()
+ + (offset + start - pv->start() + pv->byteshift())));
+}
+
+// Use readv to read COUNT entries from RM starting at START. BASE
+// must be added to all file offsets in RM.
+
+void
+File_read::do_readv(off_t base, const Read_multiple& rm, size_t start,
+ size_t count)
+{
+ unsigned char discard[File_read::page_size];
+ iovec iov[File_read::max_readv_entries * 2];
+ size_t iov_index = 0;
+
+ off_t first_offset = rm[start].file_offset;
+ off_t last_offset = first_offset;
+ ssize_t want = 0;
+ for (size_t i = 0; i < count; ++i)
+ {
+ const Read_multiple_entry& i_entry(rm[start + i]);
+
+ if (i_entry.file_offset > last_offset)
+ {
+ size_t skip = i_entry.file_offset - last_offset;
+ gold_assert(skip <= sizeof discard);
+
+ iov[iov_index].iov_base = discard;
+ iov[iov_index].iov_len = skip;
+ ++iov_index;
+
+ want += skip;
+ }
+
+ iov[iov_index].iov_base = i_entry.buffer;
+ iov[iov_index].iov_len = i_entry.size;
+ ++iov_index;
+
+ want += i_entry.size;
+
+ last_offset = i_entry.file_offset + i_entry.size;
+ }
+
+ this->reopen_descriptor();
+
+ gold_assert(iov_index < sizeof iov / sizeof iov[0]);
+
+ if (::lseek(this->descriptor_, base + first_offset, SEEK_SET) < 0)
+ gold_fatal(_("%s: lseek failed: %s"),
+ this->filename().c_str(), strerror(errno));
+
+ ssize_t got = ::readv(this->descriptor_, iov, iov_index);
+
+ if (got < 0)
+ gold_fatal(_("%s: readv failed: %s"),
+ this->filename().c_str(), strerror(errno));
+ if (got != want)
+ gold_fatal(_("%s: file too short: read only %zd of %zd bytes at %lld"),
+ this->filename().c_str(),
+ got, want, static_cast<long long>(base + first_offset));
+}
+
+// Portable IOV_MAX.
+
+#if !defined(HAVE_READV)
+#define GOLD_IOV_MAX 1
+#elif defined(IOV_MAX)
+#define GOLD_IOV_MAX IOV_MAX
+#else
+#define GOLD_IOV_MAX (File_read::max_readv_entries * 2)
+#endif
+
+// Read several pieces of data from the file.
+
+void
+File_read::read_multiple(off_t base, const Read_multiple& rm)
+{
+ static size_t iov_max = GOLD_IOV_MAX;
+ size_t count = rm.size();
+ size_t i = 0;
+ while (i < count)
+ {
+ // Find up to MAX_READV_ENTRIES consecutive entries which are
+ // less than one page apart.
+ const Read_multiple_entry& i_entry(rm[i]);
+ off_t i_off = i_entry.file_offset;
+ off_t end_off = i_off + i_entry.size;
+ size_t j;
+ for (j = i + 1; j < count; ++j)
+ {
+ if (j - i >= File_read::max_readv_entries || j - i >= iov_max / 2)
+ break;
+ const Read_multiple_entry& j_entry(rm[j]);
+ off_t j_off = j_entry.file_offset;
+ gold_assert(j_off >= end_off);
+ off_t j_end_off = j_off + j_entry.size;
+ if (j_end_off - end_off >= File_read::page_size)
+ break;
+ end_off = j_end_off;
+ }
+
+ if (j == i + 1)
+ this->read(base + i_off, i_entry.size, i_entry.buffer);
+ else
+ {
+ File_read::View* view = this->find_view(base + i_off,
+ end_off - i_off,
+ -1U, NULL);
+ if (view == NULL)
+ this->do_readv(base, rm, i, j - i);
+ else
+ {
+ const unsigned char* v = (view->data()
+ + (base + i_off - view->start()
+ + view->byteshift()));
+ for (size_t k = i; k < j; ++k)
+ {
+ const Read_multiple_entry& k_entry(rm[k]);
+ gold_assert((convert_to_section_size_type(k_entry.file_offset
+ - i_off)
+ + k_entry.size)
+ <= convert_to_section_size_type(end_off
+ - i_off));
+ memcpy(k_entry.buffer,
+ v + (k_entry.file_offset - i_off),
+ k_entry.size);
+ }
+ }
+ }
+
+ i = j;
+ }
+}
+
+// Mark all views as no longer cached.
+
+void
+File_read::clear_view_cache_marks()
+{
+ // Just ignore this if there are multiple objects associated with
+ // the file. Otherwise we will wind up uncaching and freeing some
+ // views for other objects.
+ if (this->object_count_ > 1)
+ return;
+
+ for (Views::iterator p = this->views_.begin();
+ p != this->views_.end();
+ ++p)
+ p->second->clear_cache();
+ for (Saved_views::iterator p = this->saved_views_.begin();
+ p != this->saved_views_.end();
+ ++p)
+ (*p)->clear_cache();
+}
+
+// Remove all the file views. For a file which has multiple
+// associated objects (i.e., an archive), we keep accessed views
+// around until next time, in the hopes that they will be useful for
+// the next object.
+
+void
+File_read::clear_views(Clear_views_mode mode)
+{
+ bool keep_files_mapped = (parameters->options_valid()
+ && parameters->options().keep_files_mapped());
+ Views::iterator p = this->views_.begin();
+ while (p != this->views_.end())
+ {
+ bool should_delete;
+ if (p->second->is_locked() || p->second->is_permanent_view())
+ should_delete = false;
+ else if (mode == CLEAR_VIEWS_ALL)
+ should_delete = true;
+ else if ((p->second->should_cache()
+ || p->second == this->whole_file_view_)
+ && keep_files_mapped)
+ should_delete = false;
+ else if (this->object_count_ > 1
+ && p->second->accessed()
+ && mode != CLEAR_VIEWS_ARCHIVE)
+ should_delete = false;
+ else
+ should_delete = true;
+
+ if (should_delete)
+ {
+ if (p->second == this->whole_file_view_)
+ this->whole_file_view_ = NULL;
+ delete p->second;
+
+ // map::erase invalidates only the iterator to the deleted
+ // element.
+ Views::iterator pe = p;
+ ++p;
+ this->views_.erase(pe);
+ }
+ else
+ {
+ p->second->clear_accessed();
+ ++p;
+ }
+ }
+
+ Saved_views::iterator q = this->saved_views_.begin();
+ while (q != this->saved_views_.end())
+ {
+ if (!(*q)->is_locked())
+ {
+ delete *q;
+ q = this->saved_views_.erase(q);
+ }
+ else
+ {
+ gold_assert(mode != CLEAR_VIEWS_ALL);
+ ++q;
+ }
+ }
+}
+
+// Print statistical information to stderr. This is used for --stats.
+
+void
+File_read::print_stats()
+{
+ fprintf(stderr, _("%s: total bytes mapped for read: %llu\n"),
+ program_name, File_read::total_mapped_bytes);
+ fprintf(stderr, _("%s: maximum bytes mapped for read at one time: %llu\n"),
+ program_name, File_read::maximum_mapped_bytes);
+}
+
+// Class File_view.
+
+File_view::~File_view()
+{
+ gold_assert(this->file_.is_locked());
+ this->view_->unlock();
+}
+
+// Class Input_file.
+
+// Create a file given just the filename.
+
+Input_file::Input_file(const char* name)
+ : found_name_(), file_(), is_in_sysroot_(false), format_(FORMAT_NONE)
+{
+ this->input_argument_ =
+ new Input_file_argument(name, Input_file_argument::INPUT_FILE_TYPE_FILE,
+ "", false, Position_dependent_options());
+}
+
+// Create a file for testing.
+
+Input_file::Input_file(const Task* task, const char* name,
+ const unsigned char* contents, off_t size)
+ : file_()
+{
+ this->input_argument_ =
+ new Input_file_argument(name, Input_file_argument::INPUT_FILE_TYPE_FILE,
+ "", false, Position_dependent_options());
+ bool ok = this->file_.open(task, name, contents, size);
+ gold_assert(ok);
+}
+
+// Return the position dependent options in force for this file.
+
+const Position_dependent_options&
+Input_file::options() const
+{
+ return this->input_argument_->options();
+}
+
+// Return the name given by the user. For -lc this will return "c".
+
+const char*
+Input_file::name() const
+{
+ return this->input_argument_->name();
+}
+
+// Return whether this file is in a system directory.
+
+bool
+Input_file::is_in_system_directory() const
+{
+ if (this->is_in_sysroot())
+ return true;
+ return parameters->options().is_in_system_directory(this->filename());
+}
+
+// Return whether we are only reading symbols.
+
+bool
+Input_file::just_symbols() const
+{
+ return this->input_argument_->just_symbols();
+}
+
+// Return whether this is a file that we will search for in the list
+// of directories.
+
+bool
+Input_file::will_search_for() const
+{
+ return (!IS_ABSOLUTE_PATH(this->input_argument_->name())
+ && (this->input_argument_->is_lib()
+ || this->input_argument_->is_searched_file()
+ || this->input_argument_->extra_search_path() != NULL));
+}
+
+// Return the file last modification time. Calls gold_fatal if the stat
+// system call failed.
+
+Timespec
+File_read::get_mtime()
+{
+ struct stat file_stat;
+ this->reopen_descriptor();
+
+ if (fstat(this->descriptor_, &file_stat) < 0)
+ gold_fatal(_("%s: stat failed: %s"), this->name_.c_str(),
+ strerror(errno));
+#ifdef HAVE_STAT_ST_MTIM
+ return Timespec(file_stat.st_mtim.tv_sec, file_stat.st_mtim.tv_nsec);
+#else
+ return Timespec(file_stat.st_mtime, 0);
+#endif
+}
+
+// Try to find a file in the extra search dirs. Returns true on success.
+
+bool
+Input_file::try_extra_search_path(int* pindex,
+ const Input_file_argument* input_argument,
+ std::string filename, std::string* found_name,
+ std::string* namep)
+{
+ if (input_argument->extra_search_path() == NULL)
+ return false;
+
+ std::string name = input_argument->extra_search_path();
+ if (!IS_DIR_SEPARATOR(name[name.length() - 1]))
+ name += '/';
+ name += filename;
+
+ struct stat dummy_stat;
+ if (*pindex > 0 || ::stat(name.c_str(), &dummy_stat) < 0)
+ return false;
+
+ *found_name = filename;
+ *namep = name;
+ return true;
+}
+
+// Find the actual file.
+// If the filename is not absolute, we assume it is in the current
+// directory *except* when:
+// A) input_argument_->is_lib() is true;
+// B) input_argument_->is_searched_file() is true; or
+// C) input_argument_->extra_search_path() is not empty.
+// In each, we look in extra_search_path + library_path to find
+// the file location, rather than the current directory.
+
+bool
+Input_file::find_file(const Dirsearch& dirpath, int* pindex,
+ const Input_file_argument* input_argument,
+ bool* is_in_sysroot,
+ std::string* found_name, std::string* namep)
+{
+ std::string name;
+
+ // Case 1: name is an absolute file, just try to open it
+ // Case 2: name is relative but is_lib is false, is_searched_file is false,
+ // and extra_search_path is empty
+ if (IS_ABSOLUTE_PATH(input_argument->name())
+ || (!input_argument->is_lib()
+ && !input_argument->is_searched_file()
+ && input_argument->extra_search_path() == NULL))
+ {
+ name = input_argument->name();
+ *found_name = name;
+ *namep = name;
+ return true;
+ }
+ // Case 3: is_lib is true or is_searched_file is true
+ else if (input_argument->is_lib()
+ || input_argument->is_searched_file())
+ {
+ std::vector<std::string> names;
+ names.reserve(2);
+ if (input_argument->is_lib())
+ {
+ std::string prefix = "lib";
+ prefix += input_argument->name();
+ if (parameters->options().is_static()
+ || !input_argument->options().Bdynamic())
+ names.push_back(prefix + ".a");
+ else
+ {
+ names.push_back(prefix + ".so");
+ names.push_back(prefix + ".a");
+ }
+ }
+ else
+ names.push_back(input_argument->name());
+
+ for (std::vector<std::string>::const_iterator n = names.begin();
+ n != names.end();
+ ++n)
+ if (Input_file::try_extra_search_path(pindex, input_argument, *n,
+ found_name, namep))
+ return true;
+
+ // It is not in the extra_search_path.
+ name = dirpath.find(names, is_in_sysroot, pindex, found_name);
+ if (name.empty())
+ {
+ gold_error(_("cannot find %s%s"),
+ input_argument->is_lib() ? "-l" : "",
+ input_argument->name());
+ return false;
+ }
+ *namep = name;
+ return true;
+ }
+ // Case 4: extra_search_path is not empty
+ else
+ {
+ gold_assert(input_argument->extra_search_path() != NULL);
+
+ if (try_extra_search_path(pindex, input_argument, input_argument->name(),
+ found_name, namep))
+ return true;
+
+ // extra_search_path failed, so check the normal search-path.
+ int index = *pindex;
+ if (index > 0)
+ --index;
+ name = dirpath.find(std::vector<std::string>(1, input_argument->name()),
+ is_in_sysroot, &index, found_name);
+ if (name.empty())
+ {
+ gold_error(_("cannot find %s"),
+ input_argument->name());
+ return false;
+ }
+ *namep = name;
+ *pindex = index + 1;
+ return true;
+ }
+}
+
+// Open the file.
+
+bool
+Input_file::open(const Dirsearch& dirpath, const Task* task, int* pindex)
+{
+ std::string name;
+ if (!Input_file::find_file(dirpath, pindex, this->input_argument_,
+ &this->is_in_sysroot_, &this->found_name_, &name))
+ return false;
+
+ // Now that we've figured out where the file lives, try to open it.
+
+ General_options::Object_format format =
+ this->input_argument_->options().format_enum();
+ bool ok;
+ if (format == General_options::OBJECT_FORMAT_ELF)
+ {
+ ok = this->file_.open(task, name);
+ this->format_ = FORMAT_ELF;
+ }
+ else
+ {
+ gold_assert(format == General_options::OBJECT_FORMAT_BINARY);
+ ok = this->open_binary(task, name);
+ this->format_ = FORMAT_BINARY;
+ }
+
+ if (!ok)
+ {
+ gold_error(_("cannot open %s: %s"),
+ name.c_str(), strerror(errno));
+ this->format_ = FORMAT_NONE;
+ return false;
+ }
+
+ return true;
+}
+
+// Open a file for --format binary.
+
+bool
+Input_file::open_binary(const Task* task, const std::string& name)
+{
+ // In order to open a binary file, we need machine code, size, and
+ // endianness. We may not have a valid target at this point, in
+ // which case we use the default target.
+ parameters_force_valid_target();
+ const Target& target(parameters->target());
+
+ Binary_to_elf binary_to_elf(target.machine_code(),
+ target.get_size(),
+ target.is_big_endian(),
+ name);
+ if (!binary_to_elf.convert(task))
+ return false;
+ return this->file_.open(task, name, binary_to_elf.converted_data_leak(),
+ binary_to_elf.converted_size());
+}
+
+void
+File_read::record_file_read(const std::string& name)
+{
+ File_read::files_read.push_back(name);
+}
+
+void
+File_read::write_dependency_file(const char* dependency_file_name,
+ const char* output_file_name)
+{
+ FILE *depfile = fopen(dependency_file_name, "w");
+
+ fprintf(depfile, "%s:", output_file_name);
+ for (std::vector<std::string>::const_iterator it = files_read.begin();
+ it != files_read.end();
+ ++it)
+ fprintf(depfile, " \\\n %s", it->c_str());
+ fprintf(depfile, "\n");
+
+ for (std::vector<std::string>::const_iterator it = files_read.begin();
+ it != files_read.end();
+ ++it)
+ fprintf(depfile, "\n%s:\n", it->c_str());
+
+ fclose(depfile);
+}
+
+} // End namespace gold.
Index: toolchains-1.7.2/sources/GNU/binutils/create-2.37-CVE-2019-1010204-patch/create.patch.sh
===================================================================
--- toolchains-1.7.2/sources/GNU/binutils/create-2.37-CVE-2019-1010204-patch/create.patch.sh (nonexistent)
+++ toolchains-1.7.2/sources/GNU/binutils/create-2.37-CVE-2019-1010204-patch/create.patch.sh (revision 348)
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+VERSION=2.37
+
+tar --files-from=file.list -xJvf ../binutils-$VERSION.tar.xz
+mv binutils-$VERSION binutils-$VERSION-orig
+
+cp -rf ./binutils-$VERSION-new ./binutils-$VERSION
+
+diff -b --unified -Nr binutils-$VERSION-orig binutils-$VERSION > binutils-$VERSION-CVE-2019-1010204.patch
+
+mv binutils-$VERSION-CVE-2019-1010204.patch ../patches
+
+rm -rf ./binutils-$VERSION
+rm -rf ./binutils-$VERSION-orig
Property changes on: toolchains-1.7.2/sources/GNU/binutils/create-2.37-CVE-2019-1010204-patch/create.patch.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: toolchains-1.7.2/sources/GNU/binutils/create-2.37-CVE-2019-1010204-patch/file.list
===================================================================
--- toolchains-1.7.2/sources/GNU/binutils/create-2.37-CVE-2019-1010204-patch/file.list (nonexistent)
+++ toolchains-1.7.2/sources/GNU/binutils/create-2.37-CVE-2019-1010204-patch/file.list (revision 348)
@@ -0,0 +1 @@
+binutils-2.37/gold/fileread.cc
Index: toolchains-1.7.2/sources/GNU/binutils/create-2.37-aarch64-ifunc-patch/binutils-2.37-new/bfd/elfnn-aarch64.c
===================================================================
--- toolchains-1.7.2/sources/GNU/binutils/create-2.37-aarch64-ifunc-patch/binutils-2.37-new/bfd/elfnn-aarch64.c (nonexistent)
+++ toolchains-1.7.2/sources/GNU/binutils/create-2.37-aarch64-ifunc-patch/binutils-2.37-new/bfd/elfnn-aarch64.c (revision 348)
@@ -0,0 +1,10115 @@
+/* AArch64-specific support for NN-bit ELF.
+ Copyright (C) 2009-2021 Free Software Foundation, Inc.
+ Contributed by ARM Ltd.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; see the file COPYING3. If not,
+ see <http://www.gnu.org/licenses/>. */
+
+/* Notes on implementation:
+
+ Thread Local Store (TLS)
+
+ Overview:
+
+ The implementation currently supports both traditional TLS and TLS
+ descriptors, but only general dynamic (GD).
+
+ For traditional TLS the assembler will present us with code
+ fragments of the form:
+
+ adrp x0, :tlsgd:foo
+ R_AARCH64_TLSGD_ADR_PAGE21(foo)
+ add x0, :tlsgd_lo12:foo
+ R_AARCH64_TLSGD_ADD_LO12_NC(foo)
+ bl __tls_get_addr
+ nop
+
+ For TLS descriptors the assembler will present us with code
+ fragments of the form:
+
+ adrp x0, :tlsdesc:foo R_AARCH64_TLSDESC_ADR_PAGE21(foo)
+ ldr x1, [x0, #:tlsdesc_lo12:foo] R_AARCH64_TLSDESC_LD64_LO12(foo)
+ add x0, x0, #:tlsdesc_lo12:foo R_AARCH64_TLSDESC_ADD_LO12(foo)
+ .tlsdesccall foo
+ blr x1 R_AARCH64_TLSDESC_CALL(foo)
+
+ The relocations R_AARCH64_TLSGD_{ADR_PREL21,ADD_LO12_NC} against foo
+ indicate that foo is thread local and should be accessed via the
+ traditional TLS mechanims.
+
+ The relocations R_AARCH64_TLSDESC_{ADR_PAGE21,LD64_LO12_NC,ADD_LO12_NC}
+ against foo indicate that 'foo' is thread local and should be accessed
+ via a TLS descriptor mechanism.
+
+ The precise instruction sequence is only relevant from the
+ perspective of linker relaxation which is currently not implemented.
+
+ The static linker must detect that 'foo' is a TLS object and
+ allocate a double GOT entry. The GOT entry must be created for both
+ global and local TLS symbols. Note that this is different to none
+ TLS local objects which do not need a GOT entry.
+
+ In the traditional TLS mechanism, the double GOT entry is used to
+ provide the tls_index structure, containing module and offset
+ entries. The static linker places the relocation R_AARCH64_TLS_DTPMOD
+ on the module entry. The loader will subsequently fixup this
+ relocation with the module identity.
+
+ For global traditional TLS symbols the static linker places an
+ R_AARCH64_TLS_DTPREL relocation on the offset entry. The loader
+ will subsequently fixup the offset. For local TLS symbols the static
+ linker fixes up offset.
+
+ In the TLS descriptor mechanism the double GOT entry is used to
+ provide the descriptor. The static linker places the relocation
+ R_AARCH64_TLSDESC on the first GOT slot. The loader will
+ subsequently fix this up.
+
+ Implementation:
+
+ The handling of TLS symbols is implemented across a number of
+ different backend functions. The following is a top level view of
+ what processing is performed where.
+
+ The TLS implementation maintains state information for each TLS
+ symbol. The state information for local and global symbols is kept
+ in different places. Global symbols use generic BFD structures while
+ local symbols use backend specific structures that are allocated and
+ maintained entirely by the backend.
+
+ The flow:
+
+ elfNN_aarch64_check_relocs()
+
+ This function is invoked for each relocation.
+
+ The TLS relocations R_AARCH64_TLSGD_{ADR_PREL21,ADD_LO12_NC} and
+ R_AARCH64_TLSDESC_{ADR_PAGE21,LD64_LO12_NC,ADD_LO12_NC} are
+ spotted. One time creation of local symbol data structures are
+ created when the first local symbol is seen.
+
+ The reference count for a symbol is incremented. The GOT type for
+ each symbol is marked as general dynamic.
+
+ elfNN_aarch64_allocate_dynrelocs ()
+
+ For each global with positive reference count we allocate a double
+ GOT slot. For a traditional TLS symbol we allocate space for two
+ relocation entries on the GOT, for a TLS descriptor symbol we
+ allocate space for one relocation on the slot. Record the GOT offset
+ for this symbol.
+
+ elfNN_aarch64_size_dynamic_sections ()
+
+ Iterate all input BFDS, look for in the local symbol data structure
+ constructed earlier for local TLS symbols and allocate them double
+ GOT slots along with space for a single GOT relocation. Update the
+ local symbol structure to record the GOT offset allocated.
+
+ elfNN_aarch64_relocate_section ()
+
+ Calls elfNN_aarch64_final_link_relocate ()
+
+ Emit the relevant TLS relocations against the GOT for each TLS
+ symbol. For local TLS symbols emit the GOT offset directly. The GOT
+ relocations are emitted once the first time a TLS symbol is
+ encountered. The implementation uses the LSB of the GOT offset to
+ flag that the relevant GOT relocations for a symbol have been
+ emitted. All of the TLS code that uses the GOT offset needs to take
+ care to mask out this flag bit before using the offset.
+
+ elfNN_aarch64_final_link_relocate ()
+
+ Fixup the R_AARCH64_TLSGD_{ADR_PREL21, ADD_LO12_NC} relocations. */
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "libiberty.h"
+#include "libbfd.h"
+#include "elf-bfd.h"
+#include "bfdlink.h"
+#include "objalloc.h"
+#include "elf/aarch64.h"
+#include "elfxx-aarch64.h"
+#include "cpu-aarch64.h"
+
+#define ARCH_SIZE NN
+
+#if ARCH_SIZE == 64
+#define AARCH64_R(NAME) R_AARCH64_ ## NAME
+#define AARCH64_R_STR(NAME) "R_AARCH64_" #NAME
+#define HOWTO64(...) HOWTO (__VA_ARGS__)
+#define HOWTO32(...) EMPTY_HOWTO (0)
+#define LOG_FILE_ALIGN 3
+#define BFD_RELOC_AARCH64_TLSDESC_LD64_LO12_NC BFD_RELOC_AARCH64_TLSDESC_LD64_LO12
+#endif
+
+#if ARCH_SIZE == 32
+#define AARCH64_R(NAME) R_AARCH64_P32_ ## NAME
+#define AARCH64_R_STR(NAME) "R_AARCH64_P32_" #NAME
+#define HOWTO64(...) EMPTY_HOWTO (0)
+#define HOWTO32(...) HOWTO (__VA_ARGS__)
+#define LOG_FILE_ALIGN 2
+#define BFD_RELOC_AARCH64_TLSDESC_LD32_LO12 BFD_RELOC_AARCH64_TLSDESC_LD32_LO12_NC
+#define R_AARCH64_P32_TLSDESC_ADD_LO12 R_AARCH64_P32_TLSDESC_ADD_LO12_NC
+#endif
+
+#define IS_AARCH64_TLS_RELOC(R_TYPE) \
+ ((R_TYPE) == BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSGD_ADR_PREL21 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSGD_MOVW_G1 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_HI12 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_ADR_PREL21 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G2 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_HI12 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G2 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLS_DTPMOD \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLS_DTPREL \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLS_TPREL \
+ || IS_AARCH64_TLSDESC_RELOC ((R_TYPE)))
+
+#define IS_AARCH64_TLS_RELAX_RELOC(R_TYPE) \
+ ((R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_ADD \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_ADD_LO12 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_CALL \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_LD_PREL19 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_LDNN_LO12_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_LDR \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_OFF_G0_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_OFF_G1 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_LDR \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSGD_ADR_PREL21 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSGD_MOVW_G1 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSIE_LDNN_GOTTPREL_LO12_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_ADR_PREL21)
+
+#define IS_AARCH64_TLSDESC_RELOC(R_TYPE) \
+ ((R_TYPE) == BFD_RELOC_AARCH64_TLSDESC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_ADD \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_ADD_LO12 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_CALL \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_LD32_LO12_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_LD64_LO12 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_LDR \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_LD_PREL19 \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_OFF_G0_NC \
+ || (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_OFF_G1)
+
+#define ELIMINATE_COPY_RELOCS 1
+
+/* Return size of a relocation entry. HTAB is the bfd's
+ elf_aarch64_link_hash_entry. */
+#define RELOC_SIZE(HTAB) (sizeof (ElfNN_External_Rela))
+
+/* GOT Entry size - 8 bytes in ELF64 and 4 bytes in ELF32. */
+#define GOT_ENTRY_SIZE (ARCH_SIZE / 8)
+#define PLT_ENTRY_SIZE (32)
+#define PLT_SMALL_ENTRY_SIZE (16)
+#define PLT_TLSDESC_ENTRY_SIZE (32)
+/* PLT sizes with BTI insn. */
+#define PLT_BTI_SMALL_ENTRY_SIZE (24)
+/* PLT sizes with PAC insn. */
+#define PLT_PAC_SMALL_ENTRY_SIZE (24)
+/* PLT sizes with BTI and PAC insn. */
+#define PLT_BTI_PAC_SMALL_ENTRY_SIZE (24)
+
+/* Encoding of the nop instruction. */
+#define INSN_NOP 0xd503201f
+
+#define aarch64_compute_jump_table_size(htab) \
+ (((htab)->root.srelplt == NULL) ? 0 \
+ : (htab)->root.srelplt->reloc_count * GOT_ENTRY_SIZE)
+
+/* The first entry in a procedure linkage table looks like this
+ if the distance between the PLTGOT and the PLT is < 4GB use
+ these PLT entries. Note that the dynamic linker gets &PLTGOT[2]
+ in x16 and needs to work out PLTGOT[1] by using an address of
+ [x16,#-GOT_ENTRY_SIZE]. */
+static const bfd_byte elfNN_aarch64_small_plt0_entry[PLT_ENTRY_SIZE] =
+{
+ 0xf0, 0x7b, 0xbf, 0xa9, /* stp x16, x30, [sp, #-16]! */
+ 0x10, 0x00, 0x00, 0x90, /* adrp x16, (GOT+16) */
+#if ARCH_SIZE == 64
+ 0x11, 0x0A, 0x40, 0xf9, /* ldr x17, [x16, #PLT_GOT+0x10] */
+ 0x10, 0x42, 0x00, 0x91, /* add x16, x16,#PLT_GOT+0x10 */
+#else
+ 0x11, 0x0A, 0x40, 0xb9, /* ldr w17, [x16, #PLT_GOT+0x8] */
+ 0x10, 0x22, 0x00, 0x11, /* add w16, w16,#PLT_GOT+0x8 */
+#endif
+ 0x20, 0x02, 0x1f, 0xd6, /* br x17 */
+ 0x1f, 0x20, 0x03, 0xd5, /* nop */
+ 0x1f, 0x20, 0x03, 0xd5, /* nop */
+ 0x1f, 0x20, 0x03, 0xd5, /* nop */
+};
+
+static const bfd_byte elfNN_aarch64_small_plt0_bti_entry[PLT_ENTRY_SIZE] =
+{
+ 0x5f, 0x24, 0x03, 0xd5, /* bti c. */
+ 0xf0, 0x7b, 0xbf, 0xa9, /* stp x16, x30, [sp, #-16]! */
+ 0x10, 0x00, 0x00, 0x90, /* adrp x16, (GOT+16) */
+#if ARCH_SIZE == 64
+ 0x11, 0x0A, 0x40, 0xf9, /* ldr x17, [x16, #PLT_GOT+0x10] */
+ 0x10, 0x42, 0x00, 0x91, /* add x16, x16,#PLT_GOT+0x10 */
+#else
+ 0x11, 0x0A, 0x40, 0xb9, /* ldr w17, [x16, #PLT_GOT+0x8] */
+ 0x10, 0x22, 0x00, 0x11, /* add w16, w16,#PLT_GOT+0x8 */
+#endif
+ 0x20, 0x02, 0x1f, 0xd6, /* br x17 */
+ 0x1f, 0x20, 0x03, 0xd5, /* nop */
+ 0x1f, 0x20, 0x03, 0xd5, /* nop */
+};
+
+/* Per function entry in a procedure linkage table looks like this
+ if the distance between the PLTGOT and the PLT is < 4GB use
+ these PLT entries. Use BTI versions of the PLTs when enabled. */
+static const bfd_byte elfNN_aarch64_small_plt_entry[PLT_SMALL_ENTRY_SIZE] =
+{
+ 0x10, 0x00, 0x00, 0x90, /* adrp x16, PLTGOT + n * 8 */
+#if ARCH_SIZE == 64
+ 0x11, 0x02, 0x40, 0xf9, /* ldr x17, [x16, PLTGOT + n * 8] */
+ 0x10, 0x02, 0x00, 0x91, /* add x16, x16, :lo12:PLTGOT + n * 8 */
+#else
+ 0x11, 0x02, 0x40, 0xb9, /* ldr w17, [x16, PLTGOT + n * 4] */
+ 0x10, 0x02, 0x00, 0x11, /* add w16, w16, :lo12:PLTGOT + n * 4 */
+#endif
+ 0x20, 0x02, 0x1f, 0xd6, /* br x17. */
+};
+
+static const bfd_byte
+elfNN_aarch64_small_plt_bti_entry[PLT_BTI_SMALL_ENTRY_SIZE] =
+{
+ 0x5f, 0x24, 0x03, 0xd5, /* bti c. */
+ 0x10, 0x00, 0x00, 0x90, /* adrp x16, PLTGOT + n * 8 */
+#if ARCH_SIZE == 64
+ 0x11, 0x02, 0x40, 0xf9, /* ldr x17, [x16, PLTGOT + n * 8] */
+ 0x10, 0x02, 0x00, 0x91, /* add x16, x16, :lo12:PLTGOT + n * 8 */
+#else
+ 0x11, 0x02, 0x40, 0xb9, /* ldr w17, [x16, PLTGOT + n * 4] */
+ 0x10, 0x02, 0x00, 0x11, /* add w16, w16, :lo12:PLTGOT + n * 4 */
+#endif
+ 0x20, 0x02, 0x1f, 0xd6, /* br x17. */
+ 0x1f, 0x20, 0x03, 0xd5, /* nop */
+};
+
+static const bfd_byte
+elfNN_aarch64_small_plt_pac_entry[PLT_PAC_SMALL_ENTRY_SIZE] =
+{
+ 0x10, 0x00, 0x00, 0x90, /* adrp x16, PLTGOT + n * 8 */
+#if ARCH_SIZE == 64
+ 0x11, 0x02, 0x40, 0xf9, /* ldr x17, [x16, PLTGOT + n * 8] */
+ 0x10, 0x02, 0x00, 0x91, /* add x16, x16, :lo12:PLTGOT + n * 8 */
+#else
+ 0x11, 0x02, 0x40, 0xb9, /* ldr w17, [x16, PLTGOT + n * 4] */
+ 0x10, 0x02, 0x00, 0x11, /* add w16, w16, :lo12:PLTGOT + n * 4 */
+#endif
+ 0x9f, 0x21, 0x03, 0xd5, /* autia1716 */
+ 0x20, 0x02, 0x1f, 0xd6, /* br x17. */
+ 0x1f, 0x20, 0x03, 0xd5, /* nop */
+};
+
+static const bfd_byte
+elfNN_aarch64_small_plt_bti_pac_entry[PLT_BTI_PAC_SMALL_ENTRY_SIZE] =
+{
+ 0x5f, 0x24, 0x03, 0xd5, /* bti c. */
+ 0x10, 0x00, 0x00, 0x90, /* adrp x16, PLTGOT + n * 8 */
+#if ARCH_SIZE == 64
+ 0x11, 0x02, 0x40, 0xf9, /* ldr x17, [x16, PLTGOT + n * 8] */
+ 0x10, 0x02, 0x00, 0x91, /* add x16, x16, :lo12:PLTGOT + n * 8 */
+#else
+ 0x11, 0x02, 0x40, 0xb9, /* ldr w17, [x16, PLTGOT + n * 4] */
+ 0x10, 0x02, 0x00, 0x11, /* add w16, w16, :lo12:PLTGOT + n * 4 */
+#endif
+ 0x9f, 0x21, 0x03, 0xd5, /* autia1716 */
+ 0x20, 0x02, 0x1f, 0xd6, /* br x17. */
+};
+
+static const bfd_byte
+elfNN_aarch64_tlsdesc_small_plt_entry[PLT_TLSDESC_ENTRY_SIZE] =
+{
+ 0xe2, 0x0f, 0xbf, 0xa9, /* stp x2, x3, [sp, #-16]! */
+ 0x02, 0x00, 0x00, 0x90, /* adrp x2, 0 */
+ 0x03, 0x00, 0x00, 0x90, /* adrp x3, 0 */
+#if ARCH_SIZE == 64
+ 0x42, 0x00, 0x40, 0xf9, /* ldr x2, [x2, #0] */
+ 0x63, 0x00, 0x00, 0x91, /* add x3, x3, 0 */
+#else
+ 0x42, 0x00, 0x40, 0xb9, /* ldr w2, [x2, #0] */
+ 0x63, 0x00, 0x00, 0x11, /* add w3, w3, 0 */
+#endif
+ 0x40, 0x00, 0x1f, 0xd6, /* br x2 */
+ 0x1f, 0x20, 0x03, 0xd5, /* nop */
+ 0x1f, 0x20, 0x03, 0xd5, /* nop */
+};
+
+static const bfd_byte
+elfNN_aarch64_tlsdesc_small_plt_bti_entry[PLT_TLSDESC_ENTRY_SIZE] =
+{
+ 0x5f, 0x24, 0x03, 0xd5, /* bti c. */
+ 0xe2, 0x0f, 0xbf, 0xa9, /* stp x2, x3, [sp, #-16]! */
+ 0x02, 0x00, 0x00, 0x90, /* adrp x2, 0 */
+ 0x03, 0x00, 0x00, 0x90, /* adrp x3, 0 */
+#if ARCH_SIZE == 64
+ 0x42, 0x00, 0x40, 0xf9, /* ldr x2, [x2, #0] */
+ 0x63, 0x00, 0x00, 0x91, /* add x3, x3, 0 */
+#else
+ 0x42, 0x00, 0x40, 0xb9, /* ldr w2, [x2, #0] */
+ 0x63, 0x00, 0x00, 0x11, /* add w3, w3, 0 */
+#endif
+ 0x40, 0x00, 0x1f, 0xd6, /* br x2 */
+ 0x1f, 0x20, 0x03, 0xd5, /* nop */
+};
+
+#define elf_info_to_howto elfNN_aarch64_info_to_howto
+#define elf_info_to_howto_rel elfNN_aarch64_info_to_howto
+
+#define AARCH64_ELF_ABI_VERSION 0
+
+/* In case we're on a 32-bit machine, construct a 64-bit "-1" value. */
+#define ALL_ONES (~ (bfd_vma) 0)
+
+/* Indexed by the bfd interal reloc enumerators.
+ Therefore, the table needs to be synced with BFD_RELOC_AARCH64_*
+ in reloc.c. */
+
+static reloc_howto_type elfNN_aarch64_howto_table[] =
+{
+ EMPTY_HOWTO (0),
+
+ /* Basic data relocations. */
+
+ /* Deprecated, but retained for backwards compatibility. */
+ HOWTO64 (R_AARCH64_NULL, /* type */
+ 0, /* rightshift */
+ 3, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_AARCH64_NULL", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false), /* pcrel_offset */
+ HOWTO (R_AARCH64_NONE, /* type */
+ 0, /* rightshift */
+ 3, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_AARCH64_NONE", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* .xword: (S+A) */
+ HOWTO64 (AARCH64_R (ABS64), /* type */
+ 0, /* rightshift */
+ 4, /* size (4 = long long) */
+ 64, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (ABS64), /* name */
+ false, /* partial_inplace */
+ ALL_ONES, /* src_mask */
+ ALL_ONES, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* .word: (S+A) */
+ HOWTO (AARCH64_R (ABS32), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (ABS32), /* name */
+ false, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* .half: (S+A) */
+ HOWTO (AARCH64_R (ABS16), /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (ABS16), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* .xword: (S+A-P) */
+ HOWTO64 (AARCH64_R (PREL64), /* type */
+ 0, /* rightshift */
+ 4, /* size (4 = long long) */
+ 64, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (PREL64), /* name */
+ false, /* partial_inplace */
+ ALL_ONES, /* src_mask */
+ ALL_ONES, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* .word: (S+A-P) */
+ HOWTO (AARCH64_R (PREL32), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (PREL32), /* name */
+ false, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* .half: (S+A-P) */
+ HOWTO (AARCH64_R (PREL16), /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (PREL16), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* Group relocations to create a 16, 32, 48 or 64 bit
+ unsigned data or abs address inline. */
+
+ /* MOVZ: ((S+A) >> 0) & 0xffff */
+ HOWTO (AARCH64_R (MOVW_UABS_G0), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (MOVW_UABS_G0), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* MOVK: ((S+A) >> 0) & 0xffff [no overflow check] */
+ HOWTO (AARCH64_R (MOVW_UABS_G0_NC), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (MOVW_UABS_G0_NC), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* MOVZ: ((S+A) >> 16) & 0xffff */
+ HOWTO (AARCH64_R (MOVW_UABS_G1), /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (MOVW_UABS_G1), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* MOVK: ((S+A) >> 16) & 0xffff [no overflow check] */
+ HOWTO64 (AARCH64_R (MOVW_UABS_G1_NC), /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (MOVW_UABS_G1_NC), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* MOVZ: ((S+A) >> 32) & 0xffff */
+ HOWTO64 (AARCH64_R (MOVW_UABS_G2), /* type */
+ 32, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (MOVW_UABS_G2), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* MOVK: ((S+A) >> 32) & 0xffff [no overflow check] */
+ HOWTO64 (AARCH64_R (MOVW_UABS_G2_NC), /* type */
+ 32, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (MOVW_UABS_G2_NC), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* MOVZ: ((S+A) >> 48) & 0xffff */
+ HOWTO64 (AARCH64_R (MOVW_UABS_G3), /* type */
+ 48, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (MOVW_UABS_G3), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Group relocations to create high part of a 16, 32, 48 or 64 bit
+ signed data or abs address inline. Will change instruction
+ to MOVN or MOVZ depending on sign of calculated value. */
+
+ /* MOV[ZN]: ((S+A) >> 0) & 0xffff */
+ HOWTO (AARCH64_R (MOVW_SABS_G0), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 17, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (MOVW_SABS_G0), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* MOV[ZN]: ((S+A) >> 16) & 0xffff */
+ HOWTO64 (AARCH64_R (MOVW_SABS_G1), /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 17, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (MOVW_SABS_G1), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* MOV[ZN]: ((S+A) >> 32) & 0xffff */
+ HOWTO64 (AARCH64_R (MOVW_SABS_G2), /* type */
+ 32, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 17, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (MOVW_SABS_G2), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Group relocations to create a 16, 32, 48 or 64 bit
+ PC relative address inline. */
+
+ /* MOV[NZ]: ((S+A-P) >> 0) & 0xffff */
+ HOWTO (AARCH64_R (MOVW_PREL_G0), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 17, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (MOVW_PREL_G0), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* MOVK: ((S+A-P) >> 0) & 0xffff [no overflow check] */
+ HOWTO (AARCH64_R (MOVW_PREL_G0_NC), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (MOVW_PREL_G0_NC), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* MOV[NZ]: ((S+A-P) >> 16) & 0xffff */
+ HOWTO (AARCH64_R (MOVW_PREL_G1), /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 17, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (MOVW_PREL_G1), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* MOVK: ((S+A-P) >> 16) & 0xffff [no overflow check] */
+ HOWTO64 (AARCH64_R (MOVW_PREL_G1_NC), /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (MOVW_PREL_G1_NC), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* MOV[NZ]: ((S+A-P) >> 32) & 0xffff */
+ HOWTO64 (AARCH64_R (MOVW_PREL_G2), /* type */
+ 32, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 17, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (MOVW_PREL_G2), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* MOVK: ((S+A-P) >> 32) & 0xffff [no overflow check] */
+ HOWTO64 (AARCH64_R (MOVW_PREL_G2_NC), /* type */
+ 32, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (MOVW_PREL_G2_NC), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* MOV[NZ]: ((S+A-P) >> 48) & 0xffff */
+ HOWTO64 (AARCH64_R (MOVW_PREL_G3), /* type */
+ 48, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (MOVW_PREL_G3), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+/* Relocations to generate 19, 21 and 33 bit PC-relative load/store
+ addresses: PG(x) is (x & ~0xfff). */
+
+ /* LD-lit: ((S+A-P) >> 2) & 0x7ffff */
+ HOWTO (AARCH64_R (LD_PREL_LO19), /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 19, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (LD_PREL_LO19), /* name */
+ false, /* partial_inplace */
+ 0x7ffff, /* src_mask */
+ 0x7ffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* ADR: (S+A-P) & 0x1fffff */
+ HOWTO (AARCH64_R (ADR_PREL_LO21), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 21, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (ADR_PREL_LO21), /* name */
+ false, /* partial_inplace */
+ 0x1fffff, /* src_mask */
+ 0x1fffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* ADRP: ((PG(S+A)-PG(P)) >> 12) & 0x1fffff */
+ HOWTO (AARCH64_R (ADR_PREL_PG_HI21), /* type */
+ 12, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 21, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (ADR_PREL_PG_HI21), /* name */
+ false, /* partial_inplace */
+ 0x1fffff, /* src_mask */
+ 0x1fffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* ADRP: ((PG(S+A)-PG(P)) >> 12) & 0x1fffff [no overflow check] */
+ HOWTO64 (AARCH64_R (ADR_PREL_PG_HI21_NC), /* type */
+ 12, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 21, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (ADR_PREL_PG_HI21_NC), /* name */
+ false, /* partial_inplace */
+ 0x1fffff, /* src_mask */
+ 0x1fffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* ADD: (S+A) & 0xfff [no overflow check] */
+ HOWTO (AARCH64_R (ADD_ABS_LO12_NC), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (ADD_ABS_LO12_NC), /* name */
+ false, /* partial_inplace */
+ 0x3ffc00, /* src_mask */
+ 0x3ffc00, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* LD/ST8: (S+A) & 0xfff */
+ HOWTO (AARCH64_R (LDST8_ABS_LO12_NC), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (LDST8_ABS_LO12_NC), /* name */
+ false, /* partial_inplace */
+ 0xfff, /* src_mask */
+ 0xfff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Relocations for control-flow instructions. */
+
+ /* TBZ/NZ: ((S+A-P) >> 2) & 0x3fff */
+ HOWTO (AARCH64_R (TSTBR14), /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 14, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TSTBR14), /* name */
+ false, /* partial_inplace */
+ 0x3fff, /* src_mask */
+ 0x3fff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* B.cond: ((S+A-P) >> 2) & 0x7ffff */
+ HOWTO (AARCH64_R (CONDBR19), /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 19, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (CONDBR19), /* name */
+ false, /* partial_inplace */
+ 0x7ffff, /* src_mask */
+ 0x7ffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* B: ((S+A-P) >> 2) & 0x3ffffff */
+ HOWTO (AARCH64_R (JUMP26), /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 26, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (JUMP26), /* name */
+ false, /* partial_inplace */
+ 0x3ffffff, /* src_mask */
+ 0x3ffffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* BL: ((S+A-P) >> 2) & 0x3ffffff */
+ HOWTO (AARCH64_R (CALL26), /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 26, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (CALL26), /* name */
+ false, /* partial_inplace */
+ 0x3ffffff, /* src_mask */
+ 0x3ffffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* LD/ST16: (S+A) & 0xffe */
+ HOWTO (AARCH64_R (LDST16_ABS_LO12_NC), /* type */
+ 1, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (LDST16_ABS_LO12_NC), /* name */
+ false, /* partial_inplace */
+ 0xffe, /* src_mask */
+ 0xffe, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* LD/ST32: (S+A) & 0xffc */
+ HOWTO (AARCH64_R (LDST32_ABS_LO12_NC), /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (LDST32_ABS_LO12_NC), /* name */
+ false, /* partial_inplace */
+ 0xffc, /* src_mask */
+ 0xffc, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* LD/ST64: (S+A) & 0xff8 */
+ HOWTO (AARCH64_R (LDST64_ABS_LO12_NC), /* type */
+ 3, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (LDST64_ABS_LO12_NC), /* name */
+ false, /* partial_inplace */
+ 0xff8, /* src_mask */
+ 0xff8, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* LD/ST128: (S+A) & 0xff0 */
+ HOWTO (AARCH64_R (LDST128_ABS_LO12_NC), /* type */
+ 4, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (LDST128_ABS_LO12_NC), /* name */
+ false, /* partial_inplace */
+ 0xff0, /* src_mask */
+ 0xff0, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Set a load-literal immediate field to bits
+ 0x1FFFFC of G(S)-P */
+ HOWTO (AARCH64_R (GOT_LD_PREL19), /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte,1 = short,2 = long) */
+ 19, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (GOT_LD_PREL19), /* name */
+ false, /* partial_inplace */
+ 0xffffe0, /* src_mask */
+ 0xffffe0, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* Get to the page for the GOT entry for the symbol
+ (G(S) - P) using an ADRP instruction. */
+ HOWTO (AARCH64_R (ADR_GOT_PAGE), /* type */
+ 12, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 21, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (ADR_GOT_PAGE), /* name */
+ false, /* partial_inplace */
+ 0x1fffff, /* src_mask */
+ 0x1fffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* LD64: GOT offset G(S) & 0xff8 */
+ HOWTO64 (AARCH64_R (LD64_GOT_LO12_NC), /* type */
+ 3, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (LD64_GOT_LO12_NC), /* name */
+ false, /* partial_inplace */
+ 0xff8, /* src_mask */
+ 0xff8, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* LD32: GOT offset G(S) & 0xffc */
+ HOWTO32 (AARCH64_R (LD32_GOT_LO12_NC), /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (LD32_GOT_LO12_NC), /* name */
+ false, /* partial_inplace */
+ 0xffc, /* src_mask */
+ 0xffc, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Lower 16 bits of GOT offset for the symbol. */
+ HOWTO64 (AARCH64_R (MOVW_GOTOFF_G0_NC), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (MOVW_GOTOFF_G0_NC), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Higher 16 bits of GOT offset for the symbol. */
+ HOWTO64 (AARCH64_R (MOVW_GOTOFF_G1), /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (MOVW_GOTOFF_G1), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* LD64: GOT offset for the symbol. */
+ HOWTO64 (AARCH64_R (LD64_GOTOFF_LO15), /* type */
+ 3, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (LD64_GOTOFF_LO15), /* name */
+ false, /* partial_inplace */
+ 0x7ff8, /* src_mask */
+ 0x7ff8, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* LD32: GOT offset to the page address of GOT table.
+ (G(S) - PAGE (_GLOBAL_OFFSET_TABLE_)) & 0x5ffc. */
+ HOWTO32 (AARCH64_R (LD32_GOTPAGE_LO14), /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (LD32_GOTPAGE_LO14), /* name */
+ false, /* partial_inplace */
+ 0x5ffc, /* src_mask */
+ 0x5ffc, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* LD64: GOT offset to the page address of GOT table.
+ (G(S) - PAGE (_GLOBAL_OFFSET_TABLE_)) & 0x7ff8. */
+ HOWTO64 (AARCH64_R (LD64_GOTPAGE_LO15), /* type */
+ 3, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (LD64_GOTPAGE_LO15), /* name */
+ false, /* partial_inplace */
+ 0x7ff8, /* src_mask */
+ 0x7ff8, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Get to the page for the GOT entry for the symbol
+ (G(S) - P) using an ADRP instruction. */
+ HOWTO (AARCH64_R (TLSGD_ADR_PAGE21), /* type */
+ 12, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 21, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSGD_ADR_PAGE21), /* name */
+ false, /* partial_inplace */
+ 0x1fffff, /* src_mask */
+ 0x1fffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ HOWTO (AARCH64_R (TLSGD_ADR_PREL21), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 21, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSGD_ADR_PREL21), /* name */
+ false, /* partial_inplace */
+ 0x1fffff, /* src_mask */
+ 0x1fffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* ADD: GOT offset G(S) & 0xff8 [no overflow check] */
+ HOWTO (AARCH64_R (TLSGD_ADD_LO12_NC), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSGD_ADD_LO12_NC), /* name */
+ false, /* partial_inplace */
+ 0xfff, /* src_mask */
+ 0xfff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Lower 16 bits of GOT offset to tls_index. */
+ HOWTO64 (AARCH64_R (TLSGD_MOVW_G0_NC), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSGD_MOVW_G0_NC), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Higher 16 bits of GOT offset to tls_index. */
+ HOWTO64 (AARCH64_R (TLSGD_MOVW_G1), /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSGD_MOVW_G1), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (AARCH64_R (TLSIE_ADR_GOTTPREL_PAGE21), /* type */
+ 12, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 21, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSIE_ADR_GOTTPREL_PAGE21), /* name */
+ false, /* partial_inplace */
+ 0x1fffff, /* src_mask */
+ 0x1fffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO64 (AARCH64_R (TLSIE_LD64_GOTTPREL_LO12_NC), /* type */
+ 3, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSIE_LD64_GOTTPREL_LO12_NC), /* name */
+ false, /* partial_inplace */
+ 0xff8, /* src_mask */
+ 0xff8, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO32 (AARCH64_R (TLSIE_LD32_GOTTPREL_LO12_NC), /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSIE_LD32_GOTTPREL_LO12_NC), /* name */
+ false, /* partial_inplace */
+ 0xffc, /* src_mask */
+ 0xffc, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (AARCH64_R (TLSIE_LD_GOTTPREL_PREL19), /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 19, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSIE_LD_GOTTPREL_PREL19), /* name */
+ false, /* partial_inplace */
+ 0x1ffffc, /* src_mask */
+ 0x1ffffc, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO64 (AARCH64_R (TLSIE_MOVW_GOTTPREL_G0_NC), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSIE_MOVW_GOTTPREL_G0_NC), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO64 (AARCH64_R (TLSIE_MOVW_GOTTPREL_G1), /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSIE_MOVW_GOTTPREL_G1), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* ADD: bit[23:12] of byte offset to module TLS base address. */
+ HOWTO (AARCH64_R (TLSLD_ADD_DTPREL_HI12), /* type */
+ 12, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLD_ADD_DTPREL_HI12), /* name */
+ false, /* partial_inplace */
+ 0xfff, /* src_mask */
+ 0xfff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Unsigned 12 bit byte offset to module TLS base address. */
+ HOWTO (AARCH64_R (TLSLD_ADD_DTPREL_LO12), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLD_ADD_DTPREL_LO12), /* name */
+ false, /* partial_inplace */
+ 0xfff, /* src_mask */
+ 0xfff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* No overflow check version of BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12. */
+ HOWTO (AARCH64_R (TLSLD_ADD_DTPREL_LO12_NC), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLD_ADD_DTPREL_LO12_NC), /* name */
+ false, /* partial_inplace */
+ 0xfff, /* src_mask */
+ 0xfff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* ADD: GOT offset G(S) & 0xff8 [no overflow check] */
+ HOWTO (AARCH64_R (TLSLD_ADD_LO12_NC), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLD_ADD_LO12_NC), /* name */
+ false, /* partial_inplace */
+ 0xfff, /* src_mask */
+ 0xfff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Get to the page for the GOT entry for the symbol
+ (G(S) - P) using an ADRP instruction. */
+ HOWTO (AARCH64_R (TLSLD_ADR_PAGE21), /* type */
+ 12, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 21, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLD_ADR_PAGE21), /* name */
+ false, /* partial_inplace */
+ 0x1fffff, /* src_mask */
+ 0x1fffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ HOWTO (AARCH64_R (TLSLD_ADR_PREL21), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 21, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLD_ADR_PREL21), /* name */
+ false, /* partial_inplace */
+ 0x1fffff, /* src_mask */
+ 0x1fffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* LD/ST16: bit[11:1] of byte offset to module TLS base address. */
+ HOWTO64 (AARCH64_R (TLSLD_LDST16_DTPREL_LO12), /* type */
+ 1, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 11, /* bitsize */
+ false, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLD_LDST16_DTPREL_LO12), /* name */
+ false, /* partial_inplace */
+ 0x1ffc00, /* src_mask */
+ 0x1ffc00, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Same as BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12, but no overflow check. */
+ HOWTO64 (AARCH64_R (TLSLD_LDST16_DTPREL_LO12_NC), /* type */
+ 1, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 11, /* bitsize */
+ false, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLD_LDST16_DTPREL_LO12_NC), /* name */
+ false, /* partial_inplace */
+ 0x1ffc00, /* src_mask */
+ 0x1ffc00, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* LD/ST32: bit[11:2] of byte offset to module TLS base address. */
+ HOWTO64 (AARCH64_R (TLSLD_LDST32_DTPREL_LO12), /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 10, /* bitsize */
+ false, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLD_LDST32_DTPREL_LO12), /* name */
+ false, /* partial_inplace */
+ 0x3ffc00, /* src_mask */
+ 0x3ffc00, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Same as BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12, but no overflow check. */
+ HOWTO64 (AARCH64_R (TLSLD_LDST32_DTPREL_LO12_NC), /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 10, /* bitsize */
+ false, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLD_LDST32_DTPREL_LO12_NC), /* name */
+ false, /* partial_inplace */
+ 0xffc00, /* src_mask */
+ 0xffc00, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* LD/ST64: bit[11:3] of byte offset to module TLS base address. */
+ HOWTO64 (AARCH64_R (TLSLD_LDST64_DTPREL_LO12), /* type */
+ 3, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 9, /* bitsize */
+ false, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLD_LDST64_DTPREL_LO12), /* name */
+ false, /* partial_inplace */
+ 0x3ffc00, /* src_mask */
+ 0x3ffc00, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Same as BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12, but no overflow check. */
+ HOWTO64 (AARCH64_R (TLSLD_LDST64_DTPREL_LO12_NC), /* type */
+ 3, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 9, /* bitsize */
+ false, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLD_LDST64_DTPREL_LO12_NC), /* name */
+ false, /* partial_inplace */
+ 0x7fc00, /* src_mask */
+ 0x7fc00, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* LD/ST8: bit[11:0] of byte offset to module TLS base address. */
+ HOWTO64 (AARCH64_R (TLSLD_LDST8_DTPREL_LO12), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLD_LDST8_DTPREL_LO12), /* name */
+ false, /* partial_inplace */
+ 0x3ffc00, /* src_mask */
+ 0x3ffc00, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Same as BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12, but no overflow check. */
+ HOWTO64 (AARCH64_R (TLSLD_LDST8_DTPREL_LO12_NC), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLD_LDST8_DTPREL_LO12_NC), /* name */
+ false, /* partial_inplace */
+ 0x3ffc00, /* src_mask */
+ 0x3ffc00, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* MOVZ: bit[15:0] of byte offset to module TLS base address. */
+ HOWTO (AARCH64_R (TLSLD_MOVW_DTPREL_G0), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLD_MOVW_DTPREL_G0), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* No overflow check version of BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0. */
+ HOWTO (AARCH64_R (TLSLD_MOVW_DTPREL_G0_NC), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLD_MOVW_DTPREL_G0_NC), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* MOVZ: bit[31:16] of byte offset to module TLS base address. */
+ HOWTO (AARCH64_R (TLSLD_MOVW_DTPREL_G1), /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLD_MOVW_DTPREL_G1), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* No overflow check version of BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1. */
+ HOWTO64 (AARCH64_R (TLSLD_MOVW_DTPREL_G1_NC), /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLD_MOVW_DTPREL_G1_NC), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* MOVZ: bit[47:32] of byte offset to module TLS base address. */
+ HOWTO64 (AARCH64_R (TLSLD_MOVW_DTPREL_G2), /* type */
+ 32, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLD_MOVW_DTPREL_G2), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO64 (AARCH64_R (TLSLE_MOVW_TPREL_G2), /* type */
+ 32, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLE_MOVW_TPREL_G2), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (AARCH64_R (TLSLE_MOVW_TPREL_G1), /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLE_MOVW_TPREL_G1), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO64 (AARCH64_R (TLSLE_MOVW_TPREL_G1_NC), /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLE_MOVW_TPREL_G1_NC), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (AARCH64_R (TLSLE_MOVW_TPREL_G0), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLE_MOVW_TPREL_G0), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (AARCH64_R (TLSLE_MOVW_TPREL_G0_NC), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLE_MOVW_TPREL_G0_NC), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (AARCH64_R (TLSLE_ADD_TPREL_HI12), /* type */
+ 12, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLE_ADD_TPREL_HI12), /* name */
+ false, /* partial_inplace */
+ 0xfff, /* src_mask */
+ 0xfff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (AARCH64_R (TLSLE_ADD_TPREL_LO12), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLE_ADD_TPREL_LO12), /* name */
+ false, /* partial_inplace */
+ 0xfff, /* src_mask */
+ 0xfff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (AARCH64_R (TLSLE_ADD_TPREL_LO12_NC), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLE_ADD_TPREL_LO12_NC), /* name */
+ false, /* partial_inplace */
+ 0xfff, /* src_mask */
+ 0xfff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* LD/ST16: bit[11:1] of byte offset to module TLS base address. */
+ HOWTO (AARCH64_R (TLSLE_LDST16_TPREL_LO12), /* type */
+ 1, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 11, /* bitsize */
+ false, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLE_LDST16_TPREL_LO12), /* name */
+ false, /* partial_inplace */
+ 0x1ffc00, /* src_mask */
+ 0x1ffc00, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Same as BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12, but no overflow check. */
+ HOWTO (AARCH64_R (TLSLE_LDST16_TPREL_LO12_NC), /* type */
+ 1, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 11, /* bitsize */
+ false, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLE_LDST16_TPREL_LO12_NC), /* name */
+ false, /* partial_inplace */
+ 0x1ffc00, /* src_mask */
+ 0x1ffc00, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* LD/ST32: bit[11:2] of byte offset to module TLS base address. */
+ HOWTO (AARCH64_R (TLSLE_LDST32_TPREL_LO12), /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 10, /* bitsize */
+ false, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLE_LDST32_TPREL_LO12), /* name */
+ false, /* partial_inplace */
+ 0xffc00, /* src_mask */
+ 0xffc00, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Same as BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12, but no overflow check. */
+ HOWTO (AARCH64_R (TLSLE_LDST32_TPREL_LO12_NC), /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 10, /* bitsize */
+ false, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLE_LDST32_TPREL_LO12_NC), /* name */
+ false, /* partial_inplace */
+ 0xffc00, /* src_mask */
+ 0xffc00, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* LD/ST64: bit[11:3] of byte offset to module TLS base address. */
+ HOWTO (AARCH64_R (TLSLE_LDST64_TPREL_LO12), /* type */
+ 3, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 9, /* bitsize */
+ false, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLE_LDST64_TPREL_LO12), /* name */
+ false, /* partial_inplace */
+ 0x7fc00, /* src_mask */
+ 0x7fc00, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Same as BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12, but no overflow check. */
+ HOWTO (AARCH64_R (TLSLE_LDST64_TPREL_LO12_NC), /* type */
+ 3, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 9, /* bitsize */
+ false, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLE_LDST64_TPREL_LO12_NC), /* name */
+ false, /* partial_inplace */
+ 0x7fc00, /* src_mask */
+ 0x7fc00, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* LD/ST8: bit[11:0] of byte offset to module TLS base address. */
+ HOWTO (AARCH64_R (TLSLE_LDST8_TPREL_LO12), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLE_LDST8_TPREL_LO12), /* name */
+ false, /* partial_inplace */
+ 0x3ffc00, /* src_mask */
+ 0x3ffc00, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* Same as BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12, but no overflow check. */
+ HOWTO (AARCH64_R (TLSLE_LDST8_TPREL_LO12_NC), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 10, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSLE_LDST8_TPREL_LO12_NC), /* name */
+ false, /* partial_inplace */
+ 0x3ffc00, /* src_mask */
+ 0x3ffc00, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (AARCH64_R (TLSDESC_LD_PREL19), /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 19, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSDESC_LD_PREL19), /* name */
+ false, /* partial_inplace */
+ 0x0ffffe0, /* src_mask */
+ 0x0ffffe0, /* dst_mask */
+ true), /* pcrel_offset */
+
+ HOWTO (AARCH64_R (TLSDESC_ADR_PREL21), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 21, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSDESC_ADR_PREL21), /* name */
+ false, /* partial_inplace */
+ 0x1fffff, /* src_mask */
+ 0x1fffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* Get to the page for the GOT entry for the symbol
+ (G(S) - P) using an ADRP instruction. */
+ HOWTO (AARCH64_R (TLSDESC_ADR_PAGE21), /* type */
+ 12, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 21, /* bitsize */
+ true, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSDESC_ADR_PAGE21), /* name */
+ false, /* partial_inplace */
+ 0x1fffff, /* src_mask */
+ 0x1fffff, /* dst_mask */
+ true), /* pcrel_offset */
+
+ /* LD64: GOT offset G(S) & 0xff8. */
+ HOWTO64 (AARCH64_R (TLSDESC_LD64_LO12), /* type */
+ 3, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSDESC_LD64_LO12), /* name */
+ false, /* partial_inplace */
+ 0xff8, /* src_mask */
+ 0xff8, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* LD32: GOT offset G(S) & 0xffc. */
+ HOWTO32 (AARCH64_R (TLSDESC_LD32_LO12_NC), /* type */
+ 2, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSDESC_LD32_LO12_NC), /* name */
+ false, /* partial_inplace */
+ 0xffc, /* src_mask */
+ 0xffc, /* dst_mask */
+ false), /* pcrel_offset */
+
+ /* ADD: GOT offset G(S) & 0xfff. */
+ HOWTO (AARCH64_R (TLSDESC_ADD_LO12), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSDESC_ADD_LO12), /* name */
+ false, /* partial_inplace */
+ 0xfff, /* src_mask */
+ 0xfff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO64 (AARCH64_R (TLSDESC_OFF_G1), /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_unsigned, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSDESC_OFF_G1), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO64 (AARCH64_R (TLSDESC_OFF_G0_NC), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSDESC_OFF_G0_NC), /* name */
+ false, /* partial_inplace */
+ 0xffff, /* src_mask */
+ 0xffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO64 (AARCH64_R (TLSDESC_LDR), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSDESC_LDR), /* name */
+ false, /* partial_inplace */
+ 0x0, /* src_mask */
+ 0x0, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO64 (AARCH64_R (TLSDESC_ADD), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 12, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSDESC_ADD), /* name */
+ false, /* partial_inplace */
+ 0x0, /* src_mask */
+ 0x0, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (AARCH64_R (TLSDESC_CALL), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSDESC_CALL), /* name */
+ false, /* partial_inplace */
+ 0x0, /* src_mask */
+ 0x0, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (AARCH64_R (COPY), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (COPY), /* name */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (AARCH64_R (GLOB_DAT), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (GLOB_DAT), /* name */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (AARCH64_R (JUMP_SLOT), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (JUMP_SLOT), /* name */
+ true, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (AARCH64_R (RELATIVE), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (RELATIVE), /* name */
+ true, /* partial_inplace */
+ ALL_ONES, /* src_mask */
+ ALL_ONES, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (AARCH64_R (TLS_DTPMOD), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+#if ARCH_SIZE == 64
+ AARCH64_R_STR (TLS_DTPMOD64), /* name */
+#else
+ AARCH64_R_STR (TLS_DTPMOD), /* name */
+#endif
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ ALL_ONES, /* dst_mask */
+ false), /* pc_reloffset */
+
+ HOWTO (AARCH64_R (TLS_DTPREL), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+#if ARCH_SIZE == 64
+ AARCH64_R_STR (TLS_DTPREL64), /* name */
+#else
+ AARCH64_R_STR (TLS_DTPREL), /* name */
+#endif
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ ALL_ONES, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (AARCH64_R (TLS_TPREL), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+#if ARCH_SIZE == 64
+ AARCH64_R_STR (TLS_TPREL64), /* name */
+#else
+ AARCH64_R_STR (TLS_TPREL), /* name */
+#endif
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ ALL_ONES, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (AARCH64_R (TLSDESC), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (TLSDESC), /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ ALL_ONES, /* dst_mask */
+ false), /* pcrel_offset */
+
+ HOWTO (AARCH64_R (IRELATIVE), /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ AARCH64_R_STR (IRELATIVE), /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ ALL_ONES, /* dst_mask */
+ false), /* pcrel_offset */
+
+ EMPTY_HOWTO (0),
+};
+
+static reloc_howto_type elfNN_aarch64_howto_none =
+ HOWTO (R_AARCH64_NONE, /* type */
+ 0, /* rightshift */
+ 3, /* size (0 = byte, 1 = short, 2 = long) */
+ 0, /* bitsize */
+ false, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_AARCH64_NONE", /* name */
+ false, /* partial_inplace */
+ 0, /* src_mask */
+ 0, /* dst_mask */
+ false); /* pcrel_offset */
+
+/* Given HOWTO, return the bfd internal relocation enumerator. */
+
+static bfd_reloc_code_real_type
+elfNN_aarch64_bfd_reloc_from_howto (reloc_howto_type *howto)
+{
+ const int size
+ = (int) ARRAY_SIZE (elfNN_aarch64_howto_table);
+ const ptrdiff_t offset
+ = howto - elfNN_aarch64_howto_table;
+
+ if (offset > 0 && offset < size - 1)
+ return BFD_RELOC_AARCH64_RELOC_START + offset;
+
+ if (howto == &elfNN_aarch64_howto_none)
+ return BFD_RELOC_AARCH64_NONE;
+
+ return BFD_RELOC_AARCH64_RELOC_START;
+}
+
+/* Given R_TYPE, return the bfd internal relocation enumerator. */
+
+static bfd_reloc_code_real_type
+elfNN_aarch64_bfd_reloc_from_type (bfd *abfd, unsigned int r_type)
+{
+ static bool initialized_p = false;
+ /* Indexed by R_TYPE, values are offsets in the howto_table. */
+ static unsigned int offsets[R_AARCH64_end];
+
+ if (!initialized_p)
+ {
+ unsigned int i;
+
+ for (i = 1; i < ARRAY_SIZE (elfNN_aarch64_howto_table) - 1; ++i)
+ if (elfNN_aarch64_howto_table[i].type != 0)
+ offsets[elfNN_aarch64_howto_table[i].type] = i;
+
+ initialized_p = true;
+ }
+
+ if (r_type == R_AARCH64_NONE || r_type == R_AARCH64_NULL)
+ return BFD_RELOC_AARCH64_NONE;
+
+ /* PR 17512: file: b371e70a. */
+ if (r_type >= R_AARCH64_end)
+ {
+ _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
+ abfd, r_type);
+ bfd_set_error (bfd_error_bad_value);
+ return BFD_RELOC_AARCH64_NONE;
+ }
+
+ return BFD_RELOC_AARCH64_RELOC_START + offsets[r_type];
+}
+
+struct elf_aarch64_reloc_map
+{
+ bfd_reloc_code_real_type from;
+ bfd_reloc_code_real_type to;
+};
+
+/* Map bfd generic reloc to AArch64-specific reloc. */
+static const struct elf_aarch64_reloc_map elf_aarch64_reloc_map[] =
+{
+ {BFD_RELOC_NONE, BFD_RELOC_AARCH64_NONE},
+
+ /* Basic data relocations. */
+ {BFD_RELOC_CTOR, BFD_RELOC_AARCH64_NN},
+ {BFD_RELOC_64, BFD_RELOC_AARCH64_64},
+ {BFD_RELOC_32, BFD_RELOC_AARCH64_32},
+ {BFD_RELOC_16, BFD_RELOC_AARCH64_16},
+ {BFD_RELOC_64_PCREL, BFD_RELOC_AARCH64_64_PCREL},
+ {BFD_RELOC_32_PCREL, BFD_RELOC_AARCH64_32_PCREL},
+ {BFD_RELOC_16_PCREL, BFD_RELOC_AARCH64_16_PCREL},
+};
+
+/* Given the bfd internal relocation enumerator in CODE, return the
+ corresponding howto entry. */
+
+static reloc_howto_type *
+elfNN_aarch64_howto_from_bfd_reloc (bfd_reloc_code_real_type code)
+{
+ unsigned int i;
+
+ /* Convert bfd generic reloc to AArch64-specific reloc. */
+ if (code < BFD_RELOC_AARCH64_RELOC_START
+ || code > BFD_RELOC_AARCH64_RELOC_END)
+ for (i = 0; i < ARRAY_SIZE (elf_aarch64_reloc_map); i++)
+ if (elf_aarch64_reloc_map[i].from == code)
+ {
+ code = elf_aarch64_reloc_map[i].to;
+ break;
+ }
+
+ if (code > BFD_RELOC_AARCH64_RELOC_START
+ && code < BFD_RELOC_AARCH64_RELOC_END)
+ if (elfNN_aarch64_howto_table[code - BFD_RELOC_AARCH64_RELOC_START].type)
+ return &elfNN_aarch64_howto_table[code - BFD_RELOC_AARCH64_RELOC_START];
+
+ if (code == BFD_RELOC_AARCH64_NONE)
+ return &elfNN_aarch64_howto_none;
+
+ return NULL;
+}
+
+static reloc_howto_type *
+elfNN_aarch64_howto_from_type (bfd *abfd, unsigned int r_type)
+{
+ bfd_reloc_code_real_type val;
+ reloc_howto_type *howto;
+
+#if ARCH_SIZE == 32
+ if (r_type > 256)
+ {
+ bfd_set_error (bfd_error_bad_value);
+ return NULL;
+ }
+#endif
+
+ if (r_type == R_AARCH64_NONE)
+ return &elfNN_aarch64_howto_none;
+
+ val = elfNN_aarch64_bfd_reloc_from_type (abfd, r_type);
+ howto = elfNN_aarch64_howto_from_bfd_reloc (val);
+
+ if (howto != NULL)
+ return howto;
+
+ bfd_set_error (bfd_error_bad_value);
+ return NULL;
+}
+
+static bool
+elfNN_aarch64_info_to_howto (bfd *abfd, arelent *bfd_reloc,
+ Elf_Internal_Rela *elf_reloc)
+{
+ unsigned int r_type;
+
+ r_type = ELFNN_R_TYPE (elf_reloc->r_info);
+ bfd_reloc->howto = elfNN_aarch64_howto_from_type (abfd, r_type);
+
+ if (bfd_reloc->howto == NULL)
+ {
+ /* xgettext:c-format */
+ _bfd_error_handler (_("%pB: unsupported relocation type %#x"), abfd, r_type);
+ return false;
+ }
+ return true;
+}
+
+static reloc_howto_type *
+elfNN_aarch64_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_reloc_code_real_type code)
+{
+ reloc_howto_type *howto = elfNN_aarch64_howto_from_bfd_reloc (code);
+
+ if (howto != NULL)
+ return howto;
+
+ bfd_set_error (bfd_error_bad_value);
+ return NULL;
+}
+
+static reloc_howto_type *
+elfNN_aarch64_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
+ const char *r_name)
+{
+ unsigned int i;
+
+ for (i = 1; i < ARRAY_SIZE (elfNN_aarch64_howto_table) - 1; ++i)
+ if (elfNN_aarch64_howto_table[i].name != NULL
+ && strcasecmp (elfNN_aarch64_howto_table[i].name, r_name) == 0)
+ return &elfNN_aarch64_howto_table[i];
+
+ return NULL;
+}
+
+#define TARGET_LITTLE_SYM aarch64_elfNN_le_vec
+#define TARGET_LITTLE_NAME "elfNN-littleaarch64"
+#define TARGET_BIG_SYM aarch64_elfNN_be_vec
+#define TARGET_BIG_NAME "elfNN-bigaarch64"
+
+/* The linker script knows the section names for placement.
+ The entry_names are used to do simple name mangling on the stubs.
+ Given a function name, and its type, the stub can be found. The
+ name can be changed. The only requirement is the %s be present. */
+#define STUB_ENTRY_NAME "__%s_veneer"
+
+/* The name of the dynamic interpreter. This is put in the .interp
+ section. */
+#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1"
+
+#define AARCH64_MAX_FWD_BRANCH_OFFSET \
+ (((1 << 25) - 1) << 2)
+#define AARCH64_MAX_BWD_BRANCH_OFFSET \
+ (-((1 << 25) << 2))
+
+#define AARCH64_MAX_ADRP_IMM ((1 << 20) - 1)
+#define AARCH64_MIN_ADRP_IMM (-(1 << 20))
+
+static int
+aarch64_valid_for_adrp_p (bfd_vma value, bfd_vma place)
+{
+ bfd_signed_vma offset = (bfd_signed_vma) (PG (value) - PG (place)) >> 12;
+ return offset <= AARCH64_MAX_ADRP_IMM && offset >= AARCH64_MIN_ADRP_IMM;
+}
+
+static int
+aarch64_valid_branch_p (bfd_vma value, bfd_vma place)
+{
+ bfd_signed_vma offset = (bfd_signed_vma) (value - place);
+ return (offset <= AARCH64_MAX_FWD_BRANCH_OFFSET
+ && offset >= AARCH64_MAX_BWD_BRANCH_OFFSET);
+}
+
+static const uint32_t aarch64_adrp_branch_stub [] =
+{
+ 0x90000010, /* adrp ip0, X */
+ /* R_AARCH64_ADR_HI21_PCREL(X) */
+ 0x91000210, /* add ip0, ip0, :lo12:X */
+ /* R_AARCH64_ADD_ABS_LO12_NC(X) */
+ 0xd61f0200, /* br ip0 */
+};
+
+static const uint32_t aarch64_long_branch_stub[] =
+{
+#if ARCH_SIZE == 64
+ 0x58000090, /* ldr ip0, 1f */
+#else
+ 0x18000090, /* ldr wip0, 1f */
+#endif
+ 0x10000011, /* adr ip1, #0 */
+ 0x8b110210, /* add ip0, ip0, ip1 */
+ 0xd61f0200, /* br ip0 */
+ 0x00000000, /* 1: .xword or .word
+ R_AARCH64_PRELNN(X) + 12
+ */
+ 0x00000000,
+};
+
+static const uint32_t aarch64_erratum_835769_stub[] =
+{
+ 0x00000000, /* Placeholder for multiply accumulate. */
+ 0x14000000, /* b <label> */
+};
+
+static const uint32_t aarch64_erratum_843419_stub[] =
+{
+ 0x00000000, /* Placeholder for LDR instruction. */
+ 0x14000000, /* b <label> */
+};
+
+/* Section name for stubs is the associated section name plus this
+ string. */
+#define STUB_SUFFIX ".stub"
+
+enum elf_aarch64_stub_type
+{
+ aarch64_stub_none,
+ aarch64_stub_adrp_branch,
+ aarch64_stub_long_branch,
+ aarch64_stub_erratum_835769_veneer,
+ aarch64_stub_erratum_843419_veneer,
+};
+
+struct elf_aarch64_stub_hash_entry
+{
+ /* Base hash table entry structure. */
+ struct bfd_hash_entry root;
+
+ /* The stub section. */
+ asection *stub_sec;
+
+ /* Offset within stub_sec of the beginning of this stub. */
+ bfd_vma stub_offset;
+
+ /* Given the symbol's value and its section we can determine its final
+ value when building the stubs (so the stub knows where to jump). */
+ bfd_vma target_value;
+ asection *target_section;
+
+ enum elf_aarch64_stub_type stub_type;
+
+ /* The symbol table entry, if any, that this was derived from. */
+ struct elf_aarch64_link_hash_entry *h;
+
+ /* Destination symbol type */
+ unsigned char st_type;
+
+ /* Where this stub is being called from, or, in the case of combined
+ stub sections, the first input section in the group. */
+ asection *id_sec;
+
+ /* The name for the local symbol at the start of this stub. The
+ stub name in the hash table has to be unique; this does not, so
+ it can be friendlier. */
+ char *output_name;
+
+ /* The instruction which caused this stub to be generated (only valid for
+ erratum 835769 workaround stubs at present). */
+ uint32_t veneered_insn;
+
+ /* In an erratum 843419 workaround stub, the ADRP instruction offset. */
+ bfd_vma adrp_offset;
+};
+
+/* Used to build a map of a section. This is required for mixed-endian
+ code/data. */
+
+typedef struct elf_elf_section_map
+{
+ bfd_vma vma;
+ char type;
+}
+elf_aarch64_section_map;
+
+
+typedef struct _aarch64_elf_section_data
+{
+ struct bfd_elf_section_data elf;
+ unsigned int mapcount;
+ unsigned int mapsize;
+ elf_aarch64_section_map *map;
+}
+_aarch64_elf_section_data;
+
+#define elf_aarch64_section_data(sec) \
+ ((_aarch64_elf_section_data *) elf_section_data (sec))
+
+/* The size of the thread control block which is defined to be two pointers. */
+#define TCB_SIZE (ARCH_SIZE/8)*2
+
+struct elf_aarch64_local_symbol
+{
+ unsigned int got_type;
+ bfd_signed_vma got_refcount;
+ bfd_vma got_offset;
+
+ /* Offset of the GOTPLT entry reserved for the TLS descriptor. The
+ offset is from the end of the jump table and reserved entries
+ within the PLTGOT.
+
+ The magic value (bfd_vma) -1 indicates that an offset has not be
+ allocated. */
+ bfd_vma tlsdesc_got_jump_table_offset;
+};
+
+struct elf_aarch64_obj_tdata
+{
+ struct elf_obj_tdata root;
+
+ /* local symbol descriptors */
+ struct elf_aarch64_local_symbol *locals;
+
+ /* Zero to warn when linking objects with incompatible enum sizes. */
+ int no_enum_size_warning;
+
+ /* Zero to warn when linking objects with incompatible wchar_t sizes. */
+ int no_wchar_size_warning;
+
+ /* All GNU_PROPERTY_AARCH64_FEATURE_1_AND properties. */
+ uint32_t gnu_and_prop;
+
+ /* Zero to warn when linking objects with incompatible
+ GNU_PROPERTY_AARCH64_FEATURE_1_BTI. */
+ int no_bti_warn;
+
+ /* PLT type based on security. */
+ aarch64_plt_type plt_type;
+};
+
+#define elf_aarch64_tdata(bfd) \
+ ((struct elf_aarch64_obj_tdata *) (bfd)->tdata.any)
+
+#define elf_aarch64_locals(bfd) (elf_aarch64_tdata (bfd)->locals)
+
+#define is_aarch64_elf(bfd) \
+ (bfd_get_flavour (bfd) == bfd_target_elf_flavour \
+ && elf_tdata (bfd) != NULL \
+ && elf_object_id (bfd) == AARCH64_ELF_DATA)
+
+static bool
+elfNN_aarch64_mkobject (bfd *abfd)
+{
+ return bfd_elf_allocate_object (abfd, sizeof (struct elf_aarch64_obj_tdata),
+ AARCH64_ELF_DATA);
+}
+
+#define elf_aarch64_hash_entry(ent) \
+ ((struct elf_aarch64_link_hash_entry *)(ent))
+
+#define GOT_UNKNOWN 0
+#define GOT_NORMAL 1
+#define GOT_TLS_GD 2
+#define GOT_TLS_IE 4
+#define GOT_TLSDESC_GD 8
+
+#define GOT_TLS_GD_ANY_P(type) ((type & GOT_TLS_GD) || (type & GOT_TLSDESC_GD))
+
+/* AArch64 ELF linker hash entry. */
+struct elf_aarch64_link_hash_entry
+{
+ struct elf_link_hash_entry root;
+
+ /* Since PLT entries have variable size, we need to record the
+ index into .got.plt instead of recomputing it from the PLT
+ offset. */
+ bfd_signed_vma plt_got_offset;
+
+ /* Bit mask representing the type of GOT entry(s) if any required by
+ this symbol. */
+ unsigned int got_type;
+
+ /* A pointer to the most recently used stub hash entry against this
+ symbol. */
+ struct elf_aarch64_stub_hash_entry *stub_cache;
+
+ /* Offset of the GOTPLT entry reserved for the TLS descriptor. The offset
+ is from the end of the jump table and reserved entries within the PLTGOT.
+
+ The magic value (bfd_vma) -1 indicates that an offset has not
+ be allocated. */
+ bfd_vma tlsdesc_got_jump_table_offset;
+};
+
+static unsigned int
+elfNN_aarch64_symbol_got_type (struct elf_link_hash_entry *h,
+ bfd *abfd,
+ unsigned long r_symndx)
+{
+ if (h)
+ return elf_aarch64_hash_entry (h)->got_type;
+
+ if (! elf_aarch64_locals (abfd))
+ return GOT_UNKNOWN;
+
+ return elf_aarch64_locals (abfd)[r_symndx].got_type;
+}
+
+/* Get the AArch64 elf linker hash table from a link_info structure. */
+#define elf_aarch64_hash_table(info) \
+ ((struct elf_aarch64_link_hash_table *) ((info)->hash))
+
+#define aarch64_stub_hash_lookup(table, string, create, copy) \
+ ((struct elf_aarch64_stub_hash_entry *) \
+ bfd_hash_lookup ((table), (string), (create), (copy)))
+
+/* AArch64 ELF linker hash table. */
+struct elf_aarch64_link_hash_table
+{
+ /* The main hash table. */
+ struct elf_link_hash_table root;
+
+ /* Nonzero to force PIC branch veneers. */
+ int pic_veneer;
+
+ /* Fix erratum 835769. */
+ int fix_erratum_835769;
+
+ /* Fix erratum 843419. */
+ erratum_84319_opts fix_erratum_843419;
+
+ /* Don't apply link-time values for dynamic relocations. */
+ int no_apply_dynamic_relocs;
+
+ /* The number of bytes in the initial entry in the PLT. */
+ bfd_size_type plt_header_size;
+
+ /* The bytes of the initial PLT entry. */
+ const bfd_byte *plt0_entry;
+
+ /* The number of bytes in the subsequent PLT entries. */
+ bfd_size_type plt_entry_size;
+
+ /* The bytes of the subsequent PLT entry. */
+ const bfd_byte *plt_entry;
+
+ /* For convenience in allocate_dynrelocs. */
+ bfd *obfd;
+
+ /* The amount of space used by the reserved portion of the sgotplt
+ section, plus whatever space is used by the jump slots. */
+ bfd_vma sgotplt_jump_table_size;
+
+ /* The stub hash table. */
+ struct bfd_hash_table stub_hash_table;
+
+ /* Linker stub bfd. */
+ bfd *stub_bfd;
+
+ /* Linker call-backs. */
+ asection *(*add_stub_section) (const char *, asection *);
+ void (*layout_sections_again) (void);
+
+ /* Array to keep track of which stub sections have been created, and
+ information on stub grouping. */
+ struct map_stub
+ {
+ /* This is the section to which stubs in the group will be
+ attached. */
+ asection *link_sec;
+ /* The stub section. */
+ asection *stub_sec;
+ } *stub_group;
+
+ /* Assorted information used by elfNN_aarch64_size_stubs. */
+ unsigned int bfd_count;
+ unsigned int top_index;
+ asection **input_list;
+
+ /* JUMP_SLOT relocs for variant PCS symbols may be present. */
+ int variant_pcs;
+
+ /* The number of bytes in the PLT enty for the TLS descriptor. */
+ bfd_size_type tlsdesc_plt_entry_size;
+
+ /* Used by local STT_GNU_IFUNC symbols. */
+ htab_t loc_hash_table;
+ void * loc_hash_memory;
+};
+
+/* Create an entry in an AArch64 ELF linker hash table. */
+
+static struct bfd_hash_entry *
+elfNN_aarch64_link_hash_newfunc (struct bfd_hash_entry *entry,
+ struct bfd_hash_table *table,
+ const char *string)
+{
+ struct elf_aarch64_link_hash_entry *ret =
+ (struct elf_aarch64_link_hash_entry *) entry;
+
+ /* Allocate the structure if it has not already been allocated by a
+ subclass. */
+ if (ret == NULL)
+ ret = bfd_hash_allocate (table,
+ sizeof (struct elf_aarch64_link_hash_entry));
+ if (ret == NULL)
+ return (struct bfd_hash_entry *) ret;
+
+ /* Call the allocation method of the superclass. */
+ ret = ((struct elf_aarch64_link_hash_entry *)
+ _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret,
+ table, string));
+ if (ret != NULL)
+ {
+ ret->got_type = GOT_UNKNOWN;
+ ret->plt_got_offset = (bfd_vma) - 1;
+ ret->stub_cache = NULL;
+ ret->tlsdesc_got_jump_table_offset = (bfd_vma) - 1;
+ }
+
+ return (struct bfd_hash_entry *) ret;
+}
+
+/* Initialize an entry in the stub hash table. */
+
+static struct bfd_hash_entry *
+stub_hash_newfunc (struct bfd_hash_entry *entry,
+ struct bfd_hash_table *table, const char *string)
+{
+ /* Allocate the structure if it has not already been allocated by a
+ subclass. */
+ if (entry == NULL)
+ {
+ entry = bfd_hash_allocate (table,
+ sizeof (struct
+ elf_aarch64_stub_hash_entry));
+ if (entry == NULL)
+ return entry;
+ }
+
+ /* Call the allocation method of the superclass. */
+ entry = bfd_hash_newfunc (entry, table, string);
+ if (entry != NULL)
+ {
+ struct elf_aarch64_stub_hash_entry *eh;
+
+ /* Initialize the local fields. */
+ eh = (struct elf_aarch64_stub_hash_entry *) entry;
+ eh->adrp_offset = 0;
+ eh->stub_sec = NULL;
+ eh->stub_offset = 0;
+ eh->target_value = 0;
+ eh->target_section = NULL;
+ eh->stub_type = aarch64_stub_none;
+ eh->h = NULL;
+ eh->id_sec = NULL;
+ }
+
+ return entry;
+}
+
+/* Compute a hash of a local hash entry. We use elf_link_hash_entry
+ for local symbol so that we can handle local STT_GNU_IFUNC symbols
+ as global symbol. We reuse indx and dynstr_index for local symbol
+ hash since they aren't used by global symbols in this backend. */
+
+static hashval_t
+elfNN_aarch64_local_htab_hash (const void *ptr)
+{
+ struct elf_link_hash_entry *h
+ = (struct elf_link_hash_entry *) ptr;
+ return ELF_LOCAL_SYMBOL_HASH (h->indx, h->dynstr_index);
+}
+
+/* Compare local hash entries. */
+
+static int
+elfNN_aarch64_local_htab_eq (const void *ptr1, const void *ptr2)
+{
+ struct elf_link_hash_entry *h1
+ = (struct elf_link_hash_entry *) ptr1;
+ struct elf_link_hash_entry *h2
+ = (struct elf_link_hash_entry *) ptr2;
+
+ return h1->indx == h2->indx && h1->dynstr_index == h2->dynstr_index;
+}
+
+/* Find and/or create a hash entry for local symbol. */
+
+static struct elf_link_hash_entry *
+elfNN_aarch64_get_local_sym_hash (struct elf_aarch64_link_hash_table *htab,
+ bfd *abfd, const Elf_Internal_Rela *rel,
+ bool create)
+{
+ struct elf_aarch64_link_hash_entry e, *ret;
+ asection *sec = abfd->sections;
+ hashval_t h = ELF_LOCAL_SYMBOL_HASH (sec->id,
+ ELFNN_R_SYM (rel->r_info));
+ void **slot;
+
+ e.root.indx = sec->id;
+ e.root.dynstr_index = ELFNN_R_SYM (rel->r_info);
+ slot = htab_find_slot_with_hash (htab->loc_hash_table, &e, h,
+ create ? INSERT : NO_INSERT);
+
+ if (!slot)
+ return NULL;
+
+ if (*slot)
+ {
+ ret = (struct elf_aarch64_link_hash_entry *) *slot;
+ return &ret->root;
+ }
+
+ ret = (struct elf_aarch64_link_hash_entry *)
+ objalloc_alloc ((struct objalloc *) htab->loc_hash_memory,
+ sizeof (struct elf_aarch64_link_hash_entry));
+ if (ret)
+ {
+ memset (ret, 0, sizeof (*ret));
+ ret->root.indx = sec->id;
+ ret->root.dynstr_index = ELFNN_R_SYM (rel->r_info);
+ ret->root.dynindx = -1;
+ *slot = ret;
+ }
+ return &ret->root;
+}
+
+/* Copy the extra info we tack onto an elf_link_hash_entry. */
+
+static void
+elfNN_aarch64_copy_indirect_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *dir,
+ struct elf_link_hash_entry *ind)
+{
+ struct elf_aarch64_link_hash_entry *edir, *eind;
+
+ edir = (struct elf_aarch64_link_hash_entry *) dir;
+ eind = (struct elf_aarch64_link_hash_entry *) ind;
+
+ if (ind->root.type == bfd_link_hash_indirect)
+ {
+ /* Copy over PLT info. */
+ if (dir->got.refcount <= 0)
+ {
+ edir->got_type = eind->got_type;
+ eind->got_type = GOT_UNKNOWN;
+ }
+ }
+
+ _bfd_elf_link_hash_copy_indirect (info, dir, ind);
+}
+
+/* Merge non-visibility st_other attributes. */
+
+static void
+elfNN_aarch64_merge_symbol_attribute (struct elf_link_hash_entry *h,
+ unsigned int st_other,
+ bool definition ATTRIBUTE_UNUSED,
+ bool dynamic ATTRIBUTE_UNUSED)
+{
+ unsigned int isym_sto = st_other & ~ELF_ST_VISIBILITY (-1);
+ unsigned int h_sto = h->other & ~ELF_ST_VISIBILITY (-1);
+
+ if (isym_sto == h_sto)
+ return;
+
+ if (isym_sto & ~STO_AARCH64_VARIANT_PCS)
+ /* Not fatal, this callback cannot fail. */
+ _bfd_error_handler (_("unknown attribute for symbol `%s': 0x%02x"),
+ h->root.root.string, isym_sto);
+
+ /* Note: Ideally we would warn about any attribute mismatch, but
+ this api does not allow that without substantial changes. */
+ if (isym_sto & STO_AARCH64_VARIANT_PCS)
+ h->other |= STO_AARCH64_VARIANT_PCS;
+}
+
+/* Destroy an AArch64 elf linker hash table. */
+
+static void
+elfNN_aarch64_link_hash_table_free (bfd *obfd)
+{
+ struct elf_aarch64_link_hash_table *ret
+ = (struct elf_aarch64_link_hash_table *) obfd->link.hash;
+
+ if (ret->loc_hash_table)
+ htab_delete (ret->loc_hash_table);
+ if (ret->loc_hash_memory)
+ objalloc_free ((struct objalloc *) ret->loc_hash_memory);
+
+ bfd_hash_table_free (&ret->stub_hash_table);
+ _bfd_elf_link_hash_table_free (obfd);
+}
+
+/* Create an AArch64 elf linker hash table. */
+
+static struct bfd_link_hash_table *
+elfNN_aarch64_link_hash_table_create (bfd *abfd)
+{
+ struct elf_aarch64_link_hash_table *ret;
+ size_t amt = sizeof (struct elf_aarch64_link_hash_table);
+
+ ret = bfd_zmalloc (amt);
+ if (ret == NULL)
+ return NULL;
+
+ if (!_bfd_elf_link_hash_table_init
+ (&ret->root, abfd, elfNN_aarch64_link_hash_newfunc,
+ sizeof (struct elf_aarch64_link_hash_entry), AARCH64_ELF_DATA))
+ {
+ free (ret);
+ return NULL;
+ }
+
+ ret->plt_header_size = PLT_ENTRY_SIZE;
+ ret->plt0_entry = elfNN_aarch64_small_plt0_entry;
+ ret->plt_entry_size = PLT_SMALL_ENTRY_SIZE;
+ ret->plt_entry = elfNN_aarch64_small_plt_entry;
+ ret->tlsdesc_plt_entry_size = PLT_TLSDESC_ENTRY_SIZE;
+ ret->obfd = abfd;
+ ret->root.tlsdesc_got = (bfd_vma) - 1;
+
+ if (!bfd_hash_table_init (&ret->stub_hash_table, stub_hash_newfunc,
+ sizeof (struct elf_aarch64_stub_hash_entry)))
+ {
+ _bfd_elf_link_hash_table_free (abfd);
+ return NULL;
+ }
+
+ ret->loc_hash_table = htab_try_create (1024,
+ elfNN_aarch64_local_htab_hash,
+ elfNN_aarch64_local_htab_eq,
+ NULL);
+ ret->loc_hash_memory = objalloc_create ();
+ if (!ret->loc_hash_table || !ret->loc_hash_memory)
+ {
+ elfNN_aarch64_link_hash_table_free (abfd);
+ return NULL;
+ }
+ ret->root.root.hash_table_free = elfNN_aarch64_link_hash_table_free;
+
+ return &ret->root.root;
+}
+
+/* Perform relocation R_TYPE. Returns TRUE upon success, FALSE otherwise. */
+
+static bool
+aarch64_relocate (unsigned int r_type, bfd *input_bfd, asection *input_section,
+ bfd_vma offset, bfd_vma value)
+{
+ reloc_howto_type *howto;
+ bfd_vma place;
+
+ howto = elfNN_aarch64_howto_from_type (input_bfd, r_type);
+ place = (input_section->output_section->vma + input_section->output_offset
+ + offset);
+
+ r_type = elfNN_aarch64_bfd_reloc_from_type (input_bfd, r_type);
+ value = _bfd_aarch64_elf_resolve_relocation (input_bfd, r_type, place,
+ value, 0, false);
+ return _bfd_aarch64_elf_put_addend (input_bfd,
+ input_section->contents + offset, r_type,
+ howto, value) == bfd_reloc_ok;
+}
+
+static enum elf_aarch64_stub_type
+aarch64_select_branch_stub (bfd_vma value, bfd_vma place)
+{
+ if (aarch64_valid_for_adrp_p (value, place))
+ return aarch64_stub_adrp_branch;
+ return aarch64_stub_long_branch;
+}
+
+/* Determine the type of stub needed, if any, for a call. */
+
+static enum elf_aarch64_stub_type
+aarch64_type_of_stub (asection *input_sec,
+ const Elf_Internal_Rela *rel,
+ asection *sym_sec,
+ unsigned char st_type,
+ bfd_vma destination)
+{
+ bfd_vma location;
+ bfd_signed_vma branch_offset;
+ unsigned int r_type;
+ enum elf_aarch64_stub_type stub_type = aarch64_stub_none;
+
+ if (st_type != STT_FUNC
+ && (sym_sec == input_sec))
+ return stub_type;
+
+ /* Determine where the call point is. */
+ location = (input_sec->output_offset
+ + input_sec->output_section->vma + rel->r_offset);
+
+ branch_offset = (bfd_signed_vma) (destination - location);
+
+ r_type = ELFNN_R_TYPE (rel->r_info);
+
+ /* We don't want to redirect any old unconditional jump in this way,
+ only one which is being used for a sibcall, where it is
+ acceptable for the IP0 and IP1 registers to be clobbered. */
+ if ((r_type == AARCH64_R (CALL26) || r_type == AARCH64_R (JUMP26))
+ && (branch_offset > AARCH64_MAX_FWD_BRANCH_OFFSET
+ || branch_offset < AARCH64_MAX_BWD_BRANCH_OFFSET))
+ {
+ stub_type = aarch64_stub_long_branch;
+ }
+
+ return stub_type;
+}
+
+/* Build a name for an entry in the stub hash table. */
+
+static char *
+elfNN_aarch64_stub_name (const asection *input_section,
+ const asection *sym_sec,
+ const struct elf_aarch64_link_hash_entry *hash,
+ const Elf_Internal_Rela *rel)
+{
+ char *stub_name;
+ bfd_size_type len;
+
+ if (hash)
+ {
+ len = 8 + 1 + strlen (hash->root.root.root.string) + 1 + 16 + 1;
+ stub_name = bfd_malloc (len);
+ if (stub_name != NULL)
+ snprintf (stub_name, len, "%08x_%s+%" BFD_VMA_FMT "x",
+ (unsigned int) input_section->id,
+ hash->root.root.root.string,
+ rel->r_addend);
+ }
+ else
+ {
+ len = 8 + 1 + 8 + 1 + 8 + 1 + 16 + 1;
+ stub_name = bfd_malloc (len);
+ if (stub_name != NULL)
+ snprintf (stub_name, len, "%08x_%x:%x+%" BFD_VMA_FMT "x",
+ (unsigned int) input_section->id,
+ (unsigned int) sym_sec->id,
+ (unsigned int) ELFNN_R_SYM (rel->r_info),
+ rel->r_addend);
+ }
+
+ return stub_name;
+}
+
+/* Return TRUE if symbol H should be hashed in the `.gnu.hash' section. For
+ executable PLT slots where the executable never takes the address of those
+ functions, the function symbols are not added to the hash table. */
+
+static bool
+elf_aarch64_hash_symbol (struct elf_link_hash_entry *h)
+{
+ if (h->plt.offset != (bfd_vma) -1
+ && !h->def_regular
+ && !h->pointer_equality_needed)
+ return false;
+
+ return _bfd_elf_hash_symbol (h);
+}
+
+
+/* Look up an entry in the stub hash. Stub entries are cached because
+ creating the stub name takes a bit of time. */
+
+static struct elf_aarch64_stub_hash_entry *
+elfNN_aarch64_get_stub_entry (const asection *input_section,
+ const asection *sym_sec,
+ struct elf_link_hash_entry *hash,
+ const Elf_Internal_Rela *rel,
+ struct elf_aarch64_link_hash_table *htab)
+{
+ struct elf_aarch64_stub_hash_entry *stub_entry;
+ struct elf_aarch64_link_hash_entry *h =
+ (struct elf_aarch64_link_hash_entry *) hash;
+ const asection *id_sec;
+
+ if ((input_section->flags & SEC_CODE) == 0)
+ return NULL;
+
+ /* If this input section is part of a group of sections sharing one
+ stub section, then use the id of the first section in the group.
+ Stub names need to include a section id, as there may well be
+ more than one stub used to reach say, printf, and we need to
+ distinguish between them. */
+ id_sec = htab->stub_group[input_section->id].link_sec;
+
+ if (h != NULL && h->stub_cache != NULL
+ && h->stub_cache->h == h && h->stub_cache->id_sec == id_sec)
+ {
+ stub_entry = h->stub_cache;
+ }
+ else
+ {
+ char *stub_name;
+
+ stub_name = elfNN_aarch64_stub_name (id_sec, sym_sec, h, rel);
+ if (stub_name == NULL)
+ return NULL;
+
+ stub_entry = aarch64_stub_hash_lookup (&htab->stub_hash_table,
+ stub_name, false, false);
+ if (h != NULL)
+ h->stub_cache = stub_entry;
+
+ free (stub_name);
+ }
+
+ return stub_entry;
+}
+
+
+/* Create a stub section. */
+
+static asection *
+_bfd_aarch64_create_stub_section (asection *section,
+ struct elf_aarch64_link_hash_table *htab)
+{
+ size_t namelen;
+ bfd_size_type len;
+ char *s_name;
+
+ namelen = strlen (section->name);
+ len = namelen + sizeof (STUB_SUFFIX);
+ s_name = bfd_alloc (htab->stub_bfd, len);
+ if (s_name == NULL)
+ return NULL;
+
+ memcpy (s_name, section->name, namelen);
+ memcpy (s_name + namelen, STUB_SUFFIX, sizeof (STUB_SUFFIX));
+ return (*htab->add_stub_section) (s_name, section);
+}
+
+
+/* Find or create a stub section for a link section.
+
+ Fix or create the stub section used to collect stubs attached to
+ the specified link section. */
+
+static asection *
+_bfd_aarch64_get_stub_for_link_section (asection *link_section,
+ struct elf_aarch64_link_hash_table *htab)
+{
+ if (htab->stub_group[link_section->id].stub_sec == NULL)
+ htab->stub_group[link_section->id].stub_sec
+ = _bfd_aarch64_create_stub_section (link_section, htab);
+ return htab->stub_group[link_section->id].stub_sec;
+}
+
+
+/* Find or create a stub section in the stub group for an input
+ section. */
+
+static asection *
+_bfd_aarch64_create_or_find_stub_sec (asection *section,
+ struct elf_aarch64_link_hash_table *htab)
+{
+ asection *link_sec = htab->stub_group[section->id].link_sec;
+ return _bfd_aarch64_get_stub_for_link_section (link_sec, htab);
+}
+
+
+/* Add a new stub entry in the stub group associated with an input
+ section to the stub hash. Not all fields of the new stub entry are
+ initialised. */
+
+static struct elf_aarch64_stub_hash_entry *
+_bfd_aarch64_add_stub_entry_in_group (const char *stub_name,
+ asection *section,
+ struct elf_aarch64_link_hash_table *htab)
+{
+ asection *link_sec;
+ asection *stub_sec;
+ struct elf_aarch64_stub_hash_entry *stub_entry;
+
+ link_sec = htab->stub_group[section->id].link_sec;
+ stub_sec = _bfd_aarch64_create_or_find_stub_sec (section, htab);
+
+ /* Enter this entry into the linker stub hash table. */
+ stub_entry = aarch64_stub_hash_lookup (&htab->stub_hash_table, stub_name,
+ true, false);
+ if (stub_entry == NULL)
+ {
+ /* xgettext:c-format */
+ _bfd_error_handler (_("%pB: cannot create stub entry %s"),
+ section->owner, stub_name);
+ return NULL;
+ }
+
+ stub_entry->stub_sec = stub_sec;
+ stub_entry->stub_offset = 0;
+ stub_entry->id_sec = link_sec;
+
+ return stub_entry;
+}
+
+/* Add a new stub entry in the final stub section to the stub hash.
+ Not all fields of the new stub entry are initialised. */
+
+static struct elf_aarch64_stub_hash_entry *
+_bfd_aarch64_add_stub_entry_after (const char *stub_name,
+ asection *link_section,
+ struct elf_aarch64_link_hash_table *htab)
+{
+ asection *stub_sec;
+ struct elf_aarch64_stub_hash_entry *stub_entry;
+
+ stub_sec = NULL;
+ /* Only create the actual stub if we will end up needing it. */
+ if (htab->fix_erratum_843419 & ERRAT_ADRP)
+ stub_sec = _bfd_aarch64_get_stub_for_link_section (link_section, htab);
+ stub_entry = aarch64_stub_hash_lookup (&htab->stub_hash_table, stub_name,
+ true, false);
+ if (stub_entry == NULL)
+ {
+ _bfd_error_handler (_("cannot create stub entry %s"), stub_name);
+ return NULL;
+ }
+
+ stub_entry->stub_sec = stub_sec;
+ stub_entry->stub_offset = 0;
+ stub_entry->id_sec = link_section;
+
+ return stub_entry;
+}
+
+
+static bool
+aarch64_build_one_stub (struct bfd_hash_entry *gen_entry,
+ void *in_arg)
+{
+ struct elf_aarch64_stub_hash_entry *stub_entry;
+ asection *stub_sec;
+ bfd *stub_bfd;
+ bfd_byte *loc;
+ bfd_vma sym_value;
+ bfd_vma veneered_insn_loc;
+ bfd_vma veneer_entry_loc;
+ bfd_signed_vma branch_offset = 0;
+ unsigned int template_size;
+ const uint32_t *template;
+ unsigned int i;
+ struct bfd_link_info *info;
+
+ /* Massage our args to the form they really have. */
+ stub_entry = (struct elf_aarch64_stub_hash_entry *) gen_entry;
+
+ info = (struct bfd_link_info *) in_arg;
+
+ /* Fail if the target section could not be assigned to an output
+ section. The user should fix his linker script. */
+ if (stub_entry->target_section->output_section == NULL
+ && info->non_contiguous_regions)
+ info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
+ "Retry without "
+ "--enable-non-contiguous-regions.\n"),
+ stub_entry->target_section);
+
+ stub_sec = stub_entry->stub_sec;
+
+ /* Make a note of the offset within the stubs for this entry. */
+ stub_entry->stub_offset = stub_sec->size;
+ loc = stub_sec->contents + stub_entry->stub_offset;
+
+ stub_bfd = stub_sec->owner;
+
+ /* This is the address of the stub destination. */
+ sym_value = (stub_entry->target_value
+ + stub_entry->target_section->output_offset
+ + stub_entry->target_section->output_section->vma);
+
+ if (stub_entry->stub_type == aarch64_stub_long_branch)
+ {
+ bfd_vma place = (stub_entry->stub_offset + stub_sec->output_section->vma
+ + stub_sec->output_offset);
+
+ /* See if we can relax the stub. */
+ if (aarch64_valid_for_adrp_p (sym_value, place))
+ stub_entry->stub_type = aarch64_select_branch_stub (sym_value, place);
+ }
+
+ switch (stub_entry->stub_type)
+ {
+ case aarch64_stub_adrp_branch:
+ template = aarch64_adrp_branch_stub;
+ template_size = sizeof (aarch64_adrp_branch_stub);
+ break;
+ case aarch64_stub_long_branch:
+ template = aarch64_long_branch_stub;
+ template_size = sizeof (aarch64_long_branch_stub);
+ break;
+ case aarch64_stub_erratum_835769_veneer:
+ template = aarch64_erratum_835769_stub;
+ template_size = sizeof (aarch64_erratum_835769_stub);
+ break;
+ case aarch64_stub_erratum_843419_veneer:
+ template = aarch64_erratum_843419_stub;
+ template_size = sizeof (aarch64_erratum_843419_stub);
+ break;
+ default:
+ abort ();
+ }
+
+ for (i = 0; i < (template_size / sizeof template[0]); i++)
+ {
+ bfd_putl32 (template[i], loc);
+ loc += 4;
+ }
+
+ template_size = (template_size + 7) & ~7;
+ stub_sec->size += template_size;
+
+ switch (stub_entry->stub_type)
+ {
+ case aarch64_stub_adrp_branch:
+ if (!aarch64_relocate (AARCH64_R (ADR_PREL_PG_HI21), stub_bfd, stub_sec,
+ stub_entry->stub_offset, sym_value))
+ /* The stub would not have been relaxed if the offset was out
+ of range. */
+ BFD_FAIL ();
+
+ if (!aarch64_relocate (AARCH64_R (ADD_ABS_LO12_NC), stub_bfd, stub_sec,
+ stub_entry->stub_offset + 4, sym_value))
+ BFD_FAIL ();
+ break;
+
+ case aarch64_stub_long_branch:
+ /* We want the value relative to the address 12 bytes back from the
+ value itself. */
+ if (!aarch64_relocate (AARCH64_R (PRELNN), stub_bfd, stub_sec,
+ stub_entry->stub_offset + 16, sym_value + 12))
+ BFD_FAIL ();
+ break;
+
+ case aarch64_stub_erratum_835769_veneer:
+ veneered_insn_loc = stub_entry->target_section->output_section->vma
+ + stub_entry->target_section->output_offset
+ + stub_entry->target_value;
+ veneer_entry_loc = stub_entry->stub_sec->output_section->vma
+ + stub_entry->stub_sec->output_offset
+ + stub_entry->stub_offset;
+ branch_offset = veneered_insn_loc - veneer_entry_loc;
+ branch_offset >>= 2;
+ branch_offset &= 0x3ffffff;
+ bfd_putl32 (stub_entry->veneered_insn,
+ stub_sec->contents + stub_entry->stub_offset);
+ bfd_putl32 (template[1] | branch_offset,
+ stub_sec->contents + stub_entry->stub_offset + 4);
+ break;
+
+ case aarch64_stub_erratum_843419_veneer:
+ if (!aarch64_relocate (AARCH64_R (JUMP26), stub_bfd, stub_sec,
+ stub_entry->stub_offset + 4, sym_value + 4))
+ BFD_FAIL ();
+ break;
+
+ default:
+ abort ();
+ }
+
+ return true;
+}
+
+/* As above, but don't actually build the stub. Just bump offset so
+ we know stub section sizes. */
+
+static bool
+aarch64_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
+{
+ struct elf_aarch64_stub_hash_entry *stub_entry;
+ struct elf_aarch64_link_hash_table *htab;
+ int size;
+
+ /* Massage our args to the form they really have. */
+ stub_entry = (struct elf_aarch64_stub_hash_entry *) gen_entry;
+ htab = (struct elf_aarch64_link_hash_table *) in_arg;
+
+ switch (stub_entry->stub_type)
+ {
+ case aarch64_stub_adrp_branch:
+ size = sizeof (aarch64_adrp_branch_stub);
+ break;
+ case aarch64_stub_long_branch:
+ size = sizeof (aarch64_long_branch_stub);
+ break;
+ case aarch64_stub_erratum_835769_veneer:
+ size = sizeof (aarch64_erratum_835769_stub);
+ break;
+ case aarch64_stub_erratum_843419_veneer:
+ {
+ if (htab->fix_erratum_843419 == ERRAT_ADR)
+ return true;
+ size = sizeof (aarch64_erratum_843419_stub);
+ }
+ break;
+ default:
+ abort ();
+ }
+
+ size = (size + 7) & ~7;
+ stub_entry->stub_sec->size += size;
+ return true;
+}
+
+/* External entry points for sizing and building linker stubs. */
+
+/* Set up various things so that we can make a list of input sections
+ for each output section included in the link. Returns -1 on error,
+ 0 when no stubs will be needed, and 1 on success. */
+
+int
+elfNN_aarch64_setup_section_lists (bfd *output_bfd,
+ struct bfd_link_info *info)
+{
+ bfd *input_bfd;
+ unsigned int bfd_count;
+ unsigned int top_id, top_index;
+ asection *section;
+ asection **input_list, **list;
+ size_t amt;
+ struct elf_aarch64_link_hash_table *htab =
+ elf_aarch64_hash_table (info);
+
+ if (!is_elf_hash_table (&htab->root.root))
+ return 0;
+
+ /* Count the number of input BFDs and find the top input section id. */
+ for (input_bfd = info->input_bfds, bfd_count = 0, top_id = 0;
+ input_bfd != NULL; input_bfd = input_bfd->link.next)
+ {
+ bfd_count += 1;
+ for (section = input_bfd->sections;
+ section != NULL; section = section->next)
+ {
+ if (top_id < section->id)
+ top_id = section->id;
+ }
+ }
+ htab->bfd_count = bfd_count;
+
+ amt = sizeof (struct map_stub) * (top_id + 1);
+ htab->stub_group = bfd_zmalloc (amt);
+ if (htab->stub_group == NULL)
+ return -1;
+
+ /* We can't use output_bfd->section_count here to find the top output
+ section index as some sections may have been removed, and
+ _bfd_strip_section_from_output doesn't renumber the indices. */
+ for (section = output_bfd->sections, top_index = 0;
+ section != NULL; section = section->next)
+ {
+ if (top_index < section->index)
+ top_index = section->index;
+ }
+
+ htab->top_index = top_index;
+ amt = sizeof (asection *) * (top_index + 1);
+ input_list = bfd_malloc (amt);
+ htab->input_list = input_list;
+ if (input_list == NULL)
+ return -1;
+
+ /* For sections we aren't interested in, mark their entries with a
+ value we can check later. */
+ list = input_list + top_index;
+ do
+ *list = bfd_abs_section_ptr;
+ while (list-- != input_list);
+
+ for (section = output_bfd->sections;
+ section != NULL; section = section->next)
+ {
+ if ((section->flags & SEC_CODE) != 0)
+ input_list[section->index] = NULL;
+ }
+
+ return 1;
+}
+
+/* Used by elfNN_aarch64_next_input_section and group_sections. */
+#define PREV_SEC(sec) (htab->stub_group[(sec)->id].link_sec)
+
+/* The linker repeatedly calls this function for each input section,
+ in the order that input sections are linked into output sections.
+ Build lists of input sections to determine groupings between which
+ we may insert linker stubs. */
+
+void
+elfNN_aarch64_next_input_section (struct bfd_link_info *info, asection *isec)
+{
+ struct elf_aarch64_link_hash_table *htab =
+ elf_aarch64_hash_table (info);
+
+ if (isec->output_section->index <= htab->top_index)
+ {
+ asection **list = htab->input_list + isec->output_section->index;
+
+ if (*list != bfd_abs_section_ptr && (isec->flags & SEC_CODE) != 0)
+ {
+ /* Steal the link_sec pointer for our list. */
+ /* This happens to make the list in reverse order,
+ which is what we want. */
+ PREV_SEC (isec) = *list;
+ *list = isec;
+ }
+ }
+}
+
+/* See whether we can group stub sections together. Grouping stub
+ sections may result in fewer stubs. More importantly, we need to
+ put all .init* and .fini* stubs at the beginning of the .init or
+ .fini output sections respectively, because glibc splits the
+ _init and _fini functions into multiple parts. Putting a stub in
+ the middle of a function is not a good idea. */
+
+static void
+group_sections (struct elf_aarch64_link_hash_table *htab,
+ bfd_size_type stub_group_size,
+ bool stubs_always_after_branch)
+{
+ asection **list = htab->input_list;
+
+ do
+ {
+ asection *tail = *list;
+ asection *head;
+
+ if (tail == bfd_abs_section_ptr)
+ continue;
+
+ /* Reverse the list: we must avoid placing stubs at the
+ beginning of the section because the beginning of the text
+ section may be required for an interrupt vector in bare metal
+ code. */
+#define NEXT_SEC PREV_SEC
+ head = NULL;
+ while (tail != NULL)
+ {
+ /* Pop from tail. */
+ asection *item = tail;
+ tail = PREV_SEC (item);
+
+ /* Push on head. */
+ NEXT_SEC (item) = head;
+ head = item;
+ }
+
+ while (head != NULL)
+ {
+ asection *curr;
+ asection *next;
+ bfd_vma stub_group_start = head->output_offset;
+ bfd_vma end_of_next;
+
+ curr = head;
+ while (NEXT_SEC (curr) != NULL)
+ {
+ next = NEXT_SEC (curr);
+ end_of_next = next->output_offset + next->size;
+ if (end_of_next - stub_group_start >= stub_group_size)
+ /* End of NEXT is too far from start, so stop. */
+ break;
+ /* Add NEXT to the group. */
+ curr = next;
+ }
+
+ /* OK, the size from the start to the start of CURR is less
+ than stub_group_size and thus can be handled by one stub
+ section. (Or the head section is itself larger than
+ stub_group_size, in which case we may be toast.)
+ We should really be keeping track of the total size of
+ stubs added here, as stubs contribute to the final output
+ section size. */
+ do
+ {
+ next = NEXT_SEC (head);
+ /* Set up this stub group. */
+ htab->stub_group[head->id].link_sec = curr;
+ }
+ while (head != curr && (head = next) != NULL);
+
+ /* But wait, there's more! Input sections up to stub_group_size
+ bytes after the stub section can be handled by it too. */
+ if (!stubs_always_after_branch)
+ {
+ stub_group_start = curr->output_offset + curr->size;
+
+ while (next != NULL)
+ {
+ end_of_next = next->output_offset + next->size;
+ if (end_of_next - stub_group_start >= stub_group_size)
+ /* End of NEXT is too far from stubs, so stop. */
+ break;
+ /* Add NEXT to the stub group. */
+ head = next;
+ next = NEXT_SEC (head);
+ htab->stub_group[head->id].link_sec = curr;
+ }
+ }
+ head = next;
+ }
+ }
+ while (list++ != htab->input_list + htab->top_index);
+
+ free (htab->input_list);
+}
+
+#undef PREV_SEC
+#undef PREV_SEC
+
+#define AARCH64_BITS(x, pos, n) (((x) >> (pos)) & ((1 << (n)) - 1))
+
+#define AARCH64_RT(insn) AARCH64_BITS (insn, 0, 5)
+#define AARCH64_RT2(insn) AARCH64_BITS (insn, 10, 5)
+#define AARCH64_RA(insn) AARCH64_BITS (insn, 10, 5)
+#define AARCH64_RD(insn) AARCH64_BITS (insn, 0, 5)
+#define AARCH64_RN(insn) AARCH64_BITS (insn, 5, 5)
+#define AARCH64_RM(insn) AARCH64_BITS (insn, 16, 5)
+
+#define AARCH64_MAC(insn) (((insn) & 0xff000000) == 0x9b000000)
+#define AARCH64_BIT(insn, n) AARCH64_BITS (insn, n, 1)
+#define AARCH64_OP31(insn) AARCH64_BITS (insn, 21, 3)
+#define AARCH64_ZR 0x1f
+
+/* All ld/st ops. See C4-182 of the ARM ARM. The encoding space for
+ LD_PCREL, LDST_RO, LDST_UI and LDST_UIMM cover prefetch ops. */
+
+#define AARCH64_LD(insn) (AARCH64_BIT (insn, 22) == 1)
+#define AARCH64_LDST(insn) (((insn) & 0x0a000000) == 0x08000000)
+#define AARCH64_LDST_EX(insn) (((insn) & 0x3f000000) == 0x08000000)
+#define AARCH64_LDST_PCREL(insn) (((insn) & 0x3b000000) == 0x18000000)
+#define AARCH64_LDST_NAP(insn) (((insn) & 0x3b800000) == 0x28000000)
+#define AARCH64_LDSTP_PI(insn) (((insn) & 0x3b800000) == 0x28800000)
+#define AARCH64_LDSTP_O(insn) (((insn) & 0x3b800000) == 0x29000000)
+#define AARCH64_LDSTP_PRE(insn) (((insn) & 0x3b800000) == 0x29800000)
+#define AARCH64_LDST_UI(insn) (((insn) & 0x3b200c00) == 0x38000000)
+#define AARCH64_LDST_PIIMM(insn) (((insn) & 0x3b200c00) == 0x38000400)
+#define AARCH64_LDST_U(insn) (((insn) & 0x3b200c00) == 0x38000800)
+#define AARCH64_LDST_PREIMM(insn) (((insn) & 0x3b200c00) == 0x38000c00)
+#define AARCH64_LDST_RO(insn) (((insn) & 0x3b200c00) == 0x38200800)
+#define AARCH64_LDST_UIMM(insn) (((insn) & 0x3b000000) == 0x39000000)
+#define AARCH64_LDST_SIMD_M(insn) (((insn) & 0xbfbf0000) == 0x0c000000)
+#define AARCH64_LDST_SIMD_M_PI(insn) (((insn) & 0xbfa00000) == 0x0c800000)
+#define AARCH64_LDST_SIMD_S(insn) (((insn) & 0xbf9f0000) == 0x0d000000)
+#define AARCH64_LDST_SIMD_S_PI(insn) (((insn) & 0xbf800000) == 0x0d800000)
+
+/* Classify an INSN if it is indeed a load/store.
+
+ Return TRUE if INSN is a LD/ST instruction otherwise return FALSE.
+
+ For scalar LD/ST instructions PAIR is FALSE, RT is returned and RT2
+ is set equal to RT.
+
+ For LD/ST pair instructions PAIR is TRUE, RT and RT2 are returned. */
+
+static bool
+aarch64_mem_op_p (uint32_t insn, unsigned int *rt, unsigned int *rt2,
+ bool *pair, bool *load)
+{
+ uint32_t opcode;
+ unsigned int r;
+ uint32_t opc = 0;
+ uint32_t v = 0;
+ uint32_t opc_v = 0;
+
+ /* Bail out quickly if INSN doesn't fall into the load-store
+ encoding space. */
+ if (!AARCH64_LDST (insn))
+ return false;
+
+ *pair = false;
+ *load = false;
+ if (AARCH64_LDST_EX (insn))
+ {
+ *rt = AARCH64_RT (insn);
+ *rt2 = *rt;
+ if (AARCH64_BIT (insn, 21) == 1)
+ {
+ *pair = true;
+ *rt2 = AARCH64_RT2 (insn);
+ }
+ *load = AARCH64_LD (insn);
+ return true;
+ }
+ else if (AARCH64_LDST_NAP (insn)
+ || AARCH64_LDSTP_PI (insn)
+ || AARCH64_LDSTP_O (insn)
+ || AARCH64_LDSTP_PRE (insn))
+ {
+ *pair = true;
+ *rt = AARCH64_RT (insn);
+ *rt2 = AARCH64_RT2 (insn);
+ *load = AARCH64_LD (insn);
+ return true;
+ }
+ else if (AARCH64_LDST_PCREL (insn)
+ || AARCH64_LDST_UI (insn)
+ || AARCH64_LDST_PIIMM (insn)
+ || AARCH64_LDST_U (insn)
+ || AARCH64_LDST_PREIMM (insn)
+ || AARCH64_LDST_RO (insn)
+ || AARCH64_LDST_UIMM (insn))
+ {
+ *rt = AARCH64_RT (insn);
+ *rt2 = *rt;
+ if (AARCH64_LDST_PCREL (insn))
+ *load = true;
+ opc = AARCH64_BITS (insn, 22, 2);
+ v = AARCH64_BIT (insn, 26);
+ opc_v = opc | (v << 2);
+ *load = (opc_v == 1 || opc_v == 2 || opc_v == 3
+ || opc_v == 5 || opc_v == 7);
+ return true;
+ }
+ else if (AARCH64_LDST_SIMD_M (insn)
+ || AARCH64_LDST_SIMD_M_PI (insn))
+ {
+ *rt = AARCH64_RT (insn);
+ *load = AARCH64_BIT (insn, 22);
+ opcode = (insn >> 12) & 0xf;
+ switch (opcode)
+ {
+ case 0:
+ case 2:
+ *rt2 = *rt + 3;
+ break;
+
+ case 4:
+ case 6:
+ *rt2 = *rt + 2;
+ break;
+
+ case 7:
+ *rt2 = *rt;
+ break;
+
+ case 8:
+ case 10:
+ *rt2 = *rt + 1;
+ break;
+
+ default:
+ return false;
+ }
+ return true;
+ }
+ else if (AARCH64_LDST_SIMD_S (insn)
+ || AARCH64_LDST_SIMD_S_PI (insn))
+ {
+ *rt = AARCH64_RT (insn);
+ r = (insn >> 21) & 1;
+ *load = AARCH64_BIT (insn, 22);
+ opcode = (insn >> 13) & 0x7;
+ switch (opcode)
+ {
+ case 0:
+ case 2:
+ case 4:
+ *rt2 = *rt + r;
+ break;
+
+ case 1:
+ case 3:
+ case 5:
+ *rt2 = *rt + (r == 0 ? 2 : 3);
+ break;
+
+ case 6:
+ *rt2 = *rt + r;
+ break;
+
+ case 7:
+ *rt2 = *rt + (r == 0 ? 2 : 3);
+ break;
+
+ default:
+ return false;
+ }
+ return true;
+ }
+
+ return false;
+}
+
+/* Return TRUE if INSN is multiply-accumulate. */
+
+static bool
+aarch64_mlxl_p (uint32_t insn)
+{
+ uint32_t op31 = AARCH64_OP31 (insn);
+
+ if (AARCH64_MAC (insn)
+ && (op31 == 0 || op31 == 1 || op31 == 5)
+ /* Exclude MUL instructions which are encoded as a multiple accumulate
+ with RA = XZR. */
+ && AARCH64_RA (insn) != AARCH64_ZR)
+ return true;
+
+ return false;
+}
+
+/* Some early revisions of the Cortex-A53 have an erratum (835769) whereby
+ it is possible for a 64-bit multiply-accumulate instruction to generate an
+ incorrect result. The details are quite complex and hard to
+ determine statically, since branches in the code may exist in some
+ circumstances, but all cases end with a memory (load, store, or
+ prefetch) instruction followed immediately by the multiply-accumulate
+ operation. We employ a linker patching technique, by moving the potentially
+ affected multiply-accumulate instruction into a patch region and replacing
+ the original instruction with a branch to the patch. This function checks
+ if INSN_1 is the memory operation followed by a multiply-accumulate
+ operation (INSN_2). Return TRUE if an erratum sequence is found, FALSE
+ if INSN_1 and INSN_2 are safe. */
+
+static bool
+aarch64_erratum_sequence (uint32_t insn_1, uint32_t insn_2)
+{
+ uint32_t rt;
+ uint32_t rt2;
+ uint32_t rn;
+ uint32_t rm;
+ uint32_t ra;
+ bool pair;
+ bool load;
+
+ if (aarch64_mlxl_p (insn_2)
+ && aarch64_mem_op_p (insn_1, &rt, &rt2, &pair, &load))
+ {
+ /* Any SIMD memory op is independent of the subsequent MLA
+ by definition of the erratum. */
+ if (AARCH64_BIT (insn_1, 26))
+ return true;
+
+ /* If not SIMD, check for integer memory ops and MLA relationship. */
+ rn = AARCH64_RN (insn_2);
+ ra = AARCH64_RA (insn_2);
+ rm = AARCH64_RM (insn_2);
+
+ /* If this is a load and there's a true(RAW) dependency, we are safe
+ and this is not an erratum sequence. */
+ if (load &&
+ (rt == rn || rt == rm || rt == ra
+ || (pair && (rt2 == rn || rt2 == rm || rt2 == ra))))
+ return false;
+
+ /* We conservatively put out stubs for all other cases (including
+ writebacks). */
+ return true;
+ }
+
+ return false;
+}
+
+/* Used to order a list of mapping symbols by address. */
+
+static int
+elf_aarch64_compare_mapping (const void *a, const void *b)
+{
+ const elf_aarch64_section_map *amap = (const elf_aarch64_section_map *) a;
+ const elf_aarch64_section_map *bmap = (const elf_aarch64_section_map *) b;
+
+ if (amap->vma > bmap->vma)
+ return 1;
+ else if (amap->vma < bmap->vma)
+ return -1;
+ else if (amap->type > bmap->type)
+ /* Ensure results do not depend on the host qsort for objects with
+ multiple mapping symbols at the same address by sorting on type
+ after vma. */
+ return 1;
+ else if (amap->type < bmap->type)
+ return -1;
+ else
+ return 0;
+}
+
+
+static char *
+_bfd_aarch64_erratum_835769_stub_name (unsigned num_fixes)
+{
+ char *stub_name = (char *) bfd_malloc
+ (strlen ("__erratum_835769_veneer_") + 16);
+ if (stub_name != NULL)
+ sprintf (stub_name,"__erratum_835769_veneer_%d", num_fixes);
+ return stub_name;
+}
+
+/* Scan for Cortex-A53 erratum 835769 sequence.
+
+ Return TRUE else FALSE on abnormal termination. */
+
+static bool
+_bfd_aarch64_erratum_835769_scan (bfd *input_bfd,
+ struct bfd_link_info *info,
+ unsigned int *num_fixes_p)
+{
+ asection *section;
+ struct elf_aarch64_link_hash_table *htab = elf_aarch64_hash_table (info);
+ unsigned int num_fixes = *num_fixes_p;
+
+ if (htab == NULL)
+ return true;
+
+ for (section = input_bfd->sections;
+ section != NULL;
+ section = section->next)
+ {
+ bfd_byte *contents = NULL;
+ struct _aarch64_elf_section_data *sec_data;
+ unsigned int span;
+
+ if (elf_section_type (section) != SHT_PROGBITS
+ || (elf_section_flags (section) & SHF_EXECINSTR) == 0
+ || (section->flags & SEC_EXCLUDE) != 0
+ || (section->sec_info_type == SEC_INFO_TYPE_JUST_SYMS)
+ || (section->output_section == bfd_abs_section_ptr))
+ continue;
+
+ if (elf_section_data (section)->this_hdr.contents != NULL)
+ contents = elf_section_data (section)->this_hdr.contents;
+ else if (! bfd_malloc_and_get_section (input_bfd, section, &contents))
+ return false;
+
+ sec_data = elf_aarch64_section_data (section);
+
+ if (sec_data->mapcount)
+ qsort (sec_data->map, sec_data->mapcount,
+ sizeof (elf_aarch64_section_map), elf_aarch64_compare_mapping);
+
+ for (span = 0; span < sec_data->mapcount; span++)
+ {
+ unsigned int span_start = sec_data->map[span].vma;
+ unsigned int span_end = ((span == sec_data->mapcount - 1)
+ ? sec_data->map[0].vma + section->size
+ : sec_data->map[span + 1].vma);
+ unsigned int i;
+ char span_type = sec_data->map[span].type;
+
+ if (span_type == 'd')
+ continue;
+
+ for (i = span_start; i + 4 < span_end; i += 4)
+ {
+ uint32_t insn_1 = bfd_getl32 (contents + i);
+ uint32_t insn_2 = bfd_getl32 (contents + i + 4);
+
+ if (aarch64_erratum_sequence (insn_1, insn_2))
+ {
+ struct elf_aarch64_stub_hash_entry *stub_entry;
+ char *stub_name = _bfd_aarch64_erratum_835769_stub_name (num_fixes);
+ if (! stub_name)
+ return false;
+
+ stub_entry = _bfd_aarch64_add_stub_entry_in_group (stub_name,
+ section,
+ htab);
+ if (! stub_entry)
+ return false;
+
+ stub_entry->stub_type = aarch64_stub_erratum_835769_veneer;
+ stub_entry->target_section = section;
+ stub_entry->target_value = i + 4;
+ stub_entry->veneered_insn = insn_2;
+ stub_entry->output_name = stub_name;
+ num_fixes++;
+ }
+ }
+ }
+ if (elf_section_data (section)->this_hdr.contents == NULL)
+ free (contents);
+ }
+
+ *num_fixes_p = num_fixes;
+
+ return true;
+}
+
+
+/* Test if instruction INSN is ADRP. */
+
+static bool
+_bfd_aarch64_adrp_p (uint32_t insn)
+{
+ return ((insn & AARCH64_ADRP_OP_MASK) == AARCH64_ADRP_OP);
+}
+
+
+/* Helper predicate to look for cortex-a53 erratum 843419 sequence 1. */
+
+static bool
+_bfd_aarch64_erratum_843419_sequence_p (uint32_t insn_1, uint32_t insn_2,
+ uint32_t insn_3)
+{
+ uint32_t rt;
+ uint32_t rt2;
+ bool pair;
+ bool load;
+
+ return (aarch64_mem_op_p (insn_2, &rt, &rt2, &pair, &load)
+ && (!pair
+ || (pair && !load))
+ && AARCH64_LDST_UIMM (insn_3)
+ && AARCH64_RN (insn_3) == AARCH64_RD (insn_1));
+}
+
+
+/* Test for the presence of Cortex-A53 erratum 843419 instruction sequence.
+
+ Return TRUE if section CONTENTS at offset I contains one of the
+ erratum 843419 sequences, otherwise return FALSE. If a sequence is
+ seen set P_VENEER_I to the offset of the final LOAD/STORE
+ instruction in the sequence.
+ */
+
+static bool
+_bfd_aarch64_erratum_843419_p (bfd_byte *contents, bfd_vma vma,
+ bfd_vma i, bfd_vma span_end,
+ bfd_vma *p_veneer_i)
+{
+ uint32_t insn_1 = bfd_getl32 (contents + i);
+
+ if (!_bfd_aarch64_adrp_p (insn_1))
+ return false;
+
+ if (span_end < i + 12)
+ return false;
+
+ uint32_t insn_2 = bfd_getl32 (contents + i + 4);
+ uint32_t insn_3 = bfd_getl32 (contents + i + 8);
+
+ if ((vma & 0xfff) != 0xff8 && (vma & 0xfff) != 0xffc)
+ return false;
+
+ if (_bfd_aarch64_erratum_843419_sequence_p (insn_1, insn_2, insn_3))
+ {
+ *p_veneer_i = i + 8;
+ return true;
+ }
+
+ if (span_end < i + 16)
+ return false;
+
+ uint32_t insn_4 = bfd_getl32 (contents + i + 12);
+
+ if (_bfd_aarch64_erratum_843419_sequence_p (insn_1, insn_2, insn_4))
+ {
+ *p_veneer_i = i + 12;
+ return true;
+ }
+
+ return false;
+}
+
+
+/* Resize all stub sections. */
+
+static void
+_bfd_aarch64_resize_stubs (struct elf_aarch64_link_hash_table *htab)
+{
+ asection *section;
+
+ /* OK, we've added some stubs. Find out the new size of the
+ stub sections. */
+ for (section = htab->stub_bfd->sections;
+ section != NULL; section = section->next)
+ {
+ /* Ignore non-stub sections. */
+ if (!strstr (section->name, STUB_SUFFIX))
+ continue;
+ section->size = 0;
+ }
+
+ bfd_hash_traverse (&htab->stub_hash_table, aarch64_size_one_stub, htab);
+
+ for (section = htab->stub_bfd->sections;
+ section != NULL; section = section->next)
+ {
+ if (!strstr (section->name, STUB_SUFFIX))
+ continue;
+
+ /* Add space for a branch. Add 8 bytes to keep section 8 byte aligned,
+ as long branch stubs contain a 64-bit address. */
+ if (section->size)
+ section->size += 8;
+
+ /* Ensure all stub sections have a size which is a multiple of
+ 4096. This is important in order to ensure that the insertion
+ of stub sections does not in itself move existing code around
+ in such a way that new errata sequences are created. We only do this
+ when the ADRP workaround is enabled. If only the ADR workaround is
+ enabled then the stubs workaround won't ever be used. */
+ if (htab->fix_erratum_843419 & ERRAT_ADRP)
+ if (section->size)
+ section->size = BFD_ALIGN (section->size, 0x1000);
+ }
+}
+
+/* Construct an erratum 843419 workaround stub name. */
+
+static char *
+_bfd_aarch64_erratum_843419_stub_name (asection *input_section,
+ bfd_vma offset)
+{
+ const bfd_size_type len = 8 + 4 + 1 + 8 + 1 + 16 + 1;
+ char *stub_name = bfd_malloc (len);
+
+ if (stub_name != NULL)
+ snprintf (stub_name, len, "e843419@%04x_%08x_%" BFD_VMA_FMT "x",
+ input_section->owner->id,
+ input_section->id,
+ offset);
+ return stub_name;
+}
+
+/* Build a stub_entry structure describing an 843419 fixup.
+
+ The stub_entry constructed is populated with the bit pattern INSN
+ of the instruction located at OFFSET within input SECTION.
+
+ Returns TRUE on success. */
+
+static bool
+_bfd_aarch64_erratum_843419_fixup (uint32_t insn,
+ bfd_vma adrp_offset,
+ bfd_vma ldst_offset,
+ asection *section,
+ struct bfd_link_info *info)
+{
+ struct elf_aarch64_link_hash_table *htab = elf_aarch64_hash_table (info);
+ char *stub_name;
+ struct elf_aarch64_stub_hash_entry *stub_entry;
+
+ stub_name = _bfd_aarch64_erratum_843419_stub_name (section, ldst_offset);
+ if (stub_name == NULL)
+ return false;
+ stub_entry = aarch64_stub_hash_lookup (&htab->stub_hash_table, stub_name,
+ false, false);
+ if (stub_entry)
+ {
+ free (stub_name);
+ return true;
+ }
+
+ /* We always place an 843419 workaround veneer in the stub section
+ attached to the input section in which an erratum sequence has
+ been found. This ensures that later in the link process (in
+ elfNN_aarch64_write_section) when we copy the veneered
+ instruction from the input section into the stub section the
+ copied instruction will have had any relocations applied to it.
+ If we placed workaround veneers in any other stub section then we
+ could not assume that all relocations have been processed on the
+ corresponding input section at the point we output the stub
+ section. */
+
+ stub_entry = _bfd_aarch64_add_stub_entry_after (stub_name, section, htab);
+ if (stub_entry == NULL)
+ {
+ free (stub_name);
+ return false;
+ }
+
+ stub_entry->adrp_offset = adrp_offset;
+ stub_entry->target_value = ldst_offset;
+ stub_entry->target_section = section;
+ stub_entry->stub_type = aarch64_stub_erratum_843419_veneer;
+ stub_entry->veneered_insn = insn;
+ stub_entry->output_name = stub_name;
+
+ return true;
+}
+
+
+/* Scan an input section looking for the signature of erratum 843419.
+
+ Scans input SECTION in INPUT_BFD looking for erratum 843419
+ signatures, for each signature found a stub_entry is created
+ describing the location of the erratum for subsequent fixup.
+
+ Return TRUE on successful scan, FALSE on failure to scan.
+ */
+
+static bool
+_bfd_aarch64_erratum_843419_scan (bfd *input_bfd, asection *section,
+ struct bfd_link_info *info)
+{
+ struct elf_aarch64_link_hash_table *htab = elf_aarch64_hash_table (info);
+
+ if (htab == NULL)
+ return true;
+
+ if (elf_section_type (section) != SHT_PROGBITS
+ || (elf_section_flags (section) & SHF_EXECINSTR) == 0
+ || (section->flags & SEC_EXCLUDE) != 0
+ || (section->sec_info_type == SEC_INFO_TYPE_JUST_SYMS)
+ || (section->output_section == bfd_abs_section_ptr))
+ return true;
+
+ do
+ {
+ bfd_byte *contents = NULL;
+ struct _aarch64_elf_section_data *sec_data;
+ unsigned int span;
+
+ if (elf_section_data (section)->this_hdr.contents != NULL)
+ contents = elf_section_data (section)->this_hdr.contents;
+ else if (! bfd_malloc_and_get_section (input_bfd, section, &contents))
+ return false;
+
+ sec_data = elf_aarch64_section_data (section);
+
+ if (sec_data->mapcount)
+ qsort (sec_data->map, sec_data->mapcount,
+ sizeof (elf_aarch64_section_map), elf_aarch64_compare_mapping);
+
+ for (span = 0; span < sec_data->mapcount; span++)
+ {
+ unsigned int span_start = sec_data->map[span].vma;
+ unsigned int span_end = ((span == sec_data->mapcount - 1)
+ ? sec_data->map[0].vma + section->size
+ : sec_data->map[span + 1].vma);
+ unsigned int i;
+ char span_type = sec_data->map[span].type;
+
+ if (span_type == 'd')
+ continue;
+
+ for (i = span_start; i + 8 < span_end; i += 4)
+ {
+ bfd_vma vma = (section->output_section->vma
+ + section->output_offset
+ + i);
+ bfd_vma veneer_i;
+
+ if (_bfd_aarch64_erratum_843419_p
+ (contents, vma, i, span_end, &veneer_i))
+ {
+ uint32_t insn = bfd_getl32 (contents + veneer_i);
+
+ if (!_bfd_aarch64_erratum_843419_fixup (insn, i, veneer_i,
+ section, info))
+ return false;
+ }
+ }
+ }
+
+ if (elf_section_data (section)->this_hdr.contents == NULL)
+ free (contents);
+ }
+ while (0);
+
+ return true;
+}
+
+
+/* Determine and set the size of the stub section for a final link.
+
+ The basic idea here is to examine all the relocations looking for
+ PC-relative calls to a target that is unreachable with a "bl"
+ instruction. */
+
+bool
+elfNN_aarch64_size_stubs (bfd *output_bfd,
+ bfd *stub_bfd,
+ struct bfd_link_info *info,
+ bfd_signed_vma group_size,
+ asection * (*add_stub_section) (const char *,
+ asection *),
+ void (*layout_sections_again) (void))
+{
+ bfd_size_type stub_group_size;
+ bool stubs_always_before_branch;
+ bool stub_changed = false;
+ struct elf_aarch64_link_hash_table *htab = elf_aarch64_hash_table (info);
+ unsigned int num_erratum_835769_fixes = 0;
+
+ /* Propagate mach to stub bfd, because it may not have been
+ finalized when we created stub_bfd. */
+ bfd_set_arch_mach (stub_bfd, bfd_get_arch (output_bfd),
+ bfd_get_mach (output_bfd));
+
+ /* Stash our params away. */
+ htab->stub_bfd = stub_bfd;
+ htab->add_stub_section = add_stub_section;
+ htab->layout_sections_again = layout_sections_again;
+ stubs_always_before_branch = group_size < 0;
+ if (group_size < 0)
+ stub_group_size = -group_size;
+ else
+ stub_group_size = group_size;
+
+ if (stub_group_size == 1)
+ {
+ /* Default values. */
+ /* AArch64 branch range is +-128MB. The value used is 1MB less. */
+ stub_group_size = 127 * 1024 * 1024;
+ }
+
+ group_sections (htab, stub_group_size, stubs_always_before_branch);
+
+ (*htab->layout_sections_again) ();
+
+ if (htab->fix_erratum_835769)
+ {
+ bfd *input_bfd;
+
+ for (input_bfd = info->input_bfds;
+ input_bfd != NULL; input_bfd = input_bfd->link.next)
+ {
+ if (!is_aarch64_elf (input_bfd)
+ || (input_bfd->flags & BFD_LINKER_CREATED) != 0)
+ continue;
+
+ if (!_bfd_aarch64_erratum_835769_scan (input_bfd, info,
+ &num_erratum_835769_fixes))
+ return false;
+ }
+
+ _bfd_aarch64_resize_stubs (htab);
+ (*htab->layout_sections_again) ();
+ }
+
+ if (htab->fix_erratum_843419 != ERRAT_NONE)
+ {
+ bfd *input_bfd;
+
+ for (input_bfd = info->input_bfds;
+ input_bfd != NULL;
+ input_bfd = input_bfd->link.next)
+ {
+ asection *section;
+
+ if (!is_aarch64_elf (input_bfd)
+ || (input_bfd->flags & BFD_LINKER_CREATED) != 0)
+ continue;
+
+ for (section = input_bfd->sections;
+ section != NULL;
+ section = section->next)
+ if (!_bfd_aarch64_erratum_843419_scan (input_bfd, section, info))
+ return false;
+ }
+
+ _bfd_aarch64_resize_stubs (htab);
+ (*htab->layout_sections_again) ();
+ }
+
+ while (1)
+ {
+ bfd *input_bfd;
+
+ for (input_bfd = info->input_bfds;
+ input_bfd != NULL; input_bfd = input_bfd->link.next)
+ {
+ Elf_Internal_Shdr *symtab_hdr;
+ asection *section;
+ Elf_Internal_Sym *local_syms = NULL;
+
+ if (!is_aarch64_elf (input_bfd)
+ || (input_bfd->flags & BFD_LINKER_CREATED) != 0)
+ continue;
+
+ /* We'll need the symbol table in a second. */
+ symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+ if (symtab_hdr->sh_info == 0)
+ continue;
+
+ /* Walk over each section attached to the input bfd. */
+ for (section = input_bfd->sections;
+ section != NULL; section = section->next)
+ {
+ Elf_Internal_Rela *internal_relocs, *irelaend, *irela;
+
+ /* If there aren't any relocs, then there's nothing more
+ to do. */
+ if ((section->flags & SEC_RELOC) == 0
+ || section->reloc_count == 0
+ || (section->flags & SEC_CODE) == 0)
+ continue;
+
+ /* If this section is a link-once section that will be
+ discarded, then don't create any stubs. */
+ if (section->output_section == NULL
+ || section->output_section->owner != output_bfd)
+ continue;
+
+ /* Get the relocs. */
+ internal_relocs
+ = _bfd_elf_link_read_relocs (input_bfd, section, NULL,
+ NULL, info->keep_memory);
+ if (internal_relocs == NULL)
+ goto error_ret_free_local;
+
+ /* Now examine each relocation. */
+ irela = internal_relocs;
+ irelaend = irela + section->reloc_count;
+ for (; irela < irelaend; irela++)
+ {
+ unsigned int r_type, r_indx;
+ enum elf_aarch64_stub_type stub_type;
+ struct elf_aarch64_stub_hash_entry *stub_entry;
+ asection *sym_sec;
+ bfd_vma sym_value;
+ bfd_vma destination;
+ struct elf_aarch64_link_hash_entry *hash;
+ const char *sym_name;
+ char *stub_name;
+ const asection *id_sec;
+ unsigned char st_type;
+ bfd_size_type len;
+
+ r_type = ELFNN_R_TYPE (irela->r_info);
+ r_indx = ELFNN_R_SYM (irela->r_info);
+
+ if (r_type >= (unsigned int) R_AARCH64_end)
+ {
+ bfd_set_error (bfd_error_bad_value);
+ error_ret_free_internal:
+ if (elf_section_data (section)->relocs == NULL)
+ free (internal_relocs);
+ goto error_ret_free_local;
+ }
+
+ /* Only look for stubs on unconditional branch and
+ branch and link instructions. */
+ if (r_type != (unsigned int) AARCH64_R (CALL26)
+ && r_type != (unsigned int) AARCH64_R (JUMP26))
+ continue;
+
+ /* Now determine the call target, its name, value,
+ section. */
+ sym_sec = NULL;
+ sym_value = 0;
+ destination = 0;
+ hash = NULL;
+ sym_name = NULL;
+ if (r_indx < symtab_hdr->sh_info)
+ {
+ /* It's a local symbol. */
+ Elf_Internal_Sym *sym;
+ Elf_Internal_Shdr *hdr;
+
+ if (local_syms == NULL)
+ {
+ local_syms
+ = (Elf_Internal_Sym *) symtab_hdr->contents;
+ if (local_syms == NULL)
+ local_syms
+ = bfd_elf_get_elf_syms (input_bfd, symtab_hdr,
+ symtab_hdr->sh_info, 0,
+ NULL, NULL, NULL);
+ if (local_syms == NULL)
+ goto error_ret_free_internal;
+ }
+
+ sym = local_syms + r_indx;
+ hdr = elf_elfsections (input_bfd)[sym->st_shndx];
+ sym_sec = hdr->bfd_section;
+ if (!sym_sec)
+ /* This is an undefined symbol. It can never
+ be resolved. */
+ continue;
+
+ if (ELF_ST_TYPE (sym->st_info) != STT_SECTION)
+ sym_value = sym->st_value;
+ destination = (sym_value + irela->r_addend
+ + sym_sec->output_offset
+ + sym_sec->output_section->vma);
+ st_type = ELF_ST_TYPE (sym->st_info);
+ sym_name
+ = bfd_elf_string_from_elf_section (input_bfd,
+ symtab_hdr->sh_link,
+ sym->st_name);
+ }
+ else
+ {
+ int e_indx;
+
+ e_indx = r_indx - symtab_hdr->sh_info;
+ hash = ((struct elf_aarch64_link_hash_entry *)
+ elf_sym_hashes (input_bfd)[e_indx]);
+
+ while (hash->root.root.type == bfd_link_hash_indirect
+ || hash->root.root.type == bfd_link_hash_warning)
+ hash = ((struct elf_aarch64_link_hash_entry *)
+ hash->root.root.u.i.link);
+
+ if (hash->root.root.type == bfd_link_hash_defined
+ || hash->root.root.type == bfd_link_hash_defweak)
+ {
+ struct elf_aarch64_link_hash_table *globals =
+ elf_aarch64_hash_table (info);
+ sym_sec = hash->root.root.u.def.section;
+ sym_value = hash->root.root.u.def.value;
+ /* For a destination in a shared library,
+ use the PLT stub as target address to
+ decide whether a branch stub is
+ needed. */
+ if (globals->root.splt != NULL && hash != NULL
+ && hash->root.plt.offset != (bfd_vma) - 1)
+ {
+ sym_sec = globals->root.splt;
+ sym_value = hash->root.plt.offset;
+ if (sym_sec->output_section != NULL)
+ destination = (sym_value
+ + sym_sec->output_offset
+ +
+ sym_sec->output_section->vma);
+ }
+ else if (sym_sec->output_section != NULL)
+ destination = (sym_value + irela->r_addend
+ + sym_sec->output_offset
+ + sym_sec->output_section->vma);
+ }
+ else if (hash->root.root.type == bfd_link_hash_undefined
+ || (hash->root.root.type
+ == bfd_link_hash_undefweak))
+ {
+ /* For a shared library, use the PLT stub as
+ target address to decide whether a long
+ branch stub is needed.
+ For absolute code, they cannot be handled. */
+ struct elf_aarch64_link_hash_table *globals =
+ elf_aarch64_hash_table (info);
+
+ if (globals->root.splt != NULL && hash != NULL
+ && hash->root.plt.offset != (bfd_vma) - 1)
+ {
+ sym_sec = globals->root.splt;
+ sym_value = hash->root.plt.offset;
+ if (sym_sec->output_section != NULL)
+ destination = (sym_value
+ + sym_sec->output_offset
+ +
+ sym_sec->output_section->vma);
+ }
+ else
+ continue;
+ }
+ else
+ {
+ bfd_set_error (bfd_error_bad_value);
+ goto error_ret_free_internal;
+ }
+ st_type = ELF_ST_TYPE (hash->root.type);
+ sym_name = hash->root.root.root.string;
+ }
+
+ /* Determine what (if any) linker stub is needed. */
+ stub_type = aarch64_type_of_stub (section, irela, sym_sec,
+ st_type, destination);
+ if (stub_type == aarch64_stub_none)
+ continue;
+
+ /* Support for grouping stub sections. */
+ id_sec = htab->stub_group[section->id].link_sec;
+
+ /* Get the name of this stub. */
+ stub_name = elfNN_aarch64_stub_name (id_sec, sym_sec, hash,
+ irela);
+ if (!stub_name)
+ goto error_ret_free_internal;
+
+ stub_entry =
+ aarch64_stub_hash_lookup (&htab->stub_hash_table,
+ stub_name, false, false);
+ if (stub_entry != NULL)
+ {
+ /* The proper stub has already been created. */
+ free (stub_name);
+ /* Always update this stub's target since it may have
+ changed after layout. */
+ stub_entry->target_value = sym_value + irela->r_addend;
+ continue;
+ }
+
+ stub_entry = _bfd_aarch64_add_stub_entry_in_group
+ (stub_name, section, htab);
+ if (stub_entry == NULL)
+ {
+ free (stub_name);
+ goto error_ret_free_internal;
+ }
+
+ stub_entry->target_value = sym_value + irela->r_addend;
+ stub_entry->target_section = sym_sec;
+ stub_entry->stub_type = stub_type;
+ stub_entry->h = hash;
+ stub_entry->st_type = st_type;
+
+ if (sym_name == NULL)
+ sym_name = "unnamed";
+ len = sizeof (STUB_ENTRY_NAME) + strlen (sym_name);
+ stub_entry->output_name = bfd_alloc (htab->stub_bfd, len);
+ if (stub_entry->output_name == NULL)
+ {
+ free (stub_name);
+ goto error_ret_free_internal;
+ }
+
+ snprintf (stub_entry->output_name, len, STUB_ENTRY_NAME,
+ sym_name);
+
+ stub_changed = true;
+ }
+
+ /* We're done with the internal relocs, free them. */
+ if (elf_section_data (section)->relocs == NULL)
+ free (internal_relocs);
+ }
+ }
+
+ if (!stub_changed)
+ break;
+
+ _bfd_aarch64_resize_stubs (htab);
+
+ /* Ask the linker to do its stuff. */
+ (*htab->layout_sections_again) ();
+ stub_changed = false;
+ }
+
+ return true;
+
+ error_ret_free_local:
+ return false;
+}
+
+/* Build all the stubs associated with the current output file. The
+ stubs are kept in a hash table attached to the main linker hash
+ table. We also set up the .plt entries for statically linked PIC
+ functions here. This function is called via aarch64_elf_finish in the
+ linker. */
+
+bool
+elfNN_aarch64_build_stubs (struct bfd_link_info *info)
+{
+ asection *stub_sec;
+ struct bfd_hash_table *table;
+ struct elf_aarch64_link_hash_table *htab;
+
+ htab = elf_aarch64_hash_table (info);
+
+ for (stub_sec = htab->stub_bfd->sections;
+ stub_sec != NULL; stub_sec = stub_sec->next)
+ {
+ bfd_size_type size;
+
+ /* Ignore non-stub sections. */
+ if (!strstr (stub_sec->name, STUB_SUFFIX))
+ continue;
+
+ /* Allocate memory to hold the linker stubs. */
+ size = stub_sec->size;
+ stub_sec->contents = bfd_zalloc (htab->stub_bfd, size);
+ if (stub_sec->contents == NULL && size != 0)
+ return false;
+ stub_sec->size = 0;
+
+ /* Add a branch around the stub section, and a nop, to keep it 8 byte
+ aligned, as long branch stubs contain a 64-bit address. */
+ bfd_putl32 (0x14000000 | (size >> 2), stub_sec->contents);
+ bfd_putl32 (INSN_NOP, stub_sec->contents + 4);
+ stub_sec->size += 8;
+ }
+
+ /* Build the stubs as directed by the stub hash table. */
+ table = &htab->stub_hash_table;
+ bfd_hash_traverse (table, aarch64_build_one_stub, info);
+
+ return true;
+}
+
+
+/* Add an entry to the code/data map for section SEC. */
+
+static void
+elfNN_aarch64_section_map_add (asection *sec, char type, bfd_vma vma)
+{
+ struct _aarch64_elf_section_data *sec_data =
+ elf_aarch64_section_data (sec);
+ unsigned int newidx;
+
+ if (sec_data->map == NULL)
+ {
+ sec_data->map = bfd_malloc (sizeof (elf_aarch64_section_map));
+ sec_data->mapcount = 0;
+ sec_data->mapsize = 1;
+ }
+
+ newidx = sec_data->mapcount++;
+
+ if (sec_data->mapcount > sec_data->mapsize)
+ {
+ sec_data->mapsize *= 2;
+ sec_data->map = bfd_realloc_or_free
+ (sec_data->map, sec_data->mapsize * sizeof (elf_aarch64_section_map));
+ }
+
+ if (sec_data->map)
+ {
+ sec_data->map[newidx].vma = vma;
+ sec_data->map[newidx].type = type;
+ }
+}
+
+
+/* Initialise maps of insn/data for input BFDs. */
+void
+bfd_elfNN_aarch64_init_maps (bfd *abfd)
+{
+ Elf_Internal_Sym *isymbuf;
+ Elf_Internal_Shdr *hdr;
+ unsigned int i, localsyms;
+
+ /* Make sure that we are dealing with an AArch64 elf binary. */
+ if (!is_aarch64_elf (abfd))
+ return;
+
+ if ((abfd->flags & DYNAMIC) != 0)
+ return;
+
+ hdr = &elf_symtab_hdr (abfd);
+ localsyms = hdr->sh_info;
+
+ /* Obtain a buffer full of symbols for this BFD. The hdr->sh_info field
+ should contain the number of local symbols, which should come before any
+ global symbols. Mapping symbols are always local. */
+ isymbuf = bfd_elf_get_elf_syms (abfd, hdr, localsyms, 0, NULL, NULL, NULL);
+
+ /* No internal symbols read? Skip this BFD. */
+ if (isymbuf == NULL)
+ return;
+
+ for (i = 0; i < localsyms; i++)
+ {
+ Elf_Internal_Sym *isym = &isymbuf[i];
+ asection *sec = bfd_section_from_elf_index (abfd, isym->st_shndx);
+ const char *name;
+
+ if (sec != NULL && ELF_ST_BIND (isym->st_info) == STB_LOCAL)
+ {
+ name = bfd_elf_string_from_elf_section (abfd,
+ hdr->sh_link,
+ isym->st_name);
+
+ if (bfd_is_aarch64_special_symbol_name
+ (name, BFD_AARCH64_SPECIAL_SYM_TYPE_MAP))
+ elfNN_aarch64_section_map_add (sec, name[1], isym->st_value);
+ }
+ }
+}
+
+static void
+setup_plt_values (struct bfd_link_info *link_info,
+ aarch64_plt_type plt_type)
+{
+ struct elf_aarch64_link_hash_table *globals;
+ globals = elf_aarch64_hash_table (link_info);
+
+ if (plt_type == PLT_BTI_PAC)
+ {
+ globals->plt0_entry = elfNN_aarch64_small_plt0_bti_entry;
+
+ /* Only in ET_EXEC we need PLTn with BTI. */
+ if (bfd_link_pde (link_info))
+ {
+ globals->plt_entry_size = PLT_BTI_PAC_SMALL_ENTRY_SIZE;
+ globals->plt_entry = elfNN_aarch64_small_plt_bti_pac_entry;
+ }
+ else
+ {
+ globals->plt_entry_size = PLT_PAC_SMALL_ENTRY_SIZE;
+ globals->plt_entry = elfNN_aarch64_small_plt_pac_entry;
+ }
+ }
+ else if (plt_type == PLT_BTI)
+ {
+ globals->plt0_entry = elfNN_aarch64_small_plt0_bti_entry;
+
+ /* Only in ET_EXEC we need PLTn with BTI. */
+ if (bfd_link_pde (link_info))
+ {
+ globals->plt_entry_size = PLT_BTI_SMALL_ENTRY_SIZE;
+ globals->plt_entry = elfNN_aarch64_small_plt_bti_entry;
+ }
+ }
+ else if (plt_type == PLT_PAC)
+ {
+ globals->plt_entry_size = PLT_PAC_SMALL_ENTRY_SIZE;
+ globals->plt_entry = elfNN_aarch64_small_plt_pac_entry;
+ }
+}
+
+/* Set option values needed during linking. */
+void
+bfd_elfNN_aarch64_set_options (struct bfd *output_bfd,
+ struct bfd_link_info *link_info,
+ int no_enum_warn,
+ int no_wchar_warn, int pic_veneer,
+ int fix_erratum_835769,
+ erratum_84319_opts fix_erratum_843419,
+ int no_apply_dynamic_relocs,
+ aarch64_bti_pac_info bp_info)
+{
+ struct elf_aarch64_link_hash_table *globals;
+
+ globals = elf_aarch64_hash_table (link_info);
+ globals->pic_veneer = pic_veneer;
+ globals->fix_erratum_835769 = fix_erratum_835769;
+ /* If the default options are used, then ERRAT_ADR will be set by default
+ which will enable the ADRP->ADR workaround for the erratum 843419
+ workaround. */
+ globals->fix_erratum_843419 = fix_erratum_843419;
+ globals->no_apply_dynamic_relocs = no_apply_dynamic_relocs;
+
+ BFD_ASSERT (is_aarch64_elf (output_bfd));
+ elf_aarch64_tdata (output_bfd)->no_enum_size_warning = no_enum_warn;
+ elf_aarch64_tdata (output_bfd)->no_wchar_size_warning = no_wchar_warn;
+
+ switch (bp_info.bti_type)
+ {
+ case BTI_WARN:
+ elf_aarch64_tdata (output_bfd)->no_bti_warn = 0;
+ elf_aarch64_tdata (output_bfd)->gnu_and_prop
+ |= GNU_PROPERTY_AARCH64_FEATURE_1_BTI;
+ break;
+
+ default:
+ break;
+ }
+ elf_aarch64_tdata (output_bfd)->plt_type = bp_info.plt_type;
+ setup_plt_values (link_info, bp_info.plt_type);
+}
+
+static bfd_vma
+aarch64_calculate_got_entry_vma (struct elf_link_hash_entry *h,
+ struct elf_aarch64_link_hash_table
+ *globals, struct bfd_link_info *info,
+ bfd_vma value, bfd *output_bfd,
+ bool *unresolved_reloc_p)
+{
+ bfd_vma off = (bfd_vma) - 1;
+ asection *basegot = globals->root.sgot;
+ bool dyn = globals->root.dynamic_sections_created;
+
+ if (h != NULL)
+ {
+ BFD_ASSERT (basegot != NULL);
+ off = h->got.offset;
+ BFD_ASSERT (off != (bfd_vma) - 1);
+ if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, bfd_link_pic (info), h)
+ || (bfd_link_pic (info)
+ && SYMBOL_REFERENCES_LOCAL (info, h))
+ || (ELF_ST_VISIBILITY (h->other)
+ && h->root.type == bfd_link_hash_undefweak))
+ {
+ /* This is actually a static link, or it is a -Bsymbolic link
+ and the symbol is defined locally. We must initialize this
+ entry in the global offset table. Since the offset must
+ always be a multiple of 8 (4 in the case of ILP32), we use
+ the least significant bit to record whether we have
+ initialized it already.
+ When doing a dynamic link, we create a .rel(a).got relocation
+ entry to initialize the value. This is done in the
+ finish_dynamic_symbol routine. */
+ if ((off & 1) != 0)
+ off &= ~1;
+ else
+ {
+ bfd_put_NN (output_bfd, value, basegot->contents + off);
+ h->got.offset |= 1;
+ }
+ }
+ else
+ *unresolved_reloc_p = false;
+
+ off = off + basegot->output_section->vma + basegot->output_offset;
+ }
+
+ return off;
+}
+
+/* Change R_TYPE to a more efficient access model where possible,
+ return the new reloc type. */
+
+static bfd_reloc_code_real_type
+aarch64_tls_transition_without_check (bfd_reloc_code_real_type r_type,
+ struct elf_link_hash_entry *h)
+{
+ bool is_local = h == NULL;
+
+ switch (r_type)
+ {
+ case BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21:
+ case BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21:
+ return (is_local
+ ? BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1
+ : BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21);
+
+ case BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21:
+ return (is_local
+ ? BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0_NC
+ : r_type);
+
+ case BFD_RELOC_AARCH64_TLSDESC_LD_PREL19:
+ return (is_local
+ ? BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1
+ : BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19);
+
+ case BFD_RELOC_AARCH64_TLSDESC_LDR:
+ return (is_local
+ ? BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0_NC
+ : BFD_RELOC_AARCH64_NONE);
+
+ case BFD_RELOC_AARCH64_TLSDESC_OFF_G0_NC:
+ return (is_local
+ ? BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1_NC
+ : BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC);
+
+ case BFD_RELOC_AARCH64_TLSDESC_OFF_G1:
+ return (is_local
+ ? BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G2
+ : BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1);
+
+ case BFD_RELOC_AARCH64_TLSDESC_LDNN_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC:
+ return (is_local
+ ? BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0_NC
+ : BFD_RELOC_AARCH64_TLSIE_LDNN_GOTTPREL_LO12_NC);
+
+ case BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
+ return is_local ? BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1 : r_type;
+
+ case BFD_RELOC_AARCH64_TLSIE_LDNN_GOTTPREL_LO12_NC:
+ return is_local ? BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0_NC : r_type;
+
+ case BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19:
+ return r_type;
+
+ case BFD_RELOC_AARCH64_TLSGD_ADR_PREL21:
+ return (is_local
+ ? BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_HI12
+ : BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19);
+
+ case BFD_RELOC_AARCH64_TLSDESC_ADD:
+ case BFD_RELOC_AARCH64_TLSDESC_ADD_LO12:
+ case BFD_RELOC_AARCH64_TLSDESC_CALL:
+ /* Instructions with these relocations will become NOPs. */
+ return BFD_RELOC_AARCH64_NONE;
+
+ case BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21:
+ case BFD_RELOC_AARCH64_TLSLD_ADR_PREL21:
+ return is_local ? BFD_RELOC_AARCH64_NONE : r_type;
+
+#if ARCH_SIZE == 64
+ case BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC:
+ return is_local
+ ? BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1_NC
+ : BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC;
+
+ case BFD_RELOC_AARCH64_TLSGD_MOVW_G1:
+ return is_local
+ ? BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G2
+ : BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1;
+#endif
+
+ default:
+ break;
+ }
+
+ return r_type;
+}
+
+static unsigned int
+aarch64_reloc_got_type (bfd_reloc_code_real_type r_type)
+{
+ switch (r_type)
+ {
+ case BFD_RELOC_AARCH64_ADR_GOT_PAGE:
+ case BFD_RELOC_AARCH64_GOT_LD_PREL19:
+ case BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14:
+ case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC:
+ case BFD_RELOC_AARCH64_LD64_GOTOFF_LO15:
+ case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15:
+ case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC:
+ case BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC:
+ case BFD_RELOC_AARCH64_MOVW_GOTOFF_G1:
+ return GOT_NORMAL;
+
+ case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21:
+ case BFD_RELOC_AARCH64_TLSGD_ADR_PREL21:
+ case BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC:
+ case BFD_RELOC_AARCH64_TLSGD_MOVW_G1:
+ case BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21:
+ case BFD_RELOC_AARCH64_TLSLD_ADR_PREL21:
+ return GOT_TLS_GD;
+
+ case BFD_RELOC_AARCH64_TLSDESC_ADD:
+ case BFD_RELOC_AARCH64_TLSDESC_ADD_LO12:
+ case BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21:
+ case BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21:
+ case BFD_RELOC_AARCH64_TLSDESC_CALL:
+ case BFD_RELOC_AARCH64_TLSDESC_LD32_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSDESC_LD64_LO12:
+ case BFD_RELOC_AARCH64_TLSDESC_LD_PREL19:
+ case BFD_RELOC_AARCH64_TLSDESC_LDR:
+ case BFD_RELOC_AARCH64_TLSDESC_OFF_G0_NC:
+ case BFD_RELOC_AARCH64_TLSDESC_OFF_G1:
+ return GOT_TLSDESC_GD;
+
+ case BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
+ case BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19:
+ case BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC:
+ case BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1:
+ return GOT_TLS_IE;
+
+ default:
+ break;
+ }
+ return GOT_UNKNOWN;
+}
+
+static bool
+aarch64_can_relax_tls (bfd *input_bfd,
+ struct bfd_link_info *info,
+ bfd_reloc_code_real_type r_type,
+ struct elf_link_hash_entry *h,
+ unsigned long r_symndx)
+{
+ unsigned int symbol_got_type;
+ unsigned int reloc_got_type;
+
+ if (! IS_AARCH64_TLS_RELAX_RELOC (r_type))
+ return false;
+
+ symbol_got_type = elfNN_aarch64_symbol_got_type (h, input_bfd, r_symndx);
+ reloc_got_type = aarch64_reloc_got_type (r_type);
+
+ if (symbol_got_type == GOT_TLS_IE && GOT_TLS_GD_ANY_P (reloc_got_type))
+ return true;
+
+ if (!bfd_link_executable (info))
+ return false;
+
+ if (h && h->root.type == bfd_link_hash_undefweak)
+ return false;
+
+ return true;
+}
+
+/* Given the relocation code R_TYPE, return the relaxed bfd reloc
+ enumerator. */
+
+static bfd_reloc_code_real_type
+aarch64_tls_transition (bfd *input_bfd,
+ struct bfd_link_info *info,
+ unsigned int r_type,
+ struct elf_link_hash_entry *h,
+ unsigned long r_symndx)
+{
+ bfd_reloc_code_real_type bfd_r_type
+ = elfNN_aarch64_bfd_reloc_from_type (input_bfd, r_type);
+
+ if (! aarch64_can_relax_tls (input_bfd, info, bfd_r_type, h, r_symndx))
+ return bfd_r_type;
+
+ return aarch64_tls_transition_without_check (bfd_r_type, h);
+}
+
+/* Return the base VMA address which should be subtracted from real addresses
+ when resolving R_AARCH64_TLS_DTPREL relocation. */
+
+static bfd_vma
+dtpoff_base (struct bfd_link_info *info)
+{
+ /* If tls_sec is NULL, we should have signalled an error already. */
+ BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL);
+ return elf_hash_table (info)->tls_sec->vma;
+}
+
+/* Return the base VMA address which should be subtracted from real addresses
+ when resolving R_AARCH64_TLS_GOTTPREL64 relocations. */
+
+static bfd_vma
+tpoff_base (struct bfd_link_info *info)
+{
+ struct elf_link_hash_table *htab = elf_hash_table (info);
+
+ /* If tls_sec is NULL, we should have signalled an error already. */
+ BFD_ASSERT (htab->tls_sec != NULL);
+
+ bfd_vma base = align_power ((bfd_vma) TCB_SIZE,
+ htab->tls_sec->alignment_power);
+ return htab->tls_sec->vma - base;
+}
+
+static bfd_vma *
+symbol_got_offset_ref (bfd *input_bfd, struct elf_link_hash_entry *h,
+ unsigned long r_symndx)
+{
+ /* Calculate the address of the GOT entry for symbol
+ referred to in h. */
+ if (h != NULL)
+ return &h->got.offset;
+ else
+ {
+ /* local symbol */
+ struct elf_aarch64_local_symbol *l;
+
+ l = elf_aarch64_locals (input_bfd);
+ return &l[r_symndx].got_offset;
+ }
+}
+
+static void
+symbol_got_offset_mark (bfd *input_bfd, struct elf_link_hash_entry *h,
+ unsigned long r_symndx)
+{
+ bfd_vma *p;
+ p = symbol_got_offset_ref (input_bfd, h, r_symndx);
+ *p |= 1;
+}
+
+static int
+symbol_got_offset_mark_p (bfd *input_bfd, struct elf_link_hash_entry *h,
+ unsigned long r_symndx)
+{
+ bfd_vma value;
+ value = * symbol_got_offset_ref (input_bfd, h, r_symndx);
+ return value & 1;
+}
+
+static bfd_vma
+symbol_got_offset (bfd *input_bfd, struct elf_link_hash_entry *h,
+ unsigned long r_symndx)
+{
+ bfd_vma value;
+ value = * symbol_got_offset_ref (input_bfd, h, r_symndx);
+ value &= ~1;
+ return value;
+}
+
+static bfd_vma *
+symbol_tlsdesc_got_offset_ref (bfd *input_bfd, struct elf_link_hash_entry *h,
+ unsigned long r_symndx)
+{
+ /* Calculate the address of the GOT entry for symbol
+ referred to in h. */
+ if (h != NULL)
+ {
+ struct elf_aarch64_link_hash_entry *eh;
+ eh = (struct elf_aarch64_link_hash_entry *) h;
+ return &eh->tlsdesc_got_jump_table_offset;
+ }
+ else
+ {
+ /* local symbol */
+ struct elf_aarch64_local_symbol *l;
+
+ l = elf_aarch64_locals (input_bfd);
+ return &l[r_symndx].tlsdesc_got_jump_table_offset;
+ }
+}
+
+static void
+symbol_tlsdesc_got_offset_mark (bfd *input_bfd, struct elf_link_hash_entry *h,
+ unsigned long r_symndx)
+{
+ bfd_vma *p;
+ p = symbol_tlsdesc_got_offset_ref (input_bfd, h, r_symndx);
+ *p |= 1;
+}
+
+static int
+symbol_tlsdesc_got_offset_mark_p (bfd *input_bfd,
+ struct elf_link_hash_entry *h,
+ unsigned long r_symndx)
+{
+ bfd_vma value;
+ value = * symbol_tlsdesc_got_offset_ref (input_bfd, h, r_symndx);
+ return value & 1;
+}
+
+static bfd_vma
+symbol_tlsdesc_got_offset (bfd *input_bfd, struct elf_link_hash_entry *h,
+ unsigned long r_symndx)
+{
+ bfd_vma value;
+ value = * symbol_tlsdesc_got_offset_ref (input_bfd, h, r_symndx);
+ value &= ~1;
+ return value;
+}
+
+/* Data for make_branch_to_erratum_835769_stub(). */
+
+struct erratum_835769_branch_to_stub_data
+{
+ struct bfd_link_info *info;
+ asection *output_section;
+ bfd_byte *contents;
+};
+
+/* Helper to insert branches to erratum 835769 stubs in the right
+ places for a particular section. */
+
+static bool
+make_branch_to_erratum_835769_stub (struct bfd_hash_entry *gen_entry,
+ void *in_arg)
+{
+ struct elf_aarch64_stub_hash_entry *stub_entry;
+ struct erratum_835769_branch_to_stub_data *data;
+ bfd_byte *contents;
+ unsigned long branch_insn = 0;
+ bfd_vma veneered_insn_loc, veneer_entry_loc;
+ bfd_signed_vma branch_offset;
+ unsigned int target;
+ bfd *abfd;
+
+ stub_entry = (struct elf_aarch64_stub_hash_entry *) gen_entry;
+ data = (struct erratum_835769_branch_to_stub_data *) in_arg;
+
+ if (stub_entry->target_section != data->output_section
+ || stub_entry->stub_type != aarch64_stub_erratum_835769_veneer)
+ return true;
+
+ contents = data->contents;
+ veneered_insn_loc = stub_entry->target_section->output_section->vma
+ + stub_entry->target_section->output_offset
+ + stub_entry->target_value;
+ veneer_entry_loc = stub_entry->stub_sec->output_section->vma
+ + stub_entry->stub_sec->output_offset
+ + stub_entry->stub_offset;
+ branch_offset = veneer_entry_loc - veneered_insn_loc;
+
+ abfd = stub_entry->target_section->owner;
+ if (!aarch64_valid_branch_p (veneer_entry_loc, veneered_insn_loc))
+ _bfd_error_handler
+ (_("%pB: error: erratum 835769 stub out "
+ "of range (input file too large)"), abfd);
+
+ target = stub_entry->target_value;
+ branch_insn = 0x14000000;
+ branch_offset >>= 2;
+ branch_offset &= 0x3ffffff;
+ branch_insn |= branch_offset;
+ bfd_putl32 (branch_insn, &contents[target]);
+
+ return true;
+}
+
+
+static bool
+_bfd_aarch64_erratum_843419_branch_to_stub (struct bfd_hash_entry *gen_entry,
+ void *in_arg)
+{
+ struct elf_aarch64_stub_hash_entry *stub_entry
+ = (struct elf_aarch64_stub_hash_entry *) gen_entry;
+ struct erratum_835769_branch_to_stub_data *data
+ = (struct erratum_835769_branch_to_stub_data *) in_arg;
+ struct bfd_link_info *info;
+ struct elf_aarch64_link_hash_table *htab;
+ bfd_byte *contents;
+ asection *section;
+ bfd *abfd;
+ bfd_vma place;
+ uint32_t insn;
+
+ info = data->info;
+ contents = data->contents;
+ section = data->output_section;
+
+ htab = elf_aarch64_hash_table (info);
+
+ if (stub_entry->target_section != section
+ || stub_entry->stub_type != aarch64_stub_erratum_843419_veneer)
+ return true;
+
+ BFD_ASSERT (((htab->fix_erratum_843419 & ERRAT_ADRP) && stub_entry->stub_sec)
+ || (htab->fix_erratum_843419 & ERRAT_ADR));
+
+ /* Only update the stub section if we have one. We should always have one if
+ we're allowed to use the ADRP errata workaround, otherwise it is not
+ required. */
+ if (stub_entry->stub_sec)
+ {
+ insn = bfd_getl32 (contents + stub_entry->target_value);
+ bfd_putl32 (insn,
+ stub_entry->stub_sec->contents + stub_entry->stub_offset);
+ }
+
+ place = (section->output_section->vma + section->output_offset
+ + stub_entry->adrp_offset);
+ insn = bfd_getl32 (contents + stub_entry->adrp_offset);
+
+ if (!_bfd_aarch64_adrp_p (insn))
+ abort ();
+
+ bfd_signed_vma imm =
+ (_bfd_aarch64_sign_extend
+ ((bfd_vma) _bfd_aarch64_decode_adrp_imm (insn) << 12, 33)
+ - (place & 0xfff));
+
+ if ((htab->fix_erratum_843419 & ERRAT_ADR)
+ && (imm >= AARCH64_MIN_ADRP_IMM && imm <= AARCH64_MAX_ADRP_IMM))
+ {
+ insn = (_bfd_aarch64_reencode_adr_imm (AARCH64_ADR_OP, imm)
+ | AARCH64_RT (insn));
+ bfd_putl32 (insn, contents + stub_entry->adrp_offset);
+ /* Stub is not needed, don't map it out. */
+ stub_entry->stub_type = aarch64_stub_none;
+ }
+ else if (htab->fix_erratum_843419 & ERRAT_ADRP)
+ {
+ bfd_vma veneered_insn_loc;
+ bfd_vma veneer_entry_loc;
+ bfd_signed_vma branch_offset;
+ uint32_t branch_insn;
+
+ veneered_insn_loc = stub_entry->target_section->output_section->vma
+ + stub_entry->target_section->output_offset
+ + stub_entry->target_value;
+ veneer_entry_loc = stub_entry->stub_sec->output_section->vma
+ + stub_entry->stub_sec->output_offset
+ + stub_entry->stub_offset;
+ branch_offset = veneer_entry_loc - veneered_insn_loc;
+
+ abfd = stub_entry->target_section->owner;
+ if (!aarch64_valid_branch_p (veneer_entry_loc, veneered_insn_loc))
+ _bfd_error_handler
+ (_("%pB: error: erratum 843419 stub out "
+ "of range (input file too large)"), abfd);
+
+ branch_insn = 0x14000000;
+ branch_offset >>= 2;
+ branch_offset &= 0x3ffffff;
+ branch_insn |= branch_offset;
+ bfd_putl32 (branch_insn, contents + stub_entry->target_value);
+ }
+ else
+ {
+ abfd = stub_entry->target_section->owner;
+ _bfd_error_handler
+ (_("%pB: error: erratum 843419 immediate 0x%" BFD_VMA_FMT "x "
+ "out of range for ADR (input file too large) and "
+ "--fix-cortex-a53-843419=adr used. Run the linker with "
+ "--fix-cortex-a53-843419=full instead"), abfd, imm);
+ bfd_set_error (bfd_error_bad_value);
+ /* This function is called inside a hashtable traversal and the error
+ handlers called above turn into non-fatal errors. Which means this
+ case ld returns an exit code 0 and also produces a broken object file.
+ To prevent this, issue a hard abort. */
+ BFD_FAIL ();
+ }
+ return true;
+}
+
+
+static bool
+elfNN_aarch64_write_section (bfd *output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *link_info,
+ asection *sec,
+ bfd_byte *contents)
+
+{
+ struct elf_aarch64_link_hash_table *globals =
+ elf_aarch64_hash_table (link_info);
+
+ if (globals == NULL)
+ return false;
+
+ /* Fix code to point to erratum 835769 stubs. */
+ if (globals->fix_erratum_835769)
+ {
+ struct erratum_835769_branch_to_stub_data data;
+
+ data.info = link_info;
+ data.output_section = sec;
+ data.contents = contents;
+ bfd_hash_traverse (&globals->stub_hash_table,
+ make_branch_to_erratum_835769_stub, &data);
+ }
+
+ if (globals->fix_erratum_843419)
+ {
+ struct erratum_835769_branch_to_stub_data data;
+
+ data.info = link_info;
+ data.output_section = sec;
+ data.contents = contents;
+ bfd_hash_traverse (&globals->stub_hash_table,
+ _bfd_aarch64_erratum_843419_branch_to_stub, &data);
+ }
+
+ return false;
+}
+
+/* Return TRUE if RELOC is a relocation against the base of GOT table. */
+
+static bool
+aarch64_relocation_aginst_gp_p (bfd_reloc_code_real_type reloc)
+{
+ return (reloc == BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14
+ || reloc == BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15
+ || reloc == BFD_RELOC_AARCH64_LD64_GOTOFF_LO15
+ || reloc == BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC
+ || reloc == BFD_RELOC_AARCH64_MOVW_GOTOFF_G1);
+}
+
+/* Perform a relocation as part of a final link. The input relocation type
+ should be TLS relaxed. */
+
+static bfd_reloc_status_type
+elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
+ bfd *input_bfd,
+ bfd *output_bfd,
+ asection *input_section,
+ bfd_byte *contents,
+ Elf_Internal_Rela *rel,
+ bfd_vma value,
+ struct bfd_link_info *info,
+ asection *sym_sec,
+ struct elf_link_hash_entry *h,
+ bool *unresolved_reloc_p,
+ bool save_addend,
+ bfd_vma *saved_addend,
+ Elf_Internal_Sym *sym)
+{
+ Elf_Internal_Shdr *symtab_hdr;
+ unsigned int r_type = howto->type;
+ bfd_reloc_code_real_type bfd_r_type
+ = elfNN_aarch64_bfd_reloc_from_howto (howto);
+ unsigned long r_symndx;
+ bfd_byte *hit_data = contents + rel->r_offset;
+ bfd_vma place, off, got_entry_addr = 0;
+ bfd_signed_vma signed_addend;
+ struct elf_aarch64_link_hash_table *globals;
+ bool weak_undef_p;
+ bool relative_reloc;
+ asection *base_got;
+ bfd_vma orig_value = value;
+ bool resolved_to_zero;
+ bool abs_symbol_p;
+
+ globals = elf_aarch64_hash_table (info);
+
+ symtab_hdr = &elf_symtab_hdr (input_bfd);
+
+ BFD_ASSERT (is_aarch64_elf (input_bfd));
+
+ r_symndx = ELFNN_R_SYM (rel->r_info);
+
+ place = input_section->output_section->vma
+ + input_section->output_offset + rel->r_offset;
+
+ /* Get addend, accumulating the addend for consecutive relocs
+ which refer to the same offset. */
+ signed_addend = saved_addend ? *saved_addend : 0;
+ signed_addend += rel->r_addend;
+
+ weak_undef_p = (h ? h->root.type == bfd_link_hash_undefweak
+ : bfd_is_und_section (sym_sec));
+ abs_symbol_p = h != NULL && bfd_is_abs_symbol (&h->root);
+
+
+ /* Since STT_GNU_IFUNC symbol must go through PLT, we handle
+ it here if it is defined in a non-shared object. */
+ if (h != NULL
+ && h->type == STT_GNU_IFUNC
+ && (input_section->flags & SEC_ALLOC)
+ && h->def_regular)
+ {
+ asection *plt;
+ const char *name;
+ bfd_vma addend = 0;
+
+ if ((input_section->flags & SEC_ALLOC) == 0)
+ {
+ /* If this is a SHT_NOTE section without SHF_ALLOC, treat
+ STT_GNU_IFUNC symbol as STT_FUNC. */
+ if (elf_section_type (input_section) == SHT_NOTE)
+ goto skip_ifunc;
+
+ /* Dynamic relocs are not propagated for SEC_DEBUGGING
+ sections because such sections are not SEC_ALLOC and
+ thus ld.so will not process them. */
+ if ((input_section->flags & SEC_DEBUGGING) != 0)
+ return bfd_reloc_ok;
+
+ if (h->root.root.string)
+ name = h->root.root.string;
+ else
+ name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym, NULL);
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%pB(%pA+%#" PRIx64 "): "
+ "unresolvable %s relocation against symbol `%s'"),
+ input_bfd, input_section, (uint64_t) rel->r_offset,
+ howto->name, name);
+ bfd_set_error (bfd_error_bad_value);
+ return bfd_reloc_notsupported;
+ }
+ else if (h->plt.offset == (bfd_vma) -1)
+ goto bad_ifunc_reloc;
+
+ /* STT_GNU_IFUNC symbol must go through PLT. */
+ plt = globals->root.splt ? globals->root.splt : globals->root.iplt;
+ value = (plt->output_section->vma + plt->output_offset + h->plt.offset);
+
+ switch (bfd_r_type)
+ {
+ default:
+ bad_ifunc_reloc:
+ if (h->root.root.string)
+ name = h->root.root.string;
+ else
+ name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym,
+ NULL);
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%pB: relocation %s against STT_GNU_IFUNC "
+ "symbol `%s' isn't handled by %s"), input_bfd,
+ howto->name, name, __FUNCTION__);
+ bfd_set_error (bfd_error_bad_value);
+ return bfd_reloc_notsupported;
+
+ case BFD_RELOC_AARCH64_NN:
+ if (rel->r_addend != 0)
+ {
+ if (h->root.root.string)
+ name = h->root.root.string;
+ else
+ name = bfd_elf_sym_name (input_bfd, symtab_hdr,
+ sym, NULL);
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%pB: relocation %s against STT_GNU_IFUNC "
+ "symbol `%s' has non-zero addend: %" PRId64),
+ input_bfd, howto->name, name, (int64_t) rel->r_addend);
+ bfd_set_error (bfd_error_bad_value);
+ return bfd_reloc_notsupported;
+ }
+
+ /* Generate dynamic relocation only when there is a
+ non-GOT reference in a shared object. */
+ if (bfd_link_pic (info) && h->non_got_ref)
+ {
+ Elf_Internal_Rela outrel;
+ asection *sreloc;
+
+ /* Need a dynamic relocation to get the real function
+ address. */
+ outrel.r_offset = _bfd_elf_section_offset (output_bfd,
+ info,
+ input_section,
+ rel->r_offset);
+ if (outrel.r_offset == (bfd_vma) -1
+ || outrel.r_offset == (bfd_vma) -2)
+ abort ();
+
+ outrel.r_offset += (input_section->output_section->vma
+ + input_section->output_offset);
+
+ if (h->dynindx == -1
+ || h->forced_local
+ || bfd_link_executable (info))
+ {
+ /* This symbol is resolved locally. */
+ outrel.r_info = ELFNN_R_INFO (0, AARCH64_R (IRELATIVE));
+ outrel.r_addend = (h->root.u.def.value
+ + h->root.u.def.section->output_section->vma
+ + h->root.u.def.section->output_offset);
+ }
+ else
+ {
+ outrel.r_info = ELFNN_R_INFO (h->dynindx, r_type);
+ outrel.r_addend = 0;
+ }
+
+ sreloc = globals->root.irelifunc;
+ elf_append_rela (output_bfd, sreloc, &outrel);
+
+ /* If this reloc is against an external symbol, we
+ do not want to fiddle with the addend. Otherwise,
+ we need to include the symbol value so that it
+ becomes an addend for the dynamic reloc. For an
+ internal symbol, we have updated addend. */
+ return bfd_reloc_ok;
+ }
+ /* FALLTHROUGH */
+ case BFD_RELOC_AARCH64_CALL26:
+ case BFD_RELOC_AARCH64_JUMP26:
+ value = _bfd_aarch64_elf_resolve_relocation (input_bfd, bfd_r_type,
+ place, value,
+ signed_addend,
+ weak_undef_p);
+ return _bfd_aarch64_elf_put_addend (input_bfd, hit_data, bfd_r_type,
+ howto, value);
+ case BFD_RELOC_AARCH64_ADR_GOT_PAGE:
+ case BFD_RELOC_AARCH64_GOT_LD_PREL19:
+ case BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14:
+ case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC:
+ case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15:
+ case BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC:
+ case BFD_RELOC_AARCH64_MOVW_GOTOFF_G1:
+ case BFD_RELOC_AARCH64_LD64_GOTOFF_LO15:
+ case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC:
+ base_got = globals->root.sgot;
+ off = h->got.offset;
+
+ if (base_got == NULL)
+ abort ();
+
+ if (off == (bfd_vma) -1)
+ {
+ bfd_vma plt_index;
+
+ /* We can't use h->got.offset here to save state, or
+ even just remember the offset, as finish_dynamic_symbol
+ would use that as offset into .got. */
+
+ if (globals->root.splt != NULL)
+ {
+ plt_index = ((h->plt.offset - globals->plt_header_size) /
+ globals->plt_entry_size);
+ off = (plt_index + 3) * GOT_ENTRY_SIZE;
+ base_got = globals->root.sgotplt;
+ }
+ else
+ {
+ plt_index = h->plt.offset / globals->plt_entry_size;
+ off = plt_index * GOT_ENTRY_SIZE;
+ base_got = globals->root.igotplt;
+ }
+
+ if (h->dynindx == -1
+ || h->forced_local
+ || info->symbolic)
+ {
+ /* This references the local definition. We must
+ initialize this entry in the global offset table.
+ Since the offset must always be a multiple of 8,
+ we use the least significant bit to record
+ whether we have initialized it already.
+
+ When doing a dynamic link, we create a .rela.got
+ relocation entry to initialize the value. This
+ is done in the finish_dynamic_symbol routine. */
+ if ((off & 1) != 0)
+ off &= ~1;
+ else
+ {
+ bfd_put_NN (output_bfd, value,
+ base_got->contents + off);
+ /* Note that this is harmless as -1 | 1 still is -1. */
+ h->got.offset |= 1;
+ }
+ }
+ value = (base_got->output_section->vma
+ + base_got->output_offset + off);
+ }
+ else
+ value = aarch64_calculate_got_entry_vma (h, globals, info,
+ value, output_bfd,
+ unresolved_reloc_p);
+
+ if (aarch64_relocation_aginst_gp_p (bfd_r_type))
+ addend = (globals->root.sgot->output_section->vma
+ + globals->root.sgot->output_offset);
+
+ value = _bfd_aarch64_elf_resolve_relocation (input_bfd, bfd_r_type,
+ place, value,
+ addend, weak_undef_p);
+ return _bfd_aarch64_elf_put_addend (input_bfd, hit_data, bfd_r_type, howto, value);
+ case BFD_RELOC_AARCH64_ADD_LO12:
+ case BFD_RELOC_AARCH64_ADR_HI21_PCREL:
+ break;
+ }
+ }
+
+ skip_ifunc:
+ resolved_to_zero = (h != NULL
+ && UNDEFWEAK_NO_DYNAMIC_RELOC (info, h));
+
+ switch (bfd_r_type)
+ {
+ case BFD_RELOC_AARCH64_NONE:
+ case BFD_RELOC_AARCH64_TLSDESC_ADD:
+ case BFD_RELOC_AARCH64_TLSDESC_CALL:
+ case BFD_RELOC_AARCH64_TLSDESC_LDR:
+ *unresolved_reloc_p = false;
+ return bfd_reloc_ok;
+
+ case BFD_RELOC_AARCH64_NN:
+
+ /* When generating a shared object or relocatable executable, these
+ relocations are copied into the output file to be resolved at
+ run time. */
+ if (((bfd_link_pic (info)
+ || globals->root.is_relocatable_executable)
+ && (input_section->flags & SEC_ALLOC)
+ && (h == NULL
+ || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ && !resolved_to_zero)
+ || h->root.type != bfd_link_hash_undefweak))
+ /* Or we are creating an executable, we may need to keep relocations
+ for symbols satisfied by a dynamic library if we manage to avoid
+ copy relocs for the symbol. */
+ || (ELIMINATE_COPY_RELOCS
+ && !bfd_link_pic (info)
+ && h != NULL
+ && (input_section->flags & SEC_ALLOC)
+ && h->dynindx != -1
+ && !h->non_got_ref
+ && ((h->def_dynamic
+ && !h->def_regular)
+ || h->root.type == bfd_link_hash_undefweak
+ || h->root.type == bfd_link_hash_undefined)))
+ {
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
+ bool skip, relocate;
+ asection *sreloc;
+
+ *unresolved_reloc_p = false;
+
+ skip = false;
+ relocate = false;
+
+ outrel.r_addend = signed_addend;
+ outrel.r_offset =
+ _bfd_elf_section_offset (output_bfd, info, input_section,
+ rel->r_offset);
+ if (outrel.r_offset == (bfd_vma) - 1)
+ skip = true;
+ else if (outrel.r_offset == (bfd_vma) - 2)
+ {
+ skip = true;
+ relocate = true;
+ }
+ else if (abs_symbol_p)
+ {
+ /* Local absolute symbol. */
+ skip = (h->forced_local || (h->dynindx == -1));
+ relocate = skip;
+ }
+
+ outrel.r_offset += (input_section->output_section->vma
+ + input_section->output_offset);
+
+ if (skip)
+ memset (&outrel, 0, sizeof outrel);
+ else if (h != NULL
+ && h->dynindx != -1
+ && (!bfd_link_pic (info)
+ || !(bfd_link_pie (info) || SYMBOLIC_BIND (info, h))
+ || !h->def_regular))
+ outrel.r_info = ELFNN_R_INFO (h->dynindx, r_type);
+ else
+ {
+ int symbol;
+
+ /* On SVR4-ish systems, the dynamic loader cannot
+ relocate the text and data segments independently,
+ so the symbol does not matter. */
+ symbol = 0;
+ relocate = !globals->no_apply_dynamic_relocs;
+ outrel.r_info = ELFNN_R_INFO (symbol, AARCH64_R (RELATIVE));
+ outrel.r_addend += value;
+ }
+
+ sreloc = elf_section_data (input_section)->sreloc;
+ if (sreloc == NULL || sreloc->contents == NULL)
+ return bfd_reloc_notsupported;
+
+ loc = sreloc->contents + sreloc->reloc_count++ * RELOC_SIZE (globals);
+ bfd_elfNN_swap_reloca_out (output_bfd, &outrel, loc);
+
+ if (sreloc->reloc_count * RELOC_SIZE (globals) > sreloc->size)
+ {
+ /* Sanity to check that we have previously allocated
+ sufficient space in the relocation section for the
+ number of relocations we actually want to emit. */
+ abort ();
+ }
+
+ /* If this reloc is against an external symbol, we do not want to
+ fiddle with the addend. Otherwise, we need to include the symbol
+ value so that it becomes an addend for the dynamic reloc. */
+ if (!relocate)
+ return bfd_reloc_ok;
+
+ return _bfd_final_link_relocate (howto, input_bfd, input_section,
+ contents, rel->r_offset, value,
+ signed_addend);
+ }
+ else
+ value += signed_addend;
+ break;
+
+ case BFD_RELOC_AARCH64_CALL26:
+ case BFD_RELOC_AARCH64_JUMP26:
+ {
+ asection *splt = globals->root.splt;
+ bool via_plt_p =
+ splt != NULL && h != NULL && h->plt.offset != (bfd_vma) - 1;
+
+ /* A call to an undefined weak symbol is converted to a jump to
+ the next instruction unless a PLT entry will be created.
+ The jump to the next instruction is optimized as a NOP.
+ Do the same for local undefined symbols. */
+ if (weak_undef_p && ! via_plt_p)
+ {
+ bfd_putl32 (INSN_NOP, hit_data);
+ return bfd_reloc_ok;
+ }
+
+ /* If the call goes through a PLT entry, make sure to
+ check distance to the right destination address. */
+ if (via_plt_p)
+ value = (splt->output_section->vma
+ + splt->output_offset + h->plt.offset);
+
+ /* Check if a stub has to be inserted because the destination
+ is too far away. */
+ struct elf_aarch64_stub_hash_entry *stub_entry = NULL;
+
+ /* If the branch destination is directed to plt stub, "value" will be
+ the final destination, otherwise we should plus signed_addend, it may
+ contain non-zero value, for example call to local function symbol
+ which are turned into "sec_sym + sec_off", and sec_off is kept in
+ signed_addend. */
+ if (! aarch64_valid_branch_p (via_plt_p ? value : value + signed_addend,
+ place))
+ /* The target is out of reach, so redirect the branch to
+ the local stub for this function. */
+ stub_entry = elfNN_aarch64_get_stub_entry (input_section, sym_sec, h,
+ rel, globals);
+ if (stub_entry != NULL)
+ {
+ value = (stub_entry->stub_offset
+ + stub_entry->stub_sec->output_offset
+ + stub_entry->stub_sec->output_section->vma);
+
+ /* We have redirected the destination to stub entry address,
+ so ignore any addend record in the original rela entry. */
+ signed_addend = 0;
+ }
+ }
+ value = _bfd_aarch64_elf_resolve_relocation (input_bfd, bfd_r_type,
+ place, value,
+ signed_addend, weak_undef_p);
+ *unresolved_reloc_p = false;
+ break;
+
+ case BFD_RELOC_AARCH64_16_PCREL:
+ case BFD_RELOC_AARCH64_32_PCREL:
+ case BFD_RELOC_AARCH64_64_PCREL:
+ case BFD_RELOC_AARCH64_ADR_HI21_NC_PCREL:
+ case BFD_RELOC_AARCH64_ADR_HI21_PCREL:
+ case BFD_RELOC_AARCH64_ADR_LO21_PCREL:
+ case BFD_RELOC_AARCH64_LD_LO19_PCREL:
+ case BFD_RELOC_AARCH64_MOVW_PREL_G0:
+ case BFD_RELOC_AARCH64_MOVW_PREL_G0_NC:
+ case BFD_RELOC_AARCH64_MOVW_PREL_G1:
+ case BFD_RELOC_AARCH64_MOVW_PREL_G1_NC:
+ case BFD_RELOC_AARCH64_MOVW_PREL_G2:
+ case BFD_RELOC_AARCH64_MOVW_PREL_G2_NC:
+ case BFD_RELOC_AARCH64_MOVW_PREL_G3:
+ if (bfd_link_pic (info)
+ && (input_section->flags & SEC_ALLOC) != 0
+ && (input_section->flags & SEC_READONLY) != 0
+ && !SYMBOL_REFERENCES_LOCAL (info, h))
+ {
+ int howto_index = bfd_r_type - BFD_RELOC_AARCH64_RELOC_START;
+
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%pB: relocation %s against symbol `%s' which may bind "
+ "externally can not be used when making a shared object; "
+ "recompile with -fPIC"),
+ input_bfd, elfNN_aarch64_howto_table[howto_index].name,
+ h->root.root.string);
+ bfd_set_error (bfd_error_bad_value);
+ return bfd_reloc_notsupported;
+ }
+ value = _bfd_aarch64_elf_resolve_relocation (input_bfd, bfd_r_type,
+ place, value,
+ signed_addend,
+ weak_undef_p);
+ break;
+
+ case BFD_RELOC_AARCH64_BRANCH19:
+ case BFD_RELOC_AARCH64_TSTBR14:
+ if (h && h->root.type == bfd_link_hash_undefined)
+ {
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%pB: conditional branch to undefined symbol `%s' "
+ "not allowed"), input_bfd, h->root.root.string);
+ bfd_set_error (bfd_error_bad_value);
+ return bfd_reloc_notsupported;
+ }
+ /* Fall through. */
+
+ case BFD_RELOC_AARCH64_16:
+#if ARCH_SIZE == 64
+ case BFD_RELOC_AARCH64_32:
+#endif
+ case BFD_RELOC_AARCH64_ADD_LO12:
+ case BFD_RELOC_AARCH64_LDST128_LO12:
+ case BFD_RELOC_AARCH64_LDST16_LO12:
+ case BFD_RELOC_AARCH64_LDST32_LO12:
+ case BFD_RELOC_AARCH64_LDST64_LO12:
+ case BFD_RELOC_AARCH64_LDST8_LO12:
+ case BFD_RELOC_AARCH64_MOVW_G0:
+ case BFD_RELOC_AARCH64_MOVW_G0_NC:
+ case BFD_RELOC_AARCH64_MOVW_G0_S:
+ case BFD_RELOC_AARCH64_MOVW_G1:
+ case BFD_RELOC_AARCH64_MOVW_G1_NC:
+ case BFD_RELOC_AARCH64_MOVW_G1_S:
+ case BFD_RELOC_AARCH64_MOVW_G2:
+ case BFD_RELOC_AARCH64_MOVW_G2_NC:
+ case BFD_RELOC_AARCH64_MOVW_G2_S:
+ case BFD_RELOC_AARCH64_MOVW_G3:
+ value = _bfd_aarch64_elf_resolve_relocation (input_bfd, bfd_r_type,
+ place, value,
+ signed_addend, weak_undef_p);
+ break;
+
+ case BFD_RELOC_AARCH64_ADR_GOT_PAGE:
+ case BFD_RELOC_AARCH64_GOT_LD_PREL19:
+ case BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14:
+ case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC:
+ case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15:
+ case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC:
+ case BFD_RELOC_AARCH64_LD64_GOTOFF_LO15:
+ case BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC:
+ case BFD_RELOC_AARCH64_MOVW_GOTOFF_G1:
+ if (globals->root.sgot == NULL)
+ BFD_ASSERT (h != NULL);
+
+ relative_reloc = false;
+ if (h != NULL)
+ {
+ bfd_vma addend = 0;
+
+ /* If a symbol is not dynamic and is not undefined weak, bind it
+ locally and generate a RELATIVE relocation under PIC mode.
+
+ NOTE: one symbol may be referenced by several relocations, we
+ should only generate one RELATIVE relocation for that symbol.
+ Therefore, check GOT offset mark first. */
+ if (h->dynindx == -1
+ && !h->forced_local
+ && h->root.type != bfd_link_hash_undefweak
+ && bfd_link_pic (info)
+ && !symbol_got_offset_mark_p (input_bfd, h, r_symndx))
+ relative_reloc = true;
+
+ value = aarch64_calculate_got_entry_vma (h, globals, info, value,
+ output_bfd,
+ unresolved_reloc_p);
+ /* Record the GOT entry address which will be used when generating
+ RELATIVE relocation. */
+ if (relative_reloc)
+ got_entry_addr = value;
+
+ if (aarch64_relocation_aginst_gp_p (bfd_r_type))
+ addend = (globals->root.sgot->output_section->vma
+ + globals->root.sgot->output_offset);
+ value = _bfd_aarch64_elf_resolve_relocation (input_bfd, bfd_r_type,
+ place, value,
+ addend, weak_undef_p);
+ }
+ else
+ {
+ bfd_vma addend = 0;
+ struct elf_aarch64_local_symbol *locals
+ = elf_aarch64_locals (input_bfd);
+
+ if (locals == NULL)
+ {
+ int howto_index = bfd_r_type - BFD_RELOC_AARCH64_RELOC_START;
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%pB: local symbol descriptor table be NULL when applying "
+ "relocation %s against local symbol"),
+ input_bfd, elfNN_aarch64_howto_table[howto_index].name);
+ abort ();
+ }
+
+ off = symbol_got_offset (input_bfd, h, r_symndx);
+ base_got = globals->root.sgot;
+ got_entry_addr = (base_got->output_section->vma
+ + base_got->output_offset + off);
+
+ if (!symbol_got_offset_mark_p (input_bfd, h, r_symndx))
+ {
+ bfd_put_64 (output_bfd, value, base_got->contents + off);
+
+ /* For local symbol, we have done absolute relocation in static
+ linking stage. While for shared library, we need to update the
+ content of GOT entry according to the shared object's runtime
+ base address. So, we need to generate a R_AARCH64_RELATIVE reloc
+ for dynamic linker. */
+ if (bfd_link_pic (info))
+ relative_reloc = true;
+
+ symbol_got_offset_mark (input_bfd, h, r_symndx);
+ }
+
+ /* Update the relocation value to GOT entry addr as we have transformed
+ the direct data access into indirect data access through GOT. */
+ value = got_entry_addr;
+
+ if (aarch64_relocation_aginst_gp_p (bfd_r_type))
+ addend = base_got->output_section->vma + base_got->output_offset;
+
+ value = _bfd_aarch64_elf_resolve_relocation (input_bfd, bfd_r_type,
+ place, value,
+ addend, weak_undef_p);
+ }
+
+ if (relative_reloc)
+ {
+ asection *s;
+ Elf_Internal_Rela outrel;
+
+ s = globals->root.srelgot;
+ if (s == NULL)
+ abort ();
+
+ outrel.r_offset = got_entry_addr;
+ outrel.r_info = ELFNN_R_INFO (0, AARCH64_R (RELATIVE));
+ outrel.r_addend = orig_value;
+ elf_append_rela (output_bfd, s, &outrel);
+ }
+ break;
+
+ case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21:
+ case BFD_RELOC_AARCH64_TLSGD_ADR_PREL21:
+ case BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
+ case BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19:
+ case BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21:
+ case BFD_RELOC_AARCH64_TLSLD_ADR_PREL21:
+ if (globals->root.sgot == NULL)
+ return bfd_reloc_notsupported;
+
+ value = (symbol_got_offset (input_bfd, h, r_symndx)
+ + globals->root.sgot->output_section->vma
+ + globals->root.sgot->output_offset);
+
+ value = _bfd_aarch64_elf_resolve_relocation (input_bfd, bfd_r_type,
+ place, value,
+ 0, weak_undef_p);
+ *unresolved_reloc_p = false;
+ break;
+
+ case BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC:
+ case BFD_RELOC_AARCH64_TLSGD_MOVW_G1:
+ case BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC:
+ case BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1:
+ if (globals->root.sgot == NULL)
+ return bfd_reloc_notsupported;
+
+ value = symbol_got_offset (input_bfd, h, r_symndx);
+ value = _bfd_aarch64_elf_resolve_relocation (input_bfd, bfd_r_type,
+ place, value,
+ 0, weak_undef_p);
+ *unresolved_reloc_p = false;
+ break;
+
+ case BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_HI12:
+ case BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12:
+ case BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12:
+ case BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12:
+ case BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12:
+ case BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12:
+ case BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0:
+ case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC:
+ case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1:
+ case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1_NC:
+ case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G2:
+ {
+ if (!(weak_undef_p || elf_hash_table (info)->tls_sec))
+ {
+ int howto_index = bfd_r_type - BFD_RELOC_AARCH64_RELOC_START;
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%pB: TLS relocation %s against undefined symbol `%s'"),
+ input_bfd, elfNN_aarch64_howto_table[howto_index].name,
+ h->root.root.string);
+ bfd_set_error (bfd_error_bad_value);
+ return bfd_reloc_notsupported;
+ }
+
+ bfd_vma def_value
+ = weak_undef_p ? 0 : signed_addend - dtpoff_base (info);
+ value = _bfd_aarch64_elf_resolve_relocation (input_bfd, bfd_r_type,
+ place, value,
+ def_value, weak_undef_p);
+ break;
+ }
+
+ case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_HI12:
+ case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12:
+ case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12:
+ case BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12:
+ case BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12:
+ case BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12:
+ case BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0:
+ case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0_NC:
+ case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1:
+ case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1_NC:
+ case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G2:
+ {
+ if (!(weak_undef_p || elf_hash_table (info)->tls_sec))
+ {
+ int howto_index = bfd_r_type - BFD_RELOC_AARCH64_RELOC_START;
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%pB: TLS relocation %s against undefined symbol `%s'"),
+ input_bfd, elfNN_aarch64_howto_table[howto_index].name,
+ h->root.root.string);
+ bfd_set_error (bfd_error_bad_value);
+ return bfd_reloc_notsupported;
+ }
+
+ bfd_vma def_value
+ = weak_undef_p ? 0 : signed_addend - tpoff_base (info);
+ value = _bfd_aarch64_elf_resolve_relocation (input_bfd, bfd_r_type,
+ place, value,
+ def_value, weak_undef_p);
+ *unresolved_reloc_p = false;
+ break;
+ }
+
+ case BFD_RELOC_AARCH64_TLSDESC_ADD_LO12:
+ case BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21:
+ case BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21:
+ case BFD_RELOC_AARCH64_TLSDESC_LD32_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSDESC_LD64_LO12:
+ case BFD_RELOC_AARCH64_TLSDESC_LD_PREL19:
+ if (globals->root.sgot == NULL)
+ return bfd_reloc_notsupported;
+ value = (symbol_tlsdesc_got_offset (input_bfd, h, r_symndx)
+ + globals->root.sgotplt->output_section->vma
+ + globals->root.sgotplt->output_offset
+ + globals->sgotplt_jump_table_size);
+
+ value = _bfd_aarch64_elf_resolve_relocation (input_bfd, bfd_r_type,
+ place, value,
+ 0, weak_undef_p);
+ *unresolved_reloc_p = false;
+ break;
+
+ case BFD_RELOC_AARCH64_TLSDESC_OFF_G0_NC:
+ case BFD_RELOC_AARCH64_TLSDESC_OFF_G1:
+ if (globals->root.sgot == NULL)
+ return bfd_reloc_notsupported;
+
+ value = (symbol_tlsdesc_got_offset (input_bfd, h, r_symndx)
+ + globals->root.sgotplt->output_section->vma
+ + globals->root.sgotplt->output_offset
+ + globals->sgotplt_jump_table_size);
+
+ value -= (globals->root.sgot->output_section->vma
+ + globals->root.sgot->output_offset);
+
+ value = _bfd_aarch64_elf_resolve_relocation (input_bfd, bfd_r_type,
+ place, value,
+ 0, weak_undef_p);
+ *unresolved_reloc_p = false;
+ break;
+
+ default:
+ return bfd_reloc_notsupported;
+ }
+
+ if (saved_addend)
+ *saved_addend = value;
+
+ /* Only apply the final relocation in a sequence. */
+ if (save_addend)
+ return bfd_reloc_continue;
+
+ return _bfd_aarch64_elf_put_addend (input_bfd, hit_data, bfd_r_type,
+ howto, value);
+}
+
+/* LP64 and ILP32 operates on x- and w-registers respectively.
+ Next definitions take into account the difference between
+ corresponding machine codes. R means x-register if the target
+ arch is LP64, and w-register if the target is ILP32. */
+
+#if ARCH_SIZE == 64
+# define add_R0_R0 (0x91000000)
+# define add_R0_R0_R1 (0x8b000020)
+# define add_R0_R1 (0x91400020)
+# define ldr_R0 (0x58000000)
+# define ldr_R0_mask(i) (i & 0xffffffe0)
+# define ldr_R0_x0 (0xf9400000)
+# define ldr_hw_R0 (0xf2a00000)
+# define movk_R0 (0xf2800000)
+# define movz_R0 (0xd2a00000)
+# define movz_hw_R0 (0xd2c00000)
+#else /*ARCH_SIZE == 32 */
+# define add_R0_R0 (0x11000000)
+# define add_R0_R0_R1 (0x0b000020)
+# define add_R0_R1 (0x11400020)
+# define ldr_R0 (0x18000000)
+# define ldr_R0_mask(i) (i & 0xbfffffe0)
+# define ldr_R0_x0 (0xb9400000)
+# define ldr_hw_R0 (0x72a00000)
+# define movk_R0 (0x72800000)
+# define movz_R0 (0x52a00000)
+# define movz_hw_R0 (0x52c00000)
+#endif
+
+/* Structure to hold payload for _bfd_aarch64_erratum_843419_clear_stub,
+ it is used to identify the stub information to reset. */
+
+struct erratum_843419_branch_to_stub_clear_data
+{
+ bfd_vma adrp_offset;
+ asection *output_section;
+};
+
+/* Clear the erratum information for GEN_ENTRY if the ADRP_OFFSET and
+ section inside IN_ARG matches. The clearing is done by setting the
+ stub_type to none. */
+
+static bool
+_bfd_aarch64_erratum_843419_clear_stub (struct bfd_hash_entry *gen_entry,
+ void *in_arg)
+{
+ struct elf_aarch64_stub_hash_entry *stub_entry
+ = (struct elf_aarch64_stub_hash_entry *) gen_entry;
+ struct erratum_843419_branch_to_stub_clear_data *data
+ = (struct erratum_843419_branch_to_stub_clear_data *) in_arg;
+
+ if (stub_entry->target_section != data->output_section
+ || stub_entry->stub_type != aarch64_stub_erratum_843419_veneer
+ || stub_entry->adrp_offset != data->adrp_offset)
+ return true;
+
+ /* Change the stub type instead of removing the entry, removing from the hash
+ table would be slower and we have already reserved the memory for the entry
+ so there wouldn't be much gain. Changing the stub also keeps around a
+ record of what was there before. */
+ stub_entry->stub_type = aarch64_stub_none;
+
+ /* We're done and there could have been only one matching stub at that
+ particular offset, so abort further traversal. */
+ return false;
+}
+
+/* TLS Relaxations may relax an adrp sequence that matches the erratum 843419
+ sequence. In this case the erratum no longer applies and we need to remove
+ the entry from the pending stub generation. This clears matching adrp insn
+ at ADRP_OFFSET in INPUT_SECTION in the stub table defined in GLOBALS. */
+
+static void
+clear_erratum_843419_entry (struct elf_aarch64_link_hash_table *globals,
+ bfd_vma adrp_offset, asection *input_section)
+{
+ if (globals->fix_erratum_843419 & ERRAT_ADRP)
+ {
+ struct erratum_843419_branch_to_stub_clear_data data;
+ data.adrp_offset = adrp_offset;
+ data.output_section = input_section;
+
+ bfd_hash_traverse (&globals->stub_hash_table,
+ _bfd_aarch64_erratum_843419_clear_stub, &data);
+ }
+}
+
+/* Handle TLS relaxations. Relaxing is possible for symbols that use
+ R_AARCH64_TLSDESC_ADR_{PAGE, LD64_LO12_NC, ADD_LO12_NC} during a static
+ link.
+
+ Return bfd_reloc_ok if we're done, bfd_reloc_continue if the caller
+ is to then call final_link_relocate. Return other values in the
+ case of error. */
+
+static bfd_reloc_status_type
+elfNN_aarch64_tls_relax (struct elf_aarch64_link_hash_table *globals,
+ bfd *input_bfd, asection *input_section,
+ bfd_byte *contents, Elf_Internal_Rela *rel,
+ struct elf_link_hash_entry *h)
+{
+ bool is_local = h == NULL;
+ unsigned int r_type = ELFNN_R_TYPE (rel->r_info);
+ unsigned long insn;
+
+ BFD_ASSERT (globals && input_bfd && contents && rel);
+
+ switch (elfNN_aarch64_bfd_reloc_from_type (input_bfd, r_type))
+ {
+ case BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21:
+ case BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21:
+ if (is_local)
+ {
+ /* GD->LE relaxation:
+ adrp x0, :tlsgd:var => movz R0, :tprel_g1:var
+ or
+ adrp x0, :tlsdesc:var => movz R0, :tprel_g1:var
+
+ Where R is x for LP64, and w for ILP32. */
+ bfd_putl32 (movz_R0, contents + rel->r_offset);
+ /* We have relaxed the adrp into a mov, we may have to clear any
+ pending erratum fixes. */
+ clear_erratum_843419_entry (globals, rel->r_offset, input_section);
+ return bfd_reloc_continue;
+ }
+ else
+ {
+ /* GD->IE relaxation:
+ adrp x0, :tlsgd:var => adrp x0, :gottprel:var
+ or
+ adrp x0, :tlsdesc:var => adrp x0, :gottprel:var
+ */
+ return bfd_reloc_continue;
+ }
+
+ case BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21:
+ BFD_ASSERT (0);
+ break;
+
+ case BFD_RELOC_AARCH64_TLSDESC_LD_PREL19:
+ if (is_local)
+ {
+ /* Tiny TLSDESC->LE relaxation:
+ ldr x1, :tlsdesc:var => movz R0, #:tprel_g1:var
+ adr x0, :tlsdesc:var => movk R0, #:tprel_g0_nc:var
+ .tlsdesccall var
+ blr x1 => nop
+
+ Where R is x for LP64, and w for ILP32. */
+ BFD_ASSERT (ELFNN_R_TYPE (rel[1].r_info) == AARCH64_R (TLSDESC_ADR_PREL21));
+ BFD_ASSERT (ELFNN_R_TYPE (rel[2].r_info) == AARCH64_R (TLSDESC_CALL));
+
+ rel[1].r_info = ELFNN_R_INFO (ELFNN_R_SYM (rel->r_info),
+ AARCH64_R (TLSLE_MOVW_TPREL_G0_NC));
+ rel[2].r_info = ELFNN_R_INFO (STN_UNDEF, R_AARCH64_NONE);
+
+ bfd_putl32 (movz_R0, contents + rel->r_offset);
+ bfd_putl32 (movk_R0, contents + rel->r_offset + 4);
+ bfd_putl32 (INSN_NOP, contents + rel->r_offset + 8);
+ return bfd_reloc_continue;
+ }
+ else
+ {
+ /* Tiny TLSDESC->IE relaxation:
+ ldr x1, :tlsdesc:var => ldr x0, :gottprel:var
+ adr x0, :tlsdesc:var => nop
+ .tlsdesccall var
+ blr x1 => nop
+ */
+ BFD_ASSERT (ELFNN_R_TYPE (rel[1].r_info) == AARCH64_R (TLSDESC_ADR_PREL21));
+ BFD_ASSERT (ELFNN_R_TYPE (rel[2].r_info) == AARCH64_R (TLSDESC_CALL));
+
+ rel[1].r_info = ELFNN_R_INFO (STN_UNDEF, R_AARCH64_NONE);
+ rel[2].r_info = ELFNN_R_INFO (STN_UNDEF, R_AARCH64_NONE);
+
+ bfd_putl32 (ldr_R0, contents + rel->r_offset);
+ bfd_putl32 (INSN_NOP, contents + rel->r_offset + 4);
+ bfd_putl32 (INSN_NOP, contents + rel->r_offset + 8);
+ return bfd_reloc_continue;
+ }
+
+ case BFD_RELOC_AARCH64_TLSGD_ADR_PREL21:
+ if (is_local)
+ {
+ /* Tiny GD->LE relaxation:
+ adr x0, :tlsgd:var => mrs x1, tpidr_el0
+ bl __tls_get_addr => add R0, R1, #:tprel_hi12:x, lsl #12
+ nop => add R0, R0, #:tprel_lo12_nc:x
+
+ Where R is x for LP64, and x for Ilp32. */
+
+ /* First kill the tls_get_addr reloc on the bl instruction. */
+ BFD_ASSERT (rel->r_offset + 4 == rel[1].r_offset);
+
+ bfd_putl32 (0xd53bd041, contents + rel->r_offset + 0);
+ bfd_putl32 (add_R0_R1, contents + rel->r_offset + 4);
+ bfd_putl32 (add_R0_R0, contents + rel->r_offset + 8);
+
+ rel[1].r_info = ELFNN_R_INFO (ELFNN_R_SYM (rel->r_info),
+ AARCH64_R (TLSLE_ADD_TPREL_LO12_NC));
+ rel[1].r_offset = rel->r_offset + 8;
+
+ /* Move the current relocation to the second instruction in
+ the sequence. */
+ rel->r_offset += 4;
+ rel->r_info = ELFNN_R_INFO (ELFNN_R_SYM (rel->r_info),
+ AARCH64_R (TLSLE_ADD_TPREL_HI12));
+ return bfd_reloc_continue;
+ }
+ else
+ {
+ /* Tiny GD->IE relaxation:
+ adr x0, :tlsgd:var => ldr R0, :gottprel:var
+ bl __tls_get_addr => mrs x1, tpidr_el0
+ nop => add R0, R0, R1
+
+ Where R is x for LP64, and w for Ilp32. */
+
+ /* First kill the tls_get_addr reloc on the bl instruction. */
+ BFD_ASSERT (rel->r_offset + 4 == rel[1].r_offset);
+ rel[1].r_info = ELFNN_R_INFO (STN_UNDEF, R_AARCH64_NONE);
+
+ bfd_putl32 (ldr_R0, contents + rel->r_offset);
+ bfd_putl32 (0xd53bd041, contents + rel->r_offset + 4);
+ bfd_putl32 (add_R0_R0_R1, contents + rel->r_offset + 8);
+ return bfd_reloc_continue;
+ }
+
+#if ARCH_SIZE == 64
+ case BFD_RELOC_AARCH64_TLSGD_MOVW_G1:
+ BFD_ASSERT (ELFNN_R_TYPE (rel[1].r_info) == AARCH64_R (TLSGD_MOVW_G0_NC));
+ BFD_ASSERT (rel->r_offset + 12 == rel[2].r_offset);
+ BFD_ASSERT (ELFNN_R_TYPE (rel[2].r_info) == AARCH64_R (CALL26));
+
+ if (is_local)
+ {
+ /* Large GD->LE relaxation:
+ movz x0, #:tlsgd_g1:var => movz x0, #:tprel_g2:var, lsl #32
+ movk x0, #:tlsgd_g0_nc:var => movk x0, #:tprel_g1_nc:var, lsl #16
+ add x0, gp, x0 => movk x0, #:tprel_g0_nc:var
+ bl __tls_get_addr => mrs x1, tpidr_el0
+ nop => add x0, x0, x1
+ */
+ rel[2].r_info = ELFNN_R_INFO (ELFNN_R_SYM (rel->r_info),
+ AARCH64_R (TLSLE_MOVW_TPREL_G0_NC));
+ rel[2].r_offset = rel->r_offset + 8;
+
+ bfd_putl32 (movz_hw_R0, contents + rel->r_offset + 0);
+ bfd_putl32 (ldr_hw_R0, contents + rel->r_offset + 4);
+ bfd_putl32 (movk_R0, contents + rel->r_offset + 8);
+ bfd_putl32 (0xd53bd041, contents + rel->r_offset + 12);
+ bfd_putl32 (add_R0_R0_R1, contents + rel->r_offset + 16);
+ }
+ else
+ {
+ /* Large GD->IE relaxation:
+ movz x0, #:tlsgd_g1:var => movz x0, #:gottprel_g1:var, lsl #16
+ movk x0, #:tlsgd_g0_nc:var => movk x0, #:gottprel_g0_nc:var
+ add x0, gp, x0 => ldr x0, [gp, x0]
+ bl __tls_get_addr => mrs x1, tpidr_el0
+ nop => add x0, x0, x1
+ */
+ rel[2].r_info = ELFNN_R_INFO (STN_UNDEF, R_AARCH64_NONE);
+ bfd_putl32 (0xd2a80000, contents + rel->r_offset + 0);
+ bfd_putl32 (ldr_R0, contents + rel->r_offset + 8);
+ bfd_putl32 (0xd53bd041, contents + rel->r_offset + 12);
+ bfd_putl32 (add_R0_R0_R1, contents + rel->r_offset + 16);
+ }
+ return bfd_reloc_continue;
+
+ case BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC:
+ return bfd_reloc_continue;
+#endif
+
+ case BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19:
+ return bfd_reloc_continue;
+
+ case BFD_RELOC_AARCH64_TLSDESC_LDNN_LO12_NC:
+ if (is_local)
+ {
+ /* GD->LE relaxation:
+ ldr xd, [x0, #:tlsdesc_lo12:var] => movk x0, :tprel_g0_nc:var
+
+ Where R is x for lp64 mode, and w for ILP32 mode. */
+ bfd_putl32 (movk_R0, contents + rel->r_offset);
+ return bfd_reloc_continue;
+ }
+ else
+ {
+ /* GD->IE relaxation:
+ ldr xd, [x0, #:tlsdesc_lo12:var] => ldr R0, [x0, #:gottprel_lo12:var]
+
+ Where R is x for lp64 mode, and w for ILP32 mode. */
+ insn = bfd_getl32 (contents + rel->r_offset);
+ bfd_putl32 (ldr_R0_mask (insn), contents + rel->r_offset);
+ return bfd_reloc_continue;
+ }
+
+ case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC:
+ if (is_local)
+ {
+ /* GD->LE relaxation
+ add x0, #:tlsgd_lo12:var => movk R0, :tprel_g0_nc:var
+ bl __tls_get_addr => mrs x1, tpidr_el0
+ nop => add R0, R1, R0
+
+ Where R is x for lp64 mode, and w for ILP32 mode. */
+
+ /* First kill the tls_get_addr reloc on the bl instruction. */
+ BFD_ASSERT (rel->r_offset + 4 == rel[1].r_offset);
+ rel[1].r_info = ELFNN_R_INFO (STN_UNDEF, R_AARCH64_NONE);
+
+ bfd_putl32 (movk_R0, contents + rel->r_offset);
+ bfd_putl32 (0xd53bd041, contents + rel->r_offset + 4);
+ bfd_putl32 (add_R0_R0_R1, contents + rel->r_offset + 8);
+ return bfd_reloc_continue;
+ }
+ else
+ {
+ /* GD->IE relaxation
+ ADD x0, #:tlsgd_lo12:var => ldr R0, [x0, #:gottprel_lo12:var]
+ BL __tls_get_addr => mrs x1, tpidr_el0
+ R_AARCH64_CALL26
+ NOP => add R0, R1, R0
+
+ Where R is x for lp64 mode, and w for ilp32 mode. */
+
+ BFD_ASSERT (ELFNN_R_TYPE (rel[1].r_info) == AARCH64_R (CALL26));
+
+ /* Remove the relocation on the BL instruction. */
+ rel[1].r_info = ELFNN_R_INFO (STN_UNDEF, R_AARCH64_NONE);
+
+ /* We choose to fixup the BL and NOP instructions using the
+ offset from the second relocation to allow flexibility in
+ scheduling instructions between the ADD and BL. */
+ bfd_putl32 (ldr_R0_x0, contents + rel->r_offset);
+ bfd_putl32 (0xd53bd041, contents + rel[1].r_offset);
+ bfd_putl32 (add_R0_R0_R1, contents + rel[1].r_offset + 4);
+ return bfd_reloc_continue;
+ }
+
+ case BFD_RELOC_AARCH64_TLSDESC_ADD:
+ case BFD_RELOC_AARCH64_TLSDESC_ADD_LO12:
+ case BFD_RELOC_AARCH64_TLSDESC_CALL:
+ /* GD->IE/LE relaxation:
+ add x0, x0, #:tlsdesc_lo12:var => nop
+ blr xd => nop
+ */
+ bfd_putl32 (INSN_NOP, contents + rel->r_offset);
+ return bfd_reloc_ok;
+
+ case BFD_RELOC_AARCH64_TLSDESC_LDR:
+ if (is_local)
+ {
+ /* GD->LE relaxation:
+ ldr xd, [gp, xn] => movk R0, #:tprel_g0_nc:var
+
+ Where R is x for lp64 mode, and w for ILP32 mode. */
+ bfd_putl32 (movk_R0, contents + rel->r_offset);
+ return bfd_reloc_continue;
+ }
+ else
+ {
+ /* GD->IE relaxation:
+ ldr xd, [gp, xn] => ldr R0, [gp, xn]
+
+ Where R is x for lp64 mode, and w for ILP32 mode. */
+ insn = bfd_getl32 (contents + rel->r_offset);
+ bfd_putl32 (ldr_R0_mask (insn), contents + rel->r_offset);
+ return bfd_reloc_ok;
+ }
+
+ case BFD_RELOC_AARCH64_TLSDESC_OFF_G0_NC:
+ /* GD->LE relaxation:
+ movk xd, #:tlsdesc_off_g0_nc:var => movk R0, #:tprel_g1_nc:var, lsl #16
+ GD->IE relaxation:
+ movk xd, #:tlsdesc_off_g0_nc:var => movk Rd, #:gottprel_g0_nc:var
+
+ Where R is x for lp64 mode, and w for ILP32 mode. */
+ if (is_local)
+ bfd_putl32 (ldr_hw_R0, contents + rel->r_offset);
+ return bfd_reloc_continue;
+
+ case BFD_RELOC_AARCH64_TLSDESC_OFF_G1:
+ if (is_local)
+ {
+ /* GD->LE relaxation:
+ movz xd, #:tlsdesc_off_g1:var => movz R0, #:tprel_g2:var, lsl #32
+
+ Where R is x for lp64 mode, and w for ILP32 mode. */
+ bfd_putl32 (movz_hw_R0, contents + rel->r_offset);
+ return bfd_reloc_continue;
+ }
+ else
+ {
+ /* GD->IE relaxation:
+ movz xd, #:tlsdesc_off_g1:var => movz Rd, #:gottprel_g1:var, lsl #16
+
+ Where R is x for lp64 mode, and w for ILP32 mode. */
+ insn = bfd_getl32 (contents + rel->r_offset);
+ bfd_putl32 (movz_R0 | (insn & 0x1f), contents + rel->r_offset);
+ return bfd_reloc_continue;
+ }
+
+ case BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
+ /* IE->LE relaxation:
+ adrp xd, :gottprel:var => movz Rd, :tprel_g1:var
+
+ Where R is x for lp64 mode, and w for ILP32 mode. */
+ if (is_local)
+ {
+ insn = bfd_getl32 (contents + rel->r_offset);
+ bfd_putl32 (movz_R0 | (insn & 0x1f), contents + rel->r_offset);
+ /* We have relaxed the adrp into a mov, we may have to clear any
+ pending erratum fixes. */
+ clear_erratum_843419_entry (globals, rel->r_offset, input_section);
+ }
+ return bfd_reloc_continue;
+
+ case BFD_RELOC_AARCH64_TLSIE_LDNN_GOTTPREL_LO12_NC:
+ /* IE->LE relaxation:
+ ldr xd, [xm, #:gottprel_lo12:var] => movk Rd, :tprel_g0_nc:var
+
+ Where R is x for lp64 mode, and w for ILP32 mode. */
+ if (is_local)
+ {
+ insn = bfd_getl32 (contents + rel->r_offset);
+ bfd_putl32 (movk_R0 | (insn & 0x1f), contents + rel->r_offset);
+ }
+ return bfd_reloc_continue;
+
+ case BFD_RELOC_AARCH64_TLSLD_ADR_PREL21:
+ /* LD->LE relaxation (tiny):
+ adr x0, :tlsldm:x => mrs x0, tpidr_el0
+ bl __tls_get_addr => add R0, R0, TCB_SIZE
+
+ Where R is x for lp64 mode, and w for ilp32 mode. */
+ if (is_local)
+ {
+ BFD_ASSERT (rel->r_offset + 4 == rel[1].r_offset);
+ BFD_ASSERT (ELFNN_R_TYPE (rel[1].r_info) == AARCH64_R (CALL26));
+ /* No need of CALL26 relocation for tls_get_addr. */
+ rel[1].r_info = ELFNN_R_INFO (STN_UNDEF, R_AARCH64_NONE);
+ bfd_putl32 (0xd53bd040, contents + rel->r_offset + 0);
+ bfd_putl32 (add_R0_R0 | (TCB_SIZE << 10),
+ contents + rel->r_offset + 4);
+ return bfd_reloc_ok;
+ }
+ return bfd_reloc_continue;
+
+ case BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21:
+ /* LD->LE relaxation (small):
+ adrp x0, :tlsldm:x => mrs x0, tpidr_el0
+ */
+ if (is_local)
+ {
+ bfd_putl32 (0xd53bd040, contents + rel->r_offset);
+ return bfd_reloc_ok;
+ }
+ return bfd_reloc_continue;
+
+ case BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC:
+ /* LD->LE relaxation (small):
+ add x0, #:tlsldm_lo12:x => add R0, R0, TCB_SIZE
+ bl __tls_get_addr => nop
+
+ Where R is x for lp64 mode, and w for ilp32 mode. */
+ if (is_local)
+ {
+ BFD_ASSERT (rel->r_offset + 4 == rel[1].r_offset);
+ BFD_ASSERT (ELFNN_R_TYPE (rel[1].r_info) == AARCH64_R (CALL26));
+ /* No need of CALL26 relocation for tls_get_addr. */
+ rel[1].r_info = ELFNN_R_INFO (STN_UNDEF, R_AARCH64_NONE);
+ bfd_putl32 (add_R0_R0 | (TCB_SIZE << 10),
+ contents + rel->r_offset + 0);
+ bfd_putl32 (INSN_NOP, contents + rel->r_offset + 4);
+ return bfd_reloc_ok;
+ }
+ return bfd_reloc_continue;
+
+ default:
+ return bfd_reloc_continue;
+ }
+
+ return bfd_reloc_ok;
+}
+
+/* Relocate an AArch64 ELF section. */
+
+static int
+elfNN_aarch64_relocate_section (bfd *output_bfd,
+ struct bfd_link_info *info,
+ bfd *input_bfd,
+ asection *input_section,
+ bfd_byte *contents,
+ Elf_Internal_Rela *relocs,
+ Elf_Internal_Sym *local_syms,
+ asection **local_sections)
+{
+ Elf_Internal_Shdr *symtab_hdr;
+ struct elf_link_hash_entry **sym_hashes;
+ Elf_Internal_Rela *rel;
+ Elf_Internal_Rela *relend;
+ const char *name;
+ struct elf_aarch64_link_hash_table *globals;
+ bool save_addend = false;
+ bfd_vma addend = 0;
+
+ globals = elf_aarch64_hash_table (info);
+
+ symtab_hdr = &elf_symtab_hdr (input_bfd);
+ sym_hashes = elf_sym_hashes (input_bfd);
+
+ rel = relocs;
+ relend = relocs + input_section->reloc_count;
+ for (; rel < relend; rel++)
+ {
+ unsigned int r_type;
+ bfd_reloc_code_real_type bfd_r_type;
+ bfd_reloc_code_real_type relaxed_bfd_r_type;
+ reloc_howto_type *howto;
+ unsigned long r_symndx;
+ Elf_Internal_Sym *sym;
+ asection *sec;
+ struct elf_link_hash_entry *h;
+ bfd_vma relocation;
+ bfd_reloc_status_type r;
+ arelent bfd_reloc;
+ char sym_type;
+ bool unresolved_reloc = false;
+ char *error_message = NULL;
+
+ r_symndx = ELFNN_R_SYM (rel->r_info);
+ r_type = ELFNN_R_TYPE (rel->r_info);
+
+ bfd_reloc.howto = elfNN_aarch64_howto_from_type (input_bfd, r_type);
+ howto = bfd_reloc.howto;
+
+ if (howto == NULL)
+ return _bfd_unrecognized_reloc (input_bfd, input_section, r_type);
+
+ bfd_r_type = elfNN_aarch64_bfd_reloc_from_howto (howto);
+
+ h = NULL;
+ sym = NULL;
+ sec = NULL;
+
+ if (r_symndx < symtab_hdr->sh_info)
+ {
+ sym = local_syms + r_symndx;
+ sym_type = ELFNN_ST_TYPE (sym->st_info);
+ sec = local_sections[r_symndx];
+
+ /* An object file might have a reference to a local
+ undefined symbol. This is a daft object file, but we
+ should at least do something about it. */
+ if (r_type != R_AARCH64_NONE && r_type != R_AARCH64_NULL
+ && bfd_is_und_section (sec)
+ && ELF_ST_BIND (sym->st_info) != STB_WEAK)
+ (*info->callbacks->undefined_symbol)
+ (info, bfd_elf_string_from_elf_section
+ (input_bfd, symtab_hdr->sh_link, sym->st_name),
+ input_bfd, input_section, rel->r_offset, true);
+
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
+
+ /* Relocate against local STT_GNU_IFUNC symbol. */
+ if (!bfd_link_relocatable (info)
+ && ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
+ {
+ h = elfNN_aarch64_get_local_sym_hash (globals, input_bfd,
+ rel, false);
+ if (h == NULL)
+ abort ();
+
+ /* Set STT_GNU_IFUNC symbol value. */
+ h->root.u.def.value = sym->st_value;
+ h->root.u.def.section = sec;
+ }
+ }
+ else
+ {
+ bool warned, ignored;
+
+ RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
+ r_symndx, symtab_hdr, sym_hashes,
+ h, sec, relocation,
+ unresolved_reloc, warned, ignored);
+
+ sym_type = h->type;
+ }
+
+ if (sec != NULL && discarded_section (sec))
+ RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
+ rel, 1, relend, howto, 0, contents);
+
+ if (bfd_link_relocatable (info))
+ continue;
+
+ if (h != NULL)
+ name = h->root.root.string;
+ else
+ {
+ name = (bfd_elf_string_from_elf_section
+ (input_bfd, symtab_hdr->sh_link, sym->st_name));
+ if (name == NULL || *name == '\0')
+ name = bfd_section_name (sec);
+ }
+
+ if (r_symndx != 0
+ && r_type != R_AARCH64_NONE
+ && r_type != R_AARCH64_NULL
+ && (h == NULL
+ || h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && IS_AARCH64_TLS_RELOC (bfd_r_type) != (sym_type == STT_TLS))
+ {
+ _bfd_error_handler
+ ((sym_type == STT_TLS
+ /* xgettext:c-format */
+ ? _("%pB(%pA+%#" PRIx64 "): %s used with TLS symbol %s")
+ /* xgettext:c-format */
+ : _("%pB(%pA+%#" PRIx64 "): %s used with non-TLS symbol %s")),
+ input_bfd,
+ input_section, (uint64_t) rel->r_offset, howto->name, name);
+ }
+
+ /* We relax only if we can see that there can be a valid transition
+ from a reloc type to another.
+ We call elfNN_aarch64_final_link_relocate unless we're completely
+ done, i.e., the relaxation produced the final output we want. */
+
+ relaxed_bfd_r_type = aarch64_tls_transition (input_bfd, info, r_type,
+ h, r_symndx);
+ if (relaxed_bfd_r_type != bfd_r_type)
+ {
+ bfd_r_type = relaxed_bfd_r_type;
+ howto = elfNN_aarch64_howto_from_bfd_reloc (bfd_r_type);
+ BFD_ASSERT (howto != NULL);
+ r_type = howto->type;
+ r = elfNN_aarch64_tls_relax (globals, input_bfd, input_section,
+ contents, rel, h);
+ unresolved_reloc = 0;
+ }
+ else
+ r = bfd_reloc_continue;
+
+ /* There may be multiple consecutive relocations for the
+ same offset. In that case we are supposed to treat the
+ output of each relocation as the addend for the next. */
+ if (rel + 1 < relend
+ && rel->r_offset == rel[1].r_offset
+ && ELFNN_R_TYPE (rel[1].r_info) != R_AARCH64_NONE
+ && ELFNN_R_TYPE (rel[1].r_info) != R_AARCH64_NULL)
+ save_addend = true;
+ else
+ save_addend = false;
+
+ if (r == bfd_reloc_continue)
+ r = elfNN_aarch64_final_link_relocate (howto, input_bfd, output_bfd,
+ input_section, contents, rel,
+ relocation, info, sec,
+ h, &unresolved_reloc,
+ save_addend, &addend, sym);
+
+ switch (elfNN_aarch64_bfd_reloc_from_type (input_bfd, r_type))
+ {
+ case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21:
+ case BFD_RELOC_AARCH64_TLSGD_ADR_PREL21:
+ case BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC:
+ case BFD_RELOC_AARCH64_TLSGD_MOVW_G1:
+ case BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21:
+ case BFD_RELOC_AARCH64_TLSLD_ADR_PREL21:
+ if (! symbol_got_offset_mark_p (input_bfd, h, r_symndx))
+ {
+ bool need_relocs = false;
+ bfd_byte *loc;
+ int indx;
+ bfd_vma off;
+
+ off = symbol_got_offset (input_bfd, h, r_symndx);
+ indx = h && h->dynindx != -1 ? h->dynindx : 0;
+
+ need_relocs =
+ (!bfd_link_executable (info) || indx != 0) &&
+ (h == NULL
+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak);
+
+ BFD_ASSERT (globals->root.srelgot != NULL);
+
+ if (need_relocs)
+ {
+ Elf_Internal_Rela rela;
+ rela.r_info = ELFNN_R_INFO (indx, AARCH64_R (TLS_DTPMOD));
+ rela.r_addend = 0;
+ rela.r_offset = globals->root.sgot->output_section->vma +
+ globals->root.sgot->output_offset + off;
+
+
+ loc = globals->root.srelgot->contents;
+ loc += globals->root.srelgot->reloc_count++
+ * RELOC_SIZE (htab);
+ bfd_elfNN_swap_reloca_out (output_bfd, &rela, loc);
+
+ bfd_reloc_code_real_type real_type =
+ elfNN_aarch64_bfd_reloc_from_type (input_bfd, r_type);
+
+ if (real_type == BFD_RELOC_AARCH64_TLSLD_ADR_PREL21
+ || real_type == BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21
+ || real_type == BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC)
+ {
+ /* For local dynamic, don't generate DTPREL in any case.
+ Initialize the DTPREL slot into zero, so we get module
+ base address when invoke runtime TLS resolver. */
+ bfd_put_NN (output_bfd, 0,
+ globals->root.sgot->contents + off
+ + GOT_ENTRY_SIZE);
+ }
+ else if (indx == 0)
+ {
+ bfd_put_NN (output_bfd,
+ relocation - dtpoff_base (info),
+ globals->root.sgot->contents + off
+ + GOT_ENTRY_SIZE);
+ }
+ else
+ {
+ /* This TLS symbol is global. We emit a
+ relocation to fixup the tls offset at load
+ time. */
+ rela.r_info =
+ ELFNN_R_INFO (indx, AARCH64_R (TLS_DTPREL));
+ rela.r_addend = 0;
+ rela.r_offset =
+ (globals->root.sgot->output_section->vma
+ + globals->root.sgot->output_offset + off
+ + GOT_ENTRY_SIZE);
+
+ loc = globals->root.srelgot->contents;
+ loc += globals->root.srelgot->reloc_count++
+ * RELOC_SIZE (globals);
+ bfd_elfNN_swap_reloca_out (output_bfd, &rela, loc);
+ bfd_put_NN (output_bfd, (bfd_vma) 0,
+ globals->root.sgot->contents + off
+ + GOT_ENTRY_SIZE);
+ }
+ }
+ else
+ {
+ bfd_put_NN (output_bfd, (bfd_vma) 1,
+ globals->root.sgot->contents + off);
+ bfd_put_NN (output_bfd,
+ relocation - dtpoff_base (info),
+ globals->root.sgot->contents + off
+ + GOT_ENTRY_SIZE);
+ }
+
+ symbol_got_offset_mark (input_bfd, h, r_symndx);
+ }
+ break;
+
+ case BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
+ case BFD_RELOC_AARCH64_TLSIE_LDNN_GOTTPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19:
+ case BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC:
+ case BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1:
+ if (! symbol_got_offset_mark_p (input_bfd, h, r_symndx))
+ {
+ bool need_relocs = false;
+ bfd_byte *loc;
+ int indx;
+ bfd_vma off;
+
+ off = symbol_got_offset (input_bfd, h, r_symndx);
+
+ indx = h && h->dynindx != -1 ? h->dynindx : 0;
+
+ need_relocs =
+ (!bfd_link_executable (info) || indx != 0) &&
+ (h == NULL
+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak);
+
+ BFD_ASSERT (globals->root.srelgot != NULL);
+
+ if (need_relocs)
+ {
+ Elf_Internal_Rela rela;
+
+ if (indx == 0)
+ rela.r_addend = relocation - dtpoff_base (info);
+ else
+ rela.r_addend = 0;
+
+ rela.r_info = ELFNN_R_INFO (indx, AARCH64_R (TLS_TPREL));
+ rela.r_offset = globals->root.sgot->output_section->vma +
+ globals->root.sgot->output_offset + off;
+
+ loc = globals->root.srelgot->contents;
+ loc += globals->root.srelgot->reloc_count++
+ * RELOC_SIZE (htab);
+
+ bfd_elfNN_swap_reloca_out (output_bfd, &rela, loc);
+
+ bfd_put_NN (output_bfd, rela.r_addend,
+ globals->root.sgot->contents + off);
+ }
+ else
+ bfd_put_NN (output_bfd, relocation - tpoff_base (info),
+ globals->root.sgot->contents + off);
+
+ symbol_got_offset_mark (input_bfd, h, r_symndx);
+ }
+ break;
+
+ case BFD_RELOC_AARCH64_TLSDESC_ADD_LO12:
+ case BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21:
+ case BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21:
+ case BFD_RELOC_AARCH64_TLSDESC_LDNN_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSDESC_LD_PREL19:
+ case BFD_RELOC_AARCH64_TLSDESC_OFF_G0_NC:
+ case BFD_RELOC_AARCH64_TLSDESC_OFF_G1:
+ if (! symbol_tlsdesc_got_offset_mark_p (input_bfd, h, r_symndx))
+ {
+ bool need_relocs = false;
+ int indx = h && h->dynindx != -1 ? h->dynindx : 0;
+ bfd_vma off = symbol_tlsdesc_got_offset (input_bfd, h, r_symndx);
+
+ need_relocs = (h == NULL
+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak);
+
+ BFD_ASSERT (globals->root.srelgot != NULL);
+ BFD_ASSERT (globals->root.sgot != NULL);
+
+ if (need_relocs)
+ {
+ bfd_byte *loc;
+ Elf_Internal_Rela rela;
+ rela.r_info = ELFNN_R_INFO (indx, AARCH64_R (TLSDESC));
+
+ rela.r_addend = 0;
+ rela.r_offset = (globals->root.sgotplt->output_section->vma
+ + globals->root.sgotplt->output_offset
+ + off + globals->sgotplt_jump_table_size);
+
+ if (indx == 0)
+ rela.r_addend = relocation - dtpoff_base (info);
+
+ /* Allocate the next available slot in the PLT reloc
+ section to hold our R_AARCH64_TLSDESC, the next
+ available slot is determined from reloc_count,
+ which we step. But note, reloc_count was
+ artifically moved down while allocating slots for
+ real PLT relocs such that all of the PLT relocs
+ will fit above the initial reloc_count and the
+ extra stuff will fit below. */
+ loc = globals->root.srelplt->contents;
+ loc += globals->root.srelplt->reloc_count++
+ * RELOC_SIZE (globals);
+
+ bfd_elfNN_swap_reloca_out (output_bfd, &rela, loc);
+
+ bfd_put_NN (output_bfd, (bfd_vma) 0,
+ globals->root.sgotplt->contents + off +
+ globals->sgotplt_jump_table_size);
+ bfd_put_NN (output_bfd, (bfd_vma) 0,
+ globals->root.sgotplt->contents + off +
+ globals->sgotplt_jump_table_size +
+ GOT_ENTRY_SIZE);
+ }
+
+ symbol_tlsdesc_got_offset_mark (input_bfd, h, r_symndx);
+ }
+ break;
+ default:
+ break;
+ }
+
+ /* Dynamic relocs are not propagated for SEC_DEBUGGING sections
+ because such sections are not SEC_ALLOC and thus ld.so will
+ not process them. */
+ if (unresolved_reloc
+ && !((input_section->flags & SEC_DEBUGGING) != 0
+ && h->def_dynamic)
+ && _bfd_elf_section_offset (output_bfd, info, input_section,
+ +rel->r_offset) != (bfd_vma) - 1)
+ {
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%pB(%pA+%#" PRIx64 "): "
+ "unresolvable %s relocation against symbol `%s'"),
+ input_bfd, input_section, (uint64_t) rel->r_offset, howto->name,
+ h->root.root.string);
+ return false;
+ }
+
+ if (r != bfd_reloc_ok && r != bfd_reloc_continue)
+ {
+ bfd_reloc_code_real_type real_r_type
+ = elfNN_aarch64_bfd_reloc_from_type (input_bfd, r_type);
+
+ switch (r)
+ {
+ case bfd_reloc_overflow:
+ (*info->callbacks->reloc_overflow)
+ (info, (h ? &h->root : NULL), name, howto->name, (bfd_vma) 0,
+ input_bfd, input_section, rel->r_offset);
+ if (real_r_type == BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15
+ || real_r_type == BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14)
+ {
+ (*info->callbacks->warning)
+ (info,
+ _("too many GOT entries for -fpic, "
+ "please recompile with -fPIC"),
+ name, input_bfd, input_section, rel->r_offset);
+ return false;
+ }
+ /* Overflow can occur when a variable is referenced with a type
+ that has a larger alignment than the type with which it was
+ declared. eg:
+ file1.c: extern int foo; int a (void) { return foo; }
+ file2.c: char bar, foo, baz;
+ If the variable is placed into a data section at an offset
+ that is incompatible with the larger alignment requirement
+ overflow will occur. (Strictly speaking this is not overflow
+ but rather an alignment problem, but the bfd_reloc_ error
+ enum does not have a value to cover that situation).
+
+ Try to catch this situation here and provide a more helpful
+ error message to the user. */
+ if (addend & (((bfd_vma) 1 << howto->rightshift) - 1)
+ /* FIXME: Are we testing all of the appropriate reloc
+ types here ? */
+ && (real_r_type == BFD_RELOC_AARCH64_LD_LO19_PCREL
+ || real_r_type == BFD_RELOC_AARCH64_LDST16_LO12
+ || real_r_type == BFD_RELOC_AARCH64_LDST32_LO12
+ || real_r_type == BFD_RELOC_AARCH64_LDST64_LO12
+ || real_r_type == BFD_RELOC_AARCH64_LDST128_LO12))
+ {
+ info->callbacks->warning
+ (info, _("one possible cause of this error is that the \
+symbol is being referenced in the indicated code as if it had a larger \
+alignment than was declared where it was defined"),
+ name, input_bfd, input_section, rel->r_offset);
+ }
+ break;
+
+ case bfd_reloc_undefined:
+ (*info->callbacks->undefined_symbol)
+ (info, name, input_bfd, input_section, rel->r_offset, true);
+ break;
+
+ case bfd_reloc_outofrange:
+ error_message = _("out of range");
+ goto common_error;
+
+ case bfd_reloc_notsupported:
+ error_message = _("unsupported relocation");
+ goto common_error;
+
+ case bfd_reloc_dangerous:
+ /* error_message should already be set. */
+ goto common_error;
+
+ default:
+ error_message = _("unknown error");
+ /* Fall through. */
+
+ common_error:
+ BFD_ASSERT (error_message != NULL);
+ (*info->callbacks->reloc_dangerous)
+ (info, error_message, input_bfd, input_section, rel->r_offset);
+ break;
+ }
+ }
+
+ if (!save_addend)
+ addend = 0;
+ }
+
+ return true;
+}
+
+/* Set the right machine number. */
+
+static bool
+elfNN_aarch64_object_p (bfd *abfd)
+{
+#if ARCH_SIZE == 32
+ bfd_default_set_arch_mach (abfd, bfd_arch_aarch64, bfd_mach_aarch64_ilp32);
+#else
+ bfd_default_set_arch_mach (abfd, bfd_arch_aarch64, bfd_mach_aarch64);
+#endif
+ return true;
+}
+
+/* Function to keep AArch64 specific flags in the ELF header. */
+
+static bool
+elfNN_aarch64_set_private_flags (bfd *abfd, flagword flags)
+{
+ if (elf_flags_init (abfd) && elf_elfheader (abfd)->e_flags != flags)
+ {
+ }
+ else
+ {
+ elf_elfheader (abfd)->e_flags = flags;
+ elf_flags_init (abfd) = true;
+ }
+
+ return true;
+}
+
+/* Merge backend specific data from an object file to the output
+ object file when linking. */
+
+static bool
+elfNN_aarch64_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
+{
+ bfd *obfd = info->output_bfd;
+ flagword out_flags;
+ flagword in_flags;
+ bool flags_compatible = true;
+ asection *sec;
+
+ /* Check if we have the same endianess. */
+ if (!_bfd_generic_verify_endian_match (ibfd, info))
+ return false;
+
+ if (!is_aarch64_elf (ibfd) || !is_aarch64_elf (obfd))
+ return true;
+
+ /* The input BFD must have had its flags initialised. */
+ /* The following seems bogus to me -- The flags are initialized in
+ the assembler but I don't think an elf_flags_init field is
+ written into the object. */
+ /* BFD_ASSERT (elf_flags_init (ibfd)); */
+
+ in_flags = elf_elfheader (ibfd)->e_flags;
+ out_flags = elf_elfheader (obfd)->e_flags;
+
+ if (!elf_flags_init (obfd))
+ {
+ /* If the input is the default architecture and had the default
+ flags then do not bother setting the flags for the output
+ architecture, instead allow future merges to do this. If no
+ future merges ever set these flags then they will retain their
+ uninitialised values, which surprise surprise, correspond
+ to the default values. */
+ if (bfd_get_arch_info (ibfd)->the_default
+ && elf_elfheader (ibfd)->e_flags == 0)
+ return true;
+
+ elf_flags_init (obfd) = true;
+ elf_elfheader (obfd)->e_flags = in_flags;
+
+ if (bfd_get_arch (obfd) == bfd_get_arch (ibfd)
+ && bfd_get_arch_info (obfd)->the_default)
+ return bfd_set_arch_mach (obfd, bfd_get_arch (ibfd),
+ bfd_get_mach (ibfd));
+
+ return true;
+ }
+
+ /* Identical flags must be compatible. */
+ if (in_flags == out_flags)
+ return true;
+
+ /* Check to see if the input BFD actually contains any sections. If
+ not, its flags may not have been initialised either, but it
+ cannot actually cause any incompatiblity. Do not short-circuit
+ dynamic objects; their section list may be emptied by
+ elf_link_add_object_symbols.
+
+ Also check to see if there are no code sections in the input.
+ In this case there is no need to check for code specific flags.
+ XXX - do we need to worry about floating-point format compatability
+ in data sections ? */
+ if (!(ibfd->flags & DYNAMIC))
+ {
+ bool null_input_bfd = true;
+ bool only_data_sections = true;
+
+ for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+ {
+ if ((bfd_section_flags (sec)
+ & (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS))
+ == (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS))
+ only_data_sections = false;
+
+ null_input_bfd = false;
+ break;
+ }
+
+ if (null_input_bfd || only_data_sections)
+ return true;
+ }
+
+ return flags_compatible;
+}
+
+/* Display the flags field. */
+
+static bool
+elfNN_aarch64_print_private_bfd_data (bfd *abfd, void *ptr)
+{
+ FILE *file = (FILE *) ptr;
+ unsigned long flags;
+
+ BFD_ASSERT (abfd != NULL && ptr != NULL);
+
+ /* Print normal ELF private data. */
+ _bfd_elf_print_private_bfd_data (abfd, ptr);
+
+ flags = elf_elfheader (abfd)->e_flags;
+ /* Ignore init flag - it may not be set, despite the flags field
+ containing valid data. */
+
+ /* xgettext:c-format */
+ fprintf (file, _("private flags = 0x%lx:"), elf_elfheader (abfd)->e_flags);
+
+ if (flags)
+ fprintf (file, _(" <Unrecognised flag bits set>"));
+
+ fputc ('\n', file);
+
+ return true;
+}
+
+/* Return true if we need copy relocation against EH. */
+
+static bool
+need_copy_relocation_p (struct elf_aarch64_link_hash_entry *eh)
+{
+ struct elf_dyn_relocs *p;
+ asection *s;
+
+ for (p = eh->root.dyn_relocs; p != NULL; p = p->next)
+ {
+ /* If there is any pc-relative reference, we need to keep copy relocation
+ to avoid propagating the relocation into runtime that current glibc
+ does not support. */
+ if (p->pc_count)
+ return true;
+
+ s = p->sec->output_section;
+ /* Need copy relocation if it's against read-only section. */
+ if (s != NULL && (s->flags & SEC_READONLY) != 0)
+ return true;
+ }
+
+ return false;
+}
+
+/* Adjust a symbol defined by a dynamic object and referenced by a
+ regular object. The current definition is in some section of the
+ dynamic object, but we're not including those sections. We have to
+ change the definition to something the rest of the link can
+ understand. */
+
+static bool
+elfNN_aarch64_adjust_dynamic_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *h)
+{
+ struct elf_aarch64_link_hash_table *htab;
+ asection *s, *srel;
+
+ /* If this is a function, put it in the procedure linkage table. We
+ will fill in the contents of the procedure linkage table later,
+ when we know the address of the .got section. */
+ if (h->type == STT_FUNC || h->type == STT_GNU_IFUNC || h->needs_plt)
+ {
+ if (h->plt.refcount <= 0
+ || (h->type != STT_GNU_IFUNC
+ && (SYMBOL_CALLS_LOCAL (info, h)
+ || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ && h->root.type == bfd_link_hash_undefweak))))
+ {
+ /* This case can occur if we saw a CALL26 reloc in
+ an input file, but the symbol wasn't referred to
+ by a dynamic object or all references were
+ garbage collected. In which case we can end up
+ resolving. */
+ h->plt.offset = (bfd_vma) - 1;
+ h->needs_plt = 0;
+ }
+
+ return true;
+ }
+ else
+ /* Otherwise, reset to -1. */
+ h->plt.offset = (bfd_vma) - 1;
+
+
+ /* If this is a weak symbol, and there is a real definition, the
+ processor independent code will have arranged for us to see the
+ real definition first, and we can just use the same value. */
+ if (h->is_weakalias)
+ {
+ struct elf_link_hash_entry *def = weakdef (h);
+ BFD_ASSERT (def->root.type == bfd_link_hash_defined);
+ h->root.u.def.section = def->root.u.def.section;
+ h->root.u.def.value = def->root.u.def.value;
+ if (ELIMINATE_COPY_RELOCS || info->nocopyreloc)
+ h->non_got_ref = def->non_got_ref;
+ return true;
+ }
+
+ /* If we are creating a shared library, we must presume that the
+ only references to the symbol are via the global offset table.
+ For such cases we need not do anything here; the relocations will
+ be handled correctly by relocate_section. */
+ if (bfd_link_pic (info))
+ return true;
+
+ /* If there are no references to this symbol that do not use the
+ GOT, we don't need to generate a copy reloc. */
+ if (!h->non_got_ref)
+ return true;
+
+ /* If -z nocopyreloc was given, we won't generate them either. */
+ if (info->nocopyreloc)
+ {
+ h->non_got_ref = 0;
+ return true;
+ }
+
+ if (ELIMINATE_COPY_RELOCS)
+ {
+ struct elf_aarch64_link_hash_entry *eh;
+ /* If we don't find any dynamic relocs in read-only sections, then
+ we'll be keeping the dynamic relocs and avoiding the copy reloc. */
+ eh = (struct elf_aarch64_link_hash_entry *) h;
+ if (!need_copy_relocation_p (eh))
+ {
+ h->non_got_ref = 0;
+ return true;
+ }
+ }
+
+ /* We must allocate the symbol in our .dynbss section, which will
+ become part of the .bss section of the executable. There will be
+ an entry for this symbol in the .dynsym section. The dynamic
+ object will contain position independent code, so all references
+ from the dynamic object to this symbol will go through the global
+ offset table. The dynamic linker will use the .dynsym entry to
+ determine the address it must put in the global offset table, so
+ both the dynamic object and the regular object will refer to the
+ same memory location for the variable. */
+
+ htab = elf_aarch64_hash_table (info);
+
+ /* We must generate a R_AARCH64_COPY reloc to tell the dynamic linker
+ to copy the initial value out of the dynamic object and into the
+ runtime process image. */
+ if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
+ {
+ s = htab->root.sdynrelro;
+ srel = htab->root.sreldynrelro;
+ }
+ else
+ {
+ s = htab->root.sdynbss;
+ srel = htab->root.srelbss;
+ }
+ if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0)
+ {
+ srel->size += RELOC_SIZE (htab);
+ h->needs_copy = 1;
+ }
+
+ return _bfd_elf_adjust_dynamic_copy (info, h, s);
+
+}
+
+static bool
+elfNN_aarch64_allocate_local_symbols (bfd *abfd, unsigned number)
+{
+ struct elf_aarch64_local_symbol *locals;
+ locals = elf_aarch64_locals (abfd);
+ if (locals == NULL)
+ {
+ locals = (struct elf_aarch64_local_symbol *)
+ bfd_zalloc (abfd, number * sizeof (struct elf_aarch64_local_symbol));
+ if (locals == NULL)
+ return false;
+ elf_aarch64_locals (abfd) = locals;
+ }
+ return true;
+}
+
+/* Create the .got section to hold the global offset table. */
+
+static bool
+aarch64_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
+{
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ flagword flags;
+ asection *s;
+ struct elf_link_hash_entry *h;
+ struct elf_link_hash_table *htab = elf_hash_table (info);
+
+ /* This function may be called more than once. */
+ if (htab->sgot != NULL)
+ return true;
+
+ flags = bed->dynamic_sec_flags;
+
+ s = bfd_make_section_anyway_with_flags (abfd,
+ (bed->rela_plts_and_copies_p
+ ? ".rela.got" : ".rel.got"),
+ (bed->dynamic_sec_flags
+ | SEC_READONLY));
+ if (s == NULL
+ || !bfd_set_section_alignment (s, bed->s->log_file_align))
+ return false;
+ htab->srelgot = s;
+
+ s = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
+ if (s == NULL
+ || !bfd_set_section_alignment (s, bed->s->log_file_align))
+ return false;
+ htab->sgot = s;
+ htab->sgot->size += GOT_ENTRY_SIZE;
+
+ if (bed->want_got_sym)
+ {
+ /* Define the symbol _GLOBAL_OFFSET_TABLE_ at the start of the .got
+ (or .got.plt) section. We don't do this in the linker script
+ because we don't want to define the symbol if we are not creating
+ a global offset table. */
+ h = _bfd_elf_define_linkage_sym (abfd, info, s,
+ "_GLOBAL_OFFSET_TABLE_");
+ elf_hash_table (info)->hgot = h;
+ if (h == NULL)
+ return false;
+ }
+
+ if (bed->want_got_plt)
+ {
+ s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags);
+ if (s == NULL
+ || !bfd_set_section_alignment (s, bed->s->log_file_align))
+ return false;
+ htab->sgotplt = s;
+ }
+
+ /* The first bit of the global offset table is the header. */
+ s->size += bed->got_header_size;
+
+ return true;
+}
+
+/* Look through the relocs for a section during the first phase. */
+
+static bool
+elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info,
+ asection *sec, const Elf_Internal_Rela *relocs)
+{
+ Elf_Internal_Shdr *symtab_hdr;
+ struct elf_link_hash_entry **sym_hashes;
+ const Elf_Internal_Rela *rel;
+ const Elf_Internal_Rela *rel_end;
+ asection *sreloc;
+
+ struct elf_aarch64_link_hash_table *htab;
+
+ if (bfd_link_relocatable (info))
+ return true;
+
+ BFD_ASSERT (is_aarch64_elf (abfd));
+
+ htab = elf_aarch64_hash_table (info);
+ sreloc = NULL;
+
+ symtab_hdr = &elf_symtab_hdr (abfd);
+ sym_hashes = elf_sym_hashes (abfd);
+
+ rel_end = relocs + sec->reloc_count;
+ for (rel = relocs; rel < rel_end; rel++)
+ {
+ struct elf_link_hash_entry *h;
+ unsigned int r_symndx;
+ unsigned int r_type;
+ bfd_reloc_code_real_type bfd_r_type;
+ Elf_Internal_Sym *isym;
+
+ r_symndx = ELFNN_R_SYM (rel->r_info);
+ r_type = ELFNN_R_TYPE (rel->r_info);
+
+ if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr))
+ {
+ /* xgettext:c-format */
+ _bfd_error_handler (_("%pB: bad symbol index: %d"), abfd, r_symndx);
+ return false;
+ }
+
+ if (r_symndx < symtab_hdr->sh_info)
+ {
+ /* A local symbol. */
+ isym = bfd_sym_from_r_symndx (&htab->root.sym_cache,
+ abfd, r_symndx);
+ if (isym == NULL)
+ return false;
+
+ /* Check relocation against local STT_GNU_IFUNC symbol. */
+ if (ELF_ST_TYPE (isym->st_info) == STT_GNU_IFUNC)
+ {
+ h = elfNN_aarch64_get_local_sym_hash (htab, abfd, rel,
+ true);
+ if (h == NULL)
+ return false;
+
+ /* Fake a STT_GNU_IFUNC symbol. */
+ h->type = STT_GNU_IFUNC;
+ h->def_regular = 1;
+ h->ref_regular = 1;
+ h->forced_local = 1;
+ h->root.type = bfd_link_hash_defined;
+ }
+ else
+ h = NULL;
+ }
+ else
+ {
+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ while (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ }
+
+ /* Could be done earlier, if h were already available. */
+ bfd_r_type = aarch64_tls_transition (abfd, info, r_type, h, r_symndx);
+
+ if (h != NULL)
+ {
+ /* If a relocation refers to _GLOBAL_OFFSET_TABLE_, create the .got.
+ This shows up in particular in an R_AARCH64_PREL64 in large model
+ when calculating the pc-relative address to .got section which is
+ used to initialize the gp register. */
+ if (h->root.root.string
+ && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+ {
+ if (htab->root.dynobj == NULL)
+ htab->root.dynobj = abfd;
+
+ if (! aarch64_elf_create_got_section (htab->root.dynobj, info))
+ return false;
+
+ BFD_ASSERT (h == htab->root.hgot);
+ }
+
+ /* Create the ifunc sections for static executables. If we
+ never see an indirect function symbol nor we are building
+ a static executable, those sections will be empty and
+ won't appear in output. */
+ switch (bfd_r_type)
+ {
+ default:
+ break;
+
+ case BFD_RELOC_AARCH64_ADD_LO12:
+ case BFD_RELOC_AARCH64_ADR_GOT_PAGE:
+ case BFD_RELOC_AARCH64_ADR_HI21_PCREL:
+ case BFD_RELOC_AARCH64_CALL26:
+ case BFD_RELOC_AARCH64_GOT_LD_PREL19:
+ case BFD_RELOC_AARCH64_JUMP26:
+ case BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14:
+ case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC:
+ case BFD_RELOC_AARCH64_LD64_GOTOFF_LO15:
+ case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15:
+ case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC:
+ case BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC:
+ case BFD_RELOC_AARCH64_MOVW_GOTOFF_G1:
+ case BFD_RELOC_AARCH64_NN:
+ if (htab->root.dynobj == NULL)
+ htab->root.dynobj = abfd;
+ if (!_bfd_elf_create_ifunc_sections (htab->root.dynobj, info))
+ return false;
+ break;
+ }
+
+ /* It is referenced by a non-shared object. */
+ h->ref_regular = 1;
+ }
+
+ switch (bfd_r_type)
+ {
+ case BFD_RELOC_AARCH64_16:
+#if ARCH_SIZE == 64
+ case BFD_RELOC_AARCH64_32:
+#endif
+ if (bfd_link_pic (info) && (sec->flags & SEC_ALLOC) != 0)
+ {
+ if (h != NULL
+ /* This is an absolute symbol. It represents a value instead
+ of an address. */
+ && (bfd_is_abs_symbol (&h->root)
+ /* This is an undefined symbol. */
+ || h->root.type == bfd_link_hash_undefined))
+ break;
+
+ /* For local symbols, defined global symbols in a non-ABS section,
+ it is assumed that the value is an address. */
+ int howto_index = bfd_r_type - BFD_RELOC_AARCH64_RELOC_START;
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%pB: relocation %s against `%s' can not be used when making "
+ "a shared object"),
+ abfd, elfNN_aarch64_howto_table[howto_index].name,
+ (h) ? h->root.root.string : "a local symbol");
+ bfd_set_error (bfd_error_bad_value);
+ return false;
+ }
+ else
+ break;
+
+ case BFD_RELOC_AARCH64_MOVW_G0_NC:
+ case BFD_RELOC_AARCH64_MOVW_G1_NC:
+ case BFD_RELOC_AARCH64_MOVW_G2_NC:
+ case BFD_RELOC_AARCH64_MOVW_G3:
+ if (bfd_link_pic (info))
+ {
+ int howto_index = bfd_r_type - BFD_RELOC_AARCH64_RELOC_START;
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%pB: relocation %s against `%s' can not be used when making "
+ "a shared object; recompile with -fPIC"),
+ abfd, elfNN_aarch64_howto_table[howto_index].name,
+ (h) ? h->root.root.string : "a local symbol");
+ bfd_set_error (bfd_error_bad_value);
+ return false;
+ }
+ /* Fall through. */
+
+ case BFD_RELOC_AARCH64_16_PCREL:
+ case BFD_RELOC_AARCH64_32_PCREL:
+ case BFD_RELOC_AARCH64_64_PCREL:
+ case BFD_RELOC_AARCH64_ADD_LO12:
+ case BFD_RELOC_AARCH64_ADR_HI21_NC_PCREL:
+ case BFD_RELOC_AARCH64_ADR_HI21_PCREL:
+ case BFD_RELOC_AARCH64_ADR_LO21_PCREL:
+ case BFD_RELOC_AARCH64_LDST128_LO12:
+ case BFD_RELOC_AARCH64_LDST16_LO12:
+ case BFD_RELOC_AARCH64_LDST32_LO12:
+ case BFD_RELOC_AARCH64_LDST64_LO12:
+ case BFD_RELOC_AARCH64_LDST8_LO12:
+ case BFD_RELOC_AARCH64_LD_LO19_PCREL:
+ if (h == NULL || bfd_link_pic (info))
+ break;
+ /* Fall through. */
+
+ case BFD_RELOC_AARCH64_NN:
+
+ /* We don't need to handle relocs into sections not going into
+ the "real" output. */
+ if ((sec->flags & SEC_ALLOC) == 0)
+ break;
+
+ if (h != NULL)
+ {
+ if (!bfd_link_pic (info))
+ h->non_got_ref = 1;
+
+ h->plt.refcount += 1;
+ h->pointer_equality_needed = 1;
+ }
+
+ /* No need to do anything if we're not creating a shared
+ object. */
+ if (!(bfd_link_pic (info)
+ /* If on the other hand, we are creating an executable, we
+ may need to keep relocations for symbols satisfied by a
+ dynamic library if we manage to avoid copy relocs for the
+ symbol.
+
+ NOTE: Currently, there is no support of copy relocs
+ elimination on pc-relative relocation types, because there is
+ no dynamic relocation support for them in glibc. We still
+ record the dynamic symbol reference for them. This is
+ because one symbol may be referenced by both absolute
+ relocation (for example, BFD_RELOC_AARCH64_NN) and
+ pc-relative relocation. We need full symbol reference
+ information to make correct decision later in
+ elfNN_aarch64_adjust_dynamic_symbol. */
+ || (ELIMINATE_COPY_RELOCS
+ && !bfd_link_pic (info)
+ && h != NULL
+ && (h->root.type == bfd_link_hash_defweak
+ || !h->def_regular))))
+ break;
+
+ {
+ struct elf_dyn_relocs *p;
+ struct elf_dyn_relocs **head;
+ int howto_index = bfd_r_type - BFD_RELOC_AARCH64_RELOC_START;
+
+ /* We must copy these reloc types into the output file.
+ Create a reloc section in dynobj and make room for
+ this reloc. */
+ if (sreloc == NULL)
+ {
+ if (htab->root.dynobj == NULL)
+ htab->root.dynobj = abfd;
+
+ sreloc = _bfd_elf_make_dynamic_reloc_section
+ (sec, htab->root.dynobj, LOG_FILE_ALIGN, abfd, /*rela? */ true);
+
+ if (sreloc == NULL)
+ return false;
+ }
+
+ /* If this is a global symbol, we count the number of
+ relocations we need for this symbol. */
+ if (h != NULL)
+ {
+ head = &h->dyn_relocs;
+ }
+ else
+ {
+ /* Track dynamic relocs needed for local syms too.
+ We really need local syms available to do this
+ easily. Oh well. */
+
+ asection *s;
+ void **vpp;
+
+ isym = bfd_sym_from_r_symndx (&htab->root.sym_cache,
+ abfd, r_symndx);
+ if (isym == NULL)
+ return false;
+
+ s = bfd_section_from_elf_index (abfd, isym->st_shndx);
+ if (s == NULL)
+ s = sec;
+
+ /* Beware of type punned pointers vs strict aliasing
+ rules. */
+ vpp = &(elf_section_data (s)->local_dynrel);
+ head = (struct elf_dyn_relocs **) vpp;
+ }
+
+ p = *head;
+ if (p == NULL || p->sec != sec)
+ {
+ size_t amt = sizeof *p;
+ p = ((struct elf_dyn_relocs *)
+ bfd_zalloc (htab->root.dynobj, amt));
+ if (p == NULL)
+ return false;
+ p->next = *head;
+ *head = p;
+ p->sec = sec;
+ }
+
+ p->count += 1;
+
+ if (elfNN_aarch64_howto_table[howto_index].pc_relative)
+ p->pc_count += 1;
+ }
+ break;
+
+ /* RR: We probably want to keep a consistency check that
+ there are no dangling GOT_PAGE relocs. */
+ case BFD_RELOC_AARCH64_ADR_GOT_PAGE:
+ case BFD_RELOC_AARCH64_GOT_LD_PREL19:
+ case BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14:
+ case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC:
+ case BFD_RELOC_AARCH64_LD64_GOTOFF_LO15:
+ case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15:
+ case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC:
+ case BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC:
+ case BFD_RELOC_AARCH64_MOVW_GOTOFF_G1:
+ case BFD_RELOC_AARCH64_TLSDESC_ADD_LO12:
+ case BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21:
+ case BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21:
+ case BFD_RELOC_AARCH64_TLSDESC_LD32_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSDESC_LD64_LO12:
+ case BFD_RELOC_AARCH64_TLSDESC_LD_PREL19:
+ case BFD_RELOC_AARCH64_TLSDESC_OFF_G0_NC:
+ case BFD_RELOC_AARCH64_TLSDESC_OFF_G1:
+ case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21:
+ case BFD_RELOC_AARCH64_TLSGD_ADR_PREL21:
+ case BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC:
+ case BFD_RELOC_AARCH64_TLSGD_MOVW_G1:
+ case BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
+ case BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19:
+ case BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC:
+ case BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1:
+ case BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC:
+ case BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21:
+ case BFD_RELOC_AARCH64_TLSLD_ADR_PREL21:
+ {
+ unsigned got_type;
+ unsigned old_got_type;
+
+ got_type = aarch64_reloc_got_type (bfd_r_type);
+
+ if (h)
+ {
+ h->got.refcount += 1;
+ old_got_type = elf_aarch64_hash_entry (h)->got_type;
+ }
+ else
+ {
+ struct elf_aarch64_local_symbol *locals;
+
+ if (!elfNN_aarch64_allocate_local_symbols
+ (abfd, symtab_hdr->sh_info))
+ return false;
+
+ locals = elf_aarch64_locals (abfd);
+ BFD_ASSERT (r_symndx < symtab_hdr->sh_info);
+ locals[r_symndx].got_refcount += 1;
+ old_got_type = locals[r_symndx].got_type;
+ }
+
+ /* If a variable is accessed with both general dynamic TLS
+ methods, two slots may be created. */
+ if (GOT_TLS_GD_ANY_P (old_got_type) && GOT_TLS_GD_ANY_P (got_type))
+ got_type |= old_got_type;
+
+ /* We will already have issued an error message if there
+ is a TLS/non-TLS mismatch, based on the symbol type.
+ So just combine any TLS types needed. */
+ if (old_got_type != GOT_UNKNOWN && old_got_type != GOT_NORMAL
+ && got_type != GOT_NORMAL)
+ got_type |= old_got_type;
+
+ /* If the symbol is accessed by both IE and GD methods, we
+ are able to relax. Turn off the GD flag, without
+ messing up with any other kind of TLS types that may be
+ involved. */
+ if ((got_type & GOT_TLS_IE) && GOT_TLS_GD_ANY_P (got_type))
+ got_type &= ~ (GOT_TLSDESC_GD | GOT_TLS_GD);
+
+ if (old_got_type != got_type)
+ {
+ if (h != NULL)
+ elf_aarch64_hash_entry (h)->got_type = got_type;
+ else
+ {
+ struct elf_aarch64_local_symbol *locals;
+ locals = elf_aarch64_locals (abfd);
+ BFD_ASSERT (r_symndx < symtab_hdr->sh_info);
+ locals[r_symndx].got_type = got_type;
+ }
+ }
+
+ if (htab->root.dynobj == NULL)
+ htab->root.dynobj = abfd;
+ if (! aarch64_elf_create_got_section (htab->root.dynobj, info))
+ return false;
+ break;
+ }
+
+ case BFD_RELOC_AARCH64_CALL26:
+ case BFD_RELOC_AARCH64_JUMP26:
+ /* If this is a local symbol then we resolve it
+ directly without creating a PLT entry. */
+ if (h == NULL)
+ continue;
+
+ h->needs_plt = 1;
+ if (h->plt.refcount <= 0)
+ h->plt.refcount = 1;
+ else
+ h->plt.refcount += 1;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ return true;
+}
+
+/* Treat mapping symbols as special target symbols. */
+
+static bool
+elfNN_aarch64_is_target_special_symbol (bfd *abfd ATTRIBUTE_UNUSED,
+ asymbol *sym)
+{
+ return bfd_is_aarch64_special_symbol_name (sym->name,
+ BFD_AARCH64_SPECIAL_SYM_TYPE_ANY);
+}
+
+/* If the ELF symbol SYM might be a function in SEC, return the
+ function size and set *CODE_OFF to the function's entry point,
+ otherwise return zero. */
+
+static bfd_size_type
+elfNN_aarch64_maybe_function_sym (const asymbol *sym, asection *sec,
+ bfd_vma *code_off)
+{
+ bfd_size_type size;
+ elf_symbol_type * elf_sym = (elf_symbol_type *) sym;
+
+ if ((sym->flags & (BSF_SECTION_SYM | BSF_FILE | BSF_OBJECT
+ | BSF_THREAD_LOCAL | BSF_RELC | BSF_SRELC)) != 0
+ || sym->section != sec)
+ return 0;
+
+ size = (sym->flags & BSF_SYNTHETIC) ? 0 : elf_sym->internal_elf_sym.st_size;
+
+ if (!(sym->flags & BSF_SYNTHETIC))
+ switch (ELF_ST_TYPE (elf_sym->internal_elf_sym.st_info))
+ {
+ case STT_NOTYPE:
+ /* Ignore symbols created by the annobin plugin for gcc and clang.
+ These symbols are hidden, local, notype and have a size of 0. */
+ if (size == 0
+ && sym->flags & BSF_LOCAL
+ && ELF_ST_VISIBILITY (elf_sym->internal_elf_sym.st_other) == STV_HIDDEN)
+ return 0;
+ /* Fall through. */
+ case STT_FUNC:
+ /* FIXME: Allow STT_GNU_IFUNC as well ? */
+ break;
+ default:
+ return 0;
+ }
+
+ if ((sym->flags & BSF_LOCAL)
+ && bfd_is_aarch64_special_symbol_name (sym->name,
+ BFD_AARCH64_SPECIAL_SYM_TYPE_ANY))
+ return 0;
+
+ *code_off = sym->value;
+
+ /* Do not return 0 for the function's size. */
+ return size ? size : 1;
+}
+
+static bool
+elfNN_aarch64_find_inliner_info (bfd *abfd,
+ const char **filename_ptr,
+ const char **functionname_ptr,
+ unsigned int *line_ptr)
+{
+ bool found;
+ found = _bfd_dwarf2_find_inliner_info
+ (abfd, filename_ptr,
+ functionname_ptr, line_ptr, &elf_tdata (abfd)->dwarf2_find_line_info);
+ return found;
+}
+
+
+static bool
+elfNN_aarch64_init_file_header (bfd *abfd, struct bfd_link_info *link_info)
+{
+ Elf_Internal_Ehdr *i_ehdrp; /* ELF file header, internal form. */
+
+ if (!_bfd_elf_init_file_header (abfd, link_info))
+ return false;
+
+ i_ehdrp = elf_elfheader (abfd);
+ i_ehdrp->e_ident[EI_ABIVERSION] = AARCH64_ELF_ABI_VERSION;
+ return true;
+}
+
+static enum elf_reloc_type_class
+elfNN_aarch64_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ const asection *rel_sec ATTRIBUTE_UNUSED,
+ const Elf_Internal_Rela *rela)
+{
+ struct elf_aarch64_link_hash_table *htab = elf_aarch64_hash_table (info);
+
+ if (htab->root.dynsym != NULL
+ && htab->root.dynsym->contents != NULL)
+ {
+ /* Check relocation against STT_GNU_IFUNC symbol if there are
+ dynamic symbols. */
+ bfd *abfd = info->output_bfd;
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ unsigned long r_symndx = ELFNN_R_SYM (rela->r_info);
+ if (r_symndx != STN_UNDEF)
+ {
+ Elf_Internal_Sym sym;
+ if (!bed->s->swap_symbol_in (abfd,
+ (htab->root.dynsym->contents
+ + r_symndx * bed->s->sizeof_sym),
+ 0, &sym))
+ {
+ /* xgettext:c-format */
+ _bfd_error_handler (_("%pB symbol number %lu references"
+ " nonexistent SHT_SYMTAB_SHNDX section"),
+ abfd, r_symndx);
+ /* Ideally an error class should be returned here. */
+ }
+ else if (ELF_ST_TYPE (sym.st_info) == STT_GNU_IFUNC)
+ return reloc_class_ifunc;
+ }
+ }
+
+ switch ((int) ELFNN_R_TYPE (rela->r_info))
+ {
+ case AARCH64_R (IRELATIVE):
+ return reloc_class_ifunc;
+ case AARCH64_R (RELATIVE):
+ return reloc_class_relative;
+ case AARCH64_R (JUMP_SLOT):
+ return reloc_class_plt;
+ case AARCH64_R (COPY):
+ return reloc_class_copy;
+ default:
+ return reloc_class_normal;
+ }
+}
+
+/* Handle an AArch64 specific section when reading an object file. This is
+ called when bfd_section_from_shdr finds a section with an unknown
+ type. */
+
+static bool
+elfNN_aarch64_section_from_shdr (bfd *abfd,
+ Elf_Internal_Shdr *hdr,
+ const char *name, int shindex)
+{
+ /* There ought to be a place to keep ELF backend specific flags, but
+ at the moment there isn't one. We just keep track of the
+ sections by their name, instead. Fortunately, the ABI gives
+ names for all the AArch64 specific sections, so we will probably get
+ away with this. */
+ switch (hdr->sh_type)
+ {
+ case SHT_AARCH64_ATTRIBUTES:
+ break;
+
+ default:
+ return false;
+ }
+
+ if (!_bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
+ return false;
+
+ return true;
+}
+
+/* A structure used to record a list of sections, independently
+ of the next and prev fields in the asection structure. */
+typedef struct section_list
+{
+ asection *sec;
+ struct section_list *next;
+ struct section_list *prev;
+}
+section_list;
+
+/* Unfortunately we need to keep a list of sections for which
+ an _aarch64_elf_section_data structure has been allocated. This
+ is because it is possible for functions like elfNN_aarch64_write_section
+ to be called on a section which has had an elf_data_structure
+ allocated for it (and so the used_by_bfd field is valid) but
+ for which the AArch64 extended version of this structure - the
+ _aarch64_elf_section_data structure - has not been allocated. */
+static section_list *sections_with_aarch64_elf_section_data = NULL;
+
+static void
+record_section_with_aarch64_elf_section_data (asection *sec)
+{
+ struct section_list *entry;
+
+ entry = bfd_malloc (sizeof (*entry));
+ if (entry == NULL)
+ return;
+ entry->sec = sec;
+ entry->next = sections_with_aarch64_elf_section_data;
+ entry->prev = NULL;
+ if (entry->next != NULL)
+ entry->next->prev = entry;
+ sections_with_aarch64_elf_section_data = entry;
+}
+
+static struct section_list *
+find_aarch64_elf_section_entry (asection *sec)
+{
+ struct section_list *entry;
+ static struct section_list *last_entry = NULL;
+
+ /* This is a short cut for the typical case where the sections are added
+ to the sections_with_aarch64_elf_section_data list in forward order and
+ then looked up here in backwards order. This makes a real difference
+ to the ld-srec/sec64k.exp linker test. */
+ entry = sections_with_aarch64_elf_section_data;
+ if (last_entry != NULL)
+ {
+ if (last_entry->sec == sec)
+ entry = last_entry;
+ else if (last_entry->next != NULL && last_entry->next->sec == sec)
+ entry = last_entry->next;
+ }
+
+ for (; entry; entry = entry->next)
+ if (entry->sec == sec)
+ break;
+
+ if (entry)
+ /* Record the entry prior to this one - it is the entry we are
+ most likely to want to locate next time. Also this way if we
+ have been called from
+ unrecord_section_with_aarch64_elf_section_data () we will not
+ be caching a pointer that is about to be freed. */
+ last_entry = entry->prev;
+
+ return entry;
+}
+
+static void
+unrecord_section_with_aarch64_elf_section_data (asection *sec)
+{
+ struct section_list *entry;
+
+ entry = find_aarch64_elf_section_entry (sec);
+
+ if (entry)
+ {
+ if (entry->prev != NULL)
+ entry->prev->next = entry->next;
+ if (entry->next != NULL)
+ entry->next->prev = entry->prev;
+ if (entry == sections_with_aarch64_elf_section_data)
+ sections_with_aarch64_elf_section_data = entry->next;
+ free (entry);
+ }
+}
+
+
+typedef struct
+{
+ void *finfo;
+ struct bfd_link_info *info;
+ asection *sec;
+ int sec_shndx;
+ int (*func) (void *, const char *, Elf_Internal_Sym *,
+ asection *, struct elf_link_hash_entry *);
+} output_arch_syminfo;
+
+enum map_symbol_type
+{
+ AARCH64_MAP_INSN,
+ AARCH64_MAP_DATA
+};
+
+
+/* Output a single mapping symbol. */
+
+static bool
+elfNN_aarch64_output_map_sym (output_arch_syminfo *osi,
+ enum map_symbol_type type, bfd_vma offset)
+{
+ static const char *names[2] = { "$x", "$d" };
+ Elf_Internal_Sym sym;
+
+ sym.st_value = (osi->sec->output_section->vma
+ + osi->sec->output_offset + offset);
+ sym.st_size = 0;
+ sym.st_other = 0;
+ sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_NOTYPE);
+ sym.st_shndx = osi->sec_shndx;
+ return osi->func (osi->finfo, names[type], &sym, osi->sec, NULL) == 1;
+}
+
+/* Output a single local symbol for a generated stub. */
+
+static bool
+elfNN_aarch64_output_stub_sym (output_arch_syminfo *osi, const char *name,
+ bfd_vma offset, bfd_vma size)
+{
+ Elf_Internal_Sym sym;
+
+ sym.st_value = (osi->sec->output_section->vma
+ + osi->sec->output_offset + offset);
+ sym.st_size = size;
+ sym.st_other = 0;
+ sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_FUNC);
+ sym.st_shndx = osi->sec_shndx;
+ return osi->func (osi->finfo, name, &sym, osi->sec, NULL) == 1;
+}
+
+static bool
+aarch64_map_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
+{
+ struct elf_aarch64_stub_hash_entry *stub_entry;
+ asection *stub_sec;
+ bfd_vma addr;
+ char *stub_name;
+ output_arch_syminfo *osi;
+
+ /* Massage our args to the form they really have. */
+ stub_entry = (struct elf_aarch64_stub_hash_entry *) gen_entry;
+ osi = (output_arch_syminfo *) in_arg;
+
+ stub_sec = stub_entry->stub_sec;
+
+ /* Ensure this stub is attached to the current section being
+ processed. */
+ if (stub_sec != osi->sec)
+ return true;
+
+ addr = (bfd_vma) stub_entry->stub_offset;
+
+ stub_name = stub_entry->output_name;
+
+ switch (stub_entry->stub_type)
+ {
+ case aarch64_stub_adrp_branch:
+ if (!elfNN_aarch64_output_stub_sym (osi, stub_name, addr,
+ sizeof (aarch64_adrp_branch_stub)))
+ return false;
+ if (!elfNN_aarch64_output_map_sym (osi, AARCH64_MAP_INSN, addr))
+ return false;
+ break;
+ case aarch64_stub_long_branch:
+ if (!elfNN_aarch64_output_stub_sym
+ (osi, stub_name, addr, sizeof (aarch64_long_branch_stub)))
+ return false;
+ if (!elfNN_aarch64_output_map_sym (osi, AARCH64_MAP_INSN, addr))
+ return false;
+ if (!elfNN_aarch64_output_map_sym (osi, AARCH64_MAP_DATA, addr + 16))
+ return false;
+ break;
+ case aarch64_stub_erratum_835769_veneer:
+ if (!elfNN_aarch64_output_stub_sym (osi, stub_name, addr,
+ sizeof (aarch64_erratum_835769_stub)))
+ return false;
+ if (!elfNN_aarch64_output_map_sym (osi, AARCH64_MAP_INSN, addr))
+ return false;
+ break;
+ case aarch64_stub_erratum_843419_veneer:
+ if (!elfNN_aarch64_output_stub_sym (osi, stub_name, addr,
+ sizeof (aarch64_erratum_843419_stub)))
+ return false;
+ if (!elfNN_aarch64_output_map_sym (osi, AARCH64_MAP_INSN, addr))
+ return false;
+ break;
+ case aarch64_stub_none:
+ break;
+
+ default:
+ abort ();
+ }
+
+ return true;
+}
+
+/* Output mapping symbols for linker generated sections. */
+
+static bool
+elfNN_aarch64_output_arch_local_syms (bfd *output_bfd,
+ struct bfd_link_info *info,
+ void *finfo,
+ int (*func) (void *, const char *,
+ Elf_Internal_Sym *,
+ asection *,
+ struct elf_link_hash_entry
+ *))
+{
+ output_arch_syminfo osi;
+ struct elf_aarch64_link_hash_table *htab;
+
+ htab = elf_aarch64_hash_table (info);
+
+ osi.finfo = finfo;
+ osi.info = info;
+ osi.func = func;
+
+ /* Long calls stubs. */
+ if (htab->stub_bfd && htab->stub_bfd->sections)
+ {
+ asection *stub_sec;
+
+ for (stub_sec = htab->stub_bfd->sections;
+ stub_sec != NULL; stub_sec = stub_sec->next)
+ {
+ /* Ignore non-stub sections. */
+ if (!strstr (stub_sec->name, STUB_SUFFIX))
+ continue;
+
+ osi.sec = stub_sec;
+
+ osi.sec_shndx = _bfd_elf_section_from_bfd_section
+ (output_bfd, osi.sec->output_section);
+
+ /* The first instruction in a stub is always a branch. */
+ if (!elfNN_aarch64_output_map_sym (&osi, AARCH64_MAP_INSN, 0))
+ return false;
+
+ bfd_hash_traverse (&htab->stub_hash_table, aarch64_map_one_stub,
+ &osi);
+ }
+ }
+
+ /* Finally, output mapping symbols for the PLT. */
+ if (!htab->root.splt || htab->root.splt->size == 0)
+ return true;
+
+ osi.sec_shndx = _bfd_elf_section_from_bfd_section
+ (output_bfd, htab->root.splt->output_section);
+ osi.sec = htab->root.splt;
+
+ elfNN_aarch64_output_map_sym (&osi, AARCH64_MAP_INSN, 0);
+
+ return true;
+
+}
+
+/* Allocate target specific section data. */
+
+static bool
+elfNN_aarch64_new_section_hook (bfd *abfd, asection *sec)
+{
+ if (!sec->used_by_bfd)
+ {
+ _aarch64_elf_section_data *sdata;
+ size_t amt = sizeof (*sdata);
+
+ sdata = bfd_zalloc (abfd, amt);
+ if (sdata == NULL)
+ return false;
+ sec->used_by_bfd = sdata;
+ }
+
+ record_section_with_aarch64_elf_section_data (sec);
+
+ return _bfd_elf_new_section_hook (abfd, sec);
+}
+
+
+static void
+unrecord_section_via_map_over_sections (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *sec,
+ void *ignore ATTRIBUTE_UNUSED)
+{
+ unrecord_section_with_aarch64_elf_section_data (sec);
+}
+
+static bool
+elfNN_aarch64_close_and_cleanup (bfd *abfd)
+{
+ if (abfd->sections)
+ bfd_map_over_sections (abfd,
+ unrecord_section_via_map_over_sections, NULL);
+
+ return _bfd_elf_close_and_cleanup (abfd);
+}
+
+static bool
+elfNN_aarch64_bfd_free_cached_info (bfd *abfd)
+{
+ if (abfd->sections)
+ bfd_map_over_sections (abfd,
+ unrecord_section_via_map_over_sections, NULL);
+
+ return _bfd_free_cached_info (abfd);
+}
+
+/* Create dynamic sections. This is different from the ARM backend in that
+ the got, plt, gotplt and their relocation sections are all created in the
+ standard part of the bfd elf backend. */
+
+static bool
+elfNN_aarch64_create_dynamic_sections (bfd *dynobj,
+ struct bfd_link_info *info)
+{
+ /* We need to create .got section. */
+ if (!aarch64_elf_create_got_section (dynobj, info))
+ return false;
+
+ return _bfd_elf_create_dynamic_sections (dynobj, info);
+}
+
+
+/* Allocate space in .plt, .got and associated reloc sections for
+ dynamic relocs. */
+
+static bool
+elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
+{
+ struct bfd_link_info *info;
+ struct elf_aarch64_link_hash_table *htab;
+ struct elf_aarch64_link_hash_entry *eh;
+ struct elf_dyn_relocs *p;
+
+ /* An example of a bfd_link_hash_indirect symbol is versioned
+ symbol. For example: __gxx_personality_v0(bfd_link_hash_indirect)
+ -> __gxx_personality_v0(bfd_link_hash_defined)
+
+ There is no need to process bfd_link_hash_indirect symbols here
+ because we will also be presented with the concrete instance of
+ the symbol and elfNN_aarch64_copy_indirect_symbol () will have been
+ called to copy all relevant data from the generic to the concrete
+ symbol instance. */
+ if (h->root.type == bfd_link_hash_indirect)
+ return true;
+
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ info = (struct bfd_link_info *) inf;
+ htab = elf_aarch64_hash_table (info);
+
+ /* Since STT_GNU_IFUNC symbol must go through PLT, we handle it
+ here if it is defined and referenced in a non-shared object. */
+ if (h->type == STT_GNU_IFUNC
+ && h->def_regular)
+ return true;
+ else if (htab->root.dynamic_sections_created && h->plt.refcount > 0)
+ {
+ /* Make sure this symbol is output as a dynamic symbol.
+ Undefined weak syms won't yet be marked as dynamic. */
+ if (h->dynindx == -1 && !h->forced_local
+ && h->root.type == bfd_link_hash_undefweak)
+ {
+ if (!bfd_elf_link_record_dynamic_symbol (info, h))
+ return false;
+ }
+
+ if (bfd_link_pic (info) || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
+ {
+ asection *s = htab->root.splt;
+
+ /* If this is the first .plt entry, make room for the special
+ first entry. */
+ if (s->size == 0)
+ s->size += htab->plt_header_size;
+
+ h->plt.offset = s->size;
+
+ /* If this symbol is not defined in a regular file, and we are
+ not generating a shared library, then set the symbol to this
+ location in the .plt. This is required to make function
+ pointers compare as equal between the normal executable and
+ the shared library. */
+ if (!bfd_link_pic (info) && !h->def_regular)
+ {
+ h->root.u.def.section = s;
+ h->root.u.def.value = h->plt.offset;
+ }
+
+ /* Make room for this entry. For now we only create the
+ small model PLT entries. We later need to find a way
+ of relaxing into these from the large model PLT entries. */
+ s->size += htab->plt_entry_size;
+
+ /* We also need to make an entry in the .got.plt section, which
+ will be placed in the .got section by the linker script. */
+ htab->root.sgotplt->size += GOT_ENTRY_SIZE;
+
+ /* We also need to make an entry in the .rela.plt section. */
+ htab->root.srelplt->size += RELOC_SIZE (htab);
+
+ /* We need to ensure that all GOT entries that serve the PLT
+ are consecutive with the special GOT slots [0] [1] and
+ [2]. Any addtional relocations, such as
+ R_AARCH64_TLSDESC, must be placed after the PLT related
+ entries. We abuse the reloc_count such that during
+ sizing we adjust reloc_count to indicate the number of
+ PLT related reserved entries. In subsequent phases when
+ filling in the contents of the reloc entries, PLT related
+ entries are placed by computing their PLT index (0
+ .. reloc_count). While other none PLT relocs are placed
+ at the slot indicated by reloc_count and reloc_count is
+ updated. */
+
+ htab->root.srelplt->reloc_count++;
+
+ /* Mark the DSO in case R_<CLS>_JUMP_SLOT relocs against
+ variant PCS symbols are present. */
+ if (h->other & STO_AARCH64_VARIANT_PCS)
+ htab->variant_pcs = 1;
+
+ }
+ else
+ {
+ h->plt.offset = (bfd_vma) - 1;
+ h->needs_plt = 0;
+ }
+ }
+ else
+ {
+ h->plt.offset = (bfd_vma) - 1;
+ h->needs_plt = 0;
+ }
+
+ eh = (struct elf_aarch64_link_hash_entry *) h;
+ eh->tlsdesc_got_jump_table_offset = (bfd_vma) - 1;
+
+ if (h->got.refcount > 0)
+ {
+ bool dyn;
+ unsigned got_type = elf_aarch64_hash_entry (h)->got_type;
+
+ h->got.offset = (bfd_vma) - 1;
+
+ dyn = htab->root.dynamic_sections_created;
+
+ /* Make sure this symbol is output as a dynamic symbol.
+ Undefined weak syms won't yet be marked as dynamic. */
+ if (dyn && h->dynindx == -1 && !h->forced_local
+ && h->root.type == bfd_link_hash_undefweak)
+ {
+ if (!bfd_elf_link_record_dynamic_symbol (info, h))
+ return false;
+ }
+
+ if (got_type == GOT_UNKNOWN)
+ {
+ }
+ else if (got_type == GOT_NORMAL)
+ {
+ h->got.offset = htab->root.sgot->size;
+ htab->root.sgot->size += GOT_ENTRY_SIZE;
+ if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak)
+ && (bfd_link_pic (info)
+ || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))
+ /* Undefined weak symbol in static PIE resolves to 0 without
+ any dynamic relocations. */
+ && !UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
+ {
+ htab->root.srelgot->size += RELOC_SIZE (htab);
+ }
+ }
+ else
+ {
+ int indx;
+ if (got_type & GOT_TLSDESC_GD)
+ {
+ eh->tlsdesc_got_jump_table_offset =
+ (htab->root.sgotplt->size
+ - aarch64_compute_jump_table_size (htab));
+ htab->root.sgotplt->size += GOT_ENTRY_SIZE * 2;
+ h->got.offset = (bfd_vma) - 2;
+ }
+
+ if (got_type & GOT_TLS_GD)
+ {
+ h->got.offset = htab->root.sgot->size;
+ htab->root.sgot->size += GOT_ENTRY_SIZE * 2;
+ }
+
+ if (got_type & GOT_TLS_IE)
+ {
+ h->got.offset = htab->root.sgot->size;
+ htab->root.sgot->size += GOT_ENTRY_SIZE;
+ }
+
+ indx = h && h->dynindx != -1 ? h->dynindx : 0;
+ if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak)
+ && (!bfd_link_executable (info)
+ || indx != 0
+ || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
+ {
+ if (got_type & GOT_TLSDESC_GD)
+ {
+ htab->root.srelplt->size += RELOC_SIZE (htab);
+ /* Note reloc_count not incremented here! We have
+ already adjusted reloc_count for this relocation
+ type. */
+
+ /* TLSDESC PLT is now needed, but not yet determined. */
+ htab->root.tlsdesc_plt = (bfd_vma) - 1;
+ }
+
+ if (got_type & GOT_TLS_GD)
+ htab->root.srelgot->size += RELOC_SIZE (htab) * 2;
+
+ if (got_type & GOT_TLS_IE)
+ htab->root.srelgot->size += RELOC_SIZE (htab);
+ }
+ }
+ }
+ else
+ {
+ h->got.offset = (bfd_vma) - 1;
+ }
+
+ if (h->dyn_relocs == NULL)
+ return true;
+
+ /* In the shared -Bsymbolic case, discard space allocated for
+ dynamic pc-relative relocs against symbols which turn out to be
+ defined in regular objects. For the normal shared case, discard
+ space for pc-relative relocs that have become local due to symbol
+ visibility changes. */
+
+ if (bfd_link_pic (info))
+ {
+ /* Relocs that use pc_count are those that appear on a call
+ insn, or certain REL relocs that can generated via assembly.
+ We want calls to protected symbols to resolve directly to the
+ function rather than going via the plt. If people want
+ function pointer comparisons to work as expected then they
+ should avoid writing weird assembly. */
+ if (SYMBOL_CALLS_LOCAL (info, h))
+ {
+ struct elf_dyn_relocs **pp;
+
+ for (pp = &h->dyn_relocs; (p = *pp) != NULL;)
+ {
+ p->count -= p->pc_count;
+ p->pc_count = 0;
+ if (p->count == 0)
+ *pp = p->next;
+ else
+ pp = &p->next;
+ }
+ }
+
+ /* Also discard relocs on undefined weak syms with non-default
+ visibility. */
+ if (h->dyn_relocs != NULL && h->root.type == bfd_link_hash_undefweak)
+ {
+ if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ || UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
+ h->dyn_relocs = NULL;
+
+ /* Make sure undefined weak symbols are output as a dynamic
+ symbol in PIEs. */
+ else if (h->dynindx == -1
+ && !h->forced_local
+ && h->root.type == bfd_link_hash_undefweak
+ && !bfd_elf_link_record_dynamic_symbol (info, h))
+ return false;
+ }
+
+ }
+ else if (ELIMINATE_COPY_RELOCS)
+ {
+ /* For the non-shared case, discard space for relocs against
+ symbols which turn out to need copy relocs or are not
+ dynamic. */
+
+ if (!h->non_got_ref
+ && ((h->def_dynamic
+ && !h->def_regular)
+ || (htab->root.dynamic_sections_created
+ && (h->root.type == bfd_link_hash_undefweak
+ || h->root.type == bfd_link_hash_undefined))))
+ {
+ /* Make sure this symbol is output as a dynamic symbol.
+ Undefined weak syms won't yet be marked as dynamic. */
+ if (h->dynindx == -1
+ && !h->forced_local
+ && h->root.type == bfd_link_hash_undefweak
+ && !bfd_elf_link_record_dynamic_symbol (info, h))
+ return false;
+
+ /* If that succeeded, we know we'll be keeping all the
+ relocs. */
+ if (h->dynindx != -1)
+ goto keep;
+ }
+
+ h->dyn_relocs = NULL;
+
+ keep:;
+ }
+
+ /* Finally, allocate space. */
+ for (p = h->dyn_relocs; p != NULL; p = p->next)
+ {
+ asection *sreloc;
+
+ sreloc = elf_section_data (p->sec)->sreloc;
+
+ BFD_ASSERT (sreloc != NULL);
+
+ sreloc->size += p->count * RELOC_SIZE (htab);
+ }
+
+ return true;
+}
+
+/* Allocate space in .plt, .got and associated reloc sections for
+ ifunc dynamic relocs. */
+
+static bool
+elfNN_aarch64_allocate_ifunc_dynrelocs (struct elf_link_hash_entry *h,
+ void *inf)
+{
+ struct bfd_link_info *info;
+ struct elf_aarch64_link_hash_table *htab;
+
+ /* An example of a bfd_link_hash_indirect symbol is versioned
+ symbol. For example: __gxx_personality_v0(bfd_link_hash_indirect)
+ -> __gxx_personality_v0(bfd_link_hash_defined)
+
+ There is no need to process bfd_link_hash_indirect symbols here
+ because we will also be presented with the concrete instance of
+ the symbol and elfNN_aarch64_copy_indirect_symbol () will have been
+ called to copy all relevant data from the generic to the concrete
+ symbol instance. */
+ if (h->root.type == bfd_link_hash_indirect)
+ return true;
+
+ if (h->root.type == bfd_link_hash_warning)
+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ info = (struct bfd_link_info *) inf;
+ htab = elf_aarch64_hash_table (info);
+
+ /* Since STT_GNU_IFUNC symbol must go through PLT, we handle it
+ here if it is defined and referenced in a non-shared object. */
+ if (h->type == STT_GNU_IFUNC
+ && h->def_regular)
+ return _bfd_elf_allocate_ifunc_dyn_relocs (info, h,
+ &h->dyn_relocs,
+ htab->plt_entry_size,
+ htab->plt_header_size,
+ GOT_ENTRY_SIZE,
+ false);
+ return true;
+}
+
+/* Allocate space in .plt, .got and associated reloc sections for
+ local ifunc dynamic relocs. */
+
+static int
+elfNN_aarch64_allocate_local_ifunc_dynrelocs (void **slot, void *inf)
+{
+ struct elf_link_hash_entry *h
+ = (struct elf_link_hash_entry *) *slot;
+
+ if (h->type != STT_GNU_IFUNC
+ || !h->def_regular
+ || !h->ref_regular
+ || !h->forced_local
+ || h->root.type != bfd_link_hash_defined)
+ abort ();
+
+ return elfNN_aarch64_allocate_ifunc_dynrelocs (h, inf);
+}
+
+/* This is the most important function of all . Innocuosly named
+ though ! */
+
+static bool
+elfNN_aarch64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info)
+{
+ struct elf_aarch64_link_hash_table *htab;
+ bfd *dynobj;
+ asection *s;
+ bool relocs;
+ bfd *ibfd;
+
+ htab = elf_aarch64_hash_table ((info));
+ dynobj = htab->root.dynobj;
+
+ BFD_ASSERT (dynobj != NULL);
+
+ if (htab->root.dynamic_sections_created)
+ {
+ if (bfd_link_executable (info) && !info->nointerp)
+ {
+ s = bfd_get_linker_section (dynobj, ".interp");
+ if (s == NULL)
+ abort ();
+ s->size = sizeof ELF_DYNAMIC_INTERPRETER;
+ s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
+ }
+ }
+
+ /* Set up .got offsets for local syms, and space for local dynamic
+ relocs. */
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
+ {
+ struct elf_aarch64_local_symbol *locals = NULL;
+ Elf_Internal_Shdr *symtab_hdr;
+ asection *srel;
+ unsigned int i;
+
+ if (!is_aarch64_elf (ibfd))
+ continue;
+
+ for (s = ibfd->sections; s != NULL; s = s->next)
+ {
+ struct elf_dyn_relocs *p;
+
+ for (p = (struct elf_dyn_relocs *)
+ (elf_section_data (s)->local_dynrel); p != NULL; p = p->next)
+ {
+ if (!bfd_is_abs_section (p->sec)
+ && bfd_is_abs_section (p->sec->output_section))
+ {
+ /* Input section has been discarded, either because
+ it is a copy of a linkonce section or due to
+ linker script /DISCARD/, so we'll be discarding
+ the relocs too. */
+ }
+ else if (p->count != 0)
+ {
+ srel = elf_section_data (p->sec)->sreloc;
+ srel->size += p->count * RELOC_SIZE (htab);
+ if ((p->sec->output_section->flags & SEC_READONLY) != 0)
+ info->flags |= DF_TEXTREL;
+ }
+ }
+ }
+
+ locals = elf_aarch64_locals (ibfd);
+ if (!locals)
+ continue;
+
+ symtab_hdr = &elf_symtab_hdr (ibfd);
+ srel = htab->root.srelgot;
+ for (i = 0; i < symtab_hdr->sh_info; i++)
+ {
+ locals[i].got_offset = (bfd_vma) - 1;
+ locals[i].tlsdesc_got_jump_table_offset = (bfd_vma) - 1;
+ if (locals[i].got_refcount > 0)
+ {
+ unsigned got_type = locals[i].got_type;
+ if (got_type & GOT_TLSDESC_GD)
+ {
+ locals[i].tlsdesc_got_jump_table_offset =
+ (htab->root.sgotplt->size
+ - aarch64_compute_jump_table_size (htab));
+ htab->root.sgotplt->size += GOT_ENTRY_SIZE * 2;
+ locals[i].got_offset = (bfd_vma) - 2;
+ }
+
+ if (got_type & GOT_TLS_GD)
+ {
+ locals[i].got_offset = htab->root.sgot->size;
+ htab->root.sgot->size += GOT_ENTRY_SIZE * 2;
+ }
+
+ if (got_type & GOT_TLS_IE
+ || got_type & GOT_NORMAL)
+ {
+ locals[i].got_offset = htab->root.sgot->size;
+ htab->root.sgot->size += GOT_ENTRY_SIZE;
+ }
+
+ if (got_type == GOT_UNKNOWN)
+ {
+ }
+
+ if (bfd_link_pic (info))
+ {
+ if (got_type & GOT_TLSDESC_GD)
+ {
+ htab->root.srelplt->size += RELOC_SIZE (htab);
+ /* Note RELOC_COUNT not incremented here! */
+ htab->root.tlsdesc_plt = (bfd_vma) - 1;
+ }
+
+ if (got_type & GOT_TLS_GD)
+ htab->root.srelgot->size += RELOC_SIZE (htab) * 2;
+
+ if (got_type & GOT_TLS_IE
+ || got_type & GOT_NORMAL)
+ htab->root.srelgot->size += RELOC_SIZE (htab);
+ }
+ }
+ else
+ {
+ locals[i].got_refcount = (bfd_vma) - 1;
+ }
+ }
+ }
+
+
+ /* Allocate global sym .plt and .got entries, and space for global
+ sym dynamic relocs. */
+ elf_link_hash_traverse (&htab->root, elfNN_aarch64_allocate_dynrelocs,
+ info);
+
+ /* Allocate global ifunc sym .plt and .got entries, and space for global
+ ifunc sym dynamic relocs. */
+ elf_link_hash_traverse (&htab->root, elfNN_aarch64_allocate_ifunc_dynrelocs,
+ info);
+
+ /* Allocate .plt and .got entries, and space for local ifunc symbols. */
+ htab_traverse (htab->loc_hash_table,
+ elfNN_aarch64_allocate_local_ifunc_dynrelocs,
+ info);
+
+ /* For every jump slot reserved in the sgotplt, reloc_count is
+ incremented. However, when we reserve space for TLS descriptors,
+ it's not incremented, so in order to compute the space reserved
+ for them, it suffices to multiply the reloc count by the jump
+ slot size. */
+
+ if (htab->root.srelplt)
+ htab->sgotplt_jump_table_size = aarch64_compute_jump_table_size (htab);
+
+ if (htab->root.tlsdesc_plt)
+ {
+ if (htab->root.splt->size == 0)
+ htab->root.splt->size += htab->plt_header_size;
+
+ /* If we're not using lazy TLS relocations, don't generate the
+ GOT and PLT entry required. */
+ if ((info->flags & DF_BIND_NOW))
+ htab->root.tlsdesc_plt = 0;
+ else
+ {
+ htab->root.tlsdesc_plt = htab->root.splt->size;
+ htab->root.splt->size += htab->tlsdesc_plt_entry_size;
+
+ htab->root.tlsdesc_got = htab->root.sgot->size;
+ htab->root.sgot->size += GOT_ENTRY_SIZE;
+ }
+ }
+
+ /* Init mapping symbols information to use later to distingush between
+ code and data while scanning for errata. */
+ if (htab->fix_erratum_835769 || htab->fix_erratum_843419)
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
+ {
+ if (!is_aarch64_elf (ibfd))
+ continue;
+ bfd_elfNN_aarch64_init_maps (ibfd);
+ }
+
+ /* We now have determined the sizes of the various dynamic sections.
+ Allocate memory for them. */
+ relocs = false;
+ for (s = dynobj->sections; s != NULL; s = s->next)
+ {
+ if ((s->flags & SEC_LINKER_CREATED) == 0)
+ continue;
+
+ if (s == htab->root.splt
+ || s == htab->root.sgot
+ || s == htab->root.sgotplt
+ || s == htab->root.iplt
+ || s == htab->root.igotplt
+ || s == htab->root.sdynbss
+ || s == htab->root.sdynrelro)
+ {
+ /* Strip this section if we don't need it; see the
+ comment below. */
+ }
+ else if (startswith (bfd_section_name (s), ".rela"))
+ {
+ if (s->size != 0 && s != htab->root.srelplt)
+ relocs = true;
+
+ /* We use the reloc_count field as a counter if we need
+ to copy relocs into the output file. */
+ if (s != htab->root.srelplt)
+ s->reloc_count = 0;
+ }
+ else
+ {
+ /* It's not one of our sections, so don't allocate space. */
+ continue;
+ }
+
+ if (s->size == 0)
+ {
+ /* If we don't need this section, strip it from the
+ output file. This is mostly to handle .rela.bss and
+ .rela.plt. We must create both sections in
+ create_dynamic_sections, because they must be created
+ before the linker maps input sections to output
+ sections. The linker does that before
+ adjust_dynamic_symbol is called, and it is that
+ function which decides whether anything needs to go
+ into these sections. */
+ s->flags |= SEC_EXCLUDE;
+ continue;
+ }
+
+ if ((s->flags & SEC_HAS_CONTENTS) == 0)
+ continue;
+
+ /* Allocate memory for the section contents. We use bfd_zalloc
+ here in case unused entries are not reclaimed before the
+ section's contents are written out. This should not happen,
+ but this way if it does, we get a R_AARCH64_NONE reloc instead
+ of garbage. */
+ s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size);
+ if (s->contents == NULL)
+ return false;
+ }
+
+ if (htab->root.dynamic_sections_created)
+ {
+ /* Add some entries to the .dynamic section. We fill in the
+ values later, in elfNN_aarch64_finish_dynamic_sections, but we
+ must add the entries now so that we get the correct size for
+ the .dynamic section. The DT_DEBUG entry is filled in by the
+ dynamic linker and used by the debugger. */
+#define add_dynamic_entry(TAG, VAL) \
+ _bfd_elf_add_dynamic_entry (info, TAG, VAL)
+
+ if (!_bfd_elf_add_dynamic_tags (output_bfd, info, relocs))
+ return false;
+
+ if (htab->root.splt->size != 0)
+ {
+ if (htab->variant_pcs
+ && !add_dynamic_entry (DT_AARCH64_VARIANT_PCS, 0))
+ return false;
+
+ if ((elf_aarch64_tdata (output_bfd)->plt_type == PLT_BTI_PAC)
+ && (!add_dynamic_entry (DT_AARCH64_BTI_PLT, 0)
+ || !add_dynamic_entry (DT_AARCH64_PAC_PLT, 0)))
+ return false;
+
+ else if ((elf_aarch64_tdata (output_bfd)->plt_type == PLT_BTI)
+ && !add_dynamic_entry (DT_AARCH64_BTI_PLT, 0))
+ return false;
+
+ else if ((elf_aarch64_tdata (output_bfd)->plt_type == PLT_PAC)
+ && !add_dynamic_entry (DT_AARCH64_PAC_PLT, 0))
+ return false;
+ }
+ }
+#undef add_dynamic_entry
+
+ return true;
+}
+
+static inline void
+elf_aarch64_update_plt_entry (bfd *output_bfd,
+ bfd_reloc_code_real_type r_type,
+ bfd_byte *plt_entry, bfd_vma value)
+{
+ reloc_howto_type *howto = elfNN_aarch64_howto_from_bfd_reloc (r_type);
+
+ /* FIXME: We should check the return value from this function call. */
+ (void) _bfd_aarch64_elf_put_addend (output_bfd, plt_entry, r_type, howto, value);
+}
+
+static void
+elfNN_aarch64_create_small_pltn_entry (struct elf_link_hash_entry *h,
+ struct elf_aarch64_link_hash_table
+ *htab, bfd *output_bfd,
+ struct bfd_link_info *info)
+{
+ bfd_byte *plt_entry;
+ bfd_vma plt_index;
+ bfd_vma got_offset;
+ bfd_vma gotplt_entry_address;
+ bfd_vma plt_entry_address;
+ Elf_Internal_Rela rela;
+ bfd_byte *loc;
+ asection *plt, *gotplt, *relplt;
+
+ /* When building a static executable, use .iplt, .igot.plt and
+ .rela.iplt sections for STT_GNU_IFUNC symbols. */
+ if (htab->root.splt != NULL)
+ {
+ plt = htab->root.splt;
+ gotplt = htab->root.sgotplt;
+ relplt = htab->root.srelplt;
+ }
+ else
+ {
+ plt = htab->root.iplt;
+ gotplt = htab->root.igotplt;
+ relplt = htab->root.irelplt;
+ }
+
+ /* Get the index in the procedure linkage table which
+ corresponds to this symbol. This is the index of this symbol
+ in all the symbols for which we are making plt entries. The
+ first entry in the procedure linkage table is reserved.
+
+ Get the offset into the .got table of the entry that
+ corresponds to this function. Each .got entry is GOT_ENTRY_SIZE
+ bytes. The first three are reserved for the dynamic linker.
+
+ For static executables, we don't reserve anything. */
+
+ if (plt == htab->root.splt)
+ {
+ plt_index = (h->plt.offset - htab->plt_header_size) / htab->plt_entry_size;
+ got_offset = (plt_index + 3) * GOT_ENTRY_SIZE;
+ }
+ else
+ {
+ plt_index = h->plt.offset / htab->plt_entry_size;
+ got_offset = plt_index * GOT_ENTRY_SIZE;
+ }
+
+ plt_entry = plt->contents + h->plt.offset;
+ plt_entry_address = plt->output_section->vma
+ + plt->output_offset + h->plt.offset;
+ gotplt_entry_address = gotplt->output_section->vma +
+ gotplt->output_offset + got_offset;
+
+ /* Copy in the boiler-plate for the PLTn entry. */
+ memcpy (plt_entry, htab->plt_entry, htab->plt_entry_size);
+
+ /* First instruction in BTI enabled PLT stub is a BTI
+ instruction so skip it. */
+ if (elf_aarch64_tdata (output_bfd)->plt_type & PLT_BTI
+ && elf_elfheader (output_bfd)->e_type == ET_EXEC)
+ plt_entry = plt_entry + 4;
+
+ /* Fill in the top 21 bits for this: ADRP x16, PLT_GOT + n * 8.
+ ADRP: ((PG(S+A)-PG(P)) >> 12) & 0x1fffff */
+ elf_aarch64_update_plt_entry (output_bfd, BFD_RELOC_AARCH64_ADR_HI21_PCREL,
+ plt_entry,
+ PG (gotplt_entry_address) -
+ PG (plt_entry_address));
+
+ /* Fill in the lo12 bits for the load from the pltgot. */
+ elf_aarch64_update_plt_entry (output_bfd, BFD_RELOC_AARCH64_LDSTNN_LO12,
+ plt_entry + 4,
+ PG_OFFSET (gotplt_entry_address));
+
+ /* Fill in the lo12 bits for the add from the pltgot entry. */
+ elf_aarch64_update_plt_entry (output_bfd, BFD_RELOC_AARCH64_ADD_LO12,
+ plt_entry + 8,
+ PG_OFFSET (gotplt_entry_address));
+
+ /* All the GOTPLT Entries are essentially initialized to PLT0. */
+ bfd_put_NN (output_bfd,
+ plt->output_section->vma + plt->output_offset,
+ gotplt->contents + got_offset);
+
+ rela.r_offset = gotplt_entry_address;
+
+ if (h->dynindx == -1
+ || ((bfd_link_executable (info)
+ || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
+ && h->def_regular
+ && h->type == STT_GNU_IFUNC))
+ {
+ /* If an STT_GNU_IFUNC symbol is locally defined, generate
+ R_AARCH64_IRELATIVE instead of R_AARCH64_JUMP_SLOT. */
+ rela.r_info = ELFNN_R_INFO (0, AARCH64_R (IRELATIVE));
+ rela.r_addend = (h->root.u.def.value
+ + h->root.u.def.section->output_section->vma
+ + h->root.u.def.section->output_offset);
+ }
+ else
+ {
+ /* Fill in the entry in the .rela.plt section. */
+ rela.r_info = ELFNN_R_INFO (h->dynindx, AARCH64_R (JUMP_SLOT));
+ rela.r_addend = 0;
+ }
+
+ /* Compute the relocation entry to used based on PLT index and do
+ not adjust reloc_count. The reloc_count has already been adjusted
+ to account for this entry. */
+ loc = relplt->contents + plt_index * RELOC_SIZE (htab);
+ bfd_elfNN_swap_reloca_out (output_bfd, &rela, loc);
+}
+
+/* Size sections even though they're not dynamic. We use it to setup
+ _TLS_MODULE_BASE_, if needed. */
+
+static bool
+elfNN_aarch64_always_size_sections (bfd *output_bfd,
+ struct bfd_link_info *info)
+{
+ asection *tls_sec;
+
+ if (bfd_link_relocatable (info))
+ return true;
+
+ tls_sec = elf_hash_table (info)->tls_sec;
+
+ if (tls_sec)
+ {
+ struct elf_link_hash_entry *tlsbase;
+
+ tlsbase = elf_link_hash_lookup (elf_hash_table (info),
+ "_TLS_MODULE_BASE_", true, true, false);
+
+ if (tlsbase)
+ {
+ struct bfd_link_hash_entry *h = NULL;
+ const struct elf_backend_data *bed =
+ get_elf_backend_data (output_bfd);
+
+ if (!(_bfd_generic_link_add_one_symbol
+ (info, output_bfd, "_TLS_MODULE_BASE_", BSF_LOCAL,
+ tls_sec, 0, NULL, false, bed->collect, &h)))
+ return false;
+
+ tlsbase->type = STT_TLS;
+ tlsbase = (struct elf_link_hash_entry *) h;
+ tlsbase->def_regular = 1;
+ tlsbase->other = STV_HIDDEN;
+ (*bed->elf_backend_hide_symbol) (info, tlsbase, true);
+ }
+ }
+
+ return true;
+}
+
+/* Finish up dynamic symbol handling. We set the contents of various
+ dynamic sections here. */
+
+static bool
+elfNN_aarch64_finish_dynamic_symbol (bfd *output_bfd,
+ struct bfd_link_info *info,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
+{
+ struct elf_aarch64_link_hash_table *htab;
+ htab = elf_aarch64_hash_table (info);
+
+ if (h->plt.offset != (bfd_vma) - 1)
+ {
+ asection *plt, *gotplt, *relplt;
+
+ /* This symbol has an entry in the procedure linkage table. Set
+ it up. */
+
+ /* When building a static executable, use .iplt, .igot.plt and
+ .rela.iplt sections for STT_GNU_IFUNC symbols. */
+ if (htab->root.splt != NULL)
+ {
+ plt = htab->root.splt;
+ gotplt = htab->root.sgotplt;
+ relplt = htab->root.srelplt;
+ }
+ else
+ {
+ plt = htab->root.iplt;
+ gotplt = htab->root.igotplt;
+ relplt = htab->root.irelplt;
+ }
+
+ /* This symbol has an entry in the procedure linkage table. Set
+ it up. */
+ if ((h->dynindx == -1
+ && !((h->forced_local || bfd_link_executable (info))
+ && h->def_regular
+ && h->type == STT_GNU_IFUNC))
+ || plt == NULL
+ || gotplt == NULL
+ || relplt == NULL)
+ return false;
+
+ elfNN_aarch64_create_small_pltn_entry (h, htab, output_bfd, info);
+ if (!h->def_regular)
+ {
+ /* Mark the symbol as undefined, rather than as defined in
+ the .plt section. */
+ sym->st_shndx = SHN_UNDEF;
+ /* If the symbol is weak we need to clear the value.
+ Otherwise, the PLT entry would provide a definition for
+ the symbol even if the symbol wasn't defined anywhere,
+ and so the symbol would never be NULL. Leave the value if
+ there were any relocations where pointer equality matters
+ (this is a clue for the dynamic linker, to make function
+ pointer comparisons work between an application and shared
+ library). */
+ if (!h->ref_regular_nonweak || !h->pointer_equality_needed)
+ sym->st_value = 0;
+ }
+ }
+
+ if (h->got.offset != (bfd_vma) - 1
+ && elf_aarch64_hash_entry (h)->got_type == GOT_NORMAL
+ /* Undefined weak symbol in static PIE resolves to 0 without
+ any dynamic relocations. */
+ && !UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
+ {
+ Elf_Internal_Rela rela;
+ bfd_byte *loc;
+
+ /* This symbol has an entry in the global offset table. Set it
+ up. */
+ if (htab->root.sgot == NULL || htab->root.srelgot == NULL)
+ abort ();
+
+ rela.r_offset = (htab->root.sgot->output_section->vma
+ + htab->root.sgot->output_offset
+ + (h->got.offset & ~(bfd_vma) 1));
+
+ if (h->def_regular
+ && h->type == STT_GNU_IFUNC)
+ {
+ if (bfd_link_pic (info))
+ {
+ /* Generate R_AARCH64_GLOB_DAT. */
+ goto do_glob_dat;
+ }
+ else
+ {
+ asection *plt;
+
+ if (!h->pointer_equality_needed)
+ abort ();
+
+ /* For non-shared object, we can't use .got.plt, which
+ contains the real function address if we need pointer
+ equality. We load the GOT entry with the PLT entry. */
+ plt = htab->root.splt ? htab->root.splt : htab->root.iplt;
+ bfd_put_NN (output_bfd, (plt->output_section->vma
+ + plt->output_offset
+ + h->plt.offset),
+ htab->root.sgot->contents
+ + (h->got.offset & ~(bfd_vma) 1));
+ return true;
+ }
+ }
+ else if (bfd_link_pic (info) && SYMBOL_REFERENCES_LOCAL (info, h))
+ {
+ if (!(h->def_regular || ELF_COMMON_DEF_P (h)))
+ return false;
+
+ BFD_ASSERT ((h->got.offset & 1) != 0);
+ rela.r_info = ELFNN_R_INFO (0, AARCH64_R (RELATIVE));
+ rela.r_addend = (h->root.u.def.value
+ + h->root.u.def.section->output_section->vma
+ + h->root.u.def.section->output_offset);
+ }
+ else
+ {
+ do_glob_dat:
+ BFD_ASSERT ((h->got.offset & 1) == 0);
+ bfd_put_NN (output_bfd, (bfd_vma) 0,
+ htab->root.sgot->contents + h->got.offset);
+ rela.r_info = ELFNN_R_INFO (h->dynindx, AARCH64_R (GLOB_DAT));
+ rela.r_addend = 0;
+ }
+
+ loc = htab->root.srelgot->contents;
+ loc += htab->root.srelgot->reloc_count++ * RELOC_SIZE (htab);
+ bfd_elfNN_swap_reloca_out (output_bfd, &rela, loc);
+ }
+
+ if (h->needs_copy)
+ {
+ Elf_Internal_Rela rela;
+ asection *s;
+ bfd_byte *loc;
+
+ /* This symbol needs a copy reloc. Set it up. */
+ if (h->dynindx == -1
+ || (h->root.type != bfd_link_hash_defined
+ && h->root.type != bfd_link_hash_defweak)
+ || htab->root.srelbss == NULL)
+ abort ();
+
+ rela.r_offset = (h->root.u.def.value
+ + h->root.u.def.section->output_section->vma
+ + h->root.u.def.section->output_offset);
+ rela.r_info = ELFNN_R_INFO (h->dynindx, AARCH64_R (COPY));
+ rela.r_addend = 0;
+ if (h->root.u.def.section == htab->root.sdynrelro)
+ s = htab->root.sreldynrelro;
+ else
+ s = htab->root.srelbss;
+ loc = s->contents + s->reloc_count++ * RELOC_SIZE (htab);
+ bfd_elfNN_swap_reloca_out (output_bfd, &rela, loc);
+ }
+
+ /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. SYM may
+ be NULL for local symbols. */
+ if (sym != NULL
+ && (h == elf_hash_table (info)->hdynamic
+ || h == elf_hash_table (info)->hgot))
+ sym->st_shndx = SHN_ABS;
+
+ return true;
+}
+
+/* Finish up local dynamic symbol handling. We set the contents of
+ various dynamic sections here. */
+
+static int
+elfNN_aarch64_finish_local_dynamic_symbol (void **slot, void *inf)
+{
+ struct elf_link_hash_entry *h
+ = (struct elf_link_hash_entry *) *slot;
+ struct bfd_link_info *info
+ = (struct bfd_link_info *) inf;
+
+ return elfNN_aarch64_finish_dynamic_symbol (info->output_bfd,
+ info, h, NULL);
+}
+
+static void
+elfNN_aarch64_init_small_plt0_entry (bfd *output_bfd ATTRIBUTE_UNUSED,
+ struct elf_aarch64_link_hash_table
+ *htab)
+{
+ /* Fill in PLT0. Fixme:RR Note this doesn't distinguish between
+ small and large plts and at the minute just generates
+ the small PLT. */
+
+ /* PLT0 of the small PLT looks like this in ELF64 -
+ stp x16, x30, [sp, #-16]! // Save the reloc and lr on stack.
+ adrp x16, PLT_GOT + 16 // Get the page base of the GOTPLT
+ ldr x17, [x16, #:lo12:PLT_GOT+16] // Load the address of the
+ // symbol resolver
+ add x16, x16, #:lo12:PLT_GOT+16 // Load the lo12 bits of the
+ // GOTPLT entry for this.
+ br x17
+ PLT0 will be slightly different in ELF32 due to different got entry
+ size. */
+ bfd_vma plt_got_2nd_ent; /* Address of GOT[2]. */
+ bfd_vma plt_base;
+
+
+ memcpy (htab->root.splt->contents, htab->plt0_entry,
+ htab->plt_header_size);
+
+ /* PR 26312: Explicitly set the sh_entsize to 0 so that
+ consumers do not think that the section contains fixed
+ sized objects. */
+ elf_section_data (htab->root.splt->output_section)->this_hdr.sh_entsize = 0;
+
+ plt_got_2nd_ent = (htab->root.sgotplt->output_section->vma
+ + htab->root.sgotplt->output_offset
+ + GOT_ENTRY_SIZE * 2);
+
+ plt_base = htab->root.splt->output_section->vma +
+ htab->root.splt->output_offset;
+
+ /* First instruction in BTI enabled PLT stub is a BTI
+ instruction so skip it. */
+ bfd_byte *plt0_entry = htab->root.splt->contents;
+ if (elf_aarch64_tdata (output_bfd)->plt_type & PLT_BTI)
+ plt0_entry = plt0_entry + 4;
+
+ /* Fill in the top 21 bits for this: ADRP x16, PLT_GOT + n * 8.
+ ADRP: ((PG(S+A)-PG(P)) >> 12) & 0x1fffff */
+ elf_aarch64_update_plt_entry (output_bfd, BFD_RELOC_AARCH64_ADR_HI21_PCREL,
+ plt0_entry + 4,
+ PG (plt_got_2nd_ent) - PG (plt_base + 4));
+
+ elf_aarch64_update_plt_entry (output_bfd, BFD_RELOC_AARCH64_LDSTNN_LO12,
+ plt0_entry + 8,
+ PG_OFFSET (plt_got_2nd_ent));
+
+ elf_aarch64_update_plt_entry (output_bfd, BFD_RELOC_AARCH64_ADD_LO12,
+ plt0_entry + 12,
+ PG_OFFSET (plt_got_2nd_ent));
+}
+
+static bool
+elfNN_aarch64_finish_dynamic_sections (bfd *output_bfd,
+ struct bfd_link_info *info)
+{
+ struct elf_aarch64_link_hash_table *htab;
+ bfd *dynobj;
+ asection *sdyn;
+
+ htab = elf_aarch64_hash_table (info);
+ dynobj = htab->root.dynobj;
+ sdyn = bfd_get_linker_section (dynobj, ".dynamic");
+
+ if (htab->root.dynamic_sections_created)
+ {
+ ElfNN_External_Dyn *dyncon, *dynconend;
+
+ if (sdyn == NULL || htab->root.sgot == NULL)
+ abort ();
+
+ dyncon = (ElfNN_External_Dyn *) sdyn->contents;
+ dynconend = (ElfNN_External_Dyn *) (sdyn->contents + sdyn->size);
+ for (; dyncon < dynconend; dyncon++)
+ {
+ Elf_Internal_Dyn dyn;
+ asection *s;
+
+ bfd_elfNN_swap_dyn_in (dynobj, dyncon, &dyn);
+
+ switch (dyn.d_tag)
+ {
+ default:
+ continue;
+
+ case DT_PLTGOT:
+ s = htab->root.sgotplt;
+ dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
+ break;
+
+ case DT_JMPREL:
+ s = htab->root.srelplt;
+ dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
+ break;
+
+ case DT_PLTRELSZ:
+ s = htab->root.srelplt;
+ dyn.d_un.d_val = s->size;
+ break;
+
+ case DT_TLSDESC_PLT:
+ s = htab->root.splt;
+ dyn.d_un.d_ptr = s->output_section->vma + s->output_offset
+ + htab->root.tlsdesc_plt;
+ break;
+
+ case DT_TLSDESC_GOT:
+ s = htab->root.sgot;
+ BFD_ASSERT (htab->root.tlsdesc_got != (bfd_vma)-1);
+ dyn.d_un.d_ptr = s->output_section->vma + s->output_offset
+ + htab->root.tlsdesc_got;
+ break;
+ }
+
+ bfd_elfNN_swap_dyn_out (output_bfd, &dyn, dyncon);
+ }
+
+ }
+
+ /* Fill in the special first entry in the procedure linkage table. */
+ if (htab->root.splt && htab->root.splt->size > 0)
+ {
+ elfNN_aarch64_init_small_plt0_entry (output_bfd, htab);
+
+ if (htab->root.tlsdesc_plt && !(info->flags & DF_BIND_NOW))
+ {
+ BFD_ASSERT (htab->root.tlsdesc_got != (bfd_vma)-1);
+ bfd_put_NN (output_bfd, (bfd_vma) 0,
+ htab->root.sgot->contents + htab->root.tlsdesc_got);
+
+ const bfd_byte *entry = elfNN_aarch64_tlsdesc_small_plt_entry;
+ htab->tlsdesc_plt_entry_size = PLT_TLSDESC_ENTRY_SIZE;
+
+ aarch64_plt_type type = elf_aarch64_tdata (output_bfd)->plt_type;
+ if (type == PLT_BTI || type == PLT_BTI_PAC)
+ {
+ entry = elfNN_aarch64_tlsdesc_small_plt_bti_entry;
+ }
+
+ memcpy (htab->root.splt->contents + htab->root.tlsdesc_plt,
+ entry, htab->tlsdesc_plt_entry_size);
+
+ {
+ bfd_vma adrp1_addr =
+ htab->root.splt->output_section->vma
+ + htab->root.splt->output_offset
+ + htab->root.tlsdesc_plt + 4;
+
+ bfd_vma adrp2_addr = adrp1_addr + 4;
+
+ bfd_vma got_addr =
+ htab->root.sgot->output_section->vma
+ + htab->root.sgot->output_offset;
+
+ bfd_vma pltgot_addr =
+ htab->root.sgotplt->output_section->vma
+ + htab->root.sgotplt->output_offset;
+
+ bfd_vma dt_tlsdesc_got = got_addr + htab->root.tlsdesc_got;
+
+ bfd_byte *plt_entry =
+ htab->root.splt->contents + htab->root.tlsdesc_plt;
+
+ /* First instruction in BTI enabled PLT stub is a BTI
+ instruction so skip it. */
+ if (type & PLT_BTI)
+ {
+ plt_entry = plt_entry + 4;
+ adrp1_addr = adrp1_addr + 4;
+ adrp2_addr = adrp2_addr + 4;
+ }
+
+ /* adrp x2, DT_TLSDESC_GOT */
+ elf_aarch64_update_plt_entry (output_bfd,
+ BFD_RELOC_AARCH64_ADR_HI21_PCREL,
+ plt_entry + 4,
+ (PG (dt_tlsdesc_got)
+ - PG (adrp1_addr)));
+
+ /* adrp x3, 0 */
+ elf_aarch64_update_plt_entry (output_bfd,
+ BFD_RELOC_AARCH64_ADR_HI21_PCREL,
+ plt_entry + 8,
+ (PG (pltgot_addr)
+ - PG (adrp2_addr)));
+
+ /* ldr x2, [x2, #0] */
+ elf_aarch64_update_plt_entry (output_bfd,
+ BFD_RELOC_AARCH64_LDSTNN_LO12,
+ plt_entry + 12,
+ PG_OFFSET (dt_tlsdesc_got));
+
+ /* add x3, x3, 0 */
+ elf_aarch64_update_plt_entry (output_bfd,
+ BFD_RELOC_AARCH64_ADD_LO12,
+ plt_entry + 16,
+ PG_OFFSET (pltgot_addr));
+ }
+ }
+ }
+
+ if (htab->root.sgotplt)
+ {
+ if (bfd_is_abs_section (htab->root.sgotplt->output_section))
+ {
+ _bfd_error_handler
+ (_("discarded output section: `%pA'"), htab->root.sgotplt);
+ return false;
+ }
+
+ /* Fill in the first three entries in the global offset table. */
+ if (htab->root.sgotplt->size > 0)
+ {
+ bfd_put_NN (output_bfd, (bfd_vma) 0, htab->root.sgotplt->contents);
+
+ /* Write GOT[1] and GOT[2], needed for the dynamic linker. */
+ bfd_put_NN (output_bfd,
+ (bfd_vma) 0,
+ htab->root.sgotplt->contents + GOT_ENTRY_SIZE);
+ bfd_put_NN (output_bfd,
+ (bfd_vma) 0,
+ htab->root.sgotplt->contents + GOT_ENTRY_SIZE * 2);
+ }
+
+ if (htab->root.sgot)
+ {
+ if (htab->root.sgot->size > 0)
+ {
+ bfd_vma addr =
+ sdyn ? sdyn->output_section->vma + sdyn->output_offset : 0;
+ bfd_put_NN (output_bfd, addr, htab->root.sgot->contents);
+ }
+ }
+
+ elf_section_data (htab->root.sgotplt->output_section)->
+ this_hdr.sh_entsize = GOT_ENTRY_SIZE;
+ }
+
+ if (htab->root.sgot && htab->root.sgot->size > 0)
+ elf_section_data (htab->root.sgot->output_section)->this_hdr.sh_entsize
+ = GOT_ENTRY_SIZE;
+
+ /* Fill PLT and GOT entries for local STT_GNU_IFUNC symbols. */
+ htab_traverse (htab->loc_hash_table,
+ elfNN_aarch64_finish_local_dynamic_symbol,
+ info);
+
+ return true;
+}
+
+/* Check if BTI enabled PLTs are needed. Returns the type needed. */
+static aarch64_plt_type
+get_plt_type (bfd *abfd)
+{
+ aarch64_plt_type ret = PLT_NORMAL;
+ bfd_byte *contents, *extdyn, *extdynend;
+ asection *sec = bfd_get_section_by_name (abfd, ".dynamic");
+ if (!sec || !bfd_malloc_and_get_section (abfd, sec, &contents))
+ return ret;
+ extdyn = contents;
+ extdynend = contents + sec->size;
+ for (; extdyn < extdynend; extdyn += sizeof (ElfNN_External_Dyn))
+ {
+ Elf_Internal_Dyn dyn;
+ bfd_elfNN_swap_dyn_in (abfd, extdyn, &dyn);
+
+ /* Let's check the processor specific dynamic array tags. */
+ bfd_vma tag = dyn.d_tag;
+ if (tag < DT_LOPROC || tag > DT_HIPROC)
+ continue;
+
+ switch (tag)
+ {
+ case DT_AARCH64_BTI_PLT:
+ ret |= PLT_BTI;
+ break;
+
+ case DT_AARCH64_PAC_PLT:
+ ret |= PLT_PAC;
+ break;
+
+ default: break;
+ }
+ }
+ free (contents);
+ return ret;
+}
+
+static long
+elfNN_aarch64_get_synthetic_symtab (bfd *abfd,
+ long symcount,
+ asymbol **syms,
+ long dynsymcount,
+ asymbol **dynsyms,
+ asymbol **ret)
+{
+ elf_aarch64_tdata (abfd)->plt_type = get_plt_type (abfd);
+ return _bfd_elf_get_synthetic_symtab (abfd, symcount, syms,
+ dynsymcount, dynsyms, ret);
+}
+
+/* Return address for Ith PLT stub in section PLT, for relocation REL
+ or (bfd_vma) -1 if it should not be included. */
+
+static bfd_vma
+elfNN_aarch64_plt_sym_val (bfd_vma i, const asection *plt,
+ const arelent *rel ATTRIBUTE_UNUSED)
+{
+ size_t plt0_size = PLT_ENTRY_SIZE;
+ size_t pltn_size = PLT_SMALL_ENTRY_SIZE;
+
+ if (elf_aarch64_tdata (plt->owner)->plt_type == PLT_BTI_PAC)
+ {
+ if (elf_elfheader (plt->owner)->e_type == ET_EXEC)
+ pltn_size = PLT_BTI_PAC_SMALL_ENTRY_SIZE;
+ else
+ pltn_size = PLT_PAC_SMALL_ENTRY_SIZE;
+ }
+ else if (elf_aarch64_tdata (plt->owner)->plt_type == PLT_BTI)
+ {
+ if (elf_elfheader (plt->owner)->e_type == ET_EXEC)
+ pltn_size = PLT_BTI_SMALL_ENTRY_SIZE;
+ }
+ else if (elf_aarch64_tdata (plt->owner)->plt_type == PLT_PAC)
+ {
+ pltn_size = PLT_PAC_SMALL_ENTRY_SIZE;
+ }
+
+ return plt->vma + plt0_size + i * pltn_size;
+}
+
+/* Returns TRUE if NAME is an AArch64 mapping symbol.
+ The ARM ELF standard defines $x (for A64 code) and $d (for data).
+ It also allows a period initiated suffix to be added to the symbol, ie:
+ "$[adtx]\.[:sym_char]+". */
+
+static bool
+is_aarch64_mapping_symbol (const char * name)
+{
+ return name != NULL /* Paranoia. */
+ && name[0] == '$' /* Note: if objcopy --prefix-symbols has been used then
+ the mapping symbols could have acquired a prefix.
+ We do not support this here, since such symbols no
+ longer conform to the ARM ELF ABI. */
+ && (name[1] == 'd' || name[1] == 'x')
+ && (name[2] == 0 || name[2] == '.');
+ /* FIXME: Strictly speaking the symbol is only a valid mapping symbol if
+ any characters that follow the period are legal characters for the body
+ of a symbol's name. For now we just assume that this is the case. */
+}
+
+/* Make sure that mapping symbols in object files are not removed via the
+ "strip --strip-unneeded" tool. These symbols might needed in order to
+ correctly generate linked files. Once an object file has been linked,
+ it should be safe to remove them. */
+
+static void
+elfNN_aarch64_backend_symbol_processing (bfd *abfd, asymbol *sym)
+{
+ if (((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
+ && sym->section != bfd_abs_section_ptr
+ && is_aarch64_mapping_symbol (sym->name))
+ sym->flags |= BSF_KEEP;
+}
+
+/* Implement elf_backend_setup_gnu_properties for AArch64. It serves as a
+ wrapper function for _bfd_aarch64_elf_link_setup_gnu_properties to account
+ for the effect of GNU properties of the output_bfd. */
+static bfd *
+elfNN_aarch64_link_setup_gnu_properties (struct bfd_link_info *info)
+{
+ uint32_t prop = elf_aarch64_tdata (info->output_bfd)->gnu_and_prop;
+ bfd *pbfd = _bfd_aarch64_elf_link_setup_gnu_properties (info, &prop);
+ elf_aarch64_tdata (info->output_bfd)->gnu_and_prop = prop;
+ elf_aarch64_tdata (info->output_bfd)->plt_type
+ |= (prop & GNU_PROPERTY_AARCH64_FEATURE_1_BTI) ? PLT_BTI : 0;
+ setup_plt_values (info, elf_aarch64_tdata (info->output_bfd)->plt_type);
+ return pbfd;
+}
+
+/* Implement elf_backend_merge_gnu_properties for AArch64. It serves as a
+ wrapper function for _bfd_aarch64_elf_merge_gnu_properties to account
+ for the effect of GNU properties of the output_bfd. */
+static bool
+elfNN_aarch64_merge_gnu_properties (struct bfd_link_info *info,
+ bfd *abfd, bfd *bbfd,
+ elf_property *aprop,
+ elf_property *bprop)
+{
+ uint32_t prop
+ = elf_aarch64_tdata (info->output_bfd)->gnu_and_prop;
+
+ /* If output has been marked with BTI using command line argument, give out
+ warning if necessary. */
+ /* Properties are merged per type, hence only check for warnings when merging
+ GNU_PROPERTY_AARCH64_FEATURE_1_AND. */
+ if (((aprop && aprop->pr_type == GNU_PROPERTY_AARCH64_FEATURE_1_AND)
+ || (bprop && bprop->pr_type == GNU_PROPERTY_AARCH64_FEATURE_1_AND))
+ && (prop & GNU_PROPERTY_AARCH64_FEATURE_1_BTI)
+ && (!elf_aarch64_tdata (info->output_bfd)->no_bti_warn))
+ {
+ if ((aprop && !(aprop->u.number & GNU_PROPERTY_AARCH64_FEATURE_1_BTI))
+ || !aprop)
+ {
+ _bfd_error_handler (_("%pB: warning: BTI turned on by -z force-bti when "
+ "all inputs do not have BTI in NOTE section."),
+ abfd);
+ }
+ if ((bprop && !(bprop->u.number & GNU_PROPERTY_AARCH64_FEATURE_1_BTI))
+ || !bprop)
+ {
+ _bfd_error_handler (_("%pB: warning: BTI turned on by -z force-bti when "
+ "all inputs do not have BTI in NOTE section."),
+ bbfd);
+ }
+ }
+
+ return _bfd_aarch64_elf_merge_gnu_properties (info, abfd, aprop,
+ bprop, prop);
+}
+
+/* We use this so we can override certain functions
+ (though currently we don't). */
+
+const struct elf_size_info elfNN_aarch64_size_info =
+{
+ sizeof (ElfNN_External_Ehdr),
+ sizeof (ElfNN_External_Phdr),
+ sizeof (ElfNN_External_Shdr),
+ sizeof (ElfNN_External_Rel),
+ sizeof (ElfNN_External_Rela),
+ sizeof (ElfNN_External_Sym),
+ sizeof (ElfNN_External_Dyn),
+ sizeof (Elf_External_Note),
+ 4, /* Hash table entry size. */
+ 1, /* Internal relocs per external relocs. */
+ ARCH_SIZE, /* Arch size. */
+ LOG_FILE_ALIGN, /* Log_file_align. */
+ ELFCLASSNN, EV_CURRENT,
+ bfd_elfNN_write_out_phdrs,
+ bfd_elfNN_write_shdrs_and_ehdr,
+ bfd_elfNN_checksum_contents,
+ bfd_elfNN_write_relocs,
+ bfd_elfNN_swap_symbol_in,
+ bfd_elfNN_swap_symbol_out,
+ bfd_elfNN_slurp_reloc_table,
+ bfd_elfNN_slurp_symbol_table,
+ bfd_elfNN_swap_dyn_in,
+ bfd_elfNN_swap_dyn_out,
+ bfd_elfNN_swap_reloc_in,
+ bfd_elfNN_swap_reloc_out,
+ bfd_elfNN_swap_reloca_in,
+ bfd_elfNN_swap_reloca_out
+};
+
+#define ELF_ARCH bfd_arch_aarch64
+#define ELF_MACHINE_CODE EM_AARCH64
+#define ELF_MAXPAGESIZE 0x10000
+#define ELF_MINPAGESIZE 0x1000
+#define ELF_COMMONPAGESIZE 0x1000
+
+#define bfd_elfNN_close_and_cleanup \
+ elfNN_aarch64_close_and_cleanup
+
+#define bfd_elfNN_bfd_free_cached_info \
+ elfNN_aarch64_bfd_free_cached_info
+
+#define bfd_elfNN_bfd_is_target_special_symbol \
+ elfNN_aarch64_is_target_special_symbol
+
+#define bfd_elfNN_bfd_link_hash_table_create \
+ elfNN_aarch64_link_hash_table_create
+
+#define bfd_elfNN_bfd_merge_private_bfd_data \
+ elfNN_aarch64_merge_private_bfd_data
+
+#define bfd_elfNN_bfd_print_private_bfd_data \
+ elfNN_aarch64_print_private_bfd_data
+
+#define bfd_elfNN_bfd_reloc_type_lookup \
+ elfNN_aarch64_reloc_type_lookup
+
+#define bfd_elfNN_bfd_reloc_name_lookup \
+ elfNN_aarch64_reloc_name_lookup
+
+#define bfd_elfNN_bfd_set_private_flags \
+ elfNN_aarch64_set_private_flags
+
+#define bfd_elfNN_find_inliner_info \
+ elfNN_aarch64_find_inliner_info
+
+#define bfd_elfNN_get_synthetic_symtab \
+ elfNN_aarch64_get_synthetic_symtab
+
+#define bfd_elfNN_mkobject \
+ elfNN_aarch64_mkobject
+
+#define bfd_elfNN_new_section_hook \
+ elfNN_aarch64_new_section_hook
+
+#define elf_backend_adjust_dynamic_symbol \
+ elfNN_aarch64_adjust_dynamic_symbol
+
+#define elf_backend_always_size_sections \
+ elfNN_aarch64_always_size_sections
+
+#define elf_backend_check_relocs \
+ elfNN_aarch64_check_relocs
+
+#define elf_backend_copy_indirect_symbol \
+ elfNN_aarch64_copy_indirect_symbol
+
+#define elf_backend_merge_symbol_attribute \
+ elfNN_aarch64_merge_symbol_attribute
+
+/* Create .dynbss, and .rela.bss sections in DYNOBJ, and set up shortcuts
+ to them in our hash. */
+#define elf_backend_create_dynamic_sections \
+ elfNN_aarch64_create_dynamic_sections
+
+#define elf_backend_init_index_section \
+ _bfd_elf_init_2_index_sections
+
+#define elf_backend_finish_dynamic_sections \
+ elfNN_aarch64_finish_dynamic_sections
+
+#define elf_backend_finish_dynamic_symbol \
+ elfNN_aarch64_finish_dynamic_symbol
+
+#define elf_backend_object_p \
+ elfNN_aarch64_object_p
+
+#define elf_backend_output_arch_local_syms \
+ elfNN_aarch64_output_arch_local_syms
+
+#define elf_backend_maybe_function_sym \
+ elfNN_aarch64_maybe_function_sym
+
+#define elf_backend_plt_sym_val \
+ elfNN_aarch64_plt_sym_val
+
+#define elf_backend_init_file_header \
+ elfNN_aarch64_init_file_header
+
+#define elf_backend_relocate_section \
+ elfNN_aarch64_relocate_section
+
+#define elf_backend_reloc_type_class \
+ elfNN_aarch64_reloc_type_class
+
+#define elf_backend_section_from_shdr \
+ elfNN_aarch64_section_from_shdr
+
+#define elf_backend_size_dynamic_sections \
+ elfNN_aarch64_size_dynamic_sections
+
+#define elf_backend_size_info \
+ elfNN_aarch64_size_info
+
+#define elf_backend_write_section \
+ elfNN_aarch64_write_section
+
+#define elf_backend_symbol_processing \
+ elfNN_aarch64_backend_symbol_processing
+
+#define elf_backend_setup_gnu_properties \
+ elfNN_aarch64_link_setup_gnu_properties
+
+#define elf_backend_merge_gnu_properties \
+ elfNN_aarch64_merge_gnu_properties
+
+#define elf_backend_can_refcount 1
+#define elf_backend_can_gc_sections 1
+#define elf_backend_plt_readonly 1
+#define elf_backend_want_got_plt 1
+#define elf_backend_want_plt_sym 0
+#define elf_backend_want_dynrelro 1
+#define elf_backend_may_use_rel_p 0
+#define elf_backend_may_use_rela_p 1
+#define elf_backend_default_use_rela_p 1
+#define elf_backend_rela_normal 1
+#define elf_backend_dtrel_excludes_plt 1
+#define elf_backend_got_header_size (GOT_ENTRY_SIZE * 3)
+#define elf_backend_default_execstack 0
+#define elf_backend_extern_protected_data 1
+#define elf_backend_hash_symbol elf_aarch64_hash_symbol
+
+#undef elf_backend_obj_attrs_section
+#define elf_backend_obj_attrs_section ".ARM.attributes"
+
+#include "elfNN-target.h"
+
+/* CloudABI support. */
+
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM aarch64_elfNN_le_cloudabi_vec
+#undef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "elfNN-littleaarch64-cloudabi"
+#undef TARGET_BIG_SYM
+#define TARGET_BIG_SYM aarch64_elfNN_be_cloudabi_vec
+#undef TARGET_BIG_NAME
+#define TARGET_BIG_NAME "elfNN-bigaarch64-cloudabi"
+
+#undef ELF_OSABI
+#define ELF_OSABI ELFOSABI_CLOUDABI
+
+#undef elfNN_bed
+#define elfNN_bed elfNN_aarch64_cloudabi_bed
+
+#include "elfNN-target.h"
Index: toolchains-1.7.2/sources/GNU/binutils/create-2.37-aarch64-ifunc-patch/create.patch.sh
===================================================================
--- toolchains-1.7.2/sources/GNU/binutils/create-2.37-aarch64-ifunc-patch/create.patch.sh (nonexistent)
+++ toolchains-1.7.2/sources/GNU/binutils/create-2.37-aarch64-ifunc-patch/create.patch.sh (revision 348)
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+VERSION=2.37
+
+tar --files-from=file.list -xJvf ../binutils-$VERSION.tar.xz
+mv binutils-$VERSION binutils-$VERSION-orig
+
+cp -rf ./binutils-$VERSION-new ./binutils-$VERSION
+
+diff -b --unified -Nr binutils-$VERSION-orig binutils-$VERSION > binutils-$VERSION-aarch64-ifunc.patch
+
+mv binutils-$VERSION-aarch64-ifunc.patch ../patches
+
+rm -rf ./binutils-$VERSION
+rm -rf ./binutils-$VERSION-orig
Property changes on: toolchains-1.7.2/sources/GNU/binutils/create-2.37-aarch64-ifunc-patch/create.patch.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: toolchains-1.7.2/sources/GNU/binutils/create-2.37-aarch64-ifunc-patch/file.list
===================================================================
--- toolchains-1.7.2/sources/GNU/binutils/create-2.37-aarch64-ifunc-patch/file.list (nonexistent)
+++ toolchains-1.7.2/sources/GNU/binutils/create-2.37-aarch64-ifunc-patch/file.list (revision 348)
@@ -0,0 +1 @@
+binutils-2.37/bfd/elfnn-aarch64.c
Index: toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/bfd/plugin.c
===================================================================
--- toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/bfd/plugin.c (nonexistent)
+++ toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/bfd/plugin.c (revision 348)
@@ -0,0 +1,848 @@
+/* Plugin support for BFD.
+ Copyright (C) 2009-2021 Free Software Foundation, Inc.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+#include "sysdep.h"
+#include "bfd.h"
+
+#if BFD_SUPPORTS_PLUGINS
+
+#include <assert.h>
+#ifdef HAVE_DLFCN_H
+#include <dlfcn.h>
+#elif defined (HAVE_WINDOWS_H)
+#include <windows.h>
+#else
+#error Unknown how to handle dynamic-load-libraries.
+#endif
+#include <stdarg.h>
+#include "plugin-api.h"
+#include "plugin.h"
+#include "libbfd.h"
+#include "libiberty.h"
+#include <dirent.h>
+
+#if !defined (HAVE_DLFCN_H) && defined (HAVE_WINDOWS_H)
+
+#define RTLD_NOW 0 /* Dummy value. */
+
+static void *
+dlopen (const char *file, int mode ATTRIBUTE_UNUSED)
+{
+ return LoadLibrary (file);
+}
+
+static void *
+dlsym (void *handle, const char *name)
+{
+ return GetProcAddress (handle, name);
+}
+
+static int ATTRIBUTE_UNUSED
+dlclose (void *handle)
+{
+ FreeLibrary (handle);
+ return 0;
+}
+
+static const char *
+dlerror (void)
+{
+ return "Unable to load DLL.";
+}
+
+#endif /* !defined (HAVE_DLFCN_H) && defined (HAVE_WINDOWS_H) */
+
+#define bfd_plugin_close_and_cleanup _bfd_generic_close_and_cleanup
+#define bfd_plugin_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
+#define bfd_plugin_new_section_hook _bfd_generic_new_section_hook
+#define bfd_plugin_get_section_contents _bfd_generic_get_section_contents
+#define bfd_plugin_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
+#define bfd_plugin_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
+#define bfd_plugin_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
+#define bfd_plugin_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
+#define bfd_plugin_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
+#define bfd_plugin_core_file_matches_executable_p generic_core_file_matches_executable_p
+#define bfd_plugin_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name
+#define bfd_plugin_bfd_is_target_special_symbol _bfd_bool_bfd_asymbol_false
+#define bfd_plugin_get_lineno _bfd_nosymbols_get_lineno
+#define bfd_plugin_find_nearest_line _bfd_nosymbols_find_nearest_line
+#define bfd_plugin_find_line _bfd_nosymbols_find_line
+#define bfd_plugin_find_inliner_info _bfd_nosymbols_find_inliner_info
+#define bfd_plugin_get_symbol_version_string _bfd_nosymbols_get_symbol_version_string
+#define bfd_plugin_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
+#define bfd_plugin_read_minisymbols _bfd_generic_read_minisymbols
+#define bfd_plugin_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
+#define bfd_plugin_set_arch_mach bfd_default_set_arch_mach
+#define bfd_plugin_set_section_contents _bfd_generic_set_section_contents
+#define bfd_plugin_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
+#define bfd_plugin_bfd_relax_section bfd_generic_relax_section
+#define bfd_plugin_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
+#define bfd_plugin_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define bfd_plugin_bfd_link_just_syms _bfd_generic_link_just_syms
+#define bfd_plugin_bfd_final_link _bfd_generic_final_link
+#define bfd_plugin_bfd_link_split_section _bfd_generic_link_split_section
+#define bfd_plugin_bfd_gc_sections bfd_generic_gc_sections
+#define bfd_plugin_bfd_lookup_section_flags bfd_generic_lookup_section_flags
+#define bfd_plugin_bfd_merge_sections bfd_generic_merge_sections
+#define bfd_plugin_bfd_is_group_section bfd_generic_is_group_section
+#define bfd_plugin_bfd_group_name bfd_generic_group_name
+#define bfd_plugin_bfd_discard_group bfd_generic_discard_group
+#define bfd_plugin_section_already_linked _bfd_generic_section_already_linked
+#define bfd_plugin_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define bfd_plugin_bfd_link_hide_symbol _bfd_generic_link_hide_symbol
+#define bfd_plugin_bfd_define_start_stop bfd_generic_define_start_stop
+#define bfd_plugin_bfd_copy_link_hash_symbol_type _bfd_generic_copy_link_hash_symbol_type
+#define bfd_plugin_bfd_link_check_relocs _bfd_generic_link_check_relocs
+
+static enum ld_plugin_status
+message (int level ATTRIBUTE_UNUSED,
+ const char * format, ...)
+{
+ va_list args;
+ va_start (args, format);
+ printf ("bfd plugin: ");
+ vprintf (format, args);
+ putchar ('\n');
+ va_end (args);
+ return LDPS_OK;
+}
+
+struct plugin_list_entry
+{
+ /* These must be initialized for each IR object with LTO wrapper. */
+ ld_plugin_claim_file_handler claim_file;
+ ld_plugin_all_symbols_read_handler all_symbols_read;
+ ld_plugin_all_symbols_read_handler cleanup_handler;
+ bool has_symbol_type;
+
+ struct plugin_list_entry *next;
+
+ /* These can be reused for all IR objects. */
+ const char *plugin_name;
+};
+
+static const char *plugin_program_name;
+
+void
+bfd_plugin_set_program_name (const char *program_name)
+{
+ plugin_program_name = program_name;
+}
+
+static struct plugin_list_entry *plugin_list = NULL;
+static struct plugin_list_entry *current_plugin = NULL;
+
+/* Register a claim-file handler. */
+
+static enum ld_plugin_status
+register_claim_file (ld_plugin_claim_file_handler handler)
+{
+ current_plugin->claim_file = handler;
+ return LDPS_OK;
+}
+
+static enum ld_plugin_status
+add_symbols (void * handle,
+ int nsyms,
+ const struct ld_plugin_symbol * syms)
+{
+ bfd *abfd = handle;
+ struct plugin_data_struct *plugin_data =
+ bfd_alloc (abfd, sizeof (plugin_data_struct));
+
+ if (!plugin_data)
+ return LDPS_ERR;
+
+ plugin_data->nsyms = nsyms;
+ plugin_data->syms = syms;
+
+ if (nsyms != 0)
+ abfd->flags |= HAS_SYMS;
+
+ abfd->tdata.plugin_data = plugin_data;
+ return LDPS_OK;
+}
+
+static enum ld_plugin_status
+add_symbols_v2 (void *handle, int nsyms,
+ const struct ld_plugin_symbol *syms)
+{
+ current_plugin->has_symbol_type = true;
+ return add_symbols (handle, nsyms, syms);
+}
+
+int
+bfd_plugin_open_input (bfd *ibfd, struct ld_plugin_input_file *file)
+{
+ bfd *iobfd;
+ int fd;
+
+ iobfd = ibfd;
+ while (iobfd->my_archive
+ && !bfd_is_thin_archive (iobfd->my_archive))
+ iobfd = iobfd->my_archive;
+ file->name = bfd_get_filename (iobfd);
+
+ if (!iobfd->iostream && !bfd_open_file (iobfd))
+ return 0;
+
+ /* Reuse the archive plugin file descriptor. */
+ if (iobfd != ibfd)
+ fd = iobfd->archive_plugin_fd;
+ else
+ fd = -1;
+
+ if (fd < 0)
+ {
+ /* The plugin API expects that the file descriptor won't be closed
+ and reused as done by the bfd file cache. So open it again.
+ dup isn't good enough. plugin IO uses lseek/read while BFD uses
+ fseek/fread. It isn't wise to mix the unistd and stdio calls on
+ the same underlying file descriptor. */
+ fd = open (file->name, O_RDONLY | O_BINARY);
+ if (fd < 0)
+ {
+#ifndef EMFILE
+ return 0;
+#else
+ if (errno != EMFILE)
+ return 0;
+
+#ifdef HAVE_GETRLIMIT
+ struct rlimit lim;
+
+ /* Complicated links involving lots of files and/or large
+ archives can exhaust the number of file descriptors
+ available to us. If possible, try to allocate more
+ descriptors. */
+ if (getrlimit (RLIMIT_NOFILE, & lim) == 0
+ && lim.rlim_cur < lim.rlim_max)
+ {
+ lim.rlim_cur = lim.rlim_max;
+ if (setrlimit (RLIMIT_NOFILE, &lim) == 0)
+ fd = open (file->name, O_RDONLY | O_BINARY);
+ }
+
+ if (fd < 0)
+#endif
+ {
+ _bfd_error_handler (_("plugin framework: out of file descriptors. Try using fewer objects/archives\n"));
+ return 0;
+ }
+#endif
+ }
+ }
+
+ if (iobfd == ibfd)
+ {
+ struct stat stat_buf;
+
+ if (fstat (fd, &stat_buf))
+ {
+ close (fd);
+ return 0;
+ }
+
+ file->offset = 0;
+ file->filesize = stat_buf.st_size;
+ }
+ else
+ {
+ /* Cache the archive plugin file descriptor. */
+ iobfd->archive_plugin_fd = fd;
+ iobfd->archive_plugin_fd_open_count++;
+
+ file->offset = ibfd->origin;
+ file->filesize = arelt_size (ibfd);
+ }
+
+ file->fd = fd;
+ return 1;
+}
+
+/* Close the plugin file descriptor FD. If ABFD isn't NULL, it is an
+ archive member. */
+
+void
+bfd_plugin_close_file_descriptor (bfd *abfd, int fd)
+{
+ if (abfd == NULL)
+ close (fd);
+ else
+ {
+ while (abfd->my_archive
+ && !bfd_is_thin_archive (abfd->my_archive))
+ abfd = abfd->my_archive;
+
+ /* Close the file descriptor if there is no archive plugin file
+ descriptor. */
+ if (abfd->archive_plugin_fd == -1)
+ {
+ close (fd);
+ return;
+ }
+
+ abfd->archive_plugin_fd_open_count--;
+ /* Dup the archive plugin file descriptor for later use, which
+ will be closed by _bfd_archive_close_and_cleanup. */
+ if (abfd->archive_plugin_fd_open_count == 0)
+ {
+ abfd->archive_plugin_fd = dup (fd);
+ close (fd);
+ }
+ }
+}
+
+static int
+try_claim (bfd *abfd)
+{
+ int claimed = 0;
+ struct ld_plugin_input_file file;
+
+ file.handle = abfd;
+ if (bfd_plugin_open_input (abfd, &file)
+ && current_plugin->claim_file)
+ {
+ current_plugin->claim_file (&file, &claimed);
+ bfd_plugin_close_file_descriptor ((abfd->my_archive != NULL
+ ? abfd : NULL),
+ file.fd);
+ }
+
+ return claimed;
+}
+
+static bool
+try_load_plugin (const char *pname,
+ struct plugin_list_entry *plugin_list_iter,
+ bfd *abfd,
+ bool build_list_p)
+{
+ void *plugin_handle;
+ struct ld_plugin_tv tv[5];
+ int i;
+ ld_plugin_onload onload;
+ enum ld_plugin_status status;
+ bool result = false;
+
+ /* NB: Each object is independent. Reuse the previous plugin from
+ the last run will lead to wrong result. */
+ if (current_plugin)
+ memset (current_plugin, 0,
+ offsetof (struct plugin_list_entry, next));
+
+ if (plugin_list_iter)
+ pname = plugin_list_iter->plugin_name;
+
+ plugin_handle = dlopen (pname, RTLD_NOW);
+ if (!plugin_handle)
+ {
+ /* If we are building a list of viable plugins, then
+ we do not bother the user with the details of any
+ plugins that cannot be loaded. */
+ if (! build_list_p)
+ _bfd_error_handler ("Failed to load plugin '%s', reason: %s\n",
+ pname, dlerror ());
+ return false;
+ }
+
+ if (plugin_list_iter == NULL)
+ {
+ size_t length_plugin_name = strlen (pname) + 1;
+ char *plugin_name = bfd_malloc (length_plugin_name);
+
+ if (plugin_name == NULL)
+ goto short_circuit;
+ plugin_list_iter = bfd_malloc (sizeof *plugin_list_iter);
+ if (plugin_list_iter == NULL)
+ {
+ free (plugin_name);
+ goto short_circuit;
+ }
+ /* Make a copy of PNAME since PNAME from load_plugin () will be
+ freed. */
+ memcpy (plugin_name, pname, length_plugin_name);
+ memset (plugin_list_iter, 0, sizeof (*plugin_list_iter));
+ plugin_list_iter->plugin_name = plugin_name;
+ plugin_list_iter->next = plugin_list;
+ plugin_list = plugin_list_iter;
+ }
+
+ current_plugin = plugin_list_iter;
+ if (build_list_p)
+ goto short_circuit;
+
+ onload = dlsym (plugin_handle, "onload");
+ if (!onload)
+ goto short_circuit;
+
+ i = 0;
+ tv[i].tv_tag = LDPT_MESSAGE;
+ tv[i].tv_u.tv_message = message;
+
+ ++i;
+ tv[i].tv_tag = LDPT_REGISTER_CLAIM_FILE_HOOK;
+ tv[i].tv_u.tv_register_claim_file = register_claim_file;
+
+ ++i;
+ tv[i].tv_tag = LDPT_ADD_SYMBOLS;
+ tv[i].tv_u.tv_add_symbols = add_symbols;
+
+ ++i;
+ tv[i].tv_tag = LDPT_ADD_SYMBOLS_V2;
+ tv[i].tv_u.tv_add_symbols = add_symbols_v2;
+
+ ++i;
+ tv[i].tv_tag = LDPT_NULL;
+ tv[i].tv_u.tv_val = 0;
+
+ /* LTO plugin will call handler hooks to set up plugin handlers. */
+ status = (*onload)(tv);
+
+ if (status != LDPS_OK)
+ goto short_circuit;
+
+ abfd->plugin_format = bfd_plugin_no;
+
+ if (!current_plugin->claim_file)
+ goto short_circuit;
+
+ if (!try_claim (abfd))
+ goto short_circuit;
+
+ abfd->plugin_format = bfd_plugin_yes;
+ result = true;
+
+ short_circuit:
+ dlclose (plugin_handle);
+ return result;
+}
+
+/* There may be plugin libraries in lib/bfd-plugins. */
+static int has_plugin_list = -1;
+
+static bfd_cleanup (*ld_plugin_object_p) (bfd *);
+
+static const char *plugin_name;
+
+void
+bfd_plugin_set_plugin (const char *p)
+{
+ plugin_name = p;
+}
+
+/* Return TRUE if a plugin library is used. */
+
+bool
+bfd_plugin_specified_p (void)
+{
+ return plugin_list != NULL;
+}
+
+/* Return TRUE if ABFD can be claimed by linker LTO plugin. */
+
+bool
+bfd_link_plugin_object_p (bfd *abfd)
+{
+ if (ld_plugin_object_p)
+ return ld_plugin_object_p (abfd) != NULL;
+ return false;
+}
+
+extern const bfd_target plugin_vec;
+
+/* Return TRUE if TARGET is a pointer to plugin_vec. */
+
+bool
+bfd_plugin_target_p (const bfd_target *target)
+{
+ return target == &plugin_vec;
+}
+
+/* Register OBJECT_P to be used by bfd_plugin_object_p. */
+
+void
+register_ld_plugin_object_p (bfd_cleanup (*object_p) (bfd *))
+{
+ ld_plugin_object_p = object_p;
+}
+
+static void
+build_plugin_list (bfd *abfd)
+{
+ /* The intent was to search ${libdir}/bfd-plugins for plugins, but
+ unfortunately the original implementation wasn't precisely that
+ when configuring binutils using --libdir. Search in the proper
+ path first, then the old one for backwards compatibility. */
+ static const char *path[]
+ = { LIBDIR "/bfd-plugins", BINDIR "/../lib/bfd-plugins" };
+ struct stat last_st;
+ unsigned int i;
+
+ if (has_plugin_list >= 0)
+ return;
+
+ /* Try not to search the same dir twice, by looking at st_dev and
+ st_ino for the dir. If we are on a file system that always sets
+ st_ino to zero or the actual st_ino is zero we might waste some
+ time, but that doesn't matter too much. */
+ last_st.st_dev = 0;
+ last_st.st_ino = 0;
+ for (i = 0; i < sizeof (path) / sizeof (path[0]); i++)
+ {
+ char *plugin_dir = make_relative_prefix (plugin_program_name,
+ BINDIR,
+ path[i]);
+ if (plugin_dir)
+ {
+ struct stat st;
+ DIR *d;
+
+ if (stat (plugin_dir, &st) == 0
+ && S_ISDIR (st.st_mode)
+ && !(last_st.st_dev == st.st_dev
+ && last_st.st_ino == st.st_ino
+ && st.st_ino != 0)
+ && (d = opendir (plugin_dir)) != NULL)
+ {
+ struct dirent *ent;
+
+ last_st.st_dev = st.st_dev;
+ last_st.st_ino = st.st_ino;
+ while ((ent = readdir (d)) != NULL)
+ {
+ char *full_name;
+
+ full_name = concat (plugin_dir, "/", ent->d_name, NULL);
+ if (stat (full_name, &st) == 0 && S_ISREG (st.st_mode))
+ (void) try_load_plugin (full_name, NULL, abfd, true);
+ free (full_name);
+ }
+ closedir (d);
+ }
+ free (plugin_dir);
+ }
+ }
+
+ has_plugin_list = plugin_list != NULL;
+}
+
+static bool
+load_plugin (bfd *abfd)
+{
+ struct plugin_list_entry *plugin_list_iter;
+
+ if (plugin_name)
+ return try_load_plugin (plugin_name, plugin_list, abfd, false);
+
+ if (plugin_program_name == NULL)
+ return false;
+
+ build_plugin_list (abfd);
+
+ for (plugin_list_iter = plugin_list;
+ plugin_list_iter;
+ plugin_list_iter = plugin_list_iter->next)
+ if (try_load_plugin (NULL, plugin_list_iter, abfd, false))
+ return true;
+
+ return false;
+}
+
+
+static bfd_cleanup
+bfd_plugin_object_p (bfd *abfd)
+{
+ if (ld_plugin_object_p)
+ return ld_plugin_object_p (abfd);
+
+ if (abfd->plugin_format == bfd_plugin_unknown && !load_plugin (abfd))
+ return NULL;
+
+ return abfd->plugin_format == bfd_plugin_yes ? _bfd_no_cleanup : NULL;
+}
+
+/* Copy any private info we understand from the input bfd
+ to the output bfd. */
+
+static bool
+bfd_plugin_bfd_copy_private_bfd_data (bfd *ibfd ATTRIBUTE_UNUSED,
+ bfd *obfd ATTRIBUTE_UNUSED)
+{
+ BFD_ASSERT (0);
+ return true;
+}
+
+/* Copy any private info we understand from the input section
+ to the output section. */
+
+static bool
+bfd_plugin_bfd_copy_private_section_data (bfd *ibfd ATTRIBUTE_UNUSED,
+ asection *isection ATTRIBUTE_UNUSED,
+ bfd *obfd ATTRIBUTE_UNUSED,
+ asection *osection ATTRIBUTE_UNUSED)
+{
+ BFD_ASSERT (0);
+ return true;
+}
+
+/* Copy any private info we understand from the input symbol
+ to the output symbol. */
+
+static bool
+bfd_plugin_bfd_copy_private_symbol_data (bfd *ibfd ATTRIBUTE_UNUSED,
+ asymbol *isymbol ATTRIBUTE_UNUSED,
+ bfd *obfd ATTRIBUTE_UNUSED,
+ asymbol *osymbol ATTRIBUTE_UNUSED)
+{
+ BFD_ASSERT (0);
+ return true;
+}
+
+static bool
+bfd_plugin_bfd_print_private_bfd_data (bfd *abfd ATTRIBUTE_UNUSED, PTR ptr ATTRIBUTE_UNUSED)
+{
+ BFD_ASSERT (0);
+ return true;
+}
+
+static char *
+bfd_plugin_core_file_failing_command (bfd *abfd ATTRIBUTE_UNUSED)
+{
+ BFD_ASSERT (0);
+ return NULL;
+}
+
+static int
+bfd_plugin_core_file_failing_signal (bfd *abfd ATTRIBUTE_UNUSED)
+{
+ BFD_ASSERT (0);
+ return 0;
+}
+
+static int
+bfd_plugin_core_file_pid (bfd *abfd ATTRIBUTE_UNUSED)
+{
+ BFD_ASSERT (0);
+ return 0;
+}
+
+static long
+bfd_plugin_get_symtab_upper_bound (bfd *abfd)
+{
+ struct plugin_data_struct *plugin_data = abfd->tdata.plugin_data;
+ long nsyms = plugin_data->nsyms;
+
+ BFD_ASSERT (nsyms >= 0);
+
+ return ((nsyms + 1) * sizeof (asymbol *));
+}
+
+static flagword
+convert_flags (const struct ld_plugin_symbol *sym)
+{
+ switch (sym->def)
+ {
+ case LDPK_DEF:
+ case LDPK_COMMON:
+ case LDPK_UNDEF:
+ return BSF_GLOBAL;
+
+ case LDPK_WEAKUNDEF:
+ case LDPK_WEAKDEF:
+ return BSF_GLOBAL | BSF_WEAK;
+
+ default:
+ BFD_ASSERT (0);
+ return 0;
+ }
+}
+
+static long
+bfd_plugin_canonicalize_symtab (bfd *abfd,
+ asymbol **alocation)
+{
+ struct plugin_data_struct *plugin_data = abfd->tdata.plugin_data;
+ long nsyms = plugin_data->nsyms;
+ const struct ld_plugin_symbol *syms = plugin_data->syms;
+ static asection fake_text_section
+ = BFD_FAKE_SECTION (fake_text_section, NULL, "plug", 0,
+ SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS);
+ static asection fake_data_section
+ = BFD_FAKE_SECTION (fake_data_section, NULL, "plug", 0,
+ SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS);
+ static asection fake_bss_section
+ = BFD_FAKE_SECTION (fake_bss_section, NULL, "plug", 0,
+ SEC_ALLOC);
+ static asection fake_common_section
+ = BFD_FAKE_SECTION (fake_common_section, NULL, "plug", 0, SEC_IS_COMMON);
+ int i;
+
+ for (i = 0; i < nsyms; i++)
+ {
+ asymbol *s = bfd_alloc (abfd, sizeof (asymbol));
+
+ BFD_ASSERT (s);
+ alocation[i] = s;
+
+ s->the_bfd = abfd;
+ s->name = syms[i].name;
+ s->value = 0;
+ s->flags = convert_flags (&syms[i]);
+ switch (syms[i].def)
+ {
+ case LDPK_COMMON:
+ s->section = &fake_common_section;
+ break;
+ case LDPK_UNDEF:
+ case LDPK_WEAKUNDEF:
+ s->section = bfd_und_section_ptr;
+ break;
+ case LDPK_DEF:
+ case LDPK_WEAKDEF:
+ if (current_plugin->has_symbol_type)
+ switch (syms[i].symbol_type)
+ {
+ default:
+ /* FIXME: Should we issue an error here ? */
+ case LDST_UNKNOWN:
+ /* What is the best fake section for LDST_UNKNOWN? */
+ case LDST_FUNCTION:
+ s->section = &fake_text_section;
+ break;
+ case LDST_VARIABLE:
+ if (syms[i].section_kind == LDSSK_BSS)
+ s->section = &fake_bss_section;
+ else
+ s->section = &fake_data_section;
+ break;
+ }
+ else
+ s->section = &fake_text_section;
+ break;
+ default:
+ BFD_ASSERT (0);
+ }
+
+ s->udata.p = (void *) &syms[i];
+ }
+
+ return nsyms;
+}
+
+static void
+bfd_plugin_print_symbol (bfd *abfd ATTRIBUTE_UNUSED,
+ PTR afile ATTRIBUTE_UNUSED,
+ asymbol *symbol ATTRIBUTE_UNUSED,
+ bfd_print_symbol_type how ATTRIBUTE_UNUSED)
+{
+ BFD_ASSERT (0);
+}
+
+static void
+bfd_plugin_get_symbol_info (bfd *abfd ATTRIBUTE_UNUSED,
+ asymbol *symbol,
+ symbol_info *ret)
+{
+ bfd_symbol_info (symbol, ret);
+}
+
+/* Make an empty symbol. */
+
+static asymbol *
+bfd_plugin_make_empty_symbol (bfd *abfd)
+{
+ asymbol *new_symbol = bfd_zalloc (abfd, sizeof (asymbol));
+ if (new_symbol == NULL)
+ return new_symbol;
+ new_symbol->the_bfd = abfd;
+ return new_symbol;
+}
+
+static int
+bfd_plugin_sizeof_headers (bfd *a ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
+{
+ BFD_ASSERT (0);
+ return 0;
+}
+
+const bfd_target plugin_vec =
+{
+ "plugin", /* Name. */
+ bfd_target_unknown_flavour,
+ BFD_ENDIAN_LITTLE, /* Target byte order. */
+ BFD_ENDIAN_LITTLE, /* Target headers byte order. */
+ (HAS_RELOC | EXEC_P | /* Object flags. */
+ HAS_LINENO | HAS_DEBUG |
+ HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
+ (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS
+ | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */
+ 0, /* symbol_leading_char. */
+ '/', /* ar_pad_char. */
+ 15, /* ar_max_namelen. */
+ 255, /* match priority. */
+ TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols. */
+
+ bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+ bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
+ bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+ bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
+
+ { /* bfd_check_format. */
+ _bfd_dummy_target,
+ bfd_plugin_object_p,
+ bfd_generic_archive_p,
+ _bfd_dummy_target
+ },
+ { /* bfd_set_format. */
+ _bfd_bool_bfd_false_error,
+ _bfd_bool_bfd_false_error,
+ _bfd_generic_mkarchive,
+ _bfd_bool_bfd_false_error,
+ },
+ { /* bfd_write_contents. */
+ _bfd_bool_bfd_false_error,
+ _bfd_bool_bfd_false_error,
+ _bfd_write_archive_contents,
+ _bfd_bool_bfd_false_error,
+ },
+
+ BFD_JUMP_TABLE_GENERIC (bfd_plugin),
+ BFD_JUMP_TABLE_COPY (bfd_plugin),
+ BFD_JUMP_TABLE_CORE (bfd_plugin),
+#ifdef USE_64_BIT_ARCHIVE
+ BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_64_bit),
+#else
+ BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
+#endif
+ BFD_JUMP_TABLE_SYMBOLS (bfd_plugin),
+ BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
+ BFD_JUMP_TABLE_WRITE (bfd_plugin),
+ BFD_JUMP_TABLE_LINK (bfd_plugin),
+ BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+
+ NULL,
+
+ NULL /* backend_data. */
+};
+#endif /* BFD_SUPPORTS_PLUGINS */
Index: toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/ld/testsuite/ld-plugin/lto.exp
===================================================================
--- toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/ld/testsuite/ld-plugin/lto.exp (nonexistent)
+++ toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/ld/testsuite/ld-plugin/lto.exp (revision 348)
@@ -0,0 +1,967 @@
+# Expect script for ld-plugin LTO tests
+# Copyright (C) 2011-2021 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+# Check to see if the C and C++ compilers work
+if { ![check_compiler_available] || [which $CXX] == 0 } {
+ return
+}
+
+# These tests require plugin and LTO.
+if { ![check_plugin_api_available]
+ || ![check_lto_available] } {
+ return
+}
+
+set saved_CFLAGS "$CFLAGS"
+set saved_CXXFLAGS "$CXXFLAGS"
+regsub -all "(\\-Wp,)?-D_FORTIFY_SOURCE=\[0-9\]+" $CFLAGS "" CFLAGS
+regsub -all "(\\-Wp,)?-D_FORTIFY_SOURCE=\[0-9\]+" $CXXFLAGS "" CXXFLAGS
+
+proc restore_notify { } {
+ global saved_CFLAGS
+ global saved_CXXFLAGS
+ set CFLAGS "$saved_CFLAGS"
+ set CXXFLAGS "$saved_CXXFLAGS"
+}
+
+set lto_fat ""
+set lto_no_fat ""
+if { [check_lto_fat_available] } {
+ set lto_fat "-ffat-lto-objects"
+ set lto_no_fat "-fno-fat-lto-objects"
+ set no_lto "-fno-lto"
+}
+
+# Simple LTO tests and generate input files for complex LTO tests.
+set lto_link_tests [list \
+ [list "LTO 1" \
+ "-O2 -flto -fuse-linker-plugin" "-flto -fuse-linker-plugin" \
+ {lto-1a.c lto-1b.c} {} "lto-1.exe"] \
+ [list "Compile 2" \
+ "" "-O2 -flto -fuse-linker-plugin $NOSANITIZE_CFLAGS" \
+ {lto-2.c} {} ""] \
+ [list "LTO 2" \
+ "-static -O2 -flto -fuse-linker-plugin tmpdir/lto-2.o -lm" \
+ "$NOSANITIZE_CFLAGS" \
+ {dummy.c} {} "lto-2.exe"] \
+ [list "Compile 3a" \
+ "" "-flto" \
+ {lto-3a.c} {} ""] \
+ [list "Compile 3c" \
+ "" "-O2" \
+ {lto-3c.c} {} ""] \
+ [list "Build liblto-3.a" \
+ "" "-flto $lto_fat" \
+ {lto-3b.c} {} "liblto-3.a"] \
+ [list "Compile 5a" \
+ "" "-flto $lto_fat" \
+ {lto-5a.c} {} ""] \
+ [list "Compile 5b" \
+ "" "-flto $lto_fat" \
+ {lto-5b.c} {} ""] \
+ [list "Compile PR ld/12365" \
+ "" "-flto -O2 $lto_fat" \
+ {pr12365a.c pr12365b.c pr12365c.c} {} ""] \
+ [list "Compile 9" \
+ "" "-O2 -finline -flto" \
+ {lto-9.cc} {} "" "c++"] \
+ [list "Compile 11a" \
+ "" "-O -flto" \
+ {lto-11a.c} {} ""] \
+ [list "Compile 11b" \
+ "" "-O -flto" \
+ {lto-11b.c} {} ""] \
+ [list "Compile 11c" \
+ "" "-O" \
+ {lto-11c.c} {} ""] \
+ [list "Build liblto-12.a" \
+ "$plug_opt" "-O2 -flto" \
+ {lto-12c.c} {} "liblto-12.a"] \
+ [list "Compile 12" \
+ "" "-O2 -flto" \
+ {lto-12a.c lto-12b.c} {} ""] \
+ [list "Compile 13" \
+ "" "-O2 -flto" \
+ {lto-13a.c lto-13b.c} {} ""] \
+ [list "Build liblto-13.a" \
+ "" "-O2" \
+ {lto-13c.c} {} "liblto-13.a"] \
+ [list "Compile 14a" \
+ "" "-flto" \
+ {lto-14a.c lto-14b.c} {} ""] \
+ [list "Build liblto-14.a" \
+ "$plug_opt" "-flto" \
+ {lto-14c.c} {} "liblto-14.a"] \
+ [list "Compile 15a" \
+ "" "-flto" \
+ {lto-15a.c} {} ""] \
+ [list "Build liblto-15.a" \
+ "$plug_opt" "-flto" \
+ {lto-15b.c} {} "liblto-15.a"] \
+ [list "PR ld/12696" \
+ "-O2 -flto -fuse-linker-plugin -r -nostdlib" "-O2 -flto" \
+ {pr12696-1.cc} {} "pr12696-1r.o" "c++"] \
+ [list "Compile PR ld/12758" \
+ "" "" \
+ {pr12758a.s} {} ""] \
+ [list "Build libpr12758.a" \
+ "" "-flto -O2 $lto_fat $NOSANITIZE_CFLAGS" \
+ {pr12758b.c} {} "libpr12758.a"] \
+ [list "PR ld/12758" \
+ "$NOPIE_LDFLAGS $NOSANITIZE_CFLAGS -O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12758a.o -Wl,--start-group tmpdir/libpr12758.a -Wl,--end-group" \
+ "$NOSANITIZE_CFLAGS" \
+ {dummy.c} {} "pr12758.exe"] \
+ [list "Build libpr13183.a" \
+ "-T" "-flto -O2 $lto_fat" \
+ {pr13183a.c} {} "libpr13183.a"] \
+ [list "Compile PR ld/13183" \
+ "" "-flto -O2" \
+ {pr13183b.c} {} ""] \
+ [list "Compile PR ld/13201" \
+ "" "-flto -O2" \
+ {pr13201.c} {} ""] \
+ [list "PR ld/13287" \
+ "-flto -fuse-linker-plugin -Wl,--as-needed" "-flto" \
+ {pr13287.cc} {} "pr13287.exe" "c++"] \
+ [list "PR ld/15323 (1)" \
+ "" "-O2" \
+ {pr15323a.c} {} "" "c"] \
+ [list "PR ld/15323 (2)" \
+ "-O2 -flto -r -nostdlib" "-O2 -flto" \
+ {pr15323a.c} {} "pr15323a-r.o" "c"] \
+ [list "Compile(1) PR ld/pr16846" \
+ "" "-flto" \
+ {pr16846a.c pr16846b.c} {} ""] \
+ [list "Compile(2) PR ld/pr16846" \
+ "" "" \
+ {pr16846c.c} {} ""] \
+ [list "PR ld/pr16846(1)" \
+ "-flto -fuse-linker-plugin tmpdir/pr16846a.o tmpdir/pr16846b.o tmpdir/pr16846c.o" "" \
+ {dummy.c} {} "pr16846a.exe"] \
+ [list "PR ld/pr16846(2)" \
+ "-flto -fuse-linker-plugin tmpdir/pr16846a.o tmpdir/pr16846c.o tmpdir/pr16846b.o" "" \
+ {dummy.c} {} "pr16846b.exe"] \
+ [list "PR ld/19317 (1)" \
+ "$plug_opt" "-flto $lto_no_fat" \
+ {pr19317.c} {} "libpr19317.a"] \
+ [list "Build pr20276a.o" \
+ "" "-fno-lto -fcommon" \
+ {pr20276a.c}] \
+ [list "Build pr20276b.o" \
+ "$plug_opt" "-flto $lto_no_fat -fcommon" \
+ {pr20276b.c}] \
+ [list "Build pr20267a.o" \
+ "" "-fcommon" \
+ {pr20267a.c}] \
+ [list "Build libpr20267a.a" \
+ "$plug_opt" "-flto $lto_fat -fcommon" \
+ {pr20267b.c} {} "libpr20267a.a"] \
+ [list "Build libpr20267b.a" \
+ "$plug_opt" "-flto $lto_no_fat -fcommon" \
+ {pr20267b.c} {} "libpr20267b.a"] \
+ [list "Build pr20321" \
+ "-flto -Wl,-plugin,$plug_so" "-flto" \
+ {pr20321.c} {{warning ".*: duplicated plugin"}} \
+ "pr20321" "c"] \
+ [list "Build pr22502a.o" \
+ "" "" \
+ {pr22502a.c}] \
+ [list "Build pr22502b.o" \
+ "$plug_opt" "-flto $lto_no_fat" \
+ {pr22502b.c}] \
+ [list "Build pr22751.a" \
+ "$plug_opt" "-flto $lto_no_fat $INT128_CFLAGS" \
+ {pr22751.c} {} "pr22751.a"] \
+ [list "Build pr24406-2b.o" \
+ "" "-O2 -fno-lto" \
+ {pr24406-2b.c}] \
+ [list "Build pr26163a.o" \
+ "" "-O2 -fno-lto" \
+ {pr26163a.c}] \
+ [list "Build pr26262b.o" \
+ "" "-O2" \
+ {pr26262b.c} {} "" "c"] \
+ [list "Build pr26262c.o" \
+ "" "-O2" \
+ {pr26262c.c} {} "" "c"] \
+ [list "Build pr26267a.o" \
+ "" "-O2 -flto $lto_no_fat" \
+ {pr26267a.c} {} "" "c"] \
+ [list "Build pr26267b.o" \
+ "" "-O2" \
+ {pr26267b.c} {} "" "c"] \
+ [list "Build pr26267c.o" \
+ "" "-O2" \
+ {pr26267c.c} {} "" "c"] \
+ [list "Build pr26267a" \
+ "" "-O2" \
+ {pr26267a.c} {} "" "c"] \
+ [list "Build pr26267a" \
+ "-flto tmpdir/pr26267a.o tmpdir/pr26267b.o tmpdir/pr26267c.o" \
+ "-flto $lto_no_fat" \
+ {dummy.c} \
+ {{error_output "pr26267.err"}} \
+ "pr26267a"] \
+ [list "Build pr26267b" \
+ "-flto tmpdir/pr26267b.o tmpdir/pr26267c.o tmpdir/pr26267a.o" \
+ "-flto $lto_no_fat" \
+ {dummy.c} \
+ {{error_output "pr26267.err"}} \
+ "pr26267b"] \
+ [list "Build pr26389.o" \
+ "$plug_opt" "-flto $lto_no_fat -fcommon" \
+ {pr26389.c} \
+ [list [list "nm" "$plug_opt" "pr26389.d"]]] \
+]
+
+if { [at_least_gcc_version 10 0] } {
+ set lto_link_tests [concat $lto_link_tests [list \
+ [list "pr25355.o" \
+ "" \
+ "-flto -fno-common $lto_no_fat" \
+ {pr25355.c} \
+ [list [list "nm" "$plug_opt" "pr25355.d"]]] \
+ ]]
+}
+
+if { [at_least_gcc_version 4 7] } {
+ set lto_link_tests [concat $lto_link_tests [list \
+ [list "Compile PR ld/12942 (1)" \
+ "" "-flto -O2" \
+ {pr12942a.cc pr12942c.cc} {} "" "c++"] \
+ [list "Compile PR ld/12942 (2)" \
+ "" "-O0" \
+ {pr12942b.cc} {} "" "c++"] \
+ ]]
+}
+
+set lto_compile_elf_tests [list \
+ [list "Compile 7" \
+ "" "-flto -O2" \
+ {lto-7a.c lto-7b.c lto-7c.c} {} ""] \
+ [list "Compile 8a" \
+ "" "-O2" \
+ {lto-8a.c} {} ""] \
+ [list "Compile 8b" \
+ "" "-flto -O2" \
+ {lto-8b.c} {} ""] \
+ [list "PR ld/23309" \
+ "-O2 -flto -fuse-linker-plugin -fvisibility=hidden -ffunction-sections -Wl,--gc-sections,-u,KeepMe" \
+ "-O2 -flto -fuse-linker-plugin -fvisibility=hidden -ffunction-sections" \
+ {pr23309.c} {{"nm" {} "pr23309.d"}} "pr23309.exe" "c"] \
+]
+
+# Generate input files for complex LTO tests for ELF.
+set lto_link_elf_tests [list \
+ [list "LTO 6" \
+ "-O2 -flto -fuse-linker-plugin" "" \
+ {lto-6.c} {} "lto-6.exe" "c"] \
+ [list "Build liblto-7.so" \
+ "-shared" "-O2 -fpic" \
+ {lto-7d.c} {} "liblto-7.so" "c"] \
+ [list "Build liblto-17a.so" \
+ "-shared -O2 -fpic -flto -fuse-linker-plugin" "-O2 -fpic -flto" \
+ {lto-17a.c} {{"nm" {} "lto-17a.d"}} "liblto-17a.so" "c"] \
+ [list "Build liblto-17b.so 1" \
+ "-shared -O2 -fpic -flto -fuse-linker-plugin tmpdir/lto-17a.o" "-O2 -fpic -flto" \
+ {lto-17b.c} {{"nm" {} "lto-17b-1.d"}} "liblto-17b.so"] \
+ [list "Build liblto-17b.so 2" \
+ "-shared -O2 -fpic -flto -fuse-linker-plugin tmpdir/lto-17a.o" "-O2 -fpic -flto" \
+ {lto-17b.c} {{"nm" {} "lto-17b-2.d"}} "liblto-17b.so"] \
+ [list "Compile PR ld/12760" \
+ "" "-g -O0" \
+ {pr12760a.c} {} ""] \
+ [list "Build libpr12760.a" \
+ "" "-flto -O2 $lto_fat" \
+ {pr12760b.c} {} "libpr12760.a"] \
+ [list "PR ld/12760" \
+ "-O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12760a.o -Wl,--start-group tmpdir/libpr12760.a -Wl,--end-group" "" \
+ {dummy.c} {{warning "pr12760a.c:6: warning: Bad \\.?bar"}} \
+ "pr12760.exe" "c"] \
+ [list "PR ld/12975" \
+ "-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib -Wl,-version-script,pr12975.t" "-O2 -flto" \
+ {pr12975.c} {{"readelf" {-s --wide} "pr12975.d"}} "pr12975.so" "c"] \
+ [list "PR ld/13229" \
+ "-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib" "-O2 -finline -fno-early-inlining -flto" \
+ {pr13229.cc} {{"readelf" {-s --wide} "pr13229.d"}} "pr13229.so" "c++"] \
+ [list "PR ld/13244" \
+ "-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib" "-O2 -fno-early-inlining -flto" \
+ {pr13244.c} {{"readelf" {-s --wide} "pr13244.d"}} "pr13244.so" "c"] \
+ [list "Build libpr15146a.a" \
+ "$plug_opt" "-flto -O2" \
+ {pr15146a.c} {} "lib15146a.a"] \
+ [list "Build pr15146b.so" \
+ "-shared" "-O2 -fpic" \
+ {pr15146b.c} {} "pr15146b.so" "c"] \
+ [list "Build pr15146c.so" \
+ "-shared -Wl,--no-as-needed tmpdir/pr15146b.so" "-O2 -fpic $no_lto" \
+ {pr15146c.c} {} "pr15146c.so" "c"] \
+ [list "PR ld/15146 (1)" \
+ "-O2 -flto -fuse-linker-plugin -Wl,-rpath-link,. -Wl,--no-copy-dt-needed-entries -Wl,--no-as-needed tmpdir/pr15146a.o tmpdir/pr15146c.so" "" \
+ {dummy.c} {{"readelf" {-d} "pr15146.d"}} "pr15146a.exe"] \
+ [list "Build libpr15146d.a" \
+ "$plug_opt" "-flto -O2" \
+ {pr15146d.c} {} "lib15146d.a"] \
+ [list "Build libpr16746a.a" \
+ "" "" \
+ {pr16746a.c pr16746b.c} {} "lib15146a.a"] \
+ [list "Build libpr16746b.a" \
+ "$plug_opt" "-O2 -flto" \
+ {pr16746c.c pr16746d.c} {} "lib15146b.a"] \
+ [list "PR ld/16746 (1)" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/pr16746a.o tmpdir/pr16746c.o" "-O2 -flto" \
+ {dummy.c} {} "pr16746a.exe"] \
+ [list "PR ld/16746 (2)" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/pr16746c.o tmpdir/pr16746a.o" "-O2 -flto" \
+ {dummy.c} {} "pr16746b.exe"] \
+ [list "Build pr21382a.o" \
+ "" "-O2 -flto" \
+ {pr21382a.c} {} "" "c"] \
+ [list "Build pr21382.so" \
+ "-shared" "-O2 -fpic" \
+ {pr21382b.c} {} "pr21382.so" "c"] \
+ [list {Build pr22220lib.so} \
+ {-shared -Wl,--version-script=pr22220lib.ver} {-fPIC} \
+ {pr22220lib.cc} {} {pr22220lib.so} {c++}] \
+ [list {Build pr22220main.o} \
+ {} {-flto} \
+ {pr22220main.cc} {} {} {c++}] \
+ [list "Build libpr23818.so" \
+ "-shared -flto -g -Wl,-version-script,pr23818.t" \
+ "-g -flto $lto_fat" \
+ {pr23818a.c pr23818b.c} \
+ {{"readelf" {-s --wide} "pr23818.d"}} \
+ "libpr23818.so"] \
+ [list "Build libpr23958.so" \
+ "-shared -flto -Wl,-version-script,pr23958.t" \
+ "-g -flto $lto_fat" \
+ {pr23958.c} \
+ "" \
+ "libpr23958.so"] \
+ [list "Build pr24486a.o" \
+ "$plug_opt" "-flto -O2" \
+ {pr24486a.c} {} "" "c"] \
+ [list "Build pr24486b.so" \
+ "-shared" "-O2 -fpic" \
+ {pr24486b.c} {} "pr24486b.so" "c"] \
+ [list "Build pr24486c.so" \
+ "-shared -Wl,--no-as-needed tmpdir/pr24486b.so" "-O2 -fpic" \
+ {pr24486c.c} {} "pr24486c.so" "c"] \
+ [list "PR ld/24486" \
+ "-O2 -flto tmpdir/pr24486a.o tmpdir/pr24486c.so -Wl,--as-needed tmpdir/pr24486b.so" "" \
+ {dummy.c} {} "pr24486.exe"] \
+ [list "Build pr25593a-1.o" \
+ "$plug_opt" "-flto -O2" \
+ {pr25593a-1.c} {} "" "c"] \
+ [list "Build pr25593a-2.o" \
+ "" "-O2" \
+ {pr25593a-2.c} {} "" "c"] \
+ [list "Build pr25593b.o" \
+ "" "-O2" \
+ {pr25593b.c} {} "" "c"] \
+ [list "Build pr25593c.so" \
+ "-shared" "-O2 -fpic" \
+ {pr25593c.c} {} "pr25593c.so" "c"] \
+ [list "Build pr25593d.so" \
+ "-shared" "-O2 -fpic" \
+ {pr25593d.c} {} "pr25593d.so" "c"] \
+ [list "Build pr25593e.so" \
+ "-shared" "-O2 -fpic" \
+ {pr25593e.c} {} "pr25593e.so" "c"] \
+ [list "PR ld/r25593 (LTO)" \
+ "-O2 -flto -Wl,--as-needed tmpdir/pr25593a-1.o tmpdir/pr25593b.o \
+ tmpdir/pr25593c.so tmpdir/pr25593d.so tmpdir/pr25593e.so" "" \
+ {dummy.c} {{readelf {-d --wide} pr25593.d}} "pr25593a.exe"] \
+ [list "PR ld/r25593" \
+ "-O2 -flto -Wl,--as-needed tmpdir/pr25593a-2.o tmpdir/pr25593b.o \
+ tmpdir/pr25593c.so tmpdir/pr25593d.so tmpdir/pr25593e.so" "" \
+ {dummy.c} {{readelf {-d --wide} pr25593.d}} "pr25593b.exe"] \
+ [list "Build pr25618a.o" \
+ "$plug_opt" "-O2 -flto -fpic" \
+ {pr25618a.cc} {} "" "c++"] \
+ [list "Build pr25618.a" \
+ "$plug_opt" "-O2 -flto -fpic" \
+ {pr25618b.cc} {} "pr25618.a" "c++"] \
+ [list "Build pr25618.so" \
+ "-shared -Wl,--exclude-libs,ALL tmpdir/pr25618a.o tmpdir/pr25618.a" \
+ "-fpic" \
+ {dummy.c} {{readelf {--dyn-syms --wide} pr25618.d}} "pr25618.so" "c++"] \
+ [list {liblto-18b.so} \
+ {-shared} {-O2 -fpic} \
+ {lto-18b.c} {} {liblto-18b.so}] \
+ [list {liblto-18b.a} \
+ "$plug_opt" {-flto -O2} \
+ {lto-18b.c} {} {liblto-18b.a}] \
+ [list {liblto-18c.so} \
+ {-shared} {-O2 -fpic} \
+ {lto-18c.c} {} {liblto-18c.so}] \
+ [list {liblto-18c.a} \
+ "$plug_opt" {-flto -O2} \
+ {lto-18c.c} {} {liblto-18c.a}] \
+ [list {lto-18d.o} \
+ {} {-flto -O2} \
+ {lto-18d.c} {} {}] \
+ [list {liblto-19.a} \
+ "$plug_opt" {-flto -O2 -fPIC} \
+ {lto-19a.c} {} {liblto-19.a}] \
+ [list {compile lto-19b.c} \
+ "$plug_opt" {-flto -O2 -fPIC} \
+ {lto-19b.c} {} {} {c}] \
+ [list {liblto-19.so} \
+ {-shared tmpdir/lto-19b.o tmpdir/liblto-19.a} {-O2 -fPIC} \
+ {dummy.c} {} {liblto-19.so}] \
+ [list {pr26806.so} \
+ {-shared} {-fpic -O2 -flto} \
+ {pr26806.c} {{nm {-D} pr26806.d}} {pr26806.so}] \
+ [list {pr27311a.so} \
+ {-shared -Wl,--version-script=pr27311.ver} {-fPIC} \
+ {pr27311a.c} {} {pr27311a.so}] \
+ [list {pr27311b.so} \
+ {-shared -Wl,--no-as-needed tmpdir/pr27311a.so} {-fPIC} \
+ {pr27311b.c} {} {pr27311b.so}] \
+ [list {pr27311c.o} \
+ {} {-flto} \
+ {pr27311c.c} {} {} {c}] \
+ [list {pr27311d.o} \
+ {} {-flto} \
+ {pr27311d.c} {} {} {c}] \
+ [list {pr27311-1} \
+ {tmpdir/pr27311c.o -Wl,--no-as-needed,--rpath-link=. tmpdir/pr27311b.so} {} \
+ {dummy.c} {{readelf {--dyn-syms --wide} pr27311.d}} {pr27311-1}] \
+ [list {pr27311-2} \
+ {tmpdir/pr27311d.o -Wl,--no-as-needed,--rpath-link=. tmpdir/pr27311b.so} {} \
+ {dummy.c} {{readelf {--dyn-syms --wide} pr27311.d}} {pr27311-2}] \
+ [list {pr27441a.so} \
+ {-shared} {-fPIC} \
+ {pr27441a.c} {} {pr27441a.so}] \
+ [list {pr27441b.so} \
+ {-shared} {-fPIC} \
+ {pr27441b.c} {} {pr27441b.so}] \
+ [list {pr27441c.o} \
+ {} {-fPIC -flto} \
+ {pr27441c.c} {} {}] \
+ [list {pr27441c.so} \
+ {-shared -fPIC -Wl,--as-needed tmpdir/pr27441c.o tmpdir/pr27441b.so tmpdir/pr27441a.so} {-fPIC} \
+ {dummy.c} {{readelf {-dW} pr27441c.d}} {pr27441c.so}] \
+]
+
+# PR 14918 checks that libgcc is not spuriously included in a shared link of
+# an empty program. The ARM crt1.o startup code however calls __libc_csu_init
+# in /usr/lib/libc_nonshared.a(elf-init.oS). This in turn needs
+# __aeabi_unwind_cpp_pr0@@GCC_3.5 which is provided by libgcc_s.so.1, so the
+# test fails. Hence this code to skip the test.
+if { ! [istarget "arm*-*-*"] } {
+ lappend lto_link_elf_tests \
+ [list "PR ld/14918" \
+ "-flto" "-flto" \
+ {pr14918.c} {{"readelf" {-d --wide} "pr14918.d"}} "pr14918.exe" "c"]
+}
+
+# PR 12982 checks that an executable stack is not created by default
+# when using the LTO plugin. The HPPA target however requires an
+# executable stack for syscall restarts and signal returns, so we
+# skip this test for that target.
+if { ! [istarget "hppa*-*-*"] } {
+ lappend lto_link_elf_tests \
+ [list "PR ld/12982" \
+ "-O2 -flto -fuse-linker-plugin" "-O2 -flto" \
+ {pr12982.c} {{"readelf" {-l --wide} "pr12982.d"}} "pr12982.exe"]
+}
+
+# Check final symbols in executables.
+set lto_link_symbol_tests [list \
+ [list "LTO 3 symbol" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o tmpdir/liblto-3.a" "" \
+ {dummy.c} {{"nm" {} "lto-3.d"}} "lto-3.exe" "c"] \
+ [list "LTO 5 symbol" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-5.o" "" \
+ {dummy.c} {{"nm" {} "lto-5.d"}} "lto-5.exe" "c"] \
+ [list "LTO 9 symbol" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-9.o" "" \
+ {dummy.c} {{"nm" {-C} "lto-9.d"}} "lto-9.exe" "c++"] \
+ [list "LTO 16a symbol" \
+ "-O2 $NOSANITIZE_CFLAGS -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin" \
+ "-flto $NOSANITIZE_CFLAGS" \
+ {lto-16a.c} {{"nm" {} "lto-16a.d"}} "lto-16.exe" "c"] \
+ [list "LTO 16b symbol" \
+ "-O2 $NOSANITIZE_CFLAGS -Wl,-e,foo -u bar -nostdlib -flto -fuse-linker-plugin" \
+ "-flto $NOSANITIZE_CFLAGS" \
+ {lto-16a.c lto-16b.c} {{"nm" {} "lto-16b.d"}} "lto-16b.exe" "c"] \
+ [list "PR ld/13183" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/pr13183b.o tmpdir/libpr13183.a" "" \
+ {dummy.c} {{"nm" {} "pr13183.d"}} "pr13183.exe" "c"] \
+]
+
+# LTO run-time tests.
+set lto_run_tests [list \
+ [list "LTO 3a" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o tmpdir/liblto-3.a" "" \
+ {dummy.c} "lto-3b.exe" "lto-3.out" "" "c"] \
+ [list "LTO 3b" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o tmpdir/lto-3.o" "" \
+ {dummy.c} "lto-3c.exe" "lto-3.out" "" "c"] \
+ [list "LTO 3c" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o -Wl,--whole-archive tmpdir/liblto-3.a -Wl,--no-whole-archive tmpdir/liblto-3.a" "" \
+ {dummy.c} "lto-3d.exe" "lto-3.out" "" "c"] \
+ [list "LTO 5" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-5.o" "" \
+ {dummy.c} "lto-5.exe" "lto-5.out" "" "c"] \
+ [list "LTO 11" \
+ "-O -flto -fuse-linker-plugin tmpdir/liblto-11.a" "" \
+ {dummy.c} "lto-11.exe" "lto-11.out" "" "c"] \
+ [list "LTO 12a" \
+ "-O -flto -fuse-linker-plugin tmpdir/lto-12a.o tmpdir/liblto-12.a tmpdir/lto-12b.o" "" \
+ {dummy.c} "lto-12a.exe" "lto-12.out" "" "c"] \
+ [list "LTO 12b" \
+ "-O -flto -fuse-linker-plugin tmpdir/lto-12a.o tmpdir/lto-12b.o tmpdir/liblto-12.a" "" \
+ {dummy.c} "lto-12b.exe" "lto-12.out" "" "c"] \
+ [list "LTO 13" \
+ "-O -flto -fuse-linker-plugin tmpdir/lto-13a.o tmpdir/liblto-13.a tmpdir/lto-13b.o" "" \
+ {dummy.c} "lto-13.exe" "lto-13.out" "" "c"] \
+ [list "LTO 14" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-14a.o -Wl,--whole-archive tmpdir/liblto-14.a -Wl,--no-whole-archive tmpdir/lto-14b.o" "" \
+ {dummy.c} "lto-14.exe" "lto-14.out" "" "c"] \
+ [list "LTO 15" \
+ "-O2 -flto -fuse-linker-plugin -Wl,--start-group tmpdir/liblto-15.a tmpdir/lto-15a.o -Wl,--end-group" "" \
+ {dummy.c} "lto-15.exe" "lto-15.out" "" "c"] \
+ [list "PR ld/13066" \
+ "-O2 -flto -fuse-linker-plugin" "" \
+ {pr13066.cc} "pr13066.exe" "pr13066.out" "" "c++"] \
+ [list "PR ld/13201" \
+ "-O2 -flto -fuse-linker-plugin -Wl,--as-needed tmpdir/pr13201.o -lm" "" \
+ {dummy.c} "pr13201.exe" "pr13201.out" "" "c"] \
+ [list "PR ld/15323 (3)" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/pr15323a.o" "" \
+ {pr15323b.c} "pr15323.exe" "pr15323.out" "-flto -O2" "c"] \
+ [list "PR ld/15323 (4)" \
+ "-O2 -flto tmpdir/pr15323a-r.o" "" \
+ {dummy.c} "pr15323a.exe" "pr15323.out" "-flto -O2" "c"] \
+ [list "PR ld/19317 (3)" \
+ "-O2 -flto tmpdir/pr19317-r.o" "" \
+ {dummy.c} "pr19317.exe" "pr19317.out" "-flto -O2" "c"] \
+ [list "Run pr20276" \
+ "-O2 -flto tmpdir/pr20276a.o tmpdir/pr20276b.o" "" \
+ {dummy.c} "pr20276" "pass.out" "-flto -O2" "c"] \
+ [list "Run pr20267a" \
+ "-O2 -flto -fcommon tmpdir/pr20267a.o tmpdir/libpr20267a.a" "" \
+ {dummy.c} "pr20267a" "pass.out" "-flto -O2 -fcommon" "c"] \
+ [list "Run pr20267b" \
+ "-O2 -flto -fcommon tmpdir/pr20267a.o tmpdir/libpr20267b.a" "" \
+ {dummy.c} "pr20267b" "pass.out" "-flto -O2 -fcommon" "c"] \
+ [list "Run pr22502" \
+ "-O2 -flto tmpdir/pr22502a.o tmpdir/pr22502b.o" "" \
+ {dummy.c} "pr20267" "pass.out" "-flto -O2 -fcommon" "c"] \
+ [list "Run pr22751" \
+ "-O2 -flto" "" \
+ {dummy.c} "pr22751" "pass.out" "-flto -O2" "c" "" \
+ "-Wl,--whole-archive tmpdir/pr22751.a -Wl,--no-whole-archive"] \
+ [list "Run pr24406-1" \
+ "-O2 -flto" "" \
+ {pr24406-1.c} "pr24406-1" "pass.out" "-flto -O2" "c" "" \
+ "-Wl,--wrap=read"] \
+ [list "Run pr24406-2" \
+ "-O2 -flto" "" \
+ {pr24406-2a.c} "pr24406-2" "pass.out" \
+ "-flto -O2" "c" "" \
+ "tmpdir/pr24406-2b.o -Wl,--wrap=cook"] \
+ [list "Run pr26163" \
+ "-O2 -flto" "" \
+ {pr26163b.c} "pr24406-2" "pass.out" \
+ "-flto -O2" "c" "" \
+ "tmpdir/pr26163a.o -Wl,--defsym,g=real_g"] \
+ [list "Run pr26262a" \
+ "-O2 -flto" "" \
+ {pr26262a.c} "pr26262a" "pass.out" \
+ "-flto -O2" "c" "" \
+ "tmpdir/pr26262b.o tmpdir/pr26262c.o"] \
+ [list "Run pr26262b" \
+ "-flto -O2 tmpdir/pr26262b.o tmpdir/pr26262c.o" "" \
+ {pr26262a.c} "pr26262b" "pass.out" \
+ "-flto -O2" "c" "" \
+ ""] \
+]
+
+if { [at_least_gcc_version 4 7] } {
+ set lto_run_tests [concat $lto_run_tests [list \
+ [list "PR ld/12942 (1)" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/pr12942a.o tmpdir/pr12942b.o" "" \
+ {dummy.c} "pr12942a.exe" "pr12942.out" "" "c++"] \
+ [list "PR ld/12942 (2)" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/pr12942a.o tmpdir/pr12942c.o" "" \
+ {dummy.c} "pr12942c.exe" "pr12942.out" "" "c++"] \
+ ]]
+}
+
+# LTO run-time tests for ELF which require shared library support.
+set lto_run_elf_shared_tests [list \
+ [list "LTO 7" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-7b.o tmpdir/lto-7c.o tmpdir/lto-7a.o -Wl,--no-as-needed tmpdir/liblto-7.so" "" \
+ {dummy.c} "lto-7.exe" "lto-7.out" "" "c"] \
+ [list "Run pr21382" \
+ "-O2 -flto -fuse-linker-plugin -Wl,--as-needed tmpdir/pr21382a.o tmpdir/pr21382.so" "" \
+ {dummy.c} "pr21382.exe" "pass.out" "" "c"] \
+ [list {pr22220a} \
+ {-flto -fuse-linker-plugin tmpdir/pr22220main.o tmpdir/pr22220lib.so} {} \
+ {dummy.c} {pr22220a.exe} {pass.out} {} {c++}] \
+ [list {pr22220b} \
+ {-flto -fuse-linker-plugin -Wl,--no-as-needed tmpdir/pr22220lib.so tmpdir/pr22220main.o} {} \
+ {dummy.c} {pr22220b.exe} {pass.out} {} {c++}] \
+ [list {lto-18 (1)} \
+ {-flto -fuse-linker-plugin} {} \
+ {lto-18a.c} {lto-18-1.exe} {lto-18.out} {-flto -O2} {c} {} \
+ {tmpdir/lto-18d.o -Wl,--as-needed,-R,tmpdir -Ltmpdir -llto-18b -llto-18c}] \
+ [list {lto-18 (2)} \
+ {-flto -fuse-linker-plugin} {} \
+ {lto-18a.c} {lto-18-2.exe} {lto-18.out} {-flto -O2} {c} {} \
+ {-Wl,--as-needed,-R,tmpdir -Ltmpdir -llto-18b -llto-18c tmpdir/lto-18d.o}] \
+ [list {lto-18 (3)} \
+ {-static -flto -fuse-linker-plugin} {} \
+ {lto-18a.c} {lto-18-3.exe} {lto-18.out} {-flto -O2} {c} {} \
+ {tmpdir/lto-18d.o -Ltmpdir -llto-18b -llto-18c}] \
+ [list {lto-18 (4)} \
+ {-static -flto -fuse-linker-plugin} {} \
+ {lto-18a.c} {lto-18-4.exe} {lto-18.out} {-flto -O2} {c} {} \
+ { -Ltmpdir -llto-18b -llto-18c tmpdir/lto-18d.o}] \
+ [list {lto-19} \
+ {-Wl,--as-needed,-R,tmpdir} {} \
+ {lto-19c.c} {lto-19.exe} {pass.out} {-flto -O2} {c} {} \
+ {tmpdir/liblto-19.so tmpdir/liblto-19.a}] \
+]
+
+# LTO run-time tests for ELF
+set lto_run_elf_tests [list \
+ [list "LTO 8" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-8b.o tmpdir/lto-8a.o" "" \
+ {dummy.c} "lto-8.exe" "lto-8.out" "" "c"] \
+ [list "LTO TLS IE" \
+ "-O2 -flto -fuse-linker-plugin" "" \
+ {run-ie.c} "run-ie.exe" "run-ie.out" "" "c"] \
+]
+
+run_cc_link_tests $lto_link_tests
+
+# These compilation tests generate intermediate object files which will be used
+# by some elf tests besides shared libs tests. So, always compile them.
+run_cc_link_tests $lto_compile_elf_tests
+
+# Restrict these to ELF targets that support shared libs and PIC.
+if { [is_elf_format] && [check_lto_shared_available] } {
+ run_cc_link_tests $lto_link_elf_tests
+ set testname "PR ld/15146 (2)"
+ set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin -Wl,-rpath-link,. -Wl,--no-copy-dt-needed-entries -Wl,--no-as-needed tmpdir/pr15146d.o tmpdir/pr15146c.so"]
+ if { [ regexp "undefined reference to symbol '\\.?xxx'" $exec_output ] } {
+ pass $testname
+ } {
+ fail $testname
+ }
+ set testname "PR ld/16746 (3)"
+ set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin tmpdir/pr16746b.o tmpdir/pr16746d.o"]
+ if { [ regexp "warning: \\.?foobar" $exec_output ] && ![ regexp "symbol from plugin" $exec_output ] } {
+ pass $testname
+ } {
+ fail $testname
+ }
+ set testname "PR ld/16746 (4)"
+ set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin tmpdir/pr16746d.o tmpdir/pr16746b.o"]
+ if { [ regexp "warning: \\.?foobar" $exec_output ] && ![ regexp "symbol from plugin" $exec_output ] } {
+ pass $testname
+ } {
+ fail $testname
+ }
+}
+
+run_cc_link_tests [list \
+ [list \
+ "Build pr28138.a" \
+ "-T" "" \
+ {pr28138-1.c pr28138-2.c pr28138-3.c pr28138-4.c pr28138-5.c \
+ pr28138-6.c pr28138-7.c} {} "pr28138.a" \
+ ] \
+ [list \
+ "Build pr28138.o" \
+ "" "" \
+ {pr28138.c} {} \
+ ] \
+]
+
+set exec_output [run_host_cmd "sh" \
+ "-c \"ulimit -n 20; \
+ $CC -Btmpdir/ld -o tmpdir/pr28138 \
+ tmpdir/pr28138.o tmpdir/pr28138.a\""]
+set exec_output [prune_warnings $exec_output]
+if [string match "" $exec_output] then {
+ if { [isnative] } {
+ set exec_output [run_host_cmd "tmpdir/pr28138" ""]
+ if [string match "PASS" $exec_output] then {
+ pass "PR ld/28138"
+ } else {
+ fail "PR ld/28138"
+ }
+ } else {
+ pass "PR ld/28138"
+ }
+} else {
+ fail "PR ld/28138"
+}
+
+set testname "Build liblto-11.a"
+remote_file host delete "tmpdir/liblto-11.a"
+set catch_output [run_host_cmd "$ar" "rc $plug_opt tmpdir/liblto-11.a tmpdir/lto-11a.o tmpdir/lto-11b.o tmpdir/lto-11c.o"]
+if {![string match "" $catch_output]} {
+ fail $testname
+ restore_notify
+ return
+}
+
+if { [at_least_gcc_version 4 7] } {
+ # Check expected LTO linker errors.
+ # Since the asm symbol name hack in pr12365b.c doesn't work on all
+ # targets, run PR ld/12365 tests only for known targets.
+ if { ([istarget "i?86-*-elf*"]
+ || [istarget "i?86-*-linux*"]
+ || [istarget "i?86-*-gnu*"]
+ || [istarget "x86_64-*-linux*"]
+ || [istarget "amd64-*-linux*"]) } {
+ set testname "PR ld/12365"
+ set exec_output [run_host_cmd "$CC" "-O2 -flto -flto-partition=none -fuse-linker-plugin -o tmpdir/pr12365 tmpdir/pr12365a.o tmpdir/pr12365b.o tmpdir/pr12365c.o"]
+ set exec_output [prune_warnings $exec_output]
+ if { [ regexp "undefined reference to `my_bcopy'" $exec_output ] } {
+ # Linker should catch the reference to undefined `my_bcopy'
+ # error caused by a GCC bug.
+ pass $testname
+ } elseif { [ string match "" $exec_output ] } {
+ global READELF
+ set exec_output [run_host_cmd "$READELF" "-s -W tmpdir/pr12365"]
+ if { [ regexp "my_bcopy" $exec_output ] } {
+ # Verify that there is no `my_bcopy' symbol in executable.
+ fail $testname
+ } {
+ pass $testname
+ }
+ } {
+ fail $testname
+ }
+
+ run_cc_link_tests [list \
+ [list \
+ "Build pr22721a.so" \
+ "-shared $NOSANITIZE_CFLAGS -nostdlib -nostartfiles \
+ -Wl,-version-script,pr22721.t" \
+ "" \
+ {pr22721a.s} \
+ {} \
+ "pr22721a.so" \
+ ] \
+ [list \
+ "Build pr22721b.o" \
+ "$plug_opt $NOSANITIZE_CFLAGS" \
+ "-O2 -fPIC -flto $lto_no_fat" \
+ {pr22721b.c} \
+ ] \
+ [list \
+ "Build PR ld/pr22721" \
+ "-O2 -flto -fuse-linker-plugin -nostdlib -nostartfiles \
+ $NOSANITIZE_CFLAGS \
+ -Wl,-e,_start tmpdir/pr22721b.o tmpdir/pr22721a.so" \
+ "$NOSANITIZE_CFLAGS" \
+ {dummy.c} \
+ {} \
+ "pr22721.exe"
+ ] \
+ ]
+ }
+ set testname "PR ld/12942 (3)"
+ set exec_output [run_host_cmd "$CXX" "-O2 -flto -fuse-linker-plugin tmpdir/pr12942b.o tmpdir/pr12942a.o"]
+ if { [ regexp "undefined reference to `\\.?link_error\\(\\)'" $exec_output ] } {
+ pass $testname
+ } {
+ fail $testname
+ }
+
+ run_cc_link_tests [list \
+ [list \
+ "Build pr23460*.o" \
+ "$plug_opt" \
+ "-O2 -fPIC -flto $lto_no_fat" \
+ {pr23460a.c pr23460b.c pr23460c.c \
+ pr23460d.c pr23460e.c pr23460f.c} \
+ ] \
+ ]
+ set exec_output [run_host_cmd "sh" \
+ "-c \"ulimit -n 20; \
+ $ar -rc $plug_opt \
+ tmpdir/libpr23460.a \
+ tmpdir/pr23460a.o \
+ tmpdir/pr23460b.o \
+ tmpdir/pr23460c.o \
+ tmpdir/pr23460d.o \
+ tmpdir/pr23460e.o \
+ tmpdir/pr23460f.o\""]
+ set exec_output [prune_warnings $exec_output]
+ if [string match "" $exec_output] then {
+ pass "PR binutils/23460"
+ } else {
+ fail "PR binutils/23460"
+ }
+ set exec_output [run_host_cmd "$RANLIB" "$plug_opt tmpdir/libpr23460.a"]
+ set exec_output [prune_warnings $exec_output]
+ if [string match "" $exec_output] then {
+ pass "PR binutils/23460"
+ } else {
+ fail "PR binutils/23460"
+ }
+}
+
+# Run "ld -r" to generate inputs for complex LTO tests.
+run_dump_test "lto-3r"
+remote_exec host "mv" "tmpdir/dump tmpdir/lto-3.o"
+run_dump_test "lto-5r"
+remote_exec host "mv" "tmpdir/dump tmpdir/lto-5.o"
+
+run_cc_link_tests $lto_link_symbol_tests
+
+run_ld_link_tests [list \
+ [list "PR ld/19317 (2)" \
+ "-r tmpdir/pr19317.o" "" "" \
+ {dummy.s} {} "pr19317-r.o"] \
+]
+
+run_ld_link_exec_tests $lto_run_tests
+
+if { [is_elf_format] } {
+ run_ld_link_exec_tests $lto_run_elf_tests
+
+ # Note - it is not guaranteed that the ordering of symbols in the dynamic
+ # symbol table will match the ordering of the symbols specified by the
+ # --dynamic-list command line option.
+ #
+ # For PR22983 we want to make sure that all four symbols specified in
+ # pr222983.t are present in the output, but a simple sequences of regexps
+ # will not work as we do not know the order of the symbols. (Readelf
+ # does not have a symbol sorting option and the run_cc_list_tests proc
+ # does not allow for the output of the dump program to piped into `sort`).
+ #
+ # So instead we run readelf four times, each time checking for the
+ # presence of a specific symbol from the pr22983.t file.
+ run_cc_link_tests [list \
+ [list \
+ "Build pr22983" \
+ "-Wl,--dynamic-list,pr22983.t" \
+ "-flto" \
+ {pr22983a.c pr22983b.c} \
+ {{readelf {--dyn-syms --wide} pr22983.1.d} \
+ {readelf {--dyn-syms --wide} pr22983.2.d} \
+ {readelf {--dyn-syms --wide} pr22983.3.d} \
+ {readelf {--dyn-syms --wide} pr22983.4.d}} \
+ "pr22983" \
+ ] \
+ ]
+}
+
+if { [is_elf_format] && [check_lto_shared_available] } {
+ run_ld_link_exec_tests $lto_run_elf_shared_tests
+}
+
+proc pr20103 {cflags libs} {
+ global CC
+
+ set testname "PR ld/20103 ($cflags $libs)"
+ set exec_output [run_host_cmd "$CC" "$cflags $libs"]
+ if { [ regexp "undefined reference to `\\.?dead'" $exec_output ] } {
+ pass "$testname (1)"
+ } {
+ fail "$testname (1)"
+ }
+ if { [ regexp "plugin needed to handle lto object" $exec_output ] } {
+ fail "$testname (2)"
+ } {
+ pass "$testname (2)"
+ }
+}
+
+if { [check_lto_fat_available] } {
+ run_cc_link_tests [list \
+ [list \
+ "Build fatpr20103a.a" \
+ "$plug_opt" "-flto -ffat-lto-objects" \
+ {pr20103a.c} {} "fatpr20103a.a"
+ ] \
+ [list \
+ "Build fatpr20103b.a" \
+ "$plug_opt" "-flto -ffat-lto-objects" \
+ {pr20103b.c} {} "fatpr20103b.a"
+ ] \
+ [list \
+ "Build fatpr20103c.a" \
+ "$plug_opt" "-flto -ffat-lto-objects" \
+ {pr20103c.c} {} "fatpr20103c.a" \
+ ] \
+ [list \
+ "Build thinpr20103a.a" \
+ "$plug_opt" "-flto -fno-fat-lto-objects" \
+ {pr20103a.c} {} "thinpr20103a.a"
+ ] \
+ [list \
+ "Build thinpr20103b.a" \
+ "$plug_opt" "-flto -fno-fat-lto-objects" \
+ {pr20103b.c} {} "thinpr20103b.a"
+ ] \
+ [list \
+ "Build thinpr20103c.a" \
+ "$plug_opt" "-flto -fno-fat-lto-objects" \
+ {pr20103c.c} {} "thinpr20103c.a" \
+ ] \
+ [list \
+ "Build pr20103a" \
+ "-O2 -flto -Wl,--start-group tmpdir/thinpr20103a.a tmpdir/thinpr20103b.a tmpdir/thinpr20103c.a -Wl,--end-group" \
+ "-O2 -flto" \
+ {dummy.c} {} "pr20103a" \
+ ] \
+ [list \
+ "Build pr20103b" \
+ "-O2 -flto -Wl,--start-group tmpdir/fatpr20103a.a tmpdir/fatpr20103b.a tmpdir/fatpr20103c.a -Wl,--end-group" \
+ "-O2 -flto" \
+ {dummy.c} {} "pr20103b" \
+ ] \
+ [list \
+ "Build pr20103c" \
+ "-O2 -Wl,--start-group tmpdir/fatpr20103a.a tmpdir/fatpr20103b.a tmpdir/fatpr20103c.a -Wl,--end-group" \
+ "-O2" \
+ {dummy.c} {} "pr20103c" \
+ ] \
+ ]
+ pr20103 "-O2 -flto" "tmpdir/thinpr20103a.a tmpdir/thinpr20103b.a tmpdir/thinpr20103c.a"
+ pr20103 "-O2 -flto" "tmpdir/fatpr20103a.a tmpdir/fatpr20103b.a tmpdir/fatpr20103c.a"
+ pr20103 "-O2" "tmpdir/fatpr20103a.a tmpdir/fatpr20103b.a tmpdir/fatpr20103c.a"
+
+ if { [at_least_gcc_version 4 9] } {
+ run_cc_link_tests [list \
+ [list \
+ "Build pr20103d" \
+ "-O2 -Wl,--start-group tmpdir/thinpr20103a.a tmpdir/thinpr20103b.a tmpdir/thinpr20103c.a -Wl,--end-group" \
+ "-O2" \
+ {dummy.c} {} "pr20103d" \
+ ] \
+ ]
+ pr20103 "-O2" "tmpdir/thinpr20103a.a tmpdir/thinpr20103b.a tmpdir/thinpr20103c.a"
+ }
+}
+
+restore_notify
Index: toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/ld/testsuite/ld-plugin/pr28138-1.c
===================================================================
--- toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/ld/testsuite/ld-plugin/pr28138-1.c (nonexistent)
+++ toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/ld/testsuite/ld-plugin/pr28138-1.c (revision 348)
@@ -0,0 +1,6 @@
+extern int a0(void);
+int
+a1(void)
+{
+ return 1 + a0();
+}
Index: toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/ld/testsuite/ld-plugin/pr28138-2.c
===================================================================
--- toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/ld/testsuite/ld-plugin/pr28138-2.c (nonexistent)
+++ toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/ld/testsuite/ld-plugin/pr28138-2.c (revision 348)
@@ -0,0 +1,6 @@
+extern int a1(void);
+int
+a2(void)
+{
+ return 1 + a1();
+}
Index: toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/ld/testsuite/ld-plugin/pr28138-3.c
===================================================================
--- toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/ld/testsuite/ld-plugin/pr28138-3.c (nonexistent)
+++ toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/ld/testsuite/ld-plugin/pr28138-3.c (revision 348)
@@ -0,0 +1,6 @@
+extern int a2(void);
+int
+a3(void)
+{
+ return 1 + a2();
+}
Index: toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/ld/testsuite/ld-plugin/pr28138-4.c
===================================================================
--- toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/ld/testsuite/ld-plugin/pr28138-4.c (nonexistent)
+++ toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/ld/testsuite/ld-plugin/pr28138-4.c (revision 348)
@@ -0,0 +1,6 @@
+extern int a3(void);
+int
+a4(void)
+{
+ return 1 + a3();
+}
Index: toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/ld/testsuite/ld-plugin/pr28138-5.c
===================================================================
--- toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/ld/testsuite/ld-plugin/pr28138-5.c (nonexistent)
+++ toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/ld/testsuite/ld-plugin/pr28138-5.c (revision 348)
@@ -0,0 +1,6 @@
+extern int a4(void);
+int
+a5(void)
+{
+ return 1 + a4();
+}
Index: toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/ld/testsuite/ld-plugin/pr28138-6.c
===================================================================
--- toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/ld/testsuite/ld-plugin/pr28138-6.c (nonexistent)
+++ toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/ld/testsuite/ld-plugin/pr28138-6.c (revision 348)
@@ -0,0 +1,6 @@
+extern int a5(void);
+int
+a6(void)
+{
+ return 1 + a5();
+}
Index: toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/ld/testsuite/ld-plugin/pr28138-7.c
===================================================================
--- toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/ld/testsuite/ld-plugin/pr28138-7.c (nonexistent)
+++ toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/ld/testsuite/ld-plugin/pr28138-7.c (revision 348)
@@ -0,0 +1,6 @@
+extern int a6(void);
+int
+a7(void)
+{
+ return 1 + a6();
+}
Index: toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/ld/testsuite/ld-plugin/pr28138.c
===================================================================
--- toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/ld/testsuite/ld-plugin/pr28138.c (nonexistent)
+++ toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/binutils-2.37-new/ld/testsuite/ld-plugin/pr28138.c (revision 348)
@@ -0,0 +1,20 @@
+#include <stdio.h>
+
+extern int a7(void);
+
+int
+a0(void)
+{
+ return 0;
+}
+
+int
+main()
+{
+ if (a7() == 7)
+ {
+ printf ("PASS\n");
+ return 0;
+ }
+ return 1;
+}
Index: toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/create.patch.sh
===================================================================
--- toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/create.patch.sh (nonexistent)
+++ toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/create.patch.sh (revision 348)
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+VERSION=2.37
+
+tar --files-from=file.list -xJvf ../binutils-$VERSION.tar.xz
+mv binutils-$VERSION binutils-$VERSION-orig
+
+cp -rf ./binutils-$VERSION-new ./binutils-$VERSION
+
+diff -b --unified -Nr binutils-$VERSION-orig binutils-$VERSION > binutils-$VERSION-bfd-close-fds.patch
+
+mv binutils-$VERSION-bfd-close-fds.patch ../patches
+
+rm -rf ./binutils-$VERSION
+rm -rf ./binutils-$VERSION-orig
Property changes on: toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/create.patch.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/file.list
===================================================================
--- toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/file.list (nonexistent)
+++ toolchains-1.7.2/sources/GNU/binutils/create-2.37-bfd-close-fds-patch/file.list (revision 348)
@@ -0,0 +1,2 @@
+binutils-2.37/bfd/plugin.c
+binutils-2.37/ld/testsuite/ld-plugin/lto.exp
Index: toolchains-1.7.2/sources/GNU/binutils/create-2.37-cleansweep-patch/binutils-2.37-new/ld/testsuite/ld-plugin/lto.exp
===================================================================
--- toolchains-1.7.2/sources/GNU/binutils/create-2.37-cleansweep-patch/binutils-2.37-new/ld/testsuite/ld-plugin/lto.exp (nonexistent)
+++ toolchains-1.7.2/sources/GNU/binutils/create-2.37-cleansweep-patch/binutils-2.37-new/ld/testsuite/ld-plugin/lto.exp (revision 348)
@@ -0,0 +1,937 @@
+# Expect script for ld-plugin LTO tests
+# Copyright (C) 2011-2021 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+# Check to see if the C and C++ compilers work
+if { ![check_compiler_available] || [which $CXX] == 0 } {
+ return
+}
+
+# These tests require plugin and LTO.
+if { ![check_plugin_api_available]
+ || ![check_lto_available] } {
+ return
+}
+
+set saved_CFLAGS "$CFLAGS"
+set saved_CXXFLAGS "$CXXFLAGS"
+regsub -all "(\\-Wp,)?-D_FORTIFY_SOURCE=\[0-9\]+" $CFLAGS "" CFLAGS
+regsub -all "(\\-Wp,)?-D_FORTIFY_SOURCE=\[0-9\]+" $CXXFLAGS "" CXXFLAGS
+
+proc restore_notify { } {
+ global saved_CFLAGS
+ global saved_CXXFLAGS
+ set CFLAGS "$saved_CFLAGS"
+ set CXXFLAGS "$saved_CXXFLAGS"
+}
+
+set lto_fat ""
+set lto_no_fat ""
+if { [check_lto_fat_available] } {
+ set lto_fat "-ffat-lto-objects"
+ set lto_no_fat "-fno-fat-lto-objects"
+ set no_lto "-fno-lto"
+}
+
+# Simple LTO tests and generate input files for complex LTO tests.
+set lto_link_tests [list \
+ [list "LTO 1" \
+ "-O2 -flto -fuse-linker-plugin" "-flto -fuse-linker-plugin" \
+ {lto-1a.c lto-1b.c} {} "lto-1.exe"] \
+ [list "Compile 2" \
+ "" "-O2 -flto -fuse-linker-plugin $NOSANITIZE_CFLAGS" \
+ {lto-2.c} {} ""] \
+ [list "LTO 2" \
+ "-static -O2 -flto -fuse-linker-plugin tmpdir/lto-2.o -lm" \
+ "$NOSANITIZE_CFLAGS" \
+ {dummy.c} {} "lto-2.exe"] \
+ [list "Compile 3a" \
+ "" "-flto" \
+ {lto-3a.c} {} ""] \
+ [list "Compile 3c" \
+ "" "-O2" \
+ {lto-3c.c} {} ""] \
+ [list "Build liblto-3.a" \
+ "" "-flto $lto_fat" \
+ {lto-3b.c} {} "liblto-3.a"] \
+ [list "Compile 5a" \
+ "" "-flto $lto_fat" \
+ {lto-5a.c} {} ""] \
+ [list "Compile 5b" \
+ "" "-flto $lto_fat" \
+ {lto-5b.c} {} ""] \
+ [list "Compile PR ld/12365" \
+ "" "-flto -O2 $lto_fat" \
+ {pr12365a.c pr12365b.c pr12365c.c} {} ""] \
+ [list "Compile 9" \
+ "" "-O2 -finline -flto" \
+ {lto-9.cc} {} "" "c++"] \
+ [list "Compile 11a" \
+ "" "-O -flto" \
+ {lto-11a.c} {} ""] \
+ [list "Compile 11b" \
+ "" "-O -flto" \
+ {lto-11b.c} {} ""] \
+ [list "Compile 11c" \
+ "" "-O" \
+ {lto-11c.c} {} ""] \
+ [list "Build liblto-12.a" \
+ "$plug_opt" "-O2 -flto" \
+ {lto-12c.c} {} "liblto-12.a"] \
+ [list "Compile 12" \
+ "" "-O2 -flto" \
+ {lto-12a.c lto-12b.c} {} ""] \
+ [list "Compile 13" \
+ "" "-O2 -flto" \
+ {lto-13a.c lto-13b.c} {} ""] \
+ [list "Build liblto-13.a" \
+ "" "-O2" \
+ {lto-13c.c} {} "liblto-13.a"] \
+ [list "Compile 14a" \
+ "" "-flto" \
+ {lto-14a.c lto-14b.c} {} ""] \
+ [list "Build liblto-14.a" \
+ "$plug_opt" "-flto" \
+ {lto-14c.c} {} "liblto-14.a"] \
+ [list "Compile 15a" \
+ "" "-flto" \
+ {lto-15a.c} {} ""] \
+ [list "Build liblto-15.a" \
+ "$plug_opt" "-flto" \
+ {lto-15b.c} {} "liblto-15.a"] \
+ [list "PR ld/12696" \
+ "-O2 -flto -fuse-linker-plugin -r -nostdlib" "-O2 -flto" \
+ {pr12696-1.cc} {} "pr12696-1r.o" "c++"] \
+ [list "Compile PR ld/12758" \
+ "" "" \
+ {pr12758a.s} {} ""] \
+ [list "Build libpr12758.a" \
+ "" "-flto -O2 $lto_fat $NOSANITIZE_CFLAGS" \
+ {pr12758b.c} {} "libpr12758.a"] \
+ [list "PR ld/12758" \
+ "$NOPIE_LDFLAGS $NOSANITIZE_CFLAGS -O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12758a.o -Wl,--start-group tmpdir/libpr12758.a -Wl,--end-group" \
+ "$NOSANITIZE_CFLAGS" \
+ {dummy.c} {} "pr12758.exe"] \
+ [list "Build libpr13183.a" \
+ "-T" "-flto -O2 $lto_fat" \
+ {pr13183a.c} {} "libpr13183.a"] \
+ [list "Compile PR ld/13183" \
+ "" "-flto -O2" \
+ {pr13183b.c} {} ""] \
+ [list "Compile PR ld/13201" \
+ "" "-flto -O2" \
+ {pr13201.c} {} ""] \
+ [list "PR ld/13287" \
+ "-flto -fuse-linker-plugin -Wl,--as-needed" "-flto" \
+ {pr13287.cc} {} "pr13287.exe" "c++"] \
+ [list "PR ld/15323 (1)" \
+ "" "-O2" \
+ {pr15323a.c} {} "" "c"] \
+ [list "PR ld/15323 (2)" \
+ "-O2 -flto -r -nostdlib" "-O2 -flto" \
+ {pr15323a.c} {} "pr15323a-r.o" "c"] \
+ [list "Compile(1) PR ld/pr16846" \
+ "" "-flto" \
+ {pr16846a.c pr16846b.c} {} ""] \
+ [list "Compile(2) PR ld/pr16846" \
+ "" "" \
+ {pr16846c.c} {} ""] \
+ [list "PR ld/pr16846(1)" \
+ "-flto -fuse-linker-plugin tmpdir/pr16846a.o tmpdir/pr16846b.o tmpdir/pr16846c.o" "" \
+ {dummy.c} {} "pr16846a.exe"] \
+ [list "PR ld/pr16846(2)" \
+ "-flto -fuse-linker-plugin tmpdir/pr16846a.o tmpdir/pr16846c.o tmpdir/pr16846b.o" "" \
+ {dummy.c} {} "pr16846b.exe"] \
+ [list "PR ld/19317 (1)" \
+ "$plug_opt" "-flto $lto_no_fat" \
+ {pr19317.c} {} "libpr19317.a"] \
+ [list "Build pr20276a.o" \
+ "" "-fno-lto -fcommon" \
+ {pr20276a.c}] \
+ [list "Build pr20276b.o" \
+ "$plug_opt" "-flto $lto_no_fat -fcommon" \
+ {pr20276b.c}] \
+ [list "Build pr20267a.o" \
+ "" "-fcommon" \
+ {pr20267a.c}] \
+ [list "Build libpr20267a.a" \
+ "$plug_opt" "-flto $lto_fat -fcommon" \
+ {pr20267b.c} {} "libpr20267a.a"] \
+ [list "Build libpr20267b.a" \
+ "$plug_opt" "-flto $lto_no_fat -fcommon" \
+ {pr20267b.c} {} "libpr20267b.a"] \
+ [list "Build pr20321" \
+ "-flto -Wl,-plugin,$plug_so" "-flto" \
+ {pr20321.c} {{warning ".*: duplicated plugin"}} \
+ "pr20321" "c"] \
+ [list "Build pr22502a.o" \
+ "" "" \
+ {pr22502a.c}] \
+ [list "Build pr22502b.o" \
+ "$plug_opt" "-flto $lto_no_fat" \
+ {pr22502b.c}] \
+ [list "Build pr22751.a" \
+ "$plug_opt" "-flto $lto_no_fat $INT128_CFLAGS" \
+ {pr22751.c} {} "pr22751.a"] \
+ [list "Build pr24406-2b.o" \
+ "" "-O2 -fno-lto" \
+ {pr24406-2b.c}] \
+ [list "Build pr26163a.o" \
+ "" "-O2 -fno-lto" \
+ {pr26163a.c}] \
+ [list "Build pr26262b.o" \
+ "" "-O2" \
+ {pr26262b.c} {} "" "c"] \
+ [list "Build pr26262c.o" \
+ "" "-O2" \
+ {pr26262c.c} {} "" "c"] \
+ [list "Build pr26267a.o" \
+ "" "-O2 -flto $lto_no_fat" \
+ {pr26267a.c} {} "" "c"] \
+ [list "Build pr26267b.o" \
+ "" "-O2" \
+ {pr26267b.c} {} "" "c"] \
+ [list "Build pr26267c.o" \
+ "" "-O2" \
+ {pr26267c.c} {} "" "c"] \
+ [list "Build pr26267a" \
+ "" "-O2" \
+ {pr26267a.c} {} "" "c"] \
+ [list "Build pr26267a" \
+ "-flto tmpdir/pr26267a.o tmpdir/pr26267b.o tmpdir/pr26267c.o" \
+ "-flto $lto_no_fat" \
+ {dummy.c} \
+ {{error_output "pr26267.err"}} \
+ "pr26267a"] \
+ [list "Build pr26267b" \
+ "-flto tmpdir/pr26267b.o tmpdir/pr26267c.o tmpdir/pr26267a.o" \
+ "-flto $lto_no_fat" \
+ {dummy.c} \
+ {{error_output "pr26267.err"}} \
+ "pr26267b"] \
+ [list "Build pr26389.o" \
+ "$plug_opt" "-flto $lto_no_fat -fcommon" \
+ {pr26389.c} \
+ [list [list "nm" "$plug_opt" "pr26389.d"]]] \
+]
+
+if { [at_least_gcc_version 10 0] } {
+ set lto_link_tests [concat $lto_link_tests [list \
+ [list "pr25355.o" \
+ "" \
+ "-flto -fno-common $lto_no_fat" \
+ {pr25355.c} \
+ [list [list "nm" "$plug_opt" "pr25355.d"]]] \
+ ]]
+}
+
+if { [at_least_gcc_version 4 7] } {
+ set lto_link_tests [concat $lto_link_tests [list \
+ [list "Compile PR ld/12942 (1)" \
+ "" "-flto -O2" \
+ {pr12942a.cc pr12942c.cc} {} "" "c++"] \
+ [list "Compile PR ld/12942 (2)" \
+ "" "-O0" \
+ {pr12942b.cc} {} "" "c++"] \
+ ]]
+}
+
+set lto_compile_elf_tests [list \
+ [list "Compile 7" \
+ "" "-flto -O2" \
+ {lto-7a.c lto-7b.c lto-7c.c} {} ""] \
+ [list "Compile 8a" \
+ "" "-O2" \
+ {lto-8a.c} {} ""] \
+ [list "Compile 8b" \
+ "" "-flto -O2" \
+ {lto-8b.c} {} ""] \
+ [list "PR ld/23309" \
+ "-O2 -flto -fuse-linker-plugin -fvisibility=hidden -ffunction-sections -Wl,--gc-sections,-u,KeepMe" \
+ "-O2 -flto -fuse-linker-plugin -fvisibility=hidden -ffunction-sections" \
+ {pr23309.c} {{"nm" {} "pr23309.d"}} "pr23309.exe" "c"] \
+]
+
+# Generate input files for complex LTO tests for ELF.
+set lto_link_elf_tests [list \
+ [list "LTO 6" \
+ "-O2 -flto -fuse-linker-plugin" "" \
+ {lto-6.c} {} "lto-6.exe" "c"] \
+ [list "Build liblto-7.so" \
+ "-shared" "-O2 -fpic" \
+ {lto-7d.c} {} "liblto-7.so" "c"] \
+ [list "Build liblto-17a.so" \
+ "-shared -O2 -fpic -flto -fuse-linker-plugin" "-O2 -fpic -flto" \
+ {lto-17a.c} {{"nm" {} "lto-17a.d"}} "liblto-17a.so" "c"] \
+ [list "Build liblto-17b.so 1" \
+ "-shared -O2 -fpic -flto -fuse-linker-plugin tmpdir/lto-17a.o" "-O2 -fpic -flto" \
+ {lto-17b.c} {{"nm" {} "lto-17b-1.d"}} "liblto-17b.so"] \
+ [list "Build liblto-17b.so 2" \
+ "-shared -O2 -fpic -flto -fuse-linker-plugin tmpdir/lto-17a.o" "-O2 -fpic -flto" \
+ {lto-17b.c} {{"nm" {} "lto-17b-2.d"}} "liblto-17b.so"] \
+ [list "Compile PR ld/12760" \
+ "" "-g -O0" \
+ {pr12760a.c} {} ""] \
+ [list "Build libpr12760.a" \
+ "" "-flto -O2 $lto_fat" \
+ {pr12760b.c} {} "libpr12760.a"] \
+ [list "PR ld/12760" \
+ "-O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12760a.o -Wl,--start-group tmpdir/libpr12760.a -Wl,--end-group" "" \
+ {dummy.c} {{warning "pr12760a.c:6: warning: Bad \\.?bar"}} \
+ "pr12760.exe" "c"] \
+ [list "PR ld/12975" \
+ "-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib -Wl,-version-script,pr12975.t" "-O2 -flto" \
+ {pr12975.c} {{"readelf" {-s --wide} "pr12975.d"}} "pr12975.so" "c"] \
+ [list "PR ld/13229" \
+ "-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib" "-O2 -finline -fno-early-inlining -flto" \
+ {pr13229.cc} {{"readelf" {-s --wide} "pr13229.d"}} "pr13229.so" "c++"] \
+ [list "PR ld/13244" \
+ "-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib" "-O2 -fno-early-inlining -flto" \
+ {pr13244.c} {{"readelf" {-s --wide} "pr13244.d"}} "pr13244.so" "c"] \
+ [list "Build libpr15146a.a" \
+ "$plug_opt" "-flto -O2" \
+ {pr15146a.c} {} "lib15146a.a"] \
+ [list "Build pr15146b.so" \
+ "-shared" "-O2 -fpic" \
+ {pr15146b.c} {} "pr15146b.so" "c"] \
+ [list "Build pr15146c.so" \
+ "-shared -Wl,--no-as-needed tmpdir/pr15146b.so" "-O2 -fpic $no_lto" \
+ {pr15146c.c} {} "pr15146c.so" "c"] \
+ [list "PR ld/15146 (1)" \
+ "-O2 -flto -fuse-linker-plugin -Wl,-rpath-link,. -Wl,--no-copy-dt-needed-entries -Wl,--no-as-needed tmpdir/pr15146a.o tmpdir/pr15146c.so" "" \
+ {dummy.c} {{"readelf" {-d} "pr15146.d"}} "pr15146a.exe"] \
+ [list "Build libpr15146d.a" \
+ "$plug_opt" "-flto -O2" \
+ {pr15146d.c} {} "lib15146d.a"] \
+ [list "Build libpr16746a.a" \
+ "" "" \
+ {pr16746a.c pr16746b.c} {} "lib15146a.a"] \
+ [list "Build libpr16746b.a" \
+ "$plug_opt" "-O2 -flto" \
+ {pr16746c.c pr16746d.c} {} "lib15146b.a"] \
+ [list "PR ld/16746 (1)" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/pr16746a.o tmpdir/pr16746c.o" "-O2 -flto" \
+ {dummy.c} {} "pr16746a.exe"] \
+ [list "PR ld/16746 (2)" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/pr16746c.o tmpdir/pr16746a.o" "-O2 -flto" \
+ {dummy.c} {} "pr16746b.exe"] \
+ [list "Build pr21382a.o" \
+ "" "-O2 -flto" \
+ {pr21382a.c} {} "" "c"] \
+ [list "Build pr21382.so" \
+ "-shared" "-O2 -fpic" \
+ {pr21382b.c} {} "pr21382.so" "c"] \
+ [list {Build pr22220lib.so} \
+ {-shared -Wl,--version-script=pr22220lib.ver} {-fPIC} \
+ {pr22220lib.cc} {} {pr22220lib.so} {c++}] \
+ [list {Build pr22220main.o} \
+ {} {-flto} \
+ {pr22220main.cc} {} {} {c++}] \
+ [list "Build libpr23818.so" \
+ "-shared -flto -g -Wl,-version-script,pr23818.t" \
+ "-g -flto $lto_fat" \
+ {pr23818a.c pr23818b.c} \
+ {{"readelf" {-s --wide} "pr23818.d"}} \
+ "libpr23818.so"] \
+ [list "Build libpr23958.so" \
+ "-shared -flto -Wl,-version-script,pr23958.t" \
+ "-g -flto $lto_fat" \
+ {pr23958.c} \
+ "" \
+ "libpr23958.so"] \
+ [list "Build pr24486a.o" \
+ "$plug_opt" "-flto -O2" \
+ {pr24486a.c} {} "" "c"] \
+ [list "Build pr24486b.so" \
+ "-shared" "-O2 -fpic" \
+ {pr24486b.c} {} "pr24486b.so" "c"] \
+ [list "Build pr24486c.so" \
+ "-shared -Wl,--no-as-needed tmpdir/pr24486b.so" "-O2 -fpic" \
+ {pr24486c.c} {} "pr24486c.so" "c"] \
+ [list "PR ld/24486" \
+ "-O2 -flto tmpdir/pr24486a.o tmpdir/pr24486c.so -Wl,--as-needed tmpdir/pr24486b.so" "" \
+ {dummy.c} {} "pr24486.exe"] \
+ [list "Build pr25593a-1.o" \
+ "$plug_opt" "-flto -O2" \
+ {pr25593a-1.c} {} "" "c"] \
+ [list "Build pr25593a-2.o" \
+ "" "-O2" \
+ {pr25593a-2.c} {} "" "c"] \
+ [list "Build pr25593b.o" \
+ "" "-O2" \
+ {pr25593b.c} {} "" "c"] \
+ [list "Build pr25593c.so" \
+ "-shared" "-O2 -fpic" \
+ {pr25593c.c} {} "pr25593c.so" "c"] \
+ [list "Build pr25593d.so" \
+ "-shared" "-O2 -fpic" \
+ {pr25593d.c} {} "pr25593d.so" "c"] \
+ [list "Build pr25593e.so" \
+ "-shared" "-O2 -fpic" \
+ {pr25593e.c} {} "pr25593e.so" "c"] \
+ [list "PR ld/r25593 (LTO)" \
+ "-O2 -flto -Wl,--as-needed tmpdir/pr25593a-1.o tmpdir/pr25593b.o \
+ tmpdir/pr25593c.so tmpdir/pr25593d.so tmpdir/pr25593e.so" "" \
+ {dummy.c} {{readelf {-d --wide} pr25593.d}} "pr25593a.exe"] \
+ [list "PR ld/r25593" \
+ "-O2 -flto -Wl,--as-needed tmpdir/pr25593a-2.o tmpdir/pr25593b.o \
+ tmpdir/pr25593c.so tmpdir/pr25593d.so tmpdir/pr25593e.so" "" \
+ {dummy.c} {{readelf {-d --wide} pr25593.d}} "pr25593b.exe"] \
+ [list "Build pr25618a.o" \
+ "$plug_opt" "-O2 -flto -fpic" \
+ {pr25618a.cc} {} "" "c++"] \
+ [list "Build pr25618.a" \
+ "$plug_opt" "-O2 -flto -fpic" \
+ {pr25618b.cc} {} "pr25618.a" "c++"] \
+ [list "Build pr25618.so" \
+ "-shared -Wl,--exclude-libs,ALL tmpdir/pr25618a.o tmpdir/pr25618.a" \
+ "-fpic" \
+ {dummy.c} {{readelf {--dyn-syms --wide} pr25618.d}} "pr25618.so" "c++"] \
+ [list {liblto-18b.so} \
+ {-shared} {-O2 -fpic} \
+ {lto-18b.c} {} {liblto-18b.so}] \
+ [list {liblto-18b.a} \
+ "$plug_opt" {-flto -O2} \
+ {lto-18b.c} {} {liblto-18b.a}] \
+ [list {liblto-18c.so} \
+ {-shared} {-O2 -fpic} \
+ {lto-18c.c} {} {liblto-18c.so}] \
+ [list {liblto-18c.a} \
+ "$plug_opt" {-flto -O2} \
+ {lto-18c.c} {} {liblto-18c.a}] \
+ [list {lto-18d.o} \
+ {} {-flto -O2} \
+ {lto-18d.c} {} {}] \
+ [list {liblto-19.a} \
+ "$plug_opt" {-flto -O2 -fPIC} \
+ {lto-19a.c} {} {liblto-19.a}] \
+ [list {compile lto-19b.c} \
+ "$plug_opt" {-flto -O2 -fPIC} \
+ {lto-19b.c} {} {} {c}] \
+ [list {liblto-19.so} \
+ {-shared tmpdir/lto-19b.o tmpdir/liblto-19.a} {-O2 -fPIC} \
+ {dummy.c} {} {liblto-19.so}] \
+ [list {pr26806.so} \
+ {-shared} {-fpic -O2 -flto} \
+ {pr26806.c} {{nm {-D} pr26806.d}} {pr26806.so}] \
+ [list {pr27311a.so} \
+ {-shared -Wl,--version-script=pr27311.ver} {-fPIC} \
+ {pr27311a.c} {} {pr27311a.so}] \
+ [list {pr27311b.so} \
+ {-shared -Wl,--no-as-needed tmpdir/pr27311a.so} {-fPIC} \
+ {pr27311b.c} {} {pr27311b.so}] \
+ [list {pr27311c.o} \
+ {} {-flto} \
+ {pr27311c.c} {} {} {c}] \
+ [list {pr27311d.o} \
+ {} {-flto} \
+ {pr27311d.c} {} {} {c}] \
+ [list {pr27311-1} \
+ {tmpdir/pr27311c.o -Wl,--no-as-needed,--rpath-link=. tmpdir/pr27311b.so} {} \
+ {dummy.c} {{readelf {--dyn-syms --wide} pr27311.d}} {pr27311-1}] \
+ [list {pr27311-2} \
+ {tmpdir/pr27311d.o -Wl,--no-as-needed,--rpath-link=. tmpdir/pr27311b.so} {} \
+ {dummy.c} {{readelf {--dyn-syms --wide} pr27311.d}} {pr27311-2}] \
+ [list {pr27441a.so} \
+ {-shared} {-fPIC} \
+ {pr27441a.c} {} {pr27441a.so}] \
+ [list {pr27441b.so} \
+ {-shared} {-fPIC} \
+ {pr27441b.c} {} {pr27441b.so}] \
+ [list {pr27441c.o} \
+ {} {-fPIC -flto} \
+ {pr27441c.c} {} {}] \
+ [list {pr27441c.so} \
+ {-shared -fPIC -Wl,--as-needed tmpdir/pr27441c.o tmpdir/pr27441b.so tmpdir/pr27441a.so} {-fPIC} \
+ {dummy.c} {{readelf {-dW} pr27441c.d}} {pr27441c.so}] \
+]
+
+# PR 14918 checks that libgcc is not spuriously included in a shared link of
+# an empty program. The ARM crt1.o startup code however calls __libc_csu_init
+# in /usr/lib/libc_nonshared.a(elf-init.oS). This in turn needs
+# __aeabi_unwind_cpp_pr0@@GCC_3.5 which is provided by libgcc_s.so.1, so the
+# test fails. Hence this code to skip the test.
+if { ! [istarget "arm*-*-*"] } {
+ lappend lto_link_elf_tests \
+ [list "PR ld/14918" \
+ "-flto" "-flto" \
+ {pr14918.c} {{"readelf" {-d --wide} "pr14918.d"}} "pr14918.exe" "c"]
+}
+
+# PR 12982 checks that an executable stack is not created by default
+# when using the LTO plugin. The HPPA target however requires an
+# executable stack for syscall restarts and signal returns, so we
+# skip this test for that target.
+if { ! [istarget "hppa*-*-*"] } {
+ lappend lto_link_elf_tests \
+ [list "PR ld/12982" \
+ "-O2 -flto -fuse-linker-plugin" "-O2 -flto" \
+ {pr12982.c} {{"readelf" {-l --wide} "pr12982.d"}} "pr12982.exe"]
+}
+
+# Check final symbols in executables.
+set lto_link_symbol_tests [list \
+ [list "LTO 3 symbol" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o tmpdir/liblto-3.a" "" \
+ {dummy.c} {{"nm" {} "lto-3.d"}} "lto-3.exe" "c"] \
+ [list "LTO 5 symbol" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-5.o" "" \
+ {dummy.c} {{"nm" {} "lto-5.d"}} "lto-5.exe" "c"] \
+ [list "LTO 9 symbol" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-9.o" "" \
+ {dummy.c} {{"nm" {-C} "lto-9.d"}} "lto-9.exe" "c++"] \
+ [list "LTO 16a symbol" \
+ "-O2 $NOSANITIZE_CFLAGS -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin" \
+ "-flto $NOSANITIZE_CFLAGS" \
+ {lto-16a.c} {{"nm" {} "lto-16a.d"}} "lto-16.exe" "c"] \
+ [list "LTO 16b symbol" \
+ "-O2 $NOSANITIZE_CFLAGS -Wl,-e,foo -u bar -nostdlib -flto -fuse-linker-plugin" \
+ "-flto $NOSANITIZE_CFLAGS" \
+ {lto-16a.c lto-16b.c} {{"nm" {} "lto-16b.d"}} "lto-16b.exe" "c"] \
+ [list "PR ld/13183" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/pr13183b.o tmpdir/libpr13183.a" "" \
+ {dummy.c} {{"nm" {} "pr13183.d"}} "pr13183.exe" "c"] \
+]
+
+# LTO run-time tests.
+set lto_run_tests [list \
+ [list "LTO 3a" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o tmpdir/liblto-3.a" "" \
+ {dummy.c} "lto-3b.exe" "lto-3.out" "" "c"] \
+ [list "LTO 3b" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o tmpdir/lto-3.o" "" \
+ {dummy.c} "lto-3c.exe" "lto-3.out" "" "c"] \
+ [list "LTO 3c" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o -Wl,--whole-archive tmpdir/liblto-3.a -Wl,--no-whole-archive tmpdir/liblto-3.a" "" \
+ {dummy.c} "lto-3d.exe" "lto-3.out" "" "c"] \
+ [list "LTO 5" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-5.o" "" \
+ {dummy.c} "lto-5.exe" "lto-5.out" "" "c"] \
+ [list "LTO 11" \
+ "-O -flto -fuse-linker-plugin tmpdir/liblto-11.a" "" \
+ {dummy.c} "lto-11.exe" "lto-11.out" "" "c"] \
+ [list "LTO 12a" \
+ "-O -flto -fuse-linker-plugin tmpdir/lto-12a.o tmpdir/liblto-12.a tmpdir/lto-12b.o" "" \
+ {dummy.c} "lto-12a.exe" "lto-12.out" "" "c"] \
+ [list "LTO 12b" \
+ "-O -flto -fuse-linker-plugin tmpdir/lto-12a.o tmpdir/lto-12b.o tmpdir/liblto-12.a" "" \
+ {dummy.c} "lto-12b.exe" "lto-12.out" "" "c"] \
+ [list "LTO 13" \
+ "-O -flto -fuse-linker-plugin tmpdir/lto-13a.o tmpdir/liblto-13.a tmpdir/lto-13b.o" "" \
+ {dummy.c} "lto-13.exe" "lto-13.out" "" "c"] \
+ [list "LTO 14" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-14a.o -Wl,--whole-archive tmpdir/liblto-14.a -Wl,--no-whole-archive tmpdir/lto-14b.o" "" \
+ {dummy.c} "lto-14.exe" "lto-14.out" "" "c"] \
+ [list "LTO 15" \
+ "-O2 -flto -fuse-linker-plugin -Wl,--start-group tmpdir/liblto-15.a tmpdir/lto-15a.o -Wl,--end-group" "" \
+ {dummy.c} "lto-15.exe" "lto-15.out" "" "c"] \
+ [list "PR ld/13066" \
+ "-O2 -flto -fuse-linker-plugin" "" \
+ {pr13066.cc} "pr13066.exe" "pr13066.out" "" "c++"] \
+ [list "PR ld/13201" \
+ "-O2 -flto -fuse-linker-plugin -Wl,--as-needed tmpdir/pr13201.o -lm" "" \
+ {dummy.c} "pr13201.exe" "pr13201.out" "" "c"] \
+ [list "PR ld/15323 (3)" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/pr15323a.o" "" \
+ {pr15323b.c} "pr15323.exe" "pr15323.out" "-flto -O2" "c"] \
+ [list "PR ld/15323 (4)" \
+ "-O2 -flto tmpdir/pr15323a-r.o" "" \
+ {dummy.c} "pr15323a.exe" "pr15323.out" "-flto -O2" "c"] \
+ [list "PR ld/19317 (3)" \
+ "-O2 -flto tmpdir/pr19317-r.o" "" \
+ {dummy.c} "pr19317.exe" "pr19317.out" "-flto -O2" "c"] \
+ [list "Run pr20276" \
+ "-O2 -flto tmpdir/pr20276a.o tmpdir/pr20276b.o" "" \
+ {dummy.c} "pr20276" "pass.out" "-flto -O2" "c"] \
+ [list "Run pr20267a" \
+ "-O2 -flto -fcommon tmpdir/pr20267a.o tmpdir/libpr20267a.a" "" \
+ {dummy.c} "pr20267a" "pass.out" "-flto -O2 -fcommon" "c"] \
+ [list "Run pr20267b" \
+ "-O2 -flto -fcommon tmpdir/pr20267a.o tmpdir/libpr20267b.a" "" \
+ {dummy.c} "pr20267b" "pass.out" "-flto -O2 -fcommon" "c"] \
+ [list "Run pr22502" \
+ "-O2 -flto tmpdir/pr22502a.o tmpdir/pr22502b.o" "" \
+ {dummy.c} "pr20267" "pass.out" "-flto -O2 -fcommon" "c"] \
+ [list "Run pr22751" \
+ "-O2 -flto" "" \
+ {dummy.c} "pr22751" "pass.out" "-flto -O2" "c" "" \
+ "-Wl,--whole-archive tmpdir/pr22751.a -Wl,--no-whole-archive"] \
+ [list "Run pr24406-1" \
+ "-O2 -flto" "" \
+ {pr24406-1.c} "pr24406-1" "pass.out" "-flto -O2" "c" "" \
+ "-Wl,--wrap=read"] \
+ [list "Run pr24406-2" \
+ "-O2 -flto" "" \
+ {pr24406-2a.c} "pr24406-2" "pass.out" \
+ "-flto -O2" "c" "" \
+ "tmpdir/pr24406-2b.o -Wl,--wrap=cook"] \
+ [list "Run pr26163" \
+ "-O2 -flto" "" \
+ {pr26163b.c} "pr24406-2" "pass.out" \
+ "-flto -O2" "c" "" \
+ "tmpdir/pr26163a.o -Wl,--defsym,g=real_g"] \
+ [list "Run pr26262a" \
+ "-O2 -flto" "" \
+ {pr26262a.c} "pr26262a" "pass.out" \
+ "-flto -O2" "c" "" \
+ "tmpdir/pr26262b.o tmpdir/pr26262c.o"] \
+ [list "Run pr26262b" \
+ "-flto -O2 tmpdir/pr26262b.o tmpdir/pr26262c.o" "" \
+ {pr26262a.c} "pr26262b" "pass.out" \
+ "-flto -O2" "c" "" \
+ ""] \
+]
+
+if { [at_least_gcc_version 4 7] } {
+ set lto_run_tests [concat $lto_run_tests [list \
+ [list "PR ld/12942 (1)" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/pr12942a.o tmpdir/pr12942b.o" "" \
+ {dummy.c} "pr12942a.exe" "pr12942.out" "" "c++"] \
+ [list "PR ld/12942 (2)" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/pr12942a.o tmpdir/pr12942c.o" "" \
+ {dummy.c} "pr12942c.exe" "pr12942.out" "" "c++"] \
+ ]]
+}
+
+# LTO run-time tests for ELF which require shared library support.
+set lto_run_elf_shared_tests [list \
+ [list "LTO 7" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-7b.o tmpdir/lto-7c.o tmpdir/lto-7a.o -Wl,--no-as-needed tmpdir/liblto-7.so" "" \
+ {dummy.c} "lto-7.exe" "lto-7.out" "" "c"] \
+ [list "Run pr21382" \
+ "-O2 -flto -fuse-linker-plugin -Wl,--as-needed tmpdir/pr21382a.o tmpdir/pr21382.so" "" \
+ {dummy.c} "pr21382.exe" "pass.out" "" "c"] \
+ [list {pr22220a} \
+ {-flto -fuse-linker-plugin tmpdir/pr22220main.o tmpdir/pr22220lib.so} {} \
+ {dummy.c} {pr22220a.exe} {pass.out} {} {c++}] \
+ [list {pr22220b} \
+ {-flto -fuse-linker-plugin -Wl,--no-as-needed tmpdir/pr22220lib.so tmpdir/pr22220main.o} {} \
+ {dummy.c} {pr22220b.exe} {pass.out} {} {c++}] \
+ [list {lto-18 (1)} \
+ {-flto -fuse-linker-plugin} {} \
+ {lto-18a.c} {lto-18-1.exe} {lto-18.out} {-flto -O2} {c} {} \
+ {tmpdir/lto-18d.o -Wl,--as-needed,-R,tmpdir -Ltmpdir -llto-18b -llto-18c}] \
+ [list {lto-18 (2)} \
+ {-flto -fuse-linker-plugin} {} \
+ {lto-18a.c} {lto-18-2.exe} {lto-18.out} {-flto -O2} {c} {} \
+ {-Wl,--as-needed,-R,tmpdir -Ltmpdir -llto-18b -llto-18c tmpdir/lto-18d.o}] \
+ [list {lto-18 (3)} \
+ {-static -flto -fuse-linker-plugin} {} \
+ {lto-18a.c} {lto-18-3.exe} {lto-18.out} {-flto -O2} {c} {} \
+ {tmpdir/lto-18d.o -Ltmpdir -llto-18b -llto-18c}] \
+ [list {lto-18 (4)} \
+ {-static -flto -fuse-linker-plugin} {} \
+ {lto-18a.c} {lto-18-4.exe} {lto-18.out} {-flto -O2} {c} {} \
+ { -Ltmpdir -llto-18b -llto-18c tmpdir/lto-18d.o}] \
+ [list {lto-19} \
+ {-Wl,--as-needed,-R,tmpdir} {} \
+ {lto-19c.c} {lto-19.exe} {pass.out} {-flto -O2} {c} {} \
+ {tmpdir/liblto-19.so tmpdir/liblto-19.a}] \
+]
+
+# LTO run-time tests for ELF
+set lto_run_elf_tests [list \
+ [list "LTO 8" \
+ "-O2 -flto -fuse-linker-plugin tmpdir/lto-8b.o tmpdir/lto-8a.o" "" \
+ {dummy.c} "lto-8.exe" "lto-8.out" "" "c"] \
+ [list "LTO TLS IE" \
+ "-O2 -flto -fuse-linker-plugin" "" \
+ {run-ie.c} "run-ie.exe" "run-ie.out" "" "c"] \
+]
+
+run_cc_link_tests $lto_link_tests
+
+# These compilation tests generate intermediate object files which will be used
+# by some elf tests besides shared libs tests. So, always compile them.
+run_cc_link_tests $lto_compile_elf_tests
+
+# Restrict these to ELF targets that support shared libs and PIC.
+if { [is_elf_format] && [check_lto_shared_available] } {
+ run_cc_link_tests $lto_link_elf_tests
+ set testname "PR ld/15146 (2)"
+ set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin -Wl,-rpath-link,. -Wl,--no-copy-dt-needed-entries -Wl,--no-as-needed tmpdir/pr15146d.o tmpdir/pr15146c.so"]
+ if { [ regexp "undefined reference to symbol '\\.?xxx'" $exec_output ] } {
+ pass $testname
+ } {
+ fail $testname
+ }
+ set testname "PR ld/16746 (3)"
+ set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin tmpdir/pr16746b.o tmpdir/pr16746d.o"]
+ if { [ regexp "warning: \\.?foobar" $exec_output ] && ![ regexp "symbol from plugin" $exec_output ] } {
+ pass $testname
+ } {
+ fail $testname
+ }
+ set testname "PR ld/16746 (4)"
+ set exec_output [run_host_cmd "$CC" "-O2 -flto -fuse-linker-plugin tmpdir/pr16746d.o tmpdir/pr16746b.o"]
+ if { [ regexp "warning: \\.?foobar" $exec_output ] && ![ regexp "symbol from plugin" $exec_output ] } {
+ pass $testname
+ } {
+ fail $testname
+ }
+}
+
+set testname "Build liblto-11.a"
+remote_file host delete "tmpdir/liblto-11.a"
+set catch_output [run_host_cmd "$ar" "rc $plug_opt tmpdir/liblto-11.a tmpdir/lto-11a.o tmpdir/lto-11b.o tmpdir/lto-11c.o"]
+if {![string match "" $catch_output]} {
+ fail $testname
+ restore_notify
+ return
+}
+
+if { [at_least_gcc_version 4 7] } {
+ # Check expected LTO linker errors.
+ # Since the asm symbol name hack in pr12365b.c doesn't work on all
+ # targets, run PR ld/12365 tests only for known targets.
+ if { ([istarget "i?86-*-elf*"]
+ || [istarget "i?86-*-linux*"]
+ || [istarget "i?86-*-gnu*"]
+ || [istarget "x86_64-*-linux*"]
+ || [istarget "amd64-*-linux*"]) } {
+ set testname "PR ld/12365"
+ set exec_output [run_host_cmd "$CC" "-O2 -flto -flto-partition=none -fuse-linker-plugin -o tmpdir/pr12365 tmpdir/pr12365a.o tmpdir/pr12365b.o tmpdir/pr12365c.o"]
+ set exec_output [prune_warnings $exec_output]
+ if { [ regexp "undefined reference to `my_bcopy'" $exec_output ] } {
+ # Linker should catch the reference to undefined `my_bcopy'
+ # error caused by a GCC bug.
+ pass $testname
+ } elseif { [ string match "" $exec_output ] } {
+ global READELF
+ set exec_output [run_host_cmd "$READELF" "-s -W tmpdir/pr12365"]
+ if { [ regexp "my_bcopy" $exec_output ] } {
+ # Verify that there is no `my_bcopy' symbol in executable.
+ fail $testname
+ } {
+ pass $testname
+ }
+ } {
+ fail $testname
+ }
+
+ run_cc_link_tests [list \
+ [list \
+ "Build pr22721a.so" \
+ "-shared $NOSANITIZE_CFLAGS -nostdlib -nostartfiles \
+ -Wl,-version-script,pr22721.t" \
+ "" \
+ {pr22721a.s} \
+ {} \
+ "pr22721a.so" \
+ ] \
+ [list \
+ "Build pr22721b.o" \
+ "$plug_opt $NOSANITIZE_CFLAGS" \
+ "-O2 -fPIC -flto $lto_no_fat" \
+ {pr22721b.c} \
+ ] \
+ [list \
+ "Build PR ld/pr22721" \
+ "-O2 -flto -fuse-linker-plugin -nostdlib -nostartfiles \
+ $NOSANITIZE_CFLAGS \
+ -Wl,-e,_start tmpdir/pr22721b.o tmpdir/pr22721a.so" \
+ "$NOSANITIZE_CFLAGS" \
+ {dummy.c} \
+ {} \
+ "pr22721.exe"
+ ] \
+ ]
+ }
+ set testname "PR ld/12942 (3)"
+ set exec_output [run_host_cmd "$CXX" "-O2 -flto -fuse-linker-plugin tmpdir/pr12942b.o tmpdir/pr12942a.o"]
+ if { [ regexp "undefined reference to `\\.?link_error\\(\\)'" $exec_output ] } {
+ pass $testname
+ } {
+ fail $testname
+ }
+
+ run_cc_link_tests [list \
+ [list \
+ "Build pr23460*.o" \
+ "$plug_opt" \
+ "-O2 -fPIC -flto $lto_no_fat" \
+ {pr23460a.c pr23460b.c pr23460c.c \
+ pr23460d.c pr23460e.c pr23460f.c} \
+ ] \
+ ]
+ set exec_output [run_host_cmd "sh" \
+ "-c \"ulimit -n 20; \
+ $ar -rc $plug_opt \
+ tmpdir/libpr23460.a \
+ tmpdir/pr23460a.o \
+ tmpdir/pr23460b.o \
+ tmpdir/pr23460c.o \
+ tmpdir/pr23460d.o \
+ tmpdir/pr23460e.o \
+ tmpdir/pr23460f.o\""]
+ set exec_output [prune_warnings $exec_output]
+ if [string match "" $exec_output] then {
+ pass "PR binutils/23460"
+ } else {
+ fail "PR binutils/23460"
+ }
+ set exec_output [run_host_cmd "$RANLIB" "$plug_opt tmpdir/libpr23460.a"]
+ set exec_output [prune_warnings $exec_output]
+ if [string match "" $exec_output] then {
+ pass "PR binutils/23460"
+ } else {
+ fail "PR binutils/23460"
+ }
+}
+
+# Fedora specific binutils patches break some of the tests that follow...
+restore_notify
+return
+
+# Run "ld -r" to generate inputs for complex LTO tests.
+run_dump_test "lto-3r"
+remote_exec host "mv" "tmpdir/dump tmpdir/lto-3.o"
+run_dump_test "lto-5r"
+remote_exec host "mv" "tmpdir/dump tmpdir/lto-5.o"
+
+run_cc_link_tests $lto_link_symbol_tests
+
+run_ld_link_tests [list \
+ [list "PR ld/19317 (2)" \
+ "-r tmpdir/pr19317.o" "" "" \
+ {dummy.s} {} "pr19317-r.o"] \
+]
+
+run_ld_link_exec_tests $lto_run_tests
+
+if { [is_elf_format] } {
+ run_ld_link_exec_tests $lto_run_elf_tests
+
+ # Note - it is not guaranteed that the ordering of symbols in the dynamic
+ # symbol table will match the ordering of the symbols specified by the
+ # --dynamic-list command line option.
+ #
+ # For PR22983 we want to make sure that all four symbols specified in
+ # pr222983.t are present in the output, but a simple sequences of regexps
+ # will not work as we do not know the order of the symbols. (Readelf
+ # does not have a symbol sorting option and the run_cc_list_tests proc
+ # does not allow for the output of the dump program to piped into `sort`).
+ #
+ # So instead we run readelf four times, each time checking for the
+ # presence of a specific symbol from the pr22983.t file.
+ run_cc_link_tests [list \
+ [list \
+ "Build pr22983" \
+ "-Wl,--dynamic-list,pr22983.t" \
+ "-flto" \
+ {pr22983a.c pr22983b.c} \
+ {{readelf {--dyn-syms --wide} pr22983.1.d} \
+ {readelf {--dyn-syms --wide} pr22983.2.d} \
+ {readelf {--dyn-syms --wide} pr22983.3.d} \
+ {readelf {--dyn-syms --wide} pr22983.4.d}} \
+ "pr22983" \
+ ] \
+ ]
+}
+
+if { [is_elf_format] && [check_lto_shared_available] } {
+ run_ld_link_exec_tests $lto_run_elf_shared_tests
+}
+
+proc pr20103 {cflags libs} {
+ global CC
+
+ set testname "PR ld/20103 ($cflags $libs)"
+ set exec_output [run_host_cmd "$CC" "$cflags $libs"]
+ if { [ regexp "undefined reference to `\\.?dead'" $exec_output ] } {
+ pass "$testname (1)"
+ } {
+ fail "$testname (1)"
+ }
+ if { [ regexp "plugin needed to handle lto object" $exec_output ] } {
+ fail "$testname (2)"
+ } {
+ pass "$testname (2)"
+ }
+}
+
+if { [check_lto_fat_available] } {
+ run_cc_link_tests [list \
+ [list \
+ "Build fatpr20103a.a" \
+ "$plug_opt" "-flto -ffat-lto-objects" \
+ {pr20103a.c} {} "fatpr20103a.a"
+ ] \
+ [list \
+ "Build fatpr20103b.a" \
+ "$plug_opt" "-flto -ffat-lto-objects" \
+ {pr20103b.c} {} "fatpr20103b.a"
+ ] \
+ [list \
+ "Build fatpr20103c.a" \
+ "$plug_opt" "-flto -ffat-lto-objects" \
+ {pr20103c.c} {} "fatpr20103c.a" \
+ ] \
+ [list \
+ "Build thinpr20103a.a" \
+ "$plug_opt" "-flto -fno-fat-lto-objects" \
+ {pr20103a.c} {} "thinpr20103a.a"
+ ] \
+ [list \
+ "Build thinpr20103b.a" \
+ "$plug_opt" "-flto -fno-fat-lto-objects" \
+ {pr20103b.c} {} "thinpr20103b.a"
+ ] \
+ [list \
+ "Build thinpr20103c.a" \
+ "$plug_opt" "-flto -fno-fat-lto-objects" \
+ {pr20103c.c} {} "thinpr20103c.a" \
+ ] \
+ [list \
+ "Build pr20103a" \
+ "-O2 -flto -Wl,--start-group tmpdir/thinpr20103a.a tmpdir/thinpr20103b.a tmpdir/thinpr20103c.a -Wl,--end-group" \
+ "-O2 -flto" \
+ {dummy.c} {} "pr20103a" \
+ ] \
+ [list \
+ "Build pr20103b" \
+ "-O2 -flto -Wl,--start-group tmpdir/fatpr20103a.a tmpdir/fatpr20103b.a tmpdir/fatpr20103c.a -Wl,--end-group" \
+ "-O2 -flto" \
+ {dummy.c} {} "pr20103b" \
+ ] \
+ [list \
+ "Build pr20103c" \
+ "-O2 -Wl,--start-group tmpdir/fatpr20103a.a tmpdir/fatpr20103b.a tmpdir/fatpr20103c.a -Wl,--end-group" \
+ "-O2" \
+ {dummy.c} {} "pr20103c" \
+ ] \
+ ]
+ pr20103 "-O2 -flto" "tmpdir/thinpr20103a.a tmpdir/thinpr20103b.a tmpdir/thinpr20103c.a"
+ pr20103 "-O2 -flto" "tmpdir/fatpr20103a.a tmpdir/fatpr20103b.a tmpdir/fatpr20103c.a"
+ pr20103 "-O2" "tmpdir/fatpr20103a.a tmpdir/fatpr20103b.a tmpdir/fatpr20103c.a"
+
+ if { [at_least_gcc_version 4 9] } {
+ run_cc_link_tests [list \
+ [list \
+ "Build pr20103d" \
+ "-O2 -Wl,--start-group tmpdir/thinpr20103a.a tmpdir/thinpr20103b.a tmpdir/thinpr20103c.a -Wl,--end-group" \
+ "-O2" \
+ {dummy.c} {} "pr20103d" \
+ ] \
+ ]
+ pr20103 "-O2" "tmpdir/thinpr20103a.a tmpdir/thinpr20103b.a tmpdir/thinpr20103c.a"
+ }
+}
+
+restore_notify
Index: toolchains-1.7.2/sources/GNU/binutils/create-2.37-cleansweep-patch/binutils-2.37-new/ld/testsuite/ld-size/size.exp
===================================================================
--- toolchains-1.7.2/sources/GNU/binutils/create-2.37-cleansweep-patch/binutils-2.37-new/ld/testsuite/ld-size/size.exp (nonexistent)
+++ toolchains-1.7.2/sources/GNU/binutils/create-2.37-cleansweep-patch/binutils-2.37-new/ld/testsuite/ld-size/size.exp (revision 348)
@@ -0,0 +1,273 @@
+# Expect script for linker support of size relocations.
+#
+# Copyright (C) 2013-2021 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+
+
+# Size relocations have only been implemented for the ix86 and x86_64,
+# so far.
+if {!(([istarget "i?86-*-*"]
+ || [istarget "x86_64-*-*"])
+ && ([istarget "*-*-elf*"]
+ || [istarget "*-*-nacl*"]
+ || [istarget "*-*-linux*"]
+ || [istarget "*-*-gnu*"])) } {
+ verbose "Size relocations tests not run - no target support"
+ return
+}
+
+# So as to avoid rewriting every last test case here in a nacl variant,
+# we use black magic to massage the generic cases into nacl-variant cases.
+if [istarget "*-*-nacl*"] {
+ # Change all the -melf_i386 to -melf_i386_nacl so linking can succeed.
+ set options_regsub(ld) {-m(\\S+) -m\\1_nacl}
+}
+
+set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
+foreach t $test_list {
+ # We need to strip the ".d", but can leave the dirname.
+ verbose [file rootname $t]
+ run_dump_test [file rootname $t]
+}
+
+# We need a working compiler.
+if { ![check_compiler_available] } {
+ verbose "Native size relocation tests not run - no compiler available"
+ return
+}
+
+run_cc_link_tests [list \
+ [list \
+ "Build libsize-1.so" \
+ "-shared" \
+ "-fPIC" \
+ {size-1a.c size-1b.c} \
+ {} \
+ "libsize-1.so" \
+ ] \
+ [list \
+ "Build libsize-2.so" \
+ "-shared" \
+ "-fPIC" \
+ {size-2a.c size-2b.c} \
+ {} \
+ "libsize-2.so" \
+ ] \
+ [list \
+ "Build libsize-3a.so" \
+ "-shared" "-fPIC" \
+ {size-3a.c} \
+ {} \
+ "libsize-3a.so" \
+ ] \
+ [list \
+ "Build libsize-3b.so" \
+ "-shared" \
+ "-fPIC" \
+ {size-3b.c} \
+ {} \
+ "libsize-3b.so" \
+ ] \
+ [list \
+ "Build libsize-3c.so" \
+ "-shared" \
+ "-fPIC" \
+ {size-3c.c} \
+ {} \
+ "libsize-3c.so" \
+ ] \
+ [list \
+ "Build libsize-6b.so" \
+ "-shared" \
+ "-fPIC" \
+ {size-6b.c} \
+ {} \
+ "libsize-6b.so" \
+ ] \
+ [list \
+ "Build libsize-9.so" \
+ "-shared $NOSANITIZE_CFLAGS" \
+ "-fPIC $NOSANITIZE_CFLAGS" \
+ {size-9b.c} \
+ {{readelf -rW size-9.rd}} \
+ "libsize-9.so" \
+ ] \
+ [list \
+ "Build libsize-10.so" \
+ "-shared" \
+ "-fPIC" \
+ {size-10b.c} \
+ {{readelf -rW size-10.rd}} \
+ "libsize-10.so" \
+ ] \
+]
+
+return
+
+# Check if size relocation works at run-time.
+catch "exec tmpdir/size-7.exe > tmpdir/dump.out" exec_output
+if ![string match "" $exec_output] then {
+ send_log "No run-time size relocation support: $exec_output\n"
+ verbose "No run-time size relocation support: $exec_output" 1
+ return
+}
+
+if { [regexp_diff "tmpdir/dump.out" "$srcdir/$subdir/size-7.out" ] } then {
+ verbose "output is [file_contents "tmpdir/dump.out"]" 2
+ fail "Run-time size relocation"
+ return
+}
+
+# Run-time size relocation tests.
+run_ld_link_exec_tests [list \
+ [list \
+ "Run size-1" \
+ "-Wl,--no-as-needed tmpdir/libsize-1.so" \
+ "" \
+ {size-1.c} \
+ "size-1" \
+ "size-1.out" \
+ ] \
+ [list \
+ "Run size-2" \
+ "-Wl,--no-as-needed tmpdir/libsize-2.so" \
+ "" \
+ {size-2.c} \
+ "size-2" \
+ "size-2.out" \
+ ] \
+ [list \
+ "Run size-3a" \
+ "" \
+ "" \
+ {size-3.c size-3a.c} \
+ "size-3a" \
+ "size-3.out" \
+ ] \
+ [list \
+ "Run size-3b" \
+ "-Wl,--no-as-needed tmpdir/libsize-3a.so" \
+ "" \
+ {size-3.c} \
+ "size-3b" \
+ "size-3.out" \
+ ] \
+ [list \
+ "Run size-3c" \
+ "" \
+ "" \
+ {size-3.c size-3b.c} \
+ "size-3c" \
+ "size-3.out" \
+ ] \
+ [list \
+ "Run size-3d (1)" \
+ "-Wl,--no-as-needed tmpdir/libsize-3b.so" \
+ "" \
+ {size-3.c} \
+ "size-3d1" \
+ "size-3.out" \
+ ] \
+ [list \
+ "Run size-3d (2)" \
+ "" \
+ "" \
+ {size-3.c size-3c.c} \
+ "size-3d2" \
+ "size-3.out" \
+ ] \
+ [list \
+ {"Run size-3e" \
+ "-Wl,--no-as-needed tmpdir/libsize-3c.so" "" \
+ {size-3.c} "size-3e" "size-3.out"} \
+ ] \
+ [list \
+ "Run size-4a" \
+ "$NOPIE_LDFLAGS" \
+ "" \
+ {size-4a.c size-4b.c} \
+ "size-4a" \
+ "size-4.out" \
+ "$NOPIE_CFLAGS" \
+ ] \
+ [list \
+ "Run size-4b" \
+ "$NOPIE_LDFLAGS" \
+ "" \
+ {size-4b.c size-4a.c} \
+ "size-4b" \
+ "size-4.out" \
+ "$NOPIE_CFLAGS" \
+ ] \
+ [list \
+ "Run size-5a" \
+ "$NOPIE_LDFLAGS" \
+ "" \
+ {size-5a.c size-5b.c} \
+ "size-5a" \
+ "size-5.out" \
+ "$NOPIE_CFLAGS" \
+ ] \
+ [list \
+ "Run size-5b" \
+ "$NOPIE_LDFLAGS" \
+ "" \
+ {size-5b.c size-5a.c} \
+ "size-5b" \
+ "size-5.out" \
+ "$NOPIE_CFLAGS" \
+ ] \
+ [list \
+ "Run size-6" \
+ "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libsize-6b.so" \
+ "" \
+ {size-6a.c} \
+ "size-6" \
+ "size-6.out" \
+ "$NOPIE_CFLAGS" \
+ ] \
+ [list \
+ "Run size-8" \
+ "$NOPIE_LDFLAGS -Wl,--no-as-needed,--hash-styl=gnu,-z,notext \
+ tmpdir/libsize-8.so" \
+ "" \
+ {size-8a.c} \
+ "size-8" \
+ "size-8.out" \
+ "$NOPIE_CFLAGS" \
+ ] \
+ [list \
+ "Run size-9" \
+ "-Wl,--no-as-needed tmpdir/libsize-9.so $NOSANITIZE_CFLAGS" \
+ "" \
+ {size-9a.c} \
+ "size-9" \
+ "size-9.out" \
+ "$NOSANITIZE_CFLAGS" \
+ ] \
+ [list \
+ "Run size-10" \
+ "-Wl,--no-as-needed tmpdir/libsize-10.so" \
+ "" \
+ {size-10a.c} \
+ "size-10" \
+ "size-10.out" \
+ ] \
+]
Index: toolchains-1.7.2/sources/GNU/binutils/create-2.37-cleansweep-patch/create.patch.sh
===================================================================
--- toolchains-1.7.2/sources/GNU/binutils/create-2.37-cleansweep-patch/create.patch.sh (nonexistent)
+++ toolchains-1.7.2/sources/GNU/binutils/create-2.37-cleansweep-patch/create.patch.sh (revision 348)
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+VERSION=2.37
+
+tar --files-from=file.list -xJvf ../binutils-$VERSION.tar.xz
+mv binutils-$VERSION binutils-$VERSION-orig
+
+cp -rf ./binutils-$VERSION-new ./binutils-$VERSION
+
+diff -b --unified -Nr binutils-$VERSION-orig binutils-$VERSION > binutils-$VERSION-cleansweep.patch
+
+mv binutils-$VERSION-cleansweep.patch ../patches
+
+rm -rf ./binutils-$VERSION
+rm -rf ./binutils-$VERSION-orig
Property changes on: toolchains-1.7.2/sources/GNU/binutils/create-2.37-cleansweep-patch/create.patch.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: toolchains-1.7.2/sources/GNU/binutils/create-2.37-cleansweep-patch/file.list
===================================================================
--- toolchains-1.7.2/sources/GNU/binutils/create-2.37-cleansweep-patch/file.list (nonexistent)
+++ toolchains-1.7.2/sources/GNU/binutils/create-2.37-cleansweep-patch/file.list (revision 348)
@@ -0,0 +1,2 @@
+binutils-2.37/ld/testsuite/ld-plugin/lto.exp
+binutils-2.37/ld/testsuite/ld-size/size.exp
Index: toolchains-1.7.2/sources/GNU/binutils/create-2.37-copy-osabi-patch/binutils-2.37-new/bfd/elf.c
===================================================================
--- toolchains-1.7.2/sources/GNU/binutils/create-2.37-copy-osabi-patch/binutils-2.37-new/bfd/elf.c (nonexistent)
+++ toolchains-1.7.2/sources/GNU/binutils/create-2.37-copy-osabi-patch/binutils-2.37-new/bfd/elf.c (revision 348)
@@ -0,0 +1,13184 @@
+/* ELF executable support for BFD.
+
+ Copyright (C) 1993-2021 Free Software Foundation, Inc.
+
+ This file is part of BFD, the Binary File Descriptor library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+
+/*
+SECTION
+ ELF backends
+
+ BFD support for ELF formats is being worked on.
+ Currently, the best supported back ends are for sparc and i386
+ (running svr4 or Solaris 2).
+
+ Documentation of the internals of the support code still needs
+ to be written. The code is changing quickly enough that we
+ haven't bothered yet. */
+
+/* For sparc64-cross-sparc32. */
+#define _SYSCALL32
+#include "sysdep.h"
+#include <limits.h>
+#include "bfd.h"
+#include "bfdlink.h"
+#include "libbfd.h"
+#define ARCH_SIZE 0
+#include "elf-bfd.h"
+#include "libiberty.h"
+#include "safe-ctype.h"
+#include "elf-linux-core.h"
+
+#ifdef CORE_HEADER
+#include CORE_HEADER
+#endif
+
+static int elf_sort_sections (const void *, const void *);
+static bool assign_file_positions_except_relocs (bfd *, struct bfd_link_info *);
+static bool swap_out_syms (bfd *, struct elf_strtab_hash **, int,
+ struct bfd_link_info *);
+static bool elf_parse_notes (bfd *abfd, char *buf, size_t size,
+ file_ptr offset, size_t align);
+
+/* Swap version information in and out. The version information is
+ currently size independent. If that ever changes, this code will
+ need to move into elfcode.h. */
+
+/* Swap in a Verdef structure. */
+
+void
+_bfd_elf_swap_verdef_in (bfd *abfd,
+ const Elf_External_Verdef *src,
+ Elf_Internal_Verdef *dst)
+{
+ dst->vd_version = H_GET_16 (abfd, src->vd_version);
+ dst->vd_flags = H_GET_16 (abfd, src->vd_flags);
+ dst->vd_ndx = H_GET_16 (abfd, src->vd_ndx);
+ dst->vd_cnt = H_GET_16 (abfd, src->vd_cnt);
+ dst->vd_hash = H_GET_32 (abfd, src->vd_hash);
+ dst->vd_aux = H_GET_32 (abfd, src->vd_aux);
+ dst->vd_next = H_GET_32 (abfd, src->vd_next);
+}
+
+/* Swap out a Verdef structure. */
+
+void
+_bfd_elf_swap_verdef_out (bfd *abfd,
+ const Elf_Internal_Verdef *src,
+ Elf_External_Verdef *dst)
+{
+ H_PUT_16 (abfd, src->vd_version, dst->vd_version);
+ H_PUT_16 (abfd, src->vd_flags, dst->vd_flags);
+ H_PUT_16 (abfd, src->vd_ndx, dst->vd_ndx);
+ H_PUT_16 (abfd, src->vd_cnt, dst->vd_cnt);
+ H_PUT_32 (abfd, src->vd_hash, dst->vd_hash);
+ H_PUT_32 (abfd, src->vd_aux, dst->vd_aux);
+ H_PUT_32 (abfd, src->vd_next, dst->vd_next);
+}
+
+/* Swap in a Verdaux structure. */
+
+void
+_bfd_elf_swap_verdaux_in (bfd *abfd,
+ const Elf_External_Verdaux *src,
+ Elf_Internal_Verdaux *dst)
+{
+ dst->vda_name = H_GET_32 (abfd, src->vda_name);
+ dst->vda_next = H_GET_32 (abfd, src->vda_next);
+}
+
+/* Swap out a Verdaux structure. */
+
+void
+_bfd_elf_swap_verdaux_out (bfd *abfd,
+ const Elf_Internal_Verdaux *src,
+ Elf_External_Verdaux *dst)
+{
+ H_PUT_32 (abfd, src->vda_name, dst->vda_name);
+ H_PUT_32 (abfd, src->vda_next, dst->vda_next);
+}
+
+/* Swap in a Verneed structure. */
+
+void
+_bfd_elf_swap_verneed_in (bfd *abfd,
+ const Elf_External_Verneed *src,
+ Elf_Internal_Verneed *dst)
+{
+ dst->vn_version = H_GET_16 (abfd, src->vn_version);
+ dst->vn_cnt = H_GET_16 (abfd, src->vn_cnt);
+ dst->vn_file = H_GET_32 (abfd, src->vn_file);
+ dst->vn_aux = H_GET_32 (abfd, src->vn_aux);
+ dst->vn_next = H_GET_32 (abfd, src->vn_next);
+}
+
+/* Swap out a Verneed structure. */
+
+void
+_bfd_elf_swap_verneed_out (bfd *abfd,
+ const Elf_Internal_Verneed *src,
+ Elf_External_Verneed *dst)
+{
+ H_PUT_16 (abfd, src->vn_version, dst->vn_version);
+ H_PUT_16 (abfd, src->vn_cnt, dst->vn_cnt);
+ H_PUT_32 (abfd, src->vn_file, dst->vn_file);
+ H_PUT_32 (abfd, src->vn_aux, dst->vn_aux);
+ H_PUT_32 (abfd, src->vn_next, dst->vn_next);
+}
+
+/* Swap in a Vernaux structure. */
+
+void
+_bfd_elf_swap_vernaux_in (bfd *abfd,
+ const Elf_External_Vernaux *src,
+ Elf_Internal_Vernaux *dst)
+{
+ dst->vna_hash = H_GET_32 (abfd, src->vna_hash);
+ dst->vna_flags = H_GET_16 (abfd, src->vna_flags);
+ dst->vna_other = H_GET_16 (abfd, src->vna_other);
+ dst->vna_name = H_GET_32 (abfd, src->vna_name);
+ dst->vna_next = H_GET_32 (abfd, src->vna_next);
+}
+
+/* Swap out a Vernaux structure. */
+
+void
+_bfd_elf_swap_vernaux_out (bfd *abfd,
+ const Elf_Internal_Vernaux *src,
+ Elf_External_Vernaux *dst)
+{
+ H_PUT_32 (abfd, src->vna_hash, dst->vna_hash);
+ H_PUT_16 (abfd, src->vna_flags, dst->vna_flags);
+ H_PUT_16 (abfd, src->vna_other, dst->vna_other);
+ H_PUT_32 (abfd, src->vna_name, dst->vna_name);
+ H_PUT_32 (abfd, src->vna_next, dst->vna_next);
+}
+
+/* Swap in a Versym structure. */
+
+void
+_bfd_elf_swap_versym_in (bfd *abfd,
+ const Elf_External_Versym *src,
+ Elf_Internal_Versym *dst)
+{
+ dst->vs_vers = H_GET_16 (abfd, src->vs_vers);
+}
+
+/* Swap out a Versym structure. */
+
+void
+_bfd_elf_swap_versym_out (bfd *abfd,
+ const Elf_Internal_Versym *src,
+ Elf_External_Versym *dst)
+{
+ H_PUT_16 (abfd, src->vs_vers, dst->vs_vers);
+}
+
+/* Standard ELF hash function. Do not change this function; you will
+ cause invalid hash tables to be generated. */
+
+unsigned long
+bfd_elf_hash (const char *namearg)
+{
+ const unsigned char *name = (const unsigned char *) namearg;
+ unsigned long h = 0;
+ unsigned long g;
+ int ch;
+
+ while ((ch = *name++) != '\0')
+ {
+ h = (h << 4) + ch;
+ if ((g = (h & 0xf0000000)) != 0)
+ {
+ h ^= g >> 24;
+ /* The ELF ABI says `h &= ~g', but this is equivalent in
+ this case and on some machines one insn instead of two. */
+ h ^= g;
+ }
+ }
+ return h & 0xffffffff;
+}
+
+/* DT_GNU_HASH hash function. Do not change this function; you will
+ cause invalid hash tables to be generated. */
+
+unsigned long
+bfd_elf_gnu_hash (const char *namearg)
+{
+ const unsigned char *name = (const unsigned char *) namearg;
+ unsigned long h = 5381;
+ unsigned char ch;
+
+ while ((ch = *name++) != '\0')
+ h = (h << 5) + h + ch;
+ return h & 0xffffffff;
+}
+
+/* Create a tdata field OBJECT_SIZE bytes in length, zeroed out and with
+ the object_id field of an elf_obj_tdata field set to OBJECT_ID. */
+bool
+bfd_elf_allocate_object (bfd *abfd,
+ size_t object_size,
+ enum elf_target_id object_id)
+{
+ BFD_ASSERT (object_size >= sizeof (struct elf_obj_tdata));
+ abfd->tdata.any = bfd_zalloc (abfd, object_size);
+ if (abfd->tdata.any == NULL)
+ return false;
+
+ elf_object_id (abfd) = object_id;
+ if (abfd->direction != read_direction)
+ {
+ struct output_elf_obj_tdata *o = bfd_zalloc (abfd, sizeof *o);
+ if (o == NULL)
+ return false;
+ elf_tdata (abfd)->o = o;
+ elf_program_header_size (abfd) = (bfd_size_type) -1;
+ }
+ return true;
+}
+
+
+bool
+bfd_elf_make_object (bfd *abfd)
+{
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ return bfd_elf_allocate_object (abfd, sizeof (struct elf_obj_tdata),
+ bed->target_id);
+}
+
+bool
+bfd_elf_mkcorefile (bfd *abfd)
+{
+ /* I think this can be done just like an object file. */
+ if (!abfd->xvec->_bfd_set_format[(int) bfd_object] (abfd))
+ return false;
+ elf_tdata (abfd)->core = bfd_zalloc (abfd, sizeof (*elf_tdata (abfd)->core));
+ return elf_tdata (abfd)->core != NULL;
+}
+
+char *
+bfd_elf_get_str_section (bfd *abfd, unsigned int shindex)
+{
+ Elf_Internal_Shdr **i_shdrp;
+ bfd_byte *shstrtab = NULL;
+ file_ptr offset;
+ bfd_size_type shstrtabsize;
+
+ i_shdrp = elf_elfsections (abfd);
+ if (i_shdrp == 0
+ || shindex >= elf_numsections (abfd)
+ || i_shdrp[shindex] == 0)
+ return NULL;
+
+ shstrtab = i_shdrp[shindex]->contents;
+ if (shstrtab == NULL)
+ {
+ /* No cached one, attempt to read, and cache what we read. */
+ offset = i_shdrp[shindex]->sh_offset;
+ shstrtabsize = i_shdrp[shindex]->sh_size;
+
+ /* Allocate and clear an extra byte at the end, to prevent crashes
+ in case the string table is not terminated. */
+ if (shstrtabsize + 1 <= 1
+ || bfd_seek (abfd, offset, SEEK_SET) != 0
+ || (shstrtab = _bfd_alloc_and_read (abfd, shstrtabsize + 1,
+ shstrtabsize)) == NULL)
+ {
+ /* Once we've failed to read it, make sure we don't keep
+ trying. Otherwise, we'll keep allocating space for
+ the string table over and over. */
+ i_shdrp[shindex]->sh_size = 0;
+ }
+ else
+ shstrtab[shstrtabsize] = '\0';
+ i_shdrp[shindex]->contents = shstrtab;
+ }
+ return (char *) shstrtab;
+}
+
+char *
+bfd_elf_string_from_elf_section (bfd *abfd,
+ unsigned int shindex,
+ unsigned int strindex)
+{
+ Elf_Internal_Shdr *hdr;
+
+ if (strindex == 0)
+ return "";
+
+ if (elf_elfsections (abfd) == NULL || shindex >= elf_numsections (abfd))
+ return NULL;
+
+ hdr = elf_elfsections (abfd)[shindex];
+
+ if (hdr->contents == NULL)
+ {
+ if (hdr->sh_type != SHT_STRTAB && hdr->sh_type < SHT_LOOS)
+ {
+ /* PR 17512: file: f057ec89. */
+ /* xgettext:c-format */
+ _bfd_error_handler (_("%pB: attempt to load strings from"
+ " a non-string section (number %d)"),
+ abfd, shindex);
+ return NULL;
+ }
+
+ if (bfd_elf_get_str_section (abfd, shindex) == NULL)
+ return NULL;
+ }
+ else
+ {
+ /* PR 24273: The string section's contents may have already
+ been loaded elsewhere, eg because a corrupt file has the
+ string section index in the ELF header pointing at a group
+ section. So be paranoid, and test that the last byte of
+ the section is zero. */
+ if (hdr->sh_size == 0 || hdr->contents[hdr->sh_size - 1] != 0)
+ return NULL;
+ }
+
+ if (strindex >= hdr->sh_size)
+ {
+ unsigned int shstrndx = elf_elfheader(abfd)->e_shstrndx;
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%pB: invalid string offset %u >= %" PRIu64 " for section `%s'"),
+ abfd, strindex, (uint64_t) hdr->sh_size,
+ (shindex == shstrndx && strindex == hdr->sh_name
+ ? ".shstrtab"
+ : bfd_elf_string_from_elf_section (abfd, shstrndx, hdr->sh_name)));
+ return NULL;
+ }
+
+ return ((char *) hdr->contents) + strindex;
+}
+
+/* Read and convert symbols to internal format.
+ SYMCOUNT specifies the number of symbols to read, starting from
+ symbol SYMOFFSET. If any of INTSYM_BUF, EXTSYM_BUF or EXTSHNDX_BUF
+ are non-NULL, they are used to store the internal symbols, external
+ symbols, and symbol section index extensions, respectively.
+ Returns a pointer to the internal symbol buffer (malloced if necessary)
+ or NULL if there were no symbols or some kind of problem. */
+
+Elf_Internal_Sym *
+bfd_elf_get_elf_syms (bfd *ibfd,
+ Elf_Internal_Shdr *symtab_hdr,
+ size_t symcount,
+ size_t symoffset,
+ Elf_Internal_Sym *intsym_buf,
+ void *extsym_buf,
+ Elf_External_Sym_Shndx *extshndx_buf)
+{
+ Elf_Internal_Shdr *shndx_hdr;
+ void *alloc_ext;
+ const bfd_byte *esym;
+ Elf_External_Sym_Shndx *alloc_extshndx;
+ Elf_External_Sym_Shndx *shndx;
+ Elf_Internal_Sym *alloc_intsym;
+ Elf_Internal_Sym *isym;
+ Elf_Internal_Sym *isymend;
+ const struct elf_backend_data *bed;
+ size_t extsym_size;
+ size_t amt;
+ file_ptr pos;
+
+ if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
+ abort ();
+
+ if (symcount == 0)
+ return intsym_buf;
+
+ /* Normal syms might have section extension entries. */
+ shndx_hdr = NULL;
+ if (elf_symtab_shndx_list (ibfd) != NULL)
+ {
+ elf_section_list * entry;
+ Elf_Internal_Shdr **sections = elf_elfsections (ibfd);
+
+ /* Find an index section that is linked to this symtab section. */
+ for (entry = elf_symtab_shndx_list (ibfd); entry != NULL; entry = entry->next)
+ {
+ /* PR 20063. */
+ if (entry->hdr.sh_link >= elf_numsections (ibfd))
+ continue;
+
+ if (sections[entry->hdr.sh_link] == symtab_hdr)
+ {
+ shndx_hdr = & entry->hdr;
+ break;
+ };
+ }
+
+ if (shndx_hdr == NULL)
+ {
+ if (symtab_hdr == & elf_symtab_hdr (ibfd))
+ /* Not really accurate, but this was how the old code used to work. */
+ shndx_hdr = & elf_symtab_shndx_list (ibfd)->hdr;
+ /* Otherwise we do nothing. The assumption is that
+ the index table will not be needed. */
+ }
+ }
+
+ /* Read the symbols. */
+ alloc_ext = NULL;
+ alloc_extshndx = NULL;
+ alloc_intsym = NULL;
+ bed = get_elf_backend_data (ibfd);
+ extsym_size = bed->s->sizeof_sym;
+ if (_bfd_mul_overflow (symcount, extsym_size, &amt))
+ {
+ bfd_set_error (bfd_error_file_too_big);
+ intsym_buf = NULL;
+ goto out;
+ }
+ pos = symtab_hdr->sh_offset + symoffset * extsym_size;
+ if (extsym_buf == NULL)
+ {
+ alloc_ext = bfd_malloc (amt);
+ extsym_buf = alloc_ext;
+ }
+ if (extsym_buf == NULL
+ || bfd_seek (ibfd, pos, SEEK_SET) != 0
+ || bfd_bread (extsym_buf, amt, ibfd) != amt)
+ {
+ intsym_buf = NULL;
+ goto out;
+ }
+
+ if (shndx_hdr == NULL || shndx_hdr->sh_size