From jakub@redhat.com Fri May 4 12:05:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Fri, 04 May 2001 12:05:00 -0000 Subject: [PATCH] Define __NO_INLINE__ if not inlining Message-ID: <20010504210719.E935@sunsite.ms.mff.cuni.cz> Hi! Some glibc optimizations (namely bits/string2.h) check whether inlining will be done and if so, optimize, otherwise don't do anything. The check used there is currently: #if defined __GNUC__ && __GNUC__ >= 2 # if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ && !defined __cplusplus # ifndef __NO_STRING_INLINES ... This works well most of the time, but fails badly if people do: #include and use -O2 -fno-inline (e.g. avifile does that, some others as well). What do you think about the following patch which would define __NO_INLINE__ if inline keyword won't be honored, so that glibc could use that check as well? 2001-05-04 Jakub Jelinek Hi! Now that gcc defines __NO_INLINE__ unless -O1+ was used and no -fno-inline was specified, here is a patch to actually use it in glibc, so that -O2 -fno-inline #include work. Alternatively, the ctype/stdlib/wchar checks could be replaced by simple #ifdef __USE_EXTERN_INLINES, since the other conditions are guarded in features.h (and anyone who uses -D__USE_EXTERN_INLINES with -fno-inline or -O1 and up just deserves what he wanted). If you'd like me to prepare this variant of the patch, just let me know. 2001-05-05 Jakub Jelinek * ctype/ctype.h (tolower, toupper): Only define as extern inline if __NO_INLINE__ is not defined. * include/features.h (__USE_EXTERN_INLINES): Likewise. * stdlib/stdlib.h (strtod, ...): Likewise. * wcsmbs/wchar (mbrlen): Likewise. * string/string.h: Only include bits/string.h and bits/string2.h if __NO_INLINE__ is not defined. --- libc/ctype/ctype.h.jj Thu Sep 14 09:09:36 2000 +++ libc/ctype/ctype.h Sat May 5 15:54:12 2001 @@ -164,7 +164,7 @@ __exctype (_tolower); # endif # if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ \ - && defined __USE_EXTERN_INLINES + && !defined __NO_INLINE__ && defined __USE_EXTERN_INLINES extern __inline int tolower (int __c) __THROW { --- libc/include/features.h.jj Thu Nov 9 10:09:04 2000 +++ libc/include/features.h Sat May 5 15:53:53 2001 @@ -293,7 +293,8 @@ #endif /* !ASSEMBLER */ /* Decide whether we can define 'extern inline' functions in headers. */ -#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ +#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \ + && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__ # define __USE_EXTERN_INLINES 1 #endif --- libc/stdlib/stdlib.h.jj Thu Feb 8 13:20:28 2001 +++ libc/stdlib/stdlib.h Sat May 5 15:53:33 2001 @@ -288,7 +288,7 @@ extern unsigned long long int __strtoull #endif /* GCC */ #if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ \ - && defined __USE_EXTERN_INLINES + && !defined __NO_INLINE__ && defined __USE_EXTERN_INLINES /* Define inline functions which call the internal entry points. */ extern __inline double --- libc/string/string.h.jj Tue Apr 17 23:58:43 2001 +++ libc/string/string.h Sat May 5 15:53:11 2001 @@ -333,7 +333,8 @@ extern char *basename (__const char *__f #if defined __GNUC__ && __GNUC__ >= 2 -# if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ && !defined __cplusplus +# if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ \ + && !defined __NO_INLINE__ && !defined __cplusplus /* When using GNU CC we provide some optimized versions of selected functions from this header. There are two kinds of optimizations: --- libc/wcsmbs/wchar.h.jj Tue Apr 17 23:59:00 2001 +++ libc/wcsmbs/wchar.h Sat May 5 15:52:57 2001 @@ -285,7 +285,7 @@ extern size_t mbrlen (__const char *__re mbstate_t *__restrict __ps) __THROW; #if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ \ - && defined __USE_EXTERN_INLINES + && !defined __NO_INLINE__ && defined __USE_EXTERN_INLINES /* Define inline function as optimization. */ extern __inline size_t mbrlen (__const char *__restrict __s, size_t __n, mbstate_t *__restrict __ps) __THROW Jakub From aj@suse.de Sat May 5 09:09:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Sat, 05 May 2001 09:09:00 -0000 Subject: [PATCH] Use __NO_INLINE__ checks in glibc headers References: <20010505145259.I935@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > Hi! > > Now that gcc defines __NO_INLINE__ unless -O1+ was used and no -fno-inline was > specified, here is a patch to actually use it in glibc, so that -O2 -fno-inline > #include > work. > Alternatively, the ctype/stdlib/wchar checks could be replaced by simple > #ifdef __USE_EXTERN_INLINES, since the other conditions are guarded in > features.h (and anyone who uses -D__USE_EXTERN_INLINES with -fno-inline or > -O1 and up just deserves what he wanted). If you'd like me to prepare this > variant of the patch, just let me know. IMO that variant would be the cleaner solution, Andreas -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From jakub@redhat.com Sat May 5 09:36:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Sat, 05 May 2001 09:36:00 -0000 Subject: [PATCH] Use __NO_INLINE__ checks in glibc headers (take 2) References: <20010505145259.I935@sunsite.ms.mff.cuni.cz> Message-ID: <20010505183900.J935@sunsite.ms.mff.cuni.cz> On Sat, May 05, 2001 at 05:48:10PM +0200, Andreas Jaeger wrote: > IMO that variant would be the cleaner solution, Here it is: 2001-05-05 Jakub Jelinek * include/features.h (__USE_EXTERN_INLINES): Don't define if __NO_INLINE__ is defined. * ctype/ctype.h (tolower, toupper): Change the guard condition to __USE_EXTERN_INLINES check only. * stdlib/stdlib.h (strtod, ...): Likewise. * wcsmbs/wchar (mbrlen): Likewise. * string/string.h: Only include bits/string.h and bits/string2.h if __NO_INLINE__ is not defined. --- libc/ctype/ctype.h.jj Thu Sep 14 09:09:36 2000 +++ libc/ctype/ctype.h Sat May 5 19:41:49 2001 @@ -163,8 +163,7 @@ __exctype (_tolower); # define isblank(c) __isctype((c), _ISblank) # endif -# if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ \ - && defined __USE_EXTERN_INLINES +# ifdef __USE_EXTERN_INLINES extern __inline int tolower (int __c) __THROW { --- libc/include/features.h.jj Thu Nov 9 10:09:04 2000 +++ libc/include/features.h Sat May 5 15:53:53 2001 @@ -293,7 +293,8 @@ #endif /* !ASSEMBLER */ /* Decide whether we can define 'extern inline' functions in headers. */ -#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ +#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \ + && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__ # define __USE_EXTERN_INLINES 1 #endif --- libc/stdlib/stdlib.h.jj Thu Feb 8 13:20:28 2001 +++ libc/stdlib/stdlib.h Sat May 5 19:42:21 2001 @@ -287,8 +287,7 @@ extern unsigned long long int __strtoull # endif #endif /* GCC */ -#if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ \ - && defined __USE_EXTERN_INLINES +#ifdef __USE_EXTERN_INLINES /* Define inline functions which call the internal entry points. */ extern __inline double --- libc/string/string.h.jj Tue Apr 17 23:58:43 2001 +++ libc/string/string.h Sat May 5 15:53:11 2001 @@ -333,7 +333,8 @@ extern char *basename (__const char *__f #if defined __GNUC__ && __GNUC__ >= 2 -# if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ && !defined __cplusplus +# if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ \ + && !defined __NO_INLINE__ && !defined __cplusplus /* When using GNU CC we provide some optimized versions of selected functions from this header. There are two kinds of optimizations: --- libc/wcsmbs/wchar.h.jj Tue Apr 17 23:59:00 2001 +++ libc/wcsmbs/wchar.h Sat May 5 19:42:46 2001 @@ -284,8 +284,7 @@ extern size_t __mbrlen (__const char *__ extern size_t mbrlen (__const char *__restrict __s, size_t __n, mbstate_t *__restrict __ps) __THROW; -#if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ \ - && defined __USE_EXTERN_INLINES +#ifdef __USE_EXTERN_INLINES /* Define inline function as optimization. */ extern __inline size_t mbrlen (__const char *__restrict __s, size_t __n, mbstate_t *__restrict __ps) __THROW Jakub From aj@suse.de Sat May 5 09:58:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Sat, 05 May 2001 09:58:00 -0000 Subject: [PATCH] Use __NO_INLINE__ checks in glibc headers (take 2) References: <20010505145259.I935@sunsite.ms.mff.cuni.cz> <20010505183900.J935@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > On Sat, May 05, 2001 at 05:48:10PM +0200, Andreas Jaeger wrote: > > IMO that variant would be the cleaner solution, > > Here it is: > > 2001-05-05 Jakub Jelinek > > * include/features.h (__USE_EXTERN_INLINES): Don't define if > __NO_INLINE__ is defined. > * ctype/ctype.h (tolower, toupper): Change the guard condition to > __USE_EXTERN_INLINES check only. > * stdlib/stdlib.h (strtod, ...): Likewise. > * wcsmbs/wchar (mbrlen): Likewise. > * string/string.h: Only include bits/string.h and bits/string2.h > if __NO_INLINE__ is not defined. Thanks. This looks fine. I'll give others the chance to comment on it and will commit it on monday if nobody sees a problem. Andreas -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From aj@suse.de Sun May 6 05:04:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Sun, 06 May 2001 05:04:00 -0000 Subject: First patch for i386/fpu function Message-ID: Here's a small patch for some easy functions. Ok to commit? Andreas 2001-05-06 Andreas Jaeger * sysdeps/i386/fpu/e_acosl.c: New, rewrite of e_acos.S. * sysdeps/i386/fpu/s_atanl.c: New, rewrite of e_atanl.S. * sysdeps/i386/fpu/e_sqrtl.c: New, rewrite of e_sqrt.S. * sysdeps/i386/fpu/e_acosl.S: Removed. * sysdeps/i386/fpu/s_atanl.S: Removed. * sysdeps/i386/fpu/e_sqrtl.S: Removed. ============================================================ Index: sysdeps/i386/fpu/e_acosl.c --- sysdeps/i386/fpu/e_acosl.c created +++ sysdeps/i386/fpu/e_acosl.c Sun May 6 13:39:44 2001 1.1 @@ -0,0 +1,25 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * + * Adapted for `long double' by Ulrich Drepper . + */ + +#include + +long double +__ieee754_acosl (long double x) +{ + long double res; + + /* acosl = atanl (sqrtl(1 - x^2) / x) */ + asm ( "fld %%st\n" + "fmul %%st(0)\n" /* x^2 */ + "fld1\n" + "fsubp\n" /* 1 - x^2 */ + "fsqrt\n" /* sqrtl (1 - x^2) */ + "fxch %%st(1)\n" + "fpatan" + : "=t" (res) : "0" (x) : "st(1)"); + return res; +} ============================================================ Index: sysdeps/i386/fpu/s_atanl.c --- sysdeps/i386/fpu/s_atanl.c created +++ sysdeps/i386/fpu/s_atanl.c Sun May 6 13:36:01 2001 1.1 @@ -0,0 +1,22 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * + * Adapted for `long double' by Ulrich Drepper . + */ + +#include + +long double +__atanl (long double x) +{ + long double res; + + asm ("fld1\n" + "fpatan" + : "=t" (res) : "0" (x)); + + return res; +} + +weak_alias (__atanl, atanl) ============================================================ Index: sysdeps/i386/fpu/e_sqrtl.c --- sysdeps/i386/fpu/e_sqrtl.c created +++ sysdeps/i386/fpu/e_sqrtl.c Sun May 6 13:35:46 2001 1.1 @@ -0,0 +1,18 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * + * Adapted for `long double' by Ulrich Drepper . + */ + +#include + +long double +__ieee754_sqrtl (long double x) +{ + long double res; + + asm ("fsqrt" : "=t" (res) : "0" (x)); + + return res; +} ============================================================ Index: sysdeps/i386/fpu/e_acosl.S --- sysdeps/i386/fpu/e_acosl.S Sun May 6 13:42:34 2001 1.1 +++ sysdeps/i386/fpu/e_acosl.S removed @@ -1,22 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * - * Adapted for `long double' by Ulrich Drepper . - */ - -#include - - -/* acosl = atanl (sqrtl(1 - x^2) / x) */ -ENTRY(__ieee754_acosl) - fldt 4(%esp) /* x */ - fld %st - fmul %st(0) /* x^2 */ - fld1 - fsubp /* 1 - x^2 */ - fsqrt /* sqrtl (1 - x^2) */ - fxch %st(1) - fpatan - ret -END (__ieee754_acosl) ============================================================ Index: sysdeps/i386/fpu/s_atanl.S --- sysdeps/i386/fpu/s_atanl.S Sun May 6 13:42:34 2001 1.1 +++ sysdeps/i386/fpu/s_atanl.S removed @@ -1,18 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * - * Adapted for `long double' by Ulrich Drepper . - */ - -#include - -RCSID("$NetBSD: $") - -ENTRY(__atanl) - fldt 4(%esp) - fld1 - fpatan - ret -END (__atanl) -weak_alias (__atanl, atanl) ============================================================ Index: sysdeps/i386/fpu/e_sqrtl.S --- sysdeps/i386/fpu/e_sqrtl.S Sun May 6 13:42:34 2001 1.1 +++ sysdeps/i386/fpu/e_sqrtl.S removed @@ -1,16 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * - * Adapted for `long double' by Ulrich Drepper . - */ - -#include - -RCSID("$NetBSD: $") - -ENTRY(__ieee754_sqrtl) - fldt 4(%esp) - fsqrt - ret -END (__ieee754_sqrtl) -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From drepper@redhat.com Sun May 6 09:58:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Sun, 06 May 2001 09:58:00 -0000 Subject: First patch for i386/fpu function References: Message-ID: Andreas Jaeger writes: > Here's a small patch for some easy functions. > > Ok to commit? Yes. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From aj@suse.de Sun May 6 10:38:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Sun, 06 May 2001 10:38:00 -0000 Subject: two more i386/fpu files Message-ID: Ok to commit? Andreas 2001-05-06 Andreas Jaeger * sysdeps/i386/fpu/e_fmodl.c: New, rewrite of e_fmodl.S. * sysdeps/i386/fpu/e_fmodl.S: Remove.d * sysdeps/i386/fpu/e_atan2l.c: New, rewrite of e_atan2l.S. * sysdeps/i386/fpu/e_atan2l.S: Removed. ============================================================ Index: sysdeps/i386/fpu/e_fmodl.c --- sysdeps/i386/fpu/e_fmodl.c created +++ sysdeps/i386/fpu/e_fmodl.c Sun May 6 18:59:56 2001 1.1 @@ -0,0 +1,22 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * + * Adapted for `long double' by Ulrich Drepper . + */ + +#include + +long double +__ieee754_fmodl (long double x, long double y) +{ + long double res; + + asm ("1:\tfprem\n" + "fstsw %%ax\n" + "sahf\n" + "jp 1b\n" + "fstp %%st(1)" + : "=t" (res) : "0" (x), "u" (y) : "ax", "st(1)"); + return res; +} ============================================================ Index: sysdeps/i386/fpu/e_atan2l.c --- sysdeps/i386/fpu/e_atan2l.c created +++ sysdeps/i386/fpu/e_atan2l.c Sun May 6 13:59:12 2001 1.1 @@ -0,0 +1,18 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * + * Adapted for `long double' by Ulrich Drepper . + */ + +#include + +long double +__ieee754_atan2l (long double y, long double x) +{ + long double res; + + asm ("fpatan" : "=t" (res) : "u" (y), "0" (x) : "st(1)"); + + return res; +} ============================================================ Index: sysdeps/i386/fpu/e_fmodl.S --- sysdeps/i386/fpu/e_fmodl.S Wed Jul 14 01:22:08 1999 1.1 +++ sysdeps/i386/fpu/e_fmodl.S removed @@ -1,21 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * - * Adapted for `long double' by Ulrich Drepper . - */ - -#include - -RCSID("$NetBSD: $") - -ENTRY(__ieee754_fmodl) - fldt 16(%esp) - fldt 4(%esp) -1: fprem - fstsw %ax - sahf - jp 1b - fstp %st(1) - ret -END (__ieee754_fmodl) ============================================================ Index: sysdeps/i386/fpu/e_atan2l.S --- sysdeps/i386/fpu/e_atan2l.S Wed Jul 14 01:21:18 1999 1.1 +++ sysdeps/i386/fpu/e_atan2l.S removed @@ -1,17 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * - * Adapted for `long double' by Ulrich Drepper . - */ - -#include - -RCSID("$NetBSD: $") - -ENTRY(__ieee754_atan2l) - fldt 4(%esp) - fldt 16(%esp) - fpatan - ret -END (__ieee754_atan2l) -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From drepper@redhat.com Sun May 6 10:47:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Sun, 06 May 2001 10:47:00 -0000 Subject: two more i386/fpu files References: Message-ID: Andreas Jaeger writes: > Ok to commit? Yes. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From aj@suse.de Mon May 7 01:52:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Mon, 07 May 2001 01:52:00 -0000 Subject: xtrace broken? Message-ID: Hi, Has anybody been successfull in using xtrace with the current CVS version? I don't get any output at all... Andreas -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From aj@suse.de Mon May 7 03:22:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Mon, 07 May 2001 03:22:00 -0000 Subject: config.guess/config.sub imported Message-ID: I've imported the current config.* files from gnu.org. Those contain the local change from Dave Miller for sparcv9b. Andreas -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From schwab@suse.de Wed May 9 09:22:00 2001 From: schwab@suse.de (Andreas Schwab) Date: Wed, 09 May 2001 09:22:00 -0000 Subject: readdir may not modify errno at EOF Message-ID: When readdir returns NULL it is supposed to keep errno unmodified when EOF was reached (and no error occured). But __getdents may be changing it even when sucessfull, so we need to save its value around the call. Andreas. 2001-05-09 Andreas Schwab * sysdeps/unix/readdir.c: Make sure we don't modify errno when we reached EOF. --- sysdeps/unix/readdir.c.~1.18.~ Mon Aug 14 12:07:29 2000 +++ sysdeps/unix/readdir.c Wed May 9 14:14:03 2001 @@ -39,6 +39,7 @@ __READDIR (DIR *dirp) { DIRENT_TYPE *dp; + int saved_errno = errno; __libc_lock_lock (dirp->lock); @@ -63,6 +64,9 @@ bytes = __GETDENTS (dirp->fd, dirp->data, maxread); if (bytes <= 0) { + /* Don't modifiy errno when reaching EOF. */ + if (bytes == 0) + __set_errno (saved_errno); dp = NULL; break; } -- Andreas Schwab "And now for something SuSE Labs completely different." Andreas.Schwab@suse.de SuSE GmbH, Schanz????ckerstr. 10, D-90443 N????rnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 From aj@suse.de Wed May 9 09:33:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Wed, 09 May 2001 09:33:00 -0000 Subject: readdir may not modify errno at EOF References: Message-ID: Andreas Schwab writes: > When readdir returns NULL it is supposed to keep errno unmodified when EOF > was reached (and no error occured). But __getdents may be changing it > even when sucessfull, so we need to save its value around the call. This is ok and in accordance with the Austin Draft (just checked), please commit, Andreas -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From jakub@redhat.com Thu May 10 05:50:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Thu, 10 May 2001 05:50:00 -0000 Subject: [PATCH] Restore dlsym(RTLD_NEXT, ...) behaviour Message-ID: <20010510145235.B503@sunsite.ms.mff.cuni.cz> Hi! Informix uses dlsym(RTLD_NEXT, "foo") in the main program, which used to work but does not work any longer. IMHO dlsym(RTLD_NEXT, "foo") in the main program makes sense, consider something like: #define _GNU_SOURCE #include int getpid() { return 32; } int main(void) { void *p = (void *)getpid; void *q = dlsym (RTLD_DEFAULT, "getpid"); void *r = dlsym (RTLD_NEXT, "getpid"); printf ("%p %p %p\n", p, q, r); } It looks like this was changed when strict map range checking was added to dl-sym.c. The patch below does not catch all cases where the error could be signalled, but I think it is better if it works in the main program than to catch them all (alternatively, the code could e.g. find at least smallest l_map_start above _dl_loaded->l_map_start and check if caller is less than that; BTW: why isn't l_map_end for the main program deducted from Elf_Phdr?). What is also needed is some variant of either H.J.'s _dl_signal_error or e.g. the attached one (so that signalling error in real statically linked application works). Jakub From aj@suse.de Thu May 10 06:07:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Thu, 10 May 2001 06:07:00 -0000 Subject: [PATCH] Restore dlsym(RTLD_NEXT, ...) behaviour References: <20010510145235.B503@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > Hi! > > Informix uses dlsym(RTLD_NEXT, "foo") in the main program, which used to > work but does not work any longer. > IMHO dlsym(RTLD_NEXT, "foo") in the main program makes sense, consider > something like: > #define _GNU_SOURCE > #include > int getpid() > { > return 32; > } > int main(void) > { > void *p = (void *)getpid; > void *q = dlsym (RTLD_DEFAULT, "getpid"); > void *r = dlsym (RTLD_NEXT, "getpid"); > printf ("%p %p %p\n", p, q, r); > } Can you reformat this example suitable for the testsuite together with a patch for the Makefile, please? > It looks like this was changed when strict map range checking was added to > dl-sym.c. The patch below does not catch all cases where the error could be > signalled, but I think it is better if it works in the main program than to > catch them all (alternatively, the code could e.g. find at least smallest > l_map_start above _dl_loaded->l_map_start and check if caller is less than > that; BTW: why isn't l_map_end for the main program deducted from > Elf_Phdr?). > What is also needed is some variant of either H.J.'s _dl_signal_error or > e.g. the attached one (so that signalling error in real statically linked > application works). The patch looks fine but I'll leave those for Ulrich to check, Andreas -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From drepper@redhat.com Thu May 10 09:00:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Thu, 10 May 2001 09:00:00 -0000 Subject: [PATCH] Restore dlsym(RTLD_NEXT, ...) behaviour References: <20010510145235.B503@sunsite.ms.mff.cuni.cz> Message-ID: Andreas Jaeger writes: > The patch looks fine but I'll leave those for Ulrich to check, No, the patch makes no sense. The parameter is named RTLD_NEXT not without reason. *NEXT* means you have already found one instance. You have to use RTLD_DEFAULT for the first search. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From schwab@suse.de Thu May 10 09:24:00 2001 From: schwab@suse.de (Andreas Schwab) Date: Thu, 10 May 2001 09:24:00 -0000 Subject: Linuxthreads stack size on ia64 Message-ID: The default thread stack size in linuxthreads is 2MB. This is pretty small for a 64 bit system, and on the ia64 this is even divided between the processor stack and the register stack. This patch enlages the size to 64MB on ia64. This should perhaps be changed for other 64bit targets as well. Andreas. 2001-05-10 Andreas Schwab * sysdeps/ia64/pt-machine.h (STACK_SIZE): Set to 64MB. --- sysdeps/ia64/pt-machine.h.~1.2.~ Tue Jan 2 10:42:11 2001 +++ sysdeps/ia64/pt-machine.h Thu May 10 17:47:56 2001 @@ -104,3 +104,6 @@ return ret; } + +/* The max size of the thread stack segments. */ +#define STACK_SIZE (64 * 1024 * 1024) -- Andreas Schwab "And now for something SuSE Labs completely different." Andreas.Schwab@suse.de SuSE GmbH, Schanz????ckerstr. 10, D-90443 N????rnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 From jakub@redhat.com Thu May 10 09:34:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Thu, 10 May 2001 09:34:00 -0000 Subject: [PATCH] Restore dlsym(RTLD_NEXT, ...) behaviour References: <20010510145235.B503@sunsite.ms.mff.cuni.cz> Message-ID: <20010510183625.C503@sunsite.ms.mff.cuni.cz> On Thu, May 10, 2001 at 08:59:38AM -0700, Ulrich Drepper wrote: > Andreas Jaeger writes: > > > The patch looks fine but I'll leave those for Ulrich to check, > > No, the patch makes no sense. The parameter is named RTLD_NEXT not > without reason. *NEXT* means you have already found one instance. > You have to use RTLD_DEFAULT for the first search. But as I've tried to explain in the test, RTLD_DEFAULT gives a different answer than RTLD_NEXT would even for the main program. In the test, the main program (= _dl_loaded) provides some symbol, when you want the next such symbol, you definitely cannot use RTLD_DEFAULT. A modified example: #define _GNU_SOURCE #include #include pid_t getpid(void) { pid_t (*f)(void); f = (pid_t (*)(void)) dlsym (RTLD_NEXT, "getpid"); return f() + 26; } pid_t pid; int main(void) { pid = getpid(); } Jakub From drepper@redhat.com Thu May 10 09:42:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Thu, 10 May 2001 09:42:00 -0000 Subject: Linuxthreads stack size on ia64 References: Message-ID: Andreas Schwab writes: > The default thread stack size in linuxthreads is 2MB. This is pretty > small for a 64 bit system, and on the ia64 this is even divided between > the processor stack and the register stack. This patch enlages the size > to 64MB on ia64. This should perhaps be changed for other 64bit targets > as well. I don't think this is a good idea. The problem is that all the page for the stack are allocated at once. The lazy allocation with the automatic stack growing cannot be used. Therefore such an increase has pretty big consequences. I would agree that a 64 bit architecture should probably have twice the stack size (so 4MB). For IA-64 I haven't seen any numbers suggesting that the two stack require each 4MB. Remember, the register stack content is places on the normal stack on other systems so it's not an additional requirement. Where I do agree there is a problem is that we are currently using STACK_SIZE for two purposes: to limit the total stack size the user can set and to determine the default stack size in case on attribute is available at thread creation time. I would have not problem whatsoever for separate the two uses for platforms with a thread register and make the maximum stack size the user can select much bigger. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Thu May 10 10:02:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Thu, 10 May 2001 10:02:00 -0000 Subject: [PATCH] Restore dlsym(RTLD_NEXT, ...) behaviour References: <20010510145235.B503@sunsite.ms.mff.cuni.cz> <20010510183625.C503@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > But as I've tried to explain in the test, RTLD_DEFAULT gives a different > answer than RTLD_NEXT would even for the main program. This is the test case I would have accepted: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #include #include pid_t getpid(void) { pid_t (*f)(void); f = (pid_t (*)(void)) dlsym (RTLD_NEXT, "getpid"); return f() + 26; } pid_t pid; int main(void) { pid_t (*f)(void); f = (pid_t (*)(void)) dlsym (RTLD_DEFAULT, "getpid"); pid = f(); return 0; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Now, if your patch is fixing this and *only* this then it's OK. Please also provide patches to add a test case like the one above (with -rdynamic etc). -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From aj@suse.de Thu May 10 11:15:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Thu, 10 May 2001 11:15:00 -0000 Subject: Patch for install.texi Message-ID: We should clarify that 2.2 is really minimal. I'll commit this tomorrow unless somebody finds errors or complains, Andreas 2001-05-10 Andreas Jaeger * manual/install.texi (Linux): Clarify that Linux 2.2 is minimal requirement. ============================================================ Index: manual/install.texi --- manual/install.texi 2001/04/19 20:13:55 1.53 +++ manual/install.texi 2001/05/10 18:01:47 @@ -495,12 +495,14 @@ @cindex upgrading from libc5 @cindex kernel header files -If you are installing GNU libc on a Linux system, you need to have -the header files from a 2.2 kernel around for reference. You do not -need to use the 2.2 kernel, just have its headers where glibc can access -at them. The easiest way to do this is to unpack it in a directory -such as @file{/usr/src/linux-2.2.1}. In that directory, run -@samp{make config} and accept all the defaults. Then run @samp{make +If you are installing GNU libc on a Linux system, you need to have the +header files from a 2.2 or newer kernel around for reference. For some +architectures, like ia64, sh and hppa, you need at least headers from +kernel 2.3.99 (sh and hppa) or 2.4.0 (ia64). You do not need to use +that kernel, just have its headers where glibc can access at them. The +easiest way to do this is to unpack it in a directory such as +@file{/usr/src/linux-2.2.1}. In that directory, run @samp{make config} +and accept all the defaults. Then run @samp{make include/linux/version.h}. Finally, configure glibc with the option @samp{--with-headers=/usr/src/linux-2.2.1/include}. Use the most recent kernel you can get your hands on. -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From jakub@redhat.com Thu May 10 15:32:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Thu, 10 May 2001 15:32:00 -0000 Subject: [PATCH] Restore dlsym(RTLD_NEXT, ...) behaviour (take 2) References: <20010510145235.B503@sunsite.ms.mff.cuni.cz> <20010510183625.C503@sunsite.ms.mff.cuni.cz> Message-ID: <20010511003409.D503@sunsite.ms.mff.cuni.cz> On Thu, May 10, 2001 at 10:01:38AM -0700, Ulrich Drepper wrote: > Jakub Jelinek writes: > > > But as I've tried to explain in the test, RTLD_DEFAULT gives a different > > answer than RTLD_NEXT would even for the main program. > > This is the test case I would have accepted: Ok, here are two variants of the patch. The first one requires more code (though within not-__builtin_expected if) and will catch and report attempts to call dlsym(RTLD_NEXT, ) even from places above main program not belonging to DSOs, the second one will only report those for statically linked binaries or if caller is below start of main program (otherwise if the caller does not belong to a particular DSO it will assume it is from main program). Pick the one you like more. Note that dlsym(RTLD_DEFAULT, ) will segfault in static programs anyway, so it is questionable how good the RTLD_NEXT error reporting has to be. Both patches include the testcase, which passed make check. Jakub From schwab@suse.de Fri May 11 07:45:00 2001 From: schwab@suse.de (Andreas Schwab) Date: Fri, 11 May 2001 07:45:00 -0000 Subject: \w does not match '_' Message-ID: The regex "\\w" is supposed to match an alphabetic or numeric character or '_'. It does that if regex.c is compiled without multibyte support, due to the way the re_syntax_table is initialized, but if multibyte support is enabled only iswalnum is used. Andreas. -- Andreas Schwab "And now for something SuSE Labs completely different." Andreas.Schwab@suse.de SuSE GmbH, Schanz????ckerstr. 10, D-90443 N????rnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 From aj@suse.de Fri May 11 08:31:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Fri, 11 May 2001 08:31:00 -0000 Subject: Remove some warnings with IBM'S mathlib Message-ID: I get a number of warnings in the math code. Here's a patch that I'll commit later to remove some of them. Still open are warnings like: ../sysdeps/ieee754/dbl-64/sincos32.c:111: warning: no previous prototype for `__c32' ../sysdeps/ieee754/dbl-64/sincos32.c:136: warning: no previous prototype for `__sin32' ../sysdeps/ieee754/dbl-64/sincos32.c:160: warning: no previous prototype for `__cos32' ../sysdeps/ieee754/dbl-64/doasin.c:40: warning: no previous prototype for `__doasin' I propose to add all the declarations to math_private.h. Or is there a better way to do this? Andreas 2001-05-11 Andreas Jaeger * sysdeps/ieee754/dbl-64/e_asin.c: Include "math_private.h" for internal prototypes. * sysdeps/ieee754/dbl-64/s_atan.c: Likewise. * sysdeps/ieee754/dbl-64/e_sqrt.c: Likewise. * sysdeps/ieee754/dbl-64/e_remainder.c: Likewise. * sysdeps/ieee754/dbl-64/e_pow.c: Likewise. * sysdeps/ieee754/dbl-64/e_log.c: Likewise. * sysdeps/ieee754/dbl-64/e_exp.c: Likewise. * sysdeps/ieee754/dbl-64/e_atan2.c: Likewise. * sysdeps/generic/e_rem_pio2l.c: Likewise. (__ieee754_rem_pio2l): Fix prototype. * math/math_private.h (__copysign): Add internal prototype. ============================================================ Index: sysdeps/ieee754/dbl-64/e_asin.c --- sysdeps/ieee754/dbl-64/e_asin.c 2001/03/12 22:51:16 1.4 +++ sysdeps/ieee754/dbl-64/e_asin.c 2001/05/11 15:27:03 @@ -39,6 +39,7 @@ #include "powtwo.tbl" #include "MathLib.h" #include "uasncs.h" +#include "math_private.h" void __doasin(double x, double dx, double w[]); void __dubsin(double x, double dx, double v[]); ============================================================ Index: sysdeps/ieee754/dbl-64/e_sqrt.c --- sysdeps/ieee754/dbl-64/e_sqrt.c 2001/04/19 19:14:52 1.5 +++ sysdeps/ieee754/dbl-64/e_sqrt.c 2001/05/11 15:27:04 @@ -37,6 +37,7 @@ #include "dla.h" #include "MathLib.h" #include "root.tbl" +#include "math_private.h" /*********************************************************************/ /* An ultimate aqrt routine. Given an IEEE double machine number x */ ============================================================ Index: sysdeps/ieee754/dbl-64/e_remainder.c --- sysdeps/ieee754/dbl-64/e_remainder.c 2001/03/13 01:59:14 1.5 +++ sysdeps/ieee754/dbl-64/e_remainder.c 2001/05/11 15:27:04 @@ -33,6 +33,7 @@ #include "mydefs.h" #include "urem.h" #include "MathLib.h" +#include "math_private.h" /**************************************************************************/ /* An ultimate remainder routine. Given two IEEE double machine numbers x */ ============================================================ Index: sysdeps/ieee754/dbl-64/e_pow.c --- sysdeps/ieee754/dbl-64/e_pow.c 2001/03/13 01:51:59 1.7 +++ sysdeps/ieee754/dbl-64/e_pow.c 2001/05/11 15:27:04 @@ -40,6 +40,7 @@ #include "mydefs.h" #include "MathLib.h" #include "upow.tbl" +#include "math_private.h" double __exp1(double x, double xx, double error); ============================================================ Index: sysdeps/ieee754/dbl-64/e_log.c --- sysdeps/ieee754/dbl-64/e_log.c 2001/03/12 20:04:31 1.6 +++ sysdeps/ieee754/dbl-64/e_log.c 2001/05/11 15:27:05 @@ -38,6 +38,8 @@ #include "dla.h" #include "mpa.h" #include "MathLib.h" +#include "math_private.h" + void __mplog(mp_no *, mp_no *, int); /*********************************************************************/ ============================================================ Index: sysdeps/ieee754/dbl-64/e_exp.c --- sysdeps/ieee754/dbl-64/e_exp.c 2001/03/12 06:47:26 1.4 +++ sysdeps/ieee754/dbl-64/e_exp.c 2001/05/11 15:27:05 @@ -33,10 +33,12 @@ /***************************************************************************/ #include "endian.h" -#include "uexp.h" +#include "uexp.h" #include "mydefs.h" #include "MathLib.h" #include "uexp.tbl" +#include "math_private.h" + double __slowexp(double); /***************************************************************************/ ============================================================ Index: sysdeps/ieee754/dbl-64/e_atan2.c --- sysdeps/ieee754/dbl-64/e_atan2.c 2001/03/12 20:04:08 1.6 +++ sysdeps/ieee754/dbl-64/e_atan2.c 2001/05/11 15:27:06 @@ -41,6 +41,8 @@ #include "MathLib.h" #include "uatan.tbl" #include "atnat2.h" +#include "math_private.h" + /************************************************************************/ /* An ultimate atan2 routine. Given two IEEE double machine numbers y,x */ /* it computes the correctly rounded (to nearest) value of atan2(y,x). */ ============================================================ Index: sysdeps/generic/e_rem_pio2l.c --- sysdeps/generic/e_rem_pio2l.c 1997/10/13 03:52:13 1.1 +++ sysdeps/generic/e_rem_pio2l.c 2001/05/11 15:27:06 @@ -1,8 +1,9 @@ #include #include #include +#include "math_private.h" -long double +int __ieee754_rem_pio2l (long double x, long double *y) { fputs ("__ieee754_rem_pio2l not implemented\n", stderr); ============================================================ Index: math/math_private.h --- math/math_private.h 2000/09/27 06:59:31 1.13 +++ math/math_private.h 2001/05/11 15:27:06 @@ -188,7 +188,10 @@ extern double __kernel_tan (double,double,int); extern int __kernel_rem_pio2 (double*,double*,int,int,int, const int32_t*); +/* internal functions. */ +extern double __copysign (double x, double __y); + /* ieee style elementary float functions */ extern float __ieee754_sqrtf (float); extern float __ieee754_acosf (float); @@ -219,6 +222,7 @@ extern float __ieee754_remainderf (float,float); extern int32_t __ieee754_rem_pio2f (float,float*); extern float __ieee754_scalbf (float,float); + /* float versions of fdlibm kernel functions */ extern float __kernel_sinf (float,float,int); -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From jakub@redhat.com Fri May 11 09:28:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Fri, 11 May 2001 09:28:00 -0000 Subject: [PATCH] Fix another MBS regex failure Message-ID: <20010511183016.H503@sunsite.ms.mff.cuni.cz> Hi! The following testcase fails with MBS_SUPPORT enabled regex. There are two issues: the code is swapping strings if second string is zero size and first non-NULL, but we were not swapping their MBS data together with them (cstring* are not used any more, so it is enough to swap mbs_offset* and csize*). Also, if stop is past csize1 + csize2, count_mbs_length would return -1 and things would fail, because end_match_2 would point before string2 (unlike non-MBS, where stop however large is simply added to string2 to compute end_match_2). 2001-05-11 Jakub Jelinek * posix/regex.c (re_match_2_internal): Swap mbs_offset and csize as well if swapping strings. Make sure stop is not past end of second string. * posix/bug-regex4.c: New test. * posix/Makefile (tests): Add bug-regex4. --- libc/posix/regex.c.jj Tue Apr 17 23:58:42 2001 +++ libc/posix/regex.c Fri May 11 19:13:13 2001 @@ -5595,6 +5595,12 @@ re_match_2_internal (bufp, string1, size size2 = size1; string1 = 0; size1 = 0; +#ifdef MBS_SUPPORT + mbs_offset2 = mbs_offset1; + csize2 = csize1; + mbs_offset1 = NULL; + csize1 = 0; +#endif } end1 = string1 + size1; end2 = string2 + size2; @@ -5609,6 +5615,8 @@ re_match_2_internal (bufp, string1, size } else { + if (stop > csize1 + csize2) + stop = csize1 + csize2; end_match_1 = end1; mcnt = count_mbs_length(mbs_offset2, stop-csize1); end_match_2 = string2 + mcnt; --- libc/posix/bug-regex4.c.jj Fri May 11 19:21:36 2001 +++ libc/posix/bug-regex4.c Fri May 11 19:34:15 2001 @@ -0,0 +1,60 @@ +/* Test for re_search_2. + Copyright (C) 2001 Free Software Foundation, Inc. + Contributed by Jakub Jelinek , 2001. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include +#include +#include + +int +main (void) +{ + struct re_pattern_buffer regex; + const char *s; + int match[3]; + int result = 0; + + memset (®ex, '\0', sizeof (regex)); + + setlocale (LC_ALL, "C"); + + setlocale (LC_ALL, "C"); + s = re_compile_pattern ("ab[cde]", 7, ®ex); + if (s != NULL) + { + puts ("re_compile_pattern return non-NULL value"); + result = 1; + } + else + { + match[0] = re_search_2 (®ex, "xyabez", 6, "", 0, 1, 9, NULL, 10); + match[1] = re_search_2 (®ex, NULL, 0, "abc", 3, 0, 3, NULL, 3); + match[2] = re_search_2 (®ex, "xya", 3, "bd", 2, 2, 6, NULL, 8); + if (match[0] != 2 || match[1] != 0 || match[2] != 2) + { + printf ("re_match returned %d,%d,%d, expected 2,0,2\n", + match[0], match[1], match[2]); + result = 1; + } + else + puts (" -> OK"); + } + + return result; +} --- libc/posix/Makefile.jj Wed Apr 25 12:39:49 2001 +++ libc/posix/Makefile Fri May 11 19:35:28 2001 @@ -69,7 +69,8 @@ tests := tstgetopt testfnm runtests run tst-preadwrite tst-preadwrite64 test-vfork regexbug1 \ tst-getlogin tst-mmap tst-getaddrinfo tst-truncate \ tst-truncate64 tst-fork tst-fnmatch tst-regexloc tst-dir \ - tst-chmod bug-regex1 bug-regex2 bug-regex3 tst-gnuglob + tst-chmod bug-regex1 bug-regex2 bug-regex3 bug-regex4 \ + tst-gnuglob ifeq (yes,$(build-shared)) test-srcs := globtest tests += wordexp-test tst-exec tst-spawn Jakub From drepper@redhat.com Fri May 11 09:47:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Fri, 11 May 2001 09:47:00 -0000 Subject: Remove some warnings with IBM'S mathlib References: Message-ID: Andreas Jaeger writes: > I propose to add all the declarations to math_private.h. Or is there > a better way to do this? This is as good as anything else. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From aj@suse.de Mon May 14 02:27:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Mon, 14 May 2001 02:27:00 -0000 Subject: [PATCH] Fix another MBS regex failure References: <20010511183016.H503@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > Hi! > > The following testcase fails with MBS_SUPPORT enabled regex. > There are two issues: the code is swapping strings if second string is zero > size and first non-NULL, but we were not swapping their MBS data together > with them (cstring* are not used any more, so it is enough to swap > mbs_offset* and csize*). Also, if stop is past csize1 + csize2, > count_mbs_length would return -1 and things would fail, because end_match_2 > would point before string2 (unlike non-MBS, where stop however large is > simply added to string2 to compute end_match_2). > > 2001-05-11 Jakub Jelinek > > * posix/regex.c (re_match_2_internal): Swap mbs_offset and csize > as well if swapping strings. > Make sure stop is not past end of second string. > * posix/bug-regex4.c: New test. > * posix/Makefile (tests): Add bug-regex4. Committed, Thanks, Andreas -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From aj@suse.de Mon May 14 13:01:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Mon, 14 May 2001 13:01:00 -0000 Subject: libm-tests parameters Message-ID: Stephen Moshier noticed one thing that I neglected so far in libm-test: Some of the values I used as parameters can not be represented as an exact floating point value and therefore the result is incorrect if (as I currently do) I calculate the result exactly. I therefore like to change all parameters to values that can be written as exact values. This would imply the regeneration of all libm-test-ulps files, changing them does not make much sense. What do you think about this? Andreas -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From drepper@redhat.com Mon May 14 13:23:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Mon, 14 May 2001 13:23:00 -0000 Subject: libm-tests parameters References: Message-ID: Andreas Jaeger writes: > What do you think about this? Not before the 2.3 branch. The current code might not be OK but the disturbances created by the new tests is not worth it. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From aj@suse.de Tue May 15 00:34:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Tue, 15 May 2001 00:34:00 -0000 Subject: libm-tests parameters References: Message-ID: Ulrich Drepper writes: > Andreas Jaeger writes: > > > What do you think about this? > > Not before the 2.3 branch. The current code might not be OK but the > disturbances created by the new tests is not worth it. Ok, in that case I just add larger ulps and a comment to remind us. Andreas -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From aj@suse.de Tue May 15 01:00:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Tue, 15 May 2001 01:00:00 -0000 Subject: expm1l/expl patches Message-ID: I've committed the following patch, Andreas 2001-05-15 Andreas Jaeger * sysdeps/ieee754/ldbl-128/s_expm1l.c: New file, contributed by Stephen L Moshier . * sysdeps/i386/fpu/libm-test-ulps: Adjust for change. * math/libm-test.inc: Add comment with ToDo. * sysdeps/i386/fpu/e_expl.c: Rewritten to C and using a more accurate algorithm. Patch by Stephen L Moshier . * sysdeps/i386/fpu/e_expl.S: Removed. ============================================================ Index: sysdeps/i386/fpu/libm-test-ulps --- sysdeps/i386/fpu/libm-test-ulps 2001/05/14 09:24:51 1.28 +++ sysdeps/i386/fpu/libm-test-ulps 2001/05/15 07:54:47 @@ -484,13 +484,13 @@ # ctan Test "Real part of: ctan (-2 - 3 i) == 0.0037640256415042482 - 1.0032386273536098014 i": -ildouble: 437 -ldouble: 437 +ildouble: 439 +ldouble: 439 Test "Imaginary part of: ctan (-2 - 3 i) == 0.0037640256415042482 - 1.0032386273536098014 i": float: 1 ifloat: 1 -ildouble: 1 -ldouble: 1 +ildouble: 2 +ldouble: 2 Test "Real part of: ctan (0.7 + 1.2 i) == 0.1720734197630349001 + 0.9544807059989405538 i": double: 1 float: 1 @@ -506,13 +506,13 @@ # ctanh Test "Real part of: ctanh (-2 - 3 i) == -0.9653858790221331242 + 0.0098843750383224937 i": -ildouble: 2 -ldouble: 2 +ildouble: 5 +ldouble: 5 Test "Imaginary part of: ctanh (-2 - 3 i) == -0.9653858790221331242 + 0.0098843750383224937 i": float: 1 ifloat: 1 -ildouble: 23 -ldouble: 23 +ildouble: 25 +ldouble: 25 Test "Real part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i": Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i": float: 1 @@ -551,8 +551,8 @@ float: 12 idouble: 24 ifloat: 12 -ldouble: 4 -ildouble: 4 +ldouble: 12 +ildouble: 12 Test "erfc (9) == 0.41370317465138102381e-36": ldouble: 36 ildouble: 36 ============================================================ Index: math/libm-test.inc --- math/libm-test.inc 2001/05/14 08:14:51 1.33 +++ math/libm-test.inc 2001/05/15 07:54:47 @@ -104,7 +104,12 @@ - Compiler has errors With e.g. gcc 2.7.2.2 the test for cexp fails because of a compiler error. - */ + + + To Do: All parameter should be numbers that can be represented as + exact floating point values. Currently some values cannot be represented + exactly and therefore the result is not the expected result. +*/ #ifndef _GNU_SOURCE # define _GNU_SOURCE ============================================================ Index: sysdeps/ieee754/ldbl-128/s_expm1l.c --- sysdeps/ieee754/ldbl-128/s_expm1l.c created +++ sysdeps/ieee754/ldbl-128/s_expm1l.c Tue May 15 09:50:36 2001 1.1 @@ -0,0 +1,145 @@ +/* expm1l.c + * + * Exponential function, minus 1 + * 128-bit long double precision + * + * + * + * SYNOPSIS: + * + * long double x, y, expm1l(); + * + * y = expm1l( x ); + * + * + * + * DESCRIPTION: + * + * Returns e (2.71828...) raised to the x power, minus one. + * + * Range reduction is accomplished by separating the argument + * into an integer k and fraction f such that + * + * x k f + * e = 2 e. + * + * An expansion x + .5 x^2 + x^3 R(x) approximates exp(f) - 1 + * in the basic range [-0.5 ln 2, 0.5 ln 2]. + * + * + * ACCURACY: + * + * Relative error: + * arithmetic domain # trials peak rms + * IEEE -79,+MAXLOG 100,000 1.7e-34 4.5e-35 + * + */ + +/* Copyright 2001 by Stephen L. Moshier */ + + +#include "math.h" +#include "math_private.h" + +/* exp(x) - 1 = x + 0.5 x^2 + x^3 P(x)/Q(x) + -.5 ln 2 < x < .5 ln 2 + Theoretical peak relative error = 8.1e-36 */ + +static long double + P0 = 2.943520915569954073888921213330863757240E8L, + P1 = -5.722847283900608941516165725053359168840E7L, + P2 = 8.944630806357575461578107295909719817253E6L, + P3 = -7.212432713558031519943281748462837065308E5L, + P4 = 4.578962475841642634225390068461943438441E4L, + P5 = -1.716772506388927649032068540558788106762E3L, + P6 = 4.401308817383362136048032038528753151144E1L, + P7 = -4.888737542888633647784737721812546636240E-1L, + Q0 = 1.766112549341972444333352727998584753865E9L, + Q1 = -7.848989743695296475743081255027098295771E8L, + Q2 = 1.615869009634292424463780387327037251069E8L, + Q3 = -2.019684072836541751428967854947019415698E7L, + Q4 = 1.682912729190313538934190635536631941751E6L, + Q5 = -9.615511549171441430850103489315371768998E4L, + Q6 = 3.697714952261803935521187272204485251835E3L, + Q7 = -8.802340681794263968892934703309274564037E1L, + /* Q8 = 1.000000000000000000000000000000000000000E0 */ +/* C1 + C2 = ln 2 */ + + C1 = 6.93145751953125E-1L, + C2 = 1.428606820309417232121458176568075500134E-6L, +/* ln (2^16384 * (1 - 2^-113)) */ + maxlog = 1.1356523406294143949491931077970764891253E4L, +/* ln 2^-114 */ + minarg = -7.9018778583833765273564461846232128760607E1L, big = 2e4932L; + + +long double +__expm1l (long double x) +{ + long double px, qx, xx; + int32_t ix, sign; + ieee854_long_double_shape_type u; + int k; + + /* Overflow. */ + if (x > maxlog) + return (big * big); + + /* Minimum value. */ + if (x < minarg) + return (4.0 / big - 1.0L); + + /* Detect infinity and NaN. */ + u.value = x; + ix = u.parts32.w0; + sign = ix & 0x80000000; + ix &= 0x7fffffff; + if (ix >= 0x7fff0000) + { + /* Infinity. */ + if (((ix & 0xffff) | u.parts32.w1 | u.parts32.w2 | u.parts32.w3) == 0) + { + if (sign) + return -1.0L; + else + return x; + } + /* NaN. */ + return (x + x); + } + + /* Express x = ln 2 (k + remainder), remainder not exceeding 1/2. */ + xx = C1 + C2; /* ln 2. */ + px = __floorl (0.5 + x / xx); + k = px; + /* remainder times ln 2 */ + x -= px * C1; + x -= px * C2; + + /* Approximate exp(remainder ln 2). */ + px = (((((((P7 * x + + P6) * x + + P5) * x + P4) * x + P3) * x + P2) * x + P1) * x + P0) * x; + + qx = (((((((x + + Q7) * x + + Q6) * x + Q5) * x + Q4) * x + Q3) * x + Q2) * x + Q1) * x + Q0; + + xx = x * x; + qx = x + (0.5 * xx + xx * px / qx); + + /* exp(x) = exp(k ln 2) exp(remainder ln 2) = 2^k exp(remainder ln 2). + + We have qx = exp(remainder ln 2) - 1, so + exp(x) - 1 = 2^k (qx + 1) - 1 + = 2^k qx + 2^k - 1. */ + + px = ldexpl (1.0L, k); + x = px * qx + (px - 1.0); + return x; +} + +weak_alias (__expm1l, expm1l) +#ifdef NO_LONG_DOUBLE +strong_alias (__expm1, __expm1l) weak_alias (__expm1, expm1l) +#endif ============================================================ Index: sysdeps/i386/fpu/e_expl.c --- sysdeps/i386/fpu/e_expl.c created +++ sysdeps/i386/fpu/e_expl.c Tue May 15 09:54:41 2001 1.1 @@ -0,0 +1,75 @@ +/* + * Written by J.T. Conklin . + * Public domain. + * + * Adapted for `long double' by Ulrich Drepper . + */ + +/* + * The 8087 method for the exponential function is to calculate + * exp(x) = 2^(x log2(e)) + * after separating integer and fractional parts + * x log2(e) = i + f, |f| <= .5 + * 2^i is immediate but f needs to be precise for long double accuracy. + * Suppress range reduction error in computing f by the following. + * Separate x into integer and fractional parts + * x = xi + xf, |xf| <= .5 + * Separate log2(e) into the sum of an exact number c0 and small part c1. + * c0 + c1 = log2(e) to extra precision + * Then + * f = (c0 xi - i) + c0 xf + c1 x + * where c0 xi is exact and so also is (c0 xi - i). + * -- moshier@na-net.ornl.gov + */ + +static long double c0 = 1.44268798828125L; +static long double c1 = 7.05260771340735992468e-6L; + +long double +__ieee754_expl (long double x) +{ + long double res, t; + +/* I added the following ugly construct because expl(+-Inf) resulted + in NaN. The ugliness results from the bright minds at Intel. + For the i686 the code can be written better. + -- drepper@cygnus.com. */ + asm ("fxam\n\t" /* Is NaN or +-Inf? */ + "fstsw %%ax\n\t" + "movb $0x45, %%dh\n\t" + "andb %%ah, %%dh\n\t" + "cmpb $0x05, %%dh\n\t" + "je 1f\n\t" /* Is +-Inf, jump. */ + "fldl2e\n\t" /* 1 log2(e) */ + "fmul %%st(1),%%st\n\t" /* 1 x log2(e) */ + "frndint\n\t" /* 1 i */ + "fld %%st(1)\n\t" /* 2 x */ + "frndint\n\t" /* 2 xi */ + "fld %%st(1)\n\t" /* 3 i */ + "fldt c0\n\t" /* 4 c0 */ + "fld %%st(2)\n\t" /* 5 xi */ + "fmul %%st(1),%%st\n\t" /* 5 c0 xi */ + "fsubp %%st,%%st(2)\n\t" /* 4 f = c0 xi - i */ + "fld %%st(4)\n\t" /* 5 x */ + "fsub %%st(3),%%st\n\t" /* 5 xf = x - xi */ + "fmulp %%st,%%st(1)\n\t" /* 4 c0 xf */ + "faddp %%st,%%st(1)\n\t" /* 3 f = f + c0 xf */ + "fldt c1\n\t" /* 4 */ + "fmul %%st(4),%%st\n\t" /* 4 c1 * x */ + "faddp %%st,%%st(1)\n\t" /* 3 f = f + c1 * x */ + "f2xm1\n\t" /* 3 2^(fract(x * log2(e))) - 1 */ + "fld1\n\t" /* 4 1.0 */ + "faddp\n\t" /* 3 2^(fract(x * log2(e))) */ + "fstp %%st(1)\n\t" /* 2 */ + "fscale\n\t" /* 2 scale factor is st(1); e^x */ + "fstp %%st(1)\n\t" /* 1 */ + "fstp %%st(1)\n\t" /* 0 */ + "jmp 2f\n\t" + "1:\ttestl $0x200, %%eax\n\t" /* Test sign. */ + "jz 2f\n\t" /* If positive, jump. */ + "fstp %%st\n\t" + "fldz\n\t" /* Set result to 0. */ + "2:\t\n" + : "=t" (res) : "0" (x) : "ax", "dx"); + return res; +} -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From jakub@redhat.com Tue May 15 08:34:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Tue, 15 May 2001 08:34:00 -0000 Subject: [PATCH] The recent thread sunrpc change breaks statd (take 2) References: <20010506203552.A32397@lucon.org> <20010506204848.A300@lucon.org> Message-ID: <20010515173724.O503@sunsite.ms.mff.cuni.cz> On Sun, May 06, 2001 at 08:48:48PM -0700, H . J . Lu wrote: > Here is a patch. Actually, I don't see why we need two separate rpc_thread_variables structures. Either -lpthread is present in the scope libc is using, then __libc_internal_tsd_get will be non-NULL and thus on the first call to __rpc_thread_variables __libc_tsd_get(RPC_VARS) will give NULL (and that in turn will call the once function and give the default on the first call) or -lpthread is not present in the scope libc is using, in which case __libc_tsd_get(RPC_VARS) will always return the default. The only problematic place is IMHO when calloc fails, but that is problematic always; having two rpc_thread_variables static structures would just mean that the first thread for which calloc in __rpc_thread_variables failed would get unique thread variable set (but second and later threads would not get unique variable set anyway), having just one means already the first thread for which calloc fails won't get a unique set, which is not that big difference. 2001-05-15 Jakub Jelinek * sunrpc/rpc_thread.c (rpc_default): Remove. (__rpc_thread_destroy): Use __libc_tsd_RPC_VARS_mem instead of rpc_default. (rpc_thread_multi, __rpc_thread_svc_fdset, __rpc_thread_createerr, __rpc_thread_svc_pollfd, __rpc_thread_svc_max_pollfd): Likewise. * sunrpc/auth_none.c (authnone_private): Fix a typo. --- libc/sunrpc/rpc_thread.c.jj Mon Mar 26 10:02:32 2001 +++ libc/sunrpc/rpc_thread.c Tue May 15 18:33:25 2001 @@ -9,15 +9,11 @@ #ifdef _RPC_THREAD_SAFE_ -/* Variable used in non-threaded applications. */ +/* Variable used in non-threaded applications or for the first thread. */ static struct rpc_thread_variables __libc_tsd_RPC_VARS_mem; static struct rpc_thread_variables *__libc_tsd_RPC_VARS_data = &__libc_tsd_RPC_VARS_mem; - -/* This is the variable used for the first thread. */ -static struct rpc_thread_variables rpc_default; - /* * Task-variable destructor */ @@ -26,7 +22,7 @@ __rpc_thread_destroy (void) { struct rpc_thread_variables *tvp = __rpc_thread_variables(); - if (tvp != NULL && tvp != &rpc_default) { + if (tvp != NULL && tvp != &__libc_tsd_RPC_VARS_mem) { __rpc_thread_svc_cleanup (); __rpc_thread_clnt_cleanup (); __rpc_thread_key_cleanup (); @@ -47,7 +43,7 @@ __rpc_thread_destroy (void) static void rpc_thread_multi (void) { - __libc_tsd_set (RPC_VARS, &rpc_default); + __libc_tsd_set (RPC_VARS, &__libc_tsd_RPC_VARS_mem); } @@ -88,7 +84,7 @@ __rpc_thread_svc_fdset (void) struct rpc_thread_variables *tvp; tvp = __rpc_thread_variables (); - if (tvp == &rpc_default) + if (tvp == &__libc_tsd_RPC_VARS_mem) return &svc_fdset; return &tvp->svc_fdset_s; } @@ -99,7 +95,7 @@ __rpc_thread_createerr (void) struct rpc_thread_variables *tvp; tvp = __rpc_thread_variables (); - if (tvp == &rpc_default) + if (tvp == &__libc_tsd_RPC_VARS_mem) return &rpc_createerr; return &tvp->rpc_createerr_s; } @@ -110,7 +106,7 @@ __rpc_thread_svc_pollfd (void) struct rpc_thread_variables *tvp; tvp = __rpc_thread_variables (); - if (tvp == &rpc_default) + if (tvp == &__libc_tsd_RPC_VARS_mem) return &svc_pollfd; return &tvp->svc_pollfd_s; } @@ -121,7 +117,7 @@ __rpc_thread_svc_max_pollfd (void) struct rpc_thread_variables *tvp; tvp = __rpc_thread_variables (); - if (tvp == &rpc_default) + if (tvp == &__libc_tsd_RPC_VARS_mem) return &svc_max_pollfd; return &tvp->svc_max_pollfd_s; } --- libc/sunrpc/auth_none.c.jj Mon Mar 26 10:02:25 2001 +++ libc/sunrpc/auth_none.c Tue May 15 18:42:54 2001 @@ -62,7 +62,7 @@ struct authnone_private_s { u_int mcnt; }; #ifdef _RPC_THREAD_SAFE_ -#define authnone_private ((struct authnone_private_ *)RPC_THREAD_VARIABLE(authnone_private_s)) +#define authnone_private ((struct authnone_private_s *)RPC_THREAD_VARIABLE(authnone_private_s)) #else static struct authnone_private_s *authnone_private; #endif Jakub From schwidefsky@de.ibm.com Wed May 16 08:49:00 2001 From: schwidefsky@de.ibm.com (schwidefsky@de.ibm.com) Date: Wed, 16 May 2001 08:49:00 -0000 Subject: Bug in clone for s390x. Message-ID: Hi, I found a cut-copy-paste bug in the clone routine for s390x. The stack bias for 64 bit is 160 bytes and not 96 bytes. This caused random crashes. ChangeLog & Patch: 2001-05-16 Martin Schwidefsky * sysdeps/unix/sysv/linux/s390/s390-64/clone.S: Fix stack allocation. (See attached file: clone-s390x.diff) blue skies, Martin Linux/390 Design & Development, IBM Deutschland Entwicklung GmbH Sch????naicherstr. 220, D-71032 B????blingen, Telefon: 49 - (0)7031 - 16-2247 E-Mail: schwidefsky@de.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: clone-s390x.diff Type: text/x-diff Size: 641 bytes Desc: not available URL: From aj@suse.de Wed May 16 09:13:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Wed, 16 May 2001 09:13:00 -0000 Subject: Bug in clone for s390x. References: Message-ID: schwidefsky@de.ibm.com writes: > Hi, > I found a cut-copy-paste bug in the clone routine for s390x. The stack > bias for 64 bit is 160 bytes and not 96 bytes. This caused random crashes. > ChangeLog & Patch: Committed, Thanks, Andreas -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From drepper@redhat.com Wed May 16 19:00:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Wed, 16 May 2001 19:00:00 -0000 Subject: [PATCH] The recent thread sunrpc change breaks statd (take 2) References: <20010506203552.A32397@lucon.org> <20010506204848.A300@lucon.org> <20010515173724.O503@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > Actually, I don't see why we need two separate rpc_thread_variables > structures. Me neither. I've applied Jakub's patch now. Thanks, -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Wed May 16 22:48:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Wed, 16 May 2001 22:48:00 -0000 Subject: [PATCH] Restore dlsym(RTLD_NEXT, ...) behaviour (take 2) References: <20010510145235.B503@sunsite.ms.mff.cuni.cz> <20010510183625.C503@sunsite.ms.mff.cuni.cz> <20010511003409.D503@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > Ok, here are two variants of the patch. Finally managed to look at the patches... and don't like them. Code like + if (! _dl_loaded + || _dl_loaded->l_addr != 0 + || caller < _dl_loaded->l_map_start) makes certain assumptions about the memory layout and load addresses. This should not happen. There is no reason why the application code should always be below all dynamically loaded code. In fact, isn't the x86 emulation on IA-64 doing something funny like this? I hope I can take a look at this myself soon. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Thu May 17 00:24:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Thu, 17 May 2001 00:24:00 -0000 Subject: working on the backlog Message-ID: I've done a bit of work on my backlog. The patches I could apply are applied. For those which need clarification or changes I sent out messages. Where I'm at total loss are HJ's patches with all these "there was a bug in the last patch" and "ignore the patch altogether" messages. I lost track. If one of the patches I haven't commented on today is still meant to be applied please resend of send me the pointer to the mail archive web page. All the other changes you can assume to be buried too deep for me to find anytime soon. If there is a bug or a patch which must be handled please point me to it. Now a bit about the coming weeks. I'm currently very *very* busy (which is why I don't have that much time for glibc stuff) because between the vacation I returned from and my next trip are only a few weeks in which I have to do the work I'm actually get paid for. Starting from the 26th I'll be off again for two weeks. I think it is not realistic to get a 2.2.4 release out before that date but this doesn't mean we should not have a test release. For this we should of course fix all true bugs and maybe the one or the other nuisance. Among the latter I count the regex slow-down. But I wouldn't hold a release because of this. If nobody volunteers we'll have to wait until there is somebody. I have some idea how to solve this (effectively the same way fnmatch is handled) but it'll need substantial amount of work. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From aj@suse.de Thu May 17 01:16:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Thu, 17 May 2001 01:16:00 -0000 Subject: working on the backlog References: Message-ID: Ulrich Drepper writes: > I've done a bit of work on my backlog. The patches I could apply are > applied. For those which need clarification or changes I sent out > messages. Thanks a lot! [...] > Now a bit about the coming weeks. I'm currently very *very* busy > (which is why I don't have that much time for glibc stuff) because > between the vacation I returned from and my next trip are only a few > weeks in which I have to do the work I'm actually get paid for. > Starting from the 26th I'll be off again for two weeks. Shall I continue to handle the easierer patches? Andreas -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From jakub@redhat.com Thu May 17 01:27:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Thu, 17 May 2001 01:27:00 -0000 Subject: [PATCH] Restore dlsym(RTLD_NEXT, ...) behaviour (take 2) References: <20010510145235.B503@sunsite.ms.mff.cuni.cz> <20010510183625.C503@sunsite.ms.mff.cuni.cz> <20010511003409.D503@sunsite.ms.mff.cuni.cz> Message-ID: <20010517102919.E596@sunsite.ms.mff.cuni.cz> On Wed, May 16, 2001 at 10:48:21PM -0700, Ulrich Drepper wrote: > Jakub Jelinek writes: > > > Ok, here are two variants of the patch. > > Finally managed to look at the patches... and don't like them. Code like > > > + if (! _dl_loaded > + || _dl_loaded->l_addr != 0 > + || caller < _dl_loaded->l_map_start) > > > makes certain assumptions about the memory layout and load addresses. > This should not happen. There is no reason why the application code > should always be below all dynamically loaded code. In fact, isn't > the x86 emulation on IA-64 doing something funny like this? It actually does not make any assumptions about the memory layout. The check just comes from the fact that main program has l_map_start valid, but l_map_end -1UL. The first two checks correspond to the code above it, basically if ! _dl_loaded, we for sure aren't called from dynamically linked main program, if _dl_loaded->l_addr != 0, then _dl_loaded had valid l_map_start and l_map_end and was already checked, if caller < _dl_loaded->l_map_start, then it cannot be from main. One of the patches tries to check the other direction, but as l_map_end is not exact for main program, the check is not exact either. The only thing it can say is if some DSO is above main binary and caller is above its l_map_start, then it cannot come from main program. Jakub From jakub@redhat.com Thu May 17 02:43:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Thu, 17 May 2001 02:43:00 -0000 Subject: Another dlsym(RTLD_NEXT, ) problem(s) Message-ID: <20010517114601.F596@sunsite.ms.mff.cuni.cz> Hi! Attached are three testcases, test and test3 give different results on Linux and Solaris. At least test3 output with glibc is IMHO wrong. Output on Linux is: test main c: 0x8048474 0x40018790 e: 0x8048474 0x4015d780 a: 0x8048474 0x4015f790 d: 0x8048474 0x40163790 b: 0x8048474 (nil) test2 main g: 0x804847c 0x4015f790 a: 0x400187a0 0x40161790 b: 0x400187a0 0x40163790 c: 0x400187a0 0x40165790 d: 0x400187a0 0x40168790 f: 0x400187a0 (nil) test3 main i: 0x804847c 0x40168790 h: 0x804847c 0x4016a790 g: 0x804847c (nil) and on Solaris: test main c: 207c8 ff20053c b: 207c8 0 test2 main g: 207d0 ff320538 a: ff37054c ff30053c b: ff37054c ff2e053c c: ff37054c ff1e053c d: ff37054c ff1c0538 f: ff37054c 0 test3 main i: 207d0 ff1c053c h: 207d0 ff1a053c g: 207d0 ff180538 f: 207d0 0 The first test tests RTLD_NEXT behaviour with DT_AUXILIARY libraries where `c' is the aux filter. Apparently, RTLD_NEXT in the aux filter goes into its DT_NEEDED dependencies (this is the `c' -> `b' jump, later on it behaves the same (ie. nothing comes after `b'). In the third test this is because of r_duplist. I actually cannot understand why is r_duplist created at all and use and this is specifically example where it causes different results. Solaris man page is not entirely clear: In the case of the special handle RTLD_NEXT, dlsym() searches for the named symbol in the objects that were loaded following the object from which the dlsym() call is being made. by my understanding of this is that RTLD_NEXT searches in the l_local_scope of its ultimate l_loader starting with after the map, ie. IMHO _dl_lookup_symbol_skip should look for the map in r_list, not r_duplist. Finding an index in r_duplist and using that index into r_list cannot be right, because from the way how r_duplist is created the same map can be present at different positions in both lists. In test3 case: r_list main e i libdl libc a b c d h ld g f r_duplist main e i libdl libc a b c d libc h libc libc ld libc a libc a libc a libc g libc f libc libc so finding g in the duplist gives index above nlist (and if there were just one further entry before h in duplist it would find RTLD_NEXT(h) -> f instead of g) and the search continues in the next scope (but l_local_scope has only one, so fails). I'd like to understand these things for the prelinking work. Jakub -------------- next part -------------- A non-text attachment was scrubbed... Name: rtld_next.tar.bz2 Type: application/x-tar Size: 20480 bytes Desc: not available URL: From jakub@redhat.com Thu May 17 04:22:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Thu, 17 May 2001 04:22:00 -0000 Subject: DT_FILTER/DT_AUXILIARY handling in glibc Message-ID: <20010517132452.G596@sunsite.ms.mff.cuni.cz> Hi! I went a little bit further and read the linker guide and it looks like glibc DT_FILTER/DT_AUXILIARY handling is incompatible with Solaris. Is that different on purpose? My understanding of glibc implementation is that DT_FILTER is like DT_NEEDED but it comes in the search scope before the library dependant on it, DT_AUXILIARY is like DT_FILTER except that the library does not have to exist. On Solaris, on the other side, DT_FILTER puts that library in a special search scope (together with its dependencies) and iff a symbol is found in the library having the DT_FILTER tag, then search continues in the DT_FILTER's library scope, if it is not found, search continues after the library with DT_FILTER tag (ala RTLD_NEXT). DT_AUXILIARY is similar, except a) the library does not have to be present b) if the symbol is not found in DT_AUXILIARY's scope, the symbol from the library having DT_AUXILIARY tag is returned (ala RTLD_SELF). In the attached testcase, it gives with glibc: test foo a bar a baz a dummy b test2 foo a bar a baz a dummy b while on Solaris: test foo a bar c baz c dummy c test2 foo a bar c baz c dummy b I still need to check behaviour in presence of multiple filters (if I understood correctly one DSO can either have DT_FILTER or DT_FILTER tags, never both), but I think basically that there could be just one r_scope_elem list created for each DSO using DT_FILTER or DT_AUXILIARY, which would contain all filters and its dependencies. Shall I, unless this behaviour difference is desirable, work on a patch? My plan is basically let _dl_map_object_deps create l_filter_searchlist as described above instead of prepending it into the scope and do-lookup* should probably recurse if found_it: label sees l_filter_searchlist != NULL (and if that one does not find the symbol, check some l_* flag to see if it has normal or aux filters, for normal filters just continue searching as if sym was not found and for aux filters continue as if sym was found). Jakub -------------- next part -------------- A non-text attachment was scrubbed... Name: dt_filter.tar.bz2 Type: application/x-bzip2 Size: 569 bytes Desc: not available URL: From drepper@redhat.com Thu May 17 09:14:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Thu, 17 May 2001 09:14:00 -0000 Subject: DT_FILTER/DT_AUXILIARY handling in glibc References: <20010517132452.G596@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > On Solaris, on the other side, DT_FILTER puts that library in a > special search scope (together with its dependencies) and iff a symbol > is found in the library having the DT_FILTER tag, then search continues in > the DT_FILTER's library scope, Yes, this is how it works on Solaris. I didn't implement it that way because such an implementation is far too disruptive with not much to gain. > DT_AUXILIARY is similar, except a) the library does not have to be > present b) if the symbol is not found in DT_AUXILIARY's scope, the > symbol from the library having DT_AUXILIARY tag is returned (ala > RTLD_SELF). I'm not sure this description is correct. This would mean that the symbol has to exist in the loading DSO. > Shall I, unless this behaviour difference is desirable, work on a patch? Iff such a change is made the problem is to get all the boundary cases (like RTLD_NEXT) and loading/unloading without memory leaks etc right. And this has to happen without noticable cost since these are clearly not often used features. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From jakub@redhat.com Fri May 18 02:01:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Fri, 18 May 2001 02:01:00 -0000 Subject: [PATCH] Remove r_duplist & r_nduplist Message-ID: <20010518110354.J596@sunsite.ms.mff.cuni.cz> Hi! As I wrote already yesterday, I don't see what is r_duplist for (used only for RTLD_NEXT and there it cannot be right). This patch removes duplist completely, saving some code and memory especially in dl-deps. It passed glibc make check, plus all the tests I wrote yesterday either give the same result, or in the one case I wrote exactly to show this problem they give the same results as Solaris RTLD_NEXT. If you want I'll hack up a glibc testcase from it. Also, _dl_symbol_value seems to be unused (not exported from glibc, not used by glibc internally and in addition to that marked as internal_function, so anything outside of glibc wouldn't know how to call it anyway), so I've removed it. 2001-05-18 Jakub Jelinek * include/link.h (struct r_scope_elem): Remove r_duplist and r_nduplist fields. * elf/dl-load.c (_dl_map_object_from_fd): Don't initialize them. * elf/dl-lookup.c (_dl_lookup_symbol_skip): Look in r_list, not r_duplist. (_dl_lookup_versioned_symbol_skip): Likewise. * elf/dl-deps.c (struct list): Remove dup field, rename unique to next. (_dl_map_object_deps): Don't compute duplicate list. * elf/dl-symbol.c: Removed. * elf/Makefile (routines): Remove dl-symbol. --- libc/elf/dl-load.c.jj Tue Mar 20 13:45:11 2001 +++ libc/elf/dl-load.c Fri May 18 09:42:03 2001 @@ -1126,8 +1126,6 @@ _dl_map_object_from_fd (const char *name l->l_symbolic_searchlist.r_list[0] = l; l->l_symbolic_searchlist.r_nlist = 1; - l->l_symbolic_searchlist.r_duplist = l->l_symbolic_searchlist.r_list; - l->l_symbolic_searchlist.r_nduplist = 1; /* Now move the existing entries one back. */ memmove (&l->l_scope[1], &l->l_scope[0], --- libc/elf/dl-lookup.c.jj Fri Mar 2 13:44:29 2001 +++ libc/elf/dl-lookup.c Fri May 18 09:43:34 2001 @@ -299,12 +299,11 @@ _dl_lookup_symbol_skip (const char *unde /* Search the relevant loaded objects for a definition. */ scope = symbol_scope; - for (i = 0; (*scope)->r_duplist[i] != skip_map; ++i) - assert (i < (*scope)->r_nduplist); + for (i = 0; (*scope)->r_list[i] != skip_map; ++i) + assert (i < (*scope)->r_nlist); - if (i >= (*scope)->r_nlist - || ! do_lookup (undef_name, hash, *ref, ¤t_value, *scope, i, - skip_map, 0, 0)) + if (! do_lookup (undef_name, hash, *ref, ¤t_value, *scope, i, + skip_map, 0, 0)) while (*++scope) if (do_lookup (undef_name, hash, *ref, ¤t_value, *scope, 0, skip_map, 0, 0)) @@ -502,12 +501,11 @@ _dl_lookup_versioned_symbol_skip (const /* Search the relevant loaded objects for a definition. */ scope = symbol_scope; - for (i = 0; (*scope)->r_duplist[i] != skip_map; ++i) - assert (i < (*scope)->r_nduplist); + for (i = 0; (*scope)->r_list[i] != skip_map; ++i) + assert (i < (*scope)->r_nlist); - if (i >= (*scope)->r_nlist - || ! do_lookup_versioned (undef_name, hash, *ref, ¤t_value, - *scope, i, version, skip_map, 0, 0)) + if (! do_lookup_versioned (undef_name, hash, *ref, ¤t_value, + *scope, i, version, skip_map, 0, 0)) while (*++scope) if (do_lookup_versioned (undef_name, hash, *ref, ¤t_value, *scope, 0, version, skip_map, 0, 0)) --- libc/elf/dl-deps.c.jj Tue Apr 17 23:58:34 2001 +++ libc/elf/dl-deps.c Fri May 18 10:01:48 2001 @@ -72,20 +72,15 @@ openaux (void *a) -/* We use a very special kind of list to track the two kinds paths +/* We use a very special kind of list to track the path through the list of loaded shared objects. We have to - - - produce a flat list with unique members of all involved objects - - - produce a flat list of all shared objects. + produce a flat list with unique members of all involved objects. */ struct list { int done; /* Nonzero if this map was processed. */ struct link_map *map; /* The data. */ - - struct list *unique; /* Elements for normal list. */ - struct list *dup; /* Elements in complete list. */ + struct list *next; /* Elements for normal list. */ }; @@ -139,8 +134,8 @@ _dl_map_object_deps (struct link_map *ma int trace_mode) { struct list known[1 + npreloads + 1]; - struct list *runp, *utail, *dtail; - unsigned int nlist, nduplist, i; + struct list *runp, *tail; + unsigned int nlist, i; /* Object name. */ const char *name; int errno_saved; @@ -153,9 +148,7 @@ _dl_map_object_deps (struct link_map *ma { known[nlist].done = 0; known[nlist].map = map; - - known[nlist].unique = &known[nlist + 1]; - known[nlist].dup = &known[nlist + 1]; + known[nlist].next = &known[nlist + 1]; ++nlist; /* We use `l_reserved' as a mark bit to detect objects we have @@ -175,17 +168,10 @@ _dl_map_object_deps (struct link_map *ma preload (preloads[i]); /* Terminate the lists. */ - known[nlist - 1].unique = NULL; - known[nlist - 1].dup = NULL; + known[nlist - 1].next = NULL; /* Pointer to last unique object. */ - utail = &known[nlist - 1]; - /* Pointer to last loaded object. */ - dtail = &known[nlist - 1]; - - /* Until now we have the same number of libraries in the normal and - the list with duplicates. */ - nduplist = nlist; + tail = &known[nlist - 1]; /* Process each element of the search list, loading each of its auxiliary objects and immediate dependencies. Auxiliary objects @@ -235,8 +221,6 @@ _dl_map_object_deps (struct link_map *ma { /* Map in the needed object. */ struct link_map *dep; - /* Allocate new entry. */ - struct list *newp; const char *objname; /* Recognize DSTs. */ @@ -255,21 +239,19 @@ _dl_map_object_deps (struct link_map *ma else dep = args.aux; - /* Add it in any case to the duplicate list. */ - newp = alloca (sizeof (struct list)); - newp->map = dep; - newp->dup = NULL; - dtail->dup = newp; - dtail = newp; - ++nduplist; - if (! dep->l_reserved) { - /* Append DEP to the unique list. */ + /* Allocate new entry. */ + struct list *newp; + + newp = alloca (sizeof (struct list)); + + /* Append DEP to the list. */ + newp->map = dep; newp->done = 0; - newp->unique = NULL; - utail->unique = newp; - utail = newp; + newp->next = NULL; + tail->next = newp; + tail = newp; ++nlist; /* Set the mark bit that says it's already in the list. */ dep->l_reserved = 1; @@ -343,7 +325,7 @@ _dl_map_object_deps (struct link_map *ma but we have no back links. So we copy the contents of the current entry over. Note that ORIG and NEWP now have switched their meanings. */ - orig->dup = memcpy (newp, orig, sizeof (*newp)); + memcpy (newp, orig, sizeof (*newp)); /* Initialize new entry. */ orig->done = 0; @@ -372,22 +354,22 @@ _dl_map_object_deps (struct link_map *ma /* This object is already in the search list we are building. Don't add a duplicate pointer. Just added by _dl_map_object. */ - for (late = newp; late->unique; late = late->unique) - if (late->unique->map == args.aux) + for (late = newp; late->next; late = late->next) + if (late->next->map == args.aux) break; - if (late->unique) + if (late->next) { /* The object is somewhere behind the current position in the search path. We have to move it to this earlier position. */ - orig->unique = newp; + orig->next = newp; - /* Now remove the later entry from the unique list + /* Now remove the later entry from the list and adjust the tail pointer. */ - if (utail == late->unique) - utail = late; - late->unique = late->unique->unique; + if (tail == late->next) + tail = late; + late->next = late->next->next; /* We must move the object earlier in the chain. */ if (args.aux->l_prev) @@ -406,25 +388,25 @@ _dl_map_object_deps (struct link_map *ma /* The object must be somewhere earlier in the list. That's good, we only have to insert an entry for the duplicate list. */ - orig->unique = NULL; /* Never used. */ + orig->next = NULL; /* Never used. */ /* Now we have a problem. The element - pointing to ORIG in the unique list must + pointing to ORIG in the list must point to NEWP now. This is the only place where we need this backreference and this situation is really not that frequent. So we don't use a double-linked list but instead search for the preceding element. */ late = known; - while (late->unique != orig) - late = late->unique; - late->unique = newp; + while (late->next != orig) + late = late->next; + late->next = newp; } } else { /* This is easy. We just add the symbol right here. */ - orig->unique = newp; + orig->next = newp; ++nlist; /* Set the mark bit that says it's already in the list. */ args.aux->l_reserved = 1; @@ -444,17 +426,12 @@ _dl_map_object_deps (struct link_map *ma args.aux->l_next = newp->map; } - /* Move the tail pointers if necessary. */ - if (orig == utail) - utail = newp; - if (orig == dtail) - dtail = newp; + /* Move the tail pointer if necessary. */ + if (orig == tail) + tail = newp; /* Move on the insert point. */ orig = newp; - - /* We always add an entry to the duplicate list. */ - ++nduplist; } } @@ -473,7 +450,7 @@ _dl_map_object_deps (struct link_map *ma /* If we have no auxiliary objects just go on to the next map. */ if (runp->done) do - runp = runp->unique; + runp = runp->next; while (runp != NULL && runp->done); } @@ -492,8 +469,7 @@ out: /* Store the search list we built in the object. It will be used for searches in the scope of this object. */ map->l_initfini = - (struct link_map **) malloc ((2 * nlist + 1 - + (nlist == nduplist ? 0 : nduplist)) + (struct link_map **) malloc ((2 * nlist + 1) * sizeof (struct link_map *)); if (map->l_initfini == NULL) _dl_signal_error (ENOMEM, map->l_name, @@ -503,7 +479,7 @@ out: map->l_searchlist.r_list = &map->l_initfini[nlist + 1]; map->l_searchlist.r_nlist = nlist; - for (nlist = 0, runp = known; runp; runp = runp->unique) + for (nlist = 0, runp = known; runp; runp = runp->next) { if (trace_mode && runp->map->l_faked) /* This can happen when we trace the loading. */ @@ -514,23 +490,6 @@ out: /* Now clear all the mark bits we set in the objects on the search list to avoid duplicates, so the next call starts fresh. */ runp->map->l_reserved = 0; - } - - map->l_searchlist.r_nduplist = nduplist; - if (nlist == nduplist) - map->l_searchlist.r_duplist = map->l_searchlist.r_list; - else - { - unsigned int cnt; - - map->l_searchlist.r_duplist = map->l_searchlist.r_list + nlist; - - for (cnt = 0, runp = known; runp; runp = runp->dup) - if (trace_mode && runp->map->l_faked) - /* This can happen when we trace the loading. */ - --map->l_searchlist.r_nduplist; - else - map->l_searchlist.r_duplist[cnt++] = runp->map; } /* Now determine the order in which the initialization has to happen. */ --- libc/include/link.h.jj Thu Nov 2 08:51:40 2000 +++ libc/include/link.h Fri May 18 09:41:32 2001 @@ -93,11 +93,6 @@ struct r_scope_elem struct link_map **r_list; /* Number of entries in the scope. */ unsigned int r_nlist; - - /* Array of maps which also includes duplicates. */ - struct link_map **r_duplist; - /* Number of elements in this list. */ - unsigned int r_nduplist; }; --- libc/elf/dl-symbol.c.jj Fri Sep 1 11:37:58 2000 +++ libc/elf/dl-symbol.c Fri May 18 10:40:39 2001 @@ -1,33 +0,0 @@ -/* Look up a symbol's run-time value in the scope of a loaded object. - Copyright (C) 1995, 96, 98, 99, 2000 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 - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -/* Look up symbol NAME in MAP's scope and return its run-time address. */ - -ElfW(Addr) -internal_function -_dl_symbol_value (struct link_map *map, const char *name) -{ - const ElfW(Sym) *ref = NULL; - lookup_t result; - result = _dl_lookup_symbol (name, map, &ref, map->l_local_scope, 0, 1); - return (result ? LOOKUP_VALUE_ADDRESS (result) : 0) + ref->st_value; -} --- libc/elf/Makefile.jj Fri May 11 00:47:48 2001 +++ libc/elf/Makefile Fri May 18 10:40:55 2001 @@ -21,7 +21,7 @@ subdir := elf headers = elf.h bits/elfclass.h link.h -routines = $(dl-routines) dl-open dl-close dl-symbol dl-support \ +routines = $(dl-routines) dl-open dl-close dl-support \ dl-addr enbl-secure dl-profstub dl-origin dl-libc dl-sym # The core dynamic linking functions are in libc for the static and Jakub From jakub@redhat.com Fri May 18 07:24:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Fri, 18 May 2001 07:24:00 -0000 Subject: [PATCH] dl-lookup.c space saving Message-ID: <20010518162715.K596@sunsite.ms.mff.cuni.cz> Hi! do_lookup and do_lookup_versioned are quite big functions marked with static inline and each of them is inlined 6 times, although IMHO only one place is worth inlining and the remaining 5 places are better not inlined. I think STV_PROTECTED symbols are rare, similarly RTLD_NEXT is not done too often. The space savings are quite big. This patch will work until gcc starts inlining on trees in C, after that at -O3 it will either have to mark _dl_do_lookup* as __attribute__((dontinline)) if such thing will exist, or move them into a separate file. Also, I found two leftover defines from initial H.J.'s STV_PROTECTED patch. 2001-05-18 Jakub Jelinek * dl-lookup.c (PROTECTED): Remove defines. (add_dependency): Mark it with internal_function. (_dl_do_lookup, _dl_do_lookup_versioned): New functions. (_dl_lookup_symbol, _dl_lookup_symbol_skip, _dl_lookup_versioned_symbol, _dl_lookup_versioned_symbol_skip): Use it if we don't want do_lookup* inlined. --- libc/dl-lookup.c.jj Fri May 18 09:43:34 2001 +++ libc/dl-lookup.c Fri May 18 16:14:37 2001 @@ -75,16 +75,15 @@ __libc_lock_define (extern, _dl_load_loc without versioning. gcc is not able to optimize a single function definition serving for both purposes so we define two functions. */ #define VERSIONED 0 -#define PROTECTED 0 #include "do-lookup.h" #define VERSIONED 1 -#define PROTECTED 0 #include "do-lookup.h" /* Add extra dependency on MAP to UNDEF_MAP. */ static int +internal_function add_dependency (struct link_map *undef_map, struct link_map *map) { struct link_map **list; @@ -180,6 +179,19 @@ add_dependency (struct link_map *undef_m return result; } +static int +internal_function +_dl_do_lookup (const char *undef_name, unsigned long int hash, + const ElfW(Sym) *ref, struct sym_val *result, + struct r_scope_elem *scope, size_t i, + struct link_map *skip, int noexec, int noplt); +static int +internal_function +_dl_do_lookup_versioned (const char *undef_name, unsigned long int hash, + const ElfW(Sym) *ref, struct sym_val *result, + struct r_scope_elem *scope, size_t i, + const struct r_found_version *const version, + struct link_map *skip, int noexec, int noplt); /* Search loaded objects' symbol tables for a definition of the symbol UNDEF_NAME. */ @@ -261,8 +273,8 @@ _dl_lookup_symbol (const char *undef_nam struct sym_val protected_value = { NULL, NULL }; for (scope = symbol_scope; *scope; ++scope) - if (do_lookup (undef_name, hash, *ref, &protected_value, *scope, 0, - NULL, 0, 1)) + if (_dl_do_lookup (undef_name, hash, *ref, &protected_value, *scope, + 0, NULL, 0, 1)) break; if (protected_value.s == NULL || protected_value.m == undef_map) @@ -302,11 +314,11 @@ _dl_lookup_symbol_skip (const char *unde for (i = 0; (*scope)->r_list[i] != skip_map; ++i) assert (i < (*scope)->r_nlist); - if (! do_lookup (undef_name, hash, *ref, ¤t_value, *scope, i, - skip_map, 0, 0)) + if (! _dl_do_lookup (undef_name, hash, *ref, ¤t_value, *scope, i, + skip_map, 0, 0)) while (*++scope) - if (do_lookup (undef_name, hash, *ref, ¤t_value, *scope, 0, - skip_map, 0, 0)) + if (_dl_do_lookup (undef_name, hash, *ref, ¤t_value, *scope, 0, + skip_map, 0, 0)) break; if (__builtin_expect (current_value.s == NULL, 0)) @@ -337,11 +349,11 @@ _dl_lookup_symbol_skip (const char *unde struct sym_val protected_value = { NULL, NULL }; if (i >= (*scope)->r_nlist - || !do_lookup (undef_name, hash, *ref, &protected_value, *scope, i, - skip_map, 0, 1)) + || !_dl_do_lookup (undef_name, hash, *ref, &protected_value, *scope, + i, skip_map, 0, 1)) while (*++scope) - if (do_lookup (undef_name, hash, *ref, &protected_value, *scope, 0, - skip_map, 0, 1)) + if (_dl_do_lookup (undef_name, hash, *ref, &protected_value, *scope, + 0, skip_map, 0, 1)) break; if (protected_value.s == NULL || protected_value.m == undef_map) @@ -464,8 +476,8 @@ _dl_lookup_versioned_symbol (const char struct sym_val protected_value = { NULL, NULL }; for (scope = symbol_scope; *scope; ++scope) - if (do_lookup_versioned (undef_name, hash, *ref, &protected_value, - *scope, 0, version, NULL, 0, 1)) + if (_dl_do_lookup_versioned (undef_name, hash, *ref, &protected_value, + *scope, 0, version, NULL, 0, 1)) break; if (protected_value.s == NULL || protected_value.m == undef_map) @@ -504,11 +516,11 @@ _dl_lookup_versioned_symbol_skip (const for (i = 0; (*scope)->r_list[i] != skip_map; ++i) assert (i < (*scope)->r_nlist); - if (! do_lookup_versioned (undef_name, hash, *ref, ¤t_value, - *scope, i, version, skip_map, 0, 0)) + if (! _dl_do_lookup_versioned (undef_name, hash, *ref, ¤t_value, + *scope, i, version, skip_map, 0, 0)) while (*++scope) - if (do_lookup_versioned (undef_name, hash, *ref, ¤t_value, *scope, - 0, version, skip_map, 0, 0)) + if (_dl_do_lookup_versioned (undef_name, hash, *ref, ¤t_value, + *scope, 0, version, skip_map, 0, 0)) break; if (__builtin_expect (current_value.s == NULL, 0)) @@ -552,11 +564,13 @@ _dl_lookup_versioned_symbol_skip (const struct sym_val protected_value = { NULL, NULL }; if (i >= (*scope)->r_nlist - || !do_lookup_versioned (undef_name, hash, *ref, &protected_value, - *scope, i, version, skip_map, 0, 1)) + || !_dl_do_lookup_versioned (undef_name, hash, *ref, + &protected_value, *scope, i, version, + skip_map, 0, 1)) while (*++scope) - if (do_lookup_versioned (undef_name, hash, *ref, &protected_value, - *scope, 0, version, skip_map, 0, 1)) + if (_dl_do_lookup_versioned (undef_name, hash, *ref, + &protected_value, *scope, 0, version, + skip_map, 0, 1)) break; if (protected_value.s == NULL || protected_value.m == undef_map) @@ -588,4 +602,29 @@ _dl_setup_hash (struct link_map *map) map->l_buckets = hash; hash += map->l_nbuckets; map->l_chain = hash; +} + +/* These are here so that we only inline do_lookup{,_versioned} in the common + case, not everywhere. */ +static int +internal_function +_dl_do_lookup (const char *undef_name, unsigned long int hash, + const ElfW(Sym) *ref, struct sym_val *result, + struct r_scope_elem *scope, size_t i, + struct link_map *skip, int noexec, int noplt) +{ + return do_lookup (undef_name, hash, ref, result, scope, i, skip, noexec, + noplt); +} + +static int +internal_function +_dl_do_lookup_versioned (const char *undef_name, unsigned long int hash, + const ElfW(Sym) *ref, struct sym_val *result, + struct r_scope_elem *scope, size_t i, + const struct r_found_version *const version, + struct link_map *skip, int noexec, int noplt) +{ + return do_lookup_versioned (undef_name, hash, ref, result, scope, i, + version, skip, noexec, noplt); } Jakub From kukuk@suse.de Fri May 18 07:28:00 2001 From: kukuk@suse.de (Thorsten Kukuk) Date: Fri, 18 May 2001 07:28:00 -0000 Subject: getaddrinfo security problem ? Message-ID: <20010518162813.A9161@suse.de> Hi, it looks like there is a problem with the getaddrinfo function in glibc. A lot of programs, which are IPv6 ready, do: memset(&hints, 0, sizeof (hints)); hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_STREAM; error = getaddrinfo (host, "", &hints, &res0); For me it looks like this is correct. But if host is "localhost", we get back addresses for AF_INET, AF_INET6 and AF_UNIX. If the daemon is not running, AF_INET and AF_INET6 fails and AF_UNIX is used. AF_UNIX uses a fixed path "/tmp/" ! And here is the problem: If the daemon is not running, a user can start his own, faked daemon with the "/tmp/" socket. I don't know if it is correct to return AF_UNIX with a path in /tmp. I think this is a very bad idea, and for me it looks like glibc should not do this. I cannot find any other implementation where AF_UNIX is returned, looks like only glibc is doing this. Any other opiniums ? What does the standard say about this ? I think we should disable it. Thorsten -- Thorsten Kukuk http://www.suse.de/~kukuk/ kukuk@suse.de SuSE GmbH Deutschherrnstr. 15-19 90429 Nuernberg -------------------------------------------------------------------- Key fingerprint = A368 676B 5E1B 3E46 CFCE 2D97 F8FD 4E23 56C6 FB4B From roland@frob.com Sun May 20 23:04:00 2001 From: roland@frob.com (Roland McGrath) Date: Sun, 20 May 2001 23:04:00 -0000 Subject: _dl_cpuclock_offset Message-ID: <20010521060546.73E7C996F9@perdition.linnaean.org> Why not initialize _dl_cpuclock_offset in rtld.c rather than in sysdeps code? And come to think of it, why not just set it to the START_TIME local already set in _dl_start? From drepper@redhat.com Mon May 21 00:13:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Mon, 21 May 2001 00:13:00 -0000 Subject: _dl_cpuclock_offset References: <20010521060546.73E7C996F9@perdition.linnaean.org> Message-ID: Roland McGrath writes: > Why not initialize _dl_cpuclock_offset in rtld.c rather than in sysdeps > code? And come to think of it, why not just set it to the START_TIME > local already set in _dl_start? In _dl_start you cannot write to a global variable. You could perhaps do all the initialization in _dl_start_final (move it from dl-sysdep) but passing the value is causing more pain than it solves since you have to handle the !HP_TIMING_INLINE case. I put it in dl-sysdep since there is where all the initialization code is. If you feel strongly move it to _dl_final_start. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From jakub@redhat.com Mon May 21 03:12:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Mon, 21 May 2001 03:12:00 -0000 Subject: [PATCH] Restore dlsym(RTLD_NEXT, ...) behaviour (take 3) References: <20010510145235.B503@sunsite.ms.mff.cuni.cz> <20010510183625.C503@sunsite.ms.mff.cuni.cz> <20010511003409.D503@sunsite.ms.mff.cuni.cz> Message-ID: <20010521121438.A596@sunsite.ms.mff.cuni.cz> On Wed, May 16, 2001 at 10:48:21PM -0700, Ulrich Drepper wrote: > Jakub Jelinek writes: > > > Ok, here are two variants of the patch. > > Finally managed to look at the patches... and don't like them. Code like > > > + if (! _dl_loaded > + || _dl_loaded->l_addr != 0 > + || caller < _dl_loaded->l_map_start) > > > makes certain assumptions about the memory layout and load addresses. > This should not happen. There is no reason why the application code > should always be below all dynamically loaded code. In fact, isn't > the x86 emulation on IA-64 doing something funny like this? How about this? Passed glibc bootstrap and make check. I couldn't find any code which would rely on l_map_end of main program being set to ~0 and it does not cost that much to initialize it properly. Further, the l->l_addr != 0 checks might work now but with prelinking they don't work at all (l_addr == 0 is then the common desirable case). In dl-open.c the comment close to the l_addr != 0 check said: Make sure we do not currently set this map up in this moment. but this test happens at the start of dl_open_worker, so this dlopen has not created any new maps yet and as it is protected with the _dl_load_lock, there cannot be anyone else creating/removing maps at the same time and all maps should be thus set up properly before dl_open_worker starts. 2001-05-21 Jakub Jelinek * elf/rtld.c (dl_main): Compute l_map_end for the main program. * elf/dlsym.c (_dl_sym): Don't check for l_addr == 0. If match == _dl_loaded, caller can still come from the main program. (_dl_vsym): Likewise. * elf/dl-open.c (dl_open_worker): Don't check for l_addr == 0. * elf/dl-error.c (_dl_signal_error): Change NULL objname into "". * elf/restest2.c: New test. * elf/Makefile (tests): Add restest2. (restest2, LDFLAGS-restest2): Add. --- libc/elf/rtld.c.jj Mon May 21 11:36:03 2001 +++ libc/elf/rtld.c Mon May 21 11:42:24 2001 @@ -542,8 +542,7 @@ of this helper program; chances are you information for the program. */ } - /* It is not safe to load stuff after the main program. */ - _dl_loaded->l_map_end = ~0; + _dl_loaded->l_map_end = 0; /* Perhaps the executable has no PT_LOAD header entries at all. */ _dl_loaded->l_map_start = ~0; @@ -593,13 +592,18 @@ of this helper program; chances are you case PT_LOAD: /* Remember where the main program starts in memory. */ { - ElfW(Addr) mapstart; + ElfW(Addr) mapstart, allocend; mapstart = _dl_loaded->l_addr + (ph->p_vaddr & ~(ph->p_align - 1)); + allocend = _dl_loaded->l_addr + ph->p_vaddr + ph->p_memsz; if (_dl_loaded->l_map_start > mapstart) _dl_loaded->l_map_start = mapstart; + if (_dl_loaded->l_map_end < allocend) + _dl_loaded->l_map_end = allocend; } break; } + if (! _dl_loaded->l_map_end) + _dl_loaded->l_map_end = ~0; if (! _dl_rtld_map.l_libname && _dl_rtld_map.l_name) { /* We were invoked directly, so the program might not have a --- libc/elf/dl-sym.c.jj Mon May 21 11:36:03 2001 +++ libc/elf/dl-sym.c Mon May 21 11:42:24 2001 @@ -41,7 +41,7 @@ _dl_sym (void *handle, const char *name, /* Find the highest-addressed object that CALLER is not below. */ for (l = _dl_loaded; l != NULL; l = l->l_next) - if (l->l_addr != 0 && caller >= l->l_map_start && caller < l->l_map_end) + if (caller >= l->l_map_start && caller < l->l_map_end) { /* There must be exactly one DSO for the range of the virtual memory. Otherwise something is really broken. */ @@ -65,8 +65,13 @@ _dl_sym (void *handle, const char *name, else { if (__builtin_expect (match == _dl_loaded, 0)) - _dl_signal_error (0, NULL, N_("\ + { + if (! _dl_loaded + || caller < _dl_loaded->l_map_start + || caller >= _dl_loaded->l_map_end) + _dl_signal_error (0, NULL, N_("\ RTLD_NEXT used in code not dynamically loaded")); + } l = match; while (l->l_loader != NULL) @@ -107,7 +112,7 @@ _dl_vsym (void *handle, const char *name /* Find the highest-addressed object that CALLER is not below. */ for (l = _dl_loaded; l != NULL; l = l->l_next) - if (l->l_addr != 0 && caller >= l->l_map_start && caller < l->l_map_end) + if (caller >= l->l_map_start && caller < l->l_map_end) { /* There must be exactly one DSO for the range of the virtual memory. Otherwise something is really broken. */ @@ -121,9 +126,14 @@ _dl_vsym (void *handle, const char *name &vers, 0, 0); else if (handle == RTLD_NEXT) { - if (match == _dl_loaded) - _dl_signal_error (0, NULL, N_("\ + if (__builtin_expect (match == _dl_loaded, 0)) + { + if (! _dl_loaded + || caller < _dl_loaded->l_map_start + || caller >= _dl_loaded->l_map_end) + _dl_signal_error (0, NULL, N_("\ RTLD_NEXT used in code not dynamically loaded")); + } l = match; while (l->l_loader != NULL) --- libc/elf/dl-open.c.jj Mon May 21 11:36:02 2001 +++ libc/elf/dl-open.c Mon May 21 11:42:24 2001 @@ -188,13 +188,10 @@ dl_open_worker (void *a) _dl_signal_error (0, "dlopen", N_("DST not allowed in SUID/SGID programs")); - /* We have to find out from which object the caller is calling. - Find the highest-addressed object that ADDRESS is not below. */ + /* We have to find out from which object the caller is calling. */ call_map = NULL; for (l = _dl_loaded; l; l = l->l_next) - if (l->l_addr != 0 /* Make sure we do not currently set this map up - in this moment. */ - && caller >= (const void *) l->l_map_start + if (caller >= (const void *) l->l_map_start && caller < (const void *) l->l_map_end) { /* There must be exactly one DSO for the range of the virtual --- libc/elf/dl-error.c.jj Mon May 21 11:43:57 2001 +++ libc/elf/dl-error.c Mon May 21 11:44:06 2001 @@ -71,6 +71,8 @@ _dl_signal_error (int errcode, const cha errstring = N_("DYNAMIC LINKER BUG!!!"); lcatch = tsd_getspecific (); + if (objname == NULL) + objname = ""; if (lcatch != NULL) { /* We are inside _dl_catch_error. Return to it. We have to @@ -100,7 +102,7 @@ _dl_signal_error (int errcode, const cha _dl_fatal_printf ("\ %s: error while loading shared libraries: %s%s%s%s%s\n", _dl_argv[0] ?: "", - objname ?: "", objname && *objname ? ": " : "", + objname, *objname ? ": " : "", errstring, errcode ? ": " : "", (errcode ? __strerror_r (errcode, buffer, sizeof buffer) --- libc/elf/restest2.c.jj Mon May 21 11:44:06 2001 +++ libc/elf/restest2.c Mon May 21 11:44:06 2001 @@ -0,0 +1,33 @@ +#include +#include +#include +#include +#include +#include + +pid_t pid, pid2; + +pid_t getpid(void) +{ + pid_t (*f)(void); + f = (pid_t (*)(void)) dlsym (RTLD_NEXT, "getpid"); + if (f == NULL) + error (EXIT_FAILURE, 0, "dlsym (RTLD_NEXT, \"getpid\"): %s", dlerror ()); + return (pid2 = f()) + 26; +} + +int +main (void) +{ + pid_t (*f)(void); + + mtrace (); + + f = (pid_t (*)(void)) dlsym (RTLD_DEFAULT, "getpid"); + if (f == NULL) + error (EXIT_FAILURE, 0, "dlsym (RTLD_DEFAULT, \"getpid\"): %s", dlerror ()); + pid = f(); + if (pid != pid2 + 26) + error (EXIT_FAILURE, 0, "main getpid() not called"); + return 0; +} --- libc/elf/Makefile.jj Mon May 21 11:43:57 2001 +++ libc/elf/Makefile Mon May 21 11:44:06 2001 @@ -101,7 +101,8 @@ tests = loadtest restest1 preloadtest lo constload1 order $(tests-vis-$(have-protected)) noload filter unload \ reldep reldep2 reldep3 next $(tests-nodelete-$(have-z-nodelete)) \ $(tests-nodlopen-$(have-z-nodlopen)) neededtest neededtest2 \ - neededtest3 neededtest4 unload2 lateglobal initfirst global + neededtest3 neededtest4 unload2 lateglobal initfirst global \ + restest2 test-srcs = tst-pathopt tests-vis-yes = vismain tests-nodelete-yes = nodelete @@ -302,6 +303,9 @@ $(objpfx)neededtest4.out: $(objpfx)neede $(objpfx)restest1: $(objpfx)testobj1.so $(objpfx)testobj1_1.so $(libdl) LDFLAGS-restest1 = -rdynamic + +$(objpfx)restest2: $(libdl) +LDFLAGS-restest2 = -rdynamic $(objpfx)restest1.out: $(test-modules) Jakub From jakub@redhat.com Mon May 21 11:57:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Mon, 21 May 2001 11:57:00 -0000 Subject: [PATCH] Fix ia64 sys/ucontext.h Message-ID: <20010521205923.A516@sunsite.ms.mff.cuni.cz> Hi! #define _XOPEN_SOURCE 500 #include #include does not work on ia64. The issue is that signal.h under these conditions does not source bits/sigcontext.h. Fixed thusly (the multiple inclusion guards are on most platforms inside asm/sigcontext.h, so are not needed in bits/sigcontext.h): 2001-05-21 Jakub Jelinek * sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Include bits/sigcontext.h instead of bits/sigstack.h. * sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h: Add multiple-inclusion guards. --- libc/sysdeps/unix/sysv/linux/ia64/sys/ucontext.h.jj Tue Mar 20 13:45:50 2001 +++ libc/sysdeps/unix/sysv/linux/ia64/sys/ucontext.h Mon May 21 20:41:21 2001 @@ -22,7 +22,7 @@ #include #include -#include +#include /* * These are here mostly for backwards compatibility with older Unices. --- libc/sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h.jj Tue Mar 20 13:45:50 2001 +++ libc/sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h Mon May 21 20:52:12 2001 @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997, 1998,2000 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jes Sorensen , July 2000 @@ -21,6 +21,9 @@ # error "Never use directly; include instead." #endif +#ifndef _BITS_SIGCONTEXT_H +#define _BITS_SIGCONTEXT_H 1 + #include #include @@ -50,3 +53,5 @@ struct sigcontext * include the kernel headers here. */ unsigned long int sc_mask; /* signal mask to restore after handler returns */ }; + +#endif _BITS_SIGCONTEXT_H Jakub From jakub@redhat.com Mon May 21 12:01:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Mon, 21 May 2001 12:01:00 -0000 Subject: [PATCH] Fix ia64 sys/ucontext.h References: <20010521205923.A516@sunsite.ms.mff.cuni.cz> Message-ID: <20010521210317.B516@sunsite.ms.mff.cuni.cz> On Mon, May 21, 2001 at 08:59:24PM +0200, Jakub Jelinek wrote: > Hi! > > #define _XOPEN_SOURCE 500 > #include > #include Actually #define _XOPEN_SOURCE 500 #include is enough to reproduce it. Jakub From schwidefsky@de.ibm.com Tue May 22 01:21:00 2001 From: schwidefsky@de.ibm.com (schwidefsky@de.ibm.com) Date: Tue, 22 May 2001 01:21:00 -0000 Subject: Bug in s/390 backtrace. Message-ID: Hi, Uli found a bug in the backtrace function. It returns an array of stack pointers instead of an array of return addresses. ChangeLog and patch: 2001-05-22 Martin Schwidefsky * sysdeps/s390/s390-32/backtrace.c: Make backtrace return the return addresses instead of the stack pointers. * sysdeps/s390/s390-64/backtrace.c: Likewise. (See attached file: backtrace.diff) blue skies, Martin Linux/390 Design & Development, IBM Deutschland Entwicklung GmbH Sch????naicherstr. 220, D-71032 B????blingen, Telefon: 49 - (0)7031 - 16-2247 E-Mail: schwidefsky@de.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: backtrace.diff Type: text/x-diff Size: 858 bytes Desc: not available URL: From aj@suse.de Tue May 22 01:33:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Tue, 22 May 2001 01:33:00 -0000 Subject: [PATCH] Fix ia64 sys/ucontext.h References: <20010521205923.A516@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > Hi! > > #define _XOPEN_SOURCE 500 > #include > #include > > does not work on ia64. The issue is that signal.h under these conditions > does not source bits/sigcontext.h. > Fixed thusly (the multiple inclusion guards are on most platforms inside > asm/sigcontext.h, so are not needed in bits/sigcontext.h): > > 2001-05-21 Jakub Jelinek > > * sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Include > bits/sigcontext.h instead of bits/sigstack.h. > * sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h: Add > multiple-inclusion guards. Thanks, I'll commit this now, Andreas -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From aj@suse.de Tue May 22 01:35:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Tue, 22 May 2001 01:35:00 -0000 Subject: Bug in s/390 backtrace. References: Message-ID: schwidefsky@de.ibm.com writes: > Hi, > Uli found a bug in the backtrace function. It returns an array of > stack pointers instead of an array of return addresses. > ChangeLog and patch: > > 2001-05-22 Martin Schwidefsky > > * sysdeps/s390/s390-32/backtrace.c: Make backtrace return the > return addresses instead of the stack pointers. > * sysdeps/s390/s390-64/backtrace.c: Likewise. > Thanks, I'll commit this now, Andreas -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From jakub@redhat.com Tue May 22 03:37:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Tue, 22 May 2001 03:37:00 -0000 Subject: [PATCH] Fix dl_close l_reldeps handling Message-ID: <20010522123941.C516@sunsite.ms.mff.cuni.cz> Hi! The attached testcase segfaults with current glibc. I guess it is quite obvious, the issue is that _dl_close uses `map' instead of `imap' pointer, which a) after map is freed points to freed memory b) even if that does work, we may add the same reldeps list several times and some not at all, which means that some libraries may be _dl_closed several times and if they get to zero l_opencount before last _dl_close we have a problem again. 2001-05-22 Jakub Jelinek * elf/dl-close.c (_dl_close): Save imap->l_reldeps, not map->l_reldeps. * elf/Makefile (distribute): Add reldep4mod[1234].c. (tests): Add reldep4. (modules-names): Add reldep4mod[1234]. (reldep4mod1.so, reldep4mod2.so, reldep4, reldep4.out): New rules. * elf/reldep4.c: New file. * elf/reldep4mod1.c: Likewise. * elf/reldep4mod2.c: Likewise. * elf/reldep4mod3.c: Likewise. * elf/reldep4mod4.c: Likewise. --- libc/elf/dl-close.c.jj Tue May 22 11:09:07 2001 +++ libc/elf/dl-close.c Tue May 22 11:54:45 2001 @@ -224,8 +224,8 @@ _dl_close (void *_map) struct reldep_list *newrel; newrel = (struct reldep_list *) alloca (sizeof (*reldeps)); - newrel->rellist = map->l_reldeps; - newrel->nrellist = map->l_reldepsact; + newrel->rellist = imap->l_reldeps; + newrel->nrellist = imap->l_reldepsact; newrel->next = reldeps; reldeps = newrel; --- libc/elf/Makefile.jj Tue May 22 11:09:04 2001 +++ libc/elf/Makefile Tue May 22 12:11:17 2001 @@ -53,6 +53,7 @@ distribute := $(rtld-routines:=.c) dynam nodlopenmod.c nodelete.c nodelmod1.c nodelmod2.c \ nodelmod3.c nodelmod4.c nodlopen.c dl-osinfo.h \ reldepmod1.c reldepmod2.c reldepmod3.c reldepmod4.c \ + reldep4mod1.c reldep4mod2.c reldep4mod3.c reldep4mod4.c \ nextmod1.c nextmod2.c pathoptobj.c tst-pathopt.sh \ neededobj1.c neededobj2.c neededobj3.c neededobj4.c \ neededobj5.c neededobj6.c firstobj.c \ @@ -99,7 +100,7 @@ endif ifeq (yes,$(build-shared)) tests = loadtest restest1 preloadtest loadfail multiload origtest resolvfail \ constload1 order $(tests-vis-$(have-protected)) noload filter unload \ - reldep reldep2 reldep3 next $(tests-nodelete-$(have-z-nodelete)) \ + reldep reldep2 reldep3 reldep4 next $(tests-nodelete-$(have-z-nodelete)) \ $(tests-nodlopen-$(have-z-nodlopen)) neededtest neededtest2 \ neededtest3 neededtest4 unload2 lateglobal initfirst global test-srcs = tst-pathopt @@ -113,6 +114,7 @@ modules-names = testobj1 testobj2 testob $(modules-nodelete-$(have-z-nodelete)) \ $(modules-nodlopen-$(have-z-nodlopen)) filtmod1 filtmod2 \ reldepmod1 reldepmod2 reldepmod3 reldepmod4 nextmod1 nextmod2 \ + reldep4mod1 reldep4mod2 reldep4mod3 reldep4mod4 \ neededobj1 neededobj2 neededobj3 neededobj4 \ neededobj5 neededobj6 firstobj globalmod1 \ unload2mod unload2dep ltglobmod1 ltglobmod2 pathoptobj @@ -274,6 +276,8 @@ $(objpfx)unload2mod.so: $(objpfx)unload2 $(objpfx)ltglobmod2.so: $(libdl) $(objpfx)firstobj.so: $(shared-thread-library) $(objpfx)globalmod1.so: $(libdl) +$(objpfx)reldep4mod1.so: $(objpfx)reldep4mod3.so +$(objpfx)reldep4mod2.so: $(objpfx)reldep4mod4.so # filtmod1.so has a special rule $(filter-out $(objpfx)filtmod1.so, $(test-modules)): $(objpfx)%.so: $(objpfx)%.os @@ -381,6 +385,9 @@ $(objpfx)reldep2.out: $(objpfx)reldepmod $(objpfx)reldep3: $(libdl) $(objpfx)reldep3.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod4.so + +$(objpfx)reldep4: $(libdl) +$(objpfx)reldep4.out: $(objpfx)reldep4mod1.so $(objpfx)reldep4mod2.so $(objpfx)next: $(objpfx)nextmod1.so $(objpfx)nextmod2.so $(libdl) --- libc/elf/reldep4.c.jj Tue May 22 12:05:19 2001 +++ libc/elf/reldep4.c Tue May 22 12:25:59 2001 @@ -0,0 +1,40 @@ +#include +#include +#include +#include + +int +main() +{ + int i; + void *h1, *h2; + + mtrace (); + + for (i = 0; i < 3; i++) + { + h1 = dlopen ("reldep4mod1.so", RTLD_NOW | RTLD_GLOBAL); + if (h1 == NULL) + { + printf ("cannot open reldep4mod1.so: %s\n", dlerror ()); + exit (1); + } + h2 = dlopen ("reldep4mod2.so", RTLD_NOW | RTLD_GLOBAL); + if (h2 == NULL) + { + printf ("cannot open reldep4mod2.so: %s\n", dlerror ()); + exit (1); + } + if (dlclose (h1) != 0) + { + printf ("closing h1 failed: %s\n", dlerror ()); + exit (1); + } + if (dlclose (h2) != 0) + { + printf ("closing h2 failed: %s\n", dlerror ()); + exit (1); + } + } + return 0; +} --- libc/elf/reldep4mod1.c.jj Tue May 22 12:05:24 2001 +++ libc/elf/reldep4mod1.c Tue May 22 12:26:12 2001 @@ -0,0 +1,7 @@ +int foo (void); + +int foo (void) +{ + return 0; +} + --- libc/elf/reldep4mod2.c.jj Tue May 22 12:05:27 2001 +++ libc/elf/reldep4mod2.c Tue May 22 10:57:02 2001 @@ -0,0 +1,6 @@ +extern int foo(); + +int bar () +{ + foo(); +} --- libc/elf/reldep4mod3.c.jj Tue May 22 12:05:24 2001 +++ libc/elf/reldep4mod3.c Tue May 22 12:26:19 2001 @@ -0,0 +1,7 @@ +int foo (void); + +int foo (void) +{ + return 0; +} + --- libc/elf/reldep4mod4.c.jj Tue May 22 12:05:27 2001 +++ libc/elf/reldep4mod4.c Tue May 22 10:57:02 2001 @@ -0,0 +1,6 @@ +extern int foo(); + +int bar () +{ + foo(); +} Jakub From kukuk@suse.de Tue May 22 06:40:00 2001 From: kukuk@suse.de (Thorsten Kukuk) Date: Tue, 22 May 2001 06:40:00 -0000 Subject: getaddrinfo security problem ? References: <20010518162813.A9161@suse.de> Message-ID: <20010522154001.A8672@suse.de> On Fri, May 18, Thorsten Kukuk wrote: > I don't know if it is correct to return AF_UNIX with a path in > /tmp. I think this is a very bad idea, and for me it looks like > glibc should not do this. I cannot find any other implementation > where AF_UNIX is returned, looks like only glibc is doing this. > > Any other opiniums ? What does the standard say about this ? > I think we should disable it. If I look at the various source codes: We can remove PF_LOCAL and gaih_local, or we don't allow PF_LOCAL if PF_UNSPEC is set. I would vote for the first option, removing it completly like BSD has done this. Any other ideas ? Thorsten -- Thorsten Kukuk http://www.suse.de/~kukuk/ kukuk@suse.de SuSE GmbH Deutschherrnstr. 15-19 90429 Nuernberg -------------------------------------------------------------------- Key fingerprint = A368 676B 5E1B 3E46 CFCE 2D97 F8FD 4E23 56C6 FB4B From Philip.Blundell@pobox.com Tue May 22 06:49:00 2001 From: Philip.Blundell@pobox.com (Philip.Blundell@pobox.com) Date: Tue, 22 May 2001 06:49:00 -0000 Subject: getaddrinfo security problem ? References: <20010518162813.A9161@suse.de> <20010522154001.A8672@suse.de> Message-ID: >I would vote for the first option, removing >it completly like BSD has done this. That seems reasonable to me. As far as I know nobody uses Unix sockets in this way. p. From aj@suse.de Tue May 22 11:44:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Tue, 22 May 2001 11:44:00 -0000 Subject: Do we need WEAK_GMON_START? Message-ID: A grep through glibc revealed that we don't use WEAK_GMON_START anymore: gromit:/usr/src/cvs/libc:[0]$ grep -r WEAK_GMON_START . ./sysdeps/unix/sysv/linux/ia64/Makefile:CFLAGS-initfini.s += -DWEAK_GMON_START ./sysdeps/unix/sysv/linux/i386/Makefile:CFLAGS-initfini.s += -DWEAK_GMON_START ./sysdeps/unix/sysv/linux/powerpc/Makefile:CFLAGS-initfini.s += -DWEAK_GMON_START ./sysdeps/unix/sysv/linux/s390/s390-32/Makefile:CFLAGS-initfini.s += -DWEAK_GMON_START ./sysdeps/unix/sysv/linux/s390/s390-64/Makefile:CFLAGS-initfini.s += -DWEAK_GMON_START ./ChangeLog.9: * csu/initfini.c: Don't define __gmon_start__ if WEAK_GMON_START is ./ChangeLog.9: -DWEAK_GMON_START to CFLAGS-initfini.s. ./ChangeLog.10: (CFLAGS-initfini.s): New variable, add -DWEAK_GMON_START. ./ChangeLog.11: (CFLAGS-initfini.s): Add -DWEAK_GMON_START. gromit:/usr/src/cvs/libc:[0]$ I'll sent tomorrow a patch and remove the remaining occurences. Or is there any reason why we should leave them in? Andreas -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From drepper@redhat.com Tue May 22 12:07:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Tue, 22 May 2001 12:07:00 -0000 Subject: Do we need WEAK_GMON_START? References: Message-ID: Andreas Jaeger writes: > A grep through glibc revealed that we don't use WEAK_GMON_START > anymore: It's a left-over from a hack to work around a bug on Arm. I think it's not needed anymore. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Tue May 22 14:22:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Tue, 22 May 2001 14:22:00 -0000 Subject: [PATCH] Restore dlsym(RTLD_NEXT, ...) behaviour (take 3) References: <20010510145235.B503@sunsite.ms.mff.cuni.cz> <20010510183625.C503@sunsite.ms.mff.cuni.cz> <20010511003409.D503@sunsite.ms.mff.cuni.cz> <20010521121438.A596@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > How about this? > Passed glibc bootstrap and make check. Looks fine as far as I can see in the moment. I've checked it in. Thanks, -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Tue May 22 16:18:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Tue, 22 May 2001 16:18:00 -0000 Subject: [PATCH] Remove r_duplist & r_nduplist References: <20010518110354.J596@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > This patch removes duplist completely, saving some code and memory > especially in dl-deps. Looks OK. I've checked the patch in. Thanks, -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Tue May 22 16:42:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Tue, 22 May 2001 16:42:00 -0000 Subject: [PATCH] dl-lookup.c space saving References: <20010518162715.K596@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > do_lookup and do_lookup_versioned are quite big functions marked with static > inline and each of them is inlined 6 times, although IMHO only one place is > worth inlining and the remaining 5 places are better not inlined. I agree with the patch and checked it in. Thanks, -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Tue May 22 16:54:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Tue, 22 May 2001 16:54:00 -0000 Subject: [PATCH] Fix dl_close l_reldeps handling References: <20010522123941.C516@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > The attached testcase segfaults with current glibc. I guess it is quite > obvious, the issue is that _dl_close uses `map' instead of `imap' pointer, > which > a) after map is freed points to freed memory > b) even if that does work, we may add the same reldeps list several > times and some not at all, which means that some libraries may be > _dl_closed several times and if they get to zero l_opencount before > last _dl_close we have a problem again. I've applied the patch. Thanks, -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From aj@suse.de Tue May 22 23:24:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Tue, 22 May 2001 23:24:00 -0000 Subject: Do we need WEAK_GMON_START? References: Message-ID: Ulrich Drepper writes: > Andreas Jaeger writes: > > > A grep through glibc revealed that we don't use WEAK_GMON_START > > anymore: > > It's a left-over from a hack to work around a bug on Arm. I think > it's not needed anymore. I've removed now the last occurences and will commit the appended patch now, Andreas 2001-05-23 Andreas Jaeger * sysdeps/unix/sysv/linux/ia64/Makefile (CFLAGS-initfini.s): Remove, it's not used anywhere anymore. * sysdeps/unix/sysv/linux/s390/s390-64/Makefile (CFLAGS-initfini.s): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/Makefile (CFLAGS-initfini.s): Likewise. * sysdeps/unix/sysv/linux/powerpc/Makefile (CFLAGS-initfini.s): Likewise. * sysdeps/unix/sysv/linux/i386/Makefile (CFLAGS-initfini.s): Likewise. ============================================================ Index: sysdeps/unix/sysv/linux/i386/Makefile --- sysdeps/unix/sysv/linux/i386/Makefile 2001/01/17 01:13:44 1.19 +++ sysdeps/unix/sysv/linux/i386/Makefile 2001/05/23 06:23:29 @@ -14,10 +14,6 @@ sysdep-rtld-routines += dl-procinfo endif -ifeq ($(subdir),csu) -CFLAGS-initfini.s += -DWEAK_GMON_START -endif - ifeq ($(subdir),resource) sysdep_routines += oldgetrlimit64 endif ============================================================ Index: sysdeps/unix/sysv/linux/ia64/Makefile --- sysdeps/unix/sysv/linux/ia64/Makefile 2001/03/16 21:03:12 1.5 +++ sysdeps/unix/sysv/linux/ia64/Makefile 2001/05/23 06:23:29 @@ -6,10 +6,6 @@ sysdep_routines += __start_context endif -ifeq ($(subdir),csu) -CFLAGS-initfini.s += -DWEAK_GMON_START -endif - ifeq ($(subdir),misc) sysdep_headers += sys/io.h sysdep_routines += ioperm clone2 ============================================================ Index: sysdeps/unix/sysv/linux/powerpc/Makefile --- sysdeps/unix/sysv/linux/powerpc/Makefile 2000/08/28 08:37:54 1.3 +++ sysdeps/unix/sysv/linux/powerpc/Makefile 2001/05/23 06:23:29 @@ -3,10 +3,6 @@ rt_sigqueueinfo rt_sigaction rt_sigpending endif -ifeq ($(subdir),csu) -CFLAGS-initfini.s += -DWEAK_GMON_START -endif - ifeq ($(subdir),resource) sysdep_routines += oldgetrlimit64 endif ============================================================ Index: sysdeps/unix/sysv/linux/s390/s390-32/Makefile --- sysdeps/unix/sysv/linux/s390/s390-32/Makefile 2001/03/16 09:22:13 1.1 +++ sysdeps/unix/sysv/linux/s390/s390-32/Makefile 2001/05/23 06:23:29 @@ -3,10 +3,6 @@ sysdep_headers += sys/elf.h endif -ifeq ($(subdir),csu) -CFLAGS-initfini.s += -DWEAK_GMON_START -endif - ifeq ($(subdir),resource) sysdep_routines += oldgetrlimit64 endif ============================================================ Index: sysdeps/unix/sysv/linux/s390/s390-64/Makefile --- sysdeps/unix/sysv/linux/s390/s390-64/Makefile 2001/03/16 09:21:57 1.1 +++ sysdeps/unix/sysv/linux/s390/s390-64/Makefile 2001/05/23 06:23:29 @@ -1,7 +1,3 @@ -ifeq ($(subdir),csu) -CFLAGS-initfini.s += -DWEAK_GMON_START -endif - ifeq ($(subdir),misc) sysdep_routines += setfsgid setfsuid setresgid setresuid sysdep_headers += sys/elf.h -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From drepper@redhat.com Tue May 22 23:35:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Tue, 22 May 2001 23:35:00 -0000 Subject: Do we need WEAK_GMON_START? References: Message-ID: Andreas Jaeger writes: > I've removed now the last occurences and will commit the appended > patch now, OK. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From kukuk@suse.de Wed May 23 00:24:00 2001 From: kukuk@suse.de (Thorsten Kukuk) Date: Wed, 23 May 2001 00:24:00 -0000 Subject: getaddrinfo security problem ? References: <20010518162813.A9161@suse.de> <20010522154001.A8672@suse.de> Message-ID: <20010523092435.A17236@suse.de> On Tue, May 22, Philip.Blundell@pobox.com wrote: > >I would vote for the first option, removing > >it completly like BSD has done this. > > That seems reasonable to me. As far as I know nobody uses Unix sockets in > this way. Ok, I removed the gaih_local code complete, AF_UNIX is now not longer supported by getaddrinfo and we don't have the security problems with sockets in /tmp. I append the patch for getaddrinfo.c and the test program. Thorsten -- Thorsten Kukuk http://www.suse.de/~kukuk/ kukuk@suse.de SuSE GmbH Deutschherrnstr. 15-19 D-90429 Nuernberg -------------------------------------------------------------------- Key fingerprint = A368 676B 5E1B 3E46 CFCE 2D97 F8FD 4E23 56C6 FB4B From kkojima@rr.iij4u.or.jp Wed May 23 15:29:00 2001 From: kkojima@rr.iij4u.or.jp (kaz Kojima) Date: Wed, 23 May 2001 15:29:00 -0000 Subject: SH resolver change Message-ID: <200105232228.HAA05478@rr.iij4u.or.jp> Hi, Here's a patch to sh/dl-machine.h to handle the new PLT code generated by the newest GNU ld. It preserves the backward compatibility. Regards, kaz -- 2001-05-23 kaz Kojima * sysdeps/sh/dl-machine.h (_dl_runtime_resolve): Handle newer PLT. (_dl_runtime_profile): Likewise. Index: dl-machine.h =================================================================== RCS file: /cvs/glibc/libc/sysdeps/sh/dl-machine.h,v retrieving revision 1.6 diff -u -r1.6 dl-machine.h --- dl-machine.h 2001/03/06 07:30:22 1.6 +++ dl-machine.h 2001/05/23 22:09:35 @@ -165,6 +165,7 @@ .type _dl_runtime_resolve, @function .align 5 _dl_runtime_resolve: + mov.l r2,@-r15 mov.l r3,@-r15 mov.l r4,@-r15 mov.l r5,@-r15 @@ -175,6 +176,10 @@ mov.l r3,@-r15 " FGR_SAVE " sts.l pr,@-r15 + tst r0,r0 + bt 1f + mov r0,r2 +1: mov r0,r4 ! PLT type mov r2,r5 ! link map address " FUN_ADDR " @@ -189,8 +194,9 @@ mov.l @r15+,r6 mov.l @r15+,r5 mov.l @r15+,r4 + mov.l @r15+,r3 jmp @r0 ! Jump to function address. - mov.l @r15+,r3 + mov.l @r15+,r2 .align 2 3: .long " GOTJMP (fixup) " @@ -200,6 +206,7 @@ .type _dl_runtime_profile, @function .align 5 _dl_runtime_profile: + mov.l r2,@-r15 mov.l r3,@-r15 mov.l r4,@-r15 mov.l r5,@-r15 @@ -210,6 +217,10 @@ mov.l r3,@-r15 " FGR_SAVE " sts.l pr,@-r15 + tst r0,r0 + bt 1f + mov r0,r2 +1: mov r0,r4 ! PLT type mov r2,r5 ! link map address sts pr,r7 ! return address @@ -225,8 +236,9 @@ mov.l @r15+,r6 mov.l @r15+,r5 mov.l @r15+,r4 + mov.l @r15+,r3 jmp @r0 ! Jump to function address. - mov.l @r15+,r3 + mov.l @r15+,r2 .align 2 3: .long " GOTJMP (profile_fixup) " @@ -243,6 +255,7 @@ .align 5 _dl_runtime_resolve: _dl_runtime_profile: + mov.l r2,@-r15 mov.l r3,@-r15 mov.l r4,@-r15 mov.l r5,@-r15 @@ -253,6 +266,10 @@ mov.l r3,@-r15 " FGR_SAVE " sts.l pr,@-r15 + tst r0,r0 + bt 1f + mov r0,r2 +1: mov r0,r4 ! PLT type mov r2,r5 ! link map address sts pr,r7 ! return address @@ -268,8 +285,9 @@ mov.l @r15+,r6 mov.l @r15+,r5 mov.l @r15+,r4 + mov.l @r15+,r3 jmp @r0 ! Jump to function address. - mov.l @r15+,r3 + mov.l @r15+,r2 .align 2 3: .long " GOTJMP (fixup) " From drepper@redhat.com Wed May 23 15:49:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Wed, 23 May 2001 15:49:00 -0000 Subject: getaddrinfo security problem ? References: <20010518162813.A9161@suse.de> <20010522154001.A8672@suse.de> <20010523092435.A17236@suse.de> Message-ID: Thorsten Kukuk writes: > Ok, I removed the gaih_local code complete, AF_UNIX is now not longer > supported by getaddrinfo and we don't have the security problems > with sockets in /tmp. I've basically applied the patch. But instead of removing the code I've #ifdef'ed it out. For documentation purposes and in case somebody comes up with a way it can be made useful in a save way. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Wed May 23 16:55:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Wed, 23 May 2001 16:55:00 -0000 Subject: SH resolver change References: <200105232228.HAA05478@rr.iij4u.or.jp> Message-ID: kaz Kojima writes: > Here's a patch to sh/dl-machine.h to handle the new PLT code > generated by the newest GNU ld. It preserves the backward > compatibility. Thanks, I've applied the patch. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Sun May 27 00:27:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Sun, 27 May 2001 00:27:00 -0000 Subject: status + next two weeks Message-ID: I'm through with my mail backlog and all the patches are either applied or the submitter got a comment. I've tested on x86 and IA-64 (hopefully will finish Alpha). There are too many possibly outstanding reports [1] to justify making a test release. But all is not lost, I might have decent net connectivity next week. Perhaps if all goes well I can do something. But no promises. Footnotes: [1] In gnats that is. But I cannot access the reports reliably because of these $&%????$ FSF systems. I guess it's time to move this service over to sources as well. But it's Andreas who is fighting with those people. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From hjl@lucon.org Sun May 27 00:36:00 2001 From: hjl@lucon.org (H . J . Lu) Date: Sun, 27 May 2001 00:36:00 -0000 Subject: A MIPS IPC patch Message-ID: <20010527003619.A28824@lucon.org> __key was removed from ipc_perm by accident. Here is a patch. H.J. --- 2001-05-26 H.J. Lu * sysdeps/unix/sysv/linux/mips/bits/ipc.h (ipc_perm): Put back __key. Index: sysdeps/unix/sysv/linux/mips/bits/ipc.h =================================================================== RCS file: /work/cvs/gnu/glibc/sysdeps/unix/sysv/linux/mips/bits/ipc.h,v retrieving revision 1.1.1.2 diff -u -p -r1.1.1.2 ipc.h --- sysdeps/unix/sysv/linux/mips/bits/ipc.h 2001/05/05 04:06:23 1.1.1.2 +++ sysdeps/unix/sysv/linux/mips/bits/ipc.h 2001/05/27 07:34:16 @@ -42,6 +42,7 @@ /* Data structure used to pass permission information to IPC operations. */ struct ipc_perm { + __key_t __key; /* Key. */ unsigned int uid; /* Owner's user ID. */ unsigned int gid; /* Owner's group ID. */ unsigned int cuid; /* Creator's user ID. */ From hjl@lucon.org Sun May 27 00:46:00 2001 From: hjl@lucon.org (H . J . Lu) Date: Sun, 27 May 2001 00:46:00 -0000 Subject: A MIPS patch. Message-ID: <20010527004609.A15172@lucon.org> Here is another MIPS patch. I didn't check if the MAP_BASE_ADDR change would break the old binaries compiled with the IRIX ABI since all my MIPS binaries are compiled with the SVR4 ABI. H.J. ---- 2001-05-26 H.J. Lu * sysdeps/mips/dl-machine.h (MAP_BASE_ADDR): Commented out. * sysdeps/mips/rtld-ldscript.in: Removed. * sysdeps/mips/rtld-parms: Likewise. * sysdeps/mips/mips64/rtld-parms: Likewise. * sysdeps/mips/mipsel/rtld-parms: Likewise. * sysdeps/unix/sysv/linux/mips/syscalls.list: Change sigsuspend to s_sigsuspend. Add s_mmap2. * sysdeps/mips/atomicity.h: New file. * sysdeps/unix/sysv/linux/mips/getsysstats.c: New file. Index: sysdeps/mips/dl-machine.h =================================================================== RCS file: /work/cvs/gnu/glibc/sysdeps/mips/dl-machine.h,v retrieving revision 1.1.1.11 diff -u -p -r1.1.1.11 dl-machine.h --- sysdeps/mips/dl-machine.h 2001/02/22 22:21:42 1.1.1.11 +++ sysdeps/mips/dl-machine.h 2001/05/27 07:38:00 @@ -61,6 +61,10 @@ in l_info array. */ #define DT_MIPS(x) (DT_MIPS_##x - DT_LOPROC + DT_NUM) +#if 0 +/* We no longer do that since we switched to the SVR4 MIP ABI in + binutils. */ + /* * MIPS libraries are usually linked to a non-zero base address. We * subtract the base address from the address where we map the object @@ -76,6 +80,7 @@ (l)->l_info[DT_MIPS(BASE_ADDRESS)]->d_un.d_ptr : 0) #else #define MAP_BASE_ADDR(l) 0x5ffe0000 +#endif #endif /* If there is a DT_MIPS_RLD_MAP entry in the dynamic section, fill it in Index: sysdeps/mips/rtld-ldscript.in =================================================================== RCS file: /work/cvs/gnu/glibc/sysdeps/mips/rtld-ldscript.in,v retrieving revision 1.1.1.2 diff -u -p -r1.1.1.2 rtld-ldscript.in --- sysdeps/mips/rtld-ldscript.in 2001/05/27 06:52:15 1.1.1.2 +++ sysdeps/mips/rtld-ldscript.in 2001/05/27 07:38:00 @@ -1,105 +0,0 @@ -OUTPUT_ARCH(@@rtld-arch@@) -ENTRY(@@rtld-entry@@) -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - . = @@rtld-base@@; - .reginfo : { *(.reginfo) } - .dynamic : { *(.dynamic) } - .dynstr : { *(.dynstr) } - .dynsym : { *(.dynsym) } - .hash : { *(.hash) } - .rel.text : { *(.rel.text) } - .rela.text : { *(.rela.text) } - .rel.data : { *(.rel.data) } - .rela.data : { *(.rela.data) } - .rel.rodata : { *(.rel.rodata) } - .rela.rodata : { *(.rela.rodata) } - .rel.got : { *(.rel.got) } - .rela.got : { *(.rela.got) } - .rel.ctors : { *(.rel.ctors) } - .rela.ctors : { *(.rela.ctors) } - .rel.dtors : { *(.rel.dtors) } - .rela.dtors : { *(.rela.dtors) } - .rel.init : { *(.rel.init) } - .rela.init : { *(.rela.init) } - .rel.fini : { *(.rel.fini) } - .rela.fini : { *(.rela.fini) } - .rel.bss : { *(.rel.bss) } - .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .rodata : { *(.rodata) } - .rodata1 : { *(.rodata1) } - .init : { *(.init) } =0 - .text : - { - *(.text) - *(.stub) - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - } =0 - .fini : { *(.fini) } =0 - /* Adjust the address for the data segment. We want to adjust up to - the same address within the page on the next page up. It would - be more correct to do this: - . = 0x10000000; - The current expression does not correctly handle the case of a - text segment ending precisely at the end of a page; it causes the - data segment to skip a page. The above expression does not have - this problem, but it will currently (2/95) cause BFD to allocate - a single segment, combining both text and data, for this case. - This will prevent the text segment from being shared among - multiple executions of the program; I think that is more - important than losing a page of the virtual address space (note - that no actual memory is lost; the page which is skipped can not - be referenced). */ - . += 0x10000; - .data : - { - *(.data) - CONSTRUCTORS - } - .data1 : { *(.data1) } - .ctors : { *(.ctors) } - .dtors : { *(.dtors) } - _gp = ALIGN(16) + 0x7ff0; - .got : - { - *(.got.plt) *(.got) - } - /* We want the small data sections together, so single-instruction offsets - can access them all, and initialized data all before uninitialized, so - we can shorten the on-disk segment size. */ - .sdata : { *(.sdata) } - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } - .sbss : { *(.sbss) *(.scommon) } - .bss : - { - *(.dynbss) - *(.bss) - *(COMMON) - } - /* The normal linker scripts created by the binutils doesn't have the - symbols end and _end which breaks ld.so's dl-minimal.c. */ - _end = . ; - PROVIDE (end = .); - /* These are needed for ELF backends which have not yet been - converted to the new style linker. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - /* DWARF debug sections. - Symbols in the .debug DWARF section are relative to the beginning of the - section so we begin .debug at 0. It's not clear yet what needs to happen - for the others. */ - .debug 0 : { *(.debug) } - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - .debug_sfnames 0 : { *(.debug_sfnames) } - .line 0 : { *(.line) } - /* These must appear regardless of . */ - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } -} Index: sysdeps/mips/rtld-parms =================================================================== RCS file: /work/cvs/gnu/glibc/sysdeps/mips/rtld-parms,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 rtld-parms --- sysdeps/mips/rtld-parms 2000/05/21 21:11:43 1.1.1.1 +++ sysdeps/mips/rtld-parms 2001/05/27 07:38:00 @@ -1,15 +0,0 @@ -ifndef rtld-wordsize -rtld-wordsize = 32 -endif -ifndef rtld-oformat -rtld-oformat = elf$(rtld-wordsize)-bigmips -endif -ifndef rtld-arch -rtld-arch = mips -endif -ifndef rtld-entry -rtld-entry = __start -endif -ifndef rtld-base -rtld-base = 0x0fb60000 + SIZEOF_HEADERS -endif Index: sysdeps/mips/mips64/rtld-parms =================================================================== RCS file: /work/cvs/gnu/glibc/sysdeps/mips/mips64/rtld-parms,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 rtld-parms --- sysdeps/mips/mips64/rtld-parms 2000/05/21 21:11:43 1.1.1.1 +++ sysdeps/mips/mips64/rtld-parms 2001/05/27 07:38:00 @@ -1,3 +0,0 @@ -ifndef rtld-wordsize -rtld-wordsize = 64 -endif Index: sysdeps/mips/mipsel/rtld-parms =================================================================== RCS file: /work/cvs/gnu/glibc/sysdeps/mips/mipsel/rtld-parms,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 rtld-parms --- sysdeps/mips/mipsel/rtld-parms 2000/05/21 21:11:43 1.1.1.1 +++ sysdeps/mips/mipsel/rtld-parms 2001/05/27 07:38:00 @@ -1,3 +0,0 @@ -ifndef rtld-oformat -rtld-oformat = elf32-littlemips -endif Index: sysdeps/unix/sysv/linux/mips/syscalls.list =================================================================== RCS file: /work/cvs/gnu/glibc/sysdeps/unix/sysv/linux/mips/syscalls.list,v retrieving revision 1.1.1.7 diff -u -p -r1.1.1.7 syscalls.list --- sysdeps/unix/sysv/linux/mips/syscalls.list 2001/01/21 01:11:42 1.1.1.7 +++ sysdeps/unix/sysv/linux/mips/syscalls.list 2001/05/27 07:38:00 @@ -8,7 +8,7 @@ cachectl - cachectl i:pii __cachectl cac cacheflush - cacheflush i:pii _flush_cache cacheflush sysmips - sysmips i:iiii __sysmips sysmips -sigsuspend - sigsuspend i:p __sigsuspend sigsuspend +s_sigsuspend sigsuspend sigsuspend i:p __syscall_sigsuspend # # Socket functions; Linux/MIPS doesn't use the socketcall(2) wrapper; @@ -61,6 +61,7 @@ getresgid - getresgid i:ppp getresgid getresuid - getresuid i:ppp getresuid s_ipc msgget ipc i:iiiip __syscall_ipc s_lstat64 lxstat64 lstat64 i:sp __syscall_lstat64 +s_mmap2 mmap64 mmap2 b:aniiii __syscall_mmap2 s_poll poll poll i:pii __syscall_poll s_pread64 pread64 pread i:ibniii __syscall_pread s_putpmsg putpmsg putpmsg i:ippii __syscall_putpmsg --- /dev/null Fri Mar 23 20:37:44 2001 +++ sysdeps/mips/atomicity.h Sun May 27 00:38:00 2001 @@ -0,0 +1,128 @@ +/* Low-level functions for atomic operations. Mips version. + + Copyright (C) 2001 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef _MIPS_ATOMICITY_H +#define _MIPS_ATOMICITY_H 1 + +#include +#include + +#if (_MIPS_ISA >= _MIPS_ISA_MIPS2) + +static inline int +__attribute__ ((unused)) +exchange_and_add (volatile uint32_t *mem, int val) +{ + int result, tmp; + + __asm__ __volatile__ + ("/* Inline exchange & add */\n\t" + "1:\n\t" + "ll %0,%3\n\t" + "addu %1,%4,%0\n\t" + "sc %1,%2\n\t" + "beqz %1,1b\n\t" + "/* End exchange & add */" + : "=&r"(result), "=&r"(tmp), "=m"(*mem) + : "m" (*mem), "r"(val) + : "memory"); + + return result; +} + +static inline void +__attribute__ ((unused)) +atomic_add (volatile uint32_t *mem, int val) +{ + int result; + + __asm__ __volatile__ + ("/* Inline atomic add */\n\t" + "1:\n\t" + "ll %0,%2\n\t" + "addu %0,%3,%0\n\t" + "sc %0,%1\n\t" + "beqz %0,1b\n\t" + "/* End atomic add */" + : "=&r"(result), "=m"(*mem) + : "m" (*mem), "r"(val) + : "memory"); +} + +static inline int +__attribute__ ((unused)) +compare_and_swap (volatile long int *p, long int oldval, long int newval) +{ + long int ret; + + __asm__ __volatile__ + ("/* Inline compare & swap */\n\t" + "1:\n\t" + "ll %0,%4\n\t" + ".set push\n" + ".set noreorder\n\t" + "bne %0,%2,2f\n\t" + "move %0,%3\n\t" + ".set pop\n\t" + "sc %0,%1\n\t" + "beqz %0,1b\n" + "2:\n\t" + "/* End compare & swap */" + : "=&r" (ret), "=m" (*p) + : "r" (oldval), "r" (newval), "m" (*p) + : "memory"); + + return ret; +} + +#else /* (_MIPS_ISA >= _MIPS_ISA_MIPS2) */ + +#warning MIPS I atomicity functions are not atomic + +static inline int +__attribute__ ((unused)) +exchange_and_add (volatile uint32_t *mem, int val) +{ + int result = *mem; + *mem += val; + return result; +} + +static inline void +__attribute__ ((unused)) +atomic_add (volatile uint32_t *mem, int val) +{ + *mem += val; +} + +static inline int +__attribute__ ((unused)) +compare_and_swap (volatile long int *p, long int oldval, long int newval) +{ + if (*p != oldval) + return 0; + + *p = newval; + return 1; +} + +#endif /* !(_MIPS_ISA >= _MIPS_ISA_MIPS2) */ + +#endif /* atomicity.h */ --- /dev/null Fri Mar 23 20:37:44 2001 +++ sysdeps/unix/sysv/linux/mips/getsysstats.c Sun May 27 00:38:00 2001 @@ -0,0 +1,36 @@ +/* Determine various system internal values, Linux/MIPS version. + Copyright (C) 2001 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + + +/* We need to define a special parser for /proc/cpuinfo. */ +#define GET_NPROCS_PARSER(FP, BUFFER, RESULT) \ + do \ + { \ + (RESULT) = 0; \ + /* Read all lines and count the lines starting with the string \ + "cpu model". We don't have to fear extremely long lines since \ + the kernel will not generate them. 8192 bytes are really \ + enough. */ \ + while (fgets_unlocked (BUFFER, sizeof (BUFFER), FP) != NULL) \ + if (strncmp (BUFFER, "cpu model", 9) == 0) \ + ++(RESULT); \ + } \ + while (0) + +#include From hjl@lucon.org Sun May 27 00:51:00 2001 From: hjl@lucon.org (H . J . Lu) Date: Sun, 27 May 2001 00:51:00 -0000 Subject: A mmap64 patch Message-ID: <20010527005140.A30645@lucon.org> This patch removes the duplication of mmap64.c. You also need http://sources.redhat.com/ml/libc-hacker/2001-05/msg00070.html for the MIPS support. H.J. --- 2001-05-26 H.J. Lu * sysdeps/unix/sysv/linux/powerpc/mmap64.c: Moved to ... * sysdeps/unix/sysv/linux/mmap64.c: Here. * sysdeps/unix/sysv/linux/mmap64.c (PAGE_SHIFT): Define if not defined. Check PAGE_SHIFT only if __NR_mmap2 is defined. * sysdeps/unix/sysv/linux/hppa/mmap64.c : Removed. * sysdeps/unix/sysv/linux/sparc/sparc32/mmap64.c: Likewise. Index: sysdeps/unix/sysv/linux/powerpc/mmap64.c =================================================================== RCS file: /work/cvs/gnu/glibc/sysdeps/unix/sysv/linux/powerpc/mmap64.c,v retrieving revision 1.1.1.5 diff -u -p -r1.1.1.5 mmap64.c --- sysdeps/unix/sysv/linux/powerpc/mmap64.c 2001/05/05 04:06:28 1.1.1.5 +++ sysdeps/unix/sysv/linux/powerpc/mmap64.c 2001/05/27 07:47:55 @@ -1,88 +0,0 @@ -/* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek , 1999. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include - -#include -#include -#include - -#include "kernel-features.h" - -/* This is always the constant 12 for this routine, even if the actual - page size is larger. */ -#define PAGE_SHIFT 12 - -#ifdef __NR_mmap2 -extern void *__unbounded __syscall_mmap2(void *__unbounded, size_t, - int, int, int, off_t); -#ifndef __ASSUME_MMAP2_SYSCALL -static int have_no_mmap2; -#endif -#endif - -void * -__mmap64 (void *addr, size_t len, int prot, int flags, int fd, off64_t offset) -{ - if (offset & ((1 << PAGE_SHIFT)-1)) - { - __set_errno (EINVAL); - return MAP_FAILED; - } -#ifdef __NR_mmap2 -# ifndef __ASSUME_MMAP2_SYSCALL - if (! have_no_mmap2) -# endif - { -# ifndef __ASSUME_MMAP2_SYSCALL - int saved_errno = errno; -# endif - void *result; - __ptrvalue (result) = INLINE_SYSCALL (mmap2, 6, __ptrvalue (addr), len, - prot, flags, fd, - (off_t) (offset >> PAGE_SHIFT)); -# if __BOUNDED_POINTERS__ - __ptrlow (result) = __ptrvalue (result); - __ptrhigh (result) = __ptrvalue (result) + len; -# endif -# ifndef __ASSUME_MMAP2_SYSCALL - if (result != MAP_FAILED || errno != ENOSYS) -# endif - return result; - -# ifndef __ASSUME_MMAP2_SYSCALL - __set_errno (saved_errno); - have_no_mmap2 = 1; -# endif - } -#endif -#ifndef __ASSUME_MMAP2_SYSCALL - if (offset != (off_t) offset || (offset + len) != (off_t) (offset + len)) - { - __set_errno (EINVAL); - return MAP_FAILED; - } - - return __mmap (addr, len, prot, flags, fd, (off_t) offset); -#endif -} - -weak_alias (__mmap64, mmap64) Index: sysdeps/unix/sysv/linux/mmap64.c =================================================================== RCS file: /work/cvs/gnu/glibc/sysdeps/unix/sysv/linux/mmap64.c,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 mmap64.c --- sysdeps/unix/sysv/linux/mmap64.c 2000/05/21 21:11:52 1.1.1.1 +++ sysdeps/unix/sysv/linux/mmap64.c 2001/05/27 07:46:42 @@ -1,6 +1,6 @@ -/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Daniel Jacobowitz , 1999. + Contributed by Jakub Jelinek , 1999. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as @@ -19,21 +19,63 @@ #include #include +#include #include #include +#include -#include +#include "kernel-features.h" + +#ifdef __NR_mmap2 +#ifndef PAGE_SHIFT +#define PAGE_SHIFT 12 +#endif + +extern void *__unbounded __syscall_mmap2(void *__unbounded, size_t, + int, int, int, off_t); +#ifndef __ASSUME_MMAP2_SYSCALL +static int have_no_mmap2; +#endif +#endif -__ptr_t -__mmap64 (addr, len, prot, flags, fd, offset) - __ptr_t addr; - size_t len; - int prot; - int flags; - int fd; - off64_t offset; +void * +__mmap64 (void *addr, size_t len, int prot, int flags, int fd, off64_t offset) { +#ifdef __NR_mmap2 + if (offset & ((1 << PAGE_SHIFT)-1)) + { + __set_errno (EINVAL); + return MAP_FAILED; + } +# ifndef __ASSUME_MMAP2_SYSCALL + if (! have_no_mmap2) +# endif + { +# ifndef __ASSUME_MMAP2_SYSCALL + int saved_errno = errno; +# endif + void *result; + __ptrvalue (result) = + (void *__unbounded) INLINE_SYSCALL (mmap2, 6, __ptrvalue (addr), + len, prot, flags, fd, + (off_t) (offset >> PAGE_SHIFT)); +# if __BOUNDED_POINTERS__ + __ptrlow (result) = __ptrvalue (result); + __ptrhigh (result) = __ptrvalue (result) + len; +# endif +# ifndef __ASSUME_MMAP2_SYSCALL + if (result != MAP_FAILED || errno != ENOSYS) +# endif + return result; + +# ifndef __ASSUME_MMAP2_SYSCALL + __set_errno (saved_errno); + have_no_mmap2 = 1; +# endif + } +#endif +#ifndef __ASSUME_MMAP2_SYSCALL if (offset != (off_t) offset || (offset + len) != (off_t) (offset + len)) { __set_errno (EINVAL); @@ -41,6 +83,7 @@ __mmap64 (addr, len, prot, flags, fd, of } return __mmap (addr, len, prot, flags, fd, (off_t) offset); +#endif } weak_alias (__mmap64, mmap64) Index: sysdeps/unix/sysv/linux/hppa/mmap64.c =================================================================== RCS file: /work/cvs/gnu/glibc/sysdeps/unix/sysv/linux/hppa/mmap64.c,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 mmap64.c --- sysdeps/unix/sysv/linux/hppa/mmap64.c 2001/05/05 04:06:09 1.1.1.1 +++ sysdeps/unix/sysv/linux/hppa/mmap64.c 2001/05/27 07:46:42 @@ -1 +0,0 @@ -#include Index: sysdeps/unix/sysv/linux/sparc/sparc32/mmap64.c =================================================================== RCS file: /work/cvs/gnu/glibc/sysdeps/unix/sysv/linux/sparc/sparc32/mmap64.c,v retrieving revision 1.1.1.2 diff -u -p -r1.1.1.2 mmap64.c --- sysdeps/unix/sysv/linux/sparc/sparc32/mmap64.c 2000/07/12 18:52:19 1.1.1.2 +++ sysdeps/unix/sysv/linux/sparc/sparc32/mmap64.c 2001/05/27 07:46:57 @@ -1,80 +0,0 @@ -/* Copyright (C) 1999, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek , 1999. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include - -#include -#include -#include - -#include "kernel-features.h" - -#ifdef __NR_mmap2 -extern void *__unbounded __syscall_mmap2 (void *__unbounded, size_t, - int, int, int, off_t); -# ifndef __ASSUME_MMAP2_SYSCALL -static int have_no_mmap2; -# endif -#endif - -__ptr_t -__mmap64 (__ptr_t addr, size_t len, int prot, int flags, int fd, off64_t offset) -{ -#ifdef __NR_mmap2 - if ( -# ifndef __ASSUME_MMAP2_SYSCALL - ! have_no_mmap2 && -# endif - ! (offset & 4095)) - { -# ifndef __ASSUME_MMAP2_SYSCALL - int saved_errno = errno; -# endif - /* This will be always 12, no matter what page size is. */ - __ptr_t result; - __ptrvalue (result) = - (void *__unbounded) INLINE_SYSCALL (mmap2, 6, addr, len, prot, flags, - fd, (off_t) (offset >> 12)); -# if __BOUNDED_POINTERS__ - __ptrlow (result) = __ptrvalue (result); - __ptrhigh (result) = __ptrvalue (result) + len; -# endif -# ifndef __ASSUME_MMAP2_SYSCALL - if (result != (__ptr_t) -1 || errno != ENOSYS) -# endif - return result; - -# ifndef __ASSUME_MMAP2_SYSCALL - __set_errno (saved_errno); - have_no_mmap2 = 1; -# endif - } -#endif - if (offset != (off_t) offset || (offset + len) != (off_t) (offset + len)) - { - __set_errno (EINVAL); - return MAP_FAILED; - } - - return __mmap (addr, len, prot, flags, fd, (off_t) offset); -} - -weak_alias (__mmap64, mmap64) From drepper@redhat.com Sun May 27 00:58:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Sun, 27 May 2001 00:58:00 -0000 Subject: A MIPS IPC patch References: <20010527003619.A28824@lucon.org> Message-ID: "H . J . Lu" writes: > __key was removed from ipc_perm by accident. Here is a patch. Pass this by the MIPS maintainer. This is a binary-incompatible change. They have to decide what to do. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Sun May 27 00:59:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Sun, 27 May 2001 00:59:00 -0000 Subject: A MIPS patch. References: <20010527004609.A15172@lucon.org> Message-ID: "H . J . Lu" writes: > Here is another MIPS patch. I didn't check if the MAP_BASE_ADDR > change would break the old binaries compiled with the IRIX ABI since > all my MIPS binaries are compiled with the SVR4 ABI. Once again, this is up to the MIPS maintainers. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From drepper@redhat.com Sun May 27 00:59:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Sun, 27 May 2001 00:59:00 -0000 Subject: A mmap64 patch References: <20010527005140.A30645@lucon.org> Message-ID: "H . J . Lu" writes: > This patch removes the duplication of mmap64.c. You also need You've been told that this is not acceptable. See Geoff's replies. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From hjl@lucon.org Sun May 27 01:04:00 2001 From: hjl@lucon.org (H . J . Lu) Date: Sun, 27 May 2001 01:04:00 -0000 Subject: A mmap64 patch References: <20010527005140.A30645@lucon.org> Message-ID: <20010527010436.C30645@lucon.org> On Sun, May 27, 2001 at 12:58:05AM -0700, Ulrich Drepper wrote: > "H . J . Lu" writes: > > > This patch removes the duplication of mmap64.c. You also need > > You've been told that this is not acceptable. See Geoff's replies. > Which one? If you meant http://sources.redhat.com/ml/libc-alpha/2001-05/msg00265.html then see http://sources.redhat.com/ml/libc-alpha/2001-05/msg00271.html BTW, MIPS needs mmap64. H.J. From drepper@redhat.com Sun May 27 01:17:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Sun, 27 May 2001 01:17:00 -0000 Subject: A mmap64 patch References: <20010527005140.A30645@lucon.org> <20010527010436.C30645@lucon.org> Message-ID: "H . J . Lu" writes: > BTW, MIPS needs mmap64. Then use the PPC version. It is wrong to give the impression that this is the correct way of handling large files. Every new port should not even have a non-large-file mode. -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From aj@suse.de Sun May 27 01:35:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Sun, 27 May 2001 01:35:00 -0000 Subject: A MIPS IPC patch References: <20010527003619.A28824@lucon.org> Message-ID: Thanks, I'll commit this now. Andreas -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From aj@suse.de Sun May 27 01:39:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Sun, 27 May 2001 01:39:00 -0000 Subject: A MIPS patch. References: <20010527004609.A15172@lucon.org> Message-ID: "H . J . Lu" writes: > Here is another MIPS patch. I didn't check if the MAP_BASE_ADDR > change would break the old binaries compiled with the IRIX ABI since > all my MIPS binaries are compiled with the SVR4 ABI. And that's the point I'd like to have verified before. Can you ask some MIPS developers to check that part of your patch? The other changes are fine, I'll commit them now, Thanks, Andreas -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj From jakub@redhat.com Sun May 27 04:02:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Sun, 27 May 2001 04:02:00 -0000 Subject: A mmap64 patch References: <20010527005140.A30645@lucon.org> Message-ID: <20010527130419.B601@sunsite.ms.mff.cuni.cz> On Sun, May 27, 2001 at 12:51:40AM -0700, H . J . Lu wrote: > This patch removes the duplication of mmap64.c. You also need > > http://sources.redhat.com/ml/libc-hacker/2001-05/msg00070.html > > for the MIPS support. This is wrong on sparc32. sparc32 has page size either 4K or 8K, but the mmap2 shift is always 12. The value of PAGE_SHIFT depends on what the kernel has been configured for (sun4 vs. sun4[cdm]). Jakub From hjl@lucon.org Sun May 27 09:49:00 2001 From: hjl@lucon.org (H . J . Lu) Date: Sun, 27 May 2001 09:49:00 -0000 Subject: A mmap64 patch References: <20010527005140.A30645@lucon.org> <20010527130419.B601@sunsite.ms.mff.cuni.cz> Message-ID: <20010527094941.A24897@lucon.org> On Sun, May 27, 2001 at 01:04:20PM +0200, Jakub Jelinek wrote: > On Sun, May 27, 2001 at 12:51:40AM -0700, H . J . Lu wrote: > > This patch removes the duplication of mmap64.c. You also need > > > > http://sources.redhat.com/ml/libc-hacker/2001-05/msg00070.html > > > > for the MIPS support. > > This is wrong on sparc32. sparc32 has page size either 4K or 8K, but the > mmap2 shift is always 12. > The value of PAGE_SHIFT depends on what the kernel has been configured for > (sun4 vs. sun4[cdm]). > Thanks. How about this patch? H.J. --- 2001-05-27 H.J. Lu * sysdeps/unix/sysv/linux/powerpc/mmap64.c: Moved to ... * sysdeps/unix/sysv/linux/mmap64.c: Here. * sysdeps/unix/sysv/linux/mmap64.c (MMAP2_PAGE_SHIFT): Renamed from PAGE_SHIFT. Define if not defined. Check MMAP2_PAGE_SHIFT only if __NR_mmap2 is defined. * sysdeps/unix/sysv/linux/hppa/mmap64.c : Removed. * sysdeps/unix/sysv/linux/sparc/sparc32/mmap64.c: Likewise. Index: sysdeps/unix/sysv/linux/hppa/mmap64.c =================================================================== RCS file: /work/cvs/gnu/glibc/sysdeps/unix/sysv/linux/hppa/mmap64.c,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 mmap64.c --- sysdeps/unix/sysv/linux/hppa/mmap64.c 2001/05/05 04:06:09 1.1.1.1 +++ sysdeps/unix/sysv/linux/hppa/mmap64.c 2001/05/27 07:46:42 @@ -1 +0,0 @@ -#include Index: sysdeps/unix/sysv/linux/mmap64.c =================================================================== RCS file: /work/cvs/gnu/glibc/sysdeps/unix/sysv/linux/mmap64.c,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 mmap64.c --- sysdeps/unix/sysv/linux/mmap64.c 2000/05/21 21:11:52 1.1.1.1 +++ sysdeps/unix/sysv/linux/mmap64.c 2001/05/27 16:45:30 @@ -1,6 +1,6 @@ -/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Daniel Jacobowitz , 1999. + Contributed by Jakub Jelinek , 1999. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as @@ -19,21 +19,63 @@ #include #include +#include #include #include +#include -#include +#include "kernel-features.h" + +#ifdef __NR_mmap2 +#ifndef MMAP2_PAGE_SHIFT +#define MMAP2_PAGE_SHIFT 12 +#endif + +extern void *__unbounded __syscall_mmap2(void *__unbounded, size_t, + int, int, int, off_t); +#ifndef __ASSUME_MMAP2_SYSCALL +static int have_no_mmap2; +#endif +#endif -__ptr_t -__mmap64 (addr, len, prot, flags, fd, offset) - __ptr_t addr; - size_t len; - int prot; - int flags; - int fd; - off64_t offset; +void * +__mmap64 (void *addr, size_t len, int prot, int flags, int fd, off64_t offset) { +#ifdef __NR_mmap2 + if (offset & ((1 << MMAP2_PAGE_SHIFT)-1)) + { + __set_errno (EINVAL); + return MAP_FAILED; + } +# ifndef __ASSUME_MMAP2_SYSCALL + if (! have_no_mmap2) +# endif + { +# ifndef __ASSUME_MMAP2_SYSCALL + int saved_errno = errno; +# endif + void *result; + __ptrvalue (result) = + (void *__unbounded) INLINE_SYSCALL (mmap2, 6, __ptrvalue (addr), + len, prot, flags, fd, + (off_t) (offset >> MMAP2_PAGE_SHIFT)); +# if __BOUNDED_POINTERS__ + __ptrlow (result) = __ptrvalue (result); + __ptrhigh (result) = __ptrvalue (result) + len; +# endif +# ifndef __ASSUME_MMAP2_SYSCALL + if (result != MAP_FAILED || errno != ENOSYS) +# endif + return result; + +# ifndef __ASSUME_MMAP2_SYSCALL + __set_errno (saved_errno); + have_no_mmap2 = 1; +# endif + } +#endif +#ifndef __ASSUME_MMAP2_SYSCALL if (offset != (off_t) offset || (offset + len) != (off_t) (offset + len)) { __set_errno (EINVAL); @@ -41,6 +83,7 @@ __mmap64 (addr, len, prot, flags, fd, of } return __mmap (addr, len, prot, flags, fd, (off_t) offset); +#endif } weak_alias (__mmap64, mmap64) Index: sysdeps/unix/sysv/linux/powerpc/mmap64.c =================================================================== RCS file: /work/cvs/gnu/glibc/sysdeps/unix/sysv/linux/powerpc/mmap64.c,v retrieving revision 1.1.1.5 diff -u -p -r1.1.1.5 mmap64.c --- sysdeps/unix/sysv/linux/powerpc/mmap64.c 2001/05/05 04:06:28 1.1.1.5 +++ sysdeps/unix/sysv/linux/powerpc/mmap64.c 2001/05/27 07:47:55 @@ -1,88 +0,0 @@ -/* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek , 1999. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include - -#include -#include -#include - -#include "kernel-features.h" - -/* This is always the constant 12 for this routine, even if the actual - page size is larger. */ -#define PAGE_SHIFT 12 - -#ifdef __NR_mmap2 -extern void *__unbounded __syscall_mmap2(void *__unbounded, size_t, - int, int, int, off_t); -#ifndef __ASSUME_MMAP2_SYSCALL -static int have_no_mmap2; -#endif -#endif - -void * -__mmap64 (void *addr, size_t len, int prot, int flags, int fd, off64_t offset) -{ - if (offset & ((1 << PAGE_SHIFT)-1)) - { - __set_errno (EINVAL); - return MAP_FAILED; - } -#ifdef __NR_mmap2 -# ifndef __ASSUME_MMAP2_SYSCALL - if (! have_no_mmap2) -# endif - { -# ifndef __ASSUME_MMAP2_SYSCALL - int saved_errno = errno; -# endif - void *result; - __ptrvalue (result) = INLINE_SYSCALL (mmap2, 6, __ptrvalue (addr), len, - prot, flags, fd, - (off_t) (offset >> PAGE_SHIFT)); -# if __BOUNDED_POINTERS__ - __ptrlow (result) = __ptrvalue (result); - __ptrhigh (result) = __ptrvalue (result) + len; -# endif -# ifndef __ASSUME_MMAP2_SYSCALL - if (result != MAP_FAILED || errno != ENOSYS) -# endif - return result; - -# ifndef __ASSUME_MMAP2_SYSCALL - __set_errno (saved_errno); - have_no_mmap2 = 1; -# endif - } -#endif -#ifndef __ASSUME_MMAP2_SYSCALL - if (offset != (off_t) offset || (offset + len) != (off_t) (offset + len)) - { - __set_errno (EINVAL); - return MAP_FAILED; - } - - return __mmap (addr, len, prot, flags, fd, (off_t) offset); -#endif -} - -weak_alias (__mmap64, mmap64) Index: sysdeps/unix/sysv/linux/sparc/sparc32/mmap64.c =================================================================== RCS file: /work/cvs/gnu/glibc/sysdeps/unix/sysv/linux/sparc/sparc32/mmap64.c,v retrieving revision 1.1.1.2 diff -u -p -r1.1.1.2 mmap64.c --- sysdeps/unix/sysv/linux/sparc/sparc32/mmap64.c 2000/07/12 18:52:19 1.1.1.2 +++ sysdeps/unix/sysv/linux/sparc/sparc32/mmap64.c 2001/05/27 07:46:57 @@ -1,80 +0,0 @@ -/* Copyright (C) 1999, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek , 1999. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include - -#include -#include -#include - -#include "kernel-features.h" - -#ifdef __NR_mmap2 -extern void *__unbounded __syscall_mmap2 (void *__unbounded, size_t, - int, int, int, off_t); -# ifndef __ASSUME_MMAP2_SYSCALL -static int have_no_mmap2; -# endif -#endif - -__ptr_t -__mmap64 (__ptr_t addr, size_t len, int prot, int flags, int fd, off64_t offset) -{ -#ifdef __NR_mmap2 - if ( -# ifndef __ASSUME_MMAP2_SYSCALL - ! have_no_mmap2 && -# endif - ! (offset & 4095)) - { -# ifndef __ASSUME_MMAP2_SYSCALL - int saved_errno = errno; -# endif - /* This will be always 12, no matter what page size is. */ - __ptr_t result; - __ptrvalue (result) = - (void *__unbounded) INLINE_SYSCALL (mmap2, 6, addr, len, prot, flags, - fd, (off_t) (offset >> 12)); -# if __BOUNDED_POINTERS__ - __ptrlow (result) = __ptrvalue (result); - __ptrhigh (result) = __ptrvalue (result) + len; -# endif -# ifndef __ASSUME_MMAP2_SYSCALL - if (result != (__ptr_t) -1 || errno != ENOSYS) -# endif - return result; - -# ifndef __ASSUME_MMAP2_SYSCALL - __set_errno (saved_errno); - have_no_mmap2 = 1; -# endif - } -#endif - if (offset != (off_t) offset || (offset + len) != (off_t) (offset + len)) - { - __set_errno (EINVAL); - return MAP_FAILED; - } - - return __mmap (addr, len, prot, flags, fd, (off_t) offset); -} - -weak_alias (__mmap64, mmap64) From hjl@lucon.org Sun May 27 09:53:00 2001 From: hjl@lucon.org (H . J . Lu) Date: Sun, 27 May 2001 09:53:00 -0000 Subject: A MIPS patch. References: <20010527004609.A15172@lucon.org> <20010527092104.R237@visi.net> Message-ID: <20010527095326.C24897@lucon.org> On Sun, May 27, 2001 at 09:21:04AM -0400, Ben Collins wrote: > > > > Debian mips porters have been using this patch instead. > > +#define MAP_BASE_ADDR(l) ((l)->l_addr >= 0x5ffe0000 ? 0x5ffe0000 : 0) > > It makes both binaries still work. I'd suggest this to the mips porters > before you patch. If someone can send me a few simple MIPS executables and DSOs with the IRIX ABI, I will look into it. H.J. From hjl@lucon.org Sun May 27 10:36:00 2001 From: hjl@lucon.org (H . J . Lu) Date: Sun, 27 May 2001 10:36:00 -0000 Subject: A mmap64 patch References: <20010527005140.A30645@lucon.org> <20010527010436.C30645@lucon.org> Message-ID: <20010527103651.A25868@lucon.org> On Sun, May 27, 2001 at 01:16:01AM -0700, Ulrich Drepper wrote: > "H . J . Lu" writes: > > > BTW, MIPS needs mmap64. > > Then use the PPC version. It is wrong to give the impression that Can you tell me the difference between the ppc version and the sparc32 version? > this is the correct way of handling large files. Every new port > should not even have a non-large-file mode. I think you get it backward. The kernel decides the size of off_t. Like it or not, people porting glibc makes glibc to work with the kernel. I have no idea what you meant by "new port". How new is new? Besides my patch removes 2 files and makes mips to work. As I have said many times before, all ports with 64bit off_t should define a dummy mmap64.c. On those ports, there is no mmap2 syscall. There is no difference between the current mmap64.c and the new one. Could you please tell me in what aspect my patch changes new port? H.J. From hjl@lucon.org Sun May 27 21:53:00 2001 From: hjl@lucon.org (H . J . Lu) Date: Sun, 27 May 2001 21:53:00 -0000 Subject: A mmap64 patch References: <20010527005140.A30645@lucon.org> <20010527010436.C30645@lucon.org> <200105280234.TAA15279@geoffk.org> Message-ID: <20010527215330.A3044@lucon.org> On Sun, May 27, 2001 at 07:34:59PM -0700, Geoff Keating wrote: > > > > Which one? If you meant > > > > http://sources.redhat.com/ml/libc-alpha/2001-05/msg00265.html > > > > then see > > > > http://sources.redhat.com/ml/libc-alpha/2001-05/msg00271.html > > Your reply didn't seem to make sense. > > The code in sysdeps/unix/sysv/linux is for new ports. Old ports that Wrong. The code in sysdeps/unix/sysv/linux is for ports with 32bit offset. All ports with 64bit offset, new and old, should have a dummy mmap64.c like --- /* mmap64 is the same as mmap. */ --- in the port-specific dircetory. > need backwards compatibility use routines in port-specific > directiories. Let's see what my patch does: 1. It removes mmap64.c for ppc, sparc64 and hppa. 2. It updates mmap64.c in sysdeps/unix/sysv/linux to support all ports with 32bit offset. Which one do you think not to make sense? BTW, that is the way we handle all other xxx64 functions. A port can define its own xxx64 file if it has to be handled differently from other ports with 32bit offset. My patch doesn't mean the new port with 64bit offset doesn't need a dummy mmap64.c. A dummy mmap64.c is required for a port with 32bit offset. It has nothing to do with my patch. > > New ports should not have a mmap2() system call at all. Instead, they > should have a mmap() system call that takes a 64-bit offset. Their > mmap64() library routine should be just a direct system call, and so > either they don't need any mmap64.c file at all or it should be a > dummy file. I don't think it is the way glibc does xxx64 function. We always have a dummy xxx64.c file if xxx is thes same as xxx64. In any case, what does it have anything to do with my patch? H.J. From jakub@redhat.com Sun May 27 23:29:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Sun, 27 May 2001 23:29:00 -0000 Subject: A mmap64 patch References: <20010527005140.A30645@lucon.org> <20010527010436.C30645@lucon.org> <200105280234.TAA15279@geoffk.org> <20010527215330.A3044@lucon.org> Message-ID: <20010528083115.C601@sunsite.ms.mff.cuni.cz> On Sun, May 27, 2001 at 09:53:30PM -0700, H . J . Lu wrote: > > Your reply didn't seem to make sense. > > > > The code in sysdeps/unix/sysv/linux is for new ports. Old ports that > > Wrong. The code in sysdeps/unix/sysv/linux is for ports with 32bit > offset. All ports with 64bit offset, new and old, should have a dummy > mmap64.c like sysv/linux should really be for new ports. Perhaps we should restructure sysv/linux by adding sysv/linux/wordsize-32 and sysv/linux/wordsize-64 (and adding related Implies) and moving files common to 32 or 64bit linux ports in there. The legacy kernel support in i386/ which many older ports include via #include from i386/ dir could perhaps get some subdirectory as well, so that it is clear that new ports should not use it (they unfortunately often do). Jakub From hjl@lucon.org Sun May 27 23:39:00 2001 From: hjl@lucon.org (H . J . Lu) Date: Sun, 27 May 2001 23:39:00 -0000 Subject: A mmap64 patch References: <20010527005140.A30645@lucon.org> <20010527010436.C30645@lucon.org> <200105280234.TAA15279@geoffk.org> <20010527215330.A3044@lucon.org> <20010528083115.C601@sunsite.ms.mff.cuni.cz> Message-ID: <20010527233919.A4778@lucon.org> On Mon, May 28, 2001 at 08:31:15AM +0200, Jakub Jelinek wrote: > On Sun, May 27, 2001 at 09:53:30PM -0700, H . J . Lu wrote: > > > Your reply didn't seem to make sense. > > > > > > The code in sysdeps/unix/sysv/linux is for new ports. Old ports that > > > > Wrong. The code in sysdeps/unix/sysv/linux is for ports with 32bit > > offset. All ports with 64bit offset, new and old, should have a dummy > > mmap64.c like > > sysv/linux should really be for new ports. > Perhaps we should restructure sysv/linux by adding sysv/linux/wordsize-32 > and sysv/linux/wordsize-64 (and adding related Implies) and moving files I don't think it applies to those xxx64 64bit offset I/O functions. If I get it right, you can have a port with wordsize == 32bit, but 64bit off_t. Basically, the size of off_t may not be the same as wordsize. And the new port should use 64bit off_t even if the hardware is 32bit. Did you try to say sysv/linux/off_t-64 and sysv/linux/off_t-32, or something like it? H.J. From jakub@redhat.com Tue May 29 01:24:00 2001 From: jakub@redhat.com (Jakub Jelinek) Date: Tue, 29 May 2001 01:24:00 -0000 Subject: [PATCH] Fix rpc/ headers with -std=c[89]9 Message-ID: <20010529102640.A1854@sunsite.ms.mff.cuni.cz> Hi! rpc/ headers use some types which are only defined with __USE_BSD, so including a rpc/ header in -std=c[89]9 or -ansi compilation fails. Below are two approaches, the first is just to use __ prefixed variants of the types in rpc/ headers, the latter is to define those types in rpc/types.h even if __USE_BSD is not defined (sunrpc code especially rpcgen generated will probably use those types as well). Jakub From drepper@redhat.com Wed May 30 05:56:00 2001 From: drepper@redhat.com (Ulrich Drepper) Date: Wed, 30 May 2001 05:56:00 -0000 Subject: [PATCH] Fix rpc/ headers with -std=c[89]9 References: <20010529102640.A1854@sunsite.ms.mff.cuni.cz> Message-ID: Jakub Jelinek writes: > rpc/ headers use some types which are only defined with __USE_BSD, so > including a rpc/ header in -std=c[89]9 or -ansi compilation fails. > Below are two approaches, [...] I prefer the second one and have applied the patch. Thanks, -- ---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------ From schwidefsky@de.ibm.com Thu May 31 06:39:00 2001 From: schwidefsky@de.ibm.com (schwidefsky@de.ibm.com) Date: Thu, 31 May 2001 06:39:00 -0000 Subject: greg_t aligned incorrecly (on s390). Message-ID: Hi, DJ found a problem with the greg_t definition for s390. It needs to have an 8 byte alignment to match the definitions in the kernel headers. This caused trouble with gdb. ChangeLog & Patch: 2001-05-30 Martin Schwidefsky * sysdeps/unix/sysv/linux/s390/s390-32/sys/ucontext.h: greg_t needs to have the same aligment as the kernel structure. (See attached file: ucontext.diff) blue skies, Martin Linux/390 Design & Development, IBM Deutschland Entwicklung GmbH Sch????naicherstr. 220, D-71032 B????blingen, Telefon: 49 - (0)7031 - 16-2247 E-Mail: schwidefsky@de.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: ucontext.diff Type: text/x-diff Size: 566 bytes Desc: not available URL: From aj@suse.de Thu May 31 11:21:00 2001 From: aj@suse.de (Andreas Jaeger) Date: Thu, 31 May 2001 11:21:00 -0000 Subject: greg_t aligned incorrecly (on s390). References: Message-ID: Thanks, I've committed this, Andreas -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj