This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Shared thread library is also working.


On Sun, Aug 27, 2000 at 04:39:11PM -0700, H . J . Lu wrote:
> After fixing gcc, I got static linuxthreads library in glibc 2.2
> working. I am building the shared linuxthreads library now. I will
> post an ia64 glibc 2.2 patch soon.
> 
> 
> 

Here is the patch I used for ia64 against today's CVS on sourceware.
All current major alpha ia64 Linux distributions use my ia64 port of
glibc 2.1, which has a different fork/vfork implementation. It is
simpler than the one based on clone.S which is pretty much useless
for the linuxthreads implementation under ia64. The fork/vfork
implementation in my ia64 glibc has been well tested by all current
major alpha ia64 Linux distributions. This patch brings glibc 2.2 to
my ia64 port of glibc 2.1.

Also there is a long standing libgcc EH ABI problem. I have proposed
a runtime libgcc ABI patch to gcc. Before it is fixed in gcc, I have
to patch elf/soinit.c.


-- 
H.J. Lu (hjl@gnu.org)
----
2000-08-27  H.J. Lu  <hjl@gnu.org>

	* sysdeps/unix/sysv/linux/ia64/fork.S: New.
	* sysdeps/unix/sysv/linux/ia64/vfork.S: Likewise.

	* sysdeps/unix/sysv/linux/ia64/clone.S: Make it dummy. No need
	for it.

2000-08-24  H.J. Lu  <hjl@gnu.org>

	* elf/soinit.c (object): FIXME. Change it to
	
		void * dummy [16];

	for ia64.

2000-08-17  H.J. Lu  <hjl@gnu.org>

	* sysdeps/unix/sysv/linux/ia64/bits/sigstack.h: Support 
	inclusion from <signal.h>, <bits/sigcontext.h> and
	<sys/ucontext.h>.

Index: elf/soinit.c
===================================================================
RCS file: /work/cvs/gnu/glibc/elf/soinit.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 soinit.c
--- elf/soinit.c	2000/05/21 21:10:57	1.1.1.1
+++ elf/soinit.c	2000/08/25 00:27:01
@@ -25,12 +25,16 @@ static char __EH_FRAME_BEGIN__[]
 /* This must match what's in frame.h in gcc. How can one do that? */
 struct object
 {
+#if 0
   void *pc_begin;
   void *pc_end;
   void *fde_begin;
   void *fde_array;
   __SIZE_TYPE__ count;
   struct object *next;
+#else
+  void * dummy [16];
+#endif
 };
 extern void __register_frame_info (const void *, struct object *);
 extern void __deregister_frame_info (const void *);
