about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-03-08 05:28:20 +0000
committerUlrich Drepper <drepper@redhat.com>1997-03-08 05:28:20 +0000
commit4cca6b868f08e4f95a4c3786a69135676b086c50 (patch)
treeea8f4fbb6972588bc85c5979175c1e5cb6734993 /sysdeps/unix
parentf5f52655ceb5152d79ca88db5293fa1136969303 (diff)
downloadglibc-4cca6b868f08e4f95a4c3786a69135676b086c50.tar.gz
glibc-4cca6b868f08e4f95a4c3786a69135676b086c50.tar.xz
glibc-4cca6b868f08e4f95a4c3786a69135676b086c50.zip
1997-03-08 05:30  Ulrich Drepper  <drepper@cygnus.com>

	* argp/Makefile (routines): Add argp-eexst.
	* argp/argp-ba.c (argp_program_bug_address): Make `const'.
	* argp/argp-eexst.c: New file.  Define exit status variable.
	* argp/argp-help.c (__argp_state_help): Use argp_err_exit_status
	variable instead of always exiting with value 1.
	* argp/argp-pv.c (argp_program_version): Make `const'.
	* argp/argp.h: Declare argp_err_exit_status.
	Patches by Miles Bader <miles@gnu.ai.mit.edu>.

	* locale/programs/localedef.c: Use argp_err_exit_status to
	terminate with correct value.

	* inet/rcmd.c (iruserok): Use euidaccess instead of half-hearted
	switching of UID before opening .rhosts.

	* libio/vsnprintf.c: Change implementation to follow ISO C 9X
	proposal.  The return value now is always the number of characters
	which would be written if enough space is available.
	* manual/stdio.texi: Update description for new behaviour.

	* locale/locale.h (__locale_t): Don't use __locale_t for struct
	name and pointer to struct since old gccs cannot keep the namespaces
	apart.  Rename struct to __locale_struct.
	* locale/duplocale.h: Likewise.
	* locale/newlocale.h: Likewise.

	* math/Makefile (headers): Add complex.h and cmathcalls.h.
	(routines): Remove w_cabs.  Add conj, cimag, creal, and cabs.
	* math/math.h: Undefine __MATHDECL_1, __MATHDECL, and __MATHCALL
	after use.
	(signgam): Move declaration to here from mathcalls.h.
	* math/mathcalls.h (cabs, __cabs_complex, signgam): Remove definition.
	Correct comment for fmin and fmax.
	Start implementing complex math function from ISO C 9X.
	* math/complex.h: New file.
	* math/cmathcalls.h: New file.
	* math/cabs.c: New file.
	* math/cabsf.c: New file.
	* math/cabsl.c: New file.
	* math/cimag.c: New file.
	* math/cimagf.c: New file.
	* math/cimagl.c: New file.
	* math/conj.c: New file.
	* math/conjf.c: New file.
	* math/conjl.c: New file.
	* math/creal.c: New file.
	* math/crealf.c: New file.
	* math/creall.c: New file.
	* sysdeps/libm-ieee754/w_cabs.c: Removed.
	* sysdeps/libm-ieee754/w_cabsf.c: Removed.
	* sysdeps/libm-ieee754/w_cabsl.c: Removed.

	* posix/regex.c: Merge with regex sources from Arnold Robbins'
	version in GNU awk.
	* posix/regex.h: Likewise.

	Add regex test suite by Tom Lord.
	* posix/Makefile (distribute): Add TESTS, TESTS2C.sed, and testcases.h.
	(tests): Add runtests.
	(before-compile): Add testcases.h.
	(testcases.h): New rule to generate header with tests.
	* posix/TESTS: New file.
	* posix/TESTS2C.sed.: New file.
	* posix/runtests.c: New file.
	* posix/testcases.h: New file.

	* sysdeps/unix/sysv/linux/poll.c: Test whether poll syscall is
	available and use fall-back implementation if not.

	* sysdeps/unix/sysv/linux/syscalls.list: Sort entries.

	* time/ialloc.c: Update from tzcode1997c.
	* time/private.h: Likewise.
	* time/scheck.c: Likewise.
	* time/tzselect.ksh: Likewise.
	* time/zdump.c: Likewise.
	* time/zic.c: Likewise.

	* time/tzfile.c: Pretty print.

1997-03-06 07:37  Geoff Keating  <geoffk@ozemail.com.au>

	Port to powerpc-*-linux-gnu.  Slightly tested, under MkLinux,
	on a 601.

	* sysdeps/powerpc/Implies: Added.
	* sysdeps/powerpc/__longjmp.S: Added.
	* sysdeps/powerpc/__math.h: Added.
	* sysdeps/powerpc/bsd-_setjmp.S: Added.
	* sysdeps/powerpc/bsd-setjmp.S: Added.
	* sysdeps/powerpc/dl-machine.h: Added.
	* sysdeps/powerpc/ffs.c: Added.
	* sysdeps/powerpc/fpu_control.h: Added.
	* sysdeps/powerpc/jmp_buf.h: Added.
	* sysdeps/powerpc/setjmp.S: Added.
	* sysdeps/powerpc/strlen.s: Added.
	* sysdeps/powerpc/elf/start.c: Added.
	* sysdeps/powerpc/fpu_control.h: Added.
	* sysdeps/powerpc/jmp_buf.h: Added.

	* sysdeps/unix/sysv/linux/powerpc/Dist: Added.
	* sysdeps/unix/sysv/linux/powerpc/_exit.S: Added.
	* sysdeps/unix/sysv/linux/powerpc/brk.c: Added.
	* sysdeps/unix/sysv/linux/powerpc/clone.S: Added.
	* sysdeps/unix/sysv/linux/powerpc/init-first.h: Added.
	* sysdeps/unix/sysv/linux/powerpc/ioctl-types.h: Added.
	* sysdeps/unix/sysv/linux/powerpc/profil.c: Added.
	* sysdeps/unix/sysv/linux/powerpc/sigreturn.S: Added.
	* sysdeps/unix/sysv/linux/powerpc/socket.S: Added.
	* sysdeps/unix/sysv/linux/powerpc/syscall.S: Added.
	* sysdeps/unix/sysv/linux/powerpc/syscalls.list: Added.
	* sysdeps/unix/sysv/linux/powerpc/sysdep.c: Added.
	* sysdeps/unix/sysv/linux/powerpc/sysdep.h: Added.
	* sysdeps/unix/sysv/linux/powerpc/termbits.h: Added.
	* sysdeps/unix/sysv/linux/powerpc/sys/syscall.h: Added.

