]> git.pld-linux.org Git - packages/glibc.git/blob - glibc-git.patch
- rel 4; from upstream - getmntent memory corruption fix.
[packages/glibc.git] / glibc-git.patch
1 diff --git a/ChangeLog b/ChangeLog
2 index cb9124e..f3027b0 100644
3 --- a/ChangeLog
4 +++ b/ChangeLog
5 @@ -1,3 +1,69 @@
6 +2015-08-28  Mike Frysinger  <vapier@gentoo.org>
7 +
8 +       [BZ #18887]
9 +       * misc/Makefile (tests): Add tst-mntent-blank-corrupt and
10 +       tst-mntent-blank-passno.
11 +       * misc/mntent_r.c (__getmntent_r): Do not read past buffer[0].
12 +       * misc/tst-mntent-blank-corrupt.c: New test.
13 +       * misc/tst-mntent-blank-passno.c: New test ripped from ...
14 +       * misc/tst-mntent.c (do_test): ... here.
15 +
16 +2015-08-25  Roland McGrath  <roland@hack.frob.com>
17 +
18 +       * sysdeps/nacl/start.c (_start): Call __nacl_main instead of main
19 +       if the weak reference is not null.
20 +
21 +2015-08-19  Andrew Senkevich  <andrew.senkevich@intel.com>
22 +
23 +       [BZ #18796]
24 +       * scripts/test-installation.pl: Don't add -lmvec to build options
25 +       if libmvec wasn't built.
26 +       * NEWS: Mention this fix.
27 +
28 +2015-08-10  Maxim Ostapenko  <m.ostapenko@partner.samsung.com>
29 +
30 +       [BZ #18778]
31 +       * elf/Makefile (tests): Add Add tst-nodelete2.
32 +       (modules-names): Add tst-nodelete2mod.
33 +       (tst-nodelete2mod.so-no-z-defs): New.
34 +       ($(objpfx)tst-nodelete2): Likewise.
35 +       ($(objpfx)tst-nodelete2.out): Likewise.
36 +       (LDFLAGS-tst-nodelete2): Likewise.
37 +       * elf/dl-close.c (_dl_close_worker): Move DF_1_NODELETE clearing
38 +       out of loop through all loaded libraries.
39 +       * elf/tst-nodelete2.c: New file.
40 +       * elf/tst-nodelete2mod.c: Likewise.
41 +
42 +2015-08-10  Andreas Schwab  <schwab@suse.de>
43 +
44 +       [BZ #18781]
45 +       * sysdeps/unix/sysv/linux/openat.c (__OPENAT) [MORE_OFLAGS]: Add
46 +       MORE_OFLAGS to oflag.
47 +       * io/test-lfs.c (do_test): Test openat64.
48 +
49 +2015-08-08  John David Anglin  <danglin@gcc.gnu.org>
50 +
51 +       [BZ #18787]
52 +       * sysdeps/unix/sysv/linux/hppa/bits/atomic.h (_LWS_CLOBBER): Revise
53 +       clobber registers.
54 +       (atomic_compare_and_exchange_val_acq): Use register asms to assign
55 +       operand registers.  Use register %r20 for EAGAIN and EDEADLOCK checks.
56 +       Cast return to __typeof (oldval).
57 +
58 +2015-08-08  Mike Frysinger  <vapier@gentoo.org>
59 +
60 +       * sysdeps/unix/sysv/linux/microblaze/sysdep.h: Wrap the whole file
61 +       in _LINUX_MICROBLAZE_SYSDEP_H defines.  Include sysdeps/unix/sysdep.h
62 +       and delete sys/syscall.h include.
63 +
64 +2015-08-07  Mike Frysinger  <vapier@gentoo.org>
65 +
66 +       * sysdeps/hppa/dl-symaddr.c (_dl_symbol_address): Add rtld_hidden_def.
67 +
68 +2015-08-05  Zack Weinberg  <zackw@panix.com>
69 +
70 +       * misc/regexp.h: Update comments.
71 +
72  2015-08-05  Carlos O'Donell  <carlos@systemhalted.org>
73  
74         * version.h (RELEASE): Set to "stable".
75 diff --git a/NEWS b/NEWS
76 index 4c31de7..2cfe5c1 100644
77 --- a/NEWS
78 +++ b/NEWS
79 @@ -5,6 +5,12 @@ See the end for copying conditions.
80  Please send GNU C library bug reports via <http://sourceware.org/bugzilla/>
81  using `glibc' in the "product" field.
82  \f
83 +Version 2.22.1
84 +
85 +* The following bugs are resolved with this release:
86 +
87 +  18778, 18781, 18787, 18796, 18887.
88 +\f
89  Version 2.22
90  
91  * The following bugs are resolved with this release:
92 @@ -84,7 +90,7 @@ Version 2.22
93    release.  Use of this header will trigger a deprecation warning.
94    Application developers should update their code to use <regex.h> instead.
95  
96 -  This header was formerly part of SUSv2, but was deprecated in 1997 and
97 +  This header was formerly part of SUS, but was deprecated in 1994 and
98    removed from the standard in 2001.  Also, the glibc implementation
99    leaks memory.  See BZ#18681 for more details.
100  \f
101 diff --git a/elf/Makefile b/elf/Makefile
102 index 4ceeaf8..71a18a1 100644
103 --- a/elf/Makefile
104 +++ b/elf/Makefile
105 @@ -148,7 +148,8 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
106          tst-unique1 tst-unique2 $(if $(CXX),tst-unique3 tst-unique4 \
107          tst-nodelete) \
108          tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \
109 -        tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened
110 +        tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \
111 +        tst-nodelete2
112  #       reldep9
113  ifeq ($(build-hardcoded-path-in-tests),yes)
114  tests += tst-dlopen-aout
115 @@ -218,7 +219,7 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
116                 tst-initorder2d \
117                 tst-relsort1mod1 tst-relsort1mod2 tst-array2dep \
118                 tst-array5dep tst-null-argv-lib \
119 -               tst-tlsalign-lib tst-nodelete-opened-lib
120 +               tst-tlsalign-lib tst-nodelete-opened-lib tst-nodelete2mod
121  ifeq (yes,$(have-protected-data))
122  modules-names += tst-protected1moda tst-protected1modb
123  tests += tst-protected1a tst-protected1b
124 @@ -594,6 +595,7 @@ tst-auditmod9b.so-no-z-defs = yes
125  tst-nodelete-uniquemod.so-no-z-defs = yes
126  tst-nodelete-rtldmod.so-no-z-defs = yes
127  tst-nodelete-zmod.so-no-z-defs = yes
128 +tst-nodelete2mod.so-no-z-defs = yes
129  
130  ifeq ($(build-shared),yes)
131  # Build all the modules even when not actually running test programs.
132 @@ -1164,6 +1166,11 @@ $(objpfx)tst-nodelete.out: $(objpfx)tst-nodelete-uniquemod.so \
133  LDFLAGS-tst-nodelete = -rdynamic
134  LDFLAGS-tst-nodelete-zmod.so = -Wl,--enable-new-dtags,-z,nodelete
135  
136 +$(objpfx)tst-nodelete2: $(libdl)
137 +$(objpfx)tst-nodelete2.out: $(objpfx)tst-nodelete2mod.so
138 +
139 +LDFLAGS-tst-nodelete2 = -rdynamic
140 +
141  $(objpfx)tst-initorder-cmp.out: tst-initorder.exp $(objpfx)tst-initorder.out
142         cmp $^ > $@; \
143         $(evaluate-test)
144 diff --git a/elf/dl-close.c b/elf/dl-close.c
145 index 9105277..c897247 100644
146 --- a/elf/dl-close.c
147 +++ b/elf/dl-close.c
148 @@ -144,6 +144,14 @@ _dl_close_worker (struct link_map *map, bool force)
149    char done[nloaded];
150    struct link_map *maps[nloaded];
151  
152 +  /* Clear DF_1_NODELETE to force object deletion.  We don't need to touch
153 +     l_tls_dtor_count because forced object deletion only happens when an
154 +     error occurs during object load.  Destructor registration for TLS
155 +     non-POD objects should not have happened till then for this
156 +     object.  */
157 +  if (force)
158 +    map->l_flags_1 &= ~DF_1_NODELETE;
159 +
160    /* Run over the list and assign indexes to the link maps and enter
161       them into the MAPS array.  */
162    int idx = 0;
163 @@ -153,13 +161,6 @@ _dl_close_worker (struct link_map *map, bool force)
164        maps[idx] = l;
165        ++idx;
166  
167 -      /* Clear DF_1_NODELETE to force object deletion.  We don't need to touch
168 -        l_tls_dtor_count because forced object deletion only happens when an
169 -        error occurs during object load.  Destructor registration for TLS
170 -        non-POD objects should not have happened till then for this
171 -        object.  */
172 -      if (force)
173 -       l->l_flags_1 &= ~DF_1_NODELETE;
174      }
175    assert (idx == nloaded);
176  
177 diff --git a/elf/tst-nodelete2.c b/elf/tst-nodelete2.c
178 new file mode 100644
179 index 0000000..388e8af
180 --- /dev/null
181 +++ b/elf/tst-nodelete2.c
182 @@ -0,0 +1,37 @@
183 +#include "../dlfcn/dlfcn.h"
184 +#include <stdio.h>
185 +#include <stdlib.h>
186 +#include <gnu/lib-names.h>
187 +
188 +static int
189 +do_test (void)
190 +{
191 +  int result = 0;
192 +
193 +  printf ("\nOpening pthread library.\n");
194 +  void *pthread = dlopen (LIBPTHREAD_SO, RTLD_LAZY);
195 +
196 +  /* This is a test for correct DF_1_NODELETE clearing when dlopen failure
197 +     happens.  We should clear DF_1_NODELETE for failed library only, because
198 +     doing this for others (e.g. libpthread) might cause them to be unloaded,
199 +     that may lead to some global references (e.g. __rtld_lock_unlock) to be
200 +     broken.  The dlopen should fail because of undefined symbols in shared
201 +     library, that cause DF_1_NODELETE to be cleared.  For libpthread, this
202 +     flag should be set, because if not, SIGSEGV will happen in dlclose.  */
203 +  if (dlopen ("tst-nodelete2mod.so", RTLD_NOW) != NULL)
204 +    {
205 +      printf ("Unique symbols test failed\n");
206 +      result = 1;
207 +    }
208 +
209 +  if (pthread)
210 +    dlclose (pthread);
211 +
212 +  if (result == 0)
213 +    printf ("SUCCESS\n");
214 +
215 +  return result;
216 +}
217 +
218 +#define TEST_FUNCTION do_test ()
219 +#include "../test-skeleton.c"
220 diff --git a/elf/tst-nodelete2mod.c b/elf/tst-nodelete2mod.c
221 new file mode 100644
222 index 0000000..e88c756
223 --- /dev/null
224 +++ b/elf/tst-nodelete2mod.c
225 @@ -0,0 +1,7 @@
226 +/* Undefined symbol.  */
227 +extern int not_exist (void);
228 +
229 +int foo (void)
230 +{
231 +  return not_exist ();
232 +}
233 diff --git a/elf/tst-znodelete-zlib.cc b/elf/tst-znodelete-zlib.cc
234 deleted file mode 100644
235 index 1e8f368..0000000
236 --- a/elf/tst-znodelete-zlib.cc
237 +++ /dev/null
238 @@ -1,6 +0,0 @@
239 -extern int not_exist (void);
240 -
241 -int foo (void)
242 -{
243 -  return  not_exist ();
244 -}
245 diff --git a/io/test-lfs.c b/io/test-lfs.c
246 index 539c2a2..b6ebae4 100644
247 --- a/io/test-lfs.c
248 +++ b/io/test-lfs.c
249 @@ -144,7 +144,7 @@ test_ftello (void)
250  int
251  do_test (int argc, char *argv[])
252  {
253 -  int ret;
254 +  int ret, fd2;
255    struct stat64 statbuf;
256  
257    ret = lseek64 (fd, TWO_GB+100, SEEK_SET);
258 @@ -195,6 +195,25 @@ do_test (int argc, char *argv[])
259      error (EXIT_FAILURE, 0, "stat reported size %lld instead of %lld.",
260            (long long int) statbuf.st_size, (TWO_GB + 100 + 5));
261  
262 +  fd2 = openat64 (AT_FDCWD, name, O_RDWR);
263 +  if (fd2 == -1)
264 +    {
265 +      if (errno == ENOSYS)
266 +       {
267 +         /* Silently ignore this test.  */
268 +         error (0, 0, "openat64 is not supported");
269 +       }
270 +      else
271 +       error (EXIT_FAILURE, errno, "openat64 failed to open big file");
272 +    }
273 +  else
274 +    {
275 +      ret = close (fd2);
276 +
277 +      if (ret == -1)
278 +       error (EXIT_FAILURE, errno, "error closing file");
279 +    }
280 +
281    test_ftello ();
282  
283    return 0;
284 diff --git a/misc/Makefile b/misc/Makefile
285 index aecb0da..2f5edf6 100644
286 --- a/misc/Makefile
287 +++ b/misc/Makefile
288 @@ -76,7 +76,8 @@ install-lib := libg.a
289  gpl2lgpl := error.c error.h
290  
291  tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \
292 -        tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1
293 +        tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1 \
294 +        tst-mntent-blank-corrupt tst-mntent-blank-passno
295  ifeq ($(run-built-tests),yes)
296  tests-special += $(objpfx)tst-error1-mem.out
297  endif
298 diff --git a/misc/mntent_r.c b/misc/mntent_r.c
299 index 6159873..4f26998 100644
300 --- a/misc/mntent_r.c
301 +++ b/misc/mntent_r.c
302 @@ -136,7 +136,9 @@ __getmntent_r (FILE *stream, struct mntent *mp, char *buffer, int bufsiz)
303        end_ptr = strchr (buffer, '\n');
304        if (end_ptr != NULL)     /* chop newline */
305         {
306 -         while (end_ptr[-1] == ' ' || end_ptr[-1] == '\t')
307 +         /* Do not walk past the start of buffer if it's all whitespace.  */
308 +         while (end_ptr != buffer
309 +                && (end_ptr[-1] == ' ' || end_ptr[-1] == '\t'))
310              end_ptr--;
311           *end_ptr = '\0';
312         }
313 diff --git a/misc/regexp.h b/misc/regexp.h
314 index 3460989..42394f7 100644
315 --- a/misc/regexp.h
316 +++ b/misc/regexp.h
317 @@ -19,10 +19,11 @@
318  #ifndef _REGEXP_H
319  #define _REGEXP_H      1
320  
321 -/* The contents of this header file were standardized in the
322 -   Single Unix Specification, Version 2 (1997) but marked as
323 -   LEGACY; new applications were already being encouraged to
324 -   use <regex.h> instead.  POSIX.1-2001 removed this header.
325 +/* The contents of this header file were originally standardized in
326 +   the Single Unix Specification, Issue 3 (1992).  In Issue 4 (1994)
327 +   the header was marked as TO BE WITHDRAWN, and new applications
328 +   were encouraged to use <regex.h> instead.  It was officially
329 +   withdrawn from the standard in Issue 6 (aka POSIX.1-2001).
330  
331     This header is provided only for backward compatibility.
332     It will be removed in the next release of the GNU C Library.
333 diff --git a/misc/tst-mntent-blank-corrupt.c b/misc/tst-mntent-blank-corrupt.c
334 new file mode 100644
335 index 0000000..92266a3
336 --- /dev/null
337 +++ b/misc/tst-mntent-blank-corrupt.c
338 @@ -0,0 +1,45 @@
339 +/* Make sure blank lines does not cause memory corruption BZ #18887.
340 +
341 +   Copyright (C) 2009-2015 Free Software Foundation, Inc.
342 +   This file is part of the GNU C Library.
343 +
344 +   The GNU C Library is free software; you can redistribute it and/or
345 +   modify it under the terms of the GNU Lesser General Public
346 +   License as published by the Free Software Foundation; either
347 +   version 2.1 of the License, or (at your option) any later version.
348 +
349 +   The GNU C Library is distributed in the hope that it will be useful,
350 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
351 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
352 +   Lesser General Public License for more details.
353 +
354 +   You should have received a copy of the GNU Lesser General Public
355 +   License along with the GNU C Library; if not, see
356 +   <http://www.gnu.org/licenses/>.  */
357 +
358 +#include <mntent.h>
359 +#include <stdio.h>
360 +#include <string.h>
361 +
362 +/* Make sure blank lines don't trigger memory corruption.  This doesn't happen
363 +   for all targets though, so it's a best effort test BZ #18887.  */
364 +static int
365 +do_test (void)
366 +{
367 +  FILE *fp;
368 +
369 +  fp = tmpfile ();
370 +  fputs ("\n \n/foo\\040dir /bar\\040dir auto bind \t \n", fp);
371 +  rewind (fp);
372 +
373 +  /* The corruption happens here ...  */
374 +  getmntent (fp);
375 +  /* ... but trigers here.  */
376 +  endmntent (fp);
377 +
378 +  /* If the test failed, we would crash, and not hit this point.  */
379 +  return 0;
380 +}
381 +
382 +#define TEST_FUNCTION do_test ()
383 +#include "../test-skeleton.c"
384 diff --git a/misc/tst-mntent-blank-passno.c b/misc/tst-mntent-blank-passno.c
385 new file mode 100644
386 index 0000000..fc04291
387 --- /dev/null
388 +++ b/misc/tst-mntent-blank-passno.c
389 @@ -0,0 +1,53 @@
390 +/* Make sure trailing whitespace is handled properly BZ #17273.
391 +
392 +   Copyright (C) 2009-2015 Free Software Foundation, Inc.
393 +   This file is part of the GNU C Library.
394 +
395 +   The GNU C Library is free software; you can redistribute it and/or
396 +   modify it under the terms of the GNU Lesser General Public
397 +   License as published by the Free Software Foundation; either
398 +   version 2.1 of the License, or (at your option) any later version.
399 +
400 +   The GNU C Library is distributed in the hope that it will be useful,
401 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
402 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
403 +   Lesser General Public License for more details.
404 +
405 +   You should have received a copy of the GNU Lesser General Public
406 +   License along with the GNU C Library; if not, see
407 +   <http://www.gnu.org/licenses/>.  */
408 +
409 +#include <mntent.h>
410 +#include <stdio.h>
411 +#include <string.h>
412 +
413 +/* Check entries to make sure trailing whitespace is ignored and we return the
414 +   correct passno value BZ #17273.  */
415 +static int
416 +do_test (void)
417 +{
418 +  int result = 0;
419 +  FILE *fp;
420 +  struct mntent *mnt;
421 +
422 +  fp = tmpfile ();
423 +  fputs ("/foo\\040dir /bar\\040dir auto bind \t \n", fp);
424 +  rewind (fp);
425 +
426 +  mnt = getmntent (fp);
427 +  if (strcmp (mnt->mnt_fsname, "/foo dir") != 0
428 +      || strcmp (mnt->mnt_dir, "/bar dir") != 0
429 +      || strcmp (mnt->mnt_type, "auto") != 0
430 +      || strcmp (mnt->mnt_opts, "bind") != 0
431 +      || mnt->mnt_freq != 0
432 +      || mnt->mnt_passno != 0)
433 +    {
434 +      puts ("Error while reading entry with trailing whitespaces");
435 +      result = 1;
436 +    }
437 +
438 +  return result;
439 +}
440 +
441 +#define TEST_FUNCTION do_test ()
442 +#include "../test-skeleton.c"
443 diff --git a/misc/tst-mntent.c b/misc/tst-mntent.c
444 index 876c89f..820b354 100644
445 --- a/misc/tst-mntent.c
446 +++ b/misc/tst-mntent.c
447 @@ -73,26 +73,6 @@ main (int argc, char *argv[])
448           puts ("Error while reading written entry back in");
449           result = 1;
450         }
451 -
452 -      /* Part III: Entry with whitespaces at the end of a line. */
453 -      rewind (fp);
454 -
455 -      fputs ("/foo\\040dir /bar\\040dir auto bind \t \n", fp);
456 -
457 -      rewind (fp);
458 -
459 -      mnt = getmntent (fp);
460 -
461 -      if (strcmp (mnt->mnt_fsname, "/foo dir") != 0
462 -         || strcmp (mnt->mnt_dir, "/bar dir") != 0
463 -         || strcmp (mnt->mnt_type, "auto") != 0
464 -         || strcmp (mnt->mnt_opts, "bind") != 0
465 -         || mnt->mnt_freq != 0
466 -         || mnt->mnt_passno != 0)
467 -       {
468 -         puts ("Error while reading entry with trailing whitespaces");
469 -         result = 1;
470 -       }
471     }
472  
473    return result;
474 diff --git a/scripts/test-installation.pl b/scripts/test-installation.pl
475 index cac1562..79b2b3e 100755
476 --- a/scripts/test-installation.pl
477 +++ b/scripts/test-installation.pl
478 @@ -80,16 +80,25 @@ arglist: while (@ARGV) {
479  # We expect none or one argument.
480  if ($#ARGV == -1) {
481      $soversions="soversions.mk";
482 +    $config="config.make";
483  } elsif ($#ARGV == 0) {
484      if (-d $ARGV[0]) {
485        $soversions = "$ARGV[0]/soversions.mk";
486 +      $config = "$ARGV[0]/config.make";
487      } else {
488 -      $soversions = $ARGV[0];
489 +      $soversions = $dir = $ARGV[0];
490 +      $dir =~ s!/?[^/]*/*$!!;
491 +      $config = $dir . "/config.make";
492      }
493  } else {
494      die "Wrong number of arguments.";
495  }
496  
497 +if (system ("grep -q \"build-mathvec = yes\" $config") == 0) {
498 +    $build_mathvec = 1;
499 +} else {
500 +    $build_mathvec = 0;
501 +}
502  
503  # Read names and versions of all shared libraries that are part of
504  # glibc
505 @@ -111,6 +120,8 @@ while (<SOVERSIONS>) {
506      # - libthread_db since it contains unresolved references
507      # - it's just a test NSS module
508      # - We don't provide the libgcc so we don't test it
509 +    # - libmvec if it wasn't built
510 +    next if ($build_mathvec == 0 && $name eq "mvec");
511      if ($name ne "nss_ldap" && $name ne "db1"
512         && !($name =~/^nss1_/) && $name ne "thread_db"
513         && $name ne "nss_test1" && $name ne "libgcc_s") {
514 diff --git a/sysdeps/hppa/dl-symaddr.c b/sysdeps/hppa/dl-symaddr.c
515 index b707c19..89d8baf 100644
516 --- a/sysdeps/hppa/dl-symaddr.c
517 +++ b/sysdeps/hppa/dl-symaddr.c
518 @@ -33,3 +33,4 @@ _dl_symbol_address (struct link_map *map, const ElfW(Sym) *ref)
519    else
520      return (void *) value;
521  }
522 +rtld_hidden_def (_dl_symbol_address)
523 diff --git a/sysdeps/nacl/start.c b/sysdeps/nacl/start.c
524 index a4b6dd3..8e8bc1a 100644
525 --- a/sysdeps/nacl/start.c
526 +++ b/sysdeps/nacl/start.c
527 @@ -44,6 +44,10 @@
528  /* The application defines this, of course.  */
529  extern int main (int argc, char **argv, char **envp);
530  
531 +/* But maybe it defines this too, in which case it takes precedence.  */
532 +extern int __nacl_main (int argc, char **argv, char **envp)
533 +  __attribute__ ((weak));
534 +
535  /* These are defined in libc.  */
536  extern int __libc_csu_init (int argc, char **argv, char **envp);
537  extern void __libc_csu_fini (void);
538 @@ -59,7 +63,7 @@ _start (uint32_t info[])
539  {
540    /* The generic code actually assumes that envp follows argv.  */
541  
542 -  __libc_start_main (&main,
543 +  __libc_start_main (&__nacl_main ?: &main,
544                      nacl_startup_argc (info),
545                      nacl_startup_argv (info),
546                      nacl_startup_auxv (info),
547 diff --git a/sysdeps/unix/sysv/linux/hppa/bits/atomic.h b/sysdeps/unix/sysv/linux/hppa/bits/atomic.h
548 index abde83e..6e73504 100644
549 --- a/sysdeps/unix/sysv/linux/hppa/bits/atomic.h
550 +++ b/sysdeps/unix/sysv/linux/hppa/bits/atomic.h
551 @@ -56,42 +56,41 @@ typedef uintmax_t uatomic_max_t;
552  #define _LWS "0xb0"
553  #define _LWS_CAS "0"
554  /* Note r31 is the link register.  */
555 -#define _LWS_CLOBBER "r1", "r26", "r25", "r24", "r23", "r22", "r21", "r20", "r28", "r31", "memory"
556 +#define _LWS_CLOBBER "r1", "r23", "r22", "r20", "r31", "memory"
557  /* String constant for -EAGAIN.  */
558  #define _ASM_EAGAIN "-11"
559  /* String constant for -EDEADLOCK.  */
560  #define _ASM_EDEADLOCK "-45"
561  
562  #if __ASSUME_LWS_CAS
563 -/* The only basic operation needed is compare and exchange.  */
564 +/* The only basic operation needed is compare and exchange.  The mem
565 +   pointer must be word aligned.  */
566  # define atomic_compare_and_exchange_val_acq(mem, newval, oldval)      \
567    ({                                                                   \
568 -     volatile int lws_errno;                                           \
569 -     __typeof__ (*mem) lws_ret;                                                \
570 -     asm volatile(                                                     \
571 +     register long lws_errno asm("r21");                               \
572 +     register unsigned long lws_ret asm("r28");                                \
573 +     register unsigned long lws_mem asm("r26") = (unsigned long)(mem); \
574 +     register unsigned long lws_old asm("r25") = (unsigned long)(oldval);\
575 +     register unsigned long lws_new asm("r24") = (unsigned long)(newval);\
576 +     __asm__ __volatile__(                                             \
577         "0:                                     \n\t"                   \
578 -       "copy   %2, %%r26                       \n\t"                   \
579 -       "copy   %3, %%r25                       \n\t"                   \
580 -       "copy   %4, %%r24                       \n\t"                   \
581         "ble    " _LWS "(%%sr2, %%r0)           \n\t"                   \
582         "ldi    " _LWS_CAS ", %%r20             \n\t"                   \
583 -       "ldi    " _ASM_EAGAIN ", %%r24          \n\t"                   \
584 -       "cmpb,=,n %%r24, %%r21, 0b              \n\t"                   \
585 +       "ldi    " _ASM_EAGAIN ", %%r20          \n\t"                   \
586 +       "cmpb,=,n %%r20, %%r21, 0b              \n\t"                   \
587         "nop                                    \n\t"                   \
588 -       "ldi    " _ASM_EDEADLOCK ", %%r25       \n\t"                   \
589 -       "cmpb,=,n %%r25, %%r21, 0b              \n\t"                   \
590 +       "ldi    " _ASM_EDEADLOCK ", %%r20       \n\t"                   \
591 +       "cmpb,=,n %%r20, %%r21, 0b              \n\t"                   \
592         "nop                                    \n\t"                   \
593 -       "stw    %%r28, %0                       \n\t"                   \
594 -       "stw    %%r21, %1                       \n\t"                   \
595 -       : "=m" (lws_ret), "=m" (lws_errno)                              \
596 -        : "r" (mem), "r" (oldval), "r" (newval)                                \
597 +       : "=r" (lws_ret), "=r" (lws_errno)                              \
598 +       : "r" (lws_mem), "r" (lws_old), "r" (lws_new)                   \
599         : _LWS_CLOBBER                                                  \
600       );                                                                        \
601                                                                         \
602 -     if(lws_errno == -EFAULT || lws_errno == -ENOSYS)                  \
603 +     if (lws_errno == -EFAULT || lws_errno == -ENOSYS)                 \
604         ABORT_INSTRUCTION;                                              \
605                                                                         \
606 -     lws_ret;                                                          \
607 +     (__typeof (oldval)) lws_ret;                                      \
608     })
609  
610  # define atomic_compare_and_exchange_bool_acq(mem, newval, oldval)     \
611 diff --git a/sysdeps/unix/sysv/linux/microblaze/sysdep.h b/sysdeps/unix/sysv/linux/microblaze/sysdep.h
612 index 83c0340..9d5c542 100644
613 --- a/sysdeps/unix/sysv/linux/microblaze/sysdep.h
614 +++ b/sysdeps/unix/sysv/linux/microblaze/sysdep.h
615 @@ -16,8 +16,11 @@
616     License along with the GNU C Library; if not, see
617     <http://www.gnu.org/licenses/>.  */
618  
619 +#ifndef _LINUX_MICROBLAZE_SYSDEP_H
620 +#define _LINUX_MICROBLAZE_SYSDEP_H 1
621 +
622 +#include <sysdeps/unix/sysdep.h>
623  #include <sysdeps/microblaze/sysdep.h>
624 -#include <sys/syscall.h>
625  
626  /* Defines RTLD_PRIVATE_ERRNO.  */
627  #include <dl-sysdep.h>
628 @@ -305,3 +308,5 @@ SYSCALL_ERROR_LABEL_DCL:                            \
629  # define PTR_DEMANGLE(var) (void) (var)
630  
631  #endif /* not __ASSEMBLER__ */
632 +
633 +#endif /* _LINUX_MICROBLAZE_SYSDEP_H */
634 diff --git a/sysdeps/unix/sysv/linux/openat.c b/sysdeps/unix/sysv/linux/openat.c
635 index 6777123..ad8e31d 100644
636 --- a/sysdeps/unix/sysv/linux/openat.c
637 +++ b/sysdeps/unix/sysv/linux/openat.c
638 @@ -68,6 +68,11 @@ __OPENAT (int fd, const char *file, int oflag, ...)
639        va_end (arg);
640      }
641  
642 +  /* We have to add the O_LARGEFILE flag for openat64.  */
643 +#ifdef MORE_OFLAGS
644 +  oflag |= MORE_OFLAGS;
645 +#endif
646 +
647    return SYSCALL_CANCEL (openat, fd, file, oflag, mode);
648  }
649  libc_hidden_def (__OPENAT)
This page took 0.077525 seconds and 4 git commands to generate.