1 diff --git a/ChangeLog b/ChangeLog
2 index cb9124e..f77829e 100644
6 +2015-12-31 Aurelien Jarno <aurelien@aurel32.net>
8 + * sysdeps/unix/sysv/linux/alpha/libc.abilist [GLIBC_2.22]: Move
9 + to keep the file sorted.
10 + * sysdeps/unix/sysv/linux/hppa/libc.abilist [GLIBC_2.22]: Likewise.
12 +2015-12-17 Paul E. Murphy <murphyp@linux.vnet.ibm.com>
15 + * sysdeps/powerpc/nptl/elide.h (__elide_lock): Fix usage of
16 + .skip_lock_out_of_tbegin_retries.
17 + * sysdeps/unix/sysv/linux/powerpc/elision-lock.c
18 + (__lll_lock_elision): Likewise, and respect a value of
21 +2015-12-03 Andrew Senkevich <andrew.senkevich@intel.com>
23 + * math/Makefile ($(inst_libdir)/libm.so): Corrected path to
26 +2015-11-27 Andrew Senkevich <andrew.senkevich@intel.com>
29 + * math/Makefile ($(inst_libdir)/libm.so): Added libmvec_nonshared.a to
31 + * sysdeps/x86/fpu/bits/math-vector.h: Removed code with asm aliases
33 + * sysdeps/x86_64/fpu/Makefile (libmvec-support,
34 + libmvec-static-only-routines): Added new file.
35 + * sysdeps/x86_64/fpu/svml_finite_alias.S: New file.
36 + * NEWS: Mention this fix.
38 +2015-11-20 Roland McGrath <roland@hack.frob.com>
40 + * sysdeps/nacl/dl-map-segments.h (_dl_map_segments): Use
41 + __glibc_likely instead of __builtin_expect. After falling back to
42 + dyncode_create in a non-ET_DYN case, use the allocate_code_data
43 + system interface to register the code pages as occupied.
45 +2015-11-14 H.J. Lu <hongjiu.lu@intel.com>
47 + * config.make.in (have-glob-dat-reloc): New.
48 + * configure.ac (libc_cv_has_glob_dat): New. Set to yes if
49 + target supports GLOB_DAT relocaton. AC_SUBST.
50 + * configure: Regenerated.
51 + * elf/Makefile (tests): Add tst-prelink.
52 + (tests-special): Add $(objpfx)tst-prelink-cmp.out.
53 + (tst-prelink-ENV): New.
54 + ($(objpfx)tst-prelink-conflict.out): Likewise.
55 + ($(objpfx)tst-prelink-cmp.out): Likewise.
56 + * sysdeps/x86/tst-prelink.c: Moved to ...
57 + * elf/tst-prelink.c: Here.
58 + * sysdeps/x86/tst-prelink.exp: Moved to ...
59 + * elf/tst-prelink.exp: Here.
60 + * sysdeps/x86/Makefile (tests): Don't add tst-prelink.
61 + (tst-prelink-ENV): Removed.
62 + ($(objpfx)tst-prelink-conflict.out): Likewise.
63 + ($(objpfx)tst-prelink-cmp.out): Likewise.
64 + (tests-special): Don't add $(objpfx)tst-prelink-cmp.out.
66 +2015-11-10 Roland McGrath <roland@hack.frob.com>
68 + * elf/dl-load.c (open_verify): Take new argument FD.
69 + Skip __open call if passed FD is not -1.
70 + (_dl_map_object, open_path): Update callers.
71 + * elf/dl-sysdep-open.h: New file.
72 + * elf/dl-load.c: Include it.
73 + (_dl_map_object): Try _dl_sysdep_open_object before ldconfig cache.
74 + * sysdeps/nacl/dl-sysdep.c (_dl_sysdep_open_object): New function.
75 + * sysdeps/nacl/dl-sysdep-open.h: New file.
76 + * sysdeps/nacl/nacl-interface-list.h: Move nacl_irt_resource_open
79 +2015-11-10 H.J. Lu <hongjiu.lu@intel.com>
82 + * sysdeps/x86/Makefile (tests): Add tst-prelink.
83 + (tst-prelink-ENV): New.
84 + ($(objpfx)tst-prelink-conflict.out): Likewise.
85 + ($(objpfx)tst-prelink-cmp.out): Likewise.
86 + (tests-special): Add $(objpfx)tst-prelink-cmp.out.
87 + * sysdeps/x86/tst-prelink.c: New file.
88 + * sysdeps/x86/tst-prelink.exp: Likewise.
90 +2015-11-07 H.J. Lu <hongjiu.lu@intel.com>
93 + * elf/dl-lookup.c (RTYPE_CLASS_VALID): New.
94 + (RTYPE_CLASS_PLT): Likewise.
95 + (RTYPE_CLASS_COPY): Likewise.
96 + (RTYPE_CLASS_TLS): Likewise.
97 + (_dl_debug_bindings): Use RTYPE_CLASS_TLS and RTYPE_CLASS_VALID
98 + to set relocation type class for DL_DEBUG_PRELINK. Keep only
99 + ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY bits for
102 +2015-10-20 Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
105 + * sysdeps/powerpc/nptl/elide.h (__elide_lock): Move most of this
107 + (ELIDE_LOCK): ...here.
108 + (__get_new_count): New function with part of the code from
109 + __elide_lock that updates the value of adapt_count after a
111 + (__elided_trylock): Moved this code to...
112 + (ELIDE_TRYLOCK): ...here.
114 +2015-10-06 Florian Weimer <fweimer@redhat.com>
117 + * stdlib/cxa_thread_atexit_impl.c (__cxa_thread_atexit_impl):
118 + Mangle function pointer before storing it.
119 + (__call_tls_dtors): Demangle function pointer before calling it.
121 +2015-10-15 Florian Weimer <fweimer@redhat.com>
124 + * sysdeps/generic/ldsodefs.h (struct rtld_global_ro): Remove
125 + _dl_pointer_guard member.
126 + * elf/rtld.c (_rtld_global_ro): Remove _dl_pointer_guard
128 + (security_init): Always set up pointer guard.
129 + (process_envvars): Do not process LD_POINTER_GUARD.
131 +2015-10-09 Carlos O'Donell <carlos@redhat.com>
134 + * string/bug-strcoll2.c: Adjust copyright, and remove contributed by.
135 + * string/Makefile ($(objpfx)bug-strcoll2.out): Depend on
138 +2015-10-08 Carlos O'Donell <carlos@redhat.com>
141 + * string/Makefile (tests): Add bug-strcoll2.
142 + (LOCALES): Add cs_CZ.UTF-8.
144 +2015-09-28 Martin Sebor <msebor@redhat.com>
147 + * string/Makefile (LOCALES): Define.
148 + (gen-locales.mk): Include.
149 + (test-strcasecmp.out, test-strncasecmp.out, tst-strxfrm.out)
150 + (tst-strxfrm2.out): Add deppendency on $(gen-locales).
151 + * string/tst-strxfrm2.c (do_test): Print the name of the locale
152 + on setlocale failure.
154 +2015-10-08 Carlos O'Donell <carlos@redhat.com>
157 + * string/bug-strcoll2.c: New file.
158 + * locale/categories.def: Revert commit
159 + f13c2a8dff2329c6692a80176262ceaaf8a6f74e.
160 + * locale/langinfo.h: Likewise.
161 + * locale/localeinfo.h: Likewise.
162 + * locale/C-collate.c: Likewise.
163 + * programs/ld-collate.c (collate_output): Likewise.
164 + * string/strcoll_l.c (STRDIFF): Likewise.
165 + (STRCOLL): Likewise.
166 + * wcsmbs/wcscoll_l.c: Likewise.
168 +2015-09-15 Roland McGrath <roland@hack.frob.com>
170 + * misc/sys/param.h [!MAXHOSTNAMELEN && HOST_NAME_MAX]
171 + (MAXHOSTNAMELEN): Define it to HOST_NAME_MAX.
173 +2015-09-11 Roland McGrath <roland@hack.frob.com>
175 + * sysdeps/nacl/Makefile [$(subdir) = misc] (sysdep_headers):
176 + Use 'override' keyword to freeze the value here, preventing
177 + the addition of sys/mtio.h by sysdeps/gnu/Makefile.
179 +2015-09-04 Roland McGrath <roland@hack.frob.com>
182 + * sysdeps/posix/opendir.c (need_isdir_precheck) [O_DIRECTORY]:
183 + Fix inverted sense of test of 'o_directory_works' value.
184 + Reported by Pádraig Brady <P@draigBrady.com>, diagnosed by
185 + Bernhard Voelker <mail@bernhard-voelker.de>.
187 +2015-08-31 Brett Neumeier <brett@neumeier.us>
190 + * sysdeps/sparc/sparc32/sem_open.c: Add missing #include
192 +2015-08-28 Mike Frysinger <vapier@gentoo.org>
195 + * misc/Makefile (tests): Add tst-mntent-blank-corrupt and
196 + tst-mntent-blank-passno.
197 + * misc/mntent_r.c (__getmntent_r): Do not read past buffer[0].
198 + * misc/tst-mntent-blank-corrupt.c: New test.
199 + * misc/tst-mntent-blank-passno.c: New test ripped from ...
200 + * misc/tst-mntent.c (do_test): ... here.
202 +2015-08-25 Roland McGrath <roland@hack.frob.com>
204 + * sysdeps/nacl/start.c (_start): Call __nacl_main instead of main
205 + if the weak reference is not null.
207 +2015-08-19 Andrew Senkevich <andrew.senkevich@intel.com>
210 + * scripts/test-installation.pl: Don't add -lmvec to build options
211 + if libmvec wasn't built.
212 + * NEWS: Mention this fix.
214 +2015-08-10 Maxim Ostapenko <m.ostapenko@partner.samsung.com>
217 + * elf/Makefile (tests): Add Add tst-nodelete2.
218 + (modules-names): Add tst-nodelete2mod.
219 + (tst-nodelete2mod.so-no-z-defs): New.
220 + ($(objpfx)tst-nodelete2): Likewise.
221 + ($(objpfx)tst-nodelete2.out): Likewise.
222 + (LDFLAGS-tst-nodelete2): Likewise.
223 + * elf/dl-close.c (_dl_close_worker): Move DF_1_NODELETE clearing
224 + out of loop through all loaded libraries.
225 + * elf/tst-nodelete2.c: New file.
226 + * elf/tst-nodelete2mod.c: Likewise.
228 +2015-08-10 Andreas Schwab <schwab@suse.de>
231 + * sysdeps/unix/sysv/linux/openat.c (__OPENAT) [MORE_OFLAGS]: Add
232 + MORE_OFLAGS to oflag.
233 + * io/test-lfs.c (do_test): Test openat64.
235 +2015-08-08 John David Anglin <danglin@gcc.gnu.org>
238 + * sysdeps/unix/sysv/linux/hppa/bits/atomic.h (_LWS_CLOBBER): Revise
240 + (atomic_compare_and_exchange_val_acq): Use register asms to assign
241 + operand registers. Use register %r20 for EAGAIN and EDEADLOCK checks.
242 + Cast return to __typeof (oldval).
244 +2015-08-08 Mike Frysinger <vapier@gentoo.org>
246 + * sysdeps/unix/sysv/linux/microblaze/sysdep.h: Wrap the whole file
247 + in _LINUX_MICROBLAZE_SYSDEP_H defines. Include sysdeps/unix/sysdep.h
248 + and delete sys/syscall.h include.
250 +2015-08-07 Mike Frysinger <vapier@gentoo.org>
252 + * sysdeps/hppa/dl-symaddr.c (_dl_symbol_address): Add rtld_hidden_def.
254 +2015-08-05 Zack Weinberg <zackw@panix.com>
256 + * misc/regexp.h: Update comments.
258 2015-08-05 Carlos O'Donell <carlos@systemhalted.org>
260 * version.h (RELEASE): Set to "stable".
261 diff --git a/NEWS b/NEWS
262 index 4c31de7..e1c1e58 100644
265 @@ -5,6 +5,16 @@ See the end for copying conditions.
266 Please send GNU C library bug reports via <http://sourceware.org/bugzilla/>
267 using `glibc' in the "product" field.
271 +* The following bugs are resolved with this release:
273 + 18589, 18743, 18778, 18781, 18787, 18796, 18870, 18887, 18921, 18928,
274 + 18969, 19018, 19058, 19174, 19178.
276 +* The LD_POINTER_GUARD environment variable can no longer be used to
277 + disable the pointer guard feature. It is always enabled.
281 * The following bugs are resolved with this release:
282 @@ -84,7 +94,7 @@ Version 2.22
283 release. Use of this header will trigger a deprecation warning.
284 Application developers should update their code to use <regex.h> instead.
286 - This header was formerly part of SUSv2, but was deprecated in 1997 and
287 + This header was formerly part of SUS, but was deprecated in 1994 and
288 removed from the standard in 2001. Also, the glibc implementation
289 leaks memory. See BZ#18681 for more details.
291 diff --git a/config.make.in b/config.make.in
292 index a9f5696..46cd9bb 100644
295 @@ -51,6 +51,7 @@ have-z-combreloc = @libc_cv_z_combreloc@
296 have-z-execstack = @libc_cv_z_execstack@
297 have-Bgroup = @libc_cv_Bgroup@
298 have-protected-data = @libc_cv_protected_data@
299 +have-glob-dat-reloc = @libc_cv_has_glob_dat@
301 old-glibc-headers = @old_glibc_headers@
302 unwind-find-fde = @libc_cv_gcc_unwind_find_fde@
303 diff --git a/configure b/configure
304 index 45cc7cb..4f87b31 100755
307 @@ -628,6 +628,7 @@ gnu89_inline
310 libc_cv_output_format
311 +libc_cv_has_glob_dat
315 @@ -6335,6 +6336,39 @@ $as_echo "$libc_cv_use_default_link" >&6; }
316 use_default_link=$libc_cv_use_default_link
319 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLOB_DAT reloc" >&5
320 +$as_echo_n "checking for GLOB_DAT reloc... " >&6; }
321 +if ${libc_cv_has_glob_dat+:} false; then :
322 + $as_echo_n "(cached) " >&6
324 + cat > conftest.c <<EOF
326 +int foo (void) { return mumble; }
328 +if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
329 + -fPIC -shared -o conftest.so conftest.c
330 + -nostdlib -nostartfiles
332 + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
333 + (eval $ac_try) 2>&5
335 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
336 + test $ac_status = 0; }; }
338 + if $READELF -rW conftest.so | grep '_GLOB_DAT' > /dev/null; then
339 + libc_cv_has_glob_dat=yes
341 + libc_cv_has_glob_dat=no
344 + libc_cv_has_glob_dat=no
348 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_has_glob_dat" >&5
349 +$as_echo "$libc_cv_has_glob_dat" >&6; }
352 { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker output format" >&5
353 $as_echo_n "checking linker output format... " >&6; }
354 if ${libc_cv_output_format+:} false; then :
355 diff --git a/configure.ac b/configure.ac
356 index 7e9383a..8be612d 100644
359 @@ -1535,6 +1535,29 @@ $ac_try"
360 use_default_link=$libc_cv_use_default_link
363 +AC_CACHE_CHECK(for GLOB_DAT reloc,
364 + libc_cv_has_glob_dat, [dnl
365 +cat > conftest.c <<EOF
367 +int foo (void) { return mumble; }
369 +if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
370 + -fPIC -shared -o conftest.so conftest.c
371 + -nostdlib -nostartfiles
372 + 1>&AS_MESSAGE_LOG_FD])
374 +dnl look for GLOB_DAT relocation.
375 + if $READELF -rW conftest.so | grep '_GLOB_DAT' > /dev/null; then
376 + libc_cv_has_glob_dat=yes
378 + libc_cv_has_glob_dat=no
381 + libc_cv_has_glob_dat=no
384 +AC_SUBST(libc_cv_has_glob_dat)
386 AC_CACHE_CHECK(linker output format, libc_cv_output_format, [dnl
387 if libc_cv_output_format=`
388 ${CC-cc} -nostartfiles -nostdlib -Wl,--print-output-format 2>&AS_MESSAGE_LOG_FD`
389 diff --git a/elf/Makefile b/elf/Makefile
390 index 4ceeaf8..a2c43bc 100644
393 @@ -148,7 +148,8 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
394 tst-unique1 tst-unique2 $(if $(CXX),tst-unique3 tst-unique4 \
396 tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \
397 - tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened
398 + tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \
401 ifeq ($(build-hardcoded-path-in-tests),yes)
402 tests += tst-dlopen-aout
403 @@ -218,7 +219,7 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
405 tst-relsort1mod1 tst-relsort1mod2 tst-array2dep \
406 tst-array5dep tst-null-argv-lib \
407 - tst-tlsalign-lib tst-nodelete-opened-lib
408 + tst-tlsalign-lib tst-nodelete-opened-lib tst-nodelete2mod
409 ifeq (yes,$(have-protected-data))
410 modules-names += tst-protected1moda tst-protected1modb
411 tests += tst-protected1a tst-protected1b
412 @@ -292,6 +293,13 @@ check-abi: $(objpfx)check-abi-ld.out
413 tests-special += $(objpfx)check-abi-ld.out
414 update-abi: update-abi-ld
416 +ifeq ($(have-glob-dat-reloc),yes)
417 +tests += tst-prelink
418 +ifeq ($(run-built-tests),yes)
419 +tests-special += $(objpfx)tst-prelink-cmp.out
425 ifeq (yes,$(build-shared))
426 @@ -594,6 +602,7 @@ tst-auditmod9b.so-no-z-defs = yes
427 tst-nodelete-uniquemod.so-no-z-defs = yes
428 tst-nodelete-rtldmod.so-no-z-defs = yes
429 tst-nodelete-zmod.so-no-z-defs = yes
430 +tst-nodelete2mod.so-no-z-defs = yes
432 ifeq ($(build-shared),yes)
433 # Build all the modules even when not actually running test programs.
434 @@ -1164,6 +1173,11 @@ $(objpfx)tst-nodelete.out: $(objpfx)tst-nodelete-uniquemod.so \
435 LDFLAGS-tst-nodelete = -rdynamic
436 LDFLAGS-tst-nodelete-zmod.so = -Wl,--enable-new-dtags,-z,nodelete
438 +$(objpfx)tst-nodelete2: $(libdl)
439 +$(objpfx)tst-nodelete2.out: $(objpfx)tst-nodelete2mod.so
441 +LDFLAGS-tst-nodelete2 = -rdynamic
443 $(objpfx)tst-initorder-cmp.out: tst-initorder.exp $(objpfx)tst-initorder.out
446 @@ -1205,3 +1219,13 @@ $(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so
447 $(objpfx)tst-unused-dep-cmp.out: $(objpfx)tst-unused-dep.out
448 cmp $< /dev/null > $@; \
451 +tst-prelink-ENV = LD_TRACE_PRELINKING=1
453 +$(objpfx)tst-prelink-conflict.out: $(objpfx)tst-prelink.out
454 + grep stdout $< | grep conflict | $(AWK) '{ print $$10, $$11 }' > $@
456 +$(objpfx)tst-prelink-cmp.out: tst-prelink.exp \
457 + $(objpfx)tst-prelink-conflict.out
460 diff --git a/elf/dl-close.c b/elf/dl-close.c
461 index 9105277..c897247 100644
464 @@ -144,6 +144,14 @@ _dl_close_worker (struct link_map *map, bool force)
466 struct link_map *maps[nloaded];
468 + /* Clear DF_1_NODELETE to force object deletion. We don't need to touch
469 + l_tls_dtor_count because forced object deletion only happens when an
470 + error occurs during object load. Destructor registration for TLS
471 + non-POD objects should not have happened till then for this
474 + map->l_flags_1 &= ~DF_1_NODELETE;
476 /* Run over the list and assign indexes to the link maps and enter
477 them into the MAPS array. */
479 @@ -153,13 +161,6 @@ _dl_close_worker (struct link_map *map, bool force)
483 - /* Clear DF_1_NODELETE to force object deletion. We don't need to touch
484 - l_tls_dtor_count because forced object deletion only happens when an
485 - error occurs during object load. Destructor registration for TLS
486 - non-POD objects should not have happened till then for this
489 - l->l_flags_1 &= ~DF_1_NODELETE;
491 assert (idx == nloaded);
493 diff --git a/elf/dl-load.c b/elf/dl-load.c
494 index 0c052e4..7e6f4c5 100644
498 #include <dl-map-segments.h>
499 #include <dl-unmap-segments.h>
500 #include <dl-machine-reject-phdr.h>
501 +#include <dl-sysdep-open.h>
505 @@ -1471,9 +1472,13 @@ print_search_path (struct r_search_path_elem **list,
506 ignore only ELF files for other architectures. Non-ELF files and
507 ELF files with different header information cause fatal errors since
508 this could mean there is something wrong in the installation and the
509 - user might want to know about this. */
510 + user might want to know about this.
512 + If FD is not -1, then the file is already open and FD refers to it.
513 + In that case, FD is consumed for both successful and error returns. */
515 -open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
516 +open_verify (const char *name, int fd,
517 + struct filebuf *fbp, struct link_map *loader,
518 int whatcode, int mode, bool *found_other_class, bool free_name)
520 /* This is the expected ELF header. */
521 @@ -1514,6 +1519,7 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
522 if (__glibc_unlikely (GLRO(dl_naudit) > 0) && whatcode != 0
523 && loader->l_auditing == 0)
525 + const char *original_name = name;
526 struct audit_ifaces *afct = GLRO(dl_audit);
527 for (unsigned int cnt = 0; cnt < GLRO(dl_naudit); ++cnt)
529 @@ -1528,11 +1534,21 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
534 + if (fd != -1 && name != original_name && strcmp (name, original_name))
536 + /* An audit library changed what we're supposed to open,
537 + so FD no longer matches it. */
544 - /* Open the file. We always open files read-only. */
545 - int fd = __open (name, O_RDONLY | O_CLOEXEC);
547 + /* Open the file. We always open files read-only. */
548 + fd = __open (name, O_RDONLY | O_CLOEXEC);
553 @@ -1801,7 +1817,7 @@ open_path (const char *name, size_t namelen, int mode,
554 if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
555 _dl_debug_printf (" trying file=%s\n", buf);
557 - fd = open_verify (buf, fbp, loader, whatcode, mode,
558 + fd = open_verify (buf, -1, fbp, loader, whatcode, mode,
559 found_other_class, false);
560 if (this_dir->status[cnt] == unknown)
562 @@ -2041,6 +2057,20 @@ _dl_map_object (struct link_map *loader, const char *name,
563 &loader->l_runpath_dirs, &realname, &fb, loader,
564 LA_SER_RUNPATH, &found_other_class);
568 + realname = _dl_sysdep_open_object (name, namelen, &fd);
569 + if (realname != NULL)
571 + fd = open_verify (realname, fd,
572 + &fb, loader ?: GL(dl_ns)[nsid]._ns_loaded,
573 + LA_SER_CONFIG, mode, &found_other_class,
582 && (__glibc_likely ((mode & __RTLD_SECURE) == 0)
583 @@ -2086,7 +2116,7 @@ _dl_map_object (struct link_map *loader, const char *name,
587 - fd = open_verify (cached,
588 + fd = open_verify (cached, -1,
589 &fb, loader ?: GL(dl_ns)[nsid]._ns_loaded,
590 LA_SER_CONFIG, mode, &found_other_class,
592 @@ -2121,7 +2151,7 @@ _dl_map_object (struct link_map *loader, const char *name,
596 - fd = open_verify (realname, &fb,
597 + fd = open_verify (realname, -1, &fb,
598 loader ?: GL(dl_ns)[nsid]._ns_loaded, 0, mode,
599 &found_other_class, true);
600 if (__glibc_unlikely (fd == -1))
601 diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
602 index 11cb44b..acf5280 100644
603 --- a/elf/dl-lookup.c
604 +++ b/elf/dl-lookup.c
605 @@ -1016,6 +1016,18 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
607 if (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
609 +/* ELF_RTYPE_CLASS_XXX must match RTYPE_CLASS_XXX used by prelink with
610 + LD_TRACE_PRELINKING. */
611 +#define RTYPE_CLASS_VALID 8
612 +#define RTYPE_CLASS_PLT (8|1)
613 +#define RTYPE_CLASS_COPY (8|2)
614 +#define RTYPE_CLASS_TLS (8|4)
615 +#if ELF_RTYPE_CLASS_PLT != 0 && ELF_RTYPE_CLASS_PLT != 1
616 +# error ELF_RTYPE_CLASS_PLT must be 0 or 1!
618 +#if ELF_RTYPE_CLASS_COPY != 0 && ELF_RTYPE_CLASS_COPY != 2
619 +# error ELF_RTYPE_CLASS_COPY must be 0 or 2!
622 struct sym_val val = { NULL, NULL };
624 @@ -1071,12 +1083,17 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
628 + /* Keep only ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY
629 + bits since since prelink only uses them. */
630 + type_class &= ELF_RTYPE_CLASS_PLT | ELF_RTYPE_CLASS_COPY;
631 if (__glibc_unlikely (ELFW(ST_TYPE) (value->s->st_info)
634 + /* Clear the RTYPE_CLASS_VALID bit in RTYPE_CLASS_TLS. */
635 + type_class = RTYPE_CLASS_TLS & ~RTYPE_CLASS_VALID;
636 else if (__glibc_unlikely (ELFW(ST_TYPE) (value->s->st_info)
639 + /* Set the RTYPE_CLASS_VALID bit. */
640 + type_class |= RTYPE_CLASS_VALID;
644 diff --git a/elf/dl-sysdep-open.h b/elf/dl-sysdep-open.h
646 index 0000000..a63d9f5
648 +++ b/elf/dl-sysdep-open.h
650 +/* System-specific call to open a shared object by name. Stub version.
651 + Copyright (C) 2015 Free Software Foundation, Inc.
652 + This file is part of the GNU C Library.
654 + The GNU C Library is free software; you can redistribute it and/or
655 + modify it under the terms of the GNU Lesser General Public
656 + License as published by the Free Software Foundation; either
657 + version 2.1 of the License, or (at your option) any later version.
659 + The GNU C Library is distributed in the hope that it will be useful,
660 + but WITHOUT ANY WARRANTY; without even the implied warranty of
661 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
662 + Lesser General Public License for more details.
664 + You should have received a copy of the GNU Lesser General Public
665 + License along with the GNU C Library; if not, see
666 + <http://www.gnu.org/licenses/>. */
668 +#ifndef _DL_SYSDEP_OPEN_H
669 +#define _DL_SYSDEP_OPEN_H 1
674 +/* NAME is a name without slashes, as it appears in a DT_NEEDED entry
675 + or a dlopen call's argument or suchlike. NAMELEN is (strlen (NAME) + 1).
677 + Find NAME in an OS-dependent fashion, and return its "real" name.
678 + Optionally fill in *FD with a file descriptor open on that file (or
679 + else leave its initial value of -1). The return value is a new
680 + malloc'd string, which will be free'd by the caller. If NAME is
681 + resolved to an actual file that can be opened, then the return
682 + value should name that file (and if *FD was not set, then a normal
683 + __open call on that string will be made). If *FD was set by some
684 + other means than a normal open and there is no "real" name to use,
685 + then __strdup (NAME) is fine (modulo error checking). */
687 +static inline char *
688 +_dl_sysdep_open_object (const char *name, size_t namelen, int *fd)
690 + assert (*fd == -1);
694 +#endif /* dl-sysdep-open.h */
695 diff --git a/elf/rtld.c b/elf/rtld.c
696 index 69873c2..07e741c 100644
699 @@ -162,7 +162,6 @@ struct rtld_global_ro _rtld_global_ro attribute_relro =
700 ._dl_hwcap_mask = HWCAP_IMPORTANT,
702 ._dl_fpu_control = _FPU_DEFAULT,
703 - ._dl_pointer_guard = 1,
704 ._dl_pagesize = EXEC_PAGESIZE,
705 ._dl_inhibit_cache = 0,
707 @@ -709,15 +708,12 @@ security_init (void)
710 /* Set up the pointer guard as well, if necessary. */
711 - if (GLRO(dl_pointer_guard))
713 - uintptr_t pointer_chk_guard = _dl_setup_pointer_guard (_dl_random,
715 + uintptr_t pointer_chk_guard
716 + = _dl_setup_pointer_guard (_dl_random, stack_chk_guard);
717 #ifdef THREAD_SET_POINTER_GUARD
718 - THREAD_SET_POINTER_GUARD (pointer_chk_guard);
719 + THREAD_SET_POINTER_GUARD (pointer_chk_guard);
721 - __pointer_chk_guard_local = pointer_chk_guard;
723 + __pointer_chk_guard_local = pointer_chk_guard;
725 /* We do not need the _dl_random value anymore. The less
726 information we leave behind, the better, so clear the
727 @@ -2471,9 +2467,6 @@ process_envvars (enum mode *modep)
728 GLRO(dl_use_load_bias) = envline[14] == '1' ? -1 : 0;
732 - if (memcmp (envline, "POINTER_GUARD", 13) == 0)
733 - GLRO(dl_pointer_guard) = envline[14] != '0';
737 diff --git a/elf/tst-nodelete2.c b/elf/tst-nodelete2.c
739 index 0000000..388e8af
741 +++ b/elf/tst-nodelete2.c
743 +#include "../dlfcn/dlfcn.h"
746 +#include <gnu/lib-names.h>
753 + printf ("\nOpening pthread library.\n");
754 + void *pthread = dlopen (LIBPTHREAD_SO, RTLD_LAZY);
756 + /* This is a test for correct DF_1_NODELETE clearing when dlopen failure
757 + happens. We should clear DF_1_NODELETE for failed library only, because
758 + doing this for others (e.g. libpthread) might cause them to be unloaded,
759 + that may lead to some global references (e.g. __rtld_lock_unlock) to be
760 + broken. The dlopen should fail because of undefined symbols in shared
761 + library, that cause DF_1_NODELETE to be cleared. For libpthread, this
762 + flag should be set, because if not, SIGSEGV will happen in dlclose. */
763 + if (dlopen ("tst-nodelete2mod.so", RTLD_NOW) != NULL)
765 + printf ("Unique symbols test failed\n");
773 + printf ("SUCCESS\n");
778 +#define TEST_FUNCTION do_test ()
779 +#include "../test-skeleton.c"
780 diff --git a/elf/tst-nodelete2mod.c b/elf/tst-nodelete2mod.c
782 index 0000000..e88c756
784 +++ b/elf/tst-nodelete2mod.c
786 +/* Undefined symbol. */
787 +extern int not_exist (void);
791 + return not_exist ();
793 diff --git a/elf/tst-prelink.c b/elf/tst-prelink.c
795 index 0000000..ab61c4e
797 +++ b/elf/tst-prelink.c
799 +/* Test the output from the environment variable, LD_TRACE_PRELINKING,
801 + Copyright (C) 2015 Free Software Foundation, Inc.
802 + This file is part of the GNU C Library.
804 + The GNU C Library is free software; you can redistribute it and/or
805 + modify it under the terms of the GNU Lesser General Public
806 + License as published by the Free Software Foundation; either
807 + version 2.1 of the License, or (at your option) any later version.
809 + The GNU C Library is distributed in the hope that it will be useful,
810 + but WITHOUT ANY WARRANTY; without even the implied warranty of
811 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
812 + Lesser General Public License for more details.
814 + You should have received a copy of the GNU Lesser General Public
815 + License along with the GNU C Library; if not, see
816 + <http://www.gnu.org/licenses/>. */
823 + fprintf (stdout, "hello\n");
827 +#define TEST_FUNCTION do_test ()
828 +#include "../test-skeleton.c"
829 diff --git a/elf/tst-prelink.exp b/elf/tst-prelink.exp
831 index 0000000..b35b4c9
833 +++ b/elf/tst-prelink.exp
836 diff --git a/elf/tst-znodelete-zlib.cc b/elf/tst-znodelete-zlib.cc
837 deleted file mode 100644
838 index 1e8f368..0000000
839 --- a/elf/tst-znodelete-zlib.cc
842 -extern int not_exist (void);
846 - return not_exist ();
848 diff --git a/io/test-lfs.c b/io/test-lfs.c
849 index 539c2a2..b6ebae4 100644
852 @@ -144,7 +144,7 @@ test_ftello (void)
854 do_test (int argc, char *argv[])
858 struct stat64 statbuf;
860 ret = lseek64 (fd, TWO_GB+100, SEEK_SET);
861 @@ -195,6 +195,25 @@ do_test (int argc, char *argv[])
862 error (EXIT_FAILURE, 0, "stat reported size %lld instead of %lld.",
863 (long long int) statbuf.st_size, (TWO_GB + 100 + 5));
865 + fd2 = openat64 (AT_FDCWD, name, O_RDWR);
868 + if (errno == ENOSYS)
870 + /* Silently ignore this test. */
871 + error (0, 0, "openat64 is not supported");
874 + error (EXIT_FAILURE, errno, "openat64 failed to open big file");
881 + error (EXIT_FAILURE, errno, "error closing file");
887 diff --git a/locale/C-collate.c b/locale/C-collate.c
888 index d7f3c55..06dfdfa 100644
889 --- a/locale/C-collate.c
890 +++ b/locale/C-collate.c
891 @@ -144,8 +144,6 @@ const struct __locale_data _nl_C_LC_COLLATE attribute_hidden =
892 /* _NL_COLLATE_COLLSEQWC */
893 { .string = (const char *) collseqwc },
894 /* _NL_COLLATE_CODESET */
895 - { .string = _nl_C_codeset },
896 - /* _NL_COLLATE_ENCODING_TYPE */
897 - { .word = __cet_8bit }
898 + { .string = _nl_C_codeset }
901 diff --git a/locale/categories.def b/locale/categories.def
902 index 045489d..a8dda53 100644
903 --- a/locale/categories.def
904 +++ b/locale/categories.def
905 @@ -58,7 +58,6 @@ DEFINE_CATEGORY
906 DEFINE_ELEMENT (_NL_COLLATE_COLLSEQMB, "collate-collseqmb", std, wstring)
907 DEFINE_ELEMENT (_NL_COLLATE_COLLSEQWC, "collate-collseqwc", std, wstring)
908 DEFINE_ELEMENT (_NL_COLLATE_CODESET, "collate-codeset", std, string)
909 - DEFINE_ELEMENT (_NL_COLLATE_ENCODING_TYPE, "collate-encoding-type", std, word)
913 diff --git a/locale/langinfo.h b/locale/langinfo.h
914 index ffc5c7f..a565d9d 100644
915 --- a/locale/langinfo.h
916 +++ b/locale/langinfo.h
917 @@ -255,7 +255,6 @@ enum
918 _NL_COLLATE_COLLSEQMB,
919 _NL_COLLATE_COLLSEQWC,
921 - _NL_COLLATE_ENCODING_TYPE,
924 /* LC_CTYPE category: character classification.
925 diff --git a/locale/localeinfo.h b/locale/localeinfo.h
926 index bdab9fe..1d2ee00 100644
927 --- a/locale/localeinfo.h
928 +++ b/locale/localeinfo.h
929 @@ -110,14 +110,6 @@ enum coll_sort_rule
933 -/* Collation encoding type. */
934 -enum collation_encoding_type
941 /* We can map the types of the entries into a few categories. */
944 diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
945 index a39a94f..dc0fe30 100644
946 --- a/locale/programs/ld-collate.c
947 +++ b/locale/programs/ld-collate.c
949 #include "linereader.h"
951 #include "elem-hash.h"
952 -#include "../localeinfo.h"
954 /* Uncomment the following line in the production version. */
955 /* #define NDEBUG 1 */
956 @@ -2131,8 +2130,6 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
957 /* The words have to be handled specially. */
958 if (idx == _NL_ITEM_INDEX (_NL_COLLATE_SYMB_HASH_SIZEMB))
959 add_locale_uint32 (&file, 0);
960 - else if (idx == _NL_ITEM_INDEX (_NL_COLLATE_ENCODING_TYPE))
961 - add_locale_uint32 (&file, __cet_other);
963 add_locale_empty (&file);
965 @@ -2496,12 +2493,6 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
966 add_locale_raw_data (&file, collate->mbseqorder, 256);
967 add_locale_collseq_table (&file, &collate->wcseqorder);
968 add_locale_string (&file, charmap->code_set_name);
969 - if (strcmp (charmap->code_set_name, "UTF-8") == 0)
970 - add_locale_uint32 (&file, __cet_utf8);
971 - else if (charmap->mb_cur_max == 1)
972 - add_locale_uint32 (&file, __cet_8bit);
974 - add_locale_uint32 (&file, __cet_other);
975 write_locale_data (output_path, LC_COLLATE, "LC_COLLATE", &file);
977 obstack_free (&weightpool, NULL);
978 diff --git a/math/Makefile b/math/Makefile
979 index 6388bae..2c9d72d 100644
982 @@ -98,7 +98,7 @@ $(inst_libdir)/libm.so: $(common-objpfx)format.lds \
983 (echo '/* GNU ld script'; echo '*/';\
985 echo 'GROUP ( $(slibdir)/libm.so$(libm.so-version) ' \
986 - 'AS_NEEDED ( $(slibdir)/libmvec.so$(libmvec.so-version) ) )' \
987 + 'AS_NEEDED ( $(libdir)/libmvec_nonshared.a $(slibdir)/libmvec.so$(libmvec.so-version) ) )' \
991 diff --git a/misc/Makefile b/misc/Makefile
992 index aecb0da..2f5edf6 100644
995 @@ -76,7 +76,8 @@ install-lib := libg.a
996 gpl2lgpl := error.c error.h
998 tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \
999 - tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1
1000 + tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1 \
1001 + tst-mntent-blank-corrupt tst-mntent-blank-passno
1002 ifeq ($(run-built-tests),yes)
1003 tests-special += $(objpfx)tst-error1-mem.out
1005 diff --git a/misc/mntent_r.c b/misc/mntent_r.c
1006 index 6159873..4f26998 100644
1007 --- a/misc/mntent_r.c
1008 +++ b/misc/mntent_r.c
1009 @@ -136,7 +136,9 @@ __getmntent_r (FILE *stream, struct mntent *mp, char *buffer, int bufsiz)
1010 end_ptr = strchr (buffer, '\n');
1011 if (end_ptr != NULL) /* chop newline */
1013 - while (end_ptr[-1] == ' ' || end_ptr[-1] == '\t')
1014 + /* Do not walk past the start of buffer if it's all whitespace. */
1015 + while (end_ptr != buffer
1016 + && (end_ptr[-1] == ' ' || end_ptr[-1] == '\t'))
1020 diff --git a/misc/regexp.h b/misc/regexp.h
1021 index 3460989..42394f7 100644
1028 -/* The contents of this header file were standardized in the
1029 - Single Unix Specification, Version 2 (1997) but marked as
1030 - LEGACY; new applications were already being encouraged to
1031 - use <regex.h> instead. POSIX.1-2001 removed this header.
1032 +/* The contents of this header file were originally standardized in
1033 + the Single Unix Specification, Issue 3 (1992). In Issue 4 (1994)
1034 + the header was marked as TO BE WITHDRAWN, and new applications
1035 + were encouraged to use <regex.h> instead. It was officially
1036 + withdrawn from the standard in Issue 6 (aka POSIX.1-2001).
1038 This header is provided only for backward compatibility.
1039 It will be removed in the next release of the GNU C Library.
1040 diff --git a/misc/sys/param.h b/misc/sys/param.h
1041 index 62b7ed2..1908b93 100644
1042 --- a/misc/sys/param.h
1043 +++ b/misc/sys/param.h
1045 #if !defined NOFILE && defined OPEN_MAX
1046 # define NOFILE OPEN_MAX
1048 +#if !defined MAXHOSTNAMELEN && defined HOST_NAME_MAX
1049 +# define MAXHOSTNAMELEN HOST_NAME_MAX
1053 # define NCARGS ARG_MAX
1054 diff --git a/misc/tst-mntent-blank-corrupt.c b/misc/tst-mntent-blank-corrupt.c
1055 new file mode 100644
1056 index 0000000..92266a3
1058 +++ b/misc/tst-mntent-blank-corrupt.c
1060 +/* Make sure blank lines does not cause memory corruption BZ #18887.
1062 + Copyright (C) 2009-2015 Free Software Foundation, Inc.
1063 + This file is part of the GNU C Library.
1065 + The GNU C Library is free software; you can redistribute it and/or
1066 + modify it under the terms of the GNU Lesser General Public
1067 + License as published by the Free Software Foundation; either
1068 + version 2.1 of the License, or (at your option) any later version.
1070 + The GNU C Library is distributed in the hope that it will be useful,
1071 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1072 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1073 + Lesser General Public License for more details.
1075 + You should have received a copy of the GNU Lesser General Public
1076 + License along with the GNU C Library; if not, see
1077 + <http://www.gnu.org/licenses/>. */
1079 +#include <mntent.h>
1081 +#include <string.h>
1083 +/* Make sure blank lines don't trigger memory corruption. This doesn't happen
1084 + for all targets though, so it's a best effort test BZ #18887. */
1091 + fputs ("\n \n/foo\\040dir /bar\\040dir auto bind \t \n", fp);
1094 + /* The corruption happens here ... */
1096 + /* ... but trigers here. */
1099 + /* If the test failed, we would crash, and not hit this point. */
1103 +#define TEST_FUNCTION do_test ()
1104 +#include "../test-skeleton.c"
1105 diff --git a/misc/tst-mntent-blank-passno.c b/misc/tst-mntent-blank-passno.c
1106 new file mode 100644
1107 index 0000000..fc04291
1109 +++ b/misc/tst-mntent-blank-passno.c
1111 +/* Make sure trailing whitespace is handled properly BZ #17273.
1113 + Copyright (C) 2009-2015 Free Software Foundation, Inc.
1114 + This file is part of the GNU C Library.
1116 + The GNU C Library is free software; you can redistribute it and/or
1117 + modify it under the terms of the GNU Lesser General Public
1118 + License as published by the Free Software Foundation; either
1119 + version 2.1 of the License, or (at your option) any later version.
1121 + The GNU C Library is distributed in the hope that it will be useful,
1122 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1123 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1124 + Lesser General Public License for more details.
1126 + You should have received a copy of the GNU Lesser General Public
1127 + License along with the GNU C Library; if not, see
1128 + <http://www.gnu.org/licenses/>. */
1130 +#include <mntent.h>
1132 +#include <string.h>
1134 +/* Check entries to make sure trailing whitespace is ignored and we return the
1135 + correct passno value BZ #17273. */
1141 + struct mntent *mnt;
1144 + fputs ("/foo\\040dir /bar\\040dir auto bind \t \n", fp);
1147 + mnt = getmntent (fp);
1148 + if (strcmp (mnt->mnt_fsname, "/foo dir") != 0
1149 + || strcmp (mnt->mnt_dir, "/bar dir") != 0
1150 + || strcmp (mnt->mnt_type, "auto") != 0
1151 + || strcmp (mnt->mnt_opts, "bind") != 0
1152 + || mnt->mnt_freq != 0
1153 + || mnt->mnt_passno != 0)
1155 + puts ("Error while reading entry with trailing whitespaces");
1162 +#define TEST_FUNCTION do_test ()
1163 +#include "../test-skeleton.c"
1164 diff --git a/misc/tst-mntent.c b/misc/tst-mntent.c
1165 index 876c89f..820b354 100644
1166 --- a/misc/tst-mntent.c
1167 +++ b/misc/tst-mntent.c
1168 @@ -73,26 +73,6 @@ main (int argc, char *argv[])
1169 puts ("Error while reading written entry back in");
1173 - /* Part III: Entry with whitespaces at the end of a line. */
1176 - fputs ("/foo\\040dir /bar\\040dir auto bind \t \n", fp);
1180 - mnt = getmntent (fp);
1182 - if (strcmp (mnt->mnt_fsname, "/foo dir") != 0
1183 - || strcmp (mnt->mnt_dir, "/bar dir") != 0
1184 - || strcmp (mnt->mnt_type, "auto") != 0
1185 - || strcmp (mnt->mnt_opts, "bind") != 0
1186 - || mnt->mnt_freq != 0
1187 - || mnt->mnt_passno != 0)
1189 - puts ("Error while reading entry with trailing whitespaces");
1195 diff --git a/scripts/test-installation.pl b/scripts/test-installation.pl
1196 index cac1562..79b2b3e 100755
1197 --- a/scripts/test-installation.pl
1198 +++ b/scripts/test-installation.pl
1199 @@ -80,16 +80,25 @@ arglist: while (@ARGV) {
1200 # We expect none or one argument.
1202 $soversions="soversions.mk";
1203 + $config="config.make";
1204 } elsif ($#ARGV == 0) {
1206 $soversions = "$ARGV[0]/soversions.mk";
1207 + $config = "$ARGV[0]/config.make";
1209 - $soversions = $ARGV[0];
1210 + $soversions = $dir = $ARGV[0];
1211 + $dir =~ s!/?[^/]*/*$!!;
1212 + $config = $dir . "/config.make";
1215 die "Wrong number of arguments.";
1218 +if (system ("grep -q \"build-mathvec = yes\" $config") == 0) {
1219 + $build_mathvec = 1;
1221 + $build_mathvec = 0;
1224 # Read names and versions of all shared libraries that are part of
1226 @@ -111,6 +120,8 @@ while (<SOVERSIONS>) {
1227 # - libthread_db since it contains unresolved references
1228 # - it's just a test NSS module
1229 # - We don't provide the libgcc so we don't test it
1230 + # - libmvec if it wasn't built
1231 + next if ($build_mathvec == 0 && $name eq "mvec");
1232 if ($name ne "nss_ldap" && $name ne "db1"
1233 && !($name =~/^nss1_/) && $name ne "thread_db"
1234 && $name ne "nss_test1" && $name ne "libgcc_s") {
1235 diff --git a/stdlib/cxa_thread_atexit_impl.c b/stdlib/cxa_thread_atexit_impl.c
1236 index 2d5d56a..5717f09 100644
1237 --- a/stdlib/cxa_thread_atexit_impl.c
1238 +++ b/stdlib/cxa_thread_atexit_impl.c
1239 @@ -98,6 +98,10 @@ static __thread struct link_map *lm_cache;
1241 __cxa_thread_atexit_impl (dtor_func func, void *obj, void *dso_symbol)
1244 + PTR_MANGLE (func);
1248 struct dtor_list *new = calloc (1, sizeof (struct dtor_list));
1250 @@ -142,9 +146,13 @@ __call_tls_dtors (void)
1251 while (tls_dtor_list)
1253 struct dtor_list *cur = tls_dtor_list;
1254 + dtor_func func = cur->func;
1255 +#ifdef PTR_DEMANGLE
1256 + PTR_DEMANGLE (func);
1259 tls_dtor_list = tls_dtor_list->next;
1260 - cur->func (cur->obj);
1263 /* Ensure that the MAP dereference happens before
1264 l_tls_dtor_count decrement. That way, we protect this access from a
1265 diff --git a/string/Makefile b/string/Makefile
1266 index 8424a61..ebe9354 100644
1267 --- a/string/Makefile
1268 +++ b/string/Makefile
1269 @@ -54,7 +54,7 @@ tests := tester inl-tester noinl-tester testcopy test-ffs \
1270 tst-strtok tst-strxfrm bug-strcoll1 tst-strfry \
1271 bug-strtok1 $(addprefix test-,$(strop-tests)) \
1272 bug-envz1 tst-strxfrm2 tst-endian tst-svc2 \
1274 + tst-strtok_r bug-strcoll2
1276 xtests = tst-strcoll-overflow
1278 @@ -75,4 +75,17 @@ ifeq ($(run-built-tests),yes)
1279 $(objpfx)tst-svc-cmp.out: tst-svc.expect $(objpfx)tst-svc.out
1283 +LOCALES := de_DE.UTF-8 en_US.ISO-8859-1 en_US.UTF-8 \
1284 + tr_TR.ISO-8859-9 tr_TR.UTF-8 cs_CZ.UTF-8 \
1286 +include ../gen-locales.mk
1288 +$(objpfx)test-strcasecmp.out: $(gen-locales)
1289 +$(objpfx)test-strncasecmp.out: $(gen-locales)
1290 +$(objpfx)tst-strxfrm.out: $(gen-locales)
1291 +$(objpfx)tst-strxfrm2.out: $(gen-locales)
1292 +# bug-strcoll2 needs cs_CZ.UTF-8 and da_DK.ISO-8859-1.
1293 +$(objpfx)bug-strcoll2.out: $(gen-locales)
1296 diff --git a/string/bug-strcoll2.c b/string/bug-strcoll2.c
1297 new file mode 100644
1298 index 0000000..72a9ff2
1300 +++ b/string/bug-strcoll2.c
1302 +/* Bug 18589: sort-test.sh fails at random.
1303 + Copyright (C) 2015 Free Software Foundation, Inc.
1304 + This file is part of the GNU C Library.
1306 + The GNU C Library is free software; you can redistribute it and/or
1307 + modify it under the terms of the GNU Lesser General Public
1308 + License as published by the Free Software Foundation; either
1309 + version 2.1 of the License, or (at your option) any later version.
1311 + The GNU C Library is distributed in the hope that it will be useful,
1312 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1313 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1314 + Lesser General Public License for more details.
1316 + You should have received a copy of the GNU Lesser General Public
1317 + License along with the GNU C Library; if not, see
1318 + <http://www.gnu.org/licenses/>. */
1321 +#include <string.h>
1322 +#include <locale.h>
1324 +/* An incorrect strcoll optimization resulted in incorrect
1325 + results from strcoll for cs_CZ and da_DK. */
1330 + const char t1[] = "config";
1331 + const char t2[] = "choose";
1332 + if (setlocale (LC_ALL, "cs_CZ.UTF-8") == NULL)
1334 + perror ("setlocale");
1337 + /* In Czech the digraph ch sorts after c, therefore we expect
1338 + config to sort before choose. */
1339 + int a = strcoll (t1, t2);
1340 + int b = strcoll (t2, t1);
1341 + printf ("strcoll (\"%s\", \"%s\") = %d\n", t1, t2, a);
1342 + printf ("strcoll (\"%s\", \"%s\") = %d\n", t2, t1, b);
1343 + if (a < 0 && b > 0)
1345 + puts ("PASS: config < choose");
1350 + puts ("FAIL: Wrong sorting in cs_CZ.UTF-8.");
1358 + const char t1[] = "AS";
1359 + const char t2[] = "AA";
1360 + if (setlocale (LC_ALL, "da_DK.ISO-8859-1") == NULL)
1362 + perror ("setlocale");
1365 + /* AA should be treated as the last letter of the Danish alphabet,
1366 + hence sorting after AS. */
1367 + int a = strcoll (t1, t2);
1368 + int b = strcoll (t2, t1);
1369 + printf ("strcoll (\"%s\", \"%s\") = %d\n", t1, t2, a);
1370 + printf ("strcoll (\"%s\", \"%s\") = %d\n", t2, t1, b);
1371 + if (a < 0 && b > 0)
1373 + puts ("PASS: AS < AA");
1378 + puts ("FAIL: Wrong sorting in da_DK.ISO-8859-1");
1387 + err |= test_cs_CZ ();
1388 + err |= test_da_DK ();
1392 +#define TEST_FUNCTION do_test ()
1393 +#include "../test-skeleton.c"
1394 diff --git a/string/strcoll_l.c b/string/strcoll_l.c
1395 index 8f1225f..35bc0e4 100644
1396 --- a/string/strcoll_l.c
1397 +++ b/string/strcoll_l.c
1399 # define STRING_TYPE char
1400 # define USTRING_TYPE unsigned char
1401 # define STRCOLL __strcoll_l
1402 -# define STRDIFF __strdiff
1403 # define STRCMP strcmp
1404 # define WEIGHT_H "../locale/weight.h"
1407 #include "../locale/localeinfo.h"
1410 -#define MASK_UTF8_7BIT (1 << 7)
1411 -#define MASK_UTF8_START (3 << 6)
1414 -STRDIFF (const STRING_TYPE *s, const STRING_TYPE *t)
1418 - for (n = 0; *s != '\0' && *s++ == *t++; ++n)
1424 /* Track status while looking for sequences in a string. */
1427 @@ -269,29 +254,9 @@ STRCOLL (const STRING_TYPE *s1, const STRING_TYPE *s2, __locale_t l)
1428 const USTRING_TYPE *extra;
1429 const int32_t *indirect;
1431 - /* In case there is no locale specific sort order (C / POSIX). */
1433 return STRCMP (s1, s2);
1435 - /* Fast forward to the position of the first difference. Needs to be
1436 - encoding aware as the byte-by-byte comparison can stop in the middle
1437 - of a char sequence for multibyte encodings like UTF-8. */
1438 - uint_fast32_t encoding =
1439 - current->values[_NL_ITEM_INDEX (_NL_COLLATE_ENCODING_TYPE)].word;
1440 - if (encoding != __cet_other)
1442 - size_t diff = STRDIFF (s1, s2);
1445 - if (encoding == __cet_utf8 && (*(s1 + diff) & MASK_UTF8_7BIT) != 0)
1448 - while (diff > 0 && (*(s1 + diff) & MASK_UTF8_START) != MASK_UTF8_START);
1454 /* Catch empty strings. */
1455 if (__glibc_unlikely (*s1 == '\0') || __glibc_unlikely (*s2 == '\0'))
1456 return (*s1 != '\0') - (*s2 != '\0');
1457 @@ -358,8 +323,7 @@ STRCOLL (const STRING_TYPE *s1, const STRING_TYPE *s2, __locale_t l)
1458 byte-level comparison to ensure that we don't waste time
1459 going through multiple passes for totally equal strings
1460 before proceeding to subsequent passes. */
1461 - if (pass == 0 && encoding == __cet_other &&
1462 - STRCMP (s1, s2) == 0)
1463 + if (pass == 0 && STRCMP (s1, s2) == 0)
1467 diff --git a/string/tst-strxfrm2.c b/string/tst-strxfrm2.c
1468 index d5a1115..bea5aa2 100644
1469 --- a/string/tst-strxfrm2.c
1470 +++ b/string/tst-strxfrm2.c
1475 + static const char test_locale[] = "de_DE.UTF-8";
1480 @@ -38,9 +40,9 @@ do_test (void)
1484 - if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL)
1485 + if (setlocale (LC_ALL, test_locale) == NULL)
1487 - puts ("setlocale failed");
1488 + printf ("cannot set locale \"%s\"\n", test_locale);
1492 diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
1493 index 7a0fe8d..78e3a97 100644
1494 --- a/sysdeps/generic/ldsodefs.h
1495 +++ b/sysdeps/generic/ldsodefs.h
1496 @@ -592,9 +592,6 @@ struct rtld_global_ro
1497 /* List of auditing interfaces. */
1498 struct audit_ifaces *_dl_audit;
1499 unsigned int _dl_naudit;
1501 - /* 0 if internal pointer values should not be guarded, 1 if they should. */
1502 - EXTERN int _dl_pointer_guard;
1504 # define __rtld_global_attribute__
1506 diff --git a/sysdeps/hppa/dl-symaddr.c b/sysdeps/hppa/dl-symaddr.c
1507 index b707c19..89d8baf 100644
1508 --- a/sysdeps/hppa/dl-symaddr.c
1509 +++ b/sysdeps/hppa/dl-symaddr.c
1510 @@ -33,3 +33,4 @@ _dl_symbol_address (struct link_map *map, const ElfW(Sym) *ref)
1512 return (void *) value;
1514 +rtld_hidden_def (_dl_symbol_address)
1515 diff --git a/sysdeps/nacl/Makefile b/sysdeps/nacl/Makefile
1516 index 6749a44..1748886 100644
1517 --- a/sysdeps/nacl/Makefile
1518 +++ b/sysdeps/nacl/Makefile
1519 @@ -132,4 +132,13 @@ ifeq ($(subdir),misc)
1520 # sysdeps/.../linux/ directories, but it's still a sysdeps decision to
1522 sysdep_headers += bits/mman-linux.h
1524 +# This defeats sysdeps/gnu/Makefile's addition of sys/mtio.h, which
1525 +# we do not want. This is a total kludge, but it seems no worse for
1526 +# now than making the sysdeps/gnu/Makefile code conditional on a
1527 +# variable we set here. If some sysdeps/.../Makefile that is later
1528 +# in the list than sysdeps/gnu needed to add to sysdep_headers, this
1529 +# would break it. But sysdeps/gnu is close to last in the list and
1530 +# this coming up seems unlikely.
1531 +override sysdep_headers := $(sysdep_headers)
1533 diff --git a/sysdeps/nacl/dl-map-segments.h b/sysdeps/nacl/dl-map-segments.h
1534 index f305da3..f2d5d84 100644
1535 --- a/sysdeps/nacl/dl-map-segments.h
1536 +++ b/sysdeps/nacl/dl-map-segments.h
1537 @@ -53,7 +53,7 @@ _dl_map_segments (struct link_map *l, int fd,
1538 const size_t maplength, bool has_holes,
1539 struct link_map *loader)
1541 - if (__builtin_expect (type, ET_DYN) == ET_DYN)
1542 + if (__glibc_likely (type == ET_DYN))
1544 /* This is a position-independent shared object. Let the system
1545 choose where to place it.
1546 @@ -165,6 +165,32 @@ _dl_map_segments (struct link_map *l, int fd,
1548 return DL_MAP_SEGMENTS_ERROR_MAP_SEGMENT;
1550 + if (__glibc_unlikely (type != ET_DYN))
1552 + /* A successful PROT_EXEC mmap would have implicitly
1553 + updated the bookkeeping so that a future
1554 + allocate_code_data call would know that this range
1555 + of the address space is already occupied. That
1556 + doesn't happen implicitly with dyncode_create, so
1557 + it's necessary to do an explicit call to update the
1559 + uintptr_t allocated_address;
1560 + error = __nacl_irt_code_data_alloc.allocate_code_data
1561 + (l->l_addr + c->mapstart, len, 0, 0, &allocated_address);
1562 + if (__glibc_unlikely (error))
1565 + return DL_MAP_SEGMENTS_ERROR_MAP_SEGMENT;
1567 + if (__glibc_unlikely
1568 + (allocated_address != l->l_addr + c->mapstart))
1570 + /* This is not a very helpful error for this case,
1571 + but there isn't really anything better to use. */
1573 + return DL_MAP_SEGMENTS_ERROR_MAP_SEGMENT;
1579 diff --git a/sysdeps/nacl/dl-sysdep-open.h b/sysdeps/nacl/dl-sysdep-open.h
1580 new file mode 100644
1581 index 0000000..38b0f9e
1583 +++ b/sysdeps/nacl/dl-sysdep-open.h
1585 +/* System-specific call to open a shared object by name. NaCl version.
1586 + Copyright (C) 2015 Free Software Foundation, Inc.
1587 + This file is part of the GNU C Library.
1589 + The GNU C Library is free software; you can redistribute it and/or
1590 + modify it under the terms of the GNU Lesser General Public
1591 + License as published by the Free Software Foundation; either
1592 + version 2.1 of the License, or (at your option) any later version.
1594 + The GNU C Library is distributed in the hope that it will be useful,
1595 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1596 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1597 + Lesser General Public License for more details.
1599 + You should have received a copy of the GNU Lesser General Public
1600 + License along with the GNU C Library; if not, see
1601 + <http://www.gnu.org/licenses/>. */
1603 +#ifndef _DL_SYSDEP_OPEN_H
1604 +#define _DL_SYSDEP_OPEN_H 1
1606 +#include <stddef.h>
1608 +/* NAME is a name without slashes, as it appears in a DT_NEEDED entry
1609 + or a dlopen call's argument or suchlike. NAMELEN is (strlen (NAME) + 1).
1611 + Find NAME in an OS-dependent fashion, and return its "real" name.
1612 + Optionally fill in *FD with a file descriptor open on that file (or
1613 + else leave its initial value of -1). The return value is a new
1614 + malloc'd string, which will be free'd by the caller. If NAME is
1615 + resolved to an actual file that can be opened, then the return
1616 + value should name that file (and if *FD was not set, then a normal
1617 + __open call on that string will be made). If *FD was set by some
1618 + other means than a normal open and there is no "real" name to use,
1619 + then __strdup (NAME) is fine (modulo error checking). */
1621 +extern char *_dl_sysdep_open_object (const char *name, size_t namelen, int *fd)
1622 + internal_function attribute_hidden;
1624 +#endif /* dl-sysdep-open.h */
1625 diff --git a/sysdeps/nacl/dl-sysdep.c b/sysdeps/nacl/dl-sysdep.c
1626 index 3e902c2..3a04aa1 100644
1627 --- a/sysdeps/nacl/dl-sysdep.c
1628 +++ b/sysdeps/nacl/dl-sysdep.c
1629 @@ -87,3 +87,26 @@ _dl_start_user (void (*user_entry) (uint32_t info[]), uint32_t info[])
1632 #include <elf/dl-sysdep.c>
1634 +#include <dl-sysdep-open.h>
1635 +#include <nacl-interfaces.h>
1636 +#include <assert.h>
1637 +#include <string.h>
1638 +#include <unistd.h>
1642 +_dl_sysdep_open_object (const char *name, size_t namelen, int *fd)
1644 + int error = __nacl_irt_resource_open.open_resource (name, fd);
1647 + assert (*fd != -1);
1648 + char *realname = __strdup (name);
1649 + if (__glibc_unlikely (realname == NULL))
1656 diff --git a/sysdeps/nacl/nacl-interface-list.h b/sysdeps/nacl/nacl-interface-list.h
1657 index cb33751..c68faed 100644
1658 --- a/sysdeps/nacl/nacl-interface-list.h
1659 +++ b/sysdeps/nacl/nacl-interface-list.h
1660 @@ -28,7 +28,7 @@ NACL_MANDATORY_INTERFACE (rtld,
1661 NACL_IRT_FUTEX_v0_1, nacl_irt_futex)
1662 NACL_MANDATORY_INTERFACE (rtld,
1663 NACL_IRT_TLS_v0_1, nacl_irt_tls)
1664 -NACL_MANDATORY_INTERFACE (libc,
1665 +NACL_MANDATORY_INTERFACE (rtld,
1666 NACL_IRT_RESOURCE_OPEN_v0_1, nacl_irt_resource_open)
1667 NACL_MANDATORY_INTERFACE (rtld,
1668 NACL_IRT_CODE_DATA_ALLOC_v0_1,
1669 diff --git a/sysdeps/nacl/start.c b/sysdeps/nacl/start.c
1670 index a4b6dd3..8e8bc1a 100644
1671 --- a/sysdeps/nacl/start.c
1672 +++ b/sysdeps/nacl/start.c
1674 /* The application defines this, of course. */
1675 extern int main (int argc, char **argv, char **envp);
1677 +/* But maybe it defines this too, in which case it takes precedence. */
1678 +extern int __nacl_main (int argc, char **argv, char **envp)
1679 + __attribute__ ((weak));
1681 /* These are defined in libc. */
1682 extern int __libc_csu_init (int argc, char **argv, char **envp);
1683 extern void __libc_csu_fini (void);
1684 @@ -59,7 +63,7 @@ _start (uint32_t info[])
1686 /* The generic code actually assumes that envp follows argv. */
1688 - __libc_start_main (&main,
1689 + __libc_start_main (&__nacl_main ?: &main,
1690 nacl_startup_argc (info),
1691 nacl_startup_argv (info),
1692 nacl_startup_auxv (info),
1693 diff --git a/sysdeps/posix/opendir.c b/sysdeps/posix/opendir.c
1694 index 6509f5c..9edf056 100644
1695 --- a/sysdeps/posix/opendir.c
1696 +++ b/sysdeps/posix/opendir.c
1697 @@ -105,7 +105,7 @@ need_isdir_precheck (void)
1698 tryopen_o_directory ();
1700 /* We can skip the expensive `stat' call if O_DIRECTORY works. */
1701 - return o_directory_works > 0;
1702 + return o_directory_works < 0;
1706 diff --git a/sysdeps/powerpc/nptl/elide.h b/sysdeps/powerpc/nptl/elide.h
1707 index 389f5a5..2e1e443 100644
1708 --- a/sysdeps/powerpc/nptl/elide.h
1709 +++ b/sysdeps/powerpc/nptl/elide.h
1712 # include <elision-conf.h>
1714 -/* Returns true if the lock defined by is_lock_free as elided.
1715 - ADAPT_COUNT is a pointer to per-lock state variable. */
1717 +/* Get the new value of adapt_count according to the elision
1718 + configurations. Returns true if the system should retry again or false
1721 -__elide_lock (uint8_t *adapt_count, int is_lock_free)
1722 +__get_new_count (uint8_t *adapt_count, int attempt)
1724 - if (*adapt_count > 0)
1725 + /* A persistent failure indicates that a retry will probably
1726 + result in another failure. Use normal locking now and
1727 + for the next couple of calls. */
1728 + if (_TEXASRU_FAILURE_PERSISTENT (__builtin_get_texasru ()))
1731 + if (__elision_aconf.skip_lock_internal_abort > 0)
1732 + *adapt_count = __elision_aconf.skip_lock_internal_abort;
1736 - for (int i = __elision_aconf.try_tbegin; i > 0; i--)
1738 - if (__builtin_tbegin (0))
1742 - /* Lock was busy. */
1743 - __builtin_tabort (_ABORT_LOCK_BUSY);
1747 - /* A persistent failure indicates that a retry will probably
1748 - result in another failure. Use normal locking now and
1749 - for the next couple of calls. */
1750 - if (_TEXASRU_FAILURE_PERSISTENT (__builtin_get_texasru ()))
1752 - if (__elision_aconf.skip_lock_internal_abort > 0)
1753 - *adapt_count = __elision_aconf.skip_lock_internal_abort;
1756 - /* Same logic as above, but for a number of temporary failures in a
1758 - else if (__elision_aconf.skip_lock_out_of_tbegin_retries > 0
1759 - && __elision_aconf.try_tbegin > 0)
1760 - *adapt_count = __elision_aconf.skip_lock_out_of_tbegin_retries;
1765 + /* Same logic as above, but for a number of temporary failures in a
1767 + else if (attempt <= 1 && __elision_aconf.skip_lock_out_of_tbegin_retries > 0
1768 + && __elision_aconf.try_tbegin > 0)
1769 + *adapt_count = __elision_aconf.skip_lock_out_of_tbegin_retries;
1773 -# define ELIDE_LOCK(adapt_count, is_lock_free) \
1774 - __elide_lock (&(adapt_count), is_lock_free)
1778 -__elide_trylock (uint8_t *adapt_count, int is_lock_free, int write)
1780 - if (__elision_aconf.try_tbegin > 0)
1783 - __builtin_tabort (_ABORT_NESTED_TRYLOCK);
1784 - return __elide_lock (adapt_count, is_lock_free);
1788 +/* CONCURRENCY NOTES:
1790 + The evaluation of the macro expression is_lock_free encompasses one or
1791 + more loads from memory locations that are concurrently modified by other
1792 + threads. For lock elision to work, this evaluation and the rest of the
1793 + critical section protected by the lock must be atomic because an
1794 + execution with lock elision must be equivalent to an execution in which
1795 + the lock would have been actually acquired and released. Therefore, we
1796 + evaluate is_lock_free inside of the transaction that represents the
1797 + critical section for which we want to use lock elision, which ensures
1798 + the atomicity that we require. */
1800 +/* Returns 0 if the lock defined by is_lock_free was elided.
1801 + ADAPT_COUNT is a per-lock state variable. */
1802 +# define ELIDE_LOCK(adapt_count, is_lock_free) \
1805 + if (adapt_count > 0) \
1806 + (adapt_count)--; \
1808 + for (int i = __elision_aconf.try_tbegin; i > 0; i--) \
1810 + if (__builtin_tbegin (0)) \
1812 + if (is_lock_free) \
1817 + __builtin_tabort (_ABORT_LOCK_BUSY); \
1820 + if (!__get_new_count (&adapt_count,i)) \
1826 # define ELIDE_TRYLOCK(adapt_count, is_lock_free, write) \
1827 - __elide_trylock (&(adapt_count), is_lock_free, write)
1830 + if (__elision_aconf.try_tbegin > 0) \
1833 + __builtin_tabort (_ABORT_NESTED_TRYLOCK); \
1834 + ret = ELIDE_LOCK (adapt_count, is_lock_free); \
1841 diff --git a/sysdeps/sparc/sparc32/sem_open.c b/sysdeps/sparc/sparc32/sem_open.c
1842 index 16cb9ad..59df2d7 100644
1843 --- a/sysdeps/sparc/sparc32/sem_open.c
1844 +++ b/sysdeps/sparc/sparc32/sem_open.c
1846 #include <sys/mman.h>
1847 #include <sys/stat.h>
1848 #include "semaphoreP.h"
1849 +#include <futex-internal.h>
1850 #include <shm-directory.h>
1853 diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
1854 index 58c8b32..aa20e22 100644
1855 --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
1856 +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
1857 @@ -1822,9 +1822,6 @@ GLIBC_2.17
1860 __cxa_thread_atexit_impl F
1866 _IO_adjust_wcolumn F
1867 @@ -2015,6 +2012,9 @@ GLIBC_2.2.4
1877 diff --git a/sysdeps/unix/sysv/linux/hppa/bits/atomic.h b/sysdeps/unix/sysv/linux/hppa/bits/atomic.h
1878 index abde83e..6e73504 100644
1879 --- a/sysdeps/unix/sysv/linux/hppa/bits/atomic.h
1880 +++ b/sysdeps/unix/sysv/linux/hppa/bits/atomic.h
1881 @@ -56,42 +56,41 @@ typedef uintmax_t uatomic_max_t;
1883 #define _LWS_CAS "0"
1884 /* Note r31 is the link register. */
1885 -#define _LWS_CLOBBER "r1", "r26", "r25", "r24", "r23", "r22", "r21", "r20", "r28", "r31", "memory"
1886 +#define _LWS_CLOBBER "r1", "r23", "r22", "r20", "r31", "memory"
1887 /* String constant for -EAGAIN. */
1888 #define _ASM_EAGAIN "-11"
1889 /* String constant for -EDEADLOCK. */
1890 #define _ASM_EDEADLOCK "-45"
1892 #if __ASSUME_LWS_CAS
1893 -/* The only basic operation needed is compare and exchange. */
1894 +/* The only basic operation needed is compare and exchange. The mem
1895 + pointer must be word aligned. */
1896 # define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \
1898 - volatile int lws_errno; \
1899 - __typeof__ (*mem) lws_ret; \
1901 + register long lws_errno asm("r21"); \
1902 + register unsigned long lws_ret asm("r28"); \
1903 + register unsigned long lws_mem asm("r26") = (unsigned long)(mem); \
1904 + register unsigned long lws_old asm("r25") = (unsigned long)(oldval);\
1905 + register unsigned long lws_new asm("r24") = (unsigned long)(newval);\
1906 + __asm__ __volatile__( \
1908 - "copy %2, %%r26 \n\t" \
1909 - "copy %3, %%r25 \n\t" \
1910 - "copy %4, %%r24 \n\t" \
1911 "ble " _LWS "(%%sr2, %%r0) \n\t" \
1912 "ldi " _LWS_CAS ", %%r20 \n\t" \
1913 - "ldi " _ASM_EAGAIN ", %%r24 \n\t" \
1914 - "cmpb,=,n %%r24, %%r21, 0b \n\t" \
1915 + "ldi " _ASM_EAGAIN ", %%r20 \n\t" \
1916 + "cmpb,=,n %%r20, %%r21, 0b \n\t" \
1918 - "ldi " _ASM_EDEADLOCK ", %%r25 \n\t" \
1919 - "cmpb,=,n %%r25, %%r21, 0b \n\t" \
1920 + "ldi " _ASM_EDEADLOCK ", %%r20 \n\t" \
1921 + "cmpb,=,n %%r20, %%r21, 0b \n\t" \
1923 - "stw %%r28, %0 \n\t" \
1924 - "stw %%r21, %1 \n\t" \
1925 - : "=m" (lws_ret), "=m" (lws_errno) \
1926 - : "r" (mem), "r" (oldval), "r" (newval) \
1927 + : "=r" (lws_ret), "=r" (lws_errno) \
1928 + : "r" (lws_mem), "r" (lws_old), "r" (lws_new) \
1932 - if(lws_errno == -EFAULT || lws_errno == -ENOSYS) \
1933 + if (lws_errno == -EFAULT || lws_errno == -ENOSYS) \
1934 ABORT_INSTRUCTION; \
1937 + (__typeof (oldval)) lws_ret; \
1940 # define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
1941 diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
1942 index cf0ad90..224e1f3 100644
1943 --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
1944 +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
1945 @@ -95,9 +95,6 @@ GLIBC_2.18
1955 @@ -1863,6 +1860,9 @@ GLIBC_2.2.4
1965 diff --git a/sysdeps/unix/sysv/linux/microblaze/sysdep.h b/sysdeps/unix/sysv/linux/microblaze/sysdep.h
1966 index 83c0340..9d5c542 100644
1967 --- a/sysdeps/unix/sysv/linux/microblaze/sysdep.h
1968 +++ b/sysdeps/unix/sysv/linux/microblaze/sysdep.h
1970 License along with the GNU C Library; if not, see
1971 <http://www.gnu.org/licenses/>. */
1973 +#ifndef _LINUX_MICROBLAZE_SYSDEP_H
1974 +#define _LINUX_MICROBLAZE_SYSDEP_H 1
1976 +#include <sysdeps/unix/sysdep.h>
1977 #include <sysdeps/microblaze/sysdep.h>
1978 -#include <sys/syscall.h>
1980 /* Defines RTLD_PRIVATE_ERRNO. */
1981 #include <dl-sysdep.h>
1982 @@ -305,3 +308,5 @@ SYSCALL_ERROR_LABEL_DCL: \
1983 # define PTR_DEMANGLE(var) (void) (var)
1985 #endif /* not __ASSEMBLER__ */
1987 +#endif /* _LINUX_MICROBLAZE_SYSDEP_H */
1988 diff --git a/sysdeps/unix/sysv/linux/openat.c b/sysdeps/unix/sysv/linux/openat.c
1989 index 6777123..ad8e31d 100644
1990 --- a/sysdeps/unix/sysv/linux/openat.c
1991 +++ b/sysdeps/unix/sysv/linux/openat.c
1992 @@ -68,6 +68,11 @@ __OPENAT (int fd, const char *file, int oflag, ...)
1996 + /* We have to add the O_LARGEFILE flag for openat64. */
1998 + oflag |= MORE_OFLAGS;
2001 return SYSCALL_CANCEL (openat, fd, file, oflag, mode);
2003 libc_hidden_def (__OPENAT)
2004 diff --git a/sysdeps/unix/sysv/linux/powerpc/elision-lock.c b/sysdeps/unix/sysv/linux/powerpc/elision-lock.c
2005 index 7f9bcc2..c6731ca 100644
2006 --- a/sysdeps/unix/sysv/linux/powerpc/elision-lock.c
2007 +++ b/sysdeps/unix/sysv/linux/powerpc/elision-lock.c
2008 @@ -72,8 +72,7 @@ __lll_lock_elision (int *lock, short *adapt_count, EXTRAARG int pshared)
2012 - int try_begin = aconf.try_tbegin;
2014 + for (int i = aconf.try_tbegin; i > 0; i--)
2016 if (__builtin_tbegin (0))
2018 @@ -87,21 +86,19 @@ __lll_lock_elision (int *lock, short *adapt_count, EXTRAARG int pshared)
2019 /* A persistent failure indicates that a retry will probably
2020 result in another failure. Use normal locking now and
2021 for the next couple of calls. */
2022 - if (try_begin-- <= 0
2023 - || _TEXASRU_FAILURE_PERSISTENT (__builtin_get_texasru ()))
2024 + if (_TEXASRU_FAILURE_PERSISTENT (__builtin_get_texasru ()))
2026 if (aconf.skip_lock_internal_abort > 0)
2027 *adapt_count = aconf.skip_lock_internal_abort;
2030 - /* Same logic as above, but for for a number of temporary failures
2032 - else if (aconf.skip_lock_out_of_tbegin_retries > 0
2033 - && aconf.try_tbegin > 0)
2034 - *adapt_count = aconf.skip_lock_out_of_tbegin_retries;
2038 + /* Fall back to locks for a bit if retries have been exhausted */
2039 + if (aconf.try_tbegin > 0 && aconf.skip_lock_out_of_tbegin_retries > 0)
2040 + *adapt_count = aconf.skip_lock_out_of_tbegin_retries;
2043 return LLL_LOCK ((*lock), pshared);
2045 diff --git a/sysdeps/x86/fpu/bits/math-vector.h b/sysdeps/x86/fpu/bits/math-vector.h
2046 index f9e798b..f3bfb86 100644
2047 --- a/sysdeps/x86/fpu/bits/math-vector.h
2048 +++ b/sysdeps/x86/fpu/bits/math-vector.h
2050 # undef __DECL_SIMD_powf
2051 # define __DECL_SIMD_powf __DECL_SIMD_x86_64
2053 -/* Workaround to exclude unnecessary symbol aliases in libmvec
2054 - while GCC creates the vector names based on scalar asm name.
2055 - Corresponding discussion started at
2056 - <https://gcc.gnu.org/ml/gcc/2015-06/msg00173.html>. */
2057 -__asm__ ("_ZGVbN2v___log_finite = _ZGVbN2v_log");
2058 -__asm__ ("_ZGVcN4v___log_finite = _ZGVcN4v_log");
2059 -__asm__ ("_ZGVdN4v___log_finite = _ZGVdN4v_log");
2060 -__asm__ ("_ZGVeN8v___log_finite = _ZGVeN8v_log");
2061 -__asm__ ("_ZGVbN4v___logf_finite = _ZGVbN4v_logf");
2062 -__asm__ ("_ZGVcN8v___logf_finite = _ZGVcN8v_logf");
2063 -__asm__ ("_ZGVdN8v___logf_finite = _ZGVdN8v_logf");
2064 -__asm__ ("_ZGVeN16v___logf_finite = _ZGVeN16v_logf");
2065 -__asm__ ("_ZGVbN2v___exp_finite = _ZGVbN2v_exp");
2066 -__asm__ ("_ZGVcN4v___exp_finite = _ZGVcN4v_exp");
2067 -__asm__ ("_ZGVdN4v___exp_finite = _ZGVdN4v_exp");
2068 -__asm__ ("_ZGVeN8v___exp_finite = _ZGVeN8v_exp");
2069 -__asm__ ("_ZGVbN4v___expf_finite = _ZGVbN4v_expf");
2070 -__asm__ ("_ZGVcN8v___expf_finite = _ZGVcN8v_expf");
2071 -__asm__ ("_ZGVdN8v___expf_finite = _ZGVdN8v_expf");
2072 -__asm__ ("_ZGVeN16v___expf_finite = _ZGVeN16v_expf");
2073 -__asm__ ("_ZGVbN2vv___pow_finite = _ZGVbN2vv_pow");
2074 -__asm__ ("_ZGVcN4vv___pow_finite = _ZGVcN4vv_pow");
2075 -__asm__ ("_ZGVdN4vv___pow_finite = _ZGVdN4vv_pow");
2076 -__asm__ ("_ZGVeN8vv___pow_finite = _ZGVeN8vv_pow");
2077 -__asm__ ("_ZGVbN4vv___powf_finite = _ZGVbN4vv_powf");
2078 -__asm__ ("_ZGVcN8vv___powf_finite = _ZGVcN8vv_powf");
2079 -__asm__ ("_ZGVdN8vv___powf_finite = _ZGVdN8vv_powf");
2080 -__asm__ ("_ZGVeN16vv___powf_finite = _ZGVeN16vv_powf");
2084 diff --git a/sysdeps/x86_64/fpu/Makefile b/sysdeps/x86_64/fpu/Makefile
2085 index 1ebe511..b32b852 100644
2086 --- a/sysdeps/x86_64/fpu/Makefile
2087 +++ b/sysdeps/x86_64/fpu/Makefile
2088 @@ -20,7 +20,10 @@ libmvec-support += svml_d_cos2_core svml_d_cos4_core_avx \
2089 svml_d_pow_data svml_s_powf4_core svml_s_powf8_core_avx \
2090 svml_s_powf8_core svml_s_powf16_core svml_s_powf_data \
2091 svml_s_sincosf4_core svml_s_sincosf8_core_avx \
2092 - svml_s_sincosf8_core svml_s_sincosf16_core init-arch
2093 + svml_s_sincosf8_core svml_s_sincosf16_core init-arch \
2096 +libmvec-static-only-routines = svml_finite_alias
2099 # Variables for libmvec tests.
2100 diff --git a/sysdeps/x86_64/fpu/svml_finite_alias.S b/sysdeps/x86_64/fpu/svml_finite_alias.S
2101 new file mode 100644
2102 index 0000000..f8bcfeb
2104 +++ b/sysdeps/x86_64/fpu/svml_finite_alias.S
2106 +/* These aliases added as workaround to exclude unnecessary symbol
2107 + aliases in libmvec.so while compiler creates the vector names
2108 + based on scalar asm name. Corresponding discussion is at
2109 + <https://gcc.gnu.org/ml/gcc/2015-06/msg00173.html>.
2110 + Copyright (C) 2015 Free Software Foundation, Inc.
2111 + This file is part of the GNU C Library.
2113 + The GNU C Library is free software; you can redistribute it and/or
2114 + modify it under the terms of the GNU Lesser General Public
2115 + License as published by the Free Software Foundation; either
2116 + version 2.1 of the License, or (at your option) any later version.
2118 + The GNU C Library is distributed in the hope that it will be useful,
2119 + but WITHOUT ANY WARRANTY; without even the implied warranty of
2120 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2121 + Lesser General Public License for more details.
2123 + You should have received a copy of the GNU Lesser General Public
2124 + License along with the GNU C Library; if not, see
2125 + <http://www.gnu.org/licenses/>. */
2127 +#include <sysdep.h>
2129 +#define ALIAS_IMPL(alias, target) \
2136 +ALIAS_IMPL (_ZGVbN2v___log_finite, _ZGVbN2v_log)
2137 +ALIAS_IMPL (_ZGVcN4v___log_finite, _ZGVcN4v_log)
2138 +ALIAS_IMPL (_ZGVdN4v___log_finite, _ZGVdN4v_log)
2139 +ALIAS_IMPL (_ZGVeN8v___log_finite, _ZGVeN8v_log)
2141 +ALIAS_IMPL (_ZGVbN4v___logf_finite, _ZGVbN4v_logf)
2142 +ALIAS_IMPL (_ZGVcN8v___logf_finite, _ZGVcN8v_logf)
2143 +ALIAS_IMPL (_ZGVdN8v___logf_finite, _ZGVdN8v_logf)
2144 +ALIAS_IMPL (_ZGVeN16v___logf_finite, _ZGVeN16v_logf)
2146 +ALIAS_IMPL (_ZGVbN2v___exp_finite, _ZGVbN2v_exp)
2147 +ALIAS_IMPL (_ZGVcN4v___exp_finite, _ZGVcN4v_exp)
2148 +ALIAS_IMPL (_ZGVdN4v___exp_finite, _ZGVdN4v_exp)
2149 +ALIAS_IMPL (_ZGVeN8v___exp_finite, _ZGVeN8v_exp)
2151 +ALIAS_IMPL (_ZGVbN4v___expf_finite, _ZGVbN4v_expf)
2152 +ALIAS_IMPL (_ZGVcN8v___expf_finite, _ZGVcN8v_expf)
2153 +ALIAS_IMPL (_ZGVdN8v___expf_finite, _ZGVdN8v_expf)
2154 +ALIAS_IMPL (_ZGVeN16v___expf_finite, _ZGVeN16v_expf)
2156 +ALIAS_IMPL (_ZGVbN2vv___pow_finite, _ZGVbN2vv_pow)
2157 +ALIAS_IMPL (_ZGVcN4vv___pow_finite, _ZGVcN4vv_pow)
2158 +ALIAS_IMPL (_ZGVdN4vv___pow_finite, _ZGVdN4vv_pow)
2159 +ALIAS_IMPL (_ZGVeN8vv___pow_finite, _ZGVeN8vv_pow)
2161 +ALIAS_IMPL (_ZGVbN4vv___powf_finite, _ZGVbN4vv_powf)
2162 +ALIAS_IMPL (_ZGVcN8vv___powf_finite, _ZGVcN8vv_powf)
2163 +ALIAS_IMPL (_ZGVdN8vv___powf_finite, _ZGVdN8vv_powf)
2164 +ALIAS_IMPL (_ZGVeN16vv___powf_finite, _ZGVeN16vv_powf)
2165 diff --git a/wcsmbs/wcscoll_l.c b/wcsmbs/wcscoll_l.c
2166 index 6d9384a..87f240d 100644
2167 --- a/wcsmbs/wcscoll_l.c
2168 +++ b/wcsmbs/wcscoll_l.c
2170 #define STRING_TYPE wchar_t
2171 #define USTRING_TYPE wint_t
2172 #define STRCOLL __wcscoll_l
2173 -#define STRDIFF __wcsdiff
2174 #define STRCMP __wcscmp
2175 #define WEIGHT_H "../locale/weightwc.h"