1997-03-05 05:24  Geoff Keating  <geoffk@ozemail.com.au>

	* elf/dl-runtime.c (fixup): Add ELF_FIXUP_RETURNS_ADDRESS switch,
	because knowing the first instruction of a PowerPC PLT trampoline
	is not very helpful.

1997-03-04 08:04  Geoff Keating  <geoffk@ozemail.com.au>

	* elf/dl-load.c (ELF_PREFERRED_ADDRESS, ELF_PREFERRED_ADDRESS_DATA,
	ELF_FIXED_ADDRESS): Added. These are for dl-machine.h to indicate
	a preference as to where executables should be loaded.

1997-02-28 08:50  Geoff Keating  <geoffk@ozemail.com.au>

	* elf/elf.h: Add in all those PowerPC reloc types.

1997-02-24 07:12  Geoff Keating  <geoffk@ozemail.com.au>

	* stdio-common/vfscanf.c: Use __va_copy if available.

1997-03-06 13:50  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* malloc/malloc.c (mprotect) [_LIBC]: Define as __mprotect to
	clean up namespace.

1997-03-07 14:27  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/libm-ieee754/s_fpclassify.c (__fpclassify): Don't use
	non-existing GET_WORDS macro, use EXTRACT_WORDS.
	Reported by Andres Schwab <schwab@issan.informatik.uni-dortmund.de>.

1997-03-07 05:27  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/sysv/linux/i386/sigaction.c: The user- and
	kernel-level sigaction structure is different.  handle this
	correctly.
	Bug report by Andres Jaeger <jaeger@informatik.uni-kl.de>.

1997-03-06 05:55  David Engel  <david@sw.ods.com>

	* sysdeps/generic/dl-cache.c (_dl_load_cache_lookup): Also
	recognize cache entries with flag == 3.

1997-03-06 01:05  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/generic/netinet/in.h (INADDR_NONE): Cast to unsigned int.
	(INADDR_LOOPBACK): Likewise.
	* sysdeps/unix/sysv/linux/netinet/in.h: Likewise.

	* manual/socket.texi: Correct types of INADDR_* constants from
	unsigned long to unsigned.

1997-03-05 23:14  Ulrich Drepper  <drepper@cygnus.com>

	* time/antarctica: Update from tzdata1997c.
	* time/asia: Likewise.
	* time/zone.tab: Likewise.

1997-03-05 00:43  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* configure.in (libc_cv_asm_symver_directive,
	libc_cv_ld_version_script_option): Remove unknown instruction from
	assembler test file.

1997-03-04 19:14  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/m68k/fpu/__math.h: Update feature tests to use
	__USE_ISOC9X.
	[__USE_ISOC9X]: Define __log2 and __exp2 inlines.
	(fabs): Remove defininition, it is a gcc builtin.
	(sqrt, __sqrt): Remove definition, they have wrappers in libm.

1997-03-04 10:11  H.J. Lu  <hjl@lucon.org>

	* sunrpc/Makefile ($(objpfx)rpc-proto.c): Create subdir before
	generating file.

1997-03-05 03:59  Ulrich Drepper  <drepper@cygnus.com>

	* inet/rcmd.c (__ivaliduser): Don't use getline, but __getline
	instead to avoid namespace problems.
	Reported by David Mosberger-Tang <davidm@AZStarNet.COM>.

1997-03-03 19:01  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* login/utmp_file.c: Fix previous change.  Make portable by
	checking the _HAVE_UT_* feature macros.

	* libio/fileops.c (_IO_file_finish): Likewise.
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/i386/sigaction.c57
-rw-r--r--sysdeps/unix/sysv/linux/netinet/in.h4
-rw-r--r--sysdeps/unix/sysv/linux/poll.c16
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/Dist4
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/_exit.S26
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/brk.c47
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/clone.S74
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/init-first.h27
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/ioctl-types.h1
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/profil.c2
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/sigreturn.S26
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/socket.S83
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/syscall.S32
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/syscall.h357
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/syscalls.list3
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/sysdep.c33
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/sysdep.h53
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/termbits.h356
-rw-r--r--sysdeps/unix/sysv/linux/syscalls.list2
19 files changed, 1175 insertions, 28 deletions
diff --git a/sysdeps/unix/sysv/linux/i386/sigaction.c b/sysdeps/unix/sysv/linux/i386/sigaction.c
index f3ecd4bd15..3f9d9463a0 100644
--- a/sysdeps/unix/sysv/linux/i386/sigaction.c
+++ b/sysdeps/unix/sysv/linux/i386/sigaction.c
@@ -1,42 +1,49 @@
 /* POSIX.1 `sigaction' call for Linux/i386.
-Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+   Copyright (C) 1991, 1995, 1996, 1997 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 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.
+   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., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   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>
 #include <errno.h>
 #include <stddef.h>
 #include <signal.h>
 
+/* The difference here is that the sigaction structure used in the
+   kernel is not the same as we use in the libc.  Therefore we must
+   translate it here.  */
+#include <kernel_sigaction.h>
+
 
 /* If ACT is not NULL, change the action for SIG to *ACT.
    If OACT is not NULL, put the old action for SIG in *OACT.  */
 int
 __sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
 {
-  struct sigaction newact;
+  struct kernel_sigaction k_newact, k_oldact;
   int result;
 
   if (act)
     {
-      newact = *act;
-      newact.sa_restorer = ((act->sa_flags & SA_NOMASK)
-			    ? &&restore_nomask : &&restore);
-      act = &newact;
+      k_newact.sa_handler = act->sa_handler;
+      k_newact.sa_mask = act->sa_mask.__val[0];
+      k_newact.sa_flags = act->sa_flags;
+
+      k_newact.sa_restorer = ((act->sa_flags & SA_NOMASK)
+			      ? &&restore_nomask : &&restore);
     }
 
   asm volatile ("pushl %%ebx\n"
@@ -44,13 +51,23 @@ __sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
 		"int $0x80\n"
 		"popl %%ebx"
 		: "=a" (result)
-		: "0" (SYS_ify (sigaction)), "r" (sig), "c" (act), "d" (oact));
+		: "0" (SYS_ify (sigaction)), "r" (sig),
+		  "c" (act ? &k_newact : 0), "d" (oact ? &k_oldact : 0));
 
   if (result < 0)
     {
       __set_errno (-result);
       return -1;
     }
