public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix sparc build
@ 2004-10-14  9:45 Jakub Jelinek
  2004-10-14 10:03 ` Roland McGrath
  2004-10-14 15:26 ` Jakub Jelinek
  0 siblings, 2 replies; 5+ messages in thread
From: Jakub Jelinek @ 2004-10-14  9:45 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Glibc hackers

Hi!

1) sparc32 doesn't define __NR_setres[ug]id, only __NR_setres[ug]id32.
   So if the *id32 syscall fails, it should ENOSYS, but shouldn't ENOSYS
   always.
2) sparc mathinline.h needs __NTHification
3) on SPARC, the sequence to set up load address of rtld_errno is IMHO too
   long to be included in INLINE_SYSCALL, so this patch makes
   __errno_location () hidden within ld.so if RTLD_PRIVATE_ERRNO and
   return &rtld_errno.

2004-10-14  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/unix/sysv/linux/i386/setresuid.c: Handle
	defined __NR_setresuid32 && !defined __NR_setresuid.
	* sysdeps/unix/sysv/linux/i386/setresgid.c: Handle
	defined __NR_setresgid32 && !defined __NR_setresgid.

	* sysdeps/sparc/fpu/bits/mathinline.h (__signbitf, __signbit,
	__signbitl, sqrtf, sqrt, sqrtl, fdim, fdimf): Use __NTH macro.

	* sysdeps/generic/errno-loc.c: Don't undef #errno
	if RTLD_PRIVATE_ERRNO.
	* include/errno.h (__errno_location): If RTLD_PRIVATE_ERRNO,
	add attribute_hidden.
linuxthreads/
	* sysdeps/pthread/errno-loc.c: Don't undef #errno
	if RTLD_PRIVATE_ERRNO.

--- libc/sysdeps/unix/sysv/linux/i386/setresuid.c.jj	2004-09-20 01:44:35.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/i386/setresuid.c	2004-10-14 11:35:54.055164737 +0200
@@ -28,7 +28,7 @@
 #include <pthread-functions.h>
 
 
-#ifdef __NR_setresuid
+#if defined __NR_setresuid || defined __NR_setresuid32
 
 # ifdef __NR_setresuid32
 #  if __ASSUME_32BITUIDS == 0
