1 diff --git a/ChangeLog b/ChangeLog
2 index cb9124e..9740c89 100644
6 +2015-10-27 Ludovic Courtès <ludo@gnu.org>
8 + * locale/loadlocale.c (_nl_intern_locale_data): Change assertion
9 + on CNT to a conditional jump to 'puntdata'.
11 +2015-08-18 Alan Modra <amodra@gmail.com>
14 + * sysdeps/hppa/start.S [SHARED]: Use .section .data.rel.ro and define
16 + (_start): Load %dp via .Lp__global.
17 + [!SHARED]: Use .section .rodata.
19 +2015-08-09 John David Anglin <danglin@gcc.gnu.org>
22 + * sysdeps/unix/sysv/linux/hppa/sysdep.h (LOAD_ARGS_0, LOAD_ARGS_1,
23 + LOAD_ARGS_2, LOAD_ARGS_3, LOAD_ARGS_4, LOAD_ARGS_5, LOAD_ARGS_6):
25 + (LOAD_REGS_0, LOAD_REGS_1, LOAD_REGS_2, LOAD_REGS_3, LOAD_REGS_4,
26 + LOAD_REGS_5, LOAD_REGS_6): Update.
27 + (INTERNAL_SYSCALL): Update using new LOAD defines.
28 + (INTERNAL_SYSCALL_NCS): Likewise.
29 + * sysdeps/unix/sysv/linux/hppa/syscall.c (syscall): Likewise.
31 +2015-09-26 Paul Pluzhnikov <ppluzhnikov@google.com>
34 + * time/strftime_l.c (a_wkday, f_wkday, a_month, f_month): Range check.
35 + (__strftime_internal): Likewise.
36 + * time/tst-strftime.c (do_bz18985): New test.
39 +2015-08-08 Paul Pluzhnikov <ppluzhnikov@google.com>
42 + * catgets/Makefile (tst-catgets-mem): New test.
43 + * catgets/catgets.c (catopen): Don't use unbounded alloca.
44 + * catgets/open_catalog.c (__open_catalog): Likewise.
45 + * catgets/tst-catgets.c (do_bz17905): Test unbounded alloca.
47 +2015-12-31 Aurelien Jarno <aurelien@aurel32.net>
49 + * sysdeps/unix/sysv/linux/alpha/libc.abilist [GLIBC_2.22]: Move
50 + to keep the file sorted.
51 + * sysdeps/unix/sysv/linux/hppa/libc.abilist [GLIBC_2.22]: Likewise.
53 +2015-12-17 Paul E. Murphy <murphyp@linux.vnet.ibm.com>
56 + * sysdeps/powerpc/nptl/elide.h (__elide_lock): Fix usage of
57 + .skip_lock_out_of_tbegin_retries.
58 + * sysdeps/unix/sysv/linux/powerpc/elision-lock.c
59 + (__lll_lock_elision): Likewise, and respect a value of
62 +2015-12-03 Andrew Senkevich <andrew.senkevich@intel.com>
64 + * math/Makefile ($(inst_libdir)/libm.so): Corrected path to
67 +2015-11-27 Andrew Senkevich <andrew.senkevich@intel.com>
70 + * math/Makefile ($(inst_libdir)/libm.so): Added libmvec_nonshared.a to
72 + * sysdeps/x86/fpu/bits/math-vector.h: Removed code with asm aliases
74 + * sysdeps/x86_64/fpu/Makefile (libmvec-support,
75 + libmvec-static-only-routines): Added new file.
76 + * sysdeps/x86_64/fpu/svml_finite_alias.S: New file.
77 + * NEWS: Mention this fix.
79 +2015-11-20 Roland McGrath <roland@hack.frob.com>
81 + * sysdeps/nacl/dl-map-segments.h (_dl_map_segments): Use
82 + __glibc_likely instead of __builtin_expect. After falling back to
83 + dyncode_create in a non-ET_DYN case, use the allocate_code_data
84 + system interface to register the code pages as occupied.
86 +2015-11-14 H.J. Lu <hongjiu.lu@intel.com>
88 + * config.make.in (have-glob-dat-reloc): New.
89 + * configure.ac (libc_cv_has_glob_dat): New. Set to yes if
90 + target supports GLOB_DAT relocaton. AC_SUBST.
91 + * configure: Regenerated.
92 + * elf/Makefile (tests): Add tst-prelink.
93 + (tests-special): Add $(objpfx)tst-prelink-cmp.out.
94 + (tst-prelink-ENV): New.
95 + ($(objpfx)tst-prelink-conflict.out): Likewise.
96 + ($(objpfx)tst-prelink-cmp.out): Likewise.
97 + * sysdeps/x86/tst-prelink.c: Moved to ...
98 + * elf/tst-prelink.c: Here.
99 + * sysdeps/x86/tst-prelink.exp: Moved to ...
100 + * elf/tst-prelink.exp: Here.
101 + * sysdeps/x86/Makefile (tests): Don't add tst-prelink.
102 + (tst-prelink-ENV): Removed.
103 + ($(objpfx)tst-prelink-conflict.out): Likewise.
104 + ($(objpfx)tst-prelink-cmp.out): Likewise.
105 + (tests-special): Don't add $(objpfx)tst-prelink-cmp.out.
107 +2015-11-10 Roland McGrath <roland@hack.frob.com>
109 + * elf/dl-load.c (open_verify): Take new argument FD.
110 + Skip __open call if passed FD is not -1.
111 + (_dl_map_object, open_path): Update callers.
112 + * elf/dl-sysdep-open.h: New file.
113 + * elf/dl-load.c: Include it.
114 + (_dl_map_object): Try _dl_sysdep_open_object before ldconfig cache.
115 + * sysdeps/nacl/dl-sysdep.c (_dl_sysdep_open_object): New function.
116 + * sysdeps/nacl/dl-sysdep-open.h: New file.
117 + * sysdeps/nacl/nacl-interface-list.h: Move nacl_irt_resource_open
120 +2015-11-10 H.J. Lu <hongjiu.lu@intel.com>
123 + * sysdeps/x86/Makefile (tests): Add tst-prelink.
124 + (tst-prelink-ENV): New.
125 + ($(objpfx)tst-prelink-conflict.out): Likewise.
126 + ($(objpfx)tst-prelink-cmp.out): Likewise.
127 + (tests-special): Add $(objpfx)tst-prelink-cmp.out.
128 + * sysdeps/x86/tst-prelink.c: New file.
129 + * sysdeps/x86/tst-prelink.exp: Likewise.
131 +2015-11-07 H.J. Lu <hongjiu.lu@intel.com>
134 + * elf/dl-lookup.c (RTYPE_CLASS_VALID): New.
135 + (RTYPE_CLASS_PLT): Likewise.
136 + (RTYPE_CLASS_COPY): Likewise.
137 + (RTYPE_CLASS_TLS): Likewise.
138 + (_dl_debug_bindings): Use RTYPE_CLASS_TLS and RTYPE_CLASS_VALID
139 + to set relocation type class for DL_DEBUG_PRELINK. Keep only
140 + ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY bits for
143 +2015-10-20 Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
146 + * sysdeps/powerpc/nptl/elide.h (__elide_lock): Move most of this
148 + (ELIDE_LOCK): ...here.
149 + (__get_new_count): New function with part of the code from
150 + __elide_lock that updates the value of adapt_count after a
152 + (__elided_trylock): Moved this code to...
153 + (ELIDE_TRYLOCK): ...here.
155 +2015-10-06 Florian Weimer <fweimer@redhat.com>
158 + * stdlib/cxa_thread_atexit_impl.c (__cxa_thread_atexit_impl):
159 + Mangle function pointer before storing it.
160 + (__call_tls_dtors): Demangle function pointer before calling it.
162 +2015-10-15 Florian Weimer <fweimer@redhat.com>
165 + * sysdeps/generic/ldsodefs.h (struct rtld_global_ro): Remove
166 + _dl_pointer_guard member.
167 + * elf/rtld.c (_rtld_global_ro): Remove _dl_pointer_guard
169 + (security_init): Always set up pointer guard.
170 + (process_envvars): Do not process LD_POINTER_GUARD.
172 +2015-10-09 Carlos O'Donell <carlos@redhat.com>
175 + * string/bug-strcoll2.c: Adjust copyright, and remove contributed by.
176 + * string/Makefile ($(objpfx)bug-strcoll2.out): Depend on
179 +2015-10-08 Carlos O'Donell <carlos@redhat.com>
182 + * string/Makefile (tests): Add bug-strcoll2.
183 + (LOCALES): Add cs_CZ.UTF-8.
185 +2015-09-28 Martin Sebor <msebor@redhat.com>
188 + * string/Makefile (LOCALES): Define.
189 + (gen-locales.mk): Include.
190 + (test-strcasecmp.out, test-strncasecmp.out, tst-strxfrm.out)
191 + (tst-strxfrm2.out): Add deppendency on $(gen-locales).
192 + * string/tst-strxfrm2.c (do_test): Print the name of the locale
193 + on setlocale failure.
195 +2015-10-08 Carlos O'Donell <carlos@redhat.com>
198 + * string/bug-strcoll2.c: New file.
199 + * locale/categories.def: Revert commit
200 + f13c2a8dff2329c6692a80176262ceaaf8a6f74e.
201 + * locale/langinfo.h: Likewise.
202 + * locale/localeinfo.h: Likewise.
203 + * locale/C-collate.c: Likewise.
204 + * programs/ld-collate.c (collate_output): Likewise.
205 + * string/strcoll_l.c (STRDIFF): Likewise.
206 + (STRCOLL): Likewise.
207 + * wcsmbs/wcscoll_l.c: Likewise.
209 +2015-09-15 Roland McGrath <roland@hack.frob.com>
211 + * misc/sys/param.h [!MAXHOSTNAMELEN && HOST_NAME_MAX]
212 + (MAXHOSTNAMELEN): Define it to HOST_NAME_MAX.
214 +2015-09-11 Roland McGrath <roland@hack.frob.com>
216 + * sysdeps/nacl/Makefile [$(subdir) = misc] (sysdep_headers):
217 + Use 'override' keyword to freeze the value here, preventing
218 + the addition of sys/mtio.h by sysdeps/gnu/Makefile.
220 +2015-09-04 Roland McGrath <roland@hack.frob.com>
223 + * sysdeps/posix/opendir.c (need_isdir_precheck) [O_DIRECTORY]:
224 + Fix inverted sense of test of 'o_directory_works' value.
225 + Reported by Pádraig Brady <P@draigBrady.com>, diagnosed by
226 + Bernhard Voelker <mail@bernhard-voelker.de>.
228 +2015-08-31 Brett Neumeier <brett@neumeier.us>
231 + * sysdeps/sparc/sparc32/sem_open.c: Add missing #include
233 +2015-08-28 Mike Frysinger <vapier@gentoo.org>
236 + * misc/Makefile (tests): Add tst-mntent-blank-corrupt and
237 + tst-mntent-blank-passno.
238 + * misc/mntent_r.c (__getmntent_r): Do not read past buffer[0].
239 + * misc/tst-mntent-blank-corrupt.c: New test.
240 + * misc/tst-mntent-blank-passno.c: New test ripped from ...
241 + * misc/tst-mntent.c (do_test): ... here.
243 +2015-08-25 Roland McGrath <roland@hack.frob.com>
245 + * sysdeps/nacl/start.c (_start): Call __nacl_main instead of main
246 + if the weak reference is not null.
248 +2015-08-19 Andrew Senkevich <andrew.senkevich@intel.com>
251 + * scripts/test-installation.pl: Don't add -lmvec to build options
252 + if libmvec wasn't built.
253 + * NEWS: Mention this fix.
255 +2015-08-10 Maxim Ostapenko <m.ostapenko@partner.samsung.com>
258 + * elf/Makefile (tests): Add Add tst-nodelete2.
259 + (modules-names): Add tst-nodelete2mod.
260 + (tst-nodelete2mod.so-no-z-defs): New.
261 + ($(objpfx)tst-nodelete2): Likewise.
262 + ($(objpfx)tst-nodelete2.out): Likewise.
263 + (LDFLAGS-tst-nodelete2): Likewise.
264 + * elf/dl-close.c (_dl_close_worker): Move DF_1_NODELETE clearing
265 + out of loop through all loaded libraries.
266 + * elf/tst-nodelete2.c: New file.
267 + * elf/tst-nodelete2mod.c: Likewise.
269 +2015-08-10 Andreas Schwab <schwab@suse.de>
272 + * sysdeps/unix/sysv/linux/openat.c (__OPENAT) [MORE_OFLAGS]: Add
273 + MORE_OFLAGS to oflag.
274 + * io/test-lfs.c (do_test): Test openat64.
276 +2015-08-08 John David Anglin <danglin@gcc.gnu.org>
279 + * sysdeps/unix/sysv/linux/hppa/bits/atomic.h (_LWS_CLOBBER): Revise
281 + (atomic_compare_and_exchange_val_acq): Use register asms to assign
282 + operand registers. Use register %r20 for EAGAIN and EDEADLOCK checks.
283 + Cast return to __typeof (oldval).
285 +2015-08-08 Mike Frysinger <vapier@gentoo.org>
287 + * sysdeps/unix/sysv/linux/microblaze/sysdep.h: Wrap the whole file
288 + in _LINUX_MICROBLAZE_SYSDEP_H defines. Include sysdeps/unix/sysdep.h
289 + and delete sys/syscall.h include.
291 +2015-08-07 Mike Frysinger <vapier@gentoo.org>
293 + * sysdeps/hppa/dl-symaddr.c (_dl_symbol_address): Add rtld_hidden_def.
295 +2015-08-05 Zack Weinberg <zackw@panix.com>
297 + * misc/regexp.h: Update comments.
299 2015-08-05 Carlos O'Donell <carlos@systemhalted.org>
301 * version.h (RELEASE): Set to "stable".
302 diff --git a/NEWS b/NEWS
303 index 4c31de7..99e68d2 100644
306 @@ -5,6 +5,16 @@ See the end for copying conditions.
307 Please send GNU C library bug reports via <http://sourceware.org/bugzilla/>
308 using `glibc' in the "product" field.
312 +* The following bugs are resolved with this release:
314 + 17905, 18421, 18480, 18589, 18743, 18778, 18781, 18787, 18796, 18870,
315 + 18887, 18921, 18928, 18969, 18985, 19018, 19058, 19174, 19178.
317 +* The LD_POINTER_GUARD environment variable can no longer be used to
318 + disable the pointer guard feature. It is always enabled.
322 * The following bugs are resolved with this release:
323 @@ -84,7 +94,7 @@ Version 2.22
324 release. Use of this header will trigger a deprecation warning.
325 Application developers should update their code to use <regex.h> instead.
327 - This header was formerly part of SUSv2, but was deprecated in 1997 and
328 + This header was formerly part of SUS, but was deprecated in 1994 and
329 removed from the standard in 2001. Also, the glibc implementation
330 leaks memory. See BZ#18681 for more details.
332 diff --git a/catgets/Makefile b/catgets/Makefile
333 index 4624a88..56de38b 100644
334 --- a/catgets/Makefile
335 +++ b/catgets/Makefile
336 @@ -34,6 +34,7 @@ test-srcs = test-gencat
337 ifeq ($(run-built-tests),yes)
338 tests-special += $(objpfx)de/libc.cat $(objpfx)test1.cat $(objpfx)test2.cat \
339 $(objpfx)sample.SJIS.cat $(objpfx)test-gencat.out
340 +tests-special += $(objpfx)tst-catgets-mem.out
343 gencat-modules = xmalloc
344 @@ -50,9 +51,11 @@ catgets-CPPFLAGS := -DNLSPATH='"$(msgcatdir)/%L/%N:$(msgcatdir)/%L/LC_MESSAGES/%
346 generated += de.msg test1.cat test1.h test2.cat test2.h sample.SJIS.cat \
348 +generated += tst-catgets.mtrace tst-catgets-mem.out
352 -tst-catgets-ENV = NLSPATH="$(objpfx)%l/%N.cat" LANG=de
353 +tst-catgets-ENV = NLSPATH="$(objpfx)%l/%N.cat" LANG=de MALLOC_TRACE=$(objpfx)tst-catgets.mtrace
355 ifeq ($(run-built-tests),yes)
356 # This test just checks whether the program produces any error or not.
357 @@ -86,4 +89,8 @@ $(objpfx)test-gencat.out: test-gencat.sh $(objpfx)test-gencat \
358 $(objpfx)sample.SJIS.cat: sample.SJIS $(objpfx)gencat
359 $(built-program-cmd) -H $(objpfx)test-gencat.h < $(word 1,$^) > $@; \
362 +$(objpfx)tst-catgets-mem.out: $(objpfx)tst-catgets.out
363 + $(common-objpfx)malloc/mtrace $(objpfx)tst-catgets.mtrace > $@; \
366 diff --git a/catgets/catgets.c b/catgets/catgets.c
367 index cf93d56..4be452d 100644
368 --- a/catgets/catgets.c
369 +++ b/catgets/catgets.c
371 License along with the GNU C Library; if not, see
372 <http://www.gnu.org/licenses/>. */
377 #include <nl_types.h>
378 @@ -35,6 +34,7 @@ catopen (const char *cat_name, int flag)
380 const char *env_var = NULL;
381 const char *nlspath = NULL;
384 if (strchr (cat_name, '/') == NULL)
386 @@ -54,7 +54,10 @@ catopen (const char *cat_name, int flag)
388 /* Append the system dependent directory. */
389 size_t len = strlen (nlspath) + 1 + sizeof NLSPATH;
390 - char *tmp = alloca (len);
391 + tmp = malloc (len);
393 + if (__glibc_unlikely (tmp == NULL))
394 + return (nl_catd) -1;
396 __stpcpy (__stpcpy (__stpcpy (tmp, nlspath), ":"), NLSPATH);
398 @@ -65,16 +68,18 @@ catopen (const char *cat_name, int flag)
400 result = (__nl_catd) malloc (sizeof (*result));
402 - /* We cannot get enough memory. */
403 - return (nl_catd) -1;
405 - if (__open_catalog (cat_name, nlspath, env_var, result) != 0)
407 + /* We cannot get enough memory. */
408 + result = (nl_catd) -1;
410 + else if (__open_catalog (cat_name, nlspath, env_var, result) != 0)
412 /* Couldn't open the file. */
413 free ((void *) result);
414 - return (nl_catd) -1;
415 + result = (nl_catd) -1;
419 return (nl_catd) result;
422 diff --git a/catgets/open_catalog.c b/catgets/open_catalog.c
423 index e069416..9f4d776 100644
424 --- a/catgets/open_catalog.c
425 +++ b/catgets/open_catalog.c
426 @@ -47,6 +47,7 @@ __open_catalog (const char *cat_name, const char *nlspath, const char *env_var,
432 if (strchr (cat_name, '/') != NULL || nlspath == NULL)
433 fd = open_not_cancel_2 (cat_name, O_RDONLY);
434 @@ -57,23 +58,23 @@ __open_catalog (const char *cat_name, const char *nlspath, const char *env_var,
435 if (__glibc_unlikely (bufact + (n) >= bufmax)) \
437 char *old_buf = buf; \
438 - bufmax += 256 + (n); \
439 - buf = (char *) alloca (bufmax); \
440 - memcpy (buf, old_buf, bufact); \
441 + bufmax += (bufmax < 256 + (n)) ? 256 + (n) : bufmax; \
442 + buf = realloc (buf, bufmax); \
443 + if (__glibc_unlikely (buf == NULL)) \
450 /* The RUN_NLSPATH variable contains a colon separated list of
451 descriptions where we expect to find catalogs. We have to
452 recognize certain % substitutions and stop when we found the
453 first existing file. */
464 while (*run_nlspath != '\0')
466 @@ -188,7 +189,10 @@ __open_catalog (const char *cat_name, const char *nlspath, const char *env_var,
468 /* Avoid dealing with directories and block devices */
469 if (__builtin_expect (fd, 0) < 0)
476 if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) < 0)
477 goto close_unlock_return;
478 @@ -325,6 +329,7 @@ __open_catalog (const char *cat_name, const char *nlspath, const char *env_var,
479 /* Release the lock again. */
481 close_not_cancel_no_status (fd);
486 diff --git a/catgets/tst-catgets.c b/catgets/tst-catgets.c
487 index a0a4089..0886938 100644
488 --- a/catgets/tst-catgets.c
489 +++ b/catgets/tst-catgets.c
493 #include <nl_types.h>
497 +#include <sys/resource.h>
500 static const char *msgs[] =
501 @@ -12,6 +15,33 @@ static const char *msgs[] =
503 #define nmsgs (sizeof (msgs) / sizeof (msgs[0]))
506 +/* Test for unbounded alloca. */
514 + const int sz = 1024 * 1024;
516 + getrlimit (RLIMIT_STACK, &rl);
518 + setrlimit (RLIMIT_STACK, &rl);
520 + buf = malloc (sz + 1);
521 + memset (buf, 'A', sz);
523 + setenv ("NLSPATH", buf, 1);
525 + result = catopen (buf, NL_CAT_LOCALE);
526 + assert (result == (nl_catd) -1);
535 @@ -62,6 +92,7 @@ do_test (void)
539 + result += do_bz17905 ();
543 diff --git a/config.make.in b/config.make.in
544 index a9f5696..46cd9bb 100644
547 @@ -51,6 +51,7 @@ have-z-combreloc = @libc_cv_z_combreloc@
548 have-z-execstack = @libc_cv_z_execstack@
549 have-Bgroup = @libc_cv_Bgroup@
550 have-protected-data = @libc_cv_protected_data@
551 +have-glob-dat-reloc = @libc_cv_has_glob_dat@
553 old-glibc-headers = @old_glibc_headers@
554 unwind-find-fde = @libc_cv_gcc_unwind_find_fde@
555 diff --git a/configure b/configure
556 index 45cc7cb..4f87b31 100755
559 @@ -628,6 +628,7 @@ gnu89_inline
562 libc_cv_output_format
563 +libc_cv_has_glob_dat
567 @@ -6335,6 +6336,39 @@ $as_echo "$libc_cv_use_default_link" >&6; }
568 use_default_link=$libc_cv_use_default_link
571 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLOB_DAT reloc" >&5
572 +$as_echo_n "checking for GLOB_DAT reloc... " >&6; }
573 +if ${libc_cv_has_glob_dat+:} false; then :
574 + $as_echo_n "(cached) " >&6
576 + cat > conftest.c <<EOF
578 +int foo (void) { return mumble; }
580 +if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
581 + -fPIC -shared -o conftest.so conftest.c
582 + -nostdlib -nostartfiles
584 + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
585 + (eval $ac_try) 2>&5
587 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
588 + test $ac_status = 0; }; }
590 + if $READELF -rW conftest.so | grep '_GLOB_DAT' > /dev/null; then
591 + libc_cv_has_glob_dat=yes
593 + libc_cv_has_glob_dat=no
596 + libc_cv_has_glob_dat=no
600 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_has_glob_dat" >&5
601 +$as_echo "$libc_cv_has_glob_dat" >&6; }
604 { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker output format" >&5
605 $as_echo_n "checking linker output format... " >&6; }
606 if ${libc_cv_output_format+:} false; then :
607 diff --git a/configure.ac b/configure.ac
608 index 7e9383a..8be612d 100644
611 @@ -1535,6 +1535,29 @@ $ac_try"
612 use_default_link=$libc_cv_use_default_link
615 +AC_CACHE_CHECK(for GLOB_DAT reloc,
616 + libc_cv_has_glob_dat, [dnl
617 +cat > conftest.c <<EOF
619 +int foo (void) { return mumble; }
621 +if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
622 + -fPIC -shared -o conftest.so conftest.c
623 + -nostdlib -nostartfiles
624 + 1>&AS_MESSAGE_LOG_FD])
626 +dnl look for GLOB_DAT relocation.
627 + if $READELF -rW conftest.so | grep '_GLOB_DAT' > /dev/null; then
628 + libc_cv_has_glob_dat=yes
630 + libc_cv_has_glob_dat=no
633 + libc_cv_has_glob_dat=no
636 +AC_SUBST(libc_cv_has_glob_dat)
638 AC_CACHE_CHECK(linker output format, libc_cv_output_format, [dnl
639 if libc_cv_output_format=`
640 ${CC-cc} -nostartfiles -nostdlib -Wl,--print-output-format 2>&AS_MESSAGE_LOG_FD`
641 diff --git a/elf/Makefile b/elf/Makefile
642 index 4ceeaf8..a2c43bc 100644
645 @@ -148,7 +148,8 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
646 tst-unique1 tst-unique2 $(if $(CXX),tst-unique3 tst-unique4 \
648 tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \
649 - tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened
650 + tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \
653 ifeq ($(build-hardcoded-path-in-tests),yes)
654 tests += tst-dlopen-aout
655 @@ -218,7 +219,7 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
657 tst-relsort1mod1 tst-relsort1mod2 tst-array2dep \
658 tst-array5dep tst-null-argv-lib \
659 - tst-tlsalign-lib tst-nodelete-opened-lib
660 + tst-tlsalign-lib tst-nodelete-opened-lib tst-nodelete2mod
661 ifeq (yes,$(have-protected-data))
662 modules-names += tst-protected1moda tst-protected1modb
663 tests += tst-protected1a tst-protected1b
664 @@ -292,6 +293,13 @@ check-abi: $(objpfx)check-abi-ld.out
665 tests-special += $(objpfx)check-abi-ld.out
666 update-abi: update-abi-ld
668 +ifeq ($(have-glob-dat-reloc),yes)
669 +tests += tst-prelink
670 +ifeq ($(run-built-tests),yes)
671 +tests-special += $(objpfx)tst-prelink-cmp.out
677 ifeq (yes,$(build-shared))
678 @@ -594,6 +602,7 @@ tst-auditmod9b.so-no-z-defs = yes
679 tst-nodelete-uniquemod.so-no-z-defs = yes
680 tst-nodelete-rtldmod.so-no-z-defs = yes
681 tst-nodelete-zmod.so-no-z-defs = yes
682 +tst-nodelete2mod.so-no-z-defs = yes
684 ifeq ($(build-shared),yes)
685 # Build all the modules even when not actually running test programs.
686 @@ -1164,6 +1173,11 @@ $(objpfx)tst-nodelete.out: $(objpfx)tst-nodelete-uniquemod.so \
687 LDFLAGS-tst-nodelete = -rdynamic
688 LDFLAGS-tst-nodelete-zmod.so = -Wl,--enable-new-dtags,-z,nodelete
690 +$(objpfx)tst-nodelete2: $(libdl)
691 +$(objpfx)tst-nodelete2.out: $(objpfx)tst-nodelete2mod.so
693 +LDFLAGS-tst-nodelete2 = -rdynamic
695 $(objpfx)tst-initorder-cmp.out: tst-initorder.exp $(objpfx)tst-initorder.out
698 @@ -1205,3 +1219,13 @@ $(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so
699 $(objpfx)tst-unused-dep-cmp.out: $(objpfx)tst-unused-dep.out
700 cmp $< /dev/null > $@; \
703 +tst-prelink-ENV = LD_TRACE_PRELINKING=1
705 +$(objpfx)tst-prelink-conflict.out: $(objpfx)tst-prelink.out
706 + grep stdout $< | grep conflict | $(AWK) '{ print $$10, $$11 }' > $@
708 +$(objpfx)tst-prelink-cmp.out: tst-prelink.exp \
709 + $(objpfx)tst-prelink-conflict.out
712 diff --git a/elf/dl-close.c b/elf/dl-close.c
713 index 9105277..c897247 100644
716 @@ -144,6 +144,14 @@ _dl_close_worker (struct link_map *map, bool force)
718 struct link_map *maps[nloaded];
720 + /* Clear DF_1_NODELETE to force object deletion. We don't need to touch
721 + l_tls_dtor_count because forced object deletion only happens when an
722 + error occurs during object load. Destructor registration for TLS
723 + non-POD objects should not have happened till then for this
726 + map->l_flags_1 &= ~DF_1_NODELETE;
728 /* Run over the list and assign indexes to the link maps and enter
729 them into the MAPS array. */
731 @@ -153,13 +161,6 @@ _dl_close_worker (struct link_map *map, bool force)
735 - /* Clear DF_1_NODELETE to force object deletion. We don't need to touch
736 - l_tls_dtor_count because forced object deletion only happens when an
737 - error occurs during object load. Destructor registration for TLS
738 - non-POD objects should not have happened till then for this
741 - l->l_flags_1 &= ~DF_1_NODELETE;
743 assert (idx == nloaded);
745 diff --git a/elf/dl-load.c b/elf/dl-load.c
746 index 0c052e4..7e6f4c5 100644
750 #include <dl-map-segments.h>
751 #include <dl-unmap-segments.h>
752 #include <dl-machine-reject-phdr.h>
753 +#include <dl-sysdep-open.h>
757 @@ -1471,9 +1472,13 @@ print_search_path (struct r_search_path_elem **list,
758 ignore only ELF files for other architectures. Non-ELF files and
759 ELF files with different header information cause fatal errors since
760 this could mean there is something wrong in the installation and the
761 - user might want to know about this. */
762 + user might want to know about this.
764 + If FD is not -1, then the file is already open and FD refers to it.
765 + In that case, FD is consumed for both successful and error returns. */
767 -open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
768 +open_verify (const char *name, int fd,
769 + struct filebuf *fbp, struct link_map *loader,
770 int whatcode, int mode, bool *found_other_class, bool free_name)
772 /* This is the expected ELF header. */
773 @@ -1514,6 +1519,7 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
774 if (__glibc_unlikely (GLRO(dl_naudit) > 0) && whatcode != 0
775 && loader->l_auditing == 0)
777 + const char *original_name = name;
778 struct audit_ifaces *afct = GLRO(dl_audit);
779 for (unsigned int cnt = 0; cnt < GLRO(dl_naudit); ++cnt)
781 @@ -1528,11 +1534,21 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
786 + if (fd != -1 && name != original_name && strcmp (name, original_name))
788 + /* An audit library changed what we're supposed to open,
789 + so FD no longer matches it. */
796 - /* Open the file. We always open files read-only. */
797 - int fd = __open (name, O_RDONLY | O_CLOEXEC);
799 + /* Open the file. We always open files read-only. */
800 + fd = __open (name, O_RDONLY | O_CLOEXEC);
805 @@ -1801,7 +1817,7 @@ open_path (const char *name, size_t namelen, int mode,
806 if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
807 _dl_debug_printf (" trying file=%s\n", buf);
809 - fd = open_verify (buf, fbp, loader, whatcode, mode,
810 + fd = open_verify (buf, -1, fbp, loader, whatcode, mode,
811 found_other_class, false);
812 if (this_dir->status[cnt] == unknown)
814 @@ -2041,6 +2057,20 @@ _dl_map_object (struct link_map *loader, const char *name,
815 &loader->l_runpath_dirs, &realname, &fb, loader,
816 LA_SER_RUNPATH, &found_other_class);
820 + realname = _dl_sysdep_open_object (name, namelen, &fd);
821 + if (realname != NULL)
823 + fd = open_verify (realname, fd,
824 + &fb, loader ?: GL(dl_ns)[nsid]._ns_loaded,
825 + LA_SER_CONFIG, mode, &found_other_class,
834 && (__glibc_likely ((mode & __RTLD_SECURE) == 0)
835 @@ -2086,7 +2116,7 @@ _dl_map_object (struct link_map *loader, const char *name,
839 - fd = open_verify (cached,
840 + fd = open_verify (cached, -1,
841 &fb, loader ?: GL(dl_ns)[nsid]._ns_loaded,
842 LA_SER_CONFIG, mode, &found_other_class,
844 @@ -2121,7 +2151,7 @@ _dl_map_object (struct link_map *loader, const char *name,
848 - fd = open_verify (realname, &fb,
849 + fd = open_verify (realname, -1, &fb,
850 loader ?: GL(dl_ns)[nsid]._ns_loaded, 0, mode,
851 &found_other_class, true);
852 if (__glibc_unlikely (fd == -1))
853 diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
854 index 11cb44b..acf5280 100644
855 --- a/elf/dl-lookup.c
856 +++ b/elf/dl-lookup.c
857 @@ -1016,6 +1016,18 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
859 if (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
861 +/* ELF_RTYPE_CLASS_XXX must match RTYPE_CLASS_XXX used by prelink with
862 + LD_TRACE_PRELINKING. */
863 +#define RTYPE_CLASS_VALID 8
864 +#define RTYPE_CLASS_PLT (8|1)
865 +#define RTYPE_CLASS_COPY (8|2)
866 +#define RTYPE_CLASS_TLS (8|4)
867 +#if ELF_RTYPE_CLASS_PLT != 0 && ELF_RTYPE_CLASS_PLT != 1
868 +# error ELF_RTYPE_CLASS_PLT must be 0 or 1!
870 +#if ELF_RTYPE_CLASS_COPY != 0 && ELF_RTYPE_CLASS_COPY != 2
871 +# error ELF_RTYPE_CLASS_COPY must be 0 or 2!
874 struct sym_val val = { NULL, NULL };
876 @@ -1071,12 +1083,17 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
880 + /* Keep only ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY
881 + bits since since prelink only uses them. */
882 + type_class &= ELF_RTYPE_CLASS_PLT | ELF_RTYPE_CLASS_COPY;
883 if (__glibc_unlikely (ELFW(ST_TYPE) (value->s->st_info)
886 + /* Clear the RTYPE_CLASS_VALID bit in RTYPE_CLASS_TLS. */
887 + type_class = RTYPE_CLASS_TLS & ~RTYPE_CLASS_VALID;
888 else if (__glibc_unlikely (ELFW(ST_TYPE) (value->s->st_info)
891 + /* Set the RTYPE_CLASS_VALID bit. */
892 + type_class |= RTYPE_CLASS_VALID;
896 diff --git a/elf/dl-sysdep-open.h b/elf/dl-sysdep-open.h
898 index 0000000..a63d9f5
900 +++ b/elf/dl-sysdep-open.h
902 +/* System-specific call to open a shared object by name. Stub version.
903 + Copyright (C) 2015 Free Software Foundation, Inc.
904 + This file is part of the GNU C Library.
906 + The GNU C Library is free software; you can redistribute it and/or
907 + modify it under the terms of the GNU Lesser General Public
908 + License as published by the Free Software Foundation; either
909 + version 2.1 of the License, or (at your option) any later version.
911 + The GNU C Library is distributed in the hope that it will be useful,
912 + but WITHOUT ANY WARRANTY; without even the implied warranty of
913 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
914 + Lesser General Public License for more details.
916 + You should have received a copy of the GNU Lesser General Public
917 + License along with the GNU C Library; if not, see
918 + <http://www.gnu.org/licenses/>. */
920 +#ifndef _DL_SYSDEP_OPEN_H
921 +#define _DL_SYSDEP_OPEN_H 1
926 +/* NAME is a name without slashes, as it appears in a DT_NEEDED entry
927 + or a dlopen call's argument or suchlike. NAMELEN is (strlen (NAME) + 1).
929 + Find NAME in an OS-dependent fashion, and return its "real" name.
930 + Optionally fill in *FD with a file descriptor open on that file (or
931 + else leave its initial value of -1). The return value is a new
932 + malloc'd string, which will be free'd by the caller. If NAME is
933 + resolved to an actual file that can be opened, then the return
934 + value should name that file (and if *FD was not set, then a normal
935 + __open call on that string will be made). If *FD was set by some
936 + other means than a normal open and there is no "real" name to use,
937 + then __strdup (NAME) is fine (modulo error checking). */
939 +static inline char *
940 +_dl_sysdep_open_object (const char *name, size_t namelen, int *fd)
942 + assert (*fd == -1);
946 +#endif /* dl-sysdep-open.h */
947 diff --git a/elf/rtld.c b/elf/rtld.c
948 index 69873c2..07e741c 100644
951 @@ -162,7 +162,6 @@ struct rtld_global_ro _rtld_global_ro attribute_relro =
952 ._dl_hwcap_mask = HWCAP_IMPORTANT,
954 ._dl_fpu_control = _FPU_DEFAULT,
955 - ._dl_pointer_guard = 1,
956 ._dl_pagesize = EXEC_PAGESIZE,
957 ._dl_inhibit_cache = 0,
959 @@ -709,15 +708,12 @@ security_init (void)
962 /* Set up the pointer guard as well, if necessary. */
963 - if (GLRO(dl_pointer_guard))
965 - uintptr_t pointer_chk_guard = _dl_setup_pointer_guard (_dl_random,
967 + uintptr_t pointer_chk_guard
968 + = _dl_setup_pointer_guard (_dl_random, stack_chk_guard);
969 #ifdef THREAD_SET_POINTER_GUARD
970 - THREAD_SET_POINTER_GUARD (pointer_chk_guard);
971 + THREAD_SET_POINTER_GUARD (pointer_chk_guard);
973 - __pointer_chk_guard_local = pointer_chk_guard;
975 + __pointer_chk_guard_local = pointer_chk_guard;
977 /* We do not need the _dl_random value anymore. The less
978 information we leave behind, the better, so clear the
979 @@ -2471,9 +2467,6 @@ process_envvars (enum mode *modep)
980 GLRO(dl_use_load_bias) = envline[14] == '1' ? -1 : 0;
984 - if (memcmp (envline, "POINTER_GUARD", 13) == 0)
985 - GLRO(dl_pointer_guard) = envline[14] != '0';
989 diff --git a/elf/tst-nodelete2.c b/elf/tst-nodelete2.c
991 index 0000000..388e8af
993 +++ b/elf/tst-nodelete2.c
995 +#include "../dlfcn/dlfcn.h"
998 +#include <gnu/lib-names.h>
1005 + printf ("\nOpening pthread library.\n");
1006 + void *pthread = dlopen (LIBPTHREAD_SO, RTLD_LAZY);
1008 + /* This is a test for correct DF_1_NODELETE clearing when dlopen failure
1009 + happens. We should clear DF_1_NODELETE for failed library only, because
1010 + doing this for others (e.g. libpthread) might cause them to be unloaded,
1011 + that may lead to some global references (e.g. __rtld_lock_unlock) to be
1012 + broken. The dlopen should fail because of undefined symbols in shared
1013 + library, that cause DF_1_NODELETE to be cleared. For libpthread, this
1014 + flag should be set, because if not, SIGSEGV will happen in dlclose. */
1015 + if (dlopen ("tst-nodelete2mod.so", RTLD_NOW) != NULL)
1017 + printf ("Unique symbols test failed\n");
1022 + dlclose (pthread);
1025 + printf ("SUCCESS\n");
1030 +#define TEST_FUNCTION do_test ()
1031 +#include "../test-skeleton.c"
1032 diff --git a/elf/tst-nodelete2mod.c b/elf/tst-nodelete2mod.c
1033 new file mode 100644
1034 index 0000000..e88c756
1036 +++ b/elf/tst-nodelete2mod.c
1038 +/* Undefined symbol. */
1039 +extern int not_exist (void);
1043 + return not_exist ();
1045 diff --git a/elf/tst-prelink.c b/elf/tst-prelink.c
1046 new file mode 100644
1047 index 0000000..ab61c4e
1049 +++ b/elf/tst-prelink.c
1051 +/* Test the output from the environment variable, LD_TRACE_PRELINKING,
1053 + Copyright (C) 2015 Free Software Foundation, Inc.
1054 + This file is part of the GNU C Library.
1056 + The GNU C Library is free software; you can redistribute it and/or
1057 + modify it under the terms of the GNU Lesser General Public
1058 + License as published by the Free Software Foundation; either
1059 + version 2.1 of the License, or (at your option) any later version.
1061 + The GNU C Library is distributed in the hope that it will be useful,
1062 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1063 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1064 + Lesser General Public License for more details.
1066 + You should have received a copy of the GNU Lesser General Public
1067 + License along with the GNU C Library; if not, see
1068 + <http://www.gnu.org/licenses/>. */
1075 + fprintf (stdout, "hello\n");
1079 +#define TEST_FUNCTION do_test ()
1080 +#include "../test-skeleton.c"
1081 diff --git a/elf/tst-prelink.exp b/elf/tst-prelink.exp
1082 new file mode 100644
1083 index 0000000..b35b4c9
1085 +++ b/elf/tst-prelink.exp
1088 diff --git a/elf/tst-znodelete-zlib.cc b/elf/tst-znodelete-zlib.cc
1089 deleted file mode 100644
1090 index 1e8f368..0000000
1091 --- a/elf/tst-znodelete-zlib.cc
1094 -extern int not_exist (void);
1098 - return not_exist ();
1100 diff --git a/io/test-lfs.c b/io/test-lfs.c
1101 index 539c2a2..b6ebae4 100644
1104 @@ -144,7 +144,7 @@ test_ftello (void)
1106 do_test (int argc, char *argv[])
1110 struct stat64 statbuf;
1112 ret = lseek64 (fd, TWO_GB+100, SEEK_SET);
1113 @@ -195,6 +195,25 @@ do_test (int argc, char *argv[])
1114 error (EXIT_FAILURE, 0, "stat reported size %lld instead of %lld.",
1115 (long long int) statbuf.st_size, (TWO_GB + 100 + 5));
1117 + fd2 = openat64 (AT_FDCWD, name, O_RDWR);
1120 + if (errno == ENOSYS)
1122 + /* Silently ignore this test. */
1123 + error (0, 0, "openat64 is not supported");
1126 + error (EXIT_FAILURE, errno, "openat64 failed to open big file");
1130 + ret = close (fd2);
1133 + error (EXIT_FAILURE, errno, "error closing file");
1139 diff --git a/locale/C-collate.c b/locale/C-collate.c
1140 index d7f3c55..06dfdfa 100644
1141 --- a/locale/C-collate.c
1142 +++ b/locale/C-collate.c
1143 @@ -144,8 +144,6 @@ const struct __locale_data _nl_C_LC_COLLATE attribute_hidden =
1144 /* _NL_COLLATE_COLLSEQWC */
1145 { .string = (const char *) collseqwc },
1146 /* _NL_COLLATE_CODESET */
1147 - { .string = _nl_C_codeset },
1148 - /* _NL_COLLATE_ENCODING_TYPE */
1149 - { .word = __cet_8bit }
1150 + { .string = _nl_C_codeset }
1153 diff --git a/locale/categories.def b/locale/categories.def
1154 index 045489d..a8dda53 100644
1155 --- a/locale/categories.def
1156 +++ b/locale/categories.def
1157 @@ -58,7 +58,6 @@ DEFINE_CATEGORY
1158 DEFINE_ELEMENT (_NL_COLLATE_COLLSEQMB, "collate-collseqmb", std, wstring)
1159 DEFINE_ELEMENT (_NL_COLLATE_COLLSEQWC, "collate-collseqwc", std, wstring)
1160 DEFINE_ELEMENT (_NL_COLLATE_CODESET, "collate-codeset", std, string)
1161 - DEFINE_ELEMENT (_NL_COLLATE_ENCODING_TYPE, "collate-encoding-type", std, word)
1165 diff --git a/locale/langinfo.h b/locale/langinfo.h
1166 index ffc5c7f..a565d9d 100644
1167 --- a/locale/langinfo.h
1168 +++ b/locale/langinfo.h
1169 @@ -255,7 +255,6 @@ enum
1170 _NL_COLLATE_COLLSEQMB,
1171 _NL_COLLATE_COLLSEQWC,
1172 _NL_COLLATE_CODESET,
1173 - _NL_COLLATE_ENCODING_TYPE,
1176 /* LC_CTYPE category: character classification.
1177 diff --git a/locale/loadlocale.c b/locale/loadlocale.c
1178 index fdba6e9..dcbb833 100644
1179 --- a/locale/loadlocale.c
1180 +++ b/locale/loadlocale.c
1181 @@ -121,9 +121,10 @@ _nl_intern_locale_data (int category, const void *data, size_t datasize)
1184 #define CATTEST(cat) \
1186 - assert (cnt < (sizeof (_nl_value_type_LC_##cat) \
1187 - / sizeof (_nl_value_type_LC_##cat[0]))); \
1189 + if (cnt >= (sizeof (_nl_value_type_LC_##cat) \
1190 + / sizeof (_nl_value_type_LC_##cat[0]))) \
1195 diff --git a/locale/localeinfo.h b/locale/localeinfo.h
1196 index bdab9fe..1d2ee00 100644
1197 --- a/locale/localeinfo.h
1198 +++ b/locale/localeinfo.h
1199 @@ -110,14 +110,6 @@ enum coll_sort_rule
1203 -/* Collation encoding type. */
1204 -enum collation_encoding_type
1211 /* We can map the types of the entries into a few categories. */
1214 diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
1215 index a39a94f..dc0fe30 100644
1216 --- a/locale/programs/ld-collate.c
1217 +++ b/locale/programs/ld-collate.c
1219 #include "linereader.h"
1220 #include "locfile.h"
1221 #include "elem-hash.h"
1222 -#include "../localeinfo.h"
1224 /* Uncomment the following line in the production version. */
1225 /* #define NDEBUG 1 */
1226 @@ -2131,8 +2130,6 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
1227 /* The words have to be handled specially. */
1228 if (idx == _NL_ITEM_INDEX (_NL_COLLATE_SYMB_HASH_SIZEMB))
1229 add_locale_uint32 (&file, 0);
1230 - else if (idx == _NL_ITEM_INDEX (_NL_COLLATE_ENCODING_TYPE))
1231 - add_locale_uint32 (&file, __cet_other);
1233 add_locale_empty (&file);
1235 @@ -2496,12 +2493,6 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
1236 add_locale_raw_data (&file, collate->mbseqorder, 256);
1237 add_locale_collseq_table (&file, &collate->wcseqorder);
1238 add_locale_string (&file, charmap->code_set_name);
1239 - if (strcmp (charmap->code_set_name, "UTF-8") == 0)
1240 - add_locale_uint32 (&file, __cet_utf8);
1241 - else if (charmap->mb_cur_max == 1)
1242 - add_locale_uint32 (&file, __cet_8bit);
1244 - add_locale_uint32 (&file, __cet_other);
1245 write_locale_data (output_path, LC_COLLATE, "LC_COLLATE", &file);
1247 obstack_free (&weightpool, NULL);
1248 diff --git a/math/Makefile b/math/Makefile
1249 index 6388bae..2c9d72d 100644
1252 @@ -98,7 +98,7 @@ $(inst_libdir)/libm.so: $(common-objpfx)format.lds \
1253 (echo '/* GNU ld script'; echo '*/';\
1255 echo 'GROUP ( $(slibdir)/libm.so$(libm.so-version) ' \
1256 - 'AS_NEEDED ( $(slibdir)/libmvec.so$(libmvec.so-version) ) )' \
1257 + 'AS_NEEDED ( $(libdir)/libmvec_nonshared.a $(slibdir)/libmvec.so$(libmvec.so-version) ) )' \
1261 diff --git a/misc/Makefile b/misc/Makefile
1262 index aecb0da..2f5edf6 100644
1265 @@ -76,7 +76,8 @@ install-lib := libg.a
1266 gpl2lgpl := error.c error.h
1268 tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \
1269 - tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1
1270 + tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1 \
1271 + tst-mntent-blank-corrupt tst-mntent-blank-passno
1272 ifeq ($(run-built-tests),yes)
1273 tests-special += $(objpfx)tst-error1-mem.out
1275 diff --git a/misc/mntent_r.c b/misc/mntent_r.c
1276 index 6159873..4f26998 100644
1277 --- a/misc/mntent_r.c
1278 +++ b/misc/mntent_r.c
1279 @@ -136,7 +136,9 @@ __getmntent_r (FILE *stream, struct mntent *mp, char *buffer, int bufsiz)
1280 end_ptr = strchr (buffer, '\n');
1281 if (end_ptr != NULL) /* chop newline */
1283 - while (end_ptr[-1] == ' ' || end_ptr[-1] == '\t')
1284 + /* Do not walk past the start of buffer if it's all whitespace. */
1285 + while (end_ptr != buffer
1286 + && (end_ptr[-1] == ' ' || end_ptr[-1] == '\t'))
1290 diff --git a/misc/regexp.h b/misc/regexp.h
1291 index 3460989..42394f7 100644
1298 -/* The contents of this header file were standardized in the
1299 - Single Unix Specification, Version 2 (1997) but marked as
1300 - LEGACY; new applications were already being encouraged to
1301 - use <regex.h> instead. POSIX.1-2001 removed this header.
1302 +/* The contents of this header file were originally standardized in
1303 + the Single Unix Specification, Issue 3 (1992). In Issue 4 (1994)
1304 + the header was marked as TO BE WITHDRAWN, and new applications
1305 + were encouraged to use <regex.h> instead. It was officially
1306 + withdrawn from the standard in Issue 6 (aka POSIX.1-2001).
1308 This header is provided only for backward compatibility.
1309 It will be removed in the next release of the GNU C Library.
1310 diff --git a/misc/sys/param.h b/misc/sys/param.h
1311 index 62b7ed2..1908b93 100644
1312 --- a/misc/sys/param.h
1313 +++ b/misc/sys/param.h
1315 #if !defined NOFILE && defined OPEN_MAX
1316 # define NOFILE OPEN_MAX
1318 +#if !defined MAXHOSTNAMELEN && defined HOST_NAME_MAX
1319 +# define MAXHOSTNAMELEN HOST_NAME_MAX
1323 # define NCARGS ARG_MAX
1324 diff --git a/misc/tst-mntent-blank-corrupt.c b/misc/tst-mntent-blank-corrupt.c
1325 new file mode 100644
1326 index 0000000..92266a3
1328 +++ b/misc/tst-mntent-blank-corrupt.c
1330 +/* Make sure blank lines does not cause memory corruption BZ #18887.
1332 + Copyright (C) 2009-2015 Free Software Foundation, Inc.
1333 + This file is part of the GNU C Library.
1335 + The GNU C Library is free software; you can redistribute it and/or
1336 + modify it under the terms of the GNU Lesser General Public
1337 + License as published by the Free Software Foundation; either
1338 + version 2.1 of the License, or (at your option) any later version.
1340 + The GNU C Library is distributed in the hope that it will be useful,
1341 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1342 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1343 + Lesser General Public License for more details.
1345 + You should have received a copy of the GNU Lesser General Public
1346 + License along with the GNU C Library; if not, see
1347 + <http://www.gnu.org/licenses/>. */
1349 +#include <mntent.h>
1351 +#include <string.h>
1353 +/* Make sure blank lines don't trigger memory corruption. This doesn't happen
1354 + for all targets though, so it's a best effort test BZ #18887. */
1361 + fputs ("\n \n/foo\\040dir /bar\\040dir auto bind \t \n", fp);
1364 + /* The corruption happens here ... */
1366 + /* ... but trigers here. */
1369 + /* If the test failed, we would crash, and not hit this point. */
1373 +#define TEST_FUNCTION do_test ()
1374 +#include "../test-skeleton.c"
1375 diff --git a/misc/tst-mntent-blank-passno.c b/misc/tst-mntent-blank-passno.c
1376 new file mode 100644
1377 index 0000000..fc04291
1379 +++ b/misc/tst-mntent-blank-passno.c
1381 +/* Make sure trailing whitespace is handled properly BZ #17273.
1383 + Copyright (C) 2009-2015 Free Software Foundation, Inc.
1384 + This file is part of the GNU C Library.
1386 + The GNU C Library is free software; you can redistribute it and/or
1387 + modify it under the terms of the GNU Lesser General Public
1388 + License as published by the Free Software Foundation; either
1389 + version 2.1 of the License, or (at your option) any later version.
1391 + The GNU C Library is distributed in the hope that it will be useful,
1392 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1393 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1394 + Lesser General Public License for more details.
1396 + You should have received a copy of the GNU Lesser General Public
1397 + License along with the GNU C Library; if not, see
1398 + <http://www.gnu.org/licenses/>. */
1400 +#include <mntent.h>
1402 +#include <string.h>
1404 +/* Check entries to make sure trailing whitespace is ignored and we return the
1405 + correct passno value BZ #17273. */
1411 + struct mntent *mnt;
1414 + fputs ("/foo\\040dir /bar\\040dir auto bind \t \n", fp);
1417 + mnt = getmntent (fp);
1418 + if (strcmp (mnt->mnt_fsname, "/foo dir") != 0
1419 + || strcmp (mnt->mnt_dir, "/bar dir") != 0
1420 + || strcmp (mnt->mnt_type, "auto") != 0
1421 + || strcmp (mnt->mnt_opts, "bind") != 0
1422 + || mnt->mnt_freq != 0
1423 + || mnt->mnt_passno != 0)
1425 + puts ("Error while reading entry with trailing whitespaces");
1432 +#define TEST_FUNCTION do_test ()
1433 +#include "../test-skeleton.c"
1434 diff --git a/misc/tst-mntent.c b/misc/tst-mntent.c
1435 index 876c89f..820b354 100644
1436 --- a/misc/tst-mntent.c
1437 +++ b/misc/tst-mntent.c
1438 @@ -73,26 +73,6 @@ main (int argc, char *argv[])
1439 puts ("Error while reading written entry back in");
1443 - /* Part III: Entry with whitespaces at the end of a line. */
1446 - fputs ("/foo\\040dir /bar\\040dir auto bind \t \n", fp);
1450 - mnt = getmntent (fp);
1452 - if (strcmp (mnt->mnt_fsname, "/foo dir") != 0
1453 - || strcmp (mnt->mnt_dir, "/bar dir") != 0
1454 - || strcmp (mnt->mnt_type, "auto") != 0
1455 - || strcmp (mnt->mnt_opts, "bind") != 0
1456 - || mnt->mnt_freq != 0
1457 - || mnt->mnt_passno != 0)
1459 - puts ("Error while reading entry with trailing whitespaces");
1465 diff --git a/scripts/test-installation.pl b/scripts/test-installation.pl
1466 index cac1562..79b2b3e 100755
1467 --- a/scripts/test-installation.pl
1468 +++ b/scripts/test-installation.pl
1469 @@ -80,16 +80,25 @@ arglist: while (@ARGV) {
1470 # We expect none or one argument.
1472 $soversions="soversions.mk";
1473 + $config="config.make";
1474 } elsif ($#ARGV == 0) {
1476 $soversions = "$ARGV[0]/soversions.mk";
1477 + $config = "$ARGV[0]/config.make";
1479 - $soversions = $ARGV[0];
1480 + $soversions = $dir = $ARGV[0];
1481 + $dir =~ s!/?[^/]*/*$!!;
1482 + $config = $dir . "/config.make";
1485 die "Wrong number of arguments.";
1488 +if (system ("grep -q \"build-mathvec = yes\" $config") == 0) {
1489 + $build_mathvec = 1;
1491 + $build_mathvec = 0;
1494 # Read names and versions of all shared libraries that are part of
1496 @@ -111,6 +120,8 @@ while (<SOVERSIONS>) {
1497 # - libthread_db since it contains unresolved references
1498 # - it's just a test NSS module
1499 # - We don't provide the libgcc so we don't test it
1500 + # - libmvec if it wasn't built
1501 + next if ($build_mathvec == 0 && $name eq "mvec");
1502 if ($name ne "nss_ldap" && $name ne "db1"
1503 && !($name =~/^nss1_/) && $name ne "thread_db"
1504 && $name ne "nss_test1" && $name ne "libgcc_s") {
1505 diff --git a/stdlib/cxa_thread_atexit_impl.c b/stdlib/cxa_thread_atexit_impl.c
1506 index 2d5d56a..5717f09 100644
1507 --- a/stdlib/cxa_thread_atexit_impl.c
1508 +++ b/stdlib/cxa_thread_atexit_impl.c
1509 @@ -98,6 +98,10 @@ static __thread struct link_map *lm_cache;
1511 __cxa_thread_atexit_impl (dtor_func func, void *obj, void *dso_symbol)
1514 + PTR_MANGLE (func);
1518 struct dtor_list *new = calloc (1, sizeof (struct dtor_list));
1520 @@ -142,9 +146,13 @@ __call_tls_dtors (void)
1521 while (tls_dtor_list)
1523 struct dtor_list *cur = tls_dtor_list;
1524 + dtor_func func = cur->func;
1525 +#ifdef PTR_DEMANGLE
1526 + PTR_DEMANGLE (func);
1529 tls_dtor_list = tls_dtor_list->next;
1530 - cur->func (cur->obj);
1533 /* Ensure that the MAP dereference happens before
1534 l_tls_dtor_count decrement. That way, we protect this access from a
1535 diff --git a/string/Makefile b/string/Makefile
1536 index 8424a61..ebe9354 100644
1537 --- a/string/Makefile
1538 +++ b/string/Makefile
1539 @@ -54,7 +54,7 @@ tests := tester inl-tester noinl-tester testcopy test-ffs \
1540 tst-strtok tst-strxfrm bug-strcoll1 tst-strfry \
1541 bug-strtok1 $(addprefix test-,$(strop-tests)) \
1542 bug-envz1 tst-strxfrm2 tst-endian tst-svc2 \
1544 + tst-strtok_r bug-strcoll2
1546 xtests = tst-strcoll-overflow
1548 @@ -75,4 +75,17 @@ ifeq ($(run-built-tests),yes)
1549 $(objpfx)tst-svc-cmp.out: tst-svc.expect $(objpfx)tst-svc.out
1553 +LOCALES := de_DE.UTF-8 en_US.ISO-8859-1 en_US.UTF-8 \
1554 + tr_TR.ISO-8859-9 tr_TR.UTF-8 cs_CZ.UTF-8 \
1556 +include ../gen-locales.mk
1558 +$(objpfx)test-strcasecmp.out: $(gen-locales)
1559 +$(objpfx)test-strncasecmp.out: $(gen-locales)
1560 +$(objpfx)tst-strxfrm.out: $(gen-locales)
1561 +$(objpfx)tst-strxfrm2.out: $(gen-locales)
1562 +# bug-strcoll2 needs cs_CZ.UTF-8 and da_DK.ISO-8859-1.
1563 +$(objpfx)bug-strcoll2.out: $(gen-locales)
1566 diff --git a/string/bug-strcoll2.c b/string/bug-strcoll2.c
1567 new file mode 100644
1568 index 0000000..72a9ff2
1570 +++ b/string/bug-strcoll2.c
1572 +/* Bug 18589: sort-test.sh fails at random.
1573 + Copyright (C) 2015 Free Software Foundation, Inc.
1574 + This file is part of the GNU C Library.
1576 + The GNU C Library is free software; you can redistribute it and/or
1577 + modify it under the terms of the GNU Lesser General Public
1578 + License as published by the Free Software Foundation; either
1579 + version 2.1 of the License, or (at your option) any later version.
1581 + The GNU C Library is distributed in the hope that it will be useful,
1582 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1583 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1584 + Lesser General Public License for more details.
1586 + You should have received a copy of the GNU Lesser General Public
1587 + License along with the GNU C Library; if not, see
1588 + <http://www.gnu.org/licenses/>. */
1591 +#include <string.h>
1592 +#include <locale.h>
1594 +/* An incorrect strcoll optimization resulted in incorrect
1595 + results from strcoll for cs_CZ and da_DK. */
1600 + const char t1[] = "config";
1601 + const char t2[] = "choose";
1602 + if (setlocale (LC_ALL, "cs_CZ.UTF-8") == NULL)
1604 + perror ("setlocale");
1607 + /* In Czech the digraph ch sorts after c, therefore we expect
1608 + config to sort before choose. */
1609 + int a = strcoll (t1, t2);
1610 + int b = strcoll (t2, t1);
1611 + printf ("strcoll (\"%s\", \"%s\") = %d\n", t1, t2, a);
1612 + printf ("strcoll (\"%s\", \"%s\") = %d\n", t2, t1, b);
1613 + if (a < 0 && b > 0)
1615 + puts ("PASS: config < choose");
1620 + puts ("FAIL: Wrong sorting in cs_CZ.UTF-8.");
1628 + const char t1[] = "AS";
1629 + const char t2[] = "AA";
1630 + if (setlocale (LC_ALL, "da_DK.ISO-8859-1") == NULL)
1632 + perror ("setlocale");
1635 + /* AA should be treated as the last letter of the Danish alphabet,
1636 + hence sorting after AS. */
1637 + int a = strcoll (t1, t2);
1638 + int b = strcoll (t2, t1);
1639 + printf ("strcoll (\"%s\", \"%s\") = %d\n", t1, t2, a);
1640 + printf ("strcoll (\"%s\", \"%s\") = %d\n", t2, t1, b);
1641 + if (a < 0 && b > 0)
1643 + puts ("PASS: AS < AA");
1648 + puts ("FAIL: Wrong sorting in da_DK.ISO-8859-1");
1657 + err |= test_cs_CZ ();
1658 + err |= test_da_DK ();
1662 +#define TEST_FUNCTION do_test ()
1663 +#include "../test-skeleton.c"
1664 diff --git a/string/strcoll_l.c b/string/strcoll_l.c
1665 index 8f1225f..35bc0e4 100644
1666 --- a/string/strcoll_l.c
1667 +++ b/string/strcoll_l.c
1669 # define STRING_TYPE char
1670 # define USTRING_TYPE unsigned char
1671 # define STRCOLL __strcoll_l
1672 -# define STRDIFF __strdiff
1673 # define STRCMP strcmp
1674 # define WEIGHT_H "../locale/weight.h"
1677 #include "../locale/localeinfo.h"
1680 -#define MASK_UTF8_7BIT (1 << 7)
1681 -#define MASK_UTF8_START (3 << 6)
1684 -STRDIFF (const STRING_TYPE *s, const STRING_TYPE *t)
1688 - for (n = 0; *s != '\0' && *s++ == *t++; ++n)
1694 /* Track status while looking for sequences in a string. */
1697 @@ -269,29 +254,9 @@ STRCOLL (const STRING_TYPE *s1, const STRING_TYPE *s2, __locale_t l)
1698 const USTRING_TYPE *extra;
1699 const int32_t *indirect;
1701 - /* In case there is no locale specific sort order (C / POSIX). */
1703 return STRCMP (s1, s2);
1705 - /* Fast forward to the position of the first difference. Needs to be
1706 - encoding aware as the byte-by-byte comparison can stop in the middle
1707 - of a char sequence for multibyte encodings like UTF-8. */
1708 - uint_fast32_t encoding =
1709 - current->values[_NL_ITEM_INDEX (_NL_COLLATE_ENCODING_TYPE)].word;
1710 - if (encoding != __cet_other)
1712 - size_t diff = STRDIFF (s1, s2);
1715 - if (encoding == __cet_utf8 && (*(s1 + diff) & MASK_UTF8_7BIT) != 0)
1718 - while (diff > 0 && (*(s1 + diff) & MASK_UTF8_START) != MASK_UTF8_START);
1724 /* Catch empty strings. */
1725 if (__glibc_unlikely (*s1 == '\0') || __glibc_unlikely (*s2 == '\0'))
1726 return (*s1 != '\0') - (*s2 != '\0');
1727 @@ -358,8 +323,7 @@ STRCOLL (const STRING_TYPE *s1, const STRING_TYPE *s2, __locale_t l)
1728 byte-level comparison to ensure that we don't waste time
1729 going through multiple passes for totally equal strings
1730 before proceeding to subsequent passes. */
1731 - if (pass == 0 && encoding == __cet_other &&
1732 - STRCMP (s1, s2) == 0)
1733 + if (pass == 0 && STRCMP (s1, s2) == 0)
1737 diff --git a/string/tst-strxfrm2.c b/string/tst-strxfrm2.c
1738 index d5a1115..bea5aa2 100644
1739 --- a/string/tst-strxfrm2.c
1740 +++ b/string/tst-strxfrm2.c
1745 + static const char test_locale[] = "de_DE.UTF-8";
1750 @@ -38,9 +40,9 @@ do_test (void)
1754 - if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL)
1755 + if (setlocale (LC_ALL, test_locale) == NULL)
1757 - puts ("setlocale failed");
1758 + printf ("cannot set locale \"%s\"\n", test_locale);
1762 diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
1763 index 7a0fe8d..78e3a97 100644
1764 --- a/sysdeps/generic/ldsodefs.h
1765 +++ b/sysdeps/generic/ldsodefs.h
1766 @@ -592,9 +592,6 @@ struct rtld_global_ro
1767 /* List of auditing interfaces. */
1768 struct audit_ifaces *_dl_audit;
1769 unsigned int _dl_naudit;
1771 - /* 0 if internal pointer values should not be guarded, 1 if they should. */
1772 - EXTERN int _dl_pointer_guard;
1774 # define __rtld_global_attribute__
1776 diff --git a/sysdeps/hppa/dl-symaddr.c b/sysdeps/hppa/dl-symaddr.c
1777 index b707c19..89d8baf 100644
1778 --- a/sysdeps/hppa/dl-symaddr.c
1779 +++ b/sysdeps/hppa/dl-symaddr.c
1780 @@ -33,3 +33,4 @@ _dl_symbol_address (struct link_map *map, const ElfW(Sym) *ref)
1782 return (void *) value;
1784 +rtld_hidden_def (_dl_symbol_address)
1785 diff --git a/sysdeps/hppa/start.S b/sysdeps/hppa/start.S
1786 index 64d8c3e..cc4f243 100644
1787 --- a/sysdeps/hppa/start.S
1788 +++ b/sysdeps/hppa/start.S
1790 /* Have the linker create plabel words so we get PLABEL32
1791 relocs and not 21/14. The use of 21/14 relocs is only
1792 supported in the latest dynamic linker. */
1795 + .section .data.rel.ro,"aw",@progbits
1797 + .section .rodata,"a",@progbits
1803 .word P%__libc_csu_fini
1805 .word P%__libc_csu_init
1813 @@ -122,10 +130,14 @@ _start:
1814 /* void *stack_end (7th argument) */
1818 + addil LT'.Lp__global, %r19
1819 + ldw RT'.Lp__global(%r1), %dp
1822 ldil L%$global$, %dp
1823 ldo R%$global$(%dp), %dp
1826 bl __libc_start_main,%r2
1828 /* die horribly if it returned (it shouldn't) */
1829 diff --git a/sysdeps/nacl/Makefile b/sysdeps/nacl/Makefile
1830 index 6749a44..1748886 100644
1831 --- a/sysdeps/nacl/Makefile
1832 +++ b/sysdeps/nacl/Makefile
1833 @@ -132,4 +132,13 @@ ifeq ($(subdir),misc)
1834 # sysdeps/.../linux/ directories, but it's still a sysdeps decision to
1836 sysdep_headers += bits/mman-linux.h
1838 +# This defeats sysdeps/gnu/Makefile's addition of sys/mtio.h, which
1839 +# we do not want. This is a total kludge, but it seems no worse for
1840 +# now than making the sysdeps/gnu/Makefile code conditional on a
1841 +# variable we set here. If some sysdeps/.../Makefile that is later
1842 +# in the list than sysdeps/gnu needed to add to sysdep_headers, this
1843 +# would break it. But sysdeps/gnu is close to last in the list and
1844 +# this coming up seems unlikely.
1845 +override sysdep_headers := $(sysdep_headers)
1847 diff --git a/sysdeps/nacl/dl-map-segments.h b/sysdeps/nacl/dl-map-segments.h
1848 index f305da3..f2d5d84 100644
1849 --- a/sysdeps/nacl/dl-map-segments.h
1850 +++ b/sysdeps/nacl/dl-map-segments.h
1851 @@ -53,7 +53,7 @@ _dl_map_segments (struct link_map *l, int fd,
1852 const size_t maplength, bool has_holes,
1853 struct link_map *loader)
1855 - if (__builtin_expect (type, ET_DYN) == ET_DYN)
1856 + if (__glibc_likely (type == ET_DYN))
1858 /* This is a position-independent shared object. Let the system
1859 choose where to place it.
1860 @@ -165,6 +165,32 @@ _dl_map_segments (struct link_map *l, int fd,
1862 return DL_MAP_SEGMENTS_ERROR_MAP_SEGMENT;
1864 + if (__glibc_unlikely (type != ET_DYN))
1866 + /* A successful PROT_EXEC mmap would have implicitly
1867 + updated the bookkeeping so that a future
1868 + allocate_code_data call would know that this range
1869 + of the address space is already occupied. That
1870 + doesn't happen implicitly with dyncode_create, so
1871 + it's necessary to do an explicit call to update the
1873 + uintptr_t allocated_address;
1874 + error = __nacl_irt_code_data_alloc.allocate_code_data
1875 + (l->l_addr + c->mapstart, len, 0, 0, &allocated_address);
1876 + if (__glibc_unlikely (error))
1879 + return DL_MAP_SEGMENTS_ERROR_MAP_SEGMENT;
1881 + if (__glibc_unlikely
1882 + (allocated_address != l->l_addr + c->mapstart))
1884 + /* This is not a very helpful error for this case,
1885 + but there isn't really anything better to use. */
1887 + return DL_MAP_SEGMENTS_ERROR_MAP_SEGMENT;
1893 diff --git a/sysdeps/nacl/dl-sysdep-open.h b/sysdeps/nacl/dl-sysdep-open.h
1894 new file mode 100644
1895 index 0000000..38b0f9e
1897 +++ b/sysdeps/nacl/dl-sysdep-open.h
1899 +/* System-specific call to open a shared object by name. NaCl version.
1900 + Copyright (C) 2015 Free Software Foundation, Inc.
1901 + This file is part of the GNU C Library.
1903 + The GNU C Library is free software; you can redistribute it and/or
1904 + modify it under the terms of the GNU Lesser General Public
1905 + License as published by the Free Software Foundation; either
1906 + version 2.1 of the License, or (at your option) any later version.
1908 + The GNU C Library is distributed in the hope that it will be useful,
1909 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1910 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1911 + Lesser General Public License for more details.
1913 + You should have received a copy of the GNU Lesser General Public
1914 + License along with the GNU C Library; if not, see
1915 + <http://www.gnu.org/licenses/>. */
1917 +#ifndef _DL_SYSDEP_OPEN_H
1918 +#define _DL_SYSDEP_OPEN_H 1
1920 +#include <stddef.h>
1922 +/* NAME is a name without slashes, as it appears in a DT_NEEDED entry
1923 + or a dlopen call's argument or suchlike. NAMELEN is (strlen (NAME) + 1).
1925 + Find NAME in an OS-dependent fashion, and return its "real" name.
1926 + Optionally fill in *FD with a file descriptor open on that file (or
1927 + else leave its initial value of -1). The return value is a new
1928 + malloc'd string, which will be free'd by the caller. If NAME is
1929 + resolved to an actual file that can be opened, then the return
1930 + value should name that file (and if *FD was not set, then a normal
1931 + __open call on that string will be made). If *FD was set by some
1932 + other means than a normal open and there is no "real" name to use,
1933 + then __strdup (NAME) is fine (modulo error checking). */
1935 +extern char *_dl_sysdep_open_object (const char *name, size_t namelen, int *fd)
1936 + internal_function attribute_hidden;
1938 +#endif /* dl-sysdep-open.h */
1939 diff --git a/sysdeps/nacl/dl-sysdep.c b/sysdeps/nacl/dl-sysdep.c
1940 index 3e902c2..3a04aa1 100644
1941 --- a/sysdeps/nacl/dl-sysdep.c
1942 +++ b/sysdeps/nacl/dl-sysdep.c
1943 @@ -87,3 +87,26 @@ _dl_start_user (void (*user_entry) (uint32_t info[]), uint32_t info[])
1946 #include <elf/dl-sysdep.c>
1948 +#include <dl-sysdep-open.h>
1949 +#include <nacl-interfaces.h>
1950 +#include <assert.h>
1951 +#include <string.h>
1952 +#include <unistd.h>
1956 +_dl_sysdep_open_object (const char *name, size_t namelen, int *fd)
1958 + int error = __nacl_irt_resource_open.open_resource (name, fd);
1961 + assert (*fd != -1);
1962 + char *realname = __strdup (name);
1963 + if (__glibc_unlikely (realname == NULL))
1970 diff --git a/sysdeps/nacl/nacl-interface-list.h b/sysdeps/nacl/nacl-interface-list.h
1971 index cb33751..c68faed 100644
1972 --- a/sysdeps/nacl/nacl-interface-list.h
1973 +++ b/sysdeps/nacl/nacl-interface-list.h
1974 @@ -28,7 +28,7 @@ NACL_MANDATORY_INTERFACE (rtld,
1975 NACL_IRT_FUTEX_v0_1, nacl_irt_futex)
1976 NACL_MANDATORY_INTERFACE (rtld,
1977 NACL_IRT_TLS_v0_1, nacl_irt_tls)
1978 -NACL_MANDATORY_INTERFACE (libc,
1979 +NACL_MANDATORY_INTERFACE (rtld,
1980 NACL_IRT_RESOURCE_OPEN_v0_1, nacl_irt_resource_open)
1981 NACL_MANDATORY_INTERFACE (rtld,
1982 NACL_IRT_CODE_DATA_ALLOC_v0_1,
1983 diff --git a/sysdeps/nacl/start.c b/sysdeps/nacl/start.c
1984 index a4b6dd3..8e8bc1a 100644
1985 --- a/sysdeps/nacl/start.c
1986 +++ b/sysdeps/nacl/start.c
1988 /* The application defines this, of course. */
1989 extern int main (int argc, char **argv, char **envp);
1991 +/* But maybe it defines this too, in which case it takes precedence. */
1992 +extern int __nacl_main (int argc, char **argv, char **envp)
1993 + __attribute__ ((weak));
1995 /* These are defined in libc. */
1996 extern int __libc_csu_init (int argc, char **argv, char **envp);
1997 extern void __libc_csu_fini (void);
1998 @@ -59,7 +63,7 @@ _start (uint32_t info[])
2000 /* The generic code actually assumes that envp follows argv. */
2002 - __libc_start_main (&main,
2003 + __libc_start_main (&__nacl_main ?: &main,
2004 nacl_startup_argc (info),
2005 nacl_startup_argv (info),
2006 nacl_startup_auxv (info),
2007 diff --git a/sysdeps/posix/opendir.c b/sysdeps/posix/opendir.c
2008 index 6509f5c..9edf056 100644
2009 --- a/sysdeps/posix/opendir.c
2010 +++ b/sysdeps/posix/opendir.c
2011 @@ -105,7 +105,7 @@ need_isdir_precheck (void)
2012 tryopen_o_directory ();
2014 /* We can skip the expensive `stat' call if O_DIRECTORY works. */
2015 - return o_directory_works > 0;
2016 + return o_directory_works < 0;
2020 diff --git a/sysdeps/powerpc/nptl/elide.h b/sysdeps/powerpc/nptl/elide.h
2021 index 389f5a5..2e1e443 100644
2022 --- a/sysdeps/powerpc/nptl/elide.h
2023 +++ b/sysdeps/powerpc/nptl/elide.h
2026 # include <elision-conf.h>
2028 -/* Returns true if the lock defined by is_lock_free as elided.
2029 - ADAPT_COUNT is a pointer to per-lock state variable. */
2031 +/* Get the new value of adapt_count according to the elision
2032 + configurations. Returns true if the system should retry again or false
2035 -__elide_lock (uint8_t *adapt_count, int is_lock_free)
2036 +__get_new_count (uint8_t *adapt_count, int attempt)
2038 - if (*adapt_count > 0)
2039 + /* A persistent failure indicates that a retry will probably
2040 + result in another failure. Use normal locking now and
2041 + for the next couple of calls. */
2042 + if (_TEXASRU_FAILURE_PERSISTENT (__builtin_get_texasru ()))
2045 + if (__elision_aconf.skip_lock_internal_abort > 0)
2046 + *adapt_count = __elision_aconf.skip_lock_internal_abort;
2050 - for (int i = __elision_aconf.try_tbegin; i > 0; i--)
2052 - if (__builtin_tbegin (0))
2056 - /* Lock was busy. */
2057 - __builtin_tabort (_ABORT_LOCK_BUSY);
2061 - /* A persistent failure indicates that a retry will probably
2062 - result in another failure. Use normal locking now and
2063 - for the next couple of calls. */
2064 - if (_TEXASRU_FAILURE_PERSISTENT (__builtin_get_texasru ()))
2066 - if (__elision_aconf.skip_lock_internal_abort > 0)
2067 - *adapt_count = __elision_aconf.skip_lock_internal_abort;
2070 - /* Same logic as above, but for a number of temporary failures in a
2072 - else if (__elision_aconf.skip_lock_out_of_tbegin_retries > 0
2073 - && __elision_aconf.try_tbegin > 0)
2074 - *adapt_count = __elision_aconf.skip_lock_out_of_tbegin_retries;
2079 + /* Same logic as above, but for a number of temporary failures in a
2081 + else if (attempt <= 1 && __elision_aconf.skip_lock_out_of_tbegin_retries > 0
2082 + && __elision_aconf.try_tbegin > 0)
2083 + *adapt_count = __elision_aconf.skip_lock_out_of_tbegin_retries;
2087 -# define ELIDE_LOCK(adapt_count, is_lock_free) \
2088 - __elide_lock (&(adapt_count), is_lock_free)
2092 -__elide_trylock (uint8_t *adapt_count, int is_lock_free, int write)
2094 - if (__elision_aconf.try_tbegin > 0)
2097 - __builtin_tabort (_ABORT_NESTED_TRYLOCK);
2098 - return __elide_lock (adapt_count, is_lock_free);
2102 +/* CONCURRENCY NOTES:
2104 + The evaluation of the macro expression is_lock_free encompasses one or
2105 + more loads from memory locations that are concurrently modified by other
2106 + threads. For lock elision to work, this evaluation and the rest of the
2107 + critical section protected by the lock must be atomic because an
2108 + execution with lock elision must be equivalent to an execution in which
2109 + the lock would have been actually acquired and released. Therefore, we
2110 + evaluate is_lock_free inside of the transaction that represents the
2111 + critical section for which we want to use lock elision, which ensures
2112 + the atomicity that we require. */
2114 +/* Returns 0 if the lock defined by is_lock_free was elided.
2115 + ADAPT_COUNT is a per-lock state variable. */
2116 +# define ELIDE_LOCK(adapt_count, is_lock_free) \
2119 + if (adapt_count > 0) \
2120 + (adapt_count)--; \
2122 + for (int i = __elision_aconf.try_tbegin; i > 0; i--) \
2124 + if (__builtin_tbegin (0)) \
2126 + if (is_lock_free) \
2131 + __builtin_tabort (_ABORT_LOCK_BUSY); \
2134 + if (!__get_new_count (&adapt_count,i)) \
2140 # define ELIDE_TRYLOCK(adapt_count, is_lock_free, write) \
2141 - __elide_trylock (&(adapt_count), is_lock_free, write)
2144 + if (__elision_aconf.try_tbegin > 0) \
2147 + __builtin_tabort (_ABORT_NESTED_TRYLOCK); \
2148 + ret = ELIDE_LOCK (adapt_count, is_lock_free); \
2155 diff --git a/sysdeps/sparc/sparc32/sem_open.c b/sysdeps/sparc/sparc32/sem_open.c
2156 index 16cb9ad..59df2d7 100644
2157 --- a/sysdeps/sparc/sparc32/sem_open.c
2158 +++ b/sysdeps/sparc/sparc32/sem_open.c
2160 #include <sys/mman.h>
2161 #include <sys/stat.h>
2162 #include "semaphoreP.h"
2163 +#include <futex-internal.h>
2164 #include <shm-directory.h>
2167 diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
2168 index 58c8b32..aa20e22 100644
2169 --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
2170 +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
2171 @@ -1822,9 +1822,6 @@ GLIBC_2.17
2174 __cxa_thread_atexit_impl F
2180 _IO_adjust_wcolumn F
2181 @@ -2015,6 +2012,9 @@ GLIBC_2.2.4
2191 diff --git a/sysdeps/unix/sysv/linux/hppa/bits/atomic.h b/sysdeps/unix/sysv/linux/hppa/bits/atomic.h
2192 index abde83e..6e73504 100644
2193 --- a/sysdeps/unix/sysv/linux/hppa/bits/atomic.h
2194 +++ b/sysdeps/unix/sysv/linux/hppa/bits/atomic.h
2195 @@ -56,42 +56,41 @@ typedef uintmax_t uatomic_max_t;
2197 #define _LWS_CAS "0"
2198 /* Note r31 is the link register. */
2199 -#define _LWS_CLOBBER "r1", "r26", "r25", "r24", "r23", "r22", "r21", "r20", "r28", "r31", "memory"
2200 +#define _LWS_CLOBBER "r1", "r23", "r22", "r20", "r31", "memory"
2201 /* String constant for -EAGAIN. */
2202 #define _ASM_EAGAIN "-11"
2203 /* String constant for -EDEADLOCK. */
2204 #define _ASM_EDEADLOCK "-45"
2206 #if __ASSUME_LWS_CAS
2207 -/* The only basic operation needed is compare and exchange. */
2208 +/* The only basic operation needed is compare and exchange. The mem
2209 + pointer must be word aligned. */
2210 # define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \
2212 - volatile int lws_errno; \
2213 - __typeof__ (*mem) lws_ret; \
2215 + register long lws_errno asm("r21"); \
2216 + register unsigned long lws_ret asm("r28"); \
2217 + register unsigned long lws_mem asm("r26") = (unsigned long)(mem); \
2218 + register unsigned long lws_old asm("r25") = (unsigned long)(oldval);\
2219 + register unsigned long lws_new asm("r24") = (unsigned long)(newval);\
2220 + __asm__ __volatile__( \
2222 - "copy %2, %%r26 \n\t" \
2223 - "copy %3, %%r25 \n\t" \
2224 - "copy %4, %%r24 \n\t" \
2225 "ble " _LWS "(%%sr2, %%r0) \n\t" \
2226 "ldi " _LWS_CAS ", %%r20 \n\t" \
2227 - "ldi " _ASM_EAGAIN ", %%r24 \n\t" \
2228 - "cmpb,=,n %%r24, %%r21, 0b \n\t" \
2229 + "ldi " _ASM_EAGAIN ", %%r20 \n\t" \
2230 + "cmpb,=,n %%r20, %%r21, 0b \n\t" \
2232 - "ldi " _ASM_EDEADLOCK ", %%r25 \n\t" \
2233 - "cmpb,=,n %%r25, %%r21, 0b \n\t" \
2234 + "ldi " _ASM_EDEADLOCK ", %%r20 \n\t" \
2235 + "cmpb,=,n %%r20, %%r21, 0b \n\t" \
2237 - "stw %%r28, %0 \n\t" \
2238 - "stw %%r21, %1 \n\t" \
2239 - : "=m" (lws_ret), "=m" (lws_errno) \
2240 - : "r" (mem), "r" (oldval), "r" (newval) \
2241 + : "=r" (lws_ret), "=r" (lws_errno) \
2242 + : "r" (lws_mem), "r" (lws_old), "r" (lws_new) \
2246 - if(lws_errno == -EFAULT || lws_errno == -ENOSYS) \
2247 + if (lws_errno == -EFAULT || lws_errno == -ENOSYS) \
2248 ABORT_INSTRUCTION; \
2251 + (__typeof (oldval)) lws_ret; \
2254 # define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
2255 diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
2256 index cf0ad90..224e1f3 100644
2257 --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
2258 +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
2259 @@ -95,9 +95,6 @@ GLIBC_2.18
2269 @@ -1863,6 +1860,9 @@ GLIBC_2.2.4
2279 diff --git a/sysdeps/unix/sysv/linux/hppa/syscall.c b/sysdeps/unix/sysv/linux/hppa/syscall.c
2280 index aff67a8..958fa47 100644
2281 --- a/sysdeps/unix/sysv/linux/hppa/syscall.c
2282 +++ b/sysdeps/unix/sysv/linux/hppa/syscall.c
2283 @@ -43,9 +43,10 @@ syscall (long int __sysno, ...)
2287 + LOAD_ARGS_6 (arg0, arg1, arg2, arg3, arg4, arg5)
2288 register unsigned long int __res asm("r28");
2290 - LOAD_ARGS_6 (arg0, arg1, arg2, arg3, arg4, arg5)
2292 asm volatile (SAVE_ASM_PIC
2293 " ble 0x100(%%sr2, %%r0) \n"
2294 " copy %1, %%r20 \n"
2295 diff --git a/sysdeps/unix/sysv/linux/hppa/sysdep.h b/sysdeps/unix/sysv/linux/hppa/sysdep.h
2296 index d20a04b..cb1f163 100644
2297 --- a/sysdeps/unix/sysv/linux/hppa/sysdep.h
2298 +++ b/sysdeps/unix/sysv/linux/hppa/sysdep.h
2299 @@ -400,9 +400,10 @@ L(pre_end): ASM_LINE_SEP \
2303 + LOAD_ARGS_##nr(args) \
2304 register unsigned long __res asm("r28"); \
2306 - LOAD_ARGS_##nr(args) \
2308 /* FIXME: HACK save/load r19 around syscall */ \
2311 @@ -425,9 +426,10 @@ L(pre_end): ASM_LINE_SEP \
2315 + LOAD_ARGS_##nr(args) \
2316 register unsigned long __res asm("r28"); \
2318 - LOAD_ARGS_##nr(args) \
2320 /* FIXME: HACK save/load r19 around syscall */ \
2323 @@ -443,27 +445,44 @@ L(pre_end): ASM_LINE_SEP \
2329 #define LOAD_ARGS_0()
2330 -#define LOAD_ARGS_1(r26) \
2331 - register unsigned long __r26 __asm__("r26") = (unsigned long)(r26); \
2332 +#define LOAD_REGS_0
2333 +#define LOAD_ARGS_1(a1) \
2334 + register unsigned long __x26 = (unsigned long)(a1); \
2336 -#define LOAD_ARGS_2(r26,r25) \
2337 - register unsigned long __r25 __asm__("r25") = (unsigned long)(r25); \
2339 -#define LOAD_ARGS_3(r26,r25,r24) \
2340 - register unsigned long __r24 __asm__("r24") = (unsigned long)(r24); \
2341 - LOAD_ARGS_2(r26,r25)
2342 -#define LOAD_ARGS_4(r26,r25,r24,r23) \
2343 - register unsigned long __r23 __asm__("r23") = (unsigned long)(r23); \
2344 - LOAD_ARGS_3(r26,r25,r24)
2345 -#define LOAD_ARGS_5(r26,r25,r24,r23,r22) \
2346 - register unsigned long __r22 __asm__("r22") = (unsigned long)(r22); \
2347 - LOAD_ARGS_4(r26,r25,r24,r23)
2348 -#define LOAD_ARGS_6(r26,r25,r24,r23,r22,r21) \
2349 - register unsigned long __r21 __asm__("r21") = (unsigned long)(r21); \
2350 - LOAD_ARGS_5(r26,r25,r24,r23,r22)
2351 +#define LOAD_REGS_1 \
2352 + register unsigned long __r26 __asm__("r26") = __x26; \
2354 +#define LOAD_ARGS_2(a1,a2) \
2355 + register unsigned long __x25 = (unsigned long)(a2); \
2357 +#define LOAD_REGS_2 \
2358 + register unsigned long __r25 __asm__("r25") = __x25; \
2360 +#define LOAD_ARGS_3(a1,a2,a3) \
2361 + register unsigned long __x24 = (unsigned long)(a3); \
2362 + LOAD_ARGS_2(a1,a2)
2363 +#define LOAD_REGS_3 \
2364 + register unsigned long __r24 __asm__("r24") = __x24; \
2366 +#define LOAD_ARGS_4(a1,a2,a3,a4) \
2367 + register unsigned long __x23 = (unsigned long)(a4); \
2368 + LOAD_ARGS_3(a1,a2,a3)
2369 +#define LOAD_REGS_4 \
2370 + register unsigned long __r23 __asm__("r23") = __x23; \
2372 +#define LOAD_ARGS_5(a1,a2,a3,a4,a5) \
2373 + register unsigned long __x22 = (unsigned long)(a5); \
2374 + LOAD_ARGS_4(a1,a2,a3,a4)
2375 +#define LOAD_REGS_5 \
2376 + register unsigned long __r22 __asm__("r22") = __x22; \
2378 +#define LOAD_ARGS_6(a1,a2,a3,a4,a5,a6) \
2379 + register unsigned long __x21 = (unsigned long)(a6); \
2380 + LOAD_ARGS_5(a1,a2,a3,a4,a5)
2381 +#define LOAD_REGS_6 \
2382 + register unsigned long __r21 __asm__("r21") = __x21; \
2385 /* Even with zero args we use r20 for the syscall number */
2387 diff --git a/sysdeps/unix/sysv/linux/microblaze/sysdep.h b/sysdeps/unix/sysv/linux/microblaze/sysdep.h
2388 index 83c0340..9d5c542 100644
2389 --- a/sysdeps/unix/sysv/linux/microblaze/sysdep.h
2390 +++ b/sysdeps/unix/sysv/linux/microblaze/sysdep.h
2392 License along with the GNU C Library; if not, see
2393 <http://www.gnu.org/licenses/>. */
2395 +#ifndef _LINUX_MICROBLAZE_SYSDEP_H
2396 +#define _LINUX_MICROBLAZE_SYSDEP_H 1
2398 +#include <sysdeps/unix/sysdep.h>
2399 #include <sysdeps/microblaze/sysdep.h>
2400 -#include <sys/syscall.h>
2402 /* Defines RTLD_PRIVATE_ERRNO. */
2403 #include <dl-sysdep.h>
2404 @@ -305,3 +308,5 @@ SYSCALL_ERROR_LABEL_DCL: \
2405 # define PTR_DEMANGLE(var) (void) (var)
2407 #endif /* not __ASSEMBLER__ */
2409 +#endif /* _LINUX_MICROBLAZE_SYSDEP_H */
2410 diff --git a/sysdeps/unix/sysv/linux/openat.c b/sysdeps/unix/sysv/linux/openat.c
2411 index 6777123..ad8e31d 100644
2412 --- a/sysdeps/unix/sysv/linux/openat.c
2413 +++ b/sysdeps/unix/sysv/linux/openat.c
2414 @@ -68,6 +68,11 @@ __OPENAT (int fd, const char *file, int oflag, ...)
2418 + /* We have to add the O_LARGEFILE flag for openat64. */
2420 + oflag |= MORE_OFLAGS;
2423 return SYSCALL_CANCEL (openat, fd, file, oflag, mode);
2425 libc_hidden_def (__OPENAT)
2426 diff --git a/sysdeps/unix/sysv/linux/powerpc/elision-lock.c b/sysdeps/unix/sysv/linux/powerpc/elision-lock.c
2427 index 7f9bcc2..c6731ca 100644
2428 --- a/sysdeps/unix/sysv/linux/powerpc/elision-lock.c
2429 +++ b/sysdeps/unix/sysv/linux/powerpc/elision-lock.c
2430 @@ -72,8 +72,7 @@ __lll_lock_elision (int *lock, short *adapt_count, EXTRAARG int pshared)
2434 - int try_begin = aconf.try_tbegin;
2436 + for (int i = aconf.try_tbegin; i > 0; i--)
2438 if (__builtin_tbegin (0))
2440 @@ -87,21 +86,19 @@ __lll_lock_elision (int *lock, short *adapt_count, EXTRAARG int pshared)
2441 /* A persistent failure indicates that a retry will probably
2442 result in another failure. Use normal locking now and
2443 for the next couple of calls. */
2444 - if (try_begin-- <= 0
2445 - || _TEXASRU_FAILURE_PERSISTENT (__builtin_get_texasru ()))
2446 + if (_TEXASRU_FAILURE_PERSISTENT (__builtin_get_texasru ()))
2448 if (aconf.skip_lock_internal_abort > 0)
2449 *adapt_count = aconf.skip_lock_internal_abort;
2452 - /* Same logic as above, but for for a number of temporary failures
2454 - else if (aconf.skip_lock_out_of_tbegin_retries > 0
2455 - && aconf.try_tbegin > 0)
2456 - *adapt_count = aconf.skip_lock_out_of_tbegin_retries;
2460 + /* Fall back to locks for a bit if retries have been exhausted */
2461 + if (aconf.try_tbegin > 0 && aconf.skip_lock_out_of_tbegin_retries > 0)
2462 + *adapt_count = aconf.skip_lock_out_of_tbegin_retries;
2465 return LLL_LOCK ((*lock), pshared);
2467 diff --git a/sysdeps/x86/fpu/bits/math-vector.h b/sysdeps/x86/fpu/bits/math-vector.h
2468 index f9e798b..f3bfb86 100644
2469 --- a/sysdeps/x86/fpu/bits/math-vector.h
2470 +++ b/sysdeps/x86/fpu/bits/math-vector.h
2472 # undef __DECL_SIMD_powf
2473 # define __DECL_SIMD_powf __DECL_SIMD_x86_64
2475 -/* Workaround to exclude unnecessary symbol aliases in libmvec
2476 - while GCC creates the vector names based on scalar asm name.
2477 - Corresponding discussion started at
2478 - <https://gcc.gnu.org/ml/gcc/2015-06/msg00173.html>. */
2479 -__asm__ ("_ZGVbN2v___log_finite = _ZGVbN2v_log");
2480 -__asm__ ("_ZGVcN4v___log_finite = _ZGVcN4v_log");
2481 -__asm__ ("_ZGVdN4v___log_finite = _ZGVdN4v_log");
2482 -__asm__ ("_ZGVeN8v___log_finite = _ZGVeN8v_log");
2483 -__asm__ ("_ZGVbN4v___logf_finite = _ZGVbN4v_logf");
2484 -__asm__ ("_ZGVcN8v___logf_finite = _ZGVcN8v_logf");
2485 -__asm__ ("_ZGVdN8v___logf_finite = _ZGVdN8v_logf");
2486 -__asm__ ("_ZGVeN16v___logf_finite = _ZGVeN16v_logf");
2487 -__asm__ ("_ZGVbN2v___exp_finite = _ZGVbN2v_exp");
2488 -__asm__ ("_ZGVcN4v___exp_finite = _ZGVcN4v_exp");
2489 -__asm__ ("_ZGVdN4v___exp_finite = _ZGVdN4v_exp");
2490 -__asm__ ("_ZGVeN8v___exp_finite = _ZGVeN8v_exp");
2491 -__asm__ ("_ZGVbN4v___expf_finite = _ZGVbN4v_expf");
2492 -__asm__ ("_ZGVcN8v___expf_finite = _ZGVcN8v_expf");
2493 -__asm__ ("_ZGVdN8v___expf_finite = _ZGVdN8v_expf");
2494 -__asm__ ("_ZGVeN16v___expf_finite = _ZGVeN16v_expf");
2495 -__asm__ ("_ZGVbN2vv___pow_finite = _ZGVbN2vv_pow");
2496 -__asm__ ("_ZGVcN4vv___pow_finite = _ZGVcN4vv_pow");
2497 -__asm__ ("_ZGVdN4vv___pow_finite = _ZGVdN4vv_pow");
2498 -__asm__ ("_ZGVeN8vv___pow_finite = _ZGVeN8vv_pow");
2499 -__asm__ ("_ZGVbN4vv___powf_finite = _ZGVbN4vv_powf");
2500 -__asm__ ("_ZGVcN8vv___powf_finite = _ZGVcN8vv_powf");
2501 -__asm__ ("_ZGVdN8vv___powf_finite = _ZGVdN8vv_powf");
2502 -__asm__ ("_ZGVeN16vv___powf_finite = _ZGVeN16vv_powf");
2506 diff --git a/sysdeps/x86_64/fpu/Makefile b/sysdeps/x86_64/fpu/Makefile
2507 index 1ebe511..b32b852 100644
2508 --- a/sysdeps/x86_64/fpu/Makefile
2509 +++ b/sysdeps/x86_64/fpu/Makefile
2510 @@ -20,7 +20,10 @@ libmvec-support += svml_d_cos2_core svml_d_cos4_core_avx \
2511 svml_d_pow_data svml_s_powf4_core svml_s_powf8_core_avx \
2512 svml_s_powf8_core svml_s_powf16_core svml_s_powf_data \
2513 svml_s_sincosf4_core svml_s_sincosf8_core_avx \
2514 - svml_s_sincosf8_core svml_s_sincosf16_core init-arch
2515 + svml_s_sincosf8_core svml_s_sincosf16_core init-arch \
2518 +libmvec-static-only-routines = svml_finite_alias
2521 # Variables for libmvec tests.
2522 diff --git a/sysdeps/x86_64/fpu/svml_finite_alias.S b/sysdeps/x86_64/fpu/svml_finite_alias.S
2523 new file mode 100644
2524 index 0000000..f8bcfeb
2526 +++ b/sysdeps/x86_64/fpu/svml_finite_alias.S
2528 +/* These aliases added as workaround to exclude unnecessary symbol
2529 + aliases in libmvec.so while compiler creates the vector names
2530 + based on scalar asm name. Corresponding discussion is at
2531 + <https://gcc.gnu.org/ml/gcc/2015-06/msg00173.html>.
2532 + Copyright (C) 2015 Free Software Foundation, Inc.
2533 + This file is part of the GNU C Library.
2535 + The GNU C Library is free software; you can redistribute it and/or
2536 + modify it under the terms of the GNU Lesser General Public
2537 + License as published by the Free Software Foundation; either
2538 + version 2.1 of the License, or (at your option) any later version.
2540 + The GNU C Library is distributed in the hope that it will be useful,
2541 + but WITHOUT ANY WARRANTY; without even the implied warranty of
2542 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2543 + Lesser General Public License for more details.
2545 + You should have received a copy of the GNU Lesser General Public
2546 + License along with the GNU C Library; if not, see
2547 + <http://www.gnu.org/licenses/>. */
2549 +#include <sysdep.h>
2551 +#define ALIAS_IMPL(alias, target) \
2558 +ALIAS_IMPL (_ZGVbN2v___log_finite, _ZGVbN2v_log)
2559 +ALIAS_IMPL (_ZGVcN4v___log_finite, _ZGVcN4v_log)
2560 +ALIAS_IMPL (_ZGVdN4v___log_finite, _ZGVdN4v_log)
2561 +ALIAS_IMPL (_ZGVeN8v___log_finite, _ZGVeN8v_log)
2563 +ALIAS_IMPL (_ZGVbN4v___logf_finite, _ZGVbN4v_logf)
2564 +ALIAS_IMPL (_ZGVcN8v___logf_finite, _ZGVcN8v_logf)
2565 +ALIAS_IMPL (_ZGVdN8v___logf_finite, _ZGVdN8v_logf)
2566 +ALIAS_IMPL (_ZGVeN16v___logf_finite, _ZGVeN16v_logf)
2568 +ALIAS_IMPL (_ZGVbN2v___exp_finite, _ZGVbN2v_exp)
2569 +ALIAS_IMPL (_ZGVcN4v___exp_finite, _ZGVcN4v_exp)
2570 +ALIAS_IMPL (_ZGVdN4v___exp_finite, _ZGVdN4v_exp)
2571 +ALIAS_IMPL (_ZGVeN8v___exp_finite, _ZGVeN8v_exp)
2573 +ALIAS_IMPL (_ZGVbN4v___expf_finite, _ZGVbN4v_expf)
2574 +ALIAS_IMPL (_ZGVcN8v___expf_finite, _ZGVcN8v_expf)
2575 +ALIAS_IMPL (_ZGVdN8v___expf_finite, _ZGVdN8v_expf)
2576 +ALIAS_IMPL (_ZGVeN16v___expf_finite, _ZGVeN16v_expf)
2578 +ALIAS_IMPL (_ZGVbN2vv___pow_finite, _ZGVbN2vv_pow)
2579 +ALIAS_IMPL (_ZGVcN4vv___pow_finite, _ZGVcN4vv_pow)
2580 +ALIAS_IMPL (_ZGVdN4vv___pow_finite, _ZGVdN4vv_pow)
2581 +ALIAS_IMPL (_ZGVeN8vv___pow_finite, _ZGVeN8vv_pow)
2583 +ALIAS_IMPL (_ZGVbN4vv___powf_finite, _ZGVbN4vv_powf)
2584 +ALIAS_IMPL (_ZGVcN8vv___powf_finite, _ZGVcN8vv_powf)
2585 +ALIAS_IMPL (_ZGVdN8vv___powf_finite, _ZGVdN8vv_powf)
2586 +ALIAS_IMPL (_ZGVeN16vv___powf_finite, _ZGVeN16vv_powf)
2587 diff --git a/time/strftime_l.c b/time/strftime_l.c
2588 index b48ef34..4eb647c 100644
2589 --- a/time/strftime_l.c
2590 +++ b/time/strftime_l.c
2591 @@ -510,13 +510,17 @@ __strftime_internal (s, maxsize, format, tp, tzset_called ut_argument
2592 only a few elements. Dereference the pointers only if the format
2593 requires this. Then it is ok to fail if the pointers are invalid. */
2595 - ((const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(ABDAY_1) + tp->tm_wday))
2596 + ((const CHAR_T *) (tp->tm_wday < 0 || tp->tm_wday > 6 \
2597 + ? "?" : _NL_CURRENT (LC_TIME, NLW(ABDAY_1) + tp->tm_wday)))
2599 - ((const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(DAY_1) + tp->tm_wday))
2600 + ((const CHAR_T *) (tp->tm_wday < 0 || tp->tm_wday > 6 \
2601 + ? "?" : _NL_CURRENT (LC_TIME, NLW(DAY_1) + tp->tm_wday)))
2603 - ((const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(ABMON_1) + tp->tm_mon))
2604 + ((const CHAR_T *) (tp->tm_mon < 0 || tp->tm_mon > 11 \
2605 + ? "?" : _NL_CURRENT (LC_TIME, NLW(ABMON_1) + tp->tm_mon)))
2607 - ((const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(MON_1) + tp->tm_mon))
2608 + ((const CHAR_T *) (tp->tm_mon < 0 || tp->tm_mon > 11 \
2609 + ? "?" : _NL_CURRENT (LC_TIME, NLW(MON_1) + tp->tm_mon)))
2611 ((const CHAR_T *) _NL_CURRENT (LC_TIME, tp->tm_hour > 11 \
2612 ? NLW(PM_STR) : NLW(AM_STR)))
2613 @@ -526,8 +530,10 @@ __strftime_internal (s, maxsize, format, tp, tzset_called ut_argument
2614 # define ap_len STRLEN (ampm)
2617 -# define f_wkday (weekday_name[tp->tm_wday])
2618 -# define f_month (month_name[tp->tm_mon])
2619 +# define f_wkday (tp->tm_wday < 0 || tp->tm_wday > 6 \
2620 + ? "?" : weekday_name[tp->tm_wday])
2621 +# define f_month (tp->tm_mon < 0 || tp->tm_mon > 11 \
2622 + ? "?" : month_name[tp->tm_mon])
2623 # define a_wkday f_wkday
2624 # define a_month f_month
2625 # define ampm (L_("AMPM") + 2 * (tp->tm_hour > 11))
2626 @@ -1321,7 +1327,7 @@ __strftime_internal (s, maxsize, format, tp, tzset_called ut_argument
2627 *tzset_called = true;
2630 - zone = tzname[tp->tm_isdst];
2631 + zone = tp->tm_isdst <= 1 ? tzname[tp->tm_isdst] : "?";
2635 diff --git a/time/tst-strftime.c b/time/tst-strftime.c
2636 index 374fba4..af3ff72 100644
2637 --- a/time/tst-strftime.c
2638 +++ b/time/tst-strftime.c
2650 + memset (&ttm, 1, sizeof (ttm));
2651 + ttm.tm_zone = NULL; /* Dereferenced directly if non-NULL. */
2652 + rc = strftime (buf, sizeof (buf), "%a %A %b %B %c %z %Z", &ttm);
2656 + const char expected[]
2657 + = "? ? ? ? ? ? 16843009 16843009:16843009:16843009 16844909 +467836 ?";
2658 + if (0 != strcmp (buf, expected))
2660 + printf ("expected:\n %s\ngot:\n %s\n", expected, buf);
2666 + printf ("expected 66, got %d\n", rc);
2670 + /* Check negative values as well. */
2671 + memset (&ttm, 0xFF, sizeof (ttm));
2672 + ttm.tm_zone = NULL; /* Dereferenced directly if non-NULL. */
2673 + rc = strftime (buf, sizeof (buf), "%a %A %b %B %c %z %Z", &ttm);
2677 + const char expected[] = "? ? ? ? ? ? -1 -1:-1:-1 1899 ";
2678 + if (0 != strcmp (buf, expected))
2680 + printf ("expected:\n %s\ngot:\n %s\n", expected, buf);
2686 + printf ("expected 30, got %d\n", rc);
2696 @@ -104,7 +154,7 @@ do_test (void)
2701 + return result + do_bz18985 ();
2704 #define TEST_FUNCTION do_test ()
2705 diff --git a/wcsmbs/wcscoll_l.c b/wcsmbs/wcscoll_l.c
2706 index 6d9384a..87f240d 100644
2707 --- a/wcsmbs/wcscoll_l.c
2708 +++ b/wcsmbs/wcscoll_l.c
2710 #define STRING_TYPE wchar_t
2711 #define USTRING_TYPE wint_t
2712 #define STRCOLL __wcscoll_l
2713 -#define STRDIFF __wcsdiff
2714 #define STRCMP __wcscmp
2715 #define WEIGHT_H "../locale/weightwc.h"