+
+  if (oact)
+    {
+      oact->sa_handler = k_oldact.sa_handler;
+      oact->sa_mask.__val[0] = k_oldact.sa_mask;
+      oact->sa_flags = k_oldact.sa_flags;
+      oact->sa_restorer = k_oldact.sa_restorer;
+    }
+
   return 0;
 
  restore:
diff --git a/sysdeps/unix/sysv/linux/netinet/in.h b/sysdeps/unix/sysv/linux/netinet/in.h
index 5b6cc78821..bbc625435c 100644
--- a/sysdeps/unix/sysv/linux/netinet/in.h
+++ b/sysdeps/unix/sysv/linux/netinet/in.h
@@ -127,13 +127,13 @@ struct in_addr
 /* Address to send to all hosts.  */
 #define	INADDR_BROADCAST	((unsigned) 0xffffffff)
 /* Address indicating an error return.  */
-#define	INADDR_NONE		0xffffffff
+#define	INADDR_NONE		((unsigned) 0xffffffff)
 
 /* Network number for local host loopback.  */
 #define	IN_LOOPBACKNET	127
 /* Address to loopback in software to local host.  */
 #ifndef INADDR_LOOPBACK
-#define	INADDR_LOOPBACK	0x7f000001	/* Internet address 127.0.0.1.  */
+#define	INADDR_LOOPBACK	((unsigned) 0x7f000001)	/* Inet address 127.0.0.1.  */
 #endif
 
 
diff --git a/sysdeps/unix/sysv/linux/poll.c b/sysdeps/unix/sysv/linux/poll.c
index 337b85005f..875c3b48f8 100644
--- a/sysdeps/unix/sysv/linux/poll.c
+++ b/sysdeps/unix/sysv/linux/poll.c
@@ -22,7 +22,9 @@
 
 extern int __syscall_poll __P ((struct pollfd *fds, unsigned int nfds,
 				int timeout));
