diff options
author | Ulrich Drepper <drepper@redhat.com> | 1999-07-25 23:21:20 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1999-07-25 23:21:20 +0000 |
commit | 722c33bbb6d2984cf537f0d3669617fba041fb50 (patch) | |
tree | 2a7f596c5e9979123c3833a1684a2d3516c067f9 | |
parent | 788e8e7c221825916e6ab11f0079d4c5ede8a057 (diff) | |
download | glibc-722c33bbb6d2984cf537f0d3669617fba041fb50.tar.gz glibc-722c33bbb6d2984cf537f0d3669617fba041fb50.tar.xz glibc-722c33bbb6d2984cf537f0d3669617fba041fb50.zip |
Update.
* string/bits/string2.h: Fix aliasing problems. * sysdeps/i386/i486/bits/string.h: Likewise. * sysdeps/i386/bits/string.h: Likewise. 1998-12-28 Geoff Keating <geoffk@ozemail.com.au> * sysdeps/powerpc/dl-machine.c: Handle shared library profiling. * elf/rtld.c (dl_main): Don't call malloc() between re-relocating the dynamic linker and running the application's crt0. 1999-07-21 Paul D. Smith <psmith@gnu.org> * sysdeps/generic/glob.c: Move getlogin{,_r} prototypes below glob.h to get __P() macro. * posix/fnmatch.c (internal_fnmatch): Use K&R definition syntax, not ANSI. (__strchrnul): This won't exist outside GLIBC, so create one. 1999-07-25 Jakub Jelinek <jj@ultra.linux.cz> * sysdeps/unix/sysv/linux/sparc/bits/types.h: Always define __qaddr_t. __ino64_t should be 32bit unsigned type on sparc32. Define __off64_t to __quad_t instead of __int64_t. Make __pic_pid_t unsigned on sparc32. 1999-07-25 Andreas Jaeger <aj@arthur.rhein-neckar.de> * localedata/tst-rpmatch.sh: Use "&" instead of "§" to avoid a bug in bash 2.03. 1999-07-25 Ulrich Drepper <drepper@cygnus.com>
-rw-r--r-- | ChangeLog | 33 | ||||
-rw-r--r-- | elf/rtld.c | 29 | ||||
-rw-r--r-- | posix/fnmatch.c | 25 | ||||
-rw-r--r-- | string/bits/string2.h | 289 | ||||
-rw-r--r-- | sysdeps/generic/glob.c | 12 | ||||
-rw-r--r-- | sysdeps/i386/bits/string.h | 92 | ||||
-rw-r--r-- | sysdeps/i386/i486/bits/string.h | 172 | ||||
-rw-r--r-- | sysdeps/powerpc/dl-machine.c | 5 |
8 files changed, 417 insertions, 240 deletions
diff --git a/ChangeLog b/ChangeLog index 72c8ad625f..0097e04a4f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,38 @@ 1999-07-25 Ulrich Drepper <drepper@cygnus.com> + * string/bits/string2.h: Fix aliasing problems. + * sysdeps/i386/i486/bits/string.h: Likewise. + * sysdeps/i386/bits/string.h: Likewise. + +1998-12-28 Geoff Keating <geoffk@ozemail.com.au> + + * sysdeps/powerpc/dl-machine.c: Handle shared library profiling. + * elf/rtld.c (dl_main): Don't call malloc() between + re-relocating the dynamic linker and running the application's crt0. + +1999-07-21 Paul D. Smith <psmith@gnu.org> + + * sysdeps/generic/glob.c: Move getlogin{,_r} prototypes below + glob.h to get __P() macro. + + * posix/fnmatch.c (internal_fnmatch): Use K&R definition syntax, + not ANSI. + (__strchrnul): This won't exist outside GLIBC, so create one. + +1999-07-25 Jakub Jelinek <jj@ultra.linux.cz> + + * sysdeps/unix/sysv/linux/sparc/bits/types.h: Always define __qaddr_t. + __ino64_t should be 32bit unsigned type on sparc32. + Define __off64_t to __quad_t instead of __int64_t. + Make __pic_pid_t unsigned on sparc32. + +1999-07-25 Andreas Jaeger <aj@arthur.rhein-neckar.de> + + * localedata/tst-rpmatch.sh: Use "&" instead of "§" to avoid a bug + in bash 2.03. + +1999-07-25 Ulrich Drepper <drepper@cygnus.com> + * iconvdata/euc-kr.c (euckr_from_ucs4): Set cp[0] to '\0' in case of an error. Patch by Changwoo Ryu <cwryu@debian.org>. diff --git a/elf/rtld.c b/elf/rtld.c index 60293800c5..72c81fb00f 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -1024,6 +1024,14 @@ of this helper program; chances are you did not intend to run this program.\n\ _dl_relocate_object might need to call `mprotect' for DT_TEXTREL. */ _dl_sysdep_start_cleanup (); + /* Now enable profiling if needed. Like the previous call, + this has to go here because the calls it makes should use the + rtld versions of the functions (particularly calloc()), but it + needs to have _dl_profile_map set up by the relocator. */ + if (_dl_profile_map != NULL) + /* We must prepare the profiling. */ + _dl_start_profile (_dl_profile_map, _dl_profile_output); + if (_dl_rtld_map.l_opencount > 0) { /* There was an explicit ref to the dynamic linker as a shared lib. @@ -1082,11 +1090,6 @@ of this helper program; chances are you did not intend to run this program.\n\ _dl_unload_cache (); #endif - /* Now enable profiling if needed. */ - if (_dl_profile_map != NULL) - /* We must prepare the profiling. */ - _dl_start_profile (_dl_profile_map, _dl_profile_output); - /* Once we return, _dl_sysdep_start will invoke the DT_INIT functions and then *USER_ENTRY. */ } @@ -1299,11 +1302,7 @@ process_envvars (enum mode *modep, int *lazyp) /* Which shared object shall be profiled. */ if (memcmp (&envline[3], "PROFILE", 7) == 0) - { - _dl_profile = &envline[11]; - if (*_dl_profile == '\0') - _dl_profile = NULL; - } + _dl_profile = &envline[11]; break; case 8: @@ -1388,6 +1387,12 @@ process_envvars (enum mode *modep, int *lazyp) unsetenv ("LD_PRELOAD"); if (library_path != NULL) unsetenv ("LD_LIBRARY_PATH"); + if (_dl_origin_path != NULL) + unsetenv ("LD_ORIGIN_PATH"); + if (debug_output != NULL) + unsetenv ("LD_DEBUG_OUTPUT"); + if (_dl_profile != NULL) + unsetenv ("LD_PROFILE"); for (cnt = 0; cnt < sizeof (unsecure_envvars) / sizeof (unsecure_envvars[0]); @@ -1395,6 +1400,10 @@ process_envvars (enum mode *modep, int *lazyp) unsetenv (unsecure_envvars[cnt]); } + /* The name of the object to profile cannot be empty. */ + if (_dl_profile != NULL && *_dl_profile == '\0') + _dl_profile = NULL; + /* If we have to run the dynamic linker in debugging mode and the LD_DEBUG_OUTPUT environment variable is given, we write the debug messages to this file. */ diff --git a/posix/fnmatch.c b/posix/fnmatch.c index 9617d336f4..b1e1b94afa 100644 --- a/posix/fnmatch.c +++ b/posix/fnmatch.c @@ -127,14 +127,35 @@ extern char *getenv (); extern int errno; # endif +/* This function doesn't exist on most systems. */ + +# if !defined HAVE___STRCHRNUL && !defined _LIBC +static char * +__strchrnul (s, c) + const char *s; + int c; +{ + char *result = strchr (s, c); + if (result == NULL) + result = strchr (s, '\0'); + return result; +} +# endif + /* Match STRING against the filename pattern PATTERN, returning zero if it matches, nonzero if not. */ +static int internal_fnmatch __P ((const char *pattern, const char *string, + int no_leading_period, int flags)) + internal_function; static int #ifdef _LIBC internal_function #endif -internal_fnmatch (const char *pattern, const char *string, - int no_leading_period, int flags) +internal_fnmatch (pattern, string, no_leading_period, flags) + const char *pattern; + const char *string; + int no_leading_period; + int flags; { register const char *p = pattern, *n = string; register unsigned char c; diff --git a/string/bits/string2.h b/string/bits/string2.h index 43cb6d5eff..f27ea6269d 100644 --- a/string/bits/string2.h +++ b/string/bits/string2.h @@ -110,51 +110,68 @@ __STRING2_COPY_TYPE (8); # define __memset_gc(s, c, n) \ ({ void *__s = (s); \ - __uint32_t *__ts = (__uint32_t *) __s; \ + union { \ + unsigned int __ui; \ + unsigned short int __usi; \ + unsigned char __uc; \ + } *__u = __s; \ __uint8_t __c = (__uint8_t) (c); \ - \ + \ /* This `switch' statement will be removed at compile-time. */ \ switch (n) \ { \ case 15: \ - *__ts++ = __c * 0x01010101; \ + __u->__ui = __c * 0x01010101; \ + __u = (void *) __u + 4; \ case 11: \ - *__ts++ = __c * 0x01010101; \ + __u->__ui = __c * 0x01010101; \ + __u = (void *) __u + 4; \ case 7: \ - *__ts++ = __c * 0x01010101; \ + __u->__ui = __c * 0x01010101; \ + __u = (void *) __u + 4; \ case 3: \ - *((__uint16_t *) __ts)++ = __c * 0x0101; \ - *((__uint8_t *) __ts) = __c; \ + __u->__usi = (unsigned short int) __c * 0x0101; \ + __u = (void *) __u + 2; \ + __u->__uc = (unsigned char) __c; \ break; \ \ case 14: \ - *__ts++ = __c * 0x01010101; \ + __u->__ui = __c * 0x01010101; \ + __u = (void *) __u + 4; \ case 10: \ - *__ts++ = __c * 0x01010101; \ + __u->__ui = __c * 0x01010101; \ + __u = (void *) __u + 4; \ case 6: \ - *__ts++ = __c * 0x01010101; \ + __u->__ui = __c * 0x01010101; \ + __u = (void *) __u + 4; \ case 2: \ - *((__uint16_t *) __ts) = __c * 0x0101; \ + __u->__usi = (unsigned short int) __c * 0x0101; \ break; \ \ case 13: \ - *__ts++ = __c * 0x01010101; \ + __u->__ui = __c * 0x01010101; \ + __u = (void *) __u + 4; \ case 9: \ - *__ts++ = __c * 0x01010101; \ + __u->__ui = __c * 0x01010101; \ + __u = (void *) __u + 4; \ case 5: \ - *__ts++ = __c * 0x01010101; \ + __u->__ui = __c * 0x01010101; \ + __u = (void *) __u + 4; \ case 1: \ - *((__uint8_t *) __ts) = __c; \ + __u->__uc = (unsigned char) __c; \ break; \ \ case 16: \ - *__ts++ = __c * 0x01010101; \ + __u->__ui = __c * 0x01010101; \ + __u = (void *) __u + 4; \ case 12: \ - *__ts++ = __c * 0x01010101; \ + __u->__ui = __c * 0x01010101; \ + __u = (void *) __u + 4; \ case 8: \ - *__ts++ = __c * 0x01010101; \ + __u->__ui = __c * 0x01010101; \ + __u = (void *) __u + 4; \ case 4: \ - *__ts = __c * 0x01010101; \ + __u->__ui = __c * 0x01010101; \ case 0: \ break; \ } \ @@ -169,7 +186,7 @@ __STRING2_COPY_TYPE (8); /* GCC optimizes memset(s, 0, n) but not bzero(s, n). The optimization is broken before EGCS 1.1. */ -#if __GNUC_PREREQ (2, 91) +# if __GNUC_PREREQ (2, 91) # define __bzero(s, n) __builtin_memset (s, '\0', n) # endif @@ -207,48 +224,60 @@ __mempcpy_small (void *__dest1, __uint32_t __src0_4, __uint32_t __src4_4, size_t __srclen) { - char *__dest = (char *) __dest1; + union { + __uint32_t __ui; + __uint16_t __usi; + unsigned char __uc; + unsigned char __c; + } *__u = __dest1; switch (__srclen) { case 1: - *__dest++ = __src0_1; + __u->__c = __src0_1; + __u = (void *) __u + 1; break; case 2: - *((__uint16_t *) __dest) = __src0_2; - __dest += 2; + __u->__usi = __src0_2; + __u = (void *) __u + 2; break; case 3: - *((__uint16_t *) __dest) = __src0_2; - __dest += 2; - *__dest++ = __src2_1; + __u->__usi = __src0_2; + __u = (void *) __u + 2; + __u->__c = __src2_1; + __u = (void *) __u + 1; break; case 4: - *((__uint32_t *) __dest) = __src0_4; - __dest += 4; + __u->__ui = __src0_4; + __u = (void *) __u + 4; break; case 5: - *((__uint32_t *) __dest) = __src0_4; - __dest += 4; - *__dest++ = __src4_1; + __u->__ui = __src0_4; + __u = (void *) __u + 4; + __u->__c = __src4_1; + __u = (void *) __u + 1; break; case 6: - *((__uint32_t *) __dest) = __src0_4; - *((__uint16_t *) (__dest + 4)) = __src4_2; - __dest += 6; + __u->__ui = __src0_4; + __u = (void *) __u + 4; + __u->__usi = __src4_2; + __u = (void *) __u + 2; break; case 7: - *((__uint32_t *) __dest) = __src0_4; - *((__uint16_t *) (__dest + 4)) = __src4_2; - __dest += 6; - *__dest++ = __src6_1; + __u->__ui = __src0_4; + __u = (void *) __u + 4; + __u->__usi = __src4_2; + __u = (void *) __u + 2; + __u->__c = __src6_1; + __u = (void *) __u + 1; break; case 8: - *((__uint32_t *) __dest) = __src0_4; - *((__uint32_t *) (__dest + 4)) = __src4_4; - __dest += 8; + __u->__ui = __src0_4; + __u = (void *) __u + 4; + __u->__ui = __src4_4; + __u = (void *) __u + 4; break; } - return (void *) __dest; + return (void *) __u; } # else # define __mempcpy_args(src) \ @@ -287,41 +316,50 @@ __STRING_INLINE void *__mempcpy_small (void *, char, __STRING2_COPY_ARR2, __STRING2_COPY_ARR7, __STRING2_COPY_ARR8, size_t); __STRING_INLINE void * -__mempcpy_small (void *__dest1, char __src1, +__mempcpy_small (void *__dest, char __src1, __STRING2_COPY_ARR2 __src2, __STRING2_COPY_ARR3 __src3, __STRING2_COPY_ARR4 __src4, __STRING2_COPY_ARR5 __src5, __STRING2_COPY_ARR6 __src6, __STRING2_COPY_ARR7 __src7, __STRING2_COPY_ARR8 __src8, size_t __srclen) { - char *__dest = (char *) __dest1; + union { + char __c; + __STRING2_COPY_ARR2 __sca2; + __STRING2_COPY_ARR3 __sca3; + __STRING2_COPY_ARR4 __sca4; + __STRING2_COPY_ARR5 __sca5; + __STRING2_COPY_ARR6 __sca6; + __STRING2_COPY_ARR7 __sca7; + __STRING2_COPY_ARR8 __sca8; + } *__u = __dest; switch (__srclen) { case 1: - *__dest = __src1; + __u->__c = __src1; break; case 2: - __extension__ *((__STRING2_COPY_ARR2 *) __dest) = __src2; + __extension__ __u->__sca2 = __src2; break; case 3: - __extension__ *((__STRING2_COPY_ARR3 *) __dest) = __src3; + __extension__ __u->__sca3 = __src3; break; case 4: - __extension__ *((__STRING2_COPY_ARR4 *) __dest) = __src4; + __extension__ __u->__sca4 = __src4; break; case 5: - __extension__ *((__STRING2_COPY_ARR5 *) __dest) = __src5; + __extension__ __u->__sca5 = __src5; break; case 6: - __extension__ *((__STRING2_COPY_ARR6 *) __dest) = __src6; + __extension__ __u->__sca6 = __src6; break; case 7: - __extension__ *((__STRING2_COPY_ARR7 *) __dest) = __src7; + __extension__ __u->__sca7 = __src7; break; case 8: - __extension__ *((__STRING2_COPY_ARR8 *) __dest) = __src8; + __extension__ __u->__sca8 = __src8; break; } - return (void *) (__dest + __srclen); + return __extension__ ((void *) __u + __srclen); } # endif # endif @@ -362,37 +400,48 @@ __strcpy_small (char *__dest, __uint32_t __src0_4, __uint32_t __src4_4, size_t __srclen) { + union { + __uint32_t __ui; + __uint16_t __usi; + unsigned char __uc; + } *__u = (void *) __dest; switch (__srclen) { case 1: - *__dest = '\0'; + __u->__uc = '\0'; break; case 2: - *((__uint16_t *) __dest) = __src0_2; + __u->__usi = __src0_2; break; case 3: - *((__uint16_t *) __dest) = __src0_2; - *(__dest + 2) = '\0'; + __u->__usi = __src0_2; + __u = (void *) __u + 2; + __u->__uc = '\0'; break; case 4: - *((__uint32_t *) __dest) = __src0_4; + __u->__ui = __src0_4; break; case 5: - *((__uint32_t *) __dest) = __src0_4; - *(__dest + 4) = '\0'; + __u->__ui = __src0_4; + __u = (void *) __u + 4; + __u->__uc = '\0'; break; case 6: - *((__uint32_t *) __dest) = __src0_4; - *((__uint16_t *) (__dest + 4)) = __src4_2; + __u->__ui = __src0_4; + __u = (void *) __u + 4; + __u->__usi = __src4_2; break; case 7: - *((__uint32_t *) __dest) = __src0_4; - *((__uint16_t *) (__dest + 4)) = __src4_2; - *(__dest + 6) = '\0'; + __u->__ui = __src0_4; + __u = (void *) __u + 4; + __u->__usi = __src4_2; + __u = (void *) __u + 2; + __u->__uc = '\0'; break; case 8: - *((__uint32_t *) __dest) = __src0_4; - *((__uint32_t *) (__dest + 4)) = __src4_4; + __u->__ui = __src0_4; + __u = (void *) __u + 4; + __u->__usi = __src4_4; break; } return __dest; @@ -439,31 +488,41 @@ __strcpy_small (char *__dest, __STRING2_COPY_ARR6 __src6, __STRING2_COPY_ARR7 __src7, __STRING2_COPY_ARR8 __src8, size_t __srclen) { + union { + char __c; + __STRING2_COPY_ARR2 __sca2; + __STRING2_COPY_ARR3 __sca3; + __STRING2_COPY_ARR4 __sca4; + __STRING2_COPY_ARR5 __sca5; + __STRING2_COPY_ARR6 __sca6; + __STRING2_COPY_ARR7 __sca7; + __STRING2_COPY_ARR8 __sca8; + } *__u = __dest; switch (__srclen) { case 1: - *__dest = '\0'; + __u->__c = '\0'; break; case 2: - __extension__ *((__STRING2_COPY_ARR2 *) __dest) = __src2; + __extension__ __u->__sca2 = __src2; break; case 3: - __extension__ *((__STRING2_COPY_ARR3 *) __dest) = __src3; + __extension__ __u->__sca3 = __src3; break; case 4: - __extension__ *((__STRING2_COPY_ARR4 *) __dest) = __src4; + __extension__ __u->__sca4 = __src4; break; case 5: - __extension__ *((__STRING2_COPY_ARR5 *) __dest) = __src5; + __extension__ __u->__sca5 = __src5; break; case 6: - __extension__ *((__STRING2_COPY_ARR6 *) __dest) = __src6; + __extension__ __u->__sca6 = __src6; break; case 7: - __extension__ *((__STRING2_COPY_ARR7 *) __dest) = __src7; + __extension__ __u->__sca7 = __src7; break; case 8: - __extension__ *((__STRING2_COPY_ARR8 *) __dest) = __src8; + __extension__ __u->__sca8 = __src8; break; } return __dest; @@ -500,47 +559,55 @@ __stpcpy_small (char *__dest, __uint32_t __src0_4, __uint32_t __src4_4, size_t __srclen) { + union { + unsigned int __ui; + unsigned short int __usi; + unsigned char __uc; + } *__u = (void *) __dest; switch (__srclen) { case 1: - *__dest = '\0'; + __u->__uc = '\0'; break; case 2: - *((__uint16_t *) __dest) = __src0_2; - ++__dest; + __u->__usi = __src0_2; + __u = (void *) __u + 1; break; case 3: - *((__uint16_t *) __dest) = __src0_2; - __dest += sizeof (__uint16_t); - *__dest = '\0'; + __u->__usi = __src0_2; + __u = (void *) __u + 2; + __u->__uc = '\0'; break; case 4: - *((__uint32_t *) __dest) = __src0_4; - __dest += 3; + __u->__ui = __src0_4; + __u = (void *) __u + 3; break; case 5: - *((__uint32_t *) __dest) = __src0_4; - __dest += 4; - *__dest = '\0'; + __u->__ui = __src0_4; + __u = (void *) __u + 4; + __u->__uc = '\0'; break; case 6: - *((__uint32_t *) __dest) = __src0_4; - *((__uint16_t *) (__dest + 4)) = __src4_2; - __dest += 5; + __u->__ui = __src0_4; + __u = (void *) __u + 4; + __u->__usi = __src4_2; + __u = (void *) __u + 1; break; case 7: - *((__uint32_t *) __dest) = __src0_4; - *((__uint16_t *) (__dest + 4)) = __src4_2; - __dest += 6; - *__dest = '\0'; + __u->__ui = __src0_4; + __u = (void *) __u + 4; + __u->__usi = __src4_2; + __u = (void *) __u + 2; + __u->__uc = '\0'; break; case 8: - *((__uint32_t *) __dest) = __src0_4; - *((__uint32_t *) (__dest + 4)) = __src4_4; - __dest += 7; + __u->__ui = __src0_4; + __u = (void *) __u + 4; + __u->__ui = __src4_4; + __u = (void *) __u + 3; break; } - return __dest; + return &__u->__uc; } # else # define __stpcpy_args(src) \ @@ -584,31 +651,41 @@ __stpcpy_small (char *__dest, __STRING2_COPY_ARR6 __src6, __STRING2_COPY_ARR7 __src7, __STRING2_COPY_ARR8 __src8, size_t __srclen) { + union { + char __c; + __STRING2_COPY_ARR2 __sca2; + __STRING2_COPY_ARR3 __sca3; + __STRING2_COPY_ARR4 __sca4; + __STRING2_COPY_ARR5 __sca5; + __STRING2_COPY_ARR6 __sca6; + __STRING2_COPY_ARR7 __sca7; + __STRING2_COPY_ARR8 __sca8; + } *__u = __dest; switch (__srclen) { case 1: - *__dest = '\0'; + __u->__uc = '\0'; break; case 2: - __extension__ *((__STRING2_COPY_ARR2 *) __dest) = __src2; + __extension__ __u->__sca2 = __src2; break; case 3: - __extension__ *((__STRING2_COPY_ARR3 *) __dest) = __src3; + __extension__ __u->__sca3 = __src3; break; case 4: - __extension__ *((__STRING2_COPY_ARR4 *) __dest) = __src4; + __extension__ __u->__sca4 = __src4; break; case 5: - __extension__ *((__STRING2_COPY_ARR5 *) __dest) = __src5; + __extension__ __u->__sca5 = __src5; break; case 6: - __extension__ *((__STRING2_COPY_ARR6 *) __dest) = __src6; + __extension__ __u->__sca6 = __src6; break; case 7: - __extension__ *((__STRING2_COPY_ARR7 *) __dest) = __src7; + __extension__ __u->__sca7 = __src7; break; case 8: - __extension__ *((__STRING2_COPY_ARR8 *) __dest) = __src8; + __extension__ __u->__sca8 = __src8; break; } return __dest + __srclen - 1; diff --git a/sysdeps/generic/glob.c b/sysdeps/generic/glob.c index 9b134c5a0d..1ab5d8b629 100644 --- a/sysdeps/generic/glob.c +++ b/sysdeps/generic/glob.c @@ -155,12 +155,6 @@ extern void abort (), exit (); #endif /* Standard headers. */ -#ifdef HAVE_GETLOGIN_R -extern int getlogin_r __P ((char *, size_t)); -#else -extern char *getlogin __P ((void)); -#endif - #ifndef ANSI_STRING # ifndef bzero @@ -286,6 +280,12 @@ extern char *alloca (); # undef GLOB_PERIOD #endif #include <glob.h> + +#ifdef HAVE_GETLOGIN_R +extern int getlogin_r __P ((char *, size_t)); +#else +extern char *getlogin __P ((void)); +#endif static #if __GNUC__ - 0 >= 2 diff --git a/sysdeps/i386/bits/string.h b/sysdeps/i386/bits/string.h index 1ea0571680..5f4f58a6db 100644 --- a/sysdeps/i386/bits/string.h +++ b/sysdeps/i386/bits/string.h @@ -54,59 +54,65 @@ __STRING_INLINE void * __memcpy_c (void *__dest, __const void *__src, size_t __n) { register unsigned long int __d0, __d1, __d2; + union { + unsigned int __ui; + unsigned short int __usi; + unsigned char __uc; + } *__u = __dest; switch (__n) { case 0: return __dest; case 1: - *(unsigned char *) __dest = *(const unsigned char *) __src; + __u->__uc = *(const unsigned char *) __src; return __dest; case 2: - *(unsigned short int *) __dest = *(const unsigned short int *) __src; + __u->__usi = *(const unsigned short int *) __src; return __dest; case 3: - *(unsigned short int *) __dest = *(const unsigned short int *) __src; - *(2 + (unsigned char *) __dest) = *(2 + (const unsigned char *) __src); + __u->__usi = *(const unsigned short int *) __src; + __u = (void *) __u + 2; + __u->__uc = *(2 + (const unsigned char *) __src); return __dest; case 4: - *(unsigned long int *) __dest = *(const unsigned long int *) __src; + __u->__ui = *(const unsigned int *) __src; return __dest; - case 6: /* for ethernet addresses */ - *(unsigned long int *) __dest = *(const unsigned long int *) __src; - *(2 + (unsigned short int *) __dest) = - *(2 + (const unsigned short int *) __src); + case 6: + __u->__ui = *(const unsigned int *) __src; + __u = (void *) __u + 4; + __u->__usi = *(2 + (const unsigned short int *) __src); return __dest; case 8: - *(unsigned long int *) __dest = *(const unsigned long int *) __src; - *(1 + (unsigned long int *) __dest) = - *(1 + (const unsigned long int *) __src); + __u->__ui = *(const unsigned int *) __src; + __u = (void *) __u + 4; + __u->__ui = *(1 + (const unsigned int *) __src); return __dest; case 12: - *(unsigned long int *) __dest = *(const unsigned long int *) __src; - *(1 + (unsigned long int *) __dest) = - *(1 + (const unsigned long int *) __src); - *(2 + (unsigned long int *) __dest) = - *(2 + (const unsigned long int *) __src); + __u->__ui = *(const unsigned int *) __src; + __u = (void *) __u + 4; + __u->__ui = *(1 + (const unsigned int *) __src); + __u = (void *) __u + 4; + __u->__ui = *(2 + (const unsigned int *) __src); return __dest; case 16: - *(unsigned long int *) __dest = *(const unsigned long int *) __src; - *(1 + (unsigned long int *) __dest) = - *(1 + (const unsigned long int *) __src); - *(2 + (unsigned long int *) __dest) = - *(2 + (const unsigned long int *) __src); - *(3 + (unsigned long int *) __dest) = - *(3 + (const unsigned long int *) __src); + __u->__ui = *(const unsigned int *) __src; + __u = (void *) __u + 4; + __u->__ui = *(1 + (const unsigned int *) __src); + __u = (void *) __u + 4; + __u->__ui = *(2 + (const unsigned int *) __src); + __u = (void *) __u + 4; + __u->__ui = *(3 + (const unsigned int *) __src); return __dest; case 20: - *(unsigned long int *) __dest = *(const unsigned long int *) __src; - *(1 + (unsigned long int *) __dest) = - *(1 + (const unsigned long int *) __src); - *(2 + (unsigned long int *) __dest) = - *(2 + (const unsigned long int *) __src); - *(3 + (unsigned long int *) __dest) = - *(3 + (const unsigned long int *) __src); - *(4 + (unsigned long int *) __dest) = - *(4 + (const unsigned long int *) __src); + __u->__ui = *(const unsigned int *) __src; + __u = (void *) __u + 4; + __u->__ui = *(1 + (const unsigned int *) __src); + __u = (void *) __u + 4; + __u->__ui = *(2 + (const unsigned int *) __src); + __u = (void *) __u + 4; + __u->__ui = *(3 + (const unsigned int *) __src); + __u = (void *) __u + 4; + __u->__ui = *(4 + (const unsigned int *) __src); return __dest; } #define __COMMON_CODE(x) \ @@ -115,7 +121,7 @@ __memcpy_c (void *__dest, __const void *__src, size_t __n) "rep; movsl" \ x \ : "=&c" (__d0), "=&D" (__d1), "=&S" (__d2) \ - : "0" (__n / 4), "1" (__dest), "2" (__src) \ + : "0" (__n / 4), "1" (&__u->__uc), "2" (__src) \ : "memory"); switch (__n % 4) @@ -184,22 +190,28 @@ __STRING_INLINE void * __memset_cc (void *__s, unsigned long int __pattern, size_t __n) { register unsigned long int __d0, __d1; + union { + unsigned int __ui; + unsigned short int __usi; + unsigned char __uc; + } *__u = __s; switch (__n) { case 0: return __s; case 1: - *(unsigned char *) __s = __pattern; + __u->__uc = __pattern; return __s; case 2: - *(unsigned short int *) __s = __pattern; + __u->__usi = __pattern; return __s; case 3: - *(unsigned short int *) __s = __pattern; - *(2 + (unsigned char *) __s) = __pattern; + __u->__usi = __pattern; + __u = __extension__ ((void *) __u + 1); + __u->__uc = __pattern; return __s; case 4: - *(unsigned long *) __s = __pattern; + __u->__ui = __pattern; return __s; } #define __COMMON_CODE(x) \ @@ -208,7 +220,7 @@ __memset_cc (void *__s, unsigned long int __pattern, size_t __n) "rep; stosl" \ x \ : "=&c" (__d0), "=&D" (__d1) \ - : "a" (__pattern), "0" (__n / 4), "1" (__s) \ + : "a" (__pattern), "0" (__n / 4), "1" (&__u->__uc) \ : "memory") switch (__n % 4) diff --git a/sysdeps/i386/i486/bits/string.h b/sysdeps/i386/i486/bits/string.h index 39edc6ec56..8857a7178a 100644 --- a/sysdeps/i386/i486/bits/string.h +++ b/sysdeps/i386/i486/bits/string.h @@ -211,12 +211,17 @@ memcmp (__const void *__s1, __const void *__s2, size_t __n) #define __memset_gc(s, c, n) \ ({ void *__s = (s); \ - unsigned int *__ts = (unsigned int *) __s; \ + union { \ + unsigned int __ui; \ + unsigned short int __usi; \ + unsigned char __uc; \ + } *__u = __s; \ unsigned int __c = ((unsigned int) ((unsigned char) (c))) * 0x01010101; \ \ /* We apply a trick here. `gcc' would implement the following \ - assignments using absolute operands. But this uses to much \ - memory (7, instead of 4 bytes). */ \ + assignments using immediate operands. But this uses to much \ + memory (7, instead of 4 bytes). So we force the value in a \ + registers. */ \ if (n == 3 || n >= 5) \ __asm__ __volatile__ ("" : "=r" (__c) : "0" (__c)); \ \ @@ -224,44 +229,57 @@ memcmp (__const void *__s1, __const void *__s2, size_t __n) switch (n) \ { \ case 15: \ - *__ts++ = __c; \ + __u->__ui = __c; \ + __u = (void *) __u + 4; \ case 11: \ - *__ts++ = __c; \ + __u->__ui = __c; \ + __u = (void *) __u + 4; \ case 7: \ - *__ts++ = __c; \ + __u->__ui = __c; \ + __u = (void *) __u + 4; \ case 3: \ - *((unsigned short int *) __ts)++ = (unsigned short int) __c; \ - *((unsigned char *) __ts) = (unsigned char) __c; \ + __u->__usi = (unsigned short int) __c; \ + __u = (void *) __u + 2; \ + __u->__uc = (unsigned char) __c; \ break; \ \ case 14: \ - *__ts++ = __c; \ + __u->__ui = __c; \ + __u = (void *) __u + 4; \ case 10: \ - *__ts++ = __c; \ + __u->__ui = __c; \ + __u = (void *) __u + 4; \ case 6: \ - *__ts++ = __c; \ + __u->__ui = __c; \ + __u = (void *) __u + 4; \ case 2: \ - *((unsigned short int *) __ts) = (unsigned short int) __c; \ + __u->__usi = (unsigned short int) __c; \ break; \ \ case 13: \ - *__ts++ = __c; \ + __u->__ui = __c; \ + __u = (void *) __u + 4; \ case 9: \ - *__ts++ = __c; \ + __u->__ui = __c; \ + __u = (void *) __u + 4; \ case 5: \ - *__ts++ = __c; \ + __u->__ui = __c; \ + __u = (void *) __u + 4; \ case 1: \ - *((unsigned char *) __ts) = (unsigned char) __c; \ + __u->__uc = (unsigned char) __c; \ break; \ \ case 16: \ - *__ts++ = __c; \ + __u->__ui = __c; \ + __u = (void *) __u + 4; \ case 12: \ - *__ts++ = __c; \ + __u->__ui = __c; \ + __u = (void *) __u + 4; \ case 8: \ - *__ts++ = __c; \ + __u->__ui = __c; \ + __u = (void *) __u + 4; \ case 4: \ - *__ts = __c; \ + __u->__ui = __c; \ case 0: \ break; \ } \ @@ -494,48 +512,50 @@ __strlen_g (__const char *__str) : __strcpy_g (dest, src))) #define __strcpy_small(dest, src, srclen) \ - (__extension__ ({ unsigned char *__dest = (unsigned char *) (dest); \ + (__extension__ ({ char *__dest = (dest); \ + union { \ + unsigned int __ui; \ + unsigned short int __usi; \ + unsigned char __uc; \ + char __c; \ + } *__u = (void *) __dest; \ switch (srclen) \ { \ case 1: \ - *__dest = '\0'; \ + __u->__uc = '\0'; \ break; \ case 2: \ - *((unsigned short int *) __dest) = \ - __STRING_SMALL_GET16 (src, 0); \ + __u->__usi = __STRING_SMALL_GET16 (src, 0); \ break; \ case 3: \ - *((unsigned short int *) __dest) = \ - __STRING_SMALL_GET16 (src, 0); \ - *(__dest + 2) = '\0'; \ + __u->__usi = __STRING_SMALL_GET16 (src, 0); \ + __u = (void *) __u + 2; \ + __u->__uc = '\0'; \ break; \ case 4: \ - *((unsigned int *) __dest) = \ - __STRING_SMALL_GET32 (src, 0); \ + __u->__ui = __STRING_SMALL_GET32 (src, 0); \ break; \ case 5: \ - *((unsigned int *) __dest) = \ - __STRING_SMALL_GET32 (src, 0); \ - *(__dest + 4) = '\0'; \ + __u->__ui = __STRING_SMALL_GET32 (src, 0); \ + __u = (void *) __u + 4; \ + __u->__uc = '\0'; \ break; \ case 6: \ - *((unsigned int *) __dest) = \ - __STRING_SMALL_GET32 (src, 0); \ - *((unsigned short int *) (__dest + 4)) = \ - __STRING_SMALL_GET16 (src, 4); \ + __u->__ui = __STRING_SMALL_GET32 (src, 0); \ + __u = (void *) __u + 4; \ + __u->__usi = __STRING_SMALL_GET16 (src, 4); \ break; \ case 7: \ - *((unsigned int *) __dest) = \ - __STRING_SMALL_GET32 (src, 0); \ - *((unsigned short int *) (__dest + 4)) = \ - __STRING_SMALL_GET16 (src, 4); \ - *(__dest + 6) = '\0'; \ + __u->__ui = __STRING_SMALL_GET32 (src, 0); \ + __u = (void *) __u + 4; \ + __u->__usi = __STRING_SMALL_GET16 (src, 4); \ + __u = (void *) __u + 2; \ + __u->__uc = '\0'; \ break; \ case 8: \ - *((unsigned int *) __dest) = \ - __STRING_SMALL_GET32 (src, 0); \ - *((unsigned int *) (__dest + 4)) = \ - __STRING_SMALL_GET32 (src, 4); \ + __u->__ui = __STRING_SMALL_GET32 (src, 0); \ + __u = (void *) __u + 4; \ + __u->__ui = __STRING_SMALL_GET32 (src, 4); \ break; \ } \ (char *) __dest; })) @@ -583,56 +603,56 @@ __strcpy_g (char *__dest, __const char *__src) # define stpcpy(dest, src) __stpcpy (dest, src) # define __stpcpy_small(dest, src, srclen) \ - (__extension__ ({ unsigned char *__dest = (unsigned char *) (dest); \ + (__extension__ ({ union { \ + unsigned int __ui; \ + unsigned short int __usi; \ + unsigned char __uc; \ + char __c; \ + } *__u = (void *) (dest); \ switch (srclen) \ { \ case 1: \ - *__dest = '\0'; \ + __u->__uc = '\0'; \ break; \ case 2: \ - *((unsigned short int *) __dest) = \ - __STRING_SMALL_GET16 (src, 0); \ - ++__dest; \ + __u->__usi = __STRING_SMALL_GET16 (src, 0); \ + __u = (void *) __u + 1; \ break; \ case 3: \ - *((unsigned short int *) __dest)++ = \ - __STRING_SMALL_GET16 (src, 0); \ - *__dest = '\0'; \ + __u->__usi = __STRING_SMALL_GET16 (src, 0); \ + __u = (void *) __u + 2; \ + __u->__uc = '\0'; \ break; \ case 4: \ - *((unsigned int *) __dest) = \ - __STRING_SMALL_GET32 (src, 0); \ - __dest += 3; \ + __u->__ui = __STRING_SMALL_GET32 (src, 0); \ + __u = (void *) __u + 3; \ break; \ case 5: \ - *((unsigned int *) __dest)++ = \ - __STRING_SMALL_GET32 (src, 0); \ - *__dest = '\0'; \ + __u->__ui = __STRING_SMALL_GET32 (src, 0); \ + __u = (void *) __u + 4; \ + __u->__uc = '\0'; \ break; \ case 6: \ - *((unsigned int *) __dest) = \ - __STRING_SMALL_GET32 (src, 0); \ - *((unsigned short int *) (__dest + 4)) = \ - __STRING_SMALL_GET16 (src, 4); \ - __dest += 5; \ + __u->__ui = __STRING_SMALL_GET32 (src, 0); \ + __u = (void *) __u + 4; \ + __u->__usi = __STRING_SMALL_GET16 (src, 4); \ + __u = (void *) __u + 1; \ break; \ case 7: \ - *((unsigned int *) __dest) = \ - __STRING_SMALL_GET32 (src, 0); \ - *((unsigned short int *) (__dest + 4)) = \ - __STRING_SMALL_GET16 (src, 4); \ - __dest += 6; \ - *__dest = '\0'; \ + __u->__ui = __STRING_SMALL_GET32 (src, 0); \ + __u = (void *) __u + 4; \ + __u->__usi = __STRING_SMALL_GET16 (src, 4); \ + __u = (void *) __u + 2; \ + __u->__uc = '\0'; \ break; \ case 8: \ - *((unsigned int *) __dest) = \ - __STRING_SMALL_GET32 (src, 0); \ - *((unsigned int *) (__dest + 4)) = \ - __STRING_SMALL_GET32 (src, 4); \ - __dest += 7; \ + __u->__ui = __STRING_SMALL_GET32 (src, 0); \ + __u = (void *) __u + 4; \ + __u->__ui = __STRING_SMALL_GET32 (src, 4); \ + __u = (void *) __u + 3; \ break; \ } \ - (char *) __dest; })) + (char *) __u; })) __STRING_INLINE char *__mempcpy_by4 (char *__dest, __const char *__src, size_t __srclen); diff --git a/sysdeps/powerpc/dl-machine.c b/sysdeps/powerpc/dl-machine.c index cf918fab03..9e158c9865 100644 --- a/sysdeps/powerpc/dl-machine.c +++ b/sysdeps/powerpc/dl-machine.c @@ -176,6 +176,11 @@ __elf_machine_runtime_setup (struct link_map *map, int lazy, int profile) ? _dl_prof_resolve : _dl_runtime_resolve); + if (profile && _dl_name_match_p (_dl_profile, map)) + /* This is the object we are looking for. Say that we really + want profiling and the timers are started. */ + _dl_profile_map = map; + if (lazy) for (i = 0; i < num_plt_entries; i++) { |