]> git.pld-linux.org Git - packages/glibc.git/blob - glibc-git.patch
- upstream commited fix, so use that (is the same as glibc-CVE-2015-7547.patch)
[packages/glibc.git] / glibc-git.patch
1 diff --git a/ChangeLog b/ChangeLog
2 index cb9124e..758521d 100644
3 --- a/ChangeLog
4 +++ b/ChangeLog
5 @@ -1,3 +1,332 @@
6 +2016-02-15  Carlos O'Donell  <carlos@redhat.com>
7 +
8 +       [BZ #18665]
9 +       * resolv/nss_dns/dns-host.c (gaih_getanswer_slice): Always set
10 +       *herrno_p.
11 +       (gaih_getanswer): Document functional behviour. Return tryagain
12 +       if any result is tryagain.
13 +       * resolv/res_query.c (__libc_res_nsearch): Set buffer size to zero
14 +       when freed.
15 +       * resolv/res_send.c: Add copyright text.
16 +       (__libc_res_nsend): Document that MAXPACKET is expected.
17 +       (send_vc): Document. Remove buffer reuse.
18 +       (send_dg): Document. Remove buffer reuse. Set *thisanssizp to set the
19 +       size of the buffer. Add Dprint for truncated UDP buffer.
20 +
21 +2016-02-12  Florian Weimer  <fweimer@redhat.com>
22 +
23 +       * misc/bug18240.c (do_test): Set RLIMIT_AS.
24 +
25 +2016-01-27  Paul Eggert  <eggert@cs.ucla.edu>
26 +
27 +       [BZ #18240]
28 +       * misc/hsearch_r.c (isprime, __hcreate_r): Protect against
29 +       unsigned int wraparound.
30 +
31 +2016-01-27  Florian Weimer  <fweimer@redhat.com>
32 +
33 +       [BZ #18240]
34 +       * misc/bug18240.c: New test.
35 +       * misc/Makefile (tests): Add it.
36 +
37 +2015-08-25  Ondřej Bílka  <neleai@seznam.cz>
38 +
39 +       [BZ #18240]
40 +       * misc/hsearch_r.c (__hcreate_r): Handle overflow.
41 +
42 +2015-10-27  Ludovic Courtès  <ludo@gnu.org>
43 +
44 +       * locale/loadlocale.c (_nl_intern_locale_data): Change assertion
45 +       on CNT to a conditional jump to 'puntdata'.
46 +
47 +2015-08-18  Alan Modra  <amodra@gmail.com>
48 +
49 +       [BZ #18421]
50 +       * sysdeps/hppa/start.S [SHARED]: Use .section .data.rel.ro and define
51 +       .Lp__global.
52 +       (_start): Load %dp via .Lp__global.
53 +       [!SHARED]: Use .section .rodata.
54 +
55 +2015-08-09  John David Anglin  <danglin@gcc.gnu.org>
56 +
57 +       [BZ #18480]
58 +       * sysdeps/unix/sysv/linux/hppa/sysdep.h (LOAD_ARGS_0, LOAD_ARGS_1,
59 +       LOAD_ARGS_2, LOAD_ARGS_3, LOAD_ARGS_4, LOAD_ARGS_5, LOAD_ARGS_6):
60 +       Define.
61 +       (LOAD_REGS_0, LOAD_REGS_1, LOAD_REGS_2, LOAD_REGS_3, LOAD_REGS_4,
62 +       LOAD_REGS_5, LOAD_REGS_6): Update.
63 +       (INTERNAL_SYSCALL): Update using new LOAD defines.
64 +       (INTERNAL_SYSCALL_NCS): Likewise.
65 +       * sysdeps/unix/sysv/linux/hppa/syscall.c (syscall): Likewise.
66 +
67 +2015-09-26  Paul Pluzhnikov  <ppluzhnikov@google.com>
68 +
69 +       [BZ #18985]
70 +       * time/strftime_l.c (a_wkday, f_wkday, a_month, f_month): Range check.
71 +       (__strftime_internal): Likewise.
72 +       * time/tst-strftime.c (do_bz18985): New test.
73 +       (do_test): Call it.
74 +
75 +2015-08-08  Paul Pluzhnikov  <ppluzhnikov@google.com>
76 +
77 +       [BZ #17905]
78 +       * catgets/Makefile (tst-catgets-mem): New test.
79 +       * catgets/catgets.c (catopen): Don't use unbounded alloca.
80 +       * catgets/open_catalog.c (__open_catalog): Likewise.
81 +       * catgets/tst-catgets.c (do_bz17905): Test unbounded alloca.
82 +
83 +2015-12-31  Aurelien Jarno  <aurelien@aurel32.net>
84 +
85 +       * sysdeps/unix/sysv/linux/alpha/libc.abilist [GLIBC_2.22]: Move
86 +       to keep the file sorted.
87 +       * sysdeps/unix/sysv/linux/hppa/libc.abilist [GLIBC_2.22]: Likewise.
88 +
89 +2015-12-17  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
90 +
91 +       [BZ #19174]
92 +       * sysdeps/powerpc/nptl/elide.h (__elide_lock): Fix usage of
93 +       .skip_lock_out_of_tbegin_retries.
94 +       * sysdeps/unix/sysv/linux/powerpc/elision-lock.c
95 +       (__lll_lock_elision): Likewise, and respect a value of
96 +       try_tbegin <= 0.
97 +
98 +2015-12-03  Andrew Senkevich  <andrew.senkevich@intel.com>
99 +
100 +       * math/Makefile ($(inst_libdir)/libm.so): Corrected path to
101 +       libmvec_nonshared.a
102 +
103 +2015-11-27  Andrew Senkevich  <andrew.senkevich@intel.com>
104 +
105 +       [BZ #19058]
106 +       * math/Makefile ($(inst_libdir)/libm.so): Added libmvec_nonshared.a to
107 +       AS_NEEDED.
108 +       * sysdeps/x86/fpu/bits/math-vector.h: Removed code with asm aliases
109 +       workaround.
110 +       * sysdeps/x86_64/fpu/Makefile (libmvec-support,
111 +       libmvec-static-only-routines): Added new file.
112 +       * sysdeps/x86_64/fpu/svml_finite_alias.S: New file.
113 +       * NEWS: Mention this fix.
114 +
115 +2015-11-20  Roland McGrath  <roland@hack.frob.com>
116 +
117 +       * sysdeps/nacl/dl-map-segments.h (_dl_map_segments): Use
118 +       __glibc_likely instead of __builtin_expect.  After falling back to
119 +       dyncode_create in a non-ET_DYN case, use the allocate_code_data
120 +       system interface to register the code pages as occupied.
121 +
122 +2015-11-14  H.J. Lu  <hongjiu.lu@intel.com>
123 +
124 +       * config.make.in (have-glob-dat-reloc): New.
125 +       * configure.ac (libc_cv_has_glob_dat): New.  Set to yes if
126 +       target supports GLOB_DAT relocaton. AC_SUBST.
127 +       * configure: Regenerated.
128 +       * elf/Makefile (tests): Add tst-prelink.
129 +       (tests-special): Add $(objpfx)tst-prelink-cmp.out.
130 +       (tst-prelink-ENV): New.
131 +       ($(objpfx)tst-prelink-conflict.out): Likewise.
132 +       ($(objpfx)tst-prelink-cmp.out): Likewise.
133 +       * sysdeps/x86/tst-prelink.c: Moved to ...
134 +       * elf/tst-prelink.c: Here.
135 +       * sysdeps/x86/tst-prelink.exp: Moved to ...
136 +       * elf/tst-prelink.exp: Here.
137 +       * sysdeps/x86/Makefile (tests): Don't add tst-prelink.
138 +       (tst-prelink-ENV): Removed.
139 +       ($(objpfx)tst-prelink-conflict.out): Likewise.
140 +       ($(objpfx)tst-prelink-cmp.out): Likewise.
141 +       (tests-special): Don't add $(objpfx)tst-prelink-cmp.out.
142 +
143 +2015-11-10  Roland McGrath  <roland@hack.frob.com>
144 +
145 +       * elf/dl-load.c (open_verify): Take new argument FD.
146 +       Skip __open call if passed FD is not -1.
147 +       (_dl_map_object, open_path): Update callers.
148 +       * elf/dl-sysdep-open.h: New file.
149 +       * elf/dl-load.c: Include it.
150 +       (_dl_map_object): Try _dl_sysdep_open_object before ldconfig cache.
151 +       * sysdeps/nacl/dl-sysdep.c (_dl_sysdep_open_object): New function.
152 +       * sysdeps/nacl/dl-sysdep-open.h: New file.
153 +       * sysdeps/nacl/nacl-interface-list.h: Move nacl_irt_resource_open
154 +       from libc to rtld.
155 +
156 +2015-11-10  H.J. Lu  <hongjiu.lu@intel.com>
157 +
158 +       [BZ #19178]
159 +       * sysdeps/x86/Makefile (tests): Add tst-prelink.
160 +       (tst-prelink-ENV): New.
161 +       ($(objpfx)tst-prelink-conflict.out): Likewise.
162 +       ($(objpfx)tst-prelink-cmp.out): Likewise.
163 +       (tests-special): Add $(objpfx)tst-prelink-cmp.out.
164 +       * sysdeps/x86/tst-prelink.c: New file.
165 +       * sysdeps/x86/tst-prelink.exp: Likewise.
166 +
167 +2015-11-07  H.J. Lu  <hongjiu.lu@intel.com>
168 +
169 +       [BZ #19178]
170 +       * elf/dl-lookup.c (RTYPE_CLASS_VALID): New.
171 +       (RTYPE_CLASS_PLT): Likewise.
172 +       (RTYPE_CLASS_COPY): Likewise.
173 +       (RTYPE_CLASS_TLS): Likewise.
174 +       (_dl_debug_bindings): Use RTYPE_CLASS_TLS and RTYPE_CLASS_VALID
175 +       to set relocation type class for DL_DEBUG_PRELINK.  Keep only
176 +       ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY bits for
177 +       DL_DEBUG_PRELINK.
178 +
179 +2015-10-20  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
180 +
181 +       [BZ #18743]
182 +       * sysdeps/powerpc/nptl/elide.h (__elide_lock): Move most of this
183 +       code to...
184 +       (ELIDE_LOCK): ...here.
185 +       (__get_new_count): New function with part of the code from
186 +       __elide_lock that updates the value of adapt_count after a
187 +       transaction abort.
188 +       (__elided_trylock): Moved this code to...
189 +       (ELIDE_TRYLOCK): ...here.
190 +
191 +2015-10-06  Florian Weimer  <fweimer@redhat.com>
192 +
193 +       [BZ #19018]
194 +       * stdlib/cxa_thread_atexit_impl.c (__cxa_thread_atexit_impl):
195 +       Mangle function pointer before storing it.
196 +       (__call_tls_dtors): Demangle function pointer before calling it.
197 +
198 +2015-10-15  Florian Weimer  <fweimer@redhat.com>
199 +
200 +       [BZ #18928]
201 +       * sysdeps/generic/ldsodefs.h (struct rtld_global_ro): Remove
202 +       _dl_pointer_guard member.
203 +       * elf/rtld.c (_rtld_global_ro): Remove _dl_pointer_guard
204 +       initializer.
205 +       (security_init): Always set up pointer guard.
206 +       (process_envvars): Do not process LD_POINTER_GUARD.
207 +
208 +2015-10-09  Carlos O'Donell  <carlos@redhat.com>
209 +
210 +       [BZ #18589]
211 +       * string/bug-strcoll2.c: Adjust copyright, and remove contributed by.
212 +       * string/Makefile ($(objpfx)bug-strcoll2.out): Depend on
213 +       $(gen-locales).
214 +
215 +2015-10-08  Carlos O'Donell  <carlos@redhat.com>
216 +
217 +       [BZ #18589]
218 +       * string/Makefile (tests): Add bug-strcoll2.
219 +       (LOCALES): Add cs_CZ.UTF-8.
220 +
221 +2015-09-28  Martin Sebor  <msebor@redhat.com>
222 +
223 +       [BZ #18969]
224 +       * string/Makefile (LOCALES): Define.
225 +       (gen-locales.mk): Include.
226 +       (test-strcasecmp.out, test-strncasecmp.out, tst-strxfrm.out)
227 +       (tst-strxfrm2.out): Add deppendency on $(gen-locales).
228 +       * string/tst-strxfrm2.c (do_test): Print the name of the locale
229 +       on setlocale failure.
230 +
231 +2015-10-08  Carlos O'Donell  <carlos@redhat.com>
232 +
233 +       [BZ #18589]
234 +       * string/bug-strcoll2.c: New file.
235 +       * locale/categories.def: Revert commit
236 +       f13c2a8dff2329c6692a80176262ceaaf8a6f74e.
237 +       * locale/langinfo.h: Likewise.
238 +       * locale/localeinfo.h: Likewise.
239 +       * locale/C-collate.c: Likewise.
240 +       * programs/ld-collate.c (collate_output): Likewise.
241 +       * string/strcoll_l.c (STRDIFF): Likewise.
242 +       (STRCOLL): Likewise.
243 +       * wcsmbs/wcscoll_l.c: Likewise.
244 +
245 +2015-09-15  Roland McGrath  <roland@hack.frob.com>
246 +
247 +       * misc/sys/param.h [!MAXHOSTNAMELEN && HOST_NAME_MAX]
248 +       (MAXHOSTNAMELEN): Define it to HOST_NAME_MAX.
249 +
250 +2015-09-11  Roland McGrath  <roland@hack.frob.com>
251 +
252 +       * sysdeps/nacl/Makefile [$(subdir) = misc] (sysdep_headers):
253 +       Use 'override' keyword to freeze the value here, preventing
254 +       the addition of sys/mtio.h by sysdeps/gnu/Makefile.
255 +
256 +2015-09-04  Roland McGrath  <roland@hack.frob.com>
257 +
258 +       [BZ #18921]
259 +       * sysdeps/posix/opendir.c (need_isdir_precheck) [O_DIRECTORY]:
260 +       Fix inverted sense of test of 'o_directory_works' value.
261 +       Reported by Pádraig Brady <P@draigBrady.com>, diagnosed by
262 +       Bernhard Voelker <mail@bernhard-voelker.de>.
263 +
264 +2015-08-31  Brett Neumeier <brett@neumeier.us>
265 +
266 +       [BZ #18870]
267 +       * sysdeps/sparc/sparc32/sem_open.c: Add missing #include
268 +
269 +2015-08-28  Mike Frysinger  <vapier@gentoo.org>
270 +
271 +       [BZ #18887]
272 +       * misc/Makefile (tests): Add tst-mntent-blank-corrupt and
273 +       tst-mntent-blank-passno.
274 +       * misc/mntent_r.c (__getmntent_r): Do not read past buffer[0].
275 +       * misc/tst-mntent-blank-corrupt.c: New test.
276 +       * misc/tst-mntent-blank-passno.c: New test ripped from ...
277 +       * misc/tst-mntent.c (do_test): ... here.
278 +
279 +2015-08-25  Roland McGrath  <roland@hack.frob.com>
280 +
281 +       * sysdeps/nacl/start.c (_start): Call __nacl_main instead of main
282 +       if the weak reference is not null.
283 +
284 +2015-08-19  Andrew Senkevich  <andrew.senkevich@intel.com>
285 +
286 +       [BZ #18796]
287 +       * scripts/test-installation.pl: Don't add -lmvec to build options
288 +       if libmvec wasn't built.
289 +       * NEWS: Mention this fix.
290 +
291 +2015-08-10  Maxim Ostapenko  <m.ostapenko@partner.samsung.com>
292 +
293 +       [BZ #18778]
294 +       * elf/Makefile (tests): Add Add tst-nodelete2.
295 +       (modules-names): Add tst-nodelete2mod.
296 +       (tst-nodelete2mod.so-no-z-defs): New.
297 +       ($(objpfx)tst-nodelete2): Likewise.
298 +       ($(objpfx)tst-nodelete2.out): Likewise.
299 +       (LDFLAGS-tst-nodelete2): Likewise.
300 +       * elf/dl-close.c (_dl_close_worker): Move DF_1_NODELETE clearing
301 +       out of loop through all loaded libraries.
302 +       * elf/tst-nodelete2.c: New file.
303 +       * elf/tst-nodelete2mod.c: Likewise.
304 +
305 +2015-08-10  Andreas Schwab  <schwab@suse.de>
306 +
307 +       [BZ #18781]
308 +       * sysdeps/unix/sysv/linux/openat.c (__OPENAT) [MORE_OFLAGS]: Add
309 +       MORE_OFLAGS to oflag.
310 +       * io/test-lfs.c (do_test): Test openat64.
311 +
312 +2015-08-08  John David Anglin  <danglin@gcc.gnu.org>
313 +
314 +       [BZ #18787]
315 +       * sysdeps/unix/sysv/linux/hppa/bits/atomic.h (_LWS_CLOBBER): Revise
316 +       clobber registers.
317 +       (atomic_compare_and_exchange_val_acq): Use register asms to assign
318 +       operand registers.  Use register %r20 for EAGAIN and EDEADLOCK checks.
319 +       Cast return to __typeof (oldval).
320 +
321 +2015-08-08  Mike Frysinger  <vapier@gentoo.org>
322 +
323 +       * sysdeps/unix/sysv/linux/microblaze/sysdep.h: Wrap the whole file
324 +       in _LINUX_MICROBLAZE_SYSDEP_H defines.  Include sysdeps/unix/sysdep.h
325 +       and delete sys/syscall.h include.
326 +
327 +2015-08-07  Mike Frysinger  <vapier@gentoo.org>
328 +
329 +       * sysdeps/hppa/dl-symaddr.c (_dl_symbol_address): Add rtld_hidden_def.
330 +
331 +2015-08-05  Zack Weinberg  <zackw@panix.com>
332 +
333 +       * misc/regexp.h: Update comments.
334 +
335  2015-08-05  Carlos O'Donell  <carlos@systemhalted.org>
336  
337         * version.h (RELEASE): Set to "stable".
338 diff --git a/NEWS b/NEWS
339 index 4c31de7..81ceeae 100644
340 --- a/NEWS
341 +++ b/NEWS
342 @@ -5,6 +5,30 @@ See the end for copying conditions.
343  Please send GNU C library bug reports via <http://sourceware.org/bugzilla/>
344  using `glibc' in the "product" field.
345  \f
346 +Version 2.22.1
347 +
348 +* A stack-based buffer overflow was found in libresolv when invoked from
349 +  libnss_dns, allowing specially crafted DNS responses to seize control
350 +  of execution flow in the DNS client.  The buffer overflow occurs in
351 +  the functions send_dg (send datagram) and send_vc (send TCP) for the
352 +  NSS module libnss_dns.so.2 when calling getaddrinfo with AF_UNSPEC
353 +  family.  The use of AF_UNSPEC triggers the low-level resolver code to
354 +  send out two parallel queries for A and AAAA.  A mismanagement of the
355 +  buffers used for those queries could result in the response of a query
356 +  writing beyond the alloca allocated buffer created by
357 +  _nss_dns_gethostbyname4_r.  Buffer management is simplified to remove
358 +  the overflow.  Thanks to the Google Security Team and Red Hat for
359 +  reporting the security impact of this issue, and Robert Holiday of
360 +  Ciena for reporting the related bug 18665. (CVE-2015-7547)
361 +
362 +* The following bugs are resolved with this release:
363 +
364 +  17905, 18420, 18421, 18480, 18589, 18743, 18778, 18781, 18787, 18796,
365 +  18870, 18887, 18921, 18928, 18969, 18985, 19018, 19058, 19174, 19178.
366 +
367 +* The LD_POINTER_GUARD environment variable can no longer be used to
368 +  disable the pointer guard feature.  It is always enabled.
369 +\f
370  Version 2.22
371  
372  * The following bugs are resolved with this release:
373 @@ -84,7 +108,7 @@ Version 2.22
374    release.  Use of this header will trigger a deprecation warning.
375    Application developers should update their code to use <regex.h> instead.
376  
377 -  This header was formerly part of SUSv2, but was deprecated in 1997 and
378 +  This header was formerly part of SUS, but was deprecated in 1994 and
379    removed from the standard in 2001.  Also, the glibc implementation
380    leaks memory.  See BZ#18681 for more details.
381  \f
382 diff --git a/catgets/Makefile b/catgets/Makefile
383 index 4624a88..56de38b 100644
384 --- a/catgets/Makefile
385 +++ b/catgets/Makefile
386 @@ -34,6 +34,7 @@ test-srcs = test-gencat
387  ifeq ($(run-built-tests),yes)
388  tests-special += $(objpfx)de/libc.cat $(objpfx)test1.cat $(objpfx)test2.cat \
389                  $(objpfx)sample.SJIS.cat $(objpfx)test-gencat.out
390 +tests-special += $(objpfx)tst-catgets-mem.out
391  endif
392  
393  gencat-modules = xmalloc
394 @@ -50,9 +51,11 @@ catgets-CPPFLAGS := -DNLSPATH='"$(msgcatdir)/%L/%N:$(msgcatdir)/%L/LC_MESSAGES/%
395  
396  generated += de.msg test1.cat test1.h test2.cat test2.h sample.SJIS.cat \
397              test-gencat.h
398 +generated += tst-catgets.mtrace tst-catgets-mem.out
399 +
400  generated-dirs += de
401  
402 -tst-catgets-ENV = NLSPATH="$(objpfx)%l/%N.cat" LANG=de
403 +tst-catgets-ENV = NLSPATH="$(objpfx)%l/%N.cat" LANG=de MALLOC_TRACE=$(objpfx)tst-catgets.mtrace
404  
405  ifeq ($(run-built-tests),yes)
406  # This test just checks whether the program produces any error or not.
407 @@ -86,4 +89,8 @@ $(objpfx)test-gencat.out: test-gencat.sh $(objpfx)test-gencat \
408  $(objpfx)sample.SJIS.cat: sample.SJIS $(objpfx)gencat
409         $(built-program-cmd) -H $(objpfx)test-gencat.h < $(word 1,$^) > $@; \
410         $(evaluate-test)
411 +
412 +$(objpfx)tst-catgets-mem.out: $(objpfx)tst-catgets.out
413 +       $(common-objpfx)malloc/mtrace $(objpfx)tst-catgets.mtrace > $@; \
414 +       $(evaluate-test)
415  endif
416 diff --git a/catgets/catgets.c b/catgets/catgets.c
417 index cf93d56..4be452d 100644
418 --- a/catgets/catgets.c
419 +++ b/catgets/catgets.c
420 @@ -16,7 +16,6 @@
421     License along with the GNU C Library; if not, see
422     <http://www.gnu.org/licenses/>.  */
423  
424 -#include <alloca.h>
425  #include <errno.h>
426  #include <locale.h>
427  #include <nl_types.h>
428 @@ -35,6 +34,7 @@ catopen (const char *cat_name, int flag)
429    __nl_catd result;
430    const char *env_var = NULL;
431    const char *nlspath = NULL;
432 +  char *tmp = NULL;
433  
434    if (strchr (cat_name, '/') == NULL)
435      {
436 @@ -54,7 +54,10 @@ catopen (const char *cat_name, int flag)
437         {
438           /* Append the system dependent directory.  */
439           size_t len = strlen (nlspath) + 1 + sizeof NLSPATH;
440 -         char *tmp = alloca (len);
441 +         tmp = malloc (len);
442 +
443 +         if (__glibc_unlikely (tmp == NULL))
444 +           return (nl_catd) -1;
445  
446           __stpcpy (__stpcpy (__stpcpy (tmp, nlspath), ":"), NLSPATH);
447           nlspath = tmp;
448 @@ -65,16 +68,18 @@ catopen (const char *cat_name, int flag)
449  
450    result = (__nl_catd) malloc (sizeof (*result));
451    if (result == NULL)
452 -    /* We cannot get enough memory.  */
453 -    return (nl_catd) -1;
454 -
455 -  if (__open_catalog (cat_name, nlspath, env_var, result) != 0)
456 +    {
457 +      /* We cannot get enough memory.  */
458 +      result = (nl_catd) -1;
459 +    }
460 +  else if (__open_catalog (cat_name, nlspath, env_var, result) != 0)
461      {
462        /* Couldn't open the file.  */
463        free ((void *) result);
464 -      return (nl_catd) -1;
465 +      result = (nl_catd) -1;
466      }
467  
468 +  free (tmp);
469    return (nl_catd) result;
470  }
471  
472 diff --git a/catgets/open_catalog.c b/catgets/open_catalog.c
473 index e069416..9f4d776 100644
474 --- a/catgets/open_catalog.c
475 +++ b/catgets/open_catalog.c
476 @@ -47,6 +47,7 @@ __open_catalog (const char *cat_name, const char *nlspath, const char *env_var,
477    size_t tab_size;
478    const char *lastp;
479    int result = -1;
480 +  char *buf = NULL;
481  
482    if (strchr (cat_name, '/') != NULL || nlspath == NULL)
483      fd = open_not_cancel_2 (cat_name, O_RDONLY);
484 @@ -57,23 +58,23 @@ __open_catalog (const char *cat_name, const char *nlspath, const char *env_var,
485    if (__glibc_unlikely (bufact + (n) >= bufmax))                             \
486      {                                                                        \
487        char *old_buf = buf;                                                   \
488 -      bufmax += 256 + (n);                                                   \
489 -      buf = (char *) alloca (bufmax);                                        \
490 -      memcpy (buf, old_buf, bufact);                                         \
491 +      bufmax += (bufmax < 256 + (n)) ? 256 + (n) : bufmax;                   \
492 +      buf = realloc (buf, bufmax);                                           \
493 +      if (__glibc_unlikely (buf == NULL))                                    \
494 +       {                                                                     \
495 +         free (old_buf);                                                     \
496 +         return -1;                                                          \
497 +       }                                                                     \
498      }
499  
500        /* The RUN_NLSPATH variable contains a colon separated list of
501          descriptions where we expect to find catalogs.  We have to
502          recognize certain % substitutions and stop when we found the
503          first existing file.  */
504 -      char *buf;
505        size_t bufact;
506 -      size_t bufmax;
507 +      size_t bufmax = 0;
508        size_t len;
509  
510 -      buf = NULL;
511 -      bufmax = 0;
512 -
513        fd = -1;
514        while (*run_nlspath != '\0')
515         {
516 @@ -188,7 +189,10 @@ __open_catalog (const char *cat_name, const char *nlspath, const char *env_var,
517  
518    /* Avoid dealing with directories and block devices */
519    if (__builtin_expect (fd, 0) < 0)
520 -    return -1;
521 +    {
522 +      free (buf);
523 +      return -1;
524 +    }
525  
526    if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) < 0)
527      goto close_unlock_return;
528 @@ -325,6 +329,7 @@ __open_catalog (const char *cat_name, const char *nlspath, const char *env_var,
529    /* Release the lock again.  */
530   close_unlock_return:
531    close_not_cancel_no_status (fd);
532 +  free (buf);
533  
534    return result;
535  }
536 diff --git a/catgets/tst-catgets.c b/catgets/tst-catgets.c
537 index a0a4089..0886938 100644
538 --- a/catgets/tst-catgets.c
539 +++ b/catgets/tst-catgets.c
540 @@ -1,7 +1,10 @@
541 +#include <assert.h>
542  #include <mcheck.h>
543  #include <nl_types.h>
544  #include <stdio.h>
545 +#include <stdlib.h>
546  #include <string.h>
547 +#include <sys/resource.h>
548  
549  
550  static const char *msgs[] =
551 @@ -12,6 +15,33 @@ static const char *msgs[] =
552  };
553  #define nmsgs (sizeof (msgs) / sizeof (msgs[0]))
554  
555 +
556 +/* Test for unbounded alloca.  */
557 +static int
558 +do_bz17905 (void)
559 +{
560 +  char *buf;
561 +  struct rlimit rl;
562 +  nl_catd result;
563 +
564 +  const int sz = 1024 * 1024;
565 +
566 +  getrlimit (RLIMIT_STACK, &rl);
567 +  rl.rlim_cur = sz;
568 +  setrlimit (RLIMIT_STACK, &rl);
569 +
570 +  buf = malloc (sz + 1);
571 +  memset (buf, 'A', sz);
572 +  buf[sz] = '\0';
573 +  setenv ("NLSPATH", buf, 1);
574 +
575 +  result = catopen (buf, NL_CAT_LOCALE);
576 +  assert (result == (nl_catd) -1);
577 +
578 +  free (buf);
579 +  return 0;
580 +}
581 +
582  #define ROUNDS 5
583  
584  static int
585 @@ -62,6 +92,7 @@ do_test (void)
586         }
587      }
588  
589 +  result += do_bz17905 ();
590    return result;
591  }
592  
593 diff --git a/config.make.in b/config.make.in
594 index a9f5696..46cd9bb 100644
595 --- a/config.make.in
596 +++ b/config.make.in
597 @@ -51,6 +51,7 @@ have-z-combreloc = @libc_cv_z_combreloc@
598  have-z-execstack = @libc_cv_z_execstack@
599  have-Bgroup = @libc_cv_Bgroup@
600  have-protected-data = @libc_cv_protected_data@
601 +have-glob-dat-reloc = @libc_cv_has_glob_dat@
602  with-fp = @with_fp@
603  old-glibc-headers = @old_glibc_headers@
604  unwind-find-fde = @libc_cv_gcc_unwind_find_fde@
605 diff --git a/configure b/configure
606 index 45cc7cb..4f87b31 100755
607 --- a/configure
608 +++ b/configure
609 @@ -628,6 +628,7 @@ gnu89_inline
610  libc_cv_ssp
611  fno_unit_at_a_time
612  libc_cv_output_format
613 +libc_cv_has_glob_dat
614  libc_cv_hashstyle
615  libc_cv_fpie
616  libc_cv_z_execstack
617 @@ -6335,6 +6336,39 @@ $as_echo "$libc_cv_use_default_link" >&6; }
618    use_default_link=$libc_cv_use_default_link
619  fi
620  
621 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLOB_DAT reloc" >&5
622 +$as_echo_n "checking for GLOB_DAT reloc... " >&6; }
623 +if ${libc_cv_has_glob_dat+:} false; then :
624 +  $as_echo_n "(cached) " >&6
625 +else
626 +  cat > conftest.c <<EOF
627 +extern int mumble;
628 +int foo (void) { return mumble; }
629 +EOF
630 +if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
631 +                       -fPIC -shared -o conftest.so conftest.c
632 +                       -nostdlib -nostartfiles
633 +                       1>&5'
634 +  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
635 +  (eval $ac_try) 2>&5
636 +  ac_status=$?
637 +  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
638 +  test $ac_status = 0; }; }
639 +then
640 +  if $READELF -rW conftest.so | grep '_GLOB_DAT' > /dev/null; then
641 +    libc_cv_has_glob_dat=yes
642 +  else
643 +    libc_cv_has_glob_dat=no
644 +  fi
645 +else
646 +  libc_cv_has_glob_dat=no
647 +fi
648 +rm -f conftest*
649 +fi
650 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_has_glob_dat" >&5
651 +$as_echo "$libc_cv_has_glob_dat" >&6; }
652 +
653 +
654  { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker output format" >&5
655  $as_echo_n "checking linker output format... " >&6; }
656  if ${libc_cv_output_format+:} false; then :
657 diff --git a/configure.ac b/configure.ac
658 index 7e9383a..8be612d 100644
659 --- a/configure.ac
660 +++ b/configure.ac
661 @@ -1535,6 +1535,29 @@ $ac_try"
662    use_default_link=$libc_cv_use_default_link
663  fi
664  
665 +AC_CACHE_CHECK(for GLOB_DAT reloc,
666 +              libc_cv_has_glob_dat, [dnl
667 +cat > conftest.c <<EOF
668 +extern int mumble;
669 +int foo (void) { return mumble; }
670 +EOF
671 +if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
672 +                       -fPIC -shared -o conftest.so conftest.c
673 +                       -nostdlib -nostartfiles
674 +                       1>&AS_MESSAGE_LOG_FD])
675 +then
676 +dnl look for GLOB_DAT relocation.
677 +  if $READELF -rW conftest.so | grep '_GLOB_DAT' > /dev/null; then
678 +    libc_cv_has_glob_dat=yes
679 +  else
680 +    libc_cv_has_glob_dat=no
681 +  fi
682 +else
683 +  libc_cv_has_glob_dat=no
684 +fi
685 +rm -f conftest*])
686 +AC_SUBST(libc_cv_has_glob_dat)
687 +
688  AC_CACHE_CHECK(linker output format, libc_cv_output_format, [dnl
689  if libc_cv_output_format=`
690  ${CC-cc} -nostartfiles -nostdlib -Wl,--print-output-format 2>&AS_MESSAGE_LOG_FD`
691 diff --git a/elf/Makefile b/elf/Makefile
692 index 4ceeaf8..a2c43bc 100644
693 --- a/elf/Makefile
694 +++ b/elf/Makefile
695 @@ -148,7 +148,8 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
696          tst-unique1 tst-unique2 $(if $(CXX),tst-unique3 tst-unique4 \
697          tst-nodelete) \
698          tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \
699 -        tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened
700 +        tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \
701 +        tst-nodelete2
702  #       reldep9
703  ifeq ($(build-hardcoded-path-in-tests),yes)
704  tests += tst-dlopen-aout
705 @@ -218,7 +219,7 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
706                 tst-initorder2d \
707                 tst-relsort1mod1 tst-relsort1mod2 tst-array2dep \
708                 tst-array5dep tst-null-argv-lib \
709 -               tst-tlsalign-lib tst-nodelete-opened-lib
710 +               tst-tlsalign-lib tst-nodelete-opened-lib tst-nodelete2mod
711  ifeq (yes,$(have-protected-data))
712  modules-names += tst-protected1moda tst-protected1modb
713  tests += tst-protected1a tst-protected1b
714 @@ -292,6 +293,13 @@ check-abi: $(objpfx)check-abi-ld.out
715  tests-special += $(objpfx)check-abi-ld.out
716  update-abi: update-abi-ld
717  
718 +ifeq ($(have-glob-dat-reloc),yes)
719 +tests += tst-prelink
720 +ifeq ($(run-built-tests),yes)
721 +tests-special += $(objpfx)tst-prelink-cmp.out
722 +endif
723 +endif
724 +
725  include ../Rules
726  
727  ifeq (yes,$(build-shared))
728 @@ -594,6 +602,7 @@ tst-auditmod9b.so-no-z-defs = yes
729  tst-nodelete-uniquemod.so-no-z-defs = yes
730  tst-nodelete-rtldmod.so-no-z-defs = yes
731  tst-nodelete-zmod.so-no-z-defs = yes
732 +tst-nodelete2mod.so-no-z-defs = yes
733  
734  ifeq ($(build-shared),yes)
735  # Build all the modules even when not actually running test programs.
736 @@ -1164,6 +1173,11 @@ $(objpfx)tst-nodelete.out: $(objpfx)tst-nodelete-uniquemod.so \
737  LDFLAGS-tst-nodelete = -rdynamic
738  LDFLAGS-tst-nodelete-zmod.so = -Wl,--enable-new-dtags,-z,nodelete
739  
740 +$(objpfx)tst-nodelete2: $(libdl)
741 +$(objpfx)tst-nodelete2.out: $(objpfx)tst-nodelete2mod.so
742 +
743 +LDFLAGS-tst-nodelete2 = -rdynamic
744 +
745  $(objpfx)tst-initorder-cmp.out: tst-initorder.exp $(objpfx)tst-initorder.out
746         cmp $^ > $@; \
747         $(evaluate-test)
748 @@ -1205,3 +1219,13 @@ $(objpfx)tst-unused-dep.out: $(objpfx)testobj1.so
749  $(objpfx)tst-unused-dep-cmp.out: $(objpfx)tst-unused-dep.out
750         cmp $< /dev/null > $@; \
751         $(evaluate-test)
752 +
753 +tst-prelink-ENV = LD_TRACE_PRELINKING=1
754 +
755 +$(objpfx)tst-prelink-conflict.out: $(objpfx)tst-prelink.out
756 +       grep stdout $< | grep conflict | $(AWK) '{ print $$10, $$11 }' > $@
757 +
758 +$(objpfx)tst-prelink-cmp.out: tst-prelink.exp \
759 +                             $(objpfx)tst-prelink-conflict.out
760 +       cmp $^ > $@; \
761 +       $(evaluate-test)
762 diff --git a/elf/dl-close.c b/elf/dl-close.c
763 index 9105277..c897247 100644
764 --- a/elf/dl-close.c
765 +++ b/elf/dl-close.c
766 @@ -144,6 +144,14 @@ _dl_close_worker (struct link_map *map, bool force)
767    char done[nloaded];
768    struct link_map *maps[nloaded];
769  
770 +  /* Clear DF_1_NODELETE to force object deletion.  We don't need to touch
771 +     l_tls_dtor_count because forced object deletion only happens when an
772 +     error occurs during object load.  Destructor registration for TLS
773 +     non-POD objects should not have happened till then for this
774 +     object.  */
775 +  if (force)
776 +    map->l_flags_1 &= ~DF_1_NODELETE;
777 +
778    /* Run over the list and assign indexes to the link maps and enter
779       them into the MAPS array.  */
780    int idx = 0;
781 @@ -153,13 +161,6 @@ _dl_close_worker (struct link_map *map, bool force)
782        maps[idx] = l;
783        ++idx;
784  
785 -      /* Clear DF_1_NODELETE to force object deletion.  We don't need to touch
786 -        l_tls_dtor_count because forced object deletion only happens when an
787 -        error occurs during object load.  Destructor registration for TLS
788 -        non-POD objects should not have happened till then for this
789 -        object.  */
790 -      if (force)
791 -       l->l_flags_1 &= ~DF_1_NODELETE;
792      }
793    assert (idx == nloaded);
794  
795 diff --git a/elf/dl-load.c b/elf/dl-load.c
796 index 0c052e4..7e6f4c5 100644
797 --- a/elf/dl-load.c
798 +++ b/elf/dl-load.c
799 @@ -42,6 +42,7 @@
800  #include <dl-map-segments.h>
801  #include <dl-unmap-segments.h>
802  #include <dl-machine-reject-phdr.h>
803 +#include <dl-sysdep-open.h>
804  
805  
806  #include <endian.h>
807 @@ -1471,9 +1472,13 @@ print_search_path (struct r_search_path_elem **list,
808     ignore only ELF files for other architectures.  Non-ELF files and
809     ELF files with different header information cause fatal errors since
810     this could mean there is something wrong in the installation and the
811 -   user might want to know about this.  */
812 +   user might want to know about this.
813 +
814 +   If FD is not -1, then the file is already open and FD refers to it.
815 +   In that case, FD is consumed for both successful and error returns.  */
816  static int
817 -open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
818 +open_verify (const char *name, int fd,
819 +             struct filebuf *fbp, struct link_map *loader,
820              int whatcode, int mode, bool *found_other_class, bool free_name)
821  {
822    /* This is the expected ELF header.  */
823 @@ -1514,6 +1519,7 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
824    if (__glibc_unlikely (GLRO(dl_naudit) > 0) && whatcode != 0
825        && loader->l_auditing == 0)
826      {
827 +      const char *original_name = name;
828        struct audit_ifaces *afct = GLRO(dl_audit);
829        for (unsigned int cnt = 0; cnt < GLRO(dl_naudit); ++cnt)
830         {
831 @@ -1528,11 +1534,21 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
832  
833           afct = afct->next;
834         }
835 +
836 +      if (fd != -1 && name != original_name && strcmp (name, original_name))
837 +        {
838 +          /* An audit library changed what we're supposed to open,
839 +             so FD no longer matches it.  */
840 +          __close (fd);
841 +          fd = -1;
842 +        }
843      }
844  #endif
845  
846 -  /* Open the file.  We always open files read-only.  */
847 -  int fd = __open (name, O_RDONLY | O_CLOEXEC);
848 +  if (fd == -1)
849 +    /* Open the file.  We always open files read-only.  */
850 +    fd = __open (name, O_RDONLY | O_CLOEXEC);
851 +
852    if (fd != -1)
853      {
854        ElfW(Ehdr) *ehdr;
855 @@ -1801,7 +1817,7 @@ open_path (const char *name, size_t namelen, int mode,
856           if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
857             _dl_debug_printf ("  trying file=%s\n", buf);
858  
859 -         fd = open_verify (buf, fbp, loader, whatcode, mode,
860 +         fd = open_verify (buf, -1, fbp, loader, whatcode, mode,
861                             found_other_class, false);
862           if (this_dir->status[cnt] == unknown)
863             {
864 @@ -2041,6 +2057,20 @@ _dl_map_object (struct link_map *loader, const char *name,
865                         &loader->l_runpath_dirs, &realname, &fb, loader,
866                         LA_SER_RUNPATH, &found_other_class);
867  
868 +      if (fd == -1)
869 +        {
870 +          realname = _dl_sysdep_open_object (name, namelen, &fd);
871 +          if (realname != NULL)
872 +            {
873 +              fd = open_verify (realname, fd,
874 +                                &fb, loader ?: GL(dl_ns)[nsid]._ns_loaded,
875 +                                LA_SER_CONFIG, mode, &found_other_class,
876 +                                false);
877 +              if (fd == -1)
878 +                free (realname);
879 +            }
880 +        }
881 +
882  #ifdef USE_LDCONFIG
883        if (fd == -1
884           && (__glibc_likely ((mode & __RTLD_SECURE) == 0)
885 @@ -2086,7 +2116,7 @@ _dl_map_object (struct link_map *loader, const char *name,
886  
887               if (cached != NULL)
888                 {
889 -                 fd = open_verify (cached,
890 +                 fd = open_verify (cached, -1,
891                                     &fb, loader ?: GL(dl_ns)[nsid]._ns_loaded,
892                                     LA_SER_CONFIG, mode, &found_other_class,
893                                     false);
894 @@ -2121,7 +2151,7 @@ _dl_map_object (struct link_map *loader, const char *name,
895         fd = -1;
896        else
897         {
898 -         fd = open_verify (realname, &fb,
899 +         fd = open_verify (realname, -1, &fb,
900                             loader ?: GL(dl_ns)[nsid]._ns_loaded, 0, mode,
901                             &found_other_class, true);
902           if (__glibc_unlikely (fd == -1))
903 diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
904 index 11cb44b..acf5280 100644
905 --- a/elf/dl-lookup.c
906 +++ b/elf/dl-lookup.c
907 @@ -1016,6 +1016,18 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
908  #ifdef SHARED
909    if (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
910      {
911 +/* ELF_RTYPE_CLASS_XXX must match RTYPE_CLASS_XXX used by prelink with
912 +   LD_TRACE_PRELINKING.  */
913 +#define RTYPE_CLASS_VALID      8
914 +#define RTYPE_CLASS_PLT                (8|1)
915 +#define RTYPE_CLASS_COPY       (8|2)
916 +#define RTYPE_CLASS_TLS                (8|4)
917 +#if ELF_RTYPE_CLASS_PLT != 0 && ELF_RTYPE_CLASS_PLT != 1
918 +# error ELF_RTYPE_CLASS_PLT must be 0 or 1!
919 +#endif
920 +#if ELF_RTYPE_CLASS_COPY != 0 && ELF_RTYPE_CLASS_COPY != 2
921 +# error ELF_RTYPE_CLASS_COPY must be 0 or 2!
922 +#endif
923        int conflict = 0;
924        struct sym_val val = { NULL, NULL };
925  
926 @@ -1071,12 +1083,17 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
927  
928        if (value->s)
929         {
930 +         /* Keep only ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY
931 +            bits since since prelink only uses them.  */
932 +         type_class &= ELF_RTYPE_CLASS_PLT | ELF_RTYPE_CLASS_COPY;
933           if (__glibc_unlikely (ELFW(ST_TYPE) (value->s->st_info)
934                                 == STT_TLS))
935 -           type_class = 4;
936 +           /* Clear the RTYPE_CLASS_VALID bit in RTYPE_CLASS_TLS.  */
937 +           type_class = RTYPE_CLASS_TLS & ~RTYPE_CLASS_VALID;
938           else if (__glibc_unlikely (ELFW(ST_TYPE) (value->s->st_info)
939                                      == STT_GNU_IFUNC))
940 -           type_class |= 8;
941 +           /* Set the RTYPE_CLASS_VALID bit.  */
942 +           type_class |= RTYPE_CLASS_VALID;
943         }
944  
945        if (conflict
946 diff --git a/elf/dl-sysdep-open.h b/elf/dl-sysdep-open.h
947 new file mode 100644
948 index 0000000..a63d9f5
949 --- /dev/null
950 +++ b/elf/dl-sysdep-open.h
951 @@ -0,0 +1,45 @@
952 +/* System-specific call to open a shared object by name.  Stub version.
953 +   Copyright (C) 2015 Free Software Foundation, Inc.
954 +   This file is part of the GNU C Library.
955 +
956 +   The GNU C Library is free software; you can redistribute it and/or
957 +   modify it under the terms of the GNU Lesser General Public
958 +   License as published by the Free Software Foundation; either
959 +   version 2.1 of the License, or (at your option) any later version.
960 +
961 +   The GNU C Library is distributed in the hope that it will be useful,
962 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
963 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
964 +   Lesser General Public License for more details.
965 +
966 +   You should have received a copy of the GNU Lesser General Public
967 +   License along with the GNU C Library; if not, see
968 +   <http://www.gnu.org/licenses/>.  */
969 +
970 +#ifndef _DL_SYSDEP_OPEN_H
971 +#define _DL_SYSDEP_OPEN_H      1
972 +
973 +#include <assert.h>
974 +#include <stddef.h>
975 +
976 +/* NAME is a name without slashes, as it appears in a DT_NEEDED entry
977 +   or a dlopen call's argument or suchlike.  NAMELEN is (strlen (NAME) + 1).
978 +
979 +   Find NAME in an OS-dependent fashion, and return its "real" name.
980 +   Optionally fill in *FD with a file descriptor open on that file (or
981 +   else leave its initial value of -1).  The return value is a new
982 +   malloc'd string, which will be free'd by the caller.  If NAME is
983 +   resolved to an actual file that can be opened, then the return
984 +   value should name that file (and if *FD was not set, then a normal
985 +   __open call on that string will be made).  If *FD was set by some
986 +   other means than a normal open and there is no "real" name to use,
987 +   then __strdup (NAME) is fine (modulo error checking).  */
988 +
989 +static inline char *
990 +_dl_sysdep_open_object (const char *name, size_t namelen, int *fd)
991 +{
992 +  assert (*fd == -1);
993 +  return NULL;
994 +}
995 +
996 +#endif  /* dl-sysdep-open.h */
997 diff --git a/elf/rtld.c b/elf/rtld.c
998 index 69873c2..07e741c 100644
999 --- a/elf/rtld.c
1000 +++ b/elf/rtld.c
1001 @@ -162,7 +162,6 @@ struct rtld_global_ro _rtld_global_ro attribute_relro =
1002      ._dl_hwcap_mask = HWCAP_IMPORTANT,
1003      ._dl_lazy = 1,
1004      ._dl_fpu_control = _FPU_DEFAULT,
1005 -    ._dl_pointer_guard = 1,
1006      ._dl_pagesize = EXEC_PAGESIZE,
1007      ._dl_inhibit_cache = 0,
1008  
1009 @@ -709,15 +708,12 @@ security_init (void)
1010  #endif
1011  
1012    /* Set up the pointer guard as well, if necessary.  */
1013 -  if (GLRO(dl_pointer_guard))
1014 -    {
1015 -      uintptr_t pointer_chk_guard = _dl_setup_pointer_guard (_dl_random,
1016 -                                                            stack_chk_guard);
1017 +  uintptr_t pointer_chk_guard
1018 +    = _dl_setup_pointer_guard (_dl_random, stack_chk_guard);
1019  #ifdef THREAD_SET_POINTER_GUARD
1020 -      THREAD_SET_POINTER_GUARD (pointer_chk_guard);
1021 +  THREAD_SET_POINTER_GUARD (pointer_chk_guard);
1022  #endif
1023 -      __pointer_chk_guard_local = pointer_chk_guard;
1024 -    }
1025 +  __pointer_chk_guard_local = pointer_chk_guard;
1026  
1027    /* We do not need the _dl_random value anymore.  The less
1028       information we leave behind, the better, so clear the
1029 @@ -2471,9 +2467,6 @@ process_envvars (enum mode *modep)
1030               GLRO(dl_use_load_bias) = envline[14] == '1' ? -1 : 0;
1031               break;
1032             }
1033 -
1034 -         if (memcmp (envline, "POINTER_GUARD", 13) == 0)
1035 -           GLRO(dl_pointer_guard) = envline[14] != '0';
1036           break;
1037  
1038         case 14:
1039 diff --git a/elf/tst-nodelete2.c b/elf/tst-nodelete2.c
1040 new file mode 100644
1041 index 0000000..388e8af
1042 --- /dev/null
1043 +++ b/elf/tst-nodelete2.c
1044 @@ -0,0 +1,37 @@
1045 +#include "../dlfcn/dlfcn.h"
1046 +#include <stdio.h>
1047 +#include <stdlib.h>
1048 +#include <gnu/lib-names.h>
1049 +
1050 +static int
1051 +do_test (void)
1052 +{
1053 +  int result = 0;
1054 +
1055 +  printf ("\nOpening pthread library.\n");
1056 +  void *pthread = dlopen (LIBPTHREAD_SO, RTLD_LAZY);
1057 +
1058 +  /* This is a test for correct DF_1_NODELETE clearing when dlopen failure
1059 +     happens.  We should clear DF_1_NODELETE for failed library only, because
1060 +     doing this for others (e.g. libpthread) might cause them to be unloaded,
1061 +     that may lead to some global references (e.g. __rtld_lock_unlock) to be
1062 +     broken.  The dlopen should fail because of undefined symbols in shared
1063 +     library, that cause DF_1_NODELETE to be cleared.  For libpthread, this
1064 +     flag should be set, because if not, SIGSEGV will happen in dlclose.  */
1065 +  if (dlopen ("tst-nodelete2mod.so", RTLD_NOW) != NULL)
1066 +    {
1067 +      printf ("Unique symbols test failed\n");
1068 +      result = 1;
1069 +    }
1070 +
1071 +  if (pthread)
1072 +    dlclose (pthread);
1073 +
1074 +  if (result == 0)
1075 +    printf ("SUCCESS\n");
1076 +
1077 +  return result;
1078 +}
1079 +
1080 +#define TEST_FUNCTION do_test ()
1081 +#include "../test-skeleton.c"
1082 diff --git a/elf/tst-nodelete2mod.c b/elf/tst-nodelete2mod.c
1083 new file mode 100644
1084 index 0000000..e88c756
1085 --- /dev/null
1086 +++ b/elf/tst-nodelete2mod.c
1087 @@ -0,0 +1,7 @@
1088 +/* Undefined symbol.  */
1089 +extern int not_exist (void);
1090 +
1091 +int foo (void)
1092 +{
1093 +  return not_exist ();
1094 +}
1095 diff --git a/elf/tst-prelink.c b/elf/tst-prelink.c
1096 new file mode 100644
1097 index 0000000..ab61c4e
1098 --- /dev/null
1099 +++ b/elf/tst-prelink.c
1100 @@ -0,0 +1,30 @@
1101 +/* Test the output from the environment variable, LD_TRACE_PRELINKING,
1102 +   for prelink.
1103 +   Copyright (C) 2015 Free Software Foundation, Inc.
1104 +   This file is part of the GNU C Library.
1105 +
1106 +   The GNU C Library is free software; you can redistribute it and/or
1107 +   modify it under the terms of the GNU Lesser General Public
1108 +   License as published by the Free Software Foundation; either
1109 +   version 2.1 of the License, or (at your option) any later version.
1110 +
1111 +   The GNU C Library is distributed in the hope that it will be useful,
1112 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
1113 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1114 +   Lesser General Public License for more details.
1115 +
1116 +   You should have received a copy of the GNU Lesser General Public
1117 +   License along with the GNU C Library; if not, see
1118 +   <http://www.gnu.org/licenses/>.  */
1119 +
1120 +#include <stdio.h>
1121 +
1122 +static int
1123 +do_test (void)
1124 +{
1125 +  fprintf (stdout, "hello\n");
1126 +  return 0;
1127 +}
1128 +
1129 +#define TEST_FUNCTION do_test ()
1130 +#include "../test-skeleton.c"
1131 diff --git a/elf/tst-prelink.exp b/elf/tst-prelink.exp
1132 new file mode 100644
1133 index 0000000..b35b4c9
1134 --- /dev/null
1135 +++ b/elf/tst-prelink.exp
1136 @@ -0,0 +1 @@
1137 +/0 stdout
1138 diff --git a/elf/tst-znodelete-zlib.cc b/elf/tst-znodelete-zlib.cc
1139 deleted file mode 100644
1140 index 1e8f368..0000000
1141 --- a/elf/tst-znodelete-zlib.cc
1142 +++ /dev/null
1143 @@ -1,6 +0,0 @@
1144 -extern int not_exist (void);
1145 -
1146 -int foo (void)
1147 -{
1148 -  return  not_exist ();
1149 -}
1150 diff --git a/io/test-lfs.c b/io/test-lfs.c
1151 index 539c2a2..b6ebae4 100644
1152 --- a/io/test-lfs.c
1153 +++ b/io/test-lfs.c
1154 @@ -144,7 +144,7 @@ test_ftello (void)
1155  int
1156  do_test (int argc, char *argv[])
1157  {
1158 -  int ret;
1159 +  int ret, fd2;
1160    struct stat64 statbuf;
1161  
1162    ret = lseek64 (fd, TWO_GB+100, SEEK_SET);
1163 @@ -195,6 +195,25 @@ do_test (int argc, char *argv[])
1164      error (EXIT_FAILURE, 0, "stat reported size %lld instead of %lld.",
1165            (long long int) statbuf.st_size, (TWO_GB + 100 + 5));
1166  
1167 +  fd2 = openat64 (AT_FDCWD, name, O_RDWR);
1168 +  if (fd2 == -1)
1169 +    {
1170 +      if (errno == ENOSYS)
1171 +       {
1172 +         /* Silently ignore this test.  */
1173 +         error (0, 0, "openat64 is not supported");
1174 +       }
1175 +      else
1176 +       error (EXIT_FAILURE, errno, "openat64 failed to open big file");
1177 +    }
1178 +  else
1179 +    {
1180 +      ret = close (fd2);
1181 +
1182 +      if (ret == -1)
1183 +       error (EXIT_FAILURE, errno, "error closing file");
1184 +    }
1185 +
1186    test_ftello ();
1187  
1188    return 0;
1189 diff --git a/locale/C-collate.c b/locale/C-collate.c
1190 index d7f3c55..06dfdfa 100644
1191 --- a/locale/C-collate.c
1192 +++ b/locale/C-collate.c
1193 @@ -144,8 +144,6 @@ const struct __locale_data _nl_C_LC_COLLATE attribute_hidden =
1194      /* _NL_COLLATE_COLLSEQWC */
1195      { .string = (const char *) collseqwc },
1196      /* _NL_COLLATE_CODESET */
1197 -    { .string = _nl_C_codeset },
1198 -    /* _NL_COLLATE_ENCODING_TYPE */
1199 -    { .word = __cet_8bit }
1200 +    { .string = _nl_C_codeset }
1201    }
1202  };
1203 diff --git a/locale/categories.def b/locale/categories.def
1204 index 045489d..a8dda53 100644
1205 --- a/locale/categories.def
1206 +++ b/locale/categories.def
1207 @@ -58,7 +58,6 @@ DEFINE_CATEGORY
1208    DEFINE_ELEMENT (_NL_COLLATE_COLLSEQMB,        "collate-collseqmb",        std, wstring)
1209    DEFINE_ELEMENT (_NL_COLLATE_COLLSEQWC,        "collate-collseqwc",        std, wstring)
1210    DEFINE_ELEMENT (_NL_COLLATE_CODESET,         "collate-codeset",          std, string)
1211 -  DEFINE_ELEMENT (_NL_COLLATE_ENCODING_TYPE,   "collate-encoding-type",    std, word)
1212    ), NO_POSTLOAD)
1213  
1214  
1215 diff --git a/locale/langinfo.h b/locale/langinfo.h
1216 index ffc5c7f..a565d9d 100644
1217 --- a/locale/langinfo.h
1218 +++ b/locale/langinfo.h
1219 @@ -255,7 +255,6 @@ enum
1220    _NL_COLLATE_COLLSEQMB,
1221    _NL_COLLATE_COLLSEQWC,
1222    _NL_COLLATE_CODESET,
1223 -  _NL_COLLATE_ENCODING_TYPE,
1224    _NL_NUM_LC_COLLATE,
1225  
1226    /* LC_CTYPE category: character classification.
1227 diff --git a/locale/loadlocale.c b/locale/loadlocale.c
1228 index fdba6e9..dcbb833 100644
1229 --- a/locale/loadlocale.c
1230 +++ b/locale/loadlocale.c
1231 @@ -121,9 +121,10 @@ _nl_intern_locale_data (int category, const void *data, size_t datasize)
1232        switch (category)
1233         {
1234  #define CATTEST(cat) \
1235 -       case LC_##cat:                                                        \
1236 -         assert (cnt < (sizeof (_nl_value_type_LC_##cat)                     \
1237 -                        / sizeof (_nl_value_type_LC_##cat[0])));             \
1238 +       case LC_##cat:                                          \
1239 +         if (cnt >= (sizeof (_nl_value_type_LC_##cat)          \
1240 +                     / sizeof (_nl_value_type_LC_##cat[0])))   \
1241 +           goto puntdata;                                      \
1242           break
1243           CATTEST (NUMERIC);
1244           CATTEST (TIME);
1245 diff --git a/locale/localeinfo.h b/locale/localeinfo.h
1246 index bdab9fe..1d2ee00 100644
1247 --- a/locale/localeinfo.h
1248 +++ b/locale/localeinfo.h
1249 @@ -110,14 +110,6 @@ enum coll_sort_rule
1250    sort_mask
1251  };
1252  
1253 -/* Collation encoding type.  */
1254 -enum collation_encoding_type
1255 -{
1256 -  __cet_other,
1257 -  __cet_8bit,
1258 -  __cet_utf8
1259 -};
1260 -
1261  /* We can map the types of the entries into a few categories.  */
1262  enum value_type
1263  {
1264 diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
1265 index a39a94f..dc0fe30 100644
1266 --- a/locale/programs/ld-collate.c
1267 +++ b/locale/programs/ld-collate.c
1268 @@ -32,7 +32,6 @@
1269  #include "linereader.h"
1270  #include "locfile.h"
1271  #include "elem-hash.h"
1272 -#include "../localeinfo.h"
1273  
1274  /* Uncomment the following line in the production version.  */
1275  /* #define NDEBUG 1 */
1276 @@ -2131,8 +2130,6 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
1277           /* The words have to be handled specially.  */
1278           if (idx == _NL_ITEM_INDEX (_NL_COLLATE_SYMB_HASH_SIZEMB))
1279             add_locale_uint32 (&file, 0);
1280 -         else if (idx == _NL_ITEM_INDEX (_NL_COLLATE_ENCODING_TYPE))
1281 -           add_locale_uint32 (&file, __cet_other);
1282           else
1283             add_locale_empty (&file);
1284         }
1285 @@ -2496,12 +2493,6 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
1286    add_locale_raw_data (&file, collate->mbseqorder, 256);
1287    add_locale_collseq_table (&file, &collate->wcseqorder);
1288    add_locale_string (&file, charmap->code_set_name);
1289 -  if (strcmp (charmap->code_set_name, "UTF-8") == 0)
1290 -    add_locale_uint32 (&file, __cet_utf8);
1291 -  else if (charmap->mb_cur_max == 1)
1292 -    add_locale_uint32 (&file, __cet_8bit);
1293 -  else
1294 -    add_locale_uint32 (&file, __cet_other);
1295    write_locale_data (output_path, LC_COLLATE, "LC_COLLATE", &file);
1296  
1297    obstack_free (&weightpool, NULL);
1298 diff --git a/math/Makefile b/math/Makefile
1299 index 6388bae..2c9d72d 100644
1300 --- a/math/Makefile
1301 +++ b/math/Makefile
1302 @@ -98,7 +98,7 @@ $(inst_libdir)/libm.so: $(common-objpfx)format.lds \
1303         (echo '/* GNU ld script'; echo '*/';\
1304          cat $<; \
1305          echo 'GROUP ( $(slibdir)/libm.so$(libm.so-version) ' \
1306 -             'AS_NEEDED ( $(slibdir)/libmvec.so$(libmvec.so-version) ) )' \
1307 +             'AS_NEEDED ( $(libdir)/libmvec_nonshared.a $(slibdir)/libmvec.so$(libmvec.so-version) ) )' \
1308         ) > $@
1309  endif
1310  
1311 diff --git a/misc/Makefile b/misc/Makefile
1312 index aecb0da..12055ce 100644
1313 --- a/misc/Makefile
1314 +++ b/misc/Makefile
1315 @@ -76,7 +76,8 @@ install-lib := libg.a
1316  gpl2lgpl := error.c error.h
1317  
1318  tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \
1319 -        tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1
1320 +        tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1 \
1321 +        tst-mntent-blank-corrupt tst-mntent-blank-passno bug18240
1322  ifeq ($(run-built-tests),yes)
1323  tests-special += $(objpfx)tst-error1-mem.out
1324  endif
1325 diff --git a/misc/bug18240.c b/misc/bug18240.c
1326 new file mode 100644
1327 index 0000000..773586e
1328 --- /dev/null
1329 +++ b/misc/bug18240.c
1330 @@ -0,0 +1,97 @@
1331 +/* Test integer wraparound in hcreate.
1332 +   Copyright (C) 2016 Free Software Foundation, Inc.
1333 +   This file is part of the GNU C Library.
1334 +
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.
1339 +
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.
1344 +
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/>.  */
1348 +
1349 +#include <errno.h>
1350 +#include <limits.h>
1351 +#include <search.h>
1352 +#include <stdbool.h>
1353 +#include <stdio.h>
1354 +#include <stdlib.h>
1355 +#include <sys/resource.h>
1356 +
1357 +static void
1358 +test_size (size_t size)
1359 +{
1360 +  int res = hcreate (size);
1361 +  if (res == 0)
1362 +    {
1363 +      if (errno == ENOMEM)
1364 +        return;
1365 +      printf ("error: hcreate (%zu): %m\n", size);
1366 +      exit (1);
1367 +    }
1368 +  char *keys[100];
1369 +  for (int i = 0; i < 100; ++i)
1370 +    {
1371 +      if (asprintf (keys + i, "%d", i) < 0)
1372 +        {
1373 +          printf ("error: asprintf: %m\n");
1374 +          exit (1);
1375 +        }
1376 +      ENTRY e = { keys[i], (char *) "value" };
1377 +      if (hsearch (e, ENTER) == NULL)
1378 +        {
1379 +          printf ("error: hsearch (\"%s\"): %m\n", keys[i]);
1380 +          exit (1);
1381 +        }
1382 +    }
1383 +  hdestroy ();
1384 +
1385 +  for (int i = 0; i < 100; ++i)
1386 +    free (keys[i]);
1387 +}
1388 +
1389 +static int
1390 +do_test (void)
1391 +{
1392 +  /* Limit the size of the process, so that memory allocation will
1393 +     fail without impacting the entire system.  */
1394 +  {
1395 +    struct rlimit limit;
1396 +    if (getrlimit (RLIMIT_AS, &limit) != 0)
1397 +      {
1398 +        printf ("getrlimit (RLIMIT_AS) failed: %m\n");
1399 +        return 1;
1400 +      }
1401 +    long target = 100 * 1024 * 1024;
1402 +    if (limit.rlim_cur == RLIM_INFINITY || limit.rlim_cur > target)
1403 +      {
1404 +        limit.rlim_cur = target;
1405 +        if (setrlimit (RLIMIT_AS, &limit) != 0)
1406 +          {
1407 +            printf ("setrlimit (RLIMIT_AS) failed: %m\n");
1408 +            return 1;
1409 +          }
1410 +      }
1411 +  }
1412 +
1413 +  test_size (500);
1414 +  test_size (-1);
1415 +  test_size (-3);
1416 +  test_size (INT_MAX - 2);
1417 +  test_size (INT_MAX - 1);
1418 +  test_size (INT_MAX);
1419 +  test_size (((unsigned) INT_MAX) + 1);
1420 +  test_size (UINT_MAX - 2);
1421 +  test_size (UINT_MAX - 1);
1422 +  test_size (UINT_MAX);
1423 +  return 0;
1424 +}
1425 +
1426 +#define TEST_FUNCTION do_test ()
1427 +#include "../test-skeleton.c"
1428 diff --git a/misc/hsearch_r.c b/misc/hsearch_r.c
1429 index 9f55e84..661f0f6 100644
1430 --- a/misc/hsearch_r.c
1431 +++ b/misc/hsearch_r.c
1432 @@ -19,7 +19,7 @@
1433  #include <errno.h>
1434  #include <malloc.h>
1435  #include <string.h>
1436 -
1437 +#include <stdint.h>
1438  #include <search.h>
1439  
1440  /* [Aho,Sethi,Ullman] Compilers: Principles, Techniques and Tools, 1986
1441 @@ -46,15 +46,12 @@ static int
1442  isprime (unsigned int number)
1443  {
1444    /* no even number will be passed */
1445 -  unsigned int div = 3;
1446 -
1447 -  while (div * div < number && number % div != 0)
1448 -    div += 2;
1449 -
1450 -  return number % div != 0;
1451 +  for (unsigned int div = 3; div <= number / div; div += 2)
1452 +    if (number % div == 0)
1453 +      return 0;
1454 +  return 1;
1455  }
1456  
1457 -
1458  /* Before using the hash table we must allocate memory for it.
1459     Test for an existing table are done. We allocate one element
1460     more as the found prime number says. This is done for more effective
1461 @@ -81,10 +78,19 @@ __hcreate_r (nel, htab)
1462       use will not work.  */
1463    if (nel < 3)
1464      nel = 3;
1465 -  /* Change nel to the first prime number not smaller as nel. */
1466 -  nel |= 1;      /* make odd */
1467 -  while (!isprime (nel))
1468 -    nel += 2;
1469 +
1470 +  /* Change nel to the first prime number in the range [nel, UINT_MAX - 2],
1471 +     The '- 2' means 'nel += 2' cannot overflow.  */
1472 +  for (nel |= 1; ; nel += 2)
1473 +    {
1474 +      if (UINT_MAX - 2 < nel)
1475 +       {
1476 +         __set_errno (ENOMEM);
1477 +         return 0;
1478 +       }
1479 +      if (isprime (nel))
1480 +       break;
1481 +    }
1482  
1483    htab->size = nel;
1484    htab->filled = 0;
1485 diff --git a/misc/mntent_r.c b/misc/mntent_r.c
1486 index 6159873..4f26998 100644
1487 --- a/misc/mntent_r.c
1488 +++ b/misc/mntent_r.c
1489 @@ -136,7 +136,9 @@ __getmntent_r (FILE *stream, struct mntent *mp, char *buffer, int bufsiz)
1490        end_ptr = strchr (buffer, '\n');
1491        if (end_ptr != NULL)     /* chop newline */
1492         {
1493 -         while (end_ptr[-1] == ' ' || end_ptr[-1] == '\t')
1494 +         /* Do not walk past the start of buffer if it's all whitespace.  */
1495 +         while (end_ptr != buffer
1496 +                && (end_ptr[-1] == ' ' || end_ptr[-1] == '\t'))
1497              end_ptr--;
1498           *end_ptr = '\0';
1499         }
1500 diff --git a/misc/regexp.h b/misc/regexp.h
1501 index 3460989..42394f7 100644
1502 --- a/misc/regexp.h
1503 +++ b/misc/regexp.h
1504 @@ -19,10 +19,11 @@
1505  #ifndef _REGEXP_H
1506  #define _REGEXP_H      1
1507  
1508 -/* The contents of this header file were standardized in the
1509 -   Single Unix Specification, Version 2 (1997) but marked as
1510 -   LEGACY; new applications were already being encouraged to
1511 -   use <regex.h> instead.  POSIX.1-2001 removed this header.
1512 +/* The contents of this header file were originally standardized in
1513 +   the Single Unix Specification, Issue 3 (1992).  In Issue 4 (1994)
1514 +   the header was marked as TO BE WITHDRAWN, and new applications
1515 +   were encouraged to use <regex.h> instead.  It was officially
1516 +   withdrawn from the standard in Issue 6 (aka POSIX.1-2001).
1517  
1518     This header is provided only for backward compatibility.
1519     It will be removed in the next release of the GNU C Library.
1520 diff --git a/misc/sys/param.h b/misc/sys/param.h
1521 index 62b7ed2..1908b93 100644
1522 --- a/misc/sys/param.h
1523 +++ b/misc/sys/param.h
1524 @@ -50,6 +50,9 @@
1525  #if !defined NOFILE && defined OPEN_MAX
1526  # define NOFILE                OPEN_MAX
1527  #endif
1528 +#if !defined MAXHOSTNAMELEN && defined HOST_NAME_MAX
1529 +# define MAXHOSTNAMELEN        HOST_NAME_MAX
1530 +#endif
1531  #ifndef NCARGS
1532  # ifdef ARG_MAX
1533  #  define NCARGS       ARG_MAX
1534 diff --git a/misc/tst-mntent-blank-corrupt.c b/misc/tst-mntent-blank-corrupt.c
1535 new file mode 100644
1536 index 0000000..92266a3
1537 --- /dev/null
1538 +++ b/misc/tst-mntent-blank-corrupt.c
1539 @@ -0,0 +1,45 @@
1540 +/* Make sure blank lines does not cause memory corruption BZ #18887.
1541 +
1542 +   Copyright (C) 2009-2015 Free Software Foundation, Inc.
1543 +   This file is part of the GNU C Library.
1544 +
1545 +   The GNU C Library is free software; you can redistribute it and/or
1546 +   modify it under the terms of the GNU Lesser General Public
1547 +   License as published by the Free Software Foundation; either
1548 +   version 2.1 of the License, or (at your option) any later version.
1549 +
1550 +   The GNU C Library is distributed in the hope that it will be useful,
1551 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
1552 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1553 +   Lesser General Public License for more details.
1554 +
1555 +   You should have received a copy of the GNU Lesser General Public
1556 +   License along with the GNU C Library; if not, see
1557 +   <http://www.gnu.org/licenses/>.  */
1558 +
1559 +#include <mntent.h>
1560 +#include <stdio.h>
1561 +#include <string.h>
1562 +
1563 +/* Make sure blank lines don't trigger memory corruption.  This doesn't happen
1564 +   for all targets though, so it's a best effort test BZ #18887.  */
1565 +static int
1566 +do_test (void)
1567 +{
1568 +  FILE *fp;
1569 +
1570 +  fp = tmpfile ();
1571 +  fputs ("\n \n/foo\\040dir /bar\\040dir auto bind \t \n", fp);
1572 +  rewind (fp);
1573 +
1574 +  /* The corruption happens here ...  */
1575 +  getmntent (fp);
1576 +  /* ... but trigers here.  */
1577 +  endmntent (fp);
1578 +
1579 +  /* If the test failed, we would crash, and not hit this point.  */
1580 +  return 0;
1581 +}
1582 +
1583 +#define TEST_FUNCTION do_test ()
1584 +#include "../test-skeleton.c"
1585 diff --git a/misc/tst-mntent-blank-passno.c b/misc/tst-mntent-blank-passno.c
1586 new file mode 100644
1587 index 0000000..fc04291
1588 --- /dev/null
1589 +++ b/misc/tst-mntent-blank-passno.c
1590 @@ -0,0 +1,53 @@
1591 +/* Make sure trailing whitespace is handled properly BZ #17273.
1592 +
1593 +   Copyright (C) 2009-2015 Free Software Foundation, Inc.
1594 +   This file is part of the GNU C Library.
1595 +
1596 +   The GNU C Library is free software; you can redistribute it and/or
1597 +   modify it under the terms of the GNU Lesser General Public
1598 +   License as published by the Free Software Foundation; either
1599 +   version 2.1 of the License, or (at your option) any later version.
1600 +
1601 +   The GNU C Library is distributed in the hope that it will be useful,
1602 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
1603 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1604 +   Lesser General Public License for more details.
1605 +
1606 +   You should have received a copy of the GNU Lesser General Public
1607 +   License along with the GNU C Library; if not, see
1608 +   <http://www.gnu.org/licenses/>.  */
1609 +
1610 +#include <mntent.h>
1611 +#include <stdio.h>
1612 +#include <string.h>
1613 +
1614 +/* Check entries to make sure trailing whitespace is ignored and we return the
1615 +   correct passno value BZ #17273.  */
1616 +static int
1617 +do_test (void)
1618 +{
1619 +  int result = 0;
1620 +  FILE *fp;
1621 +  struct mntent *mnt;
1622 +
1623 +  fp = tmpfile ();
1624 +  fputs ("/foo\\040dir /bar\\040dir auto bind \t \n", fp);
1625 +  rewind (fp);
1626 +
1627 +  mnt = getmntent (fp);
1628 +  if (strcmp (mnt->mnt_fsname, "/foo dir") != 0
1629 +      || strcmp (mnt->mnt_dir, "/bar dir") != 0
1630 +      || strcmp (mnt->mnt_type, "auto") != 0
1631 +      || strcmp (mnt->mnt_opts, "bind") != 0
1632 +      || mnt->mnt_freq != 0
1633 +      || mnt->mnt_passno != 0)
1634 +    {
1635 +      puts ("Error while reading entry with trailing whitespaces");
1636 +      result = 1;
1637 +    }
1638 +
1639 +  return result;
1640 +}
1641 +
1642 +#define TEST_FUNCTION do_test ()
1643 +#include "../test-skeleton.c"
1644 diff --git a/misc/tst-mntent.c b/misc/tst-mntent.c
1645 index 876c89f..820b354 100644
1646 --- a/misc/tst-mntent.c
1647 +++ b/misc/tst-mntent.c
1648 @@ -73,26 +73,6 @@ main (int argc, char *argv[])
1649           puts ("Error while reading written entry back in");
1650           result = 1;
1651         }
1652 -
1653 -      /* Part III: Entry with whitespaces at the end of a line. */
1654 -      rewind (fp);
1655 -
1656 -      fputs ("/foo\\040dir /bar\\040dir auto bind \t \n", fp);
1657 -
1658 -      rewind (fp);
1659 -
1660 -      mnt = getmntent (fp);
1661 -
1662 -      if (strcmp (mnt->mnt_fsname, "/foo dir") != 0
1663 -         || strcmp (mnt->mnt_dir, "/bar dir") != 0
1664 -         || strcmp (mnt->mnt_type, "auto") != 0
1665 -         || strcmp (mnt->mnt_opts, "bind") != 0
1666 -         || mnt->mnt_freq != 0
1667 -         || mnt->mnt_passno != 0)
1668 -       {
1669 -         puts ("Error while reading entry with trailing whitespaces");
1670 -         result = 1;
1671 -       }
1672     }
1673  
1674    return result;
1675 diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
1676 index 357ac04..a0fe9a8 100644
1677 --- a/resolv/nss_dns/dns-host.c
1678 +++ b/resolv/nss_dns/dns-host.c
1679 @@ -1031,7 +1031,10 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
1680    int h_namelen = 0;
1681  
1682    if (ancount == 0)
1683 -    return NSS_STATUS_NOTFOUND;
1684 +    {
1685 +      *h_errnop = HOST_NOT_FOUND;
1686 +      return NSS_STATUS_NOTFOUND;
1687 +    }
1688  
1689    while (ancount-- > 0 && cp < end_of_message && had_error == 0)
1690      {
1691 @@ -1208,7 +1211,14 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
1692    /* Special case here: if the resolver sent a result but it only
1693       contains a CNAME while we are looking for a T_A or T_AAAA record,
1694       we fail with NOTFOUND instead of TRYAGAIN.  */
1695 -  return canon == NULL ? NSS_STATUS_TRYAGAIN : NSS_STATUS_NOTFOUND;
1696 +  if (canon != NULL)
1697 +    {
1698 +      *h_errnop = HOST_NOT_FOUND;
1699 +      return NSS_STATUS_NOTFOUND;
1700 +    }
1701 +
1702 +  *h_errnop = NETDB_INTERNAL;
1703 +  return NSS_STATUS_TRYAGAIN;
1704  }
1705  
1706  
1707 @@ -1222,11 +1232,101 @@ gaih_getanswer (const querybuf *answer1, int anslen1, const querybuf *answer2,
1708  
1709    enum nss_status status = NSS_STATUS_NOTFOUND;
1710  
1711 +  /* Combining the NSS status of two distinct queries requires some
1712 +     compromise and attention to symmetry (A or AAAA queries can be
1713 +     returned in any order).  What follows is a breakdown of how this
1714 +     code is expected to work and why. We discuss only SUCCESS,
1715 +     TRYAGAIN, NOTFOUND and UNAVAIL, since they are the only returns
1716 +     that apply (though RETURN and MERGE exist).  We make a distinction
1717 +     between TRYAGAIN (recoverable) and TRYAGAIN' (not-recoverable).
1718 +     A recoverable TRYAGAIN is almost always due to buffer size issues
1719 +     and returns ERANGE in errno and the caller is expected to retry
1720 +     with a larger buffer.
1721 +
1722 +     Lastly, you may be tempted to make significant changes to the
1723 +     conditions in this code to bring about symmetry between responses.
1724 +     Please don't change anything without due consideration for
1725 +     expected application behaviour.  Some of the synthesized responses
1726 +     aren't very well thought out and sometimes appear to imply that
1727 +     IPv4 responses are always answer 1, and IPv6 responses are always
1728 +     answer 2, but that's not true (see the implementation of send_dg
1729 +     and send_vc to see response can arrive in any order, particularly
1730 +     for UDP). However, we expect it holds roughly enough of the time
1731 +     that this code works, but certainly needs to be fixed to make this
1732 +     a more robust implementation.
1733 +
1734 +     ----------------------------------------------
1735 +     | Answer 1 Status /   | Synthesized | Reason |
1736 +     | Answer 2 Status     | Status      |        |
1737 +     |--------------------------------------------|
1738 +     | SUCCESS/SUCCESS     | SUCCESS     | [1]    |
1739 +     | SUCCESS/TRYAGAIN    | TRYAGAIN    | [5]    |
1740 +     | SUCCESS/TRYAGAIN'   | SUCCESS     | [1]    |
1741 +     | SUCCESS/NOTFOUND    | SUCCESS     | [1]    |
1742 +     | SUCCESS/UNAVAIL     | SUCCESS     | [1]    |
1743 +     | TRYAGAIN/SUCCESS    | TRYAGAIN    | [2]    |
1744 +     | TRYAGAIN/TRYAGAIN   | TRYAGAIN    | [2]    |
1745 +     | TRYAGAIN/TRYAGAIN'  | TRYAGAIN    | [2]    |
1746 +     | TRYAGAIN/NOTFOUND   | TRYAGAIN    | [2]    |
1747 +     | TRYAGAIN/UNAVAIL    | TRYAGAIN    | [2]    |
1748 +     | TRYAGAIN'/SUCCESS   | SUCCESS     | [3]    |
1749 +     | TRYAGAIN'/TRYAGAIN  | TRYAGAIN    | [3]    |
1750 +     | TRYAGAIN'/TRYAGAIN' | TRYAGAIN'   | [3]    |
1751 +     | TRYAGAIN'/NOTFOUND  | TRYAGAIN'   | [3]    |
1752 +     | TRYAGAIN'/UNAVAIL   | UNAVAIL     | [3]    |
1753 +     | NOTFOUND/SUCCESS    | SUCCESS     | [3]    |
1754 +     | NOTFOUND/TRYAGAIN   | TRYAGAIN    | [3]    |
1755 +     | NOTFOUND/TRYAGAIN'  | TRYAGAIN'   | [3]    |
1756 +     | NOTFOUND/NOTFOUND   | NOTFOUND    | [3]    |
1757 +     | NOTFOUND/UNAVAIL    | UNAVAIL     | [3]    |
1758 +     | UNAVAIL/SUCCESS     | UNAVAIL     | [4]    |
1759 +     | UNAVAIL/TRYAGAIN    | UNAVAIL     | [4]    |
1760 +     | UNAVAIL/TRYAGAIN'   | UNAVAIL     | [4]    |
1761 +     | UNAVAIL/NOTFOUND    | UNAVAIL     | [4]    |
1762 +     | UNAVAIL/UNAVAIL     | UNAVAIL     | [4]    |
1763 +     ----------------------------------------------
1764 +
1765 +     [1] If the first response is a success we return success.
1766 +        This ignores the state of the second answer and in fact
1767 +        incorrectly sets errno and h_errno to that of the second
1768 +        answer.  However because the response is a success we ignore
1769 +        *errnop and *h_errnop (though that means you touched errno on
1770 +        success).  We are being conservative here and returning the
1771 +        likely IPv4 response in the first answer as a success.
1772 +
1773 +     [2] If the first response is a recoverable TRYAGAIN we return
1774 +        that instead of looking at the second response.  The
1775 +        expectation here is that we have failed to get an IPv4 response
1776 +        and should retry both queries.
1777 +
1778 +     [3] If the first response was not a SUCCESS and the second
1779 +        response is not NOTFOUND (had a SUCCESS, need to TRYAGAIN,
1780 +        or failed entirely e.g. TRYAGAIN' and UNAVAIL) then use the
1781 +        result from the second response, otherwise the first responses
1782 +        status is used.  Again we have some odd side-effects when the
1783 +        second response is NOTFOUND because we overwrite *errnop and
1784 +        *h_errnop that means that a first answer of NOTFOUND might see
1785 +        its *errnop and *h_errnop values altered.  Whether it matters
1786 +        in practice that a first response NOTFOUND has the wrong
1787 +        *errnop and *h_errnop is undecided.
1788 +
1789 +     [4] If the first response is UNAVAIL we return that instead of
1790 +        looking at the second response.  The expectation here is that
1791 +        it will have failed similarly e.g. configuration failure.
1792 +
1793 +     [5] Testing this code is complicated by the fact that truncated
1794 +        second response buffers might be returned as SUCCESS if the
1795 +        first answer is a SUCCESS.  To fix this we add symmetry to
1796 +        TRYAGAIN with the second response.  If the second response
1797 +        is a recoverable error we now return TRYAGIN even if the first
1798 +        response was SUCCESS.  */
1799 +
1800    if (anslen1 > 0)
1801      status = gaih_getanswer_slice(answer1, anslen1, qname,
1802                                   &pat, &buffer, &buflen,
1803                                   errnop, h_errnop, ttlp,
1804                                   &first);
1805 +
1806    if ((status == NSS_STATUS_SUCCESS || status == NSS_STATUS_NOTFOUND
1807         || (status == NSS_STATUS_TRYAGAIN
1808            /* We want to look at the second answer in case of an
1809 @@ -1242,8 +1342,15 @@ gaih_getanswer (const querybuf *answer1, int anslen1, const querybuf *answer2,
1810                                                      &pat, &buffer, &buflen,
1811                                                      errnop, h_errnop, ttlp,
1812                                                      &first);
1813 +      /* Use the second response status in some cases.  */
1814        if (status != NSS_STATUS_SUCCESS && status2 != NSS_STATUS_NOTFOUND)
1815         status = status2;
1816 +      /* Do not return a truncated second response (unless it was
1817 +        unavoidable e.g. unrecoverable TRYAGAIN).  */
1818 +      if (status == NSS_STATUS_SUCCESS
1819 +         && (status2 == NSS_STATUS_TRYAGAIN
1820 +             && *errnop == ERANGE && *h_errnop != NO_RECOVERY))
1821 +       status = NSS_STATUS_TRYAGAIN;
1822      }
1823  
1824    return status;
1825 diff --git a/resolv/res_query.c b/resolv/res_query.c
1826 index 4a9b3b3..95470a9 100644
1827 --- a/resolv/res_query.c
1828 +++ b/resolv/res_query.c
1829 @@ -396,6 +396,7 @@ __libc_res_nsearch(res_state statp,
1830                   {
1831                     free (*answerp2);
1832                     *answerp2 = NULL;
1833 +                   *nanswerp2 = 0;
1834                     *answerp2_malloced = 0;
1835                   }
1836         }
1837 @@ -447,6 +448,7 @@ __libc_res_nsearch(res_state statp,
1838                           {
1839                             free (*answerp2);
1840                             *answerp2 = NULL;
1841 +                           *nanswerp2 = 0;
1842                             *answerp2_malloced = 0;
1843                           }
1844  
1845 @@ -521,6 +523,7 @@ __libc_res_nsearch(res_state statp,
1846           {
1847             free (*answerp2);
1848             *answerp2 = NULL;
1849 +           *nanswerp2 = 0;
1850             *answerp2_malloced = 0;
1851           }
1852         if (saved_herrno != -1)
1853 diff --git a/resolv/res_send.c b/resolv/res_send.c
1854 index 5e53cc2..6511bb1 100644
1855 --- a/resolv/res_send.c
1856 +++ b/resolv/res_send.c
1857 @@ -1,3 +1,20 @@
1858 +/* Copyright (C) 2016 Free Software Foundation, Inc.
1859 +   This file is part of the GNU C Library.
1860 +
1861 +   The GNU C Library is free software; you can redistribute it and/or
1862 +   modify it under the terms of the GNU Lesser General Public
1863 +   License as published by the Free Software Foundation; either
1864 +   version 2.1 of the License, or (at your option) any later version.
1865 +
1866 +   The GNU C Library is distributed in the hope that it will be useful,
1867 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
1868 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1869 +   Lesser General Public License for more details.
1870 +
1871 +   You should have received a copy of the GNU Lesser General Public
1872 +   License along with the GNU C Library; if not, see
1873 +   <http://www.gnu.org/licenses/>.  */
1874 +
1875  /*
1876   * Copyright (c) 1985, 1989, 1993
1877   *    The Regents of the University of California.  All rights reserved.
1878 @@ -363,6 +380,8 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
1879  #ifdef USE_HOOKS
1880         if (__glibc_unlikely (statp->qhook || statp->rhook))       {
1881                 if (anssiz < MAXPACKET && ansp) {
1882 +                       /* Always allocate MAXPACKET, callers expect
1883 +                          this specific size.  */
1884                         u_char *buf = malloc (MAXPACKET);
1885                         if (buf == NULL)
1886                                 return (-1);
1887 @@ -638,6 +657,77 @@ get_nsaddr (res_state statp, int n)
1888      return (struct sockaddr *) (void *) &statp->nsaddr_list[n];
1889  }
1890  
1891 +/* The send_vc function is responsible for sending a DNS query over TCP
1892 +   to the nameserver numbered NS from the res_state STATP i.e.
1893 +   EXT(statp).nssocks[ns].  The function supports sending both IPv4 and
1894 +   IPv6 queries at the same serially on the same socket.
1895 +
1896 +   Please note that for TCP there is no way to disable sending both
1897 +   queries, unlike UDP, which honours RES_SNGLKUP and RES_SNGLKUPREOP
1898 +   and sends the queries serially and waits for the result after each
1899 +   sent query.  This implemetnation should be corrected to honour these
1900 +   options.
1901 +
1902 +   Please also note that for TCP we send both queries over the same
1903 +   socket one after another.  This technically violates best practice
1904 +   since the server is allowed to read the first query, respond, and
1905 +   then close the socket (to service another client).  If the server
1906 +   does this, then the remaining second query in the socket data buffer
1907 +   will cause the server to send the client an RST which will arrive
1908 +   asynchronously and the client's OS will likely tear down the socket
1909 +   receive buffer resulting in a potentially short read and lost
1910 +   response data.  This will force the client to retry the query again,
1911 +   and this process may repeat until all servers and connection resets
1912 +   are exhausted and then the query will fail.  It's not known if this
1913 +   happens with any frequency in real DNS server implementations.  This
1914 +   implementation should be corrected to use two sockets by default for
1915 +   parallel queries.
1916 +
1917 +   The query stored in BUF of BUFLEN length is sent first followed by
1918 +   the query stored in BUF2 of BUFLEN2 length.  Queries are sent
1919 +   serially on the same socket.
1920 +
1921 +   Answers to the query are stored firstly in *ANSP up to a max of
1922 +   *ANSSIZP bytes.  If more than *ANSSIZP bytes are needed and ANSCP
1923 +   is non-NULL (to indicate that modifying the answer buffer is allowed)
1924 +   then malloc is used to allocate a new response buffer and ANSCP and
1925 +   ANSP will both point to the new buffer.  If more than *ANSSIZP bytes
1926 +   are needed but ANSCP is NULL, then as much of the response as
1927 +   possible is read into the buffer, but the results will be truncated.
1928 +   When truncation happens because of a small answer buffer the DNS
1929 +   packets header field TC will bet set to 1, indicating a truncated
1930 +   message and the rest of the socket data will be read and discarded.
1931 +
1932 +   Answers to the query are stored secondly in *ANSP2 up to a max of
1933 +   *ANSSIZP2 bytes, with the actual response length stored in
1934 +   *RESPLEN2.  If more than *ANSSIZP bytes are needed and ANSP2
1935 +   is non-NULL (required for a second query) then malloc is used to
1936 +   allocate a new response buffer, *ANSSIZP2 is set to the new buffer
1937 +   size and *ANSP2_MALLOCED is set to 1.
1938 +
1939 +   The ANSP2_MALLOCED argument will eventually be removed as the
1940 +   change in buffer pointer can be used to detect the buffer has
1941 +   changed and that the caller should use free on the new buffer.
1942 +
1943 +   Note that the answers may arrive in any order from the server and
1944 +   therefore the first and second answer buffers may not correspond to
1945 +   the first and second queries.
1946 +
1947 +   It is not supported to call this function with a non-NULL ANSP2
1948 +   but a NULL ANSCP.  Put another way, you can call send_vc with a
1949 +   single unmodifiable buffer or two modifiable buffers, but no other
1950 +   combination is supported.
1951 +
1952 +   It is the caller's responsibility to free the malloc allocated
1953 +   buffers by detecting that the pointers have changed from their
1954 +   original values i.e. *ANSCP or *ANSP2 has changed.
1955 +
1956 +   If errors are encountered then *TERRNO is set to an appropriate
1957 +   errno value and a zero result is returned for a recoverable error,
1958 +   and a less-than zero result is returned for a non-recoverable error.
1959 +
1960 +   If no errors are encountered then *TERRNO is left unmodified and
1961 +   a the length of the first response in bytes is returned.  */
1962  static int
1963  send_vc(res_state statp,
1964         const u_char *buf, int buflen, const u_char *buf2, int buflen2,
1965 @@ -647,11 +737,7 @@ send_vc(res_state statp,
1966  {
1967         const HEADER *hp = (HEADER *) buf;
1968         const HEADER *hp2 = (HEADER *) buf2;
1969 -       u_char *ans = *ansp;
1970 -       int orig_anssizp = *anssizp;
1971 -       // XXX REMOVE
1972 -       // int anssiz = *anssizp;
1973 -       HEADER *anhp = (HEADER *) ans;
1974 +       HEADER *anhp = (HEADER *) *ansp;
1975         struct sockaddr *nsap = get_nsaddr (statp, ns);
1976         int truncating, connreset, n;
1977         /* On some architectures compiler might emit a warning indicating
1978 @@ -743,6 +829,8 @@ send_vc(res_state statp,
1979          * Receive length & response
1980          */
1981         int recvresp1 = 0;
1982 +       /* Skip the second response if there is no second query.
1983 +          To do that we mark the second response as received.  */
1984         int recvresp2 = buf2 == NULL;
1985         uint16_t rlen16;
1986   read_len:
1987 @@ -779,40 +867,14 @@ send_vc(res_state statp,
1988         u_char **thisansp;
1989         int *thisresplenp;
1990         if ((recvresp1 | recvresp2) == 0 || buf2 == NULL) {
1991 +               /* We have not received any responses
1992 +                  yet or we only have one response to
1993 +                  receive.  */
1994                 thisanssizp = anssizp;
1995                 thisansp = anscp ?: ansp;
1996                 assert (anscp != NULL || ansp2 == NULL);
1997                 thisresplenp = &resplen;
1998         } else {
1999 -               if (*anssizp != MAXPACKET) {
2000 -                       /* No buffer allocated for the first
2001 -                          reply.  We can try to use the rest
2002 -                          of the user-provided buffer.  */
2003 -#if __GNUC_PREREQ (4, 7)
2004 -                       DIAG_PUSH_NEEDS_COMMENT;
2005 -                       DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
2006 -#endif
2007 -#if _STRING_ARCH_unaligned
2008 -                       *anssizp2 = orig_anssizp - resplen;
2009 -                       *ansp2 = *ansp + resplen;
2010 -#else
2011 -                       int aligned_resplen
2012 -                         = ((resplen + __alignof__ (HEADER) - 1)
2013 -                            & ~(__alignof__ (HEADER) - 1));
2014 -                       *anssizp2 = orig_anssizp - aligned_resplen;
2015 -                       *ansp2 = *ansp + aligned_resplen;
2016 -#endif
2017 -#if __GNUC_PREREQ (4, 7)
2018 -                       DIAG_POP_NEEDS_COMMENT;
2019 -#endif
2020 -               } else {
2021 -                       /* The first reply did not fit into the
2022 -                          user-provided buffer.  Maybe the second
2023 -                          answer will.  */
2024 -                       *anssizp2 = orig_anssizp;
2025 -                       *ansp2 = *ansp;
2026 -               }
2027 -
2028                 thisanssizp = anssizp2;
2029                 thisansp = ansp2;
2030                 thisresplenp = resplen2;
2031 @@ -820,10 +882,14 @@ send_vc(res_state statp,
2032         anhp = (HEADER *) *thisansp;
2033  
2034         *thisresplenp = rlen;
2035 -       if (rlen > *thisanssizp) {
2036 -               /* Yes, we test ANSCP here.  If we have two buffers
2037 -                  both will be allocatable.  */
2038 -               if (__glibc_likely (anscp != NULL))       {
2039 +       /* Is the answer buffer too small?  */
2040 +       if (*thisanssizp < rlen) {
2041 +               /* If the current buffer is not the the static
2042 +                  user-supplied buffer then we can reallocate
2043 +                  it.  */
2044 +               if (thisansp != NULL && thisansp != ansp) {
2045 +                       /* Always allocate MAXPACKET, callers expect
2046 +                          this specific size.  */
2047                         u_char *newp = malloc (MAXPACKET);
2048                         if (newp == NULL) {
2049                                 *terrno = ENOMEM;
2050 @@ -835,6 +901,9 @@ send_vc(res_state statp,
2051                         if (thisansp == ansp2)
2052                           *ansp2_malloced = 1;
2053                         anhp = (HEADER *) newp;
2054 +                       /* A uint16_t can't be larger than MAXPACKET
2055 +                          thus it's safe to allocate MAXPACKET but
2056 +                          read RLEN bytes instead.  */
2057                         len = rlen;
2058                 } else {
2059                         Dprint(statp->options & RES_DEBUG,
2060 @@ -997,6 +1066,66 @@ reopen (res_state statp, int *terrno, int ns)
2061         return 1;
2062  }
2063  
2064 +/* The send_dg function is responsible for sending a DNS query over UDP
2065 +   to the nameserver numbered NS from the res_state STATP i.e.
2066 +   EXT(statp).nssocks[ns].  The function supports IPv4 and IPv6 queries
2067 +   along with the ability to send the query in parallel for both stacks
2068 +   (default) or serially (RES_SINGLKUP).  It also supports serial lookup
2069 +   with a close and reopen of the socket used to talk to the server
2070 +   (RES_SNGLKUPREOP) to work around broken name servers.
2071 +
2072 +   The query stored in BUF of BUFLEN length is sent first followed by
2073 +   the query stored in BUF2 of BUFLEN2 length.  Queries are sent
2074 +   in parallel (default) or serially (RES_SINGLKUP or RES_SNGLKUPREOP).
2075 +
2076 +   Answers to the query are stored firstly in *ANSP up to a max of
2077 +   *ANSSIZP bytes.  If more than *ANSSIZP bytes are needed and ANSCP
2078 +   is non-NULL (to indicate that modifying the answer buffer is allowed)
2079 +   then malloc is used to allocate a new response buffer and ANSCP and
2080 +   ANSP will both point to the new buffer.  If more than *ANSSIZP bytes
2081 +   are needed but ANSCP is NULL, then as much of the response as
2082 +   possible is read into the buffer, but the results will be truncated.
2083 +   When truncation happens because of a small answer buffer the DNS
2084 +   packets header field TC will bet set to 1, indicating a truncated
2085 +   message, while the rest of the UDP packet is discarded.
2086 +
2087 +   Answers to the query are stored secondly in *ANSP2 up to a max of
2088 +   *ANSSIZP2 bytes, with the actual response length stored in
2089 +   *RESPLEN2.  If more than *ANSSIZP bytes are needed and ANSP2
2090 +   is non-NULL (required for a second query) then malloc is used to
2091 +   allocate a new response buffer, *ANSSIZP2 is set to the new buffer
2092 +   size and *ANSP2_MALLOCED is set to 1.
2093 +
2094 +   The ANSP2_MALLOCED argument will eventually be removed as the
2095 +   change in buffer pointer can be used to detect the buffer has
2096 +   changed and that the caller should use free on the new buffer.
2097 +
2098 +   Note that the answers may arrive in any order from the server and
2099 +   therefore the first and second answer buffers may not correspond to
2100 +   the first and second queries.
2101 +
2102 +   It is not supported to call this function with a non-NULL ANSP2
2103 +   but a NULL ANSCP.  Put another way, you can call send_vc with a
2104 +   single unmodifiable buffer or two modifiable buffers, but no other
2105 +   combination is supported.
2106 +
2107 +   It is the caller's responsibility to free the malloc allocated
2108 +   buffers by detecting that the pointers have changed from their
2109 +   original values i.e. *ANSCP or *ANSP2 has changed.
2110 +
2111 +   If an answer is truncated because of UDP datagram DNS limits then
2112 +   *V_CIRCUIT is set to 1 and the return value non-zero to indicate to
2113 +   the caller to retry with TCP.  The value *GOTSOMEWHERE is set to 1
2114 +   if any progress was made reading a response from the nameserver and
2115 +   is used by the caller to distinguish between ECONNREFUSED and
2116 +   ETIMEDOUT (the latter if *GOTSOMEWHERE is 1).
2117 +
2118 +   If errors are encountered then *TERRNO is set to an appropriate
2119 +   errno value and a zero result is returned for a recoverable error,
2120 +   and a less-than zero result is returned for a non-recoverable error.
2121 +
2122 +   If no errors are encountered then *TERRNO is left unmodified and
2123 +   a the length of the first response in bytes is returned.  */
2124  static int
2125  send_dg(res_state statp,
2126         const u_char *buf, int buflen, const u_char *buf2, int buflen2,
2127 @@ -1006,8 +1135,6 @@ send_dg(res_state statp,
2128  {
2129         const HEADER *hp = (HEADER *) buf;
2130         const HEADER *hp2 = (HEADER *) buf2;
2131 -       u_char *ans = *ansp;
2132 -       int orig_anssizp = *anssizp;
2133         struct timespec now, timeout, finish;
2134         struct pollfd pfd[1];
2135         int ptimeout;
2136 @@ -1040,6 +1167,8 @@ send_dg(res_state statp,
2137         int need_recompute = 0;
2138         int nwritten = 0;
2139         int recvresp1 = 0;
2140 +       /* Skip the second response if there is no second query.
2141 +          To do that we mark the second response as received.  */
2142         int recvresp2 = buf2 == NULL;
2143         pfd[0].fd = EXT(statp).nssocks[ns];
2144         pfd[0].events = POLLOUT;
2145 @@ -1203,55 +1332,56 @@ send_dg(res_state statp,
2146                 int *thisresplenp;
2147  
2148                 if ((recvresp1 | recvresp2) == 0 || buf2 == NULL) {
2149 +                       /* We have not received any responses
2150 +                          yet or we only have one response to
2151 +                          receive.  */
2152                         thisanssizp = anssizp;
2153                         thisansp = anscp ?: ansp;
2154                         assert (anscp != NULL || ansp2 == NULL);
2155                         thisresplenp = &resplen;
2156                 } else {
2157 -                       if (*anssizp != MAXPACKET) {
2158 -                               /* No buffer allocated for the first
2159 -                                  reply.  We can try to use the rest
2160 -                                  of the user-provided buffer.  */
2161 -#if _STRING_ARCH_unaligned
2162 -                               *anssizp2 = orig_anssizp - resplen;
2163 -                               *ansp2 = *ansp + resplen;
2164 -#else
2165 -                               int aligned_resplen
2166 -                                 = ((resplen + __alignof__ (HEADER) - 1)
2167 -                                    & ~(__alignof__ (HEADER) - 1));
2168 -                               *anssizp2 = orig_anssizp - aligned_resplen;
2169 -                               *ansp2 = *ansp + aligned_resplen;
2170 -#endif
2171 -                       } else {
2172 -                               /* The first reply did not fit into the
2173 -                                  user-provided buffer.  Maybe the second
2174 -                                  answer will.  */
2175 -                               *anssizp2 = orig_anssizp;
2176 -                               *ansp2 = *ansp;
2177 -                       }
2178 -
2179                         thisanssizp = anssizp2;
2180                         thisansp = ansp2;
2181                         thisresplenp = resplen2;
2182                 }
2183  
2184                 if (*thisanssizp < MAXPACKET
2185 -                   /* Yes, we test ANSCP here.  If we have two buffers
2186 -                      both will be allocatable.  */
2187 -                   && anscp
2188 +                   /* If the current buffer is not the the static
2189 +                      user-supplied buffer then we can reallocate
2190 +                      it.  */
2191 +                   && (thisansp != NULL && thisansp != ansp)
2192  #ifdef FIONREAD
2193 +                   /* Is the size too small?  */
2194                     && (ioctl (pfd[0].fd, FIONREAD, thisresplenp) < 0
2195                         || *thisanssizp < *thisresplenp)
2196  #endif
2197                      ) {
2198 +                       /* Always allocate MAXPACKET, callers expect
2199 +                          this specific size.  */
2200                         u_char *newp = malloc (MAXPACKET);
2201                         if (newp != NULL) {
2202 -                               *anssizp = MAXPACKET;
2203 -                               *thisansp = ans = newp;
2204 +                               *thisanssizp = MAXPACKET;
2205 +                               *thisansp = newp;
2206                                 if (thisansp == ansp2)
2207                                   *ansp2_malloced = 1;
2208                         }
2209                 }
2210 +               /* We could end up with truncation if anscp was NULL
2211 +                  (not allowed to change caller's buffer) and the
2212 +                  response buffer size is too small.  This isn't a
2213 +                  reliable way to detect truncation because the ioctl
2214 +                  may be an inaccurate report of the UDP message size.
2215 +                  Therefore we use this only to issue debug output.
2216 +                  To do truncation accurately with UDP we need
2217 +                  MSG_TRUNC which is only available on Linux.  We
2218 +                  can abstract out the Linux-specific feature in the
2219 +                  future to detect truncation.  */
2220 +               if (__glibc_unlikely (*thisanssizp < *thisresplenp)) {
2221 +                       Dprint(statp->options & RES_DEBUG,
2222 +                              (stdout, ";; response may be truncated (UDP)\n")
2223 +                       );
2224 +               }
2225 +
2226                 HEADER *anhp = (HEADER *) *thisansp;
2227                 socklen_t fromlen = sizeof(struct sockaddr_in6);
2228                 assert (sizeof(from) <= fromlen);
2229 diff --git a/scripts/test-installation.pl b/scripts/test-installation.pl
2230 index cac1562..79b2b3e 100755
2231 --- a/scripts/test-installation.pl
2232 +++ b/scripts/test-installation.pl
2233 @@ -80,16 +80,25 @@ arglist: while (@ARGV) {
2234  # We expect none or one argument.
2235  if ($#ARGV == -1) {
2236      $soversions="soversions.mk";
2237 +    $config="config.make";
2238  } elsif ($#ARGV == 0) {
2239      if (-d $ARGV[0]) {
2240        $soversions = "$ARGV[0]/soversions.mk";
2241 +      $config = "$ARGV[0]/config.make";
2242      } else {
2243 -      $soversions = $ARGV[0];
2244 +      $soversions = $dir = $ARGV[0];
2245 +      $dir =~ s!/?[^/]*/*$!!;
2246 +      $config = $dir . "/config.make";
2247      }
2248  } else {
2249      die "Wrong number of arguments.";
2250  }
2251  
2252 +if (system ("grep -q \"build-mathvec = yes\" $config") == 0) {
2253 +    $build_mathvec = 1;
2254 +} else {
2255 +    $build_mathvec = 0;
2256 +}
2257  
2258  # Read names and versions of all shared libraries that are part of
2259  # glibc
2260 @@ -111,6 +120,8 @@ while (<SOVERSIONS>) {
2261      # - libthread_db since it contains unresolved references
2262      # - it's just a test NSS module
2263      # - We don't provide the libgcc so we don't test it
2264 +    # - libmvec if it wasn't built
2265 +    next if ($build_mathvec == 0 && $name eq "mvec");
2266      if ($name ne "nss_ldap" && $name ne "db1"
2267         && !($name =~/^nss1_/) && $name ne "thread_db"
2268         && $name ne "nss_test1" && $name ne "libgcc_s") {
2269 diff --git a/stdlib/cxa_thread_atexit_impl.c b/stdlib/cxa_thread_atexit_impl.c
2270 index 2d5d56a..5717f09 100644
2271 --- a/stdlib/cxa_thread_atexit_impl.c
2272 +++ b/stdlib/cxa_thread_atexit_impl.c
2273 @@ -98,6 +98,10 @@ static __thread struct link_map *lm_cache;
2274  int
2275  __cxa_thread_atexit_impl (dtor_func func, void *obj, void *dso_symbol)
2276  {
2277 +#ifdef PTR_MANGLE
2278 +  PTR_MANGLE (func);
2279 +#endif
2280 +
2281    /* Prepend.  */
2282    struct dtor_list *new = calloc (1, sizeof (struct dtor_list));
2283    new->func = func;
2284 @@ -142,9 +146,13 @@ __call_tls_dtors (void)
2285    while (tls_dtor_list)
2286      {
2287        struct dtor_list *cur = tls_dtor_list;
2288 +      dtor_func func = cur->func;
2289 +#ifdef PTR_DEMANGLE
2290 +      PTR_DEMANGLE (func);
2291 +#endif
2292  
2293        tls_dtor_list = tls_dtor_list->next;
2294 -      cur->func (cur->obj);
2295 +      func (cur->obj);
2296  
2297        /* Ensure that the MAP dereference happens before
2298          l_tls_dtor_count decrement.  That way, we protect this access from a
2299 diff --git a/string/Makefile b/string/Makefile
2300 index 8424a61..ebe9354 100644
2301 --- a/string/Makefile
2302 +++ b/string/Makefile
2303 @@ -54,7 +54,7 @@ tests         := tester inl-tester noinl-tester testcopy test-ffs     \
2304                    tst-strtok tst-strxfrm bug-strcoll1 tst-strfry       \
2305                    bug-strtok1 $(addprefix test-,$(strop-tests))        \
2306                    bug-envz1 tst-strxfrm2 tst-endian tst-svc2           \
2307 -                  tst-strtok_r
2308 +                  tst-strtok_r bug-strcoll2
2309  
2310  xtests = tst-strcoll-overflow
2311  
2312 @@ -75,4 +75,17 @@ ifeq ($(run-built-tests),yes)
2313  $(objpfx)tst-svc-cmp.out: tst-svc.expect $(objpfx)tst-svc.out
2314         cmp $^ > $@; \
2315         $(evaluate-test)
2316 +
2317 +LOCALES := de_DE.UTF-8 en_US.ISO-8859-1 en_US.UTF-8 \
2318 +           tr_TR.ISO-8859-9 tr_TR.UTF-8 cs_CZ.UTF-8 \
2319 +          da_DK.ISO-8859-1
2320 +include ../gen-locales.mk
2321 +
2322 +$(objpfx)test-strcasecmp.out: $(gen-locales)
2323 +$(objpfx)test-strncasecmp.out: $(gen-locales)
2324 +$(objpfx)tst-strxfrm.out: $(gen-locales)
2325 +$(objpfx)tst-strxfrm2.out: $(gen-locales)
2326 +# bug-strcoll2 needs cs_CZ.UTF-8 and da_DK.ISO-8859-1.
2327 +$(objpfx)bug-strcoll2.out: $(gen-locales)
2328 +
2329  endif
2330 diff --git a/string/bug-strcoll2.c b/string/bug-strcoll2.c
2331 new file mode 100644
2332 index 0000000..72a9ff2
2333 --- /dev/null
2334 +++ b/string/bug-strcoll2.c
2335 @@ -0,0 +1,92 @@
2336 +/* Bug 18589: sort-test.sh fails at random.
2337 +   Copyright (C) 2015 Free Software Foundation, Inc.
2338 +   This file is part of the GNU C Library.
2339 +
2340 +   The GNU C Library is free software; you can redistribute it and/or
2341 +   modify it under the terms of the GNU Lesser General Public
2342 +   License as published by the Free Software Foundation; either
2343 +   version 2.1 of the License, or (at your option) any later version.
2344 +
2345 +   The GNU C Library is distributed in the hope that it will be useful,
2346 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
2347 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2348 +   Lesser General Public License for more details.
2349 +
2350 +   You should have received a copy of the GNU Lesser General Public
2351 +   License along with the GNU C Library; if not, see
2352 +   <http://www.gnu.org/licenses/>.  */
2353 +
2354 +#include <stdio.h>
2355 +#include <string.h>
2356 +#include <locale.h>
2357 +
2358 +/* An incorrect strcoll optimization resulted in incorrect
2359 +   results from strcoll for cs_CZ and da_DK.  */
2360 +
2361 +int
2362 +test_cs_CZ (void)
2363 +{
2364 +  const char t1[] = "config";
2365 +  const char t2[] = "choose";
2366 +  if (setlocale (LC_ALL, "cs_CZ.UTF-8") == NULL)
2367 +    {
2368 +      perror ("setlocale");
2369 +      return 1;
2370 +    }
2371 +  /* In Czech the digraph ch sorts after c, therefore we expect
2372 +     config to sort before choose.  */
2373 +  int a = strcoll (t1, t2);
2374 +  int b = strcoll (t2, t1);
2375 +  printf ("strcoll (\"%s\", \"%s\") = %d\n", t1, t2, a);
2376 +  printf ("strcoll (\"%s\", \"%s\") = %d\n", t2, t1, b);
2377 +  if (a < 0 && b > 0)
2378 +    {
2379 +      puts ("PASS: config < choose");
2380 +      return 0;
2381 +    }
2382 +  else
2383 +    {
2384 +      puts ("FAIL: Wrong sorting in cs_CZ.UTF-8.");
2385 +      return 1;
2386 +    }
2387 +}
2388 +
2389 +int
2390 +test_da_DK (void)
2391 +{
2392 +  const char t1[] = "AS";
2393 +  const char t2[] = "AA";
2394 +  if (setlocale (LC_ALL, "da_DK.ISO-8859-1") == NULL)
2395 +    {
2396 +      perror ("setlocale");
2397 +      return 1;
2398 +    }
2399 +  /* AA should be treated as the last letter of the Danish alphabet,
2400 +     hence sorting after AS.  */
2401 +  int a = strcoll (t1, t2);
2402 +  int b = strcoll (t2, t1);
2403 +  printf ("strcoll (\"%s\", \"%s\") = %d\n", t1, t2, a);
2404 +  printf ("strcoll (\"%s\", \"%s\") = %d\n", t2, t1, b);
2405 +  if (a < 0 && b > 0)
2406 +    {
2407 +      puts ("PASS: AS < AA");
2408 +      return 0;
2409 +    }
2410 +  else
2411 +    {
2412 +      puts ("FAIL: Wrong sorting in da_DK.ISO-8859-1");
2413 +      return 1;
2414 +    }
2415 +}
2416 +
2417 +static int
2418 +do_test (void)
2419 +{
2420 +  int err = 0;
2421 +  err |= test_cs_CZ ();
2422 +  err |= test_da_DK ();
2423 +  return err;
2424 +}
2425 +
2426 +#define TEST_FUNCTION do_test ()
2427 +#include "../test-skeleton.c"
2428 diff --git a/string/strcoll_l.c b/string/strcoll_l.c
2429 index 8f1225f..35bc0e4 100644
2430 --- a/string/strcoll_l.c
2431 +++ b/string/strcoll_l.c
2432 @@ -29,7 +29,6 @@
2433  # define STRING_TYPE char
2434  # define USTRING_TYPE unsigned char
2435  # define STRCOLL __strcoll_l
2436 -# define STRDIFF __strdiff
2437  # define STRCMP strcmp
2438  # define WEIGHT_H "../locale/weight.h"
2439  # define SUFFIX        MB
2440 @@ -42,20 +41,6 @@
2441  #include "../locale/localeinfo.h"
2442  #include WEIGHT_H
2443  
2444 -#define MASK_UTF8_7BIT  (1 << 7)
2445 -#define MASK_UTF8_START (3 << 6)
2446 -
2447 -size_t
2448 -STRDIFF (const STRING_TYPE *s, const STRING_TYPE *t)
2449 -{
2450 -  size_t n;
2451 -
2452 -  for (n = 0; *s != '\0' && *s++ == *t++; ++n)
2453 -    continue;
2454 -
2455 -  return n;
2456 -}
2457 -
2458  /* Track status while looking for sequences in a string.  */
2459  typedef struct
2460  {
2461 @@ -269,29 +254,9 @@ STRCOLL (const STRING_TYPE *s1, const STRING_TYPE *s2, __locale_t l)
2462    const USTRING_TYPE *extra;
2463    const int32_t *indirect;
2464  
2465 -  /* In case there is no locale specific sort order (C / POSIX).  */
2466    if (nrules == 0)
2467      return STRCMP (s1, s2);
2468  
2469 -  /* Fast forward to the position of the first difference.  Needs to be
2470 -     encoding aware as the byte-by-byte comparison can stop in the middle
2471 -     of a char sequence for multibyte encodings like UTF-8.  */
2472 -  uint_fast32_t encoding =
2473 -    current->values[_NL_ITEM_INDEX (_NL_COLLATE_ENCODING_TYPE)].word;
2474 -  if (encoding != __cet_other)
2475 -    {
2476 -      size_t diff = STRDIFF (s1, s2);
2477 -      if (diff > 0)
2478 -       {
2479 -         if (encoding == __cet_utf8 && (*(s1 + diff) & MASK_UTF8_7BIT) != 0)
2480 -           do
2481 -             diff--;
2482 -           while (diff > 0 && (*(s1 + diff) & MASK_UTF8_START) != MASK_UTF8_START);
2483 -         s1 += diff;
2484 -         s2 += diff;
2485 -       }
2486 -    }
2487 -
2488    /* Catch empty strings.  */
2489    if (__glibc_unlikely (*s1 == '\0') || __glibc_unlikely (*s2 == '\0'))
2490      return (*s1 != '\0') - (*s2 != '\0');
2491 @@ -358,8 +323,7 @@ STRCOLL (const STRING_TYPE *s1, const STRING_TYPE *s2, __locale_t l)
2492                      byte-level comparison to ensure that we don't waste time
2493                      going through multiple passes for totally equal strings
2494                      before proceeding to subsequent passes.  */
2495 -                 if (pass == 0 && encoding == __cet_other &&
2496 -                     STRCMP (s1, s2) == 0)
2497 +                 if (pass == 0 && STRCMP (s1, s2) == 0)
2498                     return result;
2499                   else
2500                     break;
2501 diff --git a/string/tst-strxfrm2.c b/string/tst-strxfrm2.c
2502 index d5a1115..bea5aa2 100644
2503 --- a/string/tst-strxfrm2.c
2504 +++ b/string/tst-strxfrm2.c
2505 @@ -5,6 +5,8 @@
2506  static int
2507  do_test (void)
2508  {
2509 +  static const char test_locale[] = "de_DE.UTF-8";
2510 +
2511    int res = 0;
2512  
2513    char buf[20];
2514 @@ -38,9 +40,9 @@ do_test (void)
2515        res = 1;
2516      }
2517  
2518 -  if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL)
2519 +  if (setlocale (LC_ALL, test_locale) == NULL)
2520      {
2521 -      puts ("setlocale failed");
2522 +      printf ("cannot set locale \"%s\"\n", test_locale);
2523        res = 1;
2524      }
2525    else
2526 diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
2527 index 7a0fe8d..78e3a97 100644
2528 --- a/sysdeps/generic/ldsodefs.h
2529 +++ b/sysdeps/generic/ldsodefs.h
2530 @@ -592,9 +592,6 @@ struct rtld_global_ro
2531    /* List of auditing interfaces.  */
2532    struct audit_ifaces *_dl_audit;
2533    unsigned int _dl_naudit;
2534 -
2535 -  /* 0 if internal pointer values should not be guarded, 1 if they should.  */
2536 -  EXTERN int _dl_pointer_guard;
2537  };
2538  # define __rtld_global_attribute__
2539  # if IS_IN (rtld)
2540 diff --git a/sysdeps/hppa/dl-symaddr.c b/sysdeps/hppa/dl-symaddr.c
2541 index b707c19..89d8baf 100644
2542 --- a/sysdeps/hppa/dl-symaddr.c
2543 +++ b/sysdeps/hppa/dl-symaddr.c
2544 @@ -33,3 +33,4 @@ _dl_symbol_address (struct link_map *map, const ElfW(Sym) *ref)
2545    else
2546      return (void *) value;
2547  }
2548 +rtld_hidden_def (_dl_symbol_address)
2549 diff --git a/sysdeps/hppa/start.S b/sysdeps/hppa/start.S
2550 index 64d8c3e..cc4f243 100644
2551 --- a/sysdeps/hppa/start.S
2552 +++ b/sysdeps/hppa/start.S
2553 @@ -42,7 +42,11 @@
2554         /* Have the linker create plabel words so we get PLABEL32
2555            relocs and not 21/14.  The use of 21/14 relocs is only
2556            supported in the latest dynamic linker.  */
2557 -       .section        .rodata
2558 +#ifdef SHARED
2559 +       .section        .data.rel.ro,"aw",@progbits
2560 +#else
2561 +       .section        .rodata,"a",@progbits
2562 +#endif
2563         .align 4
2564  .Lpmain:
2565         .word P%main
2566 @@ -52,6 +56,10 @@
2567         .word P%__libc_csu_fini
2568  .Lp__libc_csu_init:
2569         .word P%__libc_csu_init
2570 +#ifdef SHARED
2571 +.Lp__global:
2572 +       .word $global$
2573 +#endif
2574  
2575         .text
2576         .align 4
2577 @@ -122,10 +130,14 @@ _start:
2578         /* void *stack_end (7th argument) */
2579         stw     %sp, -60(%sp)
2580  
2581 +#ifdef SHARED
2582 +       addil   LT'.Lp__global, %r19
2583 +       ldw     RT'.Lp__global(%r1), %dp
2584 +#else
2585         /* load global */
2586         ldil    L%$global$, %dp
2587         ldo     R%$global$(%dp), %dp
2588 -
2589 +#endif
2590         bl      __libc_start_main,%r2
2591         nop
2592         /* die horribly if it returned (it shouldn't) */
2593 diff --git a/sysdeps/nacl/Makefile b/sysdeps/nacl/Makefile
2594 index 6749a44..1748886 100644
2595 --- a/sysdeps/nacl/Makefile
2596 +++ b/sysdeps/nacl/Makefile
2597 @@ -132,4 +132,13 @@ ifeq ($(subdir),misc)
2598  # sysdeps/.../linux/ directories, but it's still a sysdeps decision to
2599  # install it.
2600  sysdep_headers += bits/mman-linux.h
2601 +
2602 +# This defeats sysdeps/gnu/Makefile's addition of sys/mtio.h, which
2603 +# we do not want.  This is a total kludge, but it seems no worse for
2604 +# now than making the sysdeps/gnu/Makefile code conditional on a
2605 +# variable we set here.  If some sysdeps/.../Makefile that is later
2606 +# in the list than sysdeps/gnu needed to add to sysdep_headers, this
2607 +# would break it.  But sysdeps/gnu is close to last in the list and
2608 +# this coming up seems unlikely.
2609 +override sysdep_headers := $(sysdep_headers)
2610  endif
2611 diff --git a/sysdeps/nacl/dl-map-segments.h b/sysdeps/nacl/dl-map-segments.h
2612 index f305da3..f2d5d84 100644
2613 --- a/sysdeps/nacl/dl-map-segments.h
2614 +++ b/sysdeps/nacl/dl-map-segments.h
2615 @@ -53,7 +53,7 @@ _dl_map_segments (struct link_map *l, int fd,
2616                   const size_t maplength, bool has_holes,
2617                   struct link_map *loader)
2618  {
2619 -  if (__builtin_expect (type, ET_DYN) == ET_DYN)
2620 +  if (__glibc_likely (type == ET_DYN))
2621      {
2622        /* This is a position-independent shared object.  Let the system
2623          choose where to place it.
2624 @@ -165,6 +165,32 @@ _dl_map_segments (struct link_map *l, int fd,
2625                     errno = error;
2626                     return DL_MAP_SEGMENTS_ERROR_MAP_SEGMENT;
2627                   }
2628 +                if (__glibc_unlikely (type != ET_DYN))
2629 +                  {
2630 +                    /* A successful PROT_EXEC mmap would have implicitly
2631 +                       updated the bookkeeping so that a future
2632 +                       allocate_code_data call would know that this range
2633 +                       of the address space is already occupied.  That
2634 +                       doesn't happen implicitly with dyncode_create, so
2635 +                       it's necessary to do an explicit call to update the
2636 +                       bookkeeping.  */
2637 +                    uintptr_t allocated_address;
2638 +                    error = __nacl_irt_code_data_alloc.allocate_code_data
2639 +                      (l->l_addr + c->mapstart, len, 0, 0, &allocated_address);
2640 +                    if (__glibc_unlikely (error))
2641 +                      {
2642 +                        errno = error;
2643 +                        return DL_MAP_SEGMENTS_ERROR_MAP_SEGMENT;
2644 +                      }
2645 +                    if (__glibc_unlikely
2646 +                        (allocated_address != l->l_addr + c->mapstart))
2647 +                      {
2648 +                        /* This is not a very helpful error for this case,
2649 +                           but there isn't really anything better to use.  */
2650 +                        errno = ENOMEM;
2651 +                        return DL_MAP_SEGMENTS_ERROR_MAP_SEGMENT;
2652 +                      }
2653 +                  }
2654               }
2655             else
2656               {
2657 diff --git a/sysdeps/nacl/dl-sysdep-open.h b/sysdeps/nacl/dl-sysdep-open.h
2658 new file mode 100644
2659 index 0000000..38b0f9e
2660 --- /dev/null
2661 +++ b/sysdeps/nacl/dl-sysdep-open.h
2662 @@ -0,0 +1,40 @@
2663 +/* System-specific call to open a shared object by name.  NaCl version.
2664 +   Copyright (C) 2015 Free Software Foundation, Inc.
2665 +   This file is part of the GNU C Library.
2666 +
2667 +   The GNU C Library is free software; you can redistribute it and/or
2668 +   modify it under the terms of the GNU Lesser General Public
2669 +   License as published by the Free Software Foundation; either
2670 +   version 2.1 of the License, or (at your option) any later version.
2671 +
2672 +   The GNU C Library is distributed in the hope that it will be useful,
2673 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
2674 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2675 +   Lesser General Public License for more details.
2676 +
2677 +   You should have received a copy of the GNU Lesser General Public
2678 +   License along with the GNU C Library; if not, see
2679 +   <http://www.gnu.org/licenses/>.  */
2680 +
2681 +#ifndef _DL_SYSDEP_OPEN_H
2682 +#define _DL_SYSDEP_OPEN_H      1
2683 +
2684 +#include <stddef.h>
2685 +
2686 +/* NAME is a name without slashes, as it appears in a DT_NEEDED entry
2687 +   or a dlopen call's argument or suchlike.  NAMELEN is (strlen (NAME) + 1).
2688 +
2689 +   Find NAME in an OS-dependent fashion, and return its "real" name.
2690 +   Optionally fill in *FD with a file descriptor open on that file (or
2691 +   else leave its initial value of -1).  The return value is a new
2692 +   malloc'd string, which will be free'd by the caller.  If NAME is
2693 +   resolved to an actual file that can be opened, then the return
2694 +   value should name that file (and if *FD was not set, then a normal
2695 +   __open call on that string will be made).  If *FD was set by some
2696 +   other means than a normal open and there is no "real" name to use,
2697 +   then __strdup (NAME) is fine (modulo error checking).  */
2698 +
2699 +extern char *_dl_sysdep_open_object (const char *name, size_t namelen, int *fd)
2700 +  internal_function attribute_hidden;
2701 +
2702 +#endif  /* dl-sysdep-open.h */
2703 diff --git a/sysdeps/nacl/dl-sysdep.c b/sysdeps/nacl/dl-sysdep.c
2704 index 3e902c2..3a04aa1 100644
2705 --- a/sysdeps/nacl/dl-sysdep.c
2706 +++ b/sysdeps/nacl/dl-sysdep.c
2707 @@ -87,3 +87,26 @@ _dl_start_user (void (*user_entry) (uint32_t info[]), uint32_t info[])
2708  #endif  /* SHARED */
2709  
2710  #include <elf/dl-sysdep.c>
2711 +
2712 +#include <dl-sysdep-open.h>
2713 +#include <nacl-interfaces.h>
2714 +#include <assert.h>
2715 +#include <string.h>
2716 +#include <unistd.h>
2717 +
2718 +char *
2719 +internal_function
2720 +_dl_sysdep_open_object (const char *name, size_t namelen, int *fd)
2721 +{
2722 +  int error = __nacl_irt_resource_open.open_resource (name, fd);
2723 +  if (error)
2724 +    return NULL;
2725 +  assert (*fd != -1);
2726 +  char *realname = __strdup (name);
2727 +  if (__glibc_unlikely (realname == NULL))
2728 +    {
2729 +      __close (*fd);
2730 +      *fd = -1;
2731 +    }
2732 +  return realname;
2733 +}
2734 diff --git a/sysdeps/nacl/nacl-interface-list.h b/sysdeps/nacl/nacl-interface-list.h
2735 index cb33751..c68faed 100644
2736 --- a/sysdeps/nacl/nacl-interface-list.h
2737 +++ b/sysdeps/nacl/nacl-interface-list.h
2738 @@ -28,7 +28,7 @@ NACL_MANDATORY_INTERFACE (rtld,
2739                           NACL_IRT_FUTEX_v0_1, nacl_irt_futex)
2740  NACL_MANDATORY_INTERFACE (rtld,
2741                           NACL_IRT_TLS_v0_1, nacl_irt_tls)
2742 -NACL_MANDATORY_INTERFACE (libc,
2743 +NACL_MANDATORY_INTERFACE (rtld,
2744                           NACL_IRT_RESOURCE_OPEN_v0_1, nacl_irt_resource_open)
2745  NACL_MANDATORY_INTERFACE (rtld,
2746                           NACL_IRT_CODE_DATA_ALLOC_v0_1,
2747 diff --git a/sysdeps/nacl/start.c b/sysdeps/nacl/start.c
2748 index a4b6dd3..8e8bc1a 100644
2749 --- a/sysdeps/nacl/start.c
2750 +++ b/sysdeps/nacl/start.c
2751 @@ -44,6 +44,10 @@
2752  /* The application defines this, of course.  */
2753  extern int main (int argc, char **argv, char **envp);
2754  
2755 +/* But maybe it defines this too, in which case it takes precedence.  */
2756 +extern int __nacl_main (int argc, char **argv, char **envp)
2757 +  __attribute__ ((weak));
2758 +
2759  /* These are defined in libc.  */
2760  extern int __libc_csu_init (int argc, char **argv, char **envp);
2761  extern void __libc_csu_fini (void);
2762 @@ -59,7 +63,7 @@ _start (uint32_t info[])
2763  {
2764    /* The generic code actually assumes that envp follows argv.  */
2765  
2766 -  __libc_start_main (&main,
2767 +  __libc_start_main (&__nacl_main ?: &main,
2768                      nacl_startup_argc (info),
2769                      nacl_startup_argv (info),
2770                      nacl_startup_auxv (info),
2771 diff --git a/sysdeps/posix/opendir.c b/sysdeps/posix/opendir.c
2772 index 6509f5c..9edf056 100644
2773 --- a/sysdeps/posix/opendir.c
2774 +++ b/sysdeps/posix/opendir.c
2775 @@ -105,7 +105,7 @@ need_isdir_precheck (void)
2776      tryopen_o_directory ();
2777  
2778    /* We can skip the expensive `stat' call if O_DIRECTORY works.  */
2779 -  return o_directory_works > 0;
2780 +  return o_directory_works < 0;
2781  #endif
2782    return true;
2783  }
2784 diff --git a/sysdeps/powerpc/nptl/elide.h b/sysdeps/powerpc/nptl/elide.h
2785 index 389f5a5..2e1e443 100644
2786 --- a/sysdeps/powerpc/nptl/elide.h
2787 +++ b/sysdeps/powerpc/nptl/elide.h
2788 @@ -23,67 +23,78 @@
2789  # include <htm.h>
2790  # include <elision-conf.h>
2791  
2792 -/* Returns true if the lock defined by is_lock_free as elided.
2793 -   ADAPT_COUNT is a pointer to per-lock state variable. */
2794 -
2795 +/* Get the new value of adapt_count according to the elision
2796 +   configurations.  Returns true if the system should retry again or false
2797 +   otherwise.  */
2798  static inline bool
2799 -__elide_lock (uint8_t *adapt_count, int is_lock_free)
2800 +__get_new_count (uint8_t *adapt_count, int attempt)
2801  {
2802 -  if (*adapt_count > 0)
2803 +  /* A persistent failure indicates that a retry will probably
2804 +     result in another failure.  Use normal locking now and
2805 +     for the next couple of calls.  */
2806 +  if (_TEXASRU_FAILURE_PERSISTENT (__builtin_get_texasru ()))
2807      {
2808 -      (*adapt_count)--;
2809 +      if (__elision_aconf.skip_lock_internal_abort > 0)
2810 +       *adapt_count = __elision_aconf.skip_lock_internal_abort;
2811        return false;
2812      }
2813 -
2814 -  for (int i = __elision_aconf.try_tbegin; i > 0; i--)
2815 -    {
2816 -      if (__builtin_tbegin (0))
2817 -       {
2818 -         if (is_lock_free)
2819 -           return true;
2820 -         /* Lock was busy.  */
2821 -         __builtin_tabort (_ABORT_LOCK_BUSY);
2822 -       }
2823 -      else
2824 -       {
2825 -         /* A persistent failure indicates that a retry will probably
2826 -            result in another failure.  Use normal locking now and
2827 -            for the next couple of calls.  */
2828 -         if (_TEXASRU_FAILURE_PERSISTENT (__builtin_get_texasru ()))
2829 -           {
2830 -             if (__elision_aconf.skip_lock_internal_abort > 0)
2831 -               *adapt_count = __elision_aconf.skip_lock_internal_abort;
2832 -             break;
2833 -           }
2834 -         /* Same logic as above, but for a number of temporary failures in a
2835 -            a row.  */
2836 -         else if (__elision_aconf.skip_lock_out_of_tbegin_retries > 0
2837 -                  && __elision_aconf.try_tbegin > 0)
2838 -           *adapt_count = __elision_aconf.skip_lock_out_of_tbegin_retries;
2839 -       }
2840 -     }
2841 -
2842 -  return false;
2843 +  /* Same logic as above, but for a number of temporary failures in a
2844 +     a row.  */
2845 +  else if (attempt <= 1 && __elision_aconf.skip_lock_out_of_tbegin_retries > 0
2846 +          && __elision_aconf.try_tbegin > 0)
2847 +    *adapt_count = __elision_aconf.skip_lock_out_of_tbegin_retries;
2848 +  return true;
2849  }
2850  
2851 -# define ELIDE_LOCK(adapt_count, is_lock_free) \
2852 -  __elide_lock (&(adapt_count), is_lock_free)
2853 -
2854 -
2855 -static inline bool
2856 -__elide_trylock (uint8_t *adapt_count, int is_lock_free, int write)
2857 -{
2858 -  if (__elision_aconf.try_tbegin > 0)
2859 -    {
2860 -      if (write)
2861 -       __builtin_tabort (_ABORT_NESTED_TRYLOCK);
2862 -      return __elide_lock (adapt_count, is_lock_free);
2863 -    }
2864 -  return false;
2865 -}
2866 +/* CONCURRENCY NOTES:
2867 +
2868 +   The evaluation of the macro expression is_lock_free encompasses one or
2869 +   more loads from memory locations that are concurrently modified by other
2870 +   threads.  For lock elision to work, this evaluation and the rest of the
2871 +   critical section protected by the lock must be atomic because an
2872 +   execution with lock elision must be equivalent to an execution in which
2873 +   the lock would have been actually acquired and released.  Therefore, we
2874 +   evaluate is_lock_free inside of the transaction that represents the
2875 +   critical section for which we want to use lock elision, which ensures
2876 +   the atomicity that we require.  */
2877 +
2878 +/* Returns 0 if the lock defined by is_lock_free was elided.
2879 +   ADAPT_COUNT is a per-lock state variable.  */
2880 +# define ELIDE_LOCK(adapt_count, is_lock_free)                         \
2881 +  ({                                                                   \
2882 +    int ret = 0;                                                       \
2883 +    if (adapt_count > 0)                                               \
2884 +      (adapt_count)--;                                                 \
2885 +    else                                                               \
2886 +      for (int i = __elision_aconf.try_tbegin; i > 0; i--)             \
2887 +       {                                                               \
2888 +         if (__builtin_tbegin (0))                                     \
2889 +           {                                                           \
2890 +             if (is_lock_free)                                         \
2891 +               {                                                       \
2892 +                 ret = 1;                                              \
2893 +                 break;                                                \
2894 +               }                                                       \
2895 +             __builtin_tabort (_ABORT_LOCK_BUSY);                      \
2896 +           }                                                           \
2897 +         else                                                          \
2898 +           if (!__get_new_count (&adapt_count,i))                      \
2899 +             break;                                                    \
2900 +       }                                                               \
2901 +    ret;                                                               \
2902 +  })
2903  
2904  # define ELIDE_TRYLOCK(adapt_count, is_lock_free, write)       \
2905 -  __elide_trylock (&(adapt_count), is_lock_free, write)
2906 +  ({                                                           \
2907 +    int ret = 0;                                               \
2908 +    if (__elision_aconf.try_tbegin > 0)                                \
2909 +      {                                                                \
2910 +       if (write)                                              \
2911 +         __builtin_tabort (_ABORT_NESTED_TRYLOCK);             \
2912 +       ret = ELIDE_LOCK (adapt_count, is_lock_free);           \
2913 +      }                                                                \
2914 +    ret;                                                       \
2915 +  })
2916  
2917  
2918  static inline bool
2919 diff --git a/sysdeps/sparc/sparc32/sem_open.c b/sysdeps/sparc/sparc32/sem_open.c
2920 index 16cb9ad..59df2d7 100644
2921 --- a/sysdeps/sparc/sparc32/sem_open.c
2922 +++ b/sysdeps/sparc/sparc32/sem_open.c
2923 @@ -29,6 +29,7 @@
2924  #include <sys/mman.h>
2925  #include <sys/stat.h>
2926  #include "semaphoreP.h"
2927 +#include <futex-internal.h>
2928  #include <shm-directory.h>
2929  
2930  
2931 diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
2932 index 58c8b32..aa20e22 100644
2933 --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
2934 +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
2935 @@ -1822,9 +1822,6 @@ GLIBC_2.17
2936  GLIBC_2.18
2937   GLIBC_2.18 A
2938   __cxa_thread_atexit_impl F
2939 -GLIBC_2.22
2940 - GLIBC_2.22 A
2941 - fmemopen F
2942  GLIBC_2.2
2943   GLIBC_2.2 A
2944   _IO_adjust_wcolumn F
2945 @@ -2015,6 +2012,9 @@ GLIBC_2.2.4
2946  GLIBC_2.2.6
2947   GLIBC_2.2.6 A
2948   __nanosleep F
2949 +GLIBC_2.22
2950 + GLIBC_2.22 A
2951 + fmemopen F
2952  GLIBC_2.3
2953   GLIBC_2.3 A
2954   __ctype_b_loc F
2955 diff --git a/sysdeps/unix/sysv/linux/hppa/bits/atomic.h b/sysdeps/unix/sysv/linux/hppa/bits/atomic.h
2956 index abde83e..6e73504 100644
2957 --- a/sysdeps/unix/sysv/linux/hppa/bits/atomic.h
2958 +++ b/sysdeps/unix/sysv/linux/hppa/bits/atomic.h
2959 @@ -56,42 +56,41 @@ typedef uintmax_t uatomic_max_t;
2960  #define _LWS "0xb0"
2961  #define _LWS_CAS "0"
2962  /* Note r31 is the link register.  */
2963 -#define _LWS_CLOBBER "r1", "r26", "r25", "r24", "r23", "r22", "r21", "r20", "r28", "r31", "memory"
2964 +#define _LWS_CLOBBER "r1", "r23", "r22", "r20", "r31", "memory"
2965  /* String constant for -EAGAIN.  */
2966  #define _ASM_EAGAIN "-11"
2967  /* String constant for -EDEADLOCK.  */
2968  #define _ASM_EDEADLOCK "-45"
2969  
2970  #if __ASSUME_LWS_CAS
2971 -/* The only basic operation needed is compare and exchange.  */
2972 +/* The only basic operation needed is compare and exchange.  The mem
2973 +   pointer must be word aligned.  */
2974  # define atomic_compare_and_exchange_val_acq(mem, newval, oldval)      \
2975    ({                                                                   \
2976 -     volatile int lws_errno;                                           \
2977 -     __typeof__ (*mem) lws_ret;                                                \
2978 -     asm volatile(                                                     \
2979 +     register long lws_errno asm("r21");                               \
2980 +     register unsigned long lws_ret asm("r28");                                \
2981 +     register unsigned long lws_mem asm("r26") = (unsigned long)(mem); \
2982 +     register unsigned long lws_old asm("r25") = (unsigned long)(oldval);\
2983 +     register unsigned long lws_new asm("r24") = (unsigned long)(newval);\
2984 +     __asm__ __volatile__(                                             \
2985         "0:                                     \n\t"                   \
2986 -       "copy   %2, %%r26                       \n\t"                   \
2987 -       "copy   %3, %%r25                       \n\t"                   \
2988 -       "copy   %4, %%r24                       \n\t"                   \
2989         "ble    " _LWS "(%%sr2, %%r0)           \n\t"                   \
2990         "ldi    " _LWS_CAS ", %%r20             \n\t"                   \
2991 -       "ldi    " _ASM_EAGAIN ", %%r24          \n\t"                   \
2992 -       "cmpb,=,n %%r24, %%r21, 0b              \n\t"                   \
2993 +       "ldi    " _ASM_EAGAIN ", %%r20          \n\t"                   \
2994 +       "cmpb,=,n %%r20, %%r21, 0b              \n\t"                   \
2995         "nop                                    \n\t"                   \
2996 -       "ldi    " _ASM_EDEADLOCK ", %%r25       \n\t"                   \
2997 -       "cmpb,=,n %%r25, %%r21, 0b              \n\t"                   \
2998 +       "ldi    " _ASM_EDEADLOCK ", %%r20       \n\t"                   \
2999 +       "cmpb,=,n %%r20, %%r21, 0b              \n\t"                   \
3000         "nop                                    \n\t"                   \
3001 -       "stw    %%r28, %0                       \n\t"                   \
3002 -       "stw    %%r21, %1                       \n\t"                   \
3003 -       : "=m" (lws_ret), "=m" (lws_errno)                              \
3004 -        : "r" (mem), "r" (oldval), "r" (newval)                                \
3005 +       : "=r" (lws_ret), "=r" (lws_errno)                              \
3006 +       : "r" (lws_mem), "r" (lws_old), "r" (lws_new)                   \
3007         : _LWS_CLOBBER                                                  \
3008       );                                                                        \
3009                                                                         \
3010 -     if(lws_errno == -EFAULT || lws_errno == -ENOSYS)                  \
3011 +     if (lws_errno == -EFAULT || lws_errno == -ENOSYS)                 \
3012         ABORT_INSTRUCTION;                                              \
3013                                                                         \
3014 -     lws_ret;                                                          \
3015 +     (__typeof (oldval)) lws_ret;                                      \
3016     })
3017  
3018  # define atomic_compare_and_exchange_bool_acq(mem, newval, oldval)     \
3019 diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
3020 index cf0ad90..224e1f3 100644
3021 --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
3022 +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
3023 @@ -95,9 +95,6 @@ GLIBC_2.18
3024  GLIBC_2.19
3025   GLIBC_2.19 A
3026   fanotify_mark F
3027 -GLIBC_2.22
3028 - GLIBC_2.22 A
3029 - fmemopen F
3030  GLIBC_2.2
3031   GLIBC_2.2 A
3032   _Exit F
3033 @@ -1863,6 +1860,9 @@ GLIBC_2.2.4
3034  GLIBC_2.2.6
3035   GLIBC_2.2.6 A
3036   __nanosleep F
3037 +GLIBC_2.22
3038 + GLIBC_2.22 A
3039 + fmemopen F
3040  GLIBC_2.3
3041   GLIBC_2.3 A
3042   __ctype_b_loc F
3043 diff --git a/sysdeps/unix/sysv/linux/hppa/syscall.c b/sysdeps/unix/sysv/linux/hppa/syscall.c
3044 index aff67a8..958fa47 100644
3045 --- a/sysdeps/unix/sysv/linux/hppa/syscall.c
3046 +++ b/sysdeps/unix/sysv/linux/hppa/syscall.c
3047 @@ -43,9 +43,10 @@ syscall (long int __sysno, ...)
3048    va_end (args);
3049  
3050    {
3051 +    LOAD_ARGS_6 (arg0, arg1, arg2, arg3, arg4, arg5)
3052      register unsigned long int __res asm("r28");
3053      PIC_REG_DEF
3054 -    LOAD_ARGS_6 (arg0, arg1, arg2, arg3, arg4, arg5)
3055 +    LOAD_REGS_6
3056      asm volatile (SAVE_ASM_PIC
3057                   "     ble  0x100(%%sr2, %%r0) \n"
3058                   "     copy %1, %%r20          \n"
3059 diff --git a/sysdeps/unix/sysv/linux/hppa/sysdep.h b/sysdeps/unix/sysv/linux/hppa/sysdep.h
3060 index d20a04b..cb1f163 100644
3061 --- a/sysdeps/unix/sysv/linux/hppa/sysdep.h
3062 +++ b/sysdeps/unix/sysv/linux/hppa/sysdep.h
3063 @@ -400,9 +400,10 @@ L(pre_end):                                        ASM_LINE_SEP    \
3064  ({                                                                     \
3065         long __sys_res;                                                 \
3066         {                                                               \
3067 +               LOAD_ARGS_##nr(args)                                    \
3068                 register unsigned long __res asm("r28");                \
3069                 PIC_REG_DEF                                             \
3070 -               LOAD_ARGS_##nr(args)                                    \
3071 +               LOAD_REGS_##nr                                          \
3072                 /* FIXME: HACK save/load r19 around syscall */          \
3073                 asm volatile(                                           \
3074                         SAVE_ASM_PIC                                    \
3075 @@ -425,9 +426,10 @@ L(pre_end):                                        ASM_LINE_SEP    \
3076  ({                                                                     \
3077         long __sys_res;                                                 \
3078         {                                                               \
3079 +               LOAD_ARGS_##nr(args)                                    \
3080                 register unsigned long __res asm("r28");                \
3081                 PIC_REG_DEF                                             \
3082 -               LOAD_ARGS_##nr(args)                                    \
3083 +               LOAD_REGS_##nr                                          \
3084                 /* FIXME: HACK save/load r19 around syscall */          \
3085                 asm volatile(                                           \
3086                         SAVE_ASM_PIC                                    \
3087 @@ -443,27 +445,44 @@ L(pre_end):                                       ASM_LINE_SEP    \
3088         __sys_res;                                                      \
3089   })
3090  
3091 -
3092 -
3093  #define LOAD_ARGS_0()
3094 -#define LOAD_ARGS_1(r26)                                               \
3095 -  register unsigned long __r26 __asm__("r26") = (unsigned long)(r26);  \
3096 +#define LOAD_REGS_0
3097 +#define LOAD_ARGS_1(a1)                                                        \
3098 +  register unsigned long __x26 = (unsigned long)(a1);                  \
3099    LOAD_ARGS_0()
3100 -#define LOAD_ARGS_2(r26,r25)                                           \
3101 -  register unsigned long __r25 __asm__("r25") = (unsigned long)(r25);  \
3102 -  LOAD_ARGS_1(r26)
3103 -#define LOAD_ARGS_3(r26,r25,r24)                                       \
3104 -  register unsigned long __r24 __asm__("r24") = (unsigned long)(r24);  \
3105 -  LOAD_ARGS_2(r26,r25)
3106 -#define LOAD_ARGS_4(r26,r25,r24,r23)                                   \
3107 -  register unsigned long __r23 __asm__("r23") = (unsigned long)(r23);  \
3108 -  LOAD_ARGS_3(r26,r25,r24)
3109 -#define LOAD_ARGS_5(r26,r25,r24,r23,r22)                               \
3110 -  register unsigned long __r22 __asm__("r22") = (unsigned long)(r22);  \
3111 -  LOAD_ARGS_4(r26,r25,r24,r23)
3112 -#define LOAD_ARGS_6(r26,r25,r24,r23,r22,r21)                           \
3113 -  register unsigned long __r21 __asm__("r21") = (unsigned long)(r21);  \
3114 -  LOAD_ARGS_5(r26,r25,r24,r23,r22)
3115 +#define LOAD_REGS_1                                                    \
3116 +  register unsigned long __r26 __asm__("r26") = __x26;                 \
3117 +  LOAD_REGS_0
3118 +#define LOAD_ARGS_2(a1,a2)                                             \
3119 +  register unsigned long __x25 = (unsigned long)(a2);                  \
3120 +  LOAD_ARGS_1(a1)
3121 +#define LOAD_REGS_2                                                    \
3122 +  register unsigned long __r25 __asm__("r25") = __x25;                 \
3123 +  LOAD_REGS_1
3124 +#define LOAD_ARGS_3(a1,a2,a3)                                          \
3125 +  register unsigned long __x24 = (unsigned long)(a3);                  \
3126 +  LOAD_ARGS_2(a1,a2)
3127 +#define LOAD_REGS_3                                                    \
3128 +  register unsigned long __r24 __asm__("r24") = __x24;                 \
3129 +  LOAD_REGS_2
3130 +#define LOAD_ARGS_4(a1,a2,a3,a4)                                       \
3131 +  register unsigned long __x23 = (unsigned long)(a4);                  \
3132 +  LOAD_ARGS_3(a1,a2,a3)
3133 +#define LOAD_REGS_4                                                    \
3134 +  register unsigned long __r23 __asm__("r23") = __x23;                 \
3135 +  LOAD_REGS_3
3136 +#define LOAD_ARGS_5(a1,a2,a3,a4,a5)                                    \
3137 +  register unsigned long __x22 = (unsigned long)(a5);                  \
3138 +  LOAD_ARGS_4(a1,a2,a3,a4)
3139 +#define LOAD_REGS_5                                                    \
3140 +  register unsigned long __r22 __asm__("r22") = __x22;                 \
3141 +  LOAD_REGS_4
3142 +#define LOAD_ARGS_6(a1,a2,a3,a4,a5,a6)                                 \
3143 +  register unsigned long __x21 = (unsigned long)(a6);                  \
3144 +  LOAD_ARGS_5(a1,a2,a3,a4,a5)
3145 +#define LOAD_REGS_6                                                    \
3146 +  register unsigned long __r21 __asm__("r21") = __x21;                 \
3147 +  LOAD_REGS_5
3148  
3149  /* Even with zero args we use r20 for the syscall number */
3150  #define ASM_ARGS_0
3151 diff --git a/sysdeps/unix/sysv/linux/microblaze/sysdep.h b/sysdeps/unix/sysv/linux/microblaze/sysdep.h
3152 index 83c0340..9d5c542 100644
3153 --- a/sysdeps/unix/sysv/linux/microblaze/sysdep.h
3154 +++ b/sysdeps/unix/sysv/linux/microblaze/sysdep.h
3155 @@ -16,8 +16,11 @@
3156     License along with the GNU C Library; if not, see
3157     <http://www.gnu.org/licenses/>.  */
3158  
3159 +#ifndef _LINUX_MICROBLAZE_SYSDEP_H
3160 +#define _LINUX_MICROBLAZE_SYSDEP_H 1
3161 +
3162 +#include <sysdeps/unix/sysdep.h>
3163  #include <sysdeps/microblaze/sysdep.h>
3164 -#include <sys/syscall.h>
3165  
3166  /* Defines RTLD_PRIVATE_ERRNO.  */
3167  #include <dl-sysdep.h>
3168 @@ -305,3 +308,5 @@ SYSCALL_ERROR_LABEL_DCL:                            \
3169  # define PTR_DEMANGLE(var) (void) (var)
3170  
3171  #endif /* not __ASSEMBLER__ */
3172 +
3173 +#endif /* _LINUX_MICROBLAZE_SYSDEP_H */
3174 diff --git a/sysdeps/unix/sysv/linux/openat.c b/sysdeps/unix/sysv/linux/openat.c
3175 index 6777123..ad8e31d 100644
3176 --- a/sysdeps/unix/sysv/linux/openat.c
3177 +++ b/sysdeps/unix/sysv/linux/openat.c
3178 @@ -68,6 +68,11 @@ __OPENAT (int fd, const char *file, int oflag, ...)
3179        va_end (arg);
3180      }
3181  
3182 +  /* We have to add the O_LARGEFILE flag for openat64.  */
3183 +#ifdef MORE_OFLAGS
3184 +  oflag |= MORE_OFLAGS;
3185 +#endif
3186 +
3187    return SYSCALL_CANCEL (openat, fd, file, oflag, mode);
3188  }
3189  libc_hidden_def (__OPENAT)
3190 diff --git a/sysdeps/unix/sysv/linux/powerpc/elision-lock.c b/sysdeps/unix/sysv/linux/powerpc/elision-lock.c
3191 index 7f9bcc2..c6731ca 100644
3192 --- a/sysdeps/unix/sysv/linux/powerpc/elision-lock.c
3193 +++ b/sysdeps/unix/sysv/linux/powerpc/elision-lock.c
3194 @@ -72,8 +72,7 @@ __lll_lock_elision (int *lock, short *adapt_count, EXTRAARG int pshared)
3195        goto use_lock;
3196      }
3197  
3198 -  int try_begin = aconf.try_tbegin;
3199 -  while (1)
3200 +  for (int i = aconf.try_tbegin; i > 0; i--)
3201      {
3202        if (__builtin_tbegin (0))
3203         {
3204 @@ -87,21 +86,19 @@ __lll_lock_elision (int *lock, short *adapt_count, EXTRAARG int pshared)
3205           /* A persistent failure indicates that a retry will probably
3206              result in another failure.  Use normal locking now and
3207              for the next couple of calls.  */
3208 -         if (try_begin-- <= 0
3209 -             || _TEXASRU_FAILURE_PERSISTENT (__builtin_get_texasru ()))
3210 +         if (_TEXASRU_FAILURE_PERSISTENT (__builtin_get_texasru ()))
3211             {
3212               if (aconf.skip_lock_internal_abort > 0)
3213                 *adapt_count = aconf.skip_lock_internal_abort;
3214               goto use_lock;
3215             }
3216 -         /* Same logic as above, but for for a number of temporary failures
3217 -            in a row.  */
3218 -         else if (aconf.skip_lock_out_of_tbegin_retries > 0
3219 -                   && aconf.try_tbegin > 0)
3220 -           *adapt_count = aconf.skip_lock_out_of_tbegin_retries;
3221         }
3222       }
3223  
3224 +  /* Fall back to locks for a bit if retries have been exhausted */
3225 +  if (aconf.try_tbegin > 0 && aconf.skip_lock_out_of_tbegin_retries > 0)
3226 +    *adapt_count = aconf.skip_lock_out_of_tbegin_retries;
3227 +
3228  use_lock:
3229    return LLL_LOCK ((*lock), pshared);
3230  }
3231 diff --git a/sysdeps/x86/fpu/bits/math-vector.h b/sysdeps/x86/fpu/bits/math-vector.h
3232 index f9e798b..f3bfb86 100644
3233 --- a/sysdeps/x86/fpu/bits/math-vector.h
3234 +++ b/sysdeps/x86/fpu/bits/math-vector.h
3235 @@ -53,34 +53,5 @@
3236  #  undef __DECL_SIMD_powf
3237  #  define __DECL_SIMD_powf __DECL_SIMD_x86_64
3238  
3239 -/* Workaround to exclude unnecessary symbol aliases in libmvec
3240 -   while GCC creates the vector names based on scalar asm name.
3241 -   Corresponding discussion started at
3242 -   <https://gcc.gnu.org/ml/gcc/2015-06/msg00173.html>.  */
3243 -__asm__ ("_ZGVbN2v___log_finite = _ZGVbN2v_log");
3244 -__asm__ ("_ZGVcN4v___log_finite = _ZGVcN4v_log");
3245 -__asm__ ("_ZGVdN4v___log_finite = _ZGVdN4v_log");
3246 -__asm__ ("_ZGVeN8v___log_finite = _ZGVeN8v_log");
3247 -__asm__ ("_ZGVbN4v___logf_finite = _ZGVbN4v_logf");
3248 -__asm__ ("_ZGVcN8v___logf_finite = _ZGVcN8v_logf");
3249 -__asm__ ("_ZGVdN8v___logf_finite = _ZGVdN8v_logf");
3250 -__asm__ ("_ZGVeN16v___logf_finite = _ZGVeN16v_logf");
3251 -__asm__ ("_ZGVbN2v___exp_finite = _ZGVbN2v_exp");
3252 -__asm__ ("_ZGVcN4v___exp_finite = _ZGVcN4v_exp");
3253 -__asm__ ("_ZGVdN4v___exp_finite = _ZGVdN4v_exp");
3254 -__asm__ ("_ZGVeN8v___exp_finite = _ZGVeN8v_exp");
3255 -__asm__ ("_ZGVbN4v___expf_finite = _ZGVbN4v_expf");
3256 -__asm__ ("_ZGVcN8v___expf_finite = _ZGVcN8v_expf");
3257 -__asm__ ("_ZGVdN8v___expf_finite = _ZGVdN8v_expf");
3258 -__asm__ ("_ZGVeN16v___expf_finite = _ZGVeN16v_expf");
3259 -__asm__ ("_ZGVbN2vv___pow_finite = _ZGVbN2vv_pow");
3260 -__asm__ ("_ZGVcN4vv___pow_finite = _ZGVcN4vv_pow");
3261 -__asm__ ("_ZGVdN4vv___pow_finite = _ZGVdN4vv_pow");
3262 -__asm__ ("_ZGVeN8vv___pow_finite = _ZGVeN8vv_pow");
3263 -__asm__ ("_ZGVbN4vv___powf_finite = _ZGVbN4vv_powf");
3264 -__asm__ ("_ZGVcN8vv___powf_finite = _ZGVcN8vv_powf");
3265 -__asm__ ("_ZGVdN8vv___powf_finite = _ZGVdN8vv_powf");
3266 -__asm__ ("_ZGVeN16vv___powf_finite = _ZGVeN16vv_powf");
3267 -
3268  # endif
3269  #endif
3270 diff --git a/sysdeps/x86_64/fpu/Makefile b/sysdeps/x86_64/fpu/Makefile
3271 index 1ebe511..b32b852 100644
3272 --- a/sysdeps/x86_64/fpu/Makefile
3273 +++ b/sysdeps/x86_64/fpu/Makefile
3274 @@ -20,7 +20,10 @@ libmvec-support += svml_d_cos2_core svml_d_cos4_core_avx \
3275                    svml_d_pow_data svml_s_powf4_core svml_s_powf8_core_avx \
3276                    svml_s_powf8_core svml_s_powf16_core svml_s_powf_data \
3277                    svml_s_sincosf4_core svml_s_sincosf8_core_avx \
3278 -                  svml_s_sincosf8_core svml_s_sincosf16_core init-arch
3279 +                  svml_s_sincosf8_core svml_s_sincosf16_core init-arch \
3280 +                  svml_finite_alias
3281 +
3282 +libmvec-static-only-routines = svml_finite_alias
3283  endif
3284  
3285  # Variables for libmvec tests.
3286 diff --git a/sysdeps/x86_64/fpu/svml_finite_alias.S b/sysdeps/x86_64/fpu/svml_finite_alias.S
3287 new file mode 100644
3288 index 0000000..f8bcfeb
3289 --- /dev/null
3290 +++ b/sysdeps/x86_64/fpu/svml_finite_alias.S
3291 @@ -0,0 +1,59 @@
3292 +/* These aliases added as workaround to exclude unnecessary symbol
3293 +   aliases in libmvec.so while compiler creates the vector names
3294 +   based on scalar asm name.  Corresponding discussion is at
3295 +   <https://gcc.gnu.org/ml/gcc/2015-06/msg00173.html>.
3296 +   Copyright (C) 2015 Free Software Foundation, Inc.
3297 +   This file is part of the GNU C Library.
3298 +
3299 +   The GNU C Library is free software; you can redistribute it and/or
3300 +   modify it under the terms of the GNU Lesser General Public
3301 +   License as published by the Free Software Foundation; either
3302 +   version 2.1 of the License, or (at your option) any later version.
3303 +
3304 +   The GNU C Library is distributed in the hope that it will be useful,
3305 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
3306 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
3307 +   Lesser General Public License for more details.
3308 +
3309 +   You should have received a copy of the GNU Lesser General Public
3310 +   License along with the GNU C Library; if not, see
3311 +   <http://www.gnu.org/licenses/>.  */
3312 +
3313 +#include <sysdep.h>
3314 +
3315 +#define ALIAS_IMPL(alias, target) \
3316 +ENTRY (alias); \
3317 +       call target; \
3318 +       ret; \
3319 +END (alias)
3320 +
3321 +       .text
3322 +ALIAS_IMPL (_ZGVbN2v___log_finite, _ZGVbN2v_log)
3323 +ALIAS_IMPL (_ZGVcN4v___log_finite, _ZGVcN4v_log)
3324 +ALIAS_IMPL (_ZGVdN4v___log_finite, _ZGVdN4v_log)
3325 +ALIAS_IMPL (_ZGVeN8v___log_finite, _ZGVeN8v_log)
3326 +
3327 +ALIAS_IMPL (_ZGVbN4v___logf_finite, _ZGVbN4v_logf)
3328 +ALIAS_IMPL (_ZGVcN8v___logf_finite, _ZGVcN8v_logf)
3329 +ALIAS_IMPL (_ZGVdN8v___logf_finite, _ZGVdN8v_logf)
3330 +ALIAS_IMPL (_ZGVeN16v___logf_finite, _ZGVeN16v_logf)
3331 +
3332 +ALIAS_IMPL (_ZGVbN2v___exp_finite, _ZGVbN2v_exp)
3333 +ALIAS_IMPL (_ZGVcN4v___exp_finite, _ZGVcN4v_exp)
3334 +ALIAS_IMPL (_ZGVdN4v___exp_finite, _ZGVdN4v_exp)
3335 +ALIAS_IMPL (_ZGVeN8v___exp_finite, _ZGVeN8v_exp)
3336 +
3337 +ALIAS_IMPL (_ZGVbN4v___expf_finite, _ZGVbN4v_expf)
3338 +ALIAS_IMPL (_ZGVcN8v___expf_finite, _ZGVcN8v_expf)
3339 +ALIAS_IMPL (_ZGVdN8v___expf_finite, _ZGVdN8v_expf)
3340 +ALIAS_IMPL (_ZGVeN16v___expf_finite, _ZGVeN16v_expf)
3341 +
3342 +ALIAS_IMPL (_ZGVbN2vv___pow_finite, _ZGVbN2vv_pow)
3343 +ALIAS_IMPL (_ZGVcN4vv___pow_finite, _ZGVcN4vv_pow)
3344 +ALIAS_IMPL (_ZGVdN4vv___pow_finite, _ZGVdN4vv_pow)
3345 +ALIAS_IMPL (_ZGVeN8vv___pow_finite, _ZGVeN8vv_pow)
3346 +
3347 +ALIAS_IMPL (_ZGVbN4vv___powf_finite, _ZGVbN4vv_powf)
3348 +ALIAS_IMPL (_ZGVcN8vv___powf_finite, _ZGVcN8vv_powf)
3349 +ALIAS_IMPL (_ZGVdN8vv___powf_finite, _ZGVdN8vv_powf)
3350 +ALIAS_IMPL (_ZGVeN16vv___powf_finite, _ZGVeN16vv_powf)
3351 diff --git a/time/strftime_l.c b/time/strftime_l.c
3352 index b48ef34..4eb647c 100644
3353 --- a/time/strftime_l.c
3354 +++ b/time/strftime_l.c
3355 @@ -510,13 +510,17 @@ __strftime_internal (s, maxsize, format, tp, tzset_called ut_argument
3356       only a few elements.  Dereference the pointers only if the format
3357       requires this.  Then it is ok to fail if the pointers are invalid.  */
3358  # define a_wkday \
3359 -  ((const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(ABDAY_1) + tp->tm_wday))
3360 +  ((const CHAR_T *) (tp->tm_wday < 0 || tp->tm_wday > 6                             \
3361 +                    ? "?" : _NL_CURRENT (LC_TIME, NLW(ABDAY_1) + tp->tm_wday)))
3362  # define f_wkday \
3363 -  ((const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(DAY_1) + tp->tm_wday))
3364 +  ((const CHAR_T *) (tp->tm_wday < 0 || tp->tm_wday > 6                             \
3365 +                    ? "?" : _NL_CURRENT (LC_TIME, NLW(DAY_1) + tp->tm_wday)))
3366  # define a_month \
3367 -  ((const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(ABMON_1) + tp->tm_mon))
3368 +  ((const CHAR_T *) (tp->tm_mon < 0 || tp->tm_mon > 11                      \
3369 +                    ? "?" : _NL_CURRENT (LC_TIME, NLW(ABMON_1) + tp->tm_mon)))
3370  # define f_month \
3371 -  ((const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(MON_1) + tp->tm_mon))
3372 +  ((const CHAR_T *) (tp->tm_mon < 0 || tp->tm_mon > 11                      \
3373 +                    ? "?" : _NL_CURRENT (LC_TIME, NLW(MON_1) + tp->tm_mon)))
3374  # define ampm \
3375    ((const CHAR_T *) _NL_CURRENT (LC_TIME, tp->tm_hour > 11                   \
3376                                  ? NLW(PM_STR) : NLW(AM_STR)))
3377 @@ -526,8 +530,10 @@ __strftime_internal (s, maxsize, format, tp, tzset_called ut_argument
3378  # define ap_len STRLEN (ampm)
3379  #else
3380  # if !HAVE_STRFTIME
3381 -#  define f_wkday (weekday_name[tp->tm_wday])
3382 -#  define f_month (month_name[tp->tm_mon])
3383 +#  define f_wkday (tp->tm_wday < 0 || tp->tm_wday > 6  \
3384 +                  ? "?" : weekday_name[tp->tm_wday])
3385 +#  define f_month (tp->tm_mon < 0 || tp->tm_mon > 11   \
3386 +                  ? "?" : month_name[tp->tm_mon])
3387  #  define a_wkday f_wkday
3388  #  define a_month f_month
3389  #  define ampm (L_("AMPM") + 2 * (tp->tm_hour > 11))
3390 @@ -1321,7 +1327,7 @@ __strftime_internal (s, maxsize, format, tp, tzset_called ut_argument
3391                   *tzset_called = true;
3392                 }
3393  # endif
3394 -             zone = tzname[tp->tm_isdst];
3395 +             zone = tp->tm_isdst <= 1 ? tzname[tp->tm_isdst] : "?";
3396             }
3397  #endif
3398           if (! zone)
3399 diff --git a/time/tst-strftime.c b/time/tst-strftime.c
3400 index 374fba4..af3ff72 100644
3401 --- a/time/tst-strftime.c
3402 +++ b/time/tst-strftime.c
3403 @@ -4,6 +4,56 @@
3404  #include <time.h>
3405  
3406  
3407 +static int
3408 +do_bz18985 (void)
3409 +{
3410 +  char buf[1000];
3411 +  struct tm ttm;
3412 +  int rc, ret = 0;
3413 +
3414 +  memset (&ttm, 1, sizeof (ttm));
3415 +  ttm.tm_zone = NULL;  /* Dereferenced directly if non-NULL.  */
3416 +  rc = strftime (buf, sizeof (buf), "%a %A %b %B %c %z %Z", &ttm);
3417 +
3418 +  if (rc == 66)
3419 +    {
3420 +      const char expected[]
3421 +       = "? ? ? ? ? ? 16843009 16843009:16843009:16843009 16844909 +467836 ?";
3422 +      if (0 != strcmp (buf, expected))
3423 +       {
3424 +         printf ("expected:\n  %s\ngot:\n  %s\n", expected, buf);
3425 +         ret += 1;
3426 +       }
3427 +    }
3428 +  else
3429 +    {
3430 +      printf ("expected 66, got %d\n", rc);
3431 +      ret += 1;
3432 +    }
3433 +
3434 +  /* Check negative values as well.  */
3435 +  memset (&ttm, 0xFF, sizeof (ttm));
3436 +  ttm.tm_zone = NULL;  /* Dereferenced directly if non-NULL.  */
3437 +  rc = strftime (buf, sizeof (buf), "%a %A %b %B %c %z %Z", &ttm);
3438 +
3439 +  if (rc == 30)
3440 +    {
3441 +      const char expected[] = "? ? ? ? ? ? -1 -1:-1:-1 1899  ";
3442 +      if (0 != strcmp (buf, expected))
3443 +       {
3444 +         printf ("expected:\n  %s\ngot:\n  %s\n", expected, buf);
3445 +         ret += 1;
3446 +       }
3447 +    }
3448 +  else
3449 +    {
3450 +      printf ("expected 30, got %d\n", rc);
3451 +      ret += 1;
3452 +    }
3453 +
3454 +  return ret;
3455 +}
3456 +
3457  static struct
3458  {
3459    const char *fmt;
3460 @@ -104,7 +154,7 @@ do_test (void)
3461         }
3462      }
3463  
3464 -  return result;
3465 +  return result + do_bz18985 ();
3466  }
3467  
3468  #define TEST_FUNCTION do_test ()
3469 diff --git a/wcsmbs/wcscoll_l.c b/wcsmbs/wcscoll_l.c
3470 index 6d9384a..87f240d 100644
3471 --- a/wcsmbs/wcscoll_l.c
3472 +++ b/wcsmbs/wcscoll_l.c
3473 @@ -23,7 +23,6 @@
3474  #define STRING_TYPE wchar_t
3475  #define USTRING_TYPE wint_t
3476  #define STRCOLL __wcscoll_l
3477 -#define STRDIFF __wcsdiff
3478  #define STRCMP __wcscmp
3479  #define WEIGHT_H "../locale/weightwc.h"
3480  #define SUFFIX WC
This page took 0.568983 seconds and 4 git commands to generate.