[PATCH] PPC32: Some cleanups

Franz Sirl Franz.Sirl-kernel@lauterbach.com
Thu Feb 20 21:15:00 GMT 2003


Hi,

some cleanups for PPC32 and updated Dist files. make dist still doesn't work, 
it fails with a strange message in the Hurd directories and I didn't have 
time to dig into it.

Besides that, maybe I should mention this strange warning I get a few times 
during each build:

make[2]: Entering directory 
`/home/fsirl/BUILD/glibc-2.3.1-20030218/linuxthreads'
Makefile:119: warning: overriding commands for target `/usr/lib/libpthread.so'
../o-iterator.mk:9: warning: ignoring old commands for target 
`/usr/lib/libpthread.so'

Ah, yes, what about the tcsetattr problem Roland replied to? Removing the 
checking part seems to make a lot of sense according to him.

Franz.


	* sysdeps/powerpc/powerpc32/atomicity.h: Remove compiler workaround.
	* sysdeps/unix/sysv/linux/kernel-features.h
	(__ASSUME_NEW_PRCTL_SYSCALL): Defined for ppc32 too.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fe_nomask.c: Use prctl
	if possible.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S: Avoid short
	interprocedure branches.
	* sysdeps/powerpc/soft-fp/Dist (sim-full.c, fenv_const.c): Move to...
	* sysdeps/powerpc/nofpu/Dist: ...here.
	* sysdeps/unix/sysv/linux/powerpc/Dist (fe_nomask.c): Move to...
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/Dist: ...here.
	* sysdeps/unix/sysv/linux/s390/s390-64/Dist (kernel_stat.h): Delete.
	* sysdeps/unix/sysv/linux/sparc/Dist (bits/utmpx.h): Delete.
	* sysdeps/unix/sysv/linux/x86_64/Dist (bits/utmpx.h): Delete.

linuxthreads/
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S: Avoid short
	interprocedure branches.
-------------- next part --------------
Index: linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S
===================================================================
RCS file: /cvs/glibc/libc/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S,v
retrieving revision 1.4
diff -u -p -r1.4 vfork.S
--- linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S	11 Feb 2003 06:27:53 -0000	1.4
+++ linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S	20 Feb 2003 20:50:36 -0000
@@ -36,16 +36,15 @@ ENTRY (__vfork)
 	mtlr	9
 	lwz	10,__libc_pthread_functions@got(10)
 	lwz	10,0(10)
-	cmpwi	10,0
-	bne-	HIDDEN_JUMPTARGET(__fork)
 # else
 	.weak	pthread_create
-	lis	9,pthread_create@ha
-	la	9,pthread_create@l(9)
-	cmpwi	9,0
-	bne-	.Lhidden_fork
+	lis	10,pthread_create@ha
+	la	10,pthread_create@l(10)
 # endif
 
+	cmpwi	10,0
+	bne-	.Lhidden_fork
+
 	DO_CALL (SYS_ify (vfork));
 
 # ifdef __ASSUME_VFORK_SYSCALL
@@ -54,28 +53,24 @@ ENTRY (__vfork)
 	bnslr+
 	/* Check if vfork syscall is known at all.  */
 	cmpwi	r3,ENOSYS
-#  ifdef SHARED
-	bne	JUMPTARGET(__syscall_error)
-#  else
-	bne	.Lsyscall_error
-#  endif
+	bne-	.Lsyscall_error
 
 # endif
+
+.Lhidden_fork:
+	b	HIDDEN_JUMPTARGET(__fork)
+
 #endif
 
 #ifndef __ASSUME_VFORK_SYSCALL
 	/* If we don't have vfork, fork is close enough.  */
 
 	DO_CALL (SYS_ify (fork));
-	PSEUDO_RET
-#endif
+	bnslr+
 
-# ifndef SHARED
-.Lhidden_fork:
-	b	HIDDEN_JUMPTARGET(__fork)
 .Lsyscall_error:
 	b	JUMPTARGET(__syscall_error)
-# endif
+#endif
 
 PSEUDO_END (__vfork)
 libc_hidden_def (__vfork)
Index: sysdeps/powerpc/powerpc32/atomicity.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/powerpc/powerpc32/atomicity.h,v
retrieving revision 1.1
diff -u -p -r1.1 atomicity.h
--- sysdeps/powerpc/powerpc32/atomicity.h	5 Sep 2002 08:22:39 -0000	1.1
+++ sysdeps/powerpc/powerpc32/atomicity.h	20 Feb 2003 20:50:37 -0000
@@ -22,13 +22,7 @@
 
 #include <inttypes.h>
 
-#if BROKEN_PPC_ASM_CR0
-# define __ATOMICITY_INLINE /* nothing */
-#else
-# define __ATOMICITY_INLINE inline
-#endif
-
-static __ATOMICITY_INLINE int
+static inline int
 __attribute__ ((unused))
 exchange_and_add (volatile uint32_t *mem, int val)
 {
@@ -42,7 +36,7 @@ exchange_and_add (volatile uint32_t *mem
   return result;
 }
 
-static __ATOMICITY_INLINE void
+static inline void
 __attribute__ ((unused))
 atomic_add (volatile uint32_t *mem, int val)
 {
@@ -55,7 +49,7 @@ atomic_add (volatile uint32_t *mem, int 
 " : "=&b"(tmp) : "r" (mem), "Ir"(val) : "cr0", "memory");
 }
 
-static __ATOMICITY_INLINE int
+static inline int
 __attribute__ ((unused))
 compare_and_swap (volatile long int *p, long int oldval, long int newval)
 {
@@ -72,7 +66,7 @@ compare_and_swap (volatile long int *p, 
   return result >> 5;
 }
 
-static __ATOMICITY_INLINE long int
+static inline long int
 __attribute__ ((unused))
 always_swap (volatile long int *p, long int newval)
 {
@@ -85,7 +79,7 @@ always_swap (volatile long int *p, long 
   return result;
 }
 
-static __ATOMICITY_INLINE int
+static inline int
 __attribute__ ((unused))
 test_and_set (volatile long int *p, long int newval)
 {
Index: sysdeps/powerpc/soft-fp/Dist
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/powerpc/soft-fp/Dist,v
retrieving revision 1.2
diff -u -p -r1.2 Dist
--- sysdeps/powerpc/soft-fp/Dist	17 Oct 2002 23:12:30 -0000	1.2
+++ sysdeps/powerpc/soft-fp/Dist	20 Feb 2003 20:50:37 -0000
@@ -25,6 +25,4 @@ q_sub.c
 q_ulltoq.c
 q_util.c
 q_utoq.c
-sim-full.c
-fenv_const.c
 sfp-machine.h
Index: sysdeps/unix/sysv/linux/kernel-features.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/kernel-features.h,v
retrieving revision 1.42
diff -u -p -r1.42 kernel-features.h
--- sysdeps/unix/sysv/linux/kernel-features.h	1 Feb 2003 20:23:11 -0000	1.42
+++ sysdeps/unix/sysv/linux/kernel-features.h	20 Feb 2003 20:50:38 -0000
@@ -210,9 +210,9 @@
 # define __ASSUME_MMAP2_SYSCALL		1
 #endif
 
-/* Starting with 2.4.21 PowerPC64 implements the new prctl syscall.
+/* Starting with 2.4.21 PowerPC implements the new prctl syscall.
    This allows applications to get/set the Floating Point Exception Mode.  */
-#if __LINUX_KERNEL_VERSION >= (132096+21) && defined __powerpc64__
+#if __LINUX_KERNEL_VERSION >= (132096+21) && defined __powerpc__
 # define __ASSUME_NEW_PRCTL_SYSCALL		1
 #endif
 
Index: sysdeps/unix/sysv/linux/powerpc/Dist
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/powerpc/Dist,v
retrieving revision 1.19
diff -u -p -r1.19 Dist
--- sysdeps/unix/sysv/linux/powerpc/Dist	3 Oct 2002 00:54:16 -0000	1.19
+++ sysdeps/unix/sysv/linux/powerpc/Dist	20 Feb 2003 20:50:38 -0000
@@ -1,6 +1,4 @@
-bits/utmpx.h
 dl-brk.S
-fe_nomask.c
 ipc_priv.h
 kernel_termios.h
 ldd-rewrite.sed
Index: sysdeps/unix/sysv/linux/powerpc/powerpc32/Dist
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/Dist,v
retrieving revision 1.2
diff -u -p -r1.2 Dist
--- sysdeps/unix/sysv/linux/powerpc/powerpc32/Dist	19 Sep 2002 05:50:07 -0000	1.2
+++ sysdeps/unix/sysv/linux/powerpc/powerpc32/Dist	20 Feb 2003 20:50:38 -0000
@@ -1,2 +1,3 @@
 clone.S
 kernel_stat.h
+fe_nomask.c
Index: sysdeps/unix/sysv/linux/powerpc/powerpc32/fe_nomask.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/fe_nomask.c,v
retrieving revision 1.1
diff -u -p -r1.1 fe_nomask.c
--- sysdeps/unix/sysv/linux/powerpc/powerpc32/fe_nomask.c	17 Feb 2003 19:10:01 -0000	1.1
+++ sysdeps/unix/sysv/linux/powerpc/powerpc32/fe_nomask.c	20 Feb 2003 20:50:38 -0000
@@ -21,7 +21,11 @@
 #include <errno.h>
 #include <signal.h>
 #include <unistd.h>
+#include <sysdep.h>
+#include <sys/prctl.h>
+#include "kernel-features.h"
 
+#if __ASSUME_NEW_PRCTL_SYSCALL == 0
 /* This is rather fiddly under Linux.  We don't have direct access,
    and there is no system call, but we can change the bits 
    in a signal handler's context...  */
@@ -34,18 +38,31 @@ fe_nomask_handler (int signum, struct si
   sc->regs->msr |= 0x900ul;  /* FE0 | FE1 */
   sigaction (SIGUSR1, &oact, NULL);
 }
+#endif
 
 const fenv_t *
 __fe_nomask_env (void)
 {
-  struct sigaction act;
-
-  act.sa_handler = (sighandler_t) fe_nomask_handler;
-  sigemptyset (&act.sa_mask);
-  act.sa_flags = 0;
-
-  sigaction (SIGUSR1, &act, &oact);
-  raise (SIGUSR1);
+#if __ASSUME_NEW_PRCTL_SYSCALL == 0
+# if defined PR_SET_FPEXC && defined PR_FP_EXC_PRECISE
+  int result = INLINE_SYSCALL (prctl, 2, PR_SET_FPEXC, PR_FP_EXC_PRECISE);
+
+  if (result == -1 && errno == EINVAL)
+# endif
+    {
+      struct sigaction act;
+
+      act.sa_handler = (sighandler_t) fe_nomask_handler;
+      sigemptyset (&act.sa_mask);
+      act.sa_flags = 0;
+
+      sigaction (SIGUSR1, &act, &oact);
+      raise (SIGUSR1);
+    }
+#else
+  INTERNAL_SYSCALL_DECL (err);
+  INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC, PR_FP_EXC_PRECISE);
+#endif
 
   return FE_ENABLED_ENV;
 }
Index: sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S,v
retrieving revision 1.1
diff -u -p -r1.1 vfork.S
--- sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S	12 Jan 2003 19:39:00 -0000	1.1
+++ sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S	20 Feb 2003 20:50:38 -0000
@@ -38,7 +38,7 @@ ENTRY (__vfork)
 	bnslr+
 	/* Check if vfork syscall is known at all.  */
 	cmpwi	r3,ENOSYS
-	bne	JUMPTARGET(__syscall_error)
+	bne-	.Lsyscall_error
 
 # endif
 #endif
@@ -47,7 +47,10 @@ ENTRY (__vfork)
 	/* If we don't have vfork, fork is close enough.  */
 
 	DO_CALL (SYS_ify (fork))
-	PSEUDO_RET
+	bnslr+
+
+.Lsyscall_error:
+	b	JUMPTARGET(__syscall_error)
 #endif
 
 PSEUDO_END (__vfork)
Index: sysdeps/unix/sysv/linux/s390/s390-64/Dist
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/s390/s390-64/Dist,v
retrieving revision 1.5
diff -u -p -r1.5 Dist
--- sysdeps/unix/sysv/linux/s390/s390-64/Dist	27 Aug 2002 10:59:23 -0000	1.5
+++ sysdeps/unix/sysv/linux/s390/s390-64/Dist	20 Feb 2003 20:50:38 -0000
@@ -1,3 +1,2 @@
 clone.S
-kernel_stat.h
 ucontext_i.h
Index: sysdeps/unix/sysv/linux/sparc/Dist
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/sparc/Dist,v
retrieving revision 1.13
diff -u -p -r1.13 Dist
--- sysdeps/unix/sysv/linux/sparc/Dist	3 Oct 2002 00:55:12 -0000	1.13
+++ sysdeps/unix/sysv/linux/sparc/Dist	20 Feb 2003 20:50:38 -0000
@@ -1,4 +1,3 @@
-bits/utmpx.h
 kernel_termios.h
 sys/trap.h
 ldd-rewrite.sed
Index: sysdeps/unix/sysv/linux/x86_64/Dist
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/x86_64/Dist,v
retrieving revision 1.5
diff -u -p -r1.5 Dist
--- sysdeps/unix/sysv/linux/x86_64/Dist	3 Oct 2002 00:55:50 -0000	1.5
+++ sysdeps/unix/sysv/linux/x86_64/Dist	20 Feb 2003 20:50:38 -0000
@@ -1,4 +1,3 @@
-bits/utmpx.h
 clone.S
 ldd-rewrite.sed
 __start_context.S
--- /dev/null	2002-11-11 17:51:46.000000000 -0700
+++ sysdeps/powerpc/nofpu/Dist	2003-02-20 05:15:45.000000000 -0700
@@ -0,0 +1,2 @@
+sim-full.c
+fenv_const.c


More information about the Libc-alpha mailing list