Index: sysdeps/unix/sysv/linux/ia64/clone.S
===================================================================
RCS file: /work/cvs/gnu/glibc/sysdeps/unix/sysv/linux/ia64/clone.S,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 clone.S
--- sysdeps/unix/sysv/linux/ia64/clone.S	2000/08/01 03:26:02	1.1.1.2
+++ sysdeps/unix/sysv/linux/ia64/clone.S	2000/08/01 03:32:58
@@ -1,76 +1 @@
-/* Copyright (C) 1999,2000 Free Software Foundation, Inc.
-
-   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.  */
-
-/* clone is even more special than fork as it mucks with stacks
-   and invokes a function in the right context after its all over.  */
-
-#include <sysdep.h>
-
-/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
-
-/*
- * Used for both clone and fork system calls.  Note that if fn is NULL
- *   then clone was called from fork.
- */
-
-ENTRY(__clone)
-	add	r2 = -16, r33		// save space for fn and arg
-	cmp.ne	p6,p0 = 0,r33
-	;;
-(p6)	add	r33 = -16, r33
-	add	r12 = -16, r12
-	;;
-(p6)	st8	[r2] = r32, 8		// save fn for child
-	st8	[r12] = r32		// save fn for parent
-	;;
-(p6)	st8	[r2] = r35		// save arg for child
-	mov	r32 = r34		// put flags in out0
-	DO_CALL (SYS_ify (clone))
-1:
-	ld8	r33 = [r12], 8		// recover fn
-	;;
-	ld8	r32 = [r12], 8		// recover arg
-
-	cmp.eq p6,p0=-1,r10
-(p6)	br.cond.spnt.many __syscall_error // handle error
-
-	cmp.ne p7,p0=0,r8
-(p7)	ret				// parent process, just return
-
-	cmp.eq p8,p0=0,r33
-(p8)	ret				// fork call, return
-
-	alloc	loc0 = ar.pfs,2,2,2,0
-	;;
-	ld8	r2 = [in1], 8		// get address of fn
-	mov	out0 = in0
-	mov	loc1 = gp		// save gp across indirect call
-	;;
-	ld8	gp = [in1]		// set new gp
-	mov	b6 = r2
-	br.call.sptk b0 = b6		// call thread routine
-	;;
-
-	mov	ar.pfs = loc0
-	mov	gp = loc1
-	mov	r32 = r8		// exit value
-	;;
-	br.call.sptk	b0 = _exit	// we're out of here
-
-PSEUDO_END(__clone)
-
-weak_alias (__clone, clone)
+/* clone doesn't work on ia64. clone2 is ok. */
--- /dev/null	Wed Aug 16 09:35:32 2000
+++ sysdeps/unix/sysv/linux/ia64/fork.S	Wed Jul 12 18:35:04 2000
@@ -0,0 +1,44 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.
+
+   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 <sysdep.h>
+#define _SIGNAL_H
+#include <bits/signum.h>
+
+/* pid_t fork(void); */
+/* Implemented as a clone system call with parameters SIGCHLD and 0	*/
+
+ENTRY(__libc_fork)
+	alloc r2=ar.pfs,0,0,2,0
+	mov out0=SIGCHLD	/* Return SIGCHLD when child finishes	*/
+				/* no other clone flags; nothing shared	*/
+	mov out1=0		/* Standard sp value.			*/
+	;;
+	flushrs			/* For fork, it might suffice to flush	*/
+				/* in the kernel, but for uniformity...	*/
+			// DELETED STOP BITS - UNNECESSARY
+        DO_CALL (SYS_ify (clone))
+        cmp.eq p6,p0=-1,r10
+	;;
+(p6)    br.cond.spnt.few __syscall_error
+	ret
+PSEUDO_END(__libc_fork)
+
+weak_alias (__libc_fork, __fork)
+weak_alias (__libc_fork, fork)
+
--- /dev/null	Wed Aug 16 09:35:32 2000
+++ sysdeps/unix/sysv/linux/ia64/vfork.S	Sat Jul 15 14:45:20 2000
@@ -0,0 +1,50 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.
+
+   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 <sysdep.h>
+#define _SIGNAL_H
+#include <bits/signum.h>
+
+/* The following are defined in linux/sched.h, which unfortunately	*/
+/* is not safe for inclusion in an assembly file.			*/
+#define CLONE_VM        0x00000100      /* set if VM shared between processes */
+#define CLONE_VFORK     0x00004000      /* set if the parent wants the child to wake it up on mm_release */
+
+/* pid_t vfork(void); */
+/* Implemented as __clone_syscall(CLONE_VFORK | CLONE_VM | SIGCHLD, 0)	*/
+
+ENTRY(__vfork)
+	alloc r2=ar.pfs,0,0,2,0
+	mov out0=CLONE_VM+CLONE_VFORK+SIGCHLD
+	mov out1=0		/* Standard sp value.			*/
+	;;
+	flushrs			/* I don't think this is necessary	*/
+				/* here either.  Otherwise the child 	*/
+				/* may save additional registers,	*/
+				/* which will become visible in the 	*/
+				/* parent.  But that should be fine.	*/
+	// DELETED STOP BITS - UNNECESSARY
+        DO_CALL (SYS_ify (clone))
+        cmp.eq p6,p0=-1,r10
+	;;
+(p6)    br.cond.spnt.few __syscall_error
+	ret
+PSEUDO_END(__vfork)
+
+weak_alias (__vfork, vfork)
+
Index: sysdeps/unix/sysv/linux/ia64/bits/sigstack.h
===================================================================
RCS file: /work/cvs/gnu/glibc/sysdeps/unix/sysv/linux/ia64/bits/sigstack.h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 sigstack.h
--- sysdeps/unix/sysv/linux/ia64/bits/sigstack.h	2000/06/12 05:16:21	1.1.1.1
+++ sysdeps/unix/sysv/linux/ia64/bits/sigstack.h	2000/08/17 19:00:24
@@ -21,6 +21,9 @@
 # error "Never include this file directly.  Use <signal.h> instead"
 #endif
 
+#ifndef __SIGSTACK_H
+#define __SIGSTACK_H
+
 /* Structure describing a signal stack (obsolete).  */
 struct sigstack
   {
@@ -52,3 +55,4 @@ typedef struct sigaltstack
     int ss_flags;
     size_t ss_size;
   } stack_t;
+#endif

2000-07-16  H.J. Lu  <hjl@gnu.org>

	* attr.c (__pthread_attr_setguardsize): Use page_roundup
	instead of roundup to round up to the page size.

Index: linuxthreads/attr.c
===================================================================
RCS file: /work/cvs/gnu/glibc/linuxthreads/attr.c,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 attr.c
--- linuxthreads/attr.c	2000/08/16 00:55:46	1.1.1.2
+++ linuxthreads/attr.c	2000/08/17 16:18:05
@@ -147,7 +147,7 @@ int __pthread_attr_setguardsize(pthread_
   size_t ps = __getpagesize ();
 
   /* First round up the guard size.  */
-  guardsize = roundup (guardsize, ps);
+  guardsize = page_roundup (guardsize, ps);
 
   /* The guard size must not be larger than the stack itself */
   if (guardsize >= attr->__stacksize) return EINVAL;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]