diff options
author | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2009-03-18 12:35:05 +0000 |
---|---|---|
committer | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2009-03-18 12:35:05 +0000 |
commit | 636dc71c0c0c0300fbe44498b2fc903140edc010 (patch) | |
tree | 1d2f6bdeffe4f6c25e0f4675010290bd860b8855 /libc | |
parent | 780a701d63b25431f31d77f0701f98bfe5ea2d94 (diff) |
Merge changes between r8107 and r8126 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@8127 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc')
31 files changed, 437 insertions, 250 deletions
diff --git a/libc/ChangeLog b/libc/ChangeLog index 83c355e8a..7c6bae16b 100644 --- a/libc/ChangeLog +++ b/libc/ChangeLog @@ -1,3 +1,64 @@ +2009-03-16 Ulrich Drepper <drepper@redhat.com> + + * include/dirent.h: Yet more changes to match sort function type + change. + * sysdeps/unix/sysv/linux/i386/alphasort64.c: Likewise. + * sysdeps/unix/sysv/linux/i386/olddirent.h: Likewise. + * sysdeps/unix/sysv/linux/i386/versionsort64.c: Likewise. + +2009-03-16 Thomas Schwinge <tschwinge@gnu.org> + + * dirent/scandir64.c (scandir64): Adjust declaration to type change. + +2009-03-16 Ulrich Drepper <drepper@redhat.com> + + * nscd/connections.c (restart): Try to preserve the process name + by reading the /proc/self/exe symlink and using the return name. + Patch by Jeff Bastian <jbastian@redhat.com>. + +2009-03-15 Ulrich Drepper <drepper@redhat.com> + + [BZ #9733] + * elf/dl-load.c (_dl_map_object_from_fd): Only call audit hooks + if we are not loading a new audit library. + * elf/dl-reloc (_dl_relocate_object): Third parameter is now a bitmask. + Only use profiling trampoline for auditing if we are not relocating + an audit library. + * elf/dl-open.c (dl_open_worker): Adjust _dl_relocate_object call. + * elf/rtld.c: Likewise. + * sysdeps/generic/ldsodefs.h: Adjust _dl_relocate_object prototype. + + * elf/rtld.c (dl_main): Extend help message for --audit option. + + [BZ #9759] + * dirent/dirent.h: Adjust prototypes of scandir, scandir64, alphasort, + alphasort64, versionsort, and versionsort64 to POSIX 2008. + * dirent/alphasort.c: Adjust implementation to type change. + * dirent/alphasort64.c: Likewise. + * dirent/scandir.c: Likewise. + * dirent/versionsort.c: Likewise. + * dirent/versionsort64.c: Likewise. + * sysdeps/wordsize-64/alphasort.c: Add hack to hide alphasort64 + declaration. + * sysdeps/wordsize-64/versionsort.c: Add hack to hide versionsort64 + declaration. + + [BZ #9880] + * inet/inet6_rth.c (inet6_rth_reverse): Compute number of segments + correctly. Set segleft member in output as required. + Patch partly by Yang Hongyang <yanghy@cn.fujitsu.com>. + * inet/tst-inet6_rth.c (do_test): Add tests for inet6_rth_reverse. + + [BZ #9881] + * inet/inet6_rth.c (inet6_rth_add): Add some error checking. + Patch mostly by Yang Hongyang <yanghy@cn.fujitsu.com>. + * inet/Makefile (tests): Add tst-inet6_rth. + * inet/tst-inet6_rth.c: New file. + + [BZ #5807] + * string/strlen.c (strlen): Fix omission in the expression to test + for NUL bytes. + 2009-03-14 Ulrich Drepper <drepper@redhat.com> * crypt/sha256test.c (main): Perform 100,000 'a' test in a second way. @@ -16,7 +77,7 @@ [BZ #9893] * sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Fix - alignement of La_x86_64_regs. Store xmm parameters. + alignment of La_x86_64_regs. Store xmm parameters. Patch mostly by Jiri Olsa <olsajiri@gmail.com>. [BZ #9913] diff --git a/libc/dirent/alphasort.c b/libc/dirent/alphasort.c index b378626f6..360b17c5a 100644 --- a/libc/dirent/alphasort.c +++ b/libc/dirent/alphasort.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1997, 1998, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,8 +20,7 @@ #include <string.h> int -alphasort (const void *a, const void *b) +alphasort (const struct dirent **a, const struct dirent **b) { - return strcoll ((*(const struct dirent **) a)->d_name, - (*(const struct dirent **) b)->d_name); + return strcoll ((*a)->d_name, (*b)->d_name); } diff --git a/libc/dirent/alphasort64.c b/libc/dirent/alphasort64.c index fe84aec2f..f91cba508 100644 --- a/libc/dirent/alphasort64.c +++ b/libc/dirent/alphasort64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1997, 1998, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1997, 1998, 2000, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,8 +20,7 @@ #include <string.h> int -alphasort64 (const void *a, const void *b) +alphasort64 (const struct dirent64 **a, const struct dirent64 **b) { - return strcoll ((*(const struct dirent64 **) a)->d_name, - (*(const struct dirent64 **) b)->d_name); + return strcoll ((*a)->d_name, (*b)->d_name); } diff --git a/libc/dirent/dirent.h b/libc/dirent/dirent.h index cb6d0bc2d..369ccdc9e 100644 --- a/libc/dirent/dirent.h +++ b/libc/dirent/dirent.h @@ -252,7 +252,8 @@ extern int dirfd (DIR *__dirp) __THROW __nonnull ((1)); extern int scandir (__const char *__restrict __dir, struct dirent ***__restrict __namelist, int (*__selector) (__const struct dirent *), - int (*__cmp) (__const void *, __const void *)) + int (*__cmp) (__const struct dirent **, + __const struct dirent **)) __nonnull ((1, 2)); # else # ifdef __REDIRECT @@ -260,7 +261,8 @@ extern int __REDIRECT (scandir, (__const char *__restrict __dir, struct dirent ***__restrict __namelist, int (*__selector) (__const struct dirent *), - int (*__cmp) (__const void *, __const void *)), + int (*__cmp) (__const struct dirent **, + __const struct dirent **)), scandir64) __nonnull ((1, 2)); # else # define scandir scandir64 @@ -273,18 +275,21 @@ extern int __REDIRECT (scandir, extern int scandir64 (__const char *__restrict __dir, struct dirent64 ***__restrict __namelist, int (*__selector) (__const struct dirent64 *), - int (*__cmp) (__const void *, __const void *)) + int (*__cmp) (__const struct dirent64 **, + __const struct dirent64 **)) __nonnull ((1, 2)); # endif /* Function to compare two `struct dirent's alphabetically. */ # ifndef __USE_FILE_OFFSET64 -extern int alphasort (__const void *__e1, __const void *__e2) +extern int alphasort (__const struct dirent **__e1, + __const struct dirent **__e2) __THROW __attribute_pure__ __nonnull ((1, 2)); # else # ifdef __REDIRECT extern int __REDIRECT_NTH (alphasort, - (__const void *__e1, __const void *__e2), + (__const struct dirent **__e1, + __const struct dirent **__e2), alphasort64) __attribute_pure__ __nonnull ((1, 2)); # else # define alphasort alphasort64 @@ -292,51 +297,54 @@ extern int __REDIRECT_NTH (alphasort, # endif # if defined __USE_GNU && defined __USE_LARGEFILE64 -extern int alphasort64 (__const void *__e1, __const void *__e2) +extern int alphasort64 (__const struct dirent64 **__e1, + __const struct dirent64 **__e2) __THROW __attribute_pure__ __nonnull ((1, 2)); # endif +#endif /* Use BSD or misc or XPG7. */ -# if defined __USE_BSD || defined __USE_MISC +#if defined __USE_BSD || defined __USE_MISC /* Read directory entries from FD into BUF, reading at most NBYTES. Reading starts at offset *BASEP, and *BASEP is updated with the new position after reading. Returns the number of bytes read; zero when at end of directory; or -1 for errors. */ -# ifndef __USE_FILE_OFFSET64 +# ifndef __USE_FILE_OFFSET64 extern __ssize_t getdirentries (int __fd, char *__restrict __buf, size_t __nbytes, __off_t *__restrict __basep) __THROW __nonnull ((2, 4)); -# else -# ifdef __REDIRECT +# else +# ifdef __REDIRECT extern __ssize_t __REDIRECT_NTH (getdirentries, (int __fd, char *__restrict __buf, size_t __nbytes, __off64_t *__restrict __basep), getdirentries64) __nonnull ((2, 4)); -# else -# define getdirentries getdirentries64 -# endif +# else +# define getdirentries getdirentries64 # endif +# endif -# ifdef __USE_LARGEFILE64 +# ifdef __USE_LARGEFILE64 extern __ssize_t getdirentries64 (int __fd, char *__restrict __buf, size_t __nbytes, __off64_t *__restrict __basep) __THROW __nonnull ((2, 4)); -# endif -# endif /* Use BSD or misc. */ -#endif /* Use BSD or misc or XPG7. */ +# endif +#endif /* Use BSD or misc. */ #ifdef __USE_GNU /* Function to compare two `struct dirent's by name & version. */ # ifndef __USE_FILE_OFFSET64 -extern int versionsort (__const void *__e1, __const void *__e2) +extern int versionsort (__const struct dirent **__e1, + __const struct dirent **__e2) __THROW __attribute_pure__ __nonnull ((1, 2)); # else # ifdef __REDIRECT extern int __REDIRECT_NTH (versionsort, - (__const void *__e1, __const void *__e2), + (__const struct dirent **__e1, + __const struct dirent **__e2), versionsort64) __attribute_pure__ __nonnull ((1, 2)); # else @@ -345,7 +353,8 @@ extern int __REDIRECT_NTH (versionsort, # endif # ifdef __USE_LARGEFILE64 -extern int versionsort64 (__const void *__e1, __const void *__e2) +extern int versionsort64 (__const struct dirent64 **__e1, + __const struct dirent64 **__e2) __THROW __attribute_pure__ __nonnull ((1, 2)); # endif #endif /* Use GNU. */ diff --git a/libc/dirent/scandir.c b/libc/dirent/scandir.c index 89bd9e94f..2e03578a3 100644 --- a/libc/dirent/scandir.c +++ b/libc/dirent/scandir.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-1998, 2000, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1992-1998,2000,2002,2003,2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -57,7 +57,7 @@ SCANDIR (dir, namelist, select, cmp) const char *dir; DIRENT_TYPE ***namelist; int (*select) (const DIRENT_TYPE *); - int (*cmp) (const void *, const void *); + int (*cmp) (const DIRENT_TYPE **, const DIRENT_TYPE **); { DIR *dp = __opendir (dir); DIRENT_TYPE **v = NULL; @@ -134,7 +134,8 @@ SCANDIR (dir, namelist, select, cmp) { /* Sort the list if we have a comparison function to sort with. */ if (cmp != NULL) - qsort (v, c.cnt, sizeof (*v), cmp); + qsort (v, c.cnt, sizeof (*v), + (int (*) (const void *, const void *)) cmp); *namelist = v; } diff --git a/libc/dirent/scandir64.c b/libc/dirent/scandir64.c index 68608de9a..b7bd65465 100644 --- a/libc/dirent/scandir64.c +++ b/libc/dirent/scandir64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -25,6 +25,7 @@ int scandir64 (__const char *__restrict __dir, struct dirent64 ***__restrict __namelist, int (*__selector) (__const struct dirent64 *), - int (*__cmp) (__const void *, __const void *)); + int (*__cmp) (__const struct dirent64 **, + __const struct dirent64 **)); #include <dirent/scandir.c> diff --git a/libc/dirent/versionsort.c b/libc/dirent/versionsort.c index d986981bc..f7bd71784 100644 --- a/libc/dirent/versionsort.c +++ b/libc/dirent/versionsort.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1997, 1998, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,8 +20,7 @@ #include <string.h> int -versionsort (const void *a, const void *b) +versionsort (const struct dirent **a, const struct dirent **b) { - return __strverscmp ((*(const struct dirent **) a)->d_name, - (*(const struct dirent **) b)->d_name); + return __strverscmp ((*a)->d_name, (*b)->d_name); } diff --git a/libc/dirent/versionsort64.c b/libc/dirent/versionsort64.c index e47182702..5b2833111 100644 --- a/libc/dirent/versionsort64.c +++ b/libc/dirent/versionsort64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1997, 1998, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1997, 1998, 2000, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,8 +20,7 @@ #include <string.h> int -versionsort64 (const void *a, const void *b) +versionsort64 (const struct dirent64 **a, const struct dirent64 **b) { - return __strverscmp ((*(const struct dirent64 **) a)->d_name, - (*(const struct dirent64 **) b)->d_name); + return __strverscmp ((*a)->d_name, (*b)->d_name); } diff --git a/libc/elf/dl-load.c b/libc/elf/dl-load.c index c77c25915..0deb51e44 100644 --- a/libc/elf/dl-load.c +++ b/libc/elf/dl-load.c @@ -941,7 +941,8 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp, { #ifdef SHARED /* Auditing checkpoint: we are going to add new objects. */ - if (__builtin_expect (GLRO(dl_naudit) > 0, 0)) + if ((mode & __RTLD_AUDIT) == 0 + && __builtin_expect (GLRO(dl_naudit) > 0, 0)) { struct link_map *head = GL(dl_ns)[nsid]._ns_loaded; /* Do not call the functions for any auditing object. */ diff --git a/libc/elf/dl-open.c b/libc/elf/dl-open.c index f825aa043..75dc7bc40 100644 --- a/libc/elf/dl-open.c +++ b/libc/elf/dl-open.c @@ -1,5 +1,5 @@ /* Load a shared object at runtime, relocate it, and run its initializer. - Copyright (C) 1996-2004, 2005, 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 1996-2007, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -207,7 +207,6 @@ dl_open_worker (void *a) const char *file = args->file; int mode = args->mode; struct link_map *new; - int lazy; unsigned int i; bool any_tls = false; struct link_map *call_map = NULL; @@ -366,7 +365,9 @@ dl_open_worker (void *a) _dl_debug_state (); /* Only do lazy relocation if `LD_BIND_NOW' is not set. */ - lazy = (mode & RTLD_BINDING_MASK) == RTLD_LAZY && GLRO(dl_lazy); + int reloc_mode = mode & __RTLD_AUDIT; + if (GLRO(dl_lazy)) + reloc_mode |= mode & RTLD_LAZY; /* Relocate the objects loaded. We do this in reverse order so that copy relocs of earlier objects overwrite the data written by later objects. */ @@ -388,7 +389,7 @@ dl_open_worker (void *a) start the profiling. */ struct link_map *old_profile_map = GL(dl_profile_map); - _dl_relocate_object (l, l->l_scope, 1, 1); + _dl_relocate_object (l, l->l_scope, reloc_mode | RTLD_LAZY, 1); if (old_profile_map == NULL && GL(dl_profile_map) != NULL) { @@ -401,7 +402,7 @@ dl_open_worker (void *a) } else #endif - _dl_relocate_object (l, l->l_scope, lazy, 0); + _dl_relocate_object (l, l->l_scope, reloc_mode, 0); } if (l == new) diff --git a/libc/elf/dl-reloc.c b/libc/elf/dl-reloc.c index 877360f5c..07984d456 100644 --- a/libc/elf/dl-reloc.c +++ b/libc/elf/dl-reloc.c @@ -1,5 +1,5 @@ /* Relocate a shared object and resolve its references to other loaded objects. - Copyright (C) 1995-2004, 2005, 2006, 2008 Free Software Foundation, Inc. + Copyright (C) 1995-2006, 2008, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -151,7 +151,7 @@ _dl_nothread_init_static_tls (struct link_map *map) void _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[], - int lazy, int consider_profiling) + int reloc_mode, int consider_profiling) { struct textrels { @@ -162,10 +162,12 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[], } *textrels = NULL; /* Initialize it to make the compiler happy. */ const char *errstring = NULL; + int lazy = reloc_mode & RTLD_LAZY; #ifdef SHARED /* If we are auditing, install the same handlers we need for profiling. */ - consider_profiling |= GLRO(dl_audit) != NULL; + if ((reloc_mode & __RTLD_AUDIT) == 0) + consider_profiling |= GLRO(dl_audit) != NULL; #elif defined PROF /* Never use dynamic linker profiling for gprof profiling code. */ # define consider_profiling 0 diff --git a/libc/elf/rtld.c b/libc/elf/rtld.c index aa4c030f7..bfe956446 100644 --- a/libc/elf/rtld.c +++ b/libc/elf/rtld.c @@ -574,7 +574,7 @@ _dl_start (void *arg) struct relocate_args { struct link_map *l; - int lazy; + int reloc_mode; }; struct map_args @@ -613,7 +613,7 @@ relocate_doit (void *a) { struct relocate_args *args = (struct relocate_args *) a; - _dl_relocate_object (args->l, args->l->l_scope, args->lazy, 0); + _dl_relocate_object (args->l, args->l->l_scope, args->reloc_mode, 0); } static void @@ -1011,7 +1011,8 @@ of this helper program; chances are you did not intend to run this program.\n\ --library-path PATH use given PATH instead of content of the environment\n\ variable LD_LIBRARY_PATH\n\ --inhibit-rpath LIST ignore RUNPATH and RPATH information in object names\n\ - in LIST\n"); + in LIST\n\ + --audit LIST use objects named in LIST as auditors\n"); ++_dl_skip_args; --_dl_argc; @@ -1908,7 +1909,9 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", struct link_map *l = main_map; /* Relocate the main executable. */ - struct relocate_args args = { .l = l, .lazy = GLRO(dl_lazy) }; + struct relocate_args args = { .l = l, + .reloc_mode = (GLRO(dl_lazy) + ? RTLD_LAZY : 0) }; _dl_receive_error (print_unresolved, relocate_doit, &args); /* This loop depends on the dependencies of the executable to @@ -1985,7 +1988,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", struct relocate_args args; struct link_map *l; - args.lazy = GLRO(dl_lazy); + args.reloc_mode = GLRO(dl_lazy) ? RTLD_LAZY : 0; l = main_map; while (l->l_next != NULL) @@ -2225,7 +2228,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", } if (l != &GL(dl_rtld_map)) - _dl_relocate_object (l, l->l_scope, GLRO(dl_lazy), + _dl_relocate_object (l, l->l_scope, GLRO(dl_lazy) ? RTLD_LAZY : 0, consider_profiling); /* Add object to slot information data if necessasy. */ diff --git a/libc/include/dirent.h b/libc/include/dirent.h index 8f23aee23..3f6c4b9ae 100644 --- a/libc/include/dirent.h +++ b/libc/include/dirent.h @@ -17,14 +17,16 @@ extern int __readdir64_r (DIR *__dirp, struct dirent64 *__entry, extern int __scandir64 (__const char * __dir, struct dirent64 *** __namelist, int (*__selector) (__const struct dirent64 *), - int (*__cmp) (__const void *, __const void *)); + int (*__cmp) (__const struct dirent64 **, + __const struct dirent64 **)); extern __ssize_t __getdents (int __fd, char *__buf, size_t __nbytes) internal_function; extern __ssize_t __getdents64 (int __fd, char *__buf, size_t __nbytes) internal_function; -extern int __alphasort64 (const void *a, const void *b) +extern int __alphasort64 (const struct dirent64 **a, const struct dirent64 **b) __attribute_pure__; -extern int __versionsort64 (const void *a, const void *b) +extern int __versionsort64 (const struct dirent64 **a, + const struct dirent64 **b) __attribute_pure__; extern DIR *__alloc_dir (int fd, bool close_fd, const struct stat64 *statp) internal_function; diff --git a/libc/inet/Makefile b/libc/inet/Makefile index 6f68e4b61..cd7c8cbf6 100644 --- a/libc/inet/Makefile +++ b/libc/inet/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991-2006, 2007 Free Software Foundation, Inc. +# Copyright (C) 1991-2006, 2007, 2009 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -60,7 +60,7 @@ aux-$(OPTION_EGLIBC_INET) += check_pf check_native ifreq tests := htontest test_ifindex tst-ntoa tst-ether_aton tst-network \ tst-gethnm test-ifaddrs bug-if1 tst-ether_line \ - tst-getni1 tst-getni2 + tst-getni1 tst-getni2 tst-inet6_rth tests-$(OPTION_EGLIBC_ADVANCED_INET6) += test-inet6_opt include ../Rules diff --git a/libc/inet/inet6_rth.c b/libc/inet/inet6_rth.c index 15f824090..36269fc6a 100644 --- a/libc/inet/inet6_rth.c +++ b/libc/inet/inet6_rth.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2006 Free Software Foundation, Inc. +/* Copyright (C) 2006, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2006. @@ -93,6 +93,9 @@ inet6_rth_add (void *bp, const struct in6_addr *addr) struct ip6_rthdr0 *rthdr0; case IPV6_RTHDR_TYPE_0: rthdr0 = (struct ip6_rthdr0 *) rthdr; + if (rthdr0->ip6r0_len * 8 / sizeof (struct in6_addr) + - rthdr0->ip6r0_segleft < 1) + return -1; memcpy (&rthdr0->ip6r0_addr[rthdr0->ip6r0_segleft++], addr, sizeof (struct in6_addr)); @@ -127,7 +130,7 @@ inet6_rth_reverse (const void *in, void *out) /* Copy header, not the addresses. The memory regions can overlap. */ memmove (out_rthdr0, in_rthdr0, sizeof (struct ip6_rthdr0)); - int total = in_rthdr0->ip6r0_segleft * 8 / sizeof (struct in6_addr); + int total = in_rthdr0->ip6r0_len * 8 / sizeof (struct in6_addr); for (int i = 0; i < total / 2; ++i) { /* Remember, IN_RTHDR0 and OUT_RTHDR0 might overlap. */ @@ -138,6 +141,8 @@ inet6_rth_reverse (const void *in, void *out) if (total % 2 != 0 && in != out) out_rthdr0->ip6r0_addr[total / 2] = in_rthdr0->ip6r0_addr[total / 2]; + out_rthdr0->ip6r0_segleft = total; + return 0; } diff --git a/libc/inet/tst-inet6_rth.c b/libc/inet/tst-inet6_rth.c new file mode 100644 index 000000000..4c5c90ac0 --- /dev/null +++ b/libc/inet/tst-inet6_rth.c @@ -0,0 +1,188 @@ +#include <stdio.h> +#include <string.h> +#include <arpa/inet.h> +#include <netinet/ip6.h> + +static int +do_test (void) +{ + int res = 0; + char buf[1000]; + void *p = inet6_rth_init (buf, 24, IPV6_RTHDR_TYPE_0, 0); + if (p == NULL) + { + puts ("first inet6_rth_init failed"); + res = 1; + } + else if (inet6_rth_add (p, &in6addr_any) == 0) + { + puts ("first inet6_rth_add succeeded"); + res = 1; + } + + p = inet6_rth_init (buf, 24, IPV6_RTHDR_TYPE_0, 1); + if (p == NULL) + { + puts ("second inet6_rth_init failed"); + res = 1; + } + else if (inet6_rth_add (p, &in6addr_any) != 0) + { + puts ("second inet6_rth_add failed"); + res = 1; + } + + for (int nseg = 4; nseg < 6; ++nseg) + { + printf ("nseg = %d\n", nseg); + + p = inet6_rth_init (buf, sizeof (buf), IPV6_RTHDR_TYPE_0, nseg); + if (p == NULL) + { + puts ("third inet6_rth_init failed"); + res = 1; + } + else + { + struct in6_addr tmp; + memset (&tmp, '\0', sizeof (tmp)); + + for (int i = 0; i < nseg; ++i) + { + tmp.s6_addr[0] = i; + if (inet6_rth_add (p, &tmp) != 0) + { + printf ("call %d of third inet6_rth_add failed\n", i + 1); + res = 1; + goto out; + } + } + ((struct ip6_rthdr0 *) p)->ip6r0_segleft = 0; + if (inet6_rth_segments (p) != nseg) + { + puts ("\ +inet6_rth_segments returned wrong value after loop with third inet6_rth_add"); + res = 1; + goto out; + } + + char buf2[1000]; + if (inet6_rth_reverse (p, buf2) != 0) + { + puts ("first inet6_rth_reverse call failed"); + res = 1; + goto out; + } + if (((struct ip6_rthdr0 *) buf2)->ip6r0_segleft != nseg) + { + puts ("segleft after first inet6_rth_reverse wrong"); + res = 1; + } + + if (inet6_rth_segments (p) != inet6_rth_segments (buf2)) + { + puts ("number of seconds after first inet6_rth_reverse differs"); + res = 1; + goto out; + } + + for (int i = 0; i < nseg; ++i) + { + struct in6_addr *addr = inet6_rth_getaddr (buf2, i); + if (addr == NULL) + { + printf ("call %d of first inet6_rth_getaddr failed\n", + i + 1); + res = 1; + } + else if (addr->s6_addr[0] != nseg - 1 - i + || memcmp (&addr->s6_addr[1], &in6addr_any.s6_addr[1], + sizeof (in6addr_any) + - sizeof (in6addr_any.s6_addr[0])) != 0) + { + char addrbuf[100]; + inet_ntop (AF_INET6, addr, addrbuf, sizeof (addrbuf)); + printf ("\ +address %d after first inet6_rth_reverse wrong (%s)\n", + i + 1, addrbuf); + res = 1; + } + } + out: + ; + } + + p = inet6_rth_init (buf, sizeof (buf), IPV6_RTHDR_TYPE_0, nseg); + if (p == NULL) + { + puts ("fourth inet6_rth_init failed"); + res = 1; + } + else + { + struct in6_addr tmp; + memset (&tmp, '\0', sizeof (tmp)); + + for (int i = 0; i < nseg; ++i) + { + tmp.s6_addr[0] = i; + if (inet6_rth_add (p, &tmp) != 0) + { + printf ("call %d of fourth inet6_rth_add failed\n", i + 1); + res = 1; + goto out2; + } + } + ((struct ip6_rthdr0 *) p)->ip6r0_segleft = 0; + if (inet6_rth_segments (p) != nseg) + { + puts ("\ +inet6_rth_segments returned wrong value after loop with fourth inet6_rth_add"); + res = 1; + goto out2; + } + + if (inet6_rth_reverse (p, p) != 0) + { + puts ("second inet6_rth_reverse call failed"); + res = 1; + goto out2; + } + if (((struct ip6_rthdr0 *) p)->ip6r0_segleft != nseg) + { + puts ("segleft after second inet6_rth_reverse wrong"); + res = 1; + } + + for (int i = 0; i < nseg; ++i) + { + struct in6_addr *addr = inet6_rth_getaddr (p, i); + if (addr == NULL) + { + printf ("call %d of second inet6_rth_getaddr failed\n", + i + 1); + res = 1; + } + else if (addr->s6_addr[0] != nseg - 1 - i + || memcmp (&addr->s6_addr[1], &in6addr_any.s6_addr[1], + sizeof (in6addr_any) + - sizeof (in6addr_any.s6_addr[0])) != 0) + { + char addrbuf[100]; + inet_ntop (AF_INET6, addr, addrbuf, sizeof (addrbuf)); + printf ("\ +address %d after second inet6_rth_reverse wrong (%s)\n", + i + 1, addrbuf); + res = 1; + } + } + out2: + ; + } + } + + return res; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/libc/localedata/ChangeLog b/libc/localedata/ChangeLog index fd54f7d65..17f26f68c 100644 --- a/libc/localedata/ChangeLog +++ b/libc/localedata/ChangeLog @@ -1,3 +1,15 @@ +2009-03-15 Ulrich Drepper <drepper@redhat.com> + + [BZ #9844] + * locales/iso14651_t1_common: Move U0138 entry. + + [BZ #9833] + * locales/ko_KR: Fix noexpr. Add nostr. + + [BZ #9891] + * locales/mt_MT: Fix spelling of August (Awwissu). + Patch by Martin Pitt. + 2009-03-14 Ulrich Drepper <drepper@redhat.com> [BZ #9916] diff --git a/libc/localedata/locales/iso14651_t1_common b/libc/localedata/locales/iso14651_t1_common index 1c9963aaf..6bdc795f4 100644 --- a/libc/localedata/locales/iso14651_t1_common +++ b/libc/localedata/locales/iso14651_t1_common @@ -917,7 +917,7 @@ collating-symbol <k-ai_lenght_mark> # mlvw- denotes Malayalam vowel # ml-visarga - dentos Malayalam Visarga # consonant + virama is considered half of consonant or consonant without vowel part -# so it consonant + virama should be considered as cluster and should be +# so it consonant + virama should be considered as cluster and should be # sorted before the consonant. All consonants are considered to have an implicit a vowel # part associated with it. collating-element <ml-chillu-n> from "<U0D28><U0D4D>" @@ -2362,7 +2362,6 @@ endif <U1E33> <k>;<BPT>;<MIN>;IGNORE # 337 ḳ <U1E35> <k>;<BMA>;<MIN>;IGNORE # 338 ḵ <U0199> <k>;<CRL>;<MIN>;IGNORE # 339 ƙ -<U0138> <k>;<PCL>;<MIN>;IGNORE # 340 <kk> <U006C> <l>;<BAS>;<MIN>;IGNORE # 341 l <U013A> <l>;<ACA>;<MIN>;IGNORE # 342 <l'> <U013E> <l>;<CAR>;<MIN>;IGNORE # 343 <l<> @@ -2436,6 +2435,7 @@ endif <U1E55> <p>;<ACA>;<MIN>;IGNORE # 411 <p'> <U1E57> <p>;<PCT>;<MIN>;IGNORE # 412 <p.> <U0071> <q>;<BAS>;<MIN>;IGNORE # 413 q +<U0138> <q>;<PCL>;<MIN>;IGNORE # 340 <kk> <U0072> <r>;<BAS>;<MIN>;IGNORE # 414 r <U0155> <r>;<ACA>;<MIN>;IGNORE # 415 <r'> <U0159> <r>;<CAR>;<MIN>;IGNORE # 416 <r<> @@ -4309,7 +4309,7 @@ order_start <MALAYALAM>;forward;forward;forward;forward,position <ml-dh> "<ml-dha><ml-virama>";<BAS>;<MIN>;IGNORE <U0D22> "<ml-dha><ml-virama><mlvw-shorta>";<BAS>;<MIN>;IGNORE <ml-chillu-nn> "<ml-nna><ml-virama>";<BAS>;<MIN>;IGNORE # ണ് = ണ + ് + zwj -<U0D23> "<ml-nna><ml-virama><mlvw-shorta>";<BAS>;<MIN>;IGNORE # ണ = ണ + ് + അ +<U0D23> "<ml-nna><ml-virama><mlvw-shorta>";<BAS>;<MIN>;IGNORE # ണ = ണ + ് + അ <ml-th> "<ml-tha><ml-virama>";<BAS>;<MIN>;IGNORE <U0D24> "<ml-tha><ml-virama><mlvw-shorta>";<BAS>;<MIN>;IGNORE <ml-thh> "<ml-thha><ml-virama>";<BAS>;<MIN>;IGNORE @@ -4329,14 +4329,14 @@ order_start <MALAYALAM>;forward;forward;forward;forward,position <ml-bh> "<ml-bha><ml-virama>";<BAS>;<MIN>;IGNORE <U0D2D> "<ml-bha><ml-virama><mlvw-shorta>";<BAS>;<MIN>;IGNORE <U0D02> "<ml-ma><ml-virama>";<BAS>;<MIN>;IGNORE # ം = മ + ് -<ml-m> "<ml-ma><ml-virama>";"<BAS><ml-virama>";<MIN>;IGNORE # ം = മ + ് -<U0D2E> "<ml-ma><ml-virama><mlvw-shorta>";<BAS>;<MIN>;IGNORE # മ = മ + ് + അ +<ml-m> "<ml-ma><ml-virama>";"<BAS><ml-virama>";<MIN>;IGNORE # ം = മ + ് +<U0D2E> "<ml-ma><ml-virama><mlvw-shorta>";<BAS>;<MIN>;IGNORE # മ = മ + ് + അ <ml-y> "<ml-ya><ml-virama>";<BAS>;<MIN>;IGNORE <U0D2F> "<ml-ya><ml-virama><mlvw-shorta>";<BAS>;<MIN>;IGNORE <ml-chillu-r> "<ml-ra><ml-virama>";<BAS>;<MIN>;IGNORE # ര = ര + ് + zwj -<U0D30> "<ml-ra><ml-virama><mlvw-shorta>";<BAS>;<MIN>;IGNORE # ര = ര + ് + അ +<U0D30> "<ml-ra><ml-virama><mlvw-shorta>";<BAS>;<MIN>;IGNORE # ര = ര + ് + അ <ml-chillu-l> <ml-la>;<BAS>;<MIN>;IGNORE # ല് = ല + ് + zwj -<U0D32> "<ml-la><ml-virama><mlvw-shorta>";<BAS>;<MIN>;IGNORE # ല = ല + ് + അ +<U0D32> "<ml-la><ml-virama><mlvw-shorta>";<BAS>;<MIN>;IGNORE # ല = ല + ് + അ <ml-v> "<ml-va><ml-virama>";<BAS>;<MIN>;IGNORE <U0D35> "<ml-va><ml-virama><mlvw-shorta>";<BAS>;<MIN>;IGNORE <ml-ss> "<ml-ssa><ml-virama>";<BAS>;<MIN>;IGNORE @@ -4348,7 +4348,7 @@ order_start <MALAYALAM>;forward;forward;forward;forward,position <ml-h> "<ml-ha><ml-virama>";<BAS>;<MIN>;IGNORE <U0D39> "<ml-ha><ml-virama><mlvw-shorta>";<BAS>;<MIN>;IGNORE <ml-chillu-ll> "<ml-lla><ml-virama>";<BAS>;<MIN>;IGNORE # ള് = ള + ് + zwj -<U0D33> "<ml-lla><ml-virama><mlvw-shorta>";<BAS>;<MIN>;IGNORE # ള = ള + ് + അ +<U0D33> "<ml-lla><ml-virama><mlvw-shorta>";<BAS>;<MIN>;IGNORE # ള = ള + ് + അ <ml-zh> "<ml-zha><ml-virama>";<BAS>;<MIN>;IGNORE <U0D34> "<ml-zha><ml-virama><mlvw-shorta>";<BAS>;<MIN>;IGNORE <ml-rr> "<ml-rra><ml-virama>";<BAS>;<MIN>;IGNORE diff --git a/libc/localedata/locales/ko_KR b/libc/localedata/locales/ko_KR index 43915c2a8..59653ad18 100644 --- a/libc/localedata/locales/ko_KR +++ b/libc/localedata/locales/ko_KR @@ -6202,7 +6202,9 @@ LC_MESSAGES yesexpr "<U005E><U005B><U0079><U0059><UC608><U005D>" -noexpr "<U005E><U005B><U006E><U004E><UC544><UB2C8><UC624><U005D>" +noexpr "<U005E><U005B><U006E><U004E><UC544><U005D>" + +nostr "<UC544><UB2C8><UC624>" END LC_MESSAGES diff --git a/libc/localedata/locales/mt_MT b/libc/localedata/locales/mt_MT index 81c134fde..d6af96b1e 100644 --- a/libc/localedata/locales/mt_MT +++ b/libc/localedata/locales/mt_MT @@ -188,7 +188,7 @@ day "<U0069><U006C><U002D><U0126><U0061><U0064><U0064>";/ abmon "<U004A><U0061><U006E>";"<U0046><U0072><U0061>";/ "<U004D><U0061><U0072>";"<U0041><U0070><U0072>";/ "<U004D><U0065><U006A>";"<U0120><U0075><U006E>";/ - "<U004C><U0075><U006C>";"<U0041><U0077><U0069>";/ + "<U004C><U0075><U006C>";"<U0041><U0077><U0077>";/ "<U0053><U0065><U0074>";"<U004F><U0074><U0074>";/ "<U004E><U006F><U0076>";"<U0044><U0069><U010B>" % @@ -200,7 +200,7 @@ mon "<U004A><U0061><U006E><U006E><U0061><U0072>";/ "<U004D><U0065><U006A><U006A><U0075>";/ "<U0120><U0075><U006E><U006A><U0075>";/ "<U004C><U0075><U006C><U006A><U0075>";/ - "<U0041><U0077><U0069><U0073><U0073><U0075>";/ + "<U0041><U0077><U0077><U0069><U0073><U0073><U0075>";/ "<U0053><U0065><U0074><U0074><U0065><U006D><U0062><U0072><U0075>";/ "<U004F><U0074><U0074><U0075><U0062><U0072><U0075>";/ "<U004E><U006F><U0076><U0065><U006D><U0062><U0072><U0075>";/ diff --git a/libc/nptl/ChangeLog b/libc/nptl/ChangeLog index 15e79efdd..049d3ce39 100644 --- a/libc/nptl/ChangeLog +++ b/libc/nptl/ChangeLog @@ -1,3 +1,9 @@ +2009-03-15 Ulrich Drepper <drepper@redhat.com> + + * sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S + (__pthread_cond_timedwait): Change to use cfi directives instead of + hand-coded unwind sections. + 2009-03-10 Ulrich Drepper <drepper@redhat.com> * init.c (nptl_freeres): Compile only for SHARED. diff --git a/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S b/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S index 20bc59db9..ddcf106a6 100644 --- a/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S +++ b/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. +/* Copyright (C) 2002-2005, 2007, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -37,16 +37,19 @@ .type __pthread_cond_timedwait, @function .align 16 __pthread_cond_timedwait: -.LSTARTCODE: + cfi_startproc pushq %r12 -.Lpush_r12: + cfi_adjust_cfa_offset(8) + cfi_rel_offset(%r12, 0) pushq %r13 -.Lpush_r13: + cfi_adjust_cfa_offset(8) + cfi_rel_offset(%r13, 0) pushq %r14 -.Lpush_r14: + cfi_adjust_cfa_offset(8) + cfi_rel_offset(%r14, 0) #define FRAME_SIZE 80 subq $FRAME_SIZE, %rsp -.Lsubq: + cfi_adjust_cfa_offset(FRAME_SIZE) cmpq $1000000000, 8(%rdx) movl $EINVAL, %eax @@ -305,19 +308,25 @@ __pthread_cond_timedwait: cmoveq %r14, %rax 18: addq $FRAME_SIZE, %rsp -.Laddq: + cfi_adjust_cfa_offset(-FRAME_SIZE) popq %r14 -.Lpop_r14: + cfi_adjust_cfa_offset(-8) + cfi_restore(%r14) popq %r13 -.Lpop_r13: + cfi_adjust_cfa_offset(-8) + cfi_restore(%r13) popq %r12 -.Lpop_r12: + cfi_adjust_cfa_offset(-8) + cfi_restore(%r12) retq /* Initial locking failed. */ 1: -.LSbl1: + cfi_adjust_cfa_offset(3 * 8 + FRAME_SIZE) + cfi_rel_offset(%r12, FRAME_SIZE + 16) + cfi_rel_offset(%r13, FRAME_SIZE + 8) + cfi_rel_offset(%r14, FRAME_SIZE) #if cond_lock != 0 addq $cond_lock, %rdi #endif @@ -414,97 +423,7 @@ __pthread_cond_timedwait: js 6b jmp 21b #endif -.LENDCODE: + cfi_endproc .size __pthread_cond_timedwait, .-__pthread_cond_timedwait versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait, GLIBC_2_3_2) - - - .section .eh_frame,"a",@progbits -.LSTARTFRAME: - .long L(ENDCIE)-L(STARTCIE) # Length of the CIE. -.LSTARTCIE: - .long 0 # CIE ID. - .byte 1 # Version number. -#ifdef SHARED - .string "zR" # NUL-terminated augmentation - # string. -#else - .ascii "\0" # NUL-terminated augmentation - # string. -#endif - .uleb128 1 # Code alignment factor. - .sleb128 -8 # Data alignment factor. - .byte 16 # Return address register - # column. -#ifdef SHARED - .uleb128 1 # Augmentation value length. - .byte 0x1b # Encoding: DW_EH_PE_pcrel - # + DW_EH_PE_sdata4. -#endif - .byte 0x0c # DW_CFA_def_cfa - .uleb128 7 - .uleb128 8 - .byte 0x90 # DW_CFA_offset, column 0x8 - .uleb128 1 - .align 8 -.LENDCIE: - - .long .LENDFDE-.LSTARTFDE # Length of the FDE. -.LSTARTFDE: - .long .LSTARTFDE-.LSTARTFRAME # CIE pointer. -#ifdef SHARED - .long .LSTARTCODE-. # PC-relative start address - # of the code -#else - .long .LSTARTCODE # Start address of the code. -#endif - .long .LENDCODE-.LSTARTCODE # Length of the code. -#ifdef SHARED - .uleb128 0 # No augmentation data. -#endif - .byte 0x40+.Lpush_r12-.LSTARTCODE # DW_CFA_advance_loc+N - .byte 14 # DW_CFA_def_cfa_offset - .uleb128 16 - .byte 0x8c # DW_CFA_offset %r12 - .uleb128 2 - .byte 0x40+.Lpush_r13-.Lpush_r12 # DW_CFA_advance_loc+N - .byte 14 # DW_CFA_def_cfa_offset - .uleb128 24 - .byte 0x8d # DW_CFA_offset %r13 - .uleb128 3 - .byte 0x40+.Lpush_r14-.Lpush_r13 # DW_CFA_advance_loc+N - .byte 14 # DW_CFA_def_cfa_offset - .uleb128 32 - .byte 0x84 # DW_CFA_offset %r14 - .uleb128 4 - .byte 0x40+.Lsubq-.Lpush_r14 # DW_CFA_advance_loc+N - .byte 14 # DW_CFA_def_cfa_offset - .uleb128 32+FRAME_SIZE - .byte 3 # DW_CFA_advance_loc2 - .2byte .Laddq-.Lsubq - .byte 14 # DW_CFA_def_cfa_offset - .uleb128 32 - .byte 0x40+.Lpop_r14-.Laddq # DW_CFA_advance_loc+N - .byte 14 # DW_CFA_def_cfa_offset - .uleb128 24 - .byte 0xce # DW_CFA_restore %r14 - .byte 0x40+.Lpop_r13-.Lpop_r14 # DW_CFA_advance_loc+N - .byte 14 # DW_CFA_def_cfa_offset - .uleb128 16 - .byte 0xcd # DW_CFA_restore %r13 - .byte 0x40+.Lpop_r12-.Lpop_r13 # DW_CFA_advance_loc+N - .byte 14 # DW_CFA_def_cfa_offset - .uleb128 8 - .byte 0xcc # DW_CFA_restore %r12 - .byte 0x40+.LSbl1-.Lpop_r12 # DW_CFA_advance_loc+N - .byte 14 # DW_CFA_def_cfa_offset - .uleb128 32+FRAME_SIZE - .byte 0x8c # DW_CFA_offset %r12 - .uleb128 2 - .byte 0x8d # DW_CFA_offset %r13 - .uleb128 3 - .byte 0x84 # DW_CFA_offset %r14 - .uleb128 4 - .align 8 -.LENDFDE: diff --git a/libc/nscd/connections.c b/libc/nscd/connections.c index 3d0727f33..234e289f0 100644 --- a/libc/nscd/connections.c +++ b/libc/nscd/connections.c @@ -1418,7 +1418,22 @@ cannot change to old working directory: %s; disabling paranoia mode"), } /* The preparations are done. */ - execv ("/proc/self/exe", argv); +#ifdef PATH_MAX + char pathbuf[PATH_MAX]; +#else + char pathbuf[256]; +#endif + /* Try to exec the real nscd program so the process name (as reported + in /proc/PID/status) will be 'nscd', but fall back to /proc/self/exe + if readlink fails */ + ssize_t n = readlink ("/proc/self/exe", pathbuf, sizeof (pathbuf) - 1); + if (n == -1) + execv ("/proc/self/exe", argv); + else + { + pathbuf[n] = '\0'; + execv (pathbuf, argv); + } /* If we come here, we will never be able to re-exec. */ dbg_log (_("re-exec failed: %s; disabling paranoia mode"), diff --git a/libc/string/strlen.c b/libc/string/strlen.c index 9bc9db68f..5f22ce950 100644 --- a/libc/string/strlen.c +++ b/libc/string/strlen.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1993, 1997, 2000, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1991,1993,1997,2000,2003,2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Torbjorn Granlund (tege@sics.se), with help from Dan Sahlin (dan@sics.se); @@ -32,7 +32,7 @@ strlen (str) { const char *char_ptr; const unsigned long int *longword_ptr; - unsigned long int longword, magic_bits, himagic, lomagic; + unsigned long int longword, himagic, lomagic; /* Handle the first few characters by reading one character at a time. Do this until CHAR_PTR is aligned on a longword boundary. */ @@ -56,14 +56,12 @@ strlen (str) The 1-bits make sure that carries propagate to the next 0-bit. The 0-bits provide holes for carries to fall into. */ - magic_bits = 0x7efefeffL; himagic = 0x80808080L; lomagic = 0x01010101L; if (sizeof (longword) > 4) { /* 64-bit version of the magic. */ /* Do the shift in two steps to avoid a warning if long has 32 bits. */ - magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; himagic = ((himagic << 16) << 16) | himagic; lomagic = ((lomagic << 16) << 16) | lomagic; } @@ -75,53 +73,9 @@ strlen (str) if *any of the four* bytes in the longword in question are zero. */ for (;;) { - /* We tentatively exit the loop if adding MAGIC_BITS to - LONGWORD fails to change any of the hole bits of LONGWORD. - - 1) Is this safe? Will it catch all the zero bytes? - Suppose there is a byte with all zeros. Any carry bits - propagating from its left will fall into the hole at its - least significant bit and stop. Since there will be no - carry from its most significant bit, the LSB of the - byte to the left will be unchanged, and the zero will be - detected. - - 2) Is this worthwhile? Will it ignore everything except - zero bytes? Suppose every byte of LONGWORD has a bit set - somewhere. There will be a carry into bit 8. If bit 8 - is set, this will carry into bit 16. If bit 8 is clear, - one of bits 9-15 must be set, so there will be a carry - into bit 16. Similarly, there will be a carry into bit - 24. If one of bits 24-30 is set, there will be a carry - into bit 31, so all of the hole bits will be changed. - - The one misfire occurs when bits 24-30 are clear and bit - 31 is set; in this case, the hole at bit 31 is not - changed. If we had access to the processor carry flag, - we could close this loophole by putting the fourth hole - at bit 32! - - So it ignores everything except 128's, when they're aligned - properly. */ - longword = *longword_ptr++; - if ( -#if 0 - /* Add MAGIC_BITS to LONGWORD. */ - (((longword + magic_bits) - - /* Set those bits that were unchanged by the addition. */ - ^ ~longword) - - /* Look at only the hole bits. If any of the hole bits - are unchanged, most likely one of the bytes was a - zero. */ - & ~magic_bits) -#else - ((longword - lomagic) & himagic) -#endif - != 0) + if (((longword - lomagic) & ~longword & himagic) != 0) { /* Which of the bytes was the zero? If none of them were, it was a misfire; continue the search. */ diff --git a/libc/sysdeps/generic/ldsodefs.h b/libc/sysdeps/generic/ldsodefs.h index e00b173f4..943369bb2 100644 --- a/libc/sysdeps/generic/ldsodefs.h +++ b/libc/sysdeps/generic/ldsodefs.h @@ -882,10 +882,10 @@ extern struct link_map *_dl_new_object (char *realname, const char *libname, /* Relocate the given object (if it hasn't already been). SCOPE is passed to _dl_lookup_symbol in symbol lookups. - If LAZY is nonzero, don't relocate its PLT. */ + If RTLD_LAZY is set in RELOC-MODE, don't relocate its PLT. */ extern void _dl_relocate_object (struct link_map *map, struct r_scope_elem *scope[], - int lazy, int consider_profiling) + int reloc_mode, int consider_profiling) attribute_hidden; /* Protect PT_GNU_RELRO area. */ diff --git a/libc/sysdeps/unix/sysv/linux/i386/alphasort64.c b/libc/sysdeps/unix/sysv/linux/i386/alphasort64.c index 221aedc16..33e2fcd43 100644 --- a/libc/sysdeps/unix/sysv/linux/i386/alphasort64.c +++ b/libc/sysdeps/unix/sysv/linux/i386/alphasort64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1997, 1998, 2000, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1997,1998,2000,2004,2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,10 +20,9 @@ #include <string.h> int -__alphasort64 (const void *a, const void *b) +__alphasort64 (const struct dirent64 **a, const struct dirent64 **b) { - return strcoll ((*(const struct dirent64 **) a)->d_name, - (*(const struct dirent64 **) b)->d_name); + return strcoll ((*a)->d_name, (*b)->d_name); } #include <shlib-compat.h> @@ -35,14 +34,15 @@ versioned_symbol (libc, __alphasort64, alphasort64, GLIBC_2_2); #include <sysdeps/unix/sysv/linux/i386/olddirent.h> int -__old_alphasort64 (const void *a, const void *b); +__old_alphasort64 (const struct __old_dirent64 **a, + const struct __old_dirent64 **b); int attribute_compat_text_section -__old_alphasort64 (const void *a, const void *b) +__old_alphasort64 (const struct __old_dirent64 **a, + const struct __old_dirent64 **b) { - return strcoll ((*(const struct __old_dirent64 **) a)->d_name, - (*(const struct __old_dirent64 **) b)->d_name); + return strcoll ((*a)->d_name, (*b)->d_name); } compat_symbol (libc, __old_alphasort64, alphasort64, GLIBC_2_1); diff --git a/libc/sysdeps/unix/sysv/linux/i386/olddirent.h b/libc/sysdeps/unix/sysv/linux/i386/olddirent.h index f9a79b235..4f73197e5 100644 --- a/libc/sysdeps/unix/sysv/linux/i386/olddirent.h +++ b/libc/sysdeps/unix/sysv/linux/i386/olddirent.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -39,6 +39,7 @@ extern __ssize_t __old_getdents64 (int __fd, char *__buf, size_t __nbytes) int __old_scandir64 (__const char * __dir, struct __old_dirent64 *** __namelist, int (*__selector) (__const struct __old_dirent64 *), - int (*__cmp) (__const void *, __const void *)); + int (*__cmp) (__const struct __old_dirent64 **, + __const struct __old_dirent64 **)); #endif diff --git a/libc/sysdeps/unix/sysv/linux/i386/versionsort64.c b/libc/sysdeps/unix/sysv/linux/i386/versionsort64.c index 3efce692f..be635f918 100644 --- a/libc/sysdeps/unix/sysv/linux/i386/versionsort64.c +++ b/libc/sysdeps/unix/sysv/linux/i386/versionsort64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1997, 1998, 2000, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1992,1997,1998,2000,2004,2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,10 +20,9 @@ #include <string.h> int -__versionsort64 (const void *a, const void *b) +__versionsort64 (const struct dirent64 **a, const struct dirent64 **b) { - return __strverscmp ((*(const struct dirent64 **) a)->d_name, - (*(const struct dirent64 **) b)->d_name); + return __strverscmp ((*a)->d_name, (*b)->d_name); } #include <shlib-compat.h> @@ -35,14 +34,15 @@ versioned_symbol (libc, __versionsort64, versionsort64, GLIBC_2_2); #include <sysdeps/unix/sysv/linux/i386/olddirent.h> int -__old_versionsort64 (const void *a, const void *b); +__old_versionsort64 (const struct __old_dirent64 **a, + const struct __old_dirent64 **b); int attribute_compat_text_section -__old_versionsort64 (const void *a, const void *b) +__old_versionsort64 (const struct __old_dirent64 **a, + const struct __old_dirent64 **b) { - return __strverscmp ((*(const struct __old_dirent64 **) a)->d_name, - (*(const struct __old_dirent64 **) b)->d_name); + return __strverscmp ((*a)->d_name, (*b)->d_name); } compat_symbol (libc, __old_versionsort64, versionsort64, GLIBC_2_1); diff --git a/libc/sysdeps/wordsize-64/alphasort.c b/libc/sysdeps/wordsize-64/alphasort.c index 509616662..edc410129 100644 --- a/libc/sysdeps/wordsize-64/alphasort.c +++ b/libc/sysdeps/wordsize-64/alphasort.c @@ -1,3 +1,7 @@ +#define alphasort64 rename_alphasort64 + #include "../../dirent/alphasort.c" +#undef alphasort64 + weak_alias (alphasort, alphasort64) diff --git a/libc/sysdeps/wordsize-64/versionsort.c b/libc/sysdeps/wordsize-64/versionsort.c index 90365a4b2..bb25550d3 100644 --- a/libc/sysdeps/wordsize-64/versionsort.c +++ b/libc/sysdeps/wordsize-64/versionsort.c @@ -1,3 +1,7 @@ +#define versionsort64 rename_versionsort64 + #include "../../dirent/versionsort.c" +#undef versionsort64 + weak_alias (versionsort, versionsort64) diff --git a/libc/sysdeps/x86_64/dl-trampoline.S b/libc/sysdeps/x86_64/dl-trampoline.S index 0ae47a47d..d8d9bc12a 100644 --- a/libc/sysdeps/x86_64/dl-trampoline.S +++ b/libc/sysdeps/x86_64/dl-trampoline.S @@ -35,7 +35,7 @@ _dl_runtime_resolve: movq %r8, 40(%rsp) movq %r9, 48(%rsp) movq 64(%rsp), %rsi # Copy args pushed by PLT in register. - movq 56(%rsp), %rdi # %rdi: link_map, %rsi: reloc_offset + movq 56(%rsp), %rdi # %rdi: link_map, %rsi: reloc_index call _dl_fixup # Call resolver. movq %rax, %r11 # Save return value movq 48(%rsp), %r9 # Get register content back. @@ -112,7 +112,7 @@ _dl_runtime_profile: movq %rsp, %rcx # La_x86_64_regs pointer to %rcx. movq 48(%rbx), %rdx # Load return address if needed. movq 40(%rbx), %rsi # Copy args pushed by PLT in register. - movq 32(%rbx), %rdi # %rdi: link_map, %rsi: reloc_offset + movq 32(%rbx), %rdi # %rdi: link_map, %rsi: reloc_index leaq 16(%rbx), %r8 call _dl_profile_fixup # Call resolver. @@ -196,7 +196,7 @@ _dl_runtime_profile: movq 24(%rbx), %rdx # La_x86_64_regs argument to %rdx. movq 40(%rbx), %rsi # Copy args pushed by PLT in register. - movq 32(%rbx), %rdi # %rdi: link_map, %rsi: reloc_offset + movq 32(%rbx), %rdi # %rdi: link_map, %rsi: reloc_index call _dl_call_pltexit movq (%rsp), %rax # Restore return registers. |