@@ -43,7 +43,7 @@ __setresuid (uid_t ruid, uid_t euid, uid
 {
   int result;
 
-# if __ASSUME_32BITUIDS > 0
+# if __ASSUME_32BITUIDS > 0 || !defined __NR_setresuid
   result = INLINE_SYSCALL (setresuid32, 3, ruid, euid, suid);
 # else
 #  ifdef __NR_setresuid32
--- libc/sysdeps/unix/sysv/linux/i386/setresgid.c.jj	2004-09-20 01:44:35.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/i386/setresgid.c	2004-10-14 11:35:54.056164558 +0200
@@ -28,7 +28,7 @@
 #include <pthread-functions.h>
 
 
-#ifdef __NR_setresgid
+#if defined __NR_setresgid || defined __NR_setresgid32
 
 # ifdef __NR_setresgid32
 #  if __ASSUME_32BITUIDS == 0
@@ -43,7 +43,7 @@ __setresgid (gid_t rgid, gid_t egid, gid
 {
   int result;
 
-# if __ASSUME_32BITUIDS > 0
+# if __ASSUME_32BITUIDS > 0 || !defined __NR_setresgid
   result = INLINE_SYSCALL (setresgid32, 3, rgid, egid, sgid);
 # else
 #  ifdef __NR_setresgid32
--- libc/sysdeps/sparc/fpu/bits/mathinline.h.jj	2004-09-30 11:04:11.000000000 +0200
+++ libc/sysdeps/sparc/fpu/bits/mathinline.h	2004-10-14 11:35:54.072161702 +0200
@@ -112,7 +112,7 @@
 
 /* Test for negative number.  Used in the signbit() macro.  */
 __MATH_INLINE int
-__signbitf (float __x) __THROW
+__NTH (__signbitf (float __x))
 {
   __extension__ union { float __f; int __i; } __u = { __f: __x };
   return __u.__i < 0;
@@ -121,14 +121,14 @@ __signbitf (float __x) __THROW
 #   if __WORDSIZE == 32
 
 __MATH_INLINE int
-__signbit (double __x) __THROW
+__NTH (__signbit (double __x))
 {
   __extension__ union { double __d; int __i[2]; } __u = { __d: __x };
   return __u.__i[0] < 0;
 }
 
 __MATH_INLINE int
-__signbitl (long double __x) __THROW
+__NTH (__signbitl (long double __x))
 {
   return __signbit ((double)__x);
 }
@@ -136,14 +136,14 @@ __signbitl (long double __x) __THROW
 #   else /* sparc64 */
 
 __MATH_INLINE int
-__signbit (double __x) __THROW
+__NTH (__signbit (double __x))
 {
   __extension__ union { double __d; long int __i; } __u = { __d: __x };
   return __u.__i < 0;
 }
 
 __MATH_INLINE int
-__signbitl (long double __x) __THROW
+__NTH (__signbitl (long double __x))
 {
   __extension__ union { long double __l; long int __i[2]; } __u = { __l: __x };
   return __u.__i[0] < 0;
@@ -156,7 +156,7 @@ __signbitl (long double __x) __THROW
 #  if !defined __NO_MATH_INLINES && !__GNUC_PREREQ (3, 2)
 
 __MATH_INLINE double
-sqrt (double __x) __THROW
+__NTH (sqrt (double __x))
 {
   register double __r;
   __asm ("fsqrtd %1,%0" : "=f" (__r) : "f" (__x));
@@ -164,7 +164,7 @@ sqrt (double __x) __THROW
 }
 
 __MATH_INLINE float
-sqrtf (float __x) __THROW
+__NTH (sqrtf (float __x))
 {
   register float __r;
   __asm ("fsqrts %1,%0" : "=f" (__r) : "f" (__x));
@@ -173,7 +173,7 @@ sqrtf (float __x) __THROW
 
 #   if __WORDSIZE == 64
 __MATH_INLINE long double
-sqrtl (long double __x) __THROW
+__NTH (sqrtl (long double __x))
 {
   long double __r;
   extern void _Qp_sqrt (long double *, __const__ long double *);
@@ -219,16 +219,16 @@ __ieee754_sqrtl (long double __x)
 
 #  ifndef __NO_MATH_INLINES
 
-__MATH_INLINE double fdim (double __x, double __y) __THROW;
+__MATH_INLINE double __NTH (fdim (double __x, double __y));
 __MATH_INLINE double
-fdim (double __x, double __y) __THROW
+__NTH (fdim (double __x, double __y))
 {
   return __x <= __y ? 0 : __x - __y;
 }
 
-__MATH_INLINE float fdimf (float __x, float __y) __THROW;
+__MATH_INLINE float __NTH (fdimf (float __x, float __y));
 __MATH_INLINE float
-fdimf (float __x, float __y) __THROW
+__NTH (fdimf (float __x, float __y))
 {
   return __x <= __y ? 0 : __x - __y;
 }
--- libc/sysdeps/generic/errno-loc.c.jj	2002-12-31 21:39:08.000000000 +0100
+++ libc/sysdeps/generic/errno-loc.c	2004-10-14 11:25:35.632630029 +0200
@@ -1,6 +1,6 @@
 /* MT support function to get address of `errno' variable, non-threaded
    version.
-   Copyright (C) 1996, 1998, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1998, 2002, 2004 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
@@ -21,7 +21,7 @@
 #include <errno.h>
 #include <tls.h>
 
-#if ! USE___THREAD
+#if ! USE___THREAD && !RTLD_PRIVATE_ERRNO
 #undef errno
 extern int errno;
 #endif
--- libc/include/errno.h.jj	2004-10-05 09:48:45.000000000 +0200
+++ libc/include/errno.h	2004-10-14 11:23:41.445001098 +0200
@@ -36,7 +36,11 @@ extern __thread int errno attribute_tls_
 # define __set_errno(val) (errno = (val))
 
 # ifndef __ASSEMBLER__
-extern int *__errno_location (void) __THROW __attribute__ ((__const__));
+extern int *__errno_location (void) __THROW __attribute__ ((__const__))
+#  ifdef RTLD_PRIVATE_ERRNO
+     attribute_hidden
+#  endif
+;
 libc_hidden_proto (__errno_location)
 # endif
 
--- libc/linuxthreads/sysdeps/pthread/errno-loc.c.jj	2003-04-01 02:52:40.000000000 +0200
+++ libc/linuxthreads/sysdeps/pthread/errno-loc.c	2004-10-14 11:26:39.368240356 +0200
@@ -1,6 +1,6 @@
 /* MT support function to get address of `errno' variable, linuxthreads
    version.
-   Copyright (C) 1996, 1998, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1998, 2002, 2003, 2004 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
@@ -23,7 +23,7 @@
 #include <linuxthreads/internals.h>
 #include <sysdep-cancel.h>
 
-#if ! USE___THREAD
+#if ! USE___THREAD && !RTLD_PRIVATE_ERRNO
 #undef errno
 extern int errno;
 #endif

	Jakub

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix sparc build
  2004-10-14  9:45 [PATCH] Fix sparc build Jakub Jelinek
@ 2004-10-14 10:03 ` Roland McGrath
  2004-10-14 10:14   ` Jakub Jelinek
  2004-10-14 15:26 ` Jakub Jelinek
  1 sibling, 1 reply; 5+ messages in thread
From: Roland McGrath @ 2004-10-14 10:03 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Ulrich Drepper, Glibc hackers

> 3) on SPARC, the sequence to set up load address of rtld_errno is IMHO too
>    long to be included in INLINE_SYSCALL, so this patch makes
>    __errno_location () hidden within ld.so if RTLD_PRIVATE_ERRNO and
>    return &rtld_errno.

If you're going to have a call, why not just have it be

	call cerror
	mov %o7,%g1

or suchlike, and have sysdep.S define one spot that does it all?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix sparc build
  2004-10-14 10:03 ` Roland McGrath
@ 2004-10-14 10:14   ` Jakub Jelinek
  2004-10-14 20:57     ` Roland McGrath
  0 siblings, 1 reply; 5+ messages in thread
From: Jakub Jelinek @ 2004-10-14 10:14 UTC (permalink / raw)
  To: Roland McGrath; +Cc: Ulrich Drepper, Glibc hackers

On Thu, Oct 14, 2004 at 03:03:06AM -0700, Roland McGrath wrote:
> > 3) on SPARC, the sequence to set up load address of rtld_errno is IMHO too
> >    long to be included in INLINE_SYSCALL, so this patch makes
> >    __errno_location () hidden within ld.so if RTLD_PRIVATE_ERRNO and
> >    return &rtld_errno.
> 
> If you're going to have a call, why not just have it be
> 
> 	call cerror
> 	mov %o7,%g1
> 
> or suchlike, and have sysdep.S define one spot that does it all?

Ok, sure, will work on it.  Still, making __errno_location available IMHO
doesn't hurt (and is not linked in on arches that don't needed it).

	Jakub

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix sparc build
  2004-10-14  9:45 [PATCH] Fix sparc build Jakub Jelinek
  2004-10-14 10:03 ` Roland McGrath
@ 2004-10-14 15:26 ` Jakub Jelinek
  1 sibling, 0 replies; 5+ messages in thread
From: Jakub Jelinek @ 2004-10-14 15:26 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Glibc hackers

On Thu, Oct 14, 2004 at 11:43:45AM +0200, Jakub Jelinek wrote:
> Hi!
> 
> 1) sparc32 doesn't define __NR_setres[ug]id, only __NR_setres[ug]id32.
>    So if the *id32 syscall fails, it should ENOSYS, but shouldn't ENOSYS
>    always.
> 2) sparc mathinline.h needs __NTHification
> 3) on SPARC, the sequence to set up load address of rtld_errno is IMHO too
>    long to be included in INLINE_SYSCALL, so this patch makes
>    __errno_location () hidden within ld.so if RTLD_PRIVATE_ERRNO and
>    return &rtld_errno.

Actually, further testing on other arches revealed a typo, so here is a new
version, this time not featuring that typo (#ifdef RTLD_PRIVATE_ERRNO
instead of the desired #if RTLD_PRIVATE_ERRNO).

2004-10-14  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/unix/sysv/linux/i386/setresuid.c: Handle
	defined __NR_setresuid32 && !defined __NR_setresuid.
	* sysdeps/unix/sysv/linux/i386/setresgid.c: Handle
	defined __NR_setresgid32 && !defined __NR_setresgid.

	* sysdeps/sparc/fpu/bits/mathinline.h (__signbitf, __signbit,
	__signbitl, sqrtf, sqrt, sqrtl, fdim, fdimf): Use __NTH macro.

	* sysdeps/generic/errno-loc.c: Don't undef #errno
	if RTLD_PRIVATE_ERRNO.
	* include/errno.h (__errno_location): If RTLD_PRIVATE_ERRNO,
	add attribute_hidden.
linuxthreads/
	* sysdeps/pthread/errno-loc.c: Don't undef #errno
	if RTLD_PRIVATE_ERRNO.

--- libc/sysdeps/unix/sysv/linux/i386/setresuid.c.jj	2004-09-20 01:44:35.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/i386/setresuid.c	2004-10-14 11:35:54.055164737 +0200
@@ -28,7 +28,7 @@
 #include <pthread-functions.h>
 
 
-#ifdef __NR_setresuid
+#if defined __NR_setresuid || defined __NR_setresuid32
 
 # ifdef __NR_setresuid32
 #  if __ASSUME_32BITUIDS == 0
@@ -43,7 +43,7 @@ __setresuid (uid_t ruid, uid_t euid, uid
 {
   int result;
 
-# if __ASSUME_32BITUIDS > 0
+# if __ASSUME_32BITUIDS > 0 || !defined __NR_setresuid
   result = INLINE_SYSCALL (setresuid32, 3, ruid, euid, suid);
 # else
 #  ifdef __NR_setresuid32
--- libc/sysdeps/unix/sysv/linux/i386/setresgid.c.jj	2004-09-20 01:44:35.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/i386/setresgid.c	2004-10-14 11:35:54.056164558 +0200
@@ -28,7 +28,7 @@
 #include <pthread-functions.h>
 
 
-#ifdef __NR_setresgid
+#if defined __NR_setresgid || defined __NR_setresgid32
 
 # ifdef __NR_setresgid32
 #  if __ASSUME_32BITUIDS == 0
@@ -43,7 +43,7 @@ __setresgid (gid_t rgid, gid_t egid, gid
 {
   int result;
 
-# if __ASSUME_32BITUIDS > 0
+# if __ASSUME_32BITUIDS > 0 || !defined __NR_setresgid
   result = INLINE_SYSCALL (setresgid32, 3, rgid, egid, sgid);
 # else
 #  ifdef __NR_setresgid32
--- libc/sysdeps/sparc/fpu/bits/mathinline.h.jj	2004-09-30 11:04:11.000000000 +0200
+++ libc/sysdeps/sparc/fpu/bits/mathinline.h	2004-10-14 11:35:54.072161702 +0200
@@ -112,7 +112,7 @@
 
 /* Test for negative number.  Used in the signbit() macro.  */
 __MATH_INLINE int
-__signbitf (float __x) __THROW
+__NTH (__signbitf (float __x))
 {
   __extension__ union { float __f; int __i; } __u = { __f: __x };
   return __u.__i < 0;
@@ -121,14 +121,14 @@ __signbitf (float __x) __THROW
 #   if __WORDSIZE == 32
 
 __MATH_INLINE int
-__signbit (double __x) __THROW
+__NTH (__signbit (double __x))
 {
   __extension__ union { double __d; int __i[2]; } __u = { __d: __x };
   return __u.__i[0] < 0;
 }
 
 __MATH_INLINE int
-__signbitl (long double __x) __THROW
+__NTH (__signbitl (long double __x))
 {
   return __signbit ((double)__x);
 }
@@ -136,14 +136,14 @@ __signbitl (long double __x) __THROW
 #   else /* sparc64 */
 
 __MATH_INLINE int
-__signbit (double __x) __THROW
+__NTH (__signbit (double __x))
 {
   __extension__ union { double __d; long int __i; } __u = { __d: __x };
   return __u.__i < 0;
 }
 
 __MATH_INLINE int
-__signbitl (long double __x) __THROW
+__NTH (__signbitl (long double __x))
 {
   __extension__ union { long double __l; long int __i[2]; } __u = { __l: __x };
   return __u.__i[0] < 0;
@@ -156,7 +156,7 @@ __signbitl (long double __x) __THROW
 #  if !defined __NO_MATH_INLINES && !__GNUC_PREREQ (3, 2)
 
 __MATH_INLINE double
-sqrt (double __x) __THROW
+__NTH (sqrt (double __x))
 {
   register double __r;
   __asm ("fsqrtd %1,%0" : "=f" (__r) : "f" (__x));
@@ -164,7 +164,7 @@ sqrt (double __x) __THROW
 }
 
 __MATH_INLINE float
-sqrtf (float __x) __THROW
+__NTH (sqrtf (float __x))
 {
   register float __r;
   __asm ("fsqrts %1,%0" : "=f" (__r) : "f" (__x));
@@ -173,7 +173,7 @@ sqrtf (float __x) __THROW
 
 #   if __WORDSIZE == 64
 __MATH_INLINE long double
-sqrtl (long double __x) __THROW
+__NTH (sqrtl (long double __x))
 {
   long double __r;
   extern void _Qp_sqrt (long double *, __const__ long double *);
@@ -219,16 +219,16 @@ __ieee754_sqrtl (long double __x)
 
 #  ifndef __NO_MATH_INLINES
 
-__MATH_INLINE double fdim (double __x, double __y) __THROW;
+__MATH_INLINE double __NTH (fdim (double __x, double __y));
 __MATH_INLINE double
-fdim (double __x, double __y) __THROW
+__NTH (fdim (double __x, double __y))
 {
   return __x <= __y ? 0 : __x - __y;
 }
 
-__MATH_INLINE float fdimf (float __x, float __y) __THROW;
+__MATH_INLINE float __NTH (fdimf (float __x, float __y));
 __MATH_INLINE float
-fdimf (float __x, float __y) __THROW
+__NTH (fdimf (float __x, float __y))
 {
   return __x <= __y ? 0 : __x - __y;
 }
--- libc/sysdeps/generic/errno-loc.c.jj	2002-12-31 21:39:08.000000000 +0100
+++ libc/sysdeps/generic/errno-loc.c	2004-10-14 11:25:35.632630029 +0200
@@ -1,6 +1,6 @@
 /* MT support function to get address of `errno' variable, non-threaded
    version.
-   Copyright (C) 1996, 1998, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1998, 2002, 2004 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
@@ -21,7 +21,7 @@
 #include <errno.h>
 #include <tls.h>
 
-#if ! USE___THREAD
+#if ! USE___THREAD && !RTLD_PRIVATE_ERRNO
 #undef errno
 extern int errno;
 #endif
--- libc/include/errno.h.jj	2004-10-05 09:48:45.000000000 +0200
+++ libc/include/errno.h	2004-10-14 11:23:41.445001098 +0200
@@ -36,7 +36,11 @@ extern __thread int errno attribute_tls_
 # define __set_errno(val) (errno = (val))
 
 # ifndef __ASSEMBLER__
-extern int *__errno_location (void) __THROW __attribute__ ((__const__));
+extern int *__errno_location (void) __THROW __attribute__ ((__const__))
+#  if RTLD_PRIVATE_ERRNO
+     attribute_hidden
+#  endif
+;
 libc_hidden_proto (__errno_location)
 # endif
 
--- libc/linuxthreads/sysdeps/pthread/errno-loc.c.jj	2003-04-01 02:52:40.000000000 +0200
+++ libc/linuxthreads/sysdeps/pthread/errno-loc.c	2004-10-14 11:26:39.368240356 +0200
@@ -1,6 +1,6 @@
 /* MT support function to get address of `errno' variable, linuxthreads
    version.
-   Copyright (C) 1996, 1998, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1998, 2002, 2003, 2004 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
@@ -23,7 +23,7 @@
 #include <linuxthreads/internals.h>
 #include <sysdep-cancel.h>
 
-#if ! USE___THREAD
+#if ! USE___THREAD && !RTLD_PRIVATE_ERRNO
 #undef errno
 extern int errno;
 #endif

	Jakub

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix sparc build
  2004-10-14 10:14   ` Jakub Jelinek
@ 2004-10-14 20:57     ` Roland McGrath
  0 siblings, 0 replies; 5+ messages in thread
From: Roland McGrath @ 2004-10-14 20:57 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Ulrich Drepper, Glibc hackers

> Ok, sure, will work on it.  Still, making __errno_location available IMHO
> doesn't hurt (and is not linked in on arches that don't needed it).

Agreed.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-10-14 20:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-14  9:45 [PATCH] Fix sparc build Jakub Jelinek
2004-10-14 10:03 ` Roland McGrath
2004-10-14 10:14   ` Jakub Jelinek
2004-10-14 20:57     ` Roland McGrath
2004-10-14 15:26 ` Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).