-extern int __emulate_poll __P ((struct pollfd *fds, unsigned long int nfds,
+weak_extern (__syscall_poll)
+
+static int __emulate_poll __P ((struct pollfd *fds, unsigned long int nfds,
 				int timeout));
 
 /* The real implementation.  */
@@ -33,13 +35,17 @@ poll (fds, nfds, timeout)
      int timeout;
 {
   static int must_emulate = 0;
+  int (*syscall) __P ((struct pollfd *, unsigned int, int)) = __syscall_poll;
 
   if (!must_emulate)
     {
-      int retval = __syscall_poll (fds, nfds, timeout);
+      if (syscall)
+	{
+	  int retval = __syscall_poll (fds, nfds, timeout);
 
-      if (retval >= 0 || errno != ENOSYS)
-	return retval;
+	  if (retval >= 0 || errno != ENOSYS)
+	    return retval;
+	}
 
       must_emulate = 1;
     }
@@ -49,5 +55,5 @@ poll (fds, nfds, timeout)
 
 
 /* Get the emulation code.  */
-#define poll(fds, nfds, timeout) __emulate_poll (fds, nfds, timeout)
+#define poll(fds, nfds, timeout) static __emulate_poll (fds, nfds, timeout)
 #include <sysdeps/unix/bsd/poll.c>
diff --git a/sysdeps/unix/sysv/linux/powerpc/Dist b/sysdeps/unix/sysv/linux/powerpc/Dist
new file mode 100644
index 0000000000..3df65c325c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/Dist
@@ -0,0 +1,4 @@
+clone.S
+ioctl-types.h
+termbits.h
+termios.h
diff --git a/sysdeps/unix/sysv/linux/powerpc/_exit.S b/sysdeps/unix/sysv/linux/powerpc/_exit.S
new file mode 100644
index 0000000000..a1ca375d54
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/_exit.S
@@ -0,0 +1,26 @@
+/* Copyright (C) 1995, 1996, 1997 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 <sysdep.h>
+
+/* The 'exit' syscall does not return.  */
+
+	.text
+ENTRY(_exit)
+	DO_CALL (SYS_ify (exit))
+PSEUDO_END (_exit)
diff --git a/sysdeps/unix/sysv/linux/powerpc/brk.c b/sysdeps/unix/sysv/linux/powerpc/brk.c
new file mode 100644
index 0000000000..e9826bd098
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/brk.c
@@ -0,0 +1,47 @@
+/* brk system call for Linux/ppc.
+   Copyright (C) 1995, 1996, 1997 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 <sysdep.h>
+#include <errno.h>
+
+void *__curbrk;
+
+int
+__brk (void *addr)
+{
+  register void *syscall_arg asm ("r3") = addr;
+  register int syscall_number asm ("r0") = SYS_ify (brk);
+  register void *newbrk asm ("r3");
+  asm ("sc"
+       : "=r" (newbrk)
+       : "r" (syscall_arg), "r" (syscall_number)
+       : "r4","r5","r6","r7","r8","r9","r10","r11","r12",
+         "ctr", "mq", "cr0", "cr1", "cr6", "cr7");
+
+  __curbrk = newbrk;
+
+  if (newbrk < addr)
+    {
+      __set_errno (ENOMEM);
+      return -1;
+    }
+
+  return 0;
+}
+weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/powerpc/clone.S b/sysdeps/unix/sysv/linux/powerpc/clone.S
new file mode 100644
index 0000000000..e5fa16d8c5
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/clone.S
@@ -0,0 +1,74 @@
+/* Wrapper around clone system call.
+   Copyright (C) 1997 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 <sysdep.h>
+#define _ERRNO_H	1
+#include <errnos.h>
+
+/* This is the only really unusual system call in PPC linux, but not
+   because of any weirdness in the system call itself; because of
+   all the freaky stuff we have to do to make the call useful.  */
+
+/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
+
+ENTRY(clone)
+	/* Set up stack frame, save registers.  */
+	stwu 1,-20(1)
+	stw 31,16(1)
+
+	/* Check for child_stack == NULL, fn == NULL.  */
+	mr. 31,4
+	cmpwi 1,3,0
+	cror 2+0*4,2+0*4,2+1*4
+	beq- 0,badargs
+
+	/* Save 'fn' and its argument on the new stack.  */
+	stw 3,0(4)
+	stw 6,4(4)
+
+	/* 'flags' argument is (only) parameter to clone syscall.  */
+	mr 3,5
+
+	/* Do the call.  */
+	DO_CALL(SYS_ify(clone))
+	bso- error
+	beq child
+
+	/* Parent.  Restore registers & return.  */
+	lwz 31,20(1)
+	addi 1,1,20
+	blr
+
+child:
+	/* Get address of procedure to call.  */
+	lwz 0,0(31)
+	/* Set up argument register.  */
+	lwz 3,4(31)
+	mtlr 0
+	/* Switch to new stack.  */
+	mr 1,31
+	/* Call procedure.  */
+	blrl
+	/* Call _exit with result from procedure.  */
+	DO_CALL (SYS_ify (exit))
+
+badargs:
+	li 3,-EINVAL
+error:
+	b __syscall_error
diff --git a/sysdeps/unix/sysv/linux/powerpc/init-first.h b/sysdeps/unix/sysv/linux/powerpc/init-first.h
new file mode 100644
index 0000000000..df702380fa
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/init-first.h
@@ -0,0 +1,27 @@
+/* Copyright (C) 1997 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.  */
+
+/* The job of this fragment it to find argc and friends for INIT.
+   They are passed to this routine by either the program loader
+   code in start.c, or by by dlopen.*/
+
+#define SYSDEP_CALL_INIT(NAME, INIT)					      \
+void NAME (int argc, char **argv, char **envp)				      \
+{									      \
+  INIT (argc, argv, envp);						      \
+}
diff --git a/sysdeps/unix/sysv/linux/powerpc/ioctl-types.h b/sysdeps/unix/sysv/linux/powerpc/ioctl-types.h
new file mode 100644
index 0000000000..9e2695652e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/ioctl-types.h
@@ -0,0 +1 @@
+#include <termios.h>
diff --git a/sysdeps/unix/sysv/linux/powerpc/profil.c b/sysdeps/unix/sysv/linux/powerpc/profil.c
new file mode 100644
index 0000000000..6ab8065da3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/profil.c
@@ -0,0 +1,2 @@
+/* For now.  */
+#include <sysdeps/stub/profil.c>
diff --git a/sysdeps/unix/sysv/linux/powerpc/sigreturn.S b/sysdeps/unix/sysv/linux/powerpc/sigreturn.S
new file mode 100644
index 0000000000..748c26761f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/sigreturn.S
@@ -0,0 +1,26 @@
+/* Copyright (C) 1995, 1996, 1997 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 <sysdep.h>
+
+/* The 'sigreturn' syscall does not return.  */
+
+	.text
+ENTRY(__sigreturn)
+	DO_CALL(SYS_ify(sigreturn))
+PSEUDO_END (__sigreturn)
diff --git a/sysdeps/unix/sysv/linux/powerpc/socket.S b/sysdeps/unix/sysv/linux/powerpc/socket.S
new file mode 100644
index 0000000000..32bb8f64cd
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/socket.S
@@ -0,0 +1,83 @@
+/* Copyright (C) 1995, 1996, 1997 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 <sysdep.h>
+#include <sys/socketcall.h>
+
+#define P(a, b) P2(a, b)
+#define P2(a, b) a##b
+
+/* The socket-oriented system calls are handled unusally in Linux.
+   They are all gated through the single `socketcall' system call number.
+   `socketcall' takes two arguments: the first is the subcode, specifying
+   which socket function is being called; and the second is a pointer to
+   the arguments to the specific function.
+
+   The .S files for the other calls just #define socket and #include this.
+   They also #define a 'number-of-arguments' word in NARGS, which
+   defaults to 3.  */
+
+#ifndef NARGS
+#ifdef socket
+#error NARGS not defined
+#endif
+#define NARGS 3
+#endif
+
+#define stackblock 20
+
+	.text
+ENTRY(P(__,socket))
+	stwu 1,-48(1)
+#if NARGS >= 1
+	stw 3,stackblock(1)
+#endif
+#if NARGS >= 2
+	stw 4,4+stackblock(1)
+#endif
+#if NARGS >= 3
+	stw 5,8+stackblock(1)
+#endif
+#if NARGS >= 4
+	stw 6,12+stackblock(1)
+#endif
+#if NARGS >= 5
+	stw 7,16+stackblock(1)
+#endif
+#if NARGS >= 6
+	stw 8,20+stackblock(1)
+#endif
+#if NARGS >= 7
+	stw 9,24+stackblock(1)
+#endif
+#if NARGS >= 8
+	stw 10,28+stackblock(1)
+#endif
+#if NARGS >= 9
+#error too many arguments!
+#endif
+	li 3,P(SOCKOP_,socket)
+	addi 4,1,stackblock
+	DO_CALL(SYS_ify(socketcall))
+	addi 1,1,48
+	bnslr
+	b __syscall_error
+
+PSEUDO_END (P(__,socket))
+
+weak_alias (P(__,socket), socket)
diff --git a/sysdeps/unix/sysv/linux/powerpc/syscall.S b/sysdeps/unix/sysv/linux/powerpc/syscall.S
new file mode 100644
index 0000000000..9b3f66682e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/syscall.S
@@ -0,0 +1,32 @@
+/* Copyright (C) 1991, 1992, 1997 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 <sysdep.h>
+
+	.text
+ENTRY (syscall)
+	mr	0,3
+	mr	3,4
+	mr	4,5
+	mr	5,6
+	mr	6,7
+	mr	7,8
+	sc
+	bnslr
+	b __syscall_error
+PSEUDO_END (syscall)
diff --git a/sysdeps/unix/sysv/linux/powerpc/syscall.h b/sysdeps/unix/sysv/linux/powerpc/syscall.h
new file mode 100644
index 0000000000..c6bac3de5b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/syscall.h
@@ -0,0 +1,357 @@
+/* Copyright (C) 1997 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 _SYSCALL_H
+#define _SYSCALL_H	1
+
+/* normally, we'd get syscalls from asm/unistd.h under Linux, but this
+   is very broken under MkLinux/PPC, so we list them right here directly. */
+
+#define __NR_setup		  0
+#define __NR_exit		  1
+#define __NR_fork		  2
+#define __NR_read		  3
+#define __NR_write		  4
+#define __NR_open		  5
+#define __NR_close		  6
+#define __NR_waitpid		  7
+#define __NR_creat		  8
+#define __NR_link		  9
+#define __NR_unlink		 10
+#define __NR_execve		 11
+#define __NR_chdir		 12
+#define __NR_time		 13
+#define __NR_mknod		 14
+#define __NR_chmod		 15
+#define __NR_chown		 16
+#define __NR_break		 17
+#define __NR_oldstat		 18
+#define __NR_lseek		 19
+#define __NR_getpid		 20
+#define __NR_mount		 21
+#define __NR_umount		 22
+#define __NR_setuid		 23
+#define __NR_getuid		 24
+#define __NR_stime		 25
+#define __NR_ptrace		 26
+#define __NR_alarm		 27
+#define __NR_oldfstat		 28
+#define __NR_pause		 29
+#define __NR_utime		 30
+#define __NR_stty		 31
+#define __NR_gtty		 32
+#define __NR_access		 33
+#define __NR_nice		 34
+#define __NR_ftime		 35
+#define __NR_sync		 36
+#define __NR_kill		 37
+#define __NR_rename		 38
+#define __NR_mkdir		 39
+#define __NR_rmdir		 40
+#define __NR_dup		 41
+#define __NR_pipe		 42
+#define __NR_times		 43
+#define __NR_prof		 44
+#define __NR_brk		 45
+#define __NR_setgid		 46
+#define __NR_getgid		 47
+#define __NR_signal		 48
+#define __NR_geteuid		 49
+#define __NR_getegid		 50
+#define __NR_acct		 51
+#define __NR_phys		 52
+#define __NR_lock		 53
+#define __NR_ioctl		 54
+#define __NR_fcntl		 55
+#define __NR_mpx		 56
+#define __NR_setpgid		 57
+#define __NR_ulimit		 58
+#define __NR_oldolduname	 59
+#define __NR_umask		 60
+#define __NR_chroot		 61
+#define __NR_ustat		 62
+#define __NR_dup2		 63
+#define __NR_getppid		 64
+#define __NR_getpgrp		 65
+#define __NR_setsid		 66
+#define __NR_sigaction		 67
+#define __NR_sgetmask		 68
+#define __NR_ssetmask		 69
+#define __NR_setreuid		 70
+#define __NR_setregid		 71
+#define __NR_sigsuspend		 72
+#define __NR_sigpending		 73
+#define __NR_sethostname	 74
+#define __NR_setrlimit		 75
+#define __NR_getrlimit		 76
+#define __NR_getrusage		 77
+#define __NR_gettimeofday	 78
+#define __NR_settimeofday	 79
+#define __NR_getgroups		 80
+#define __NR_setgroups		 81
+#define __NR_select		 82
+#define __NR_symlink		 83
+#define __NR_oldlstat		 84
+#define __NR_readlink		 85
+#define __NR_uselib		 86
+#define __NR_swapon		 87
+#define __NR_reboot		 88
+#define __NR_readdir		 89
+#define __NR_mmap		 90
+#define __NR_munmap		 91
+#define __NR_truncate		 92
+#define __NR_ftruncate		 93
+#define __NR_fchmod		 94
+#define __NR_fchown		 95
+#define __NR_getpriority	 96
+#define __NR_setpriority	 97
+#define __NR_profil		 98
+#define __NR_statfs		 99
+#define __NR_fstatfs		100
+#define __NR_ioperm		101
+#define __NR_socketcall		102
+#define __NR_syslog		103
+#define __NR_setitimer		104
+#define __NR_getitimer		105
+#define __NR_stat		106
+#define __NR_lstat		107
+#define __NR_fstat		108
+#define __NR_olduname		109
+#define __NR_iopl		110
+#define __NR_vhangup		111
+#define __NR_idle		112
+#define __NR_vm86		113
+#define __NR_wait4		114
+#define __NR_swapoff		115
+#define __NR_sysinfo		116
+#define __NR_ipc		117
+#define __NR_fsync		118
+#define __NR_sigreturn		119
+#define __NR_clone		120
+#define __NR_setdomainname	121
+#define __NR_uname		122
+#define __NR_modify_ldt		123
+#define __NR_adjtimex		124
+#define __NR_mprotect		125
+#define __NR_sigprocmask	126
+#define __NR_create_module	127
+#define __NR_init_module	128
+#define __NR_delete_module	129
+#define __NR_get_kernel_syms	130
+#define __NR_quotactl		131
+#define __NR_getpgid		132
+#define __NR_fchdir		133
+#define __NR_bdflush		134
+#define __NR_sysfs		135
+#define __NR_personality	136
+#define __NR_afs_syscall	137 /* Syscall for Andrew File System */
+#define __NR_setfsuid		138
+#define __NR_setfsgid		139
+#define __NR__llseek		140
+#define __NR_getdents		141
+#define __NR__newselect		142
+#define __NR_flock		143
+#define __NR_msync		144
+#define __NR_readv              145
+#define __NR_writev             146
+#define __NR_getsid             147
+#define __NR_fdatasync          148
+#define __NR__sysctl            149
+#define __NR_mlock              150
+#define __NR_munlock            151
+#define __NR_mlockall           152
+#define __NR_munlockall         153
+#define __NR_sched_setparam     154
+#define __NR_sched_getparam     155
+#define __NR_sched_setscheduler 156
+#define __NR_sched_getscheduler 157
+#define __NR_sched_yield        158
+#define __NR_sched_get_priority_max 159
+#define __NR_sched_get_priority_min 160
+#define __NR_sched_rr_get_interval 161
+#define __NR_nanosleep          162
+#define __NR_mremap             163
+
+#ifndef _LIBC
+#define SYS_setup		  0
+#define SYS_exit		  1
+#define SYS_fork		  2
+#define SYS_read		  3
+#define SYS_write		  4
+#define SYS_open		  5
+#define SYS_close		  6
+#define SYS_waitpid		  7
+#define SYS_creat		  8
+#define SYS_link		  9
+#define SYS_unlink		 10
+#define SYS_execve		 11
+#define SYS_chdir		 12
+#define SYS_time		 13
+#define SYS_mknod		 14
+#define SYS_chmod		 15
+#define SYS_chown		 16
+#define SYS_break		 17
+#define SYS_oldstat		 18
+#define SYS_lseek		 19
+#define SYS_getpid		 20
+#define SYS_mount		 21
+#define SYS_umount		 22
+#define SYS_setuid		 23
+#define SYS_getuid		 24
+#define SYS_stime		 25
+#define SYS_ptrace		 26
+#define SYS_alarm		 27
+#define SYS_oldfstat		 28
+#define SYS_pause		 29
+#define SYS_utime		 30
+#define SYS_stty		 31
+#define SYS_gtty		 32
+#define SYS_access		 33
+#define SYS_nice		 34
+#define SYS_ftime		 35
+#define SYS_sync		 36
+#define SYS_kill		 37
+#define SYS_rename		 38
+#define SYS_mkdir		 39
+#define SYS_rmdir		 40
+#define SYS_dup		 41
+#define SYS_pipe		 42
+#define SYS_times		 43
+#define SYS_prof		 44
+#define SYS_brk		 45
+#define SYS_setgid		 46
+#define SYS_getgid		 47
+#define SYS_signal		 48
+#define SYS_geteuid		 49
+#define SYS_getegid		 50
+#define SYS_acct		 51
+#define SYS_phys		 52
+#define SYS_lock		 53
+#define SYS_ioctl		 54
+#define SYS_fcntl		 55
+#define SYS_mpx		 56
+#define SYS_setpgid		 57
+#define SYS_ulimit		 58
+#define SYS_oldolduname	 59
+#define SYS_umask		 60
+#define SYS_chroot		 61
+#define SYS_ustat		 62
+#define SYS_dup2		 63
+#define SYS_getppid		 64
+#define SYS_getpgrp		 65
+#define SYS_setsid		 66
+#define SYS_sigaction		 67
+#define SYS_sgetmask		 68
+#define SYS_ssetmask		 69
+#define SYS_setreuid		 70
+#define SYS_setregid		 71
+#define SYS_sigsuspend		 72
+#define SYS_sigpending		 73
+#define SYS_sethostname	 74
+#define SYS_setrlimit		 75
+#define SYS_getrlimit		 76
+#define SYS_getrusage		 77
+#define SYS_gettimeofday	 78
+#define SYS_settimeofday	 79
+#define SYS_getgroups		 80
+#define SYS_setgroups		 81
+#define SYS_select		 82
+#define SYS_symlink		 83
+#define SYS_oldlstat		 84
+#define SYS_readlink		 85
+#define SYS_uselib		 86
+#define SYS_swapon		 87
+#define SYS_reboot		 88
+#define SYS_readdir		 89
+#define SYS_mmap		 90
+#define SYS_munmap		 91
+#define SYS_truncate		 92
+#define SYS_ftruncate		 93
+#define SYS_fchmod		 94
+#define SYS_fchown		 95
+#define SYS_getpriority	 96
+#define SYS_setpriority	 97
+#define SYS_profil		 98
+#define SYS_statfs		 99
+#define SYS_fstatfs		100
+#define SYS_ioperm		101
+#define SYS_socketcall		102
+#define SYS_syslog		103
+#define SYS_setitimer		104
+#define SYS_getitimer		105
+#define SYS_stat		106
+#define SYS_lstat		107
+#define SYS_fstat		108
+#define SYS_olduname		109
+#define SYS_iopl		110
+#define SYS_vhangup		111
+#define SYS_idle		112
+#define SYS_vm86		113
+#define SYS_wait4		114
+#define SYS_swapoff		115
+#define SYS_sysinfo		116
+#define SYS_ipc		117
+#define SYS_fsync		118
+#define SYS_sigreturn		119
+#define SYS_clone		120
+#define SYS_setdomainname	121
+#define SYS_uname		122
+#define SYS_modify_ldt		123
+#define SYS_adjtimex		124
+#define SYS_mprotect		125
+#define SYS_sigprocmask	126
+#define SYS_create_module	127
+#define SYS_init_module	128
+#define SYS_delete_module	129
+#define SYS_get_kernel_syms	130
+#define SYS_quotactl		131
+#define SYS_getpgid		132
+#define SYS_fchdir		133
+#define SYS_bdflush		134
+#define SYS_sysfs		135
+#define SYS_personality	136
+#define SYS_afs_syscall	137 /* Syscall for Andrew File System */
+#define SYS_setfsuid		138
+#define SYS_setfsgid		139
+#define SYS__llseek		140
+#define SYS_getdents		141
+#define SYS__newselect		142
+#define SYS_flock		143
+#define SYS_msync		144
+#define SYS_readv              145
+#define SYS_writev             146
+#define SYS_getsid             147
+#define SYS_fdatasync          148
+#define SYS__sysctl            149
+#define SYS_mlock              150
+#define SYS_munlock            151
+#define SYS_mlockall           152
+#define SYS_munlockall         153
+#define SYS_sched_setparam     154
+#define SYS_sched_getparam     155
+#define SYS_sched_setscheduler 156
+#define SYS_sched_getscheduler 157
+#define SYS_sched_yield        158
+#define SYS_sched_get_priority_max 159
+#define SYS_sched_get_priority_min 160
+#define SYS_sched_rr_get_interval 161
+#define SYS_nanosleep          162
+#define SYS_mremap             163
+#endif
+
+#endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/syscalls.list b/sysdeps/unix/sysv/linux/powerpc/syscalls.list
new file mode 100644
index 0000000000..7883d70719
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/syscalls.list
@@ -0,0 +1,3 @@
+# File name	Caller	Syscall name	# args	Strong name	Weak names
+
+s_llseek	llseek	_llseek		5	__sys_llseek
diff --git a/sysdeps/unix/sysv/linux/powerpc/sysdep.c b/sysdeps/unix/sysv/linux/powerpc/sysdep.c
new file mode 100644
index 0000000000..3896111005
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/sysdep.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1997 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 <sysdep.h>
+#include <errno.h>
+
+/* This routine is jumped to by all the syscall handlers, to stash
+   an error number into errno.  */
+int
+__syscall_error (int err_no)
+{
+  __set_errno (err_no);
+  return -1;
+}
+
+/* We also have to have a 'real' definition of errno.  */
+#undef errno
+int errno = 0;
diff --git a/sysdeps/unix/sysv/linux/powerpc/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/sysdep.h
new file mode 100644
index 0000000000..c08e3d8060
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/sysdep.h
@@ -0,0 +1,53 @@
+/* Copyright (C) 1992, 1997 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 <sysdeps/unix/sysdep.h>
+
+/* For Linux we can use the system call table in the header file
+	/usr/include/asm/unistd.h
+   of the kernel.  But these symbols do not follow the SYS_* syntax
+   so we have to redefine the `SYS_ify' macro here.  */
+#undef SYS_ify
+#ifdef __STDC__
+# define SYS_ify(syscall_name)	__NR_##syscall_name
+#else
+# define SYS_ify(syscall_name)	__NR_/**/syscall_name
+#endif
+
+#ifdef ASSEMBLER
+
+#define ENTRY(name)                                                           \
+  .globl name;							              \
+  .type name,@function;						              \
+  .align 2;								      \
+  C_LABEL(name)
+
+#define DO_CALL(syscall)				      		      \
+    li 0,syscall;						              \
+    sc
+
+#define PSEUDO(name, syscall_name, args)                                      \
+  .text;								      \
+  ENTRY (name)                                                                \
+    DO_CALL (SYS_ify (syscall_name));				              \
+    bnslr; \
+    b __syscall_error
+
+#define ret	/* Nothing (should be 'blr', but never reached).  */
+
+#endif	/* ASSEMBLER */
diff --git a/sysdeps/unix/sysv/linux/powerpc/termbits.h b/sysdeps/unix/sysv/linux/powerpc/termbits.h
new file mode 100644
index 0000000000..d1b0a3e3cb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/termbits.h
@@ -0,0 +1,356 @@
+/* Copyright (C) 1997 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 _TERMBITS_H
+#define _TERMBITS_H
+
+#include <linux/posix_types.h>
+
+typedef unsigned char	cc_t;
+typedef unsigned int	speed_t;
+typedef unsigned int	tcflag_t;
+
+/*
+ * termios type and macro definitions.  Be careful about adding stuff
+ * to this file since it's used in GNU libc and there are strict rules
+ * concerning namespace pollution.
+ */
+
+#define NCCS 19
+struct termios {
+	tcflag_t c_iflag;		/* input mode flags */
+	tcflag_t c_oflag;		/* output mode flags */
+	tcflag_t c_cflag;		/* control mode flags */
+	tcflag_t c_lflag;		/* local mode flags */
+	cc_t c_cc[NCCS];		/* control characters */
+	cc_t c_line;			/* line discipline (== c_cc[19]) */
+	speed_t c_ispeed;		/* input speed */
+	speed_t c_ospeed;		/* output speed */
+};
+
+/* c_cc characters */
+#define VINTR 	0
+#define VQUIT 	1
+#define VERASE 	2
+#define VKILL	3
+#define VEOF	4
+#define VMIN	5
+#define VEOL	6
+#define VTIME	7
+#define VEOL2	8
+#define VSWTC	9
+
+#define VWERASE 	10
+#define VREPRINT	11
+#define VSUSP 		12
+#define VSTART		13
+#define VSTOP		14
+#define VLNEXT		15
+#define VDISCARD	16
+
+/* c_iflag bits */
+#define IGNBRK	0000001
+#define BRKINT	0000002
+#define IGNPAR	0000004
+#define PARMRK	0000010
+#define INPCK	0000020
+#define ISTRIP	0000040
+#define INLCR	0000100
+#define IGNCR	0000200
+#define ICRNL	0000400
+#define IXON	0001000
+#define IXOFF	0002000
+#if !defined(KERNEL) || defined(__USE_BSD)
+  /* POSIX.1 doesn't want these... */
+# define IXANY		0004000
+# define IUCLC		0010000
+# define IMAXBEL	0020000
+#endif
+
+/* c_oflag bits */
+#define OPOST	0000001
+#define ONLCR	0000002
+#define OLCUC	0000004
+
+#define OCRNL	0000010
+#define ONOCR	0000020
+#define ONLRET	0000040
+
+#define OFILL	00000100
+#define OFDEL	00000200
+#define NLDLY	00001400
+#define   NL0	00000000
+#define   NL1	00000400
+#define   NL2	00001000
+#define   NL3	00001400
+#define TABDLY	00006000
+#define   TAB0	00000000
+#define   TAB1	00002000
+#define   TAB2	00004000
+#define   TAB3	00006000
+#define CRDLY	00030000
+#define   CR0	00000000
+#define   CR1	00010000
+#define   CR2	00020000
+#define   CR3	00030000
+#define FFDLY	00040000
+#define   FF0	00000000
+#define   FF1	00040000
+#define BSDLY	00100000
+#define   BS0	00000000
+#define   BS1	00100000
+#define VTDLY	00200000
+#define   VT0	00000000
+#define   VT1	00200000
+#define XTABS	01000000 /* Hmm.. Linux/i386 considers this part of TABDLY.. */
+
+/* c_cflag bit meaning */
+#define CBAUD	0000377
+#define  B0	0000000		/* hang up */
+#define  B50	0000001
+#define  B75	0000002
+#define  B110	0000003
+#define  B134	0000004
+#define  B150	0000005
+#define  B200	0000006
+#define  B300	0000007
+#define  B600	0000010
+#define  B1200	0000011
+#define  B1800	0000012
+#define  B2400	0000013
+#define  B4800	0000014
+#define  B9600	0000015
+#define  B19200	0000016
+#define  B38400	0000017
+#define EXTA B19200
+#define EXTB B38400
+#define CBAUDEX 0000020
+#define  B57600   00020
+#define  B115200  00021
+#define  B230400  00022
+#define  B460800  00023
+
+#define CSIZE	00001400
+#define   CS5	00000000
+#define   CS6	00000400
+#define   CS7	00001000
+#define   CS8	00001400
+
+#define CSTOPB	00002000
+#define CREAD	00004000
+#define PARENB	00010000
+#define PARODD	00020000
+#define HUPCL	00040000
+
+#define CLOCAL	00100000
+#define CRTSCTS	  020000000000		/* flow control */
+
+/* c_lflag bits */
+#define ISIG	0x00000080
+#define ICANON	0x00000100
+#define XCASE	0x00004000
+#define ECHO	0x00000008
+#define ECHOE	0x00000002
+#define ECHOK	0x00000004
+#define ECHONL	0x00000010
+#define NOFLSH	0x80000000
+#define TOSTOP	0x00400000
+#define ECHOCTL	0x00000040
+#define ECHOPRT	0x00000020
+#define ECHOKE	0x00000001
+#define FLUSHO	0x00800000
+#define PENDIN	0x20000000
+#define IEXTEN	0x00000400
+
+/* Values for the ACTION argument to `tcflow'.  */
+#define	TCOOFF		0
+#define	TCOON		1
+#define	TCIOFF		2
+#define	TCION		3
+
+/* Values for the QUEUE_SELECTOR argument to `tcflush'.  */
+#define	TCIFLUSH	0
+#define	TCOFLUSH	1
+#define	TCIOFLUSH	2
+
+/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'.  */
+#define	TCSANOW		0
+#define	TCSADRAIN	1
+#define	TCSAFLUSH	2
+
+struct sgttyb {
+	char	sg_ispeed;
+	char	sg_ospeed;
+	char	sg_erase;
+	char	sg_kill;
+	short	sg_flags;
+};
+
+struct tchars {
+	char	t_intrc;
+	char	t_quitc;
+	char	t_startc;
+	char	t_stopc;
+	char	t_eofc;
+	char	t_brkc;
+};
+
+struct ltchars {
+	char	t_suspc;
+	char	t_dsuspc;
+	char	t_rprntc;
+	char	t_flushc;
+	char	t_werasc;
+	char	t_lnextc;
+};
+
+#define FIOCLEX		_IO('f', 1)
+#define FIONCLEX	_IO('f', 2)
+#define FIOASYNC	_IOW('f', 125, int)
+#define FIONBIO		_IOW('f', 126, int)
+#define FIONREAD	_IOR('f', 127, int)
+#define TIOCINQ		FIONREAD
+
+#define TIOCGETP	_IOR('t', 8, struct sgttyb)
+#define TIOCSETP	_IOW('t', 9, struct sgttyb)
+#define TIOCSETN	_IOW('t', 10, struct sgttyb)	/* TIOCSETP wo flush */
+
+#define TIOCSETC	_IOW('t', 17, struct tchars)
+#define TIOCGETC	_IOR('t', 18, struct tchars)
+#define TCGETS		_IOR('t', 19, struct termios)
+#define TCSETS		_IOW('t', 20, struct termios)
+#define TCSETSW		_IOW('t', 21, struct termios)
+#define TCSETSF		_IOW('t', 22, struct termios)
+
+#define TCGETA		_IOR('t', 23, struct termio)
+#define TCSETA		_IOW('t', 24, struct termio)
+#define TCSETAW		_IOW('t', 25, struct termio)
+#define TCSETAF		_IOW('t', 28, struct termio)
+
+#define TCSBRK		_IO('t', 29)
+#define TCXONC		_IO('t', 30)
+#define TCFLSH		_IO('t', 31)
+
+#define TIOCSWINSZ	_IOW('t', 103, struct winsize)
+#define TIOCGWINSZ	_IOR('t', 104, struct winsize)
+#define	TIOCSTART	_IO('t', 110)		/* start output, like ^Q */
+#define	TIOCSTOP	_IO('t', 111)		/* stop output, like ^S */
+#define TIOCOUTQ        _IOR('t', 115, int)     /* output queue size */
+
+#define TIOCGLTC	_IOR('t', 116, struct ltchars)
+#define TIOCSLTC	_IOW('t', 117, struct ltchars)
+#define TIOCSPGRP	_IOW('t', 118, int)
+#define TIOCGPGRP	_IOR('t', 119, int)
+
+#define TIOCEXCL	0x540C
+#define TIOCNXCL	0x540D
+#define TIOCSCTTY	0x540E
+
+#define TIOCSTI		0x5412
+#define TIOCMGET	0x5415
+#define TIOCMBIS	0x5416
+#define TIOCMBIC	0x5417
+#define TIOCMSET	0x5418
+#define TIOCGSOFTCAR	0x5419
+#define TIOCSSOFTCAR	0x541A
+#define TIOCLINUX	0x541C
+#define TIOCCONS	0x541D
+#define TIOCGSERIAL	0x541E
+#define TIOCSSERIAL	0x541F
+#define TIOCPKT		0x5420
+
+#define TIOCNOTTY	0x5422
+#define TIOCSETD	0x5423
+#define TIOCGETD	0x5424
+#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
+#define TIOCTTYGSTRUCT	0x5426  /* For debugging only */
+
+#define TIOCSERCONFIG	0x5453
+#define TIOCSERGWILD	0x5454
+#define TIOCSERSWILD	0x5455
+#define TIOCGLCKTRMIOS	0x5456
+#define TIOCSLCKTRMIOS	0x5457
+#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
+#define TIOCSERGETLSR   0x5459 /* Get line status register */
+#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
+#define TIOCSERSETMULTI 0x545B /* Set multiport config */
+
+#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
+#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
+
+/* Used for packet mode */
+#define TIOCPKT_DATA		 0
+#define TIOCPKT_FLUSHREAD	 1
+#define TIOCPKT_FLUSHWRITE	 2
+#define TIOCPKT_STOP		 4
+#define TIOCPKT_START		 8
+#define TIOCPKT_NOSTOP		16
+#define TIOCPKT_DOSTOP		32
+
+struct winsize {
+	unsigned short ws_row;
+	unsigned short ws_col;
+	unsigned short ws_xpixel;
+	unsigned short ws_ypixel;
+};
+
+#define NCC 10
+struct termio {
+	unsigned short c_iflag;		/* input mode flags */
+	unsigned short c_oflag;		/* output mode flags */
+	unsigned short c_cflag;		/* control mode flags */
+	unsigned short c_lflag;		/* local mode flags */
+	unsigned char c_line;		/* line discipline */
+	unsigned char c_cc[NCC];	/* control characters */
+};
+
+/* c_cc characters */
+#define _VINTR	0
+#define _VQUIT	1
+#define _VERASE	2
+#define _VKILL	3
+#define _VEOF	4
+#define _VMIN	5
+#define _VEOL	6
+#define _VTIME	7
+#define _VEOL2	8
+#define _VSWTC	9
+
+/* modem lines */
+#define TIOCM_LE	0x001
+#define TIOCM_DTR	0x002
+#define TIOCM_RTS	0x004
+#define TIOCM_ST	0x008
+#define TIOCM_SR	0x010
+#define TIOCM_CTS	0x020
+#define TIOCM_CAR	0x040
+#define TIOCM_RNG	0x080
+#define TIOCM_DSR	0x100
+#define TIOCM_CD	TIOCM_CAR
+#define TIOCM_RI	TIOCM_RNG
+
+/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
+#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
+
+/* line disciplines */
+#define N_TTY		0
+#define N_SLIP		1
+#define N_MOUSE		2
+#define N_PPP		3
+
+#endif /* _TERMBITS_H */
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index 867e3bce3e..4e92f6d35c 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -30,10 +30,10 @@ nanosleep	-	nanosleep	2	__libc_nanosleep	__nanosleep nanosleep
 pause		-	pause		0	__libc_pause	pause
 personality	init-first personality	1	__personality	personality
 pipe		-	pipe		1	__pipe		pipe
-s_poll		EXTRA	poll		3	__syscall_poll
 query_module	EXTRA	query_module	5	query_module
 s_getdents	EXTRA	getdents	3	__getdents
 s_getpriority	getpriority getpriority	2	__syscall_getpriority
+s_poll		poll	poll		3	__syscall_poll
 s_ptrace	ptrace	ptrace		4	__syscall_ptrace
 s_reboot	EXTRA	reboot		3	__syscall_reboot
 s_sigaction	sigaction sigaction	3	__syscall_sigaction