about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-06-20 07:10:50 +0000
committerUlrich Drepper <drepper@redhat.com>2001-06-20 07:10:50 +0000
commitad10cac8a4d5874f6e7cd8cd6b4acbf86502a893 (patch)
tree55851a6afc1be5d786fce886daf3a528ba7a41f7 /sysdeps/unix
parent874e557059c1dfb945437826f477ed43b31871c7 (diff)
downloadglibc-ad10cac8a4d5874f6e7cd8cd6b4acbf86502a893.tar.gz
glibc-ad10cac8a4d5874f6e7cd8cd6b4acbf86502a893.tar.xz
glibc-ad10cac8a4d5874f6e7cd8cd6b4acbf86502a893.zip
Update.
2001-05-09  Michael Keezer  <mkeezer@redhat.com>

	* Makeconfig: Added AIX-ld support for DSO.
	* Makerules: Likewise.
	* dlfcn/Makefile (defaultmod1.so): Added libc_nonshared.
	(defaultmod2.so): Likewise.
	* debug/Makefile: Conditionalize use of elf/ld.so.
	* iconvdata/Makefile: Moved LDFLAG rpath/soname info into Makeconfig.

	* sysdeps/unix/sysv/aix/Makefile: Added dl-support.c and dl-error.c.
	* sysdeps/unix/sysv/aix/Makefile: Made (f/g)rsave(0/1) &
	(f/g)prrest(0/1) static only.
	* sysdeps/unix/sysv/aix/gettimeofday.c: Removed #if 0.
	* sysdeps/unix/sysv/aix/start.c: Define __dso_handle if not ELF but
	shared.
	* sysdeps/unix/sysv/aix/setitimer.c: New file.
	* sysdeps/unix/sysv/aix/sleep.c: New file.
	* sysdeps/unix/sysv/aix/usleep.c: New file.
	* sysdeps/unix/sysv/aix/dl-addr.c: New file.
	* sysdeps/unix/sysv/aix/dl-error.c: New file.
	* sysdeps/unix/sysv/aix/dl-support.c: New file.
	* sysdeps/unix/sysv/aix/powerpc/register-dump.h: New file.

	(BODY for TO_LOOP): Keep track of Unicode 3.1 language tag. I f "ja",
	prefer conversion to Japanese character sets.  If "zh", prefer
	conversion to GB2312. I f "ko", prefer conversion to KSC5601.  Small
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/aix/Makefile5
-rw-r--r--sysdeps/unix/sysv/aix/dl-addr.c30
-rw-r--r--sysdeps/unix/sysv/aix/dl-error.c20
-rw-r--r--sysdeps/unix/sysv/aix/dl-support.c20
-rw-r--r--sysdeps/unix/sysv/aix/gettimeofday.c6
-rw-r--r--sysdeps/unix/sysv/aix/powerpc/register-dump.h281
-rw-r--r--sysdeps/unix/sysv/aix/setitimer.c68
-rw-r--r--sysdeps/unix/sysv/aix/sleep.c34
-rw-r--r--sysdeps/unix/sysv/aix/start.c17
-rw-r--r--sysdeps/unix/sysv/aix/usleep.c34
10 files changed, 504 insertions, 11 deletions
diff --git a/sysdeps/unix/sysv/aix/Makefile b/sysdeps/unix/sysv/aix/Makefile
index dc91f8f241..19ec885473 100644
--- a/sysdeps/unix/sysv/aix/Makefile
+++ b/sysdeps/unix/sysv/aix/Makefile
@@ -3,7 +3,10 @@
 +postctor += /lib/syscalls.exp
 
 ifeq ($(subdir),misc)
-sysdep_routines  += dl-libc dl-open dl-sym dl-close uitrunc 
+sysdep_routines  += dl-error dl-support dl-libc dl-open dl-sym \
+		    dl-close dl-addr uitrunc
+
+static-only-routines = gprsave0 gprrest0 gprsave1 gprrest1 fprsave fprrest
 endif
 
 ifeq ($(subdir),login)
diff --git a/sysdeps/unix/sysv/aix/dl-addr.c b/sysdeps/unix/sysv/aix/dl-addr.c
new file mode 100644
index 0000000000..928b76eda0
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/dl-addr.c
@@ -0,0 +1,30 @@
+/*
+   Copyright (C) 1996, 1997, 1998, 1999, 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 <dlfcn.h>
+#include <stdlib.h>
+#include <ldsodefs.h>
+
+int
+internal_function
+_dl_addr (const void *address, Dl_info *info)
+{
+  return 0;
+}
+
diff --git a/sysdeps/unix/sysv/aix/dl-error.c b/sysdeps/unix/sysv/aix/dl-error.c
new file mode 100644
index 0000000000..069596e323
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/dl-error.c
@@ -0,0 +1,20 @@
+/* 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.  */
+
+
+#include <elf/dl-error.c>
diff --git a/sysdeps/unix/sysv/aix/dl-support.c b/sysdeps/unix/sysv/aix/dl-support.c
new file mode 100644
index 0000000000..a641370883
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/dl-support.c
@@ -0,0 +1,20 @@
+/* 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.  */
+
+
+#include <elf/dl-support.c>
diff --git a/sysdeps/unix/sysv/aix/gettimeofday.c b/sysdeps/unix/sysv/aix/gettimeofday.c
index 6b5bd48085..e85bd05f5e 100644
--- a/sysdeps/unix/sysv/aix/gettimeofday.c
+++ b/sysdeps/unix/sysv/aix/gettimeofday.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 94, 95, 96, 97, 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
@@ -57,10 +57,9 @@ __gettimeofday (tv, tz)
   if (ts != tu)          /* the lower reg to the upper      */
       tl  = rtc_lower(); /* Recover from the race condition */
 
-  tv->tv_sec  = (long int) (tu + (double)tl/1000000000); 
+  tv->tv_sec  = (long int) (tu + (double)tl/1000000000);
   tv->tv_usec = (long int) ((double)tl/1000);
 
-#if 0
   if (tz != NULL)
     {
       const  time_t timer = tv->tv_sec;
@@ -86,7 +85,6 @@ __gettimeofday (tv, tz)
       if (tmp == NULL)
 	return -1;
     }
-#endif
 
   return 0;
 }
diff --git a/sysdeps/unix/sysv/aix/powerpc/register-dump.h b/sysdeps/unix/sysv/aix/powerpc/register-dump.h
new file mode 100644
index 0000000000..3f308e6856
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/powerpc/register-dump.h
@@ -0,0 +1,281 @@
+/* Dump registers.
+   Copyright (C) 1998 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 <sys/uio.h>
+#include <stdio-common/_itoa.h>
+#include <sys/ucontext.h>
+
+/* We will print the register dump in this format:
+
+Register dump:
+fp0-3:   0000000000000000 0000000000000000 0000000000000000 0000000000000000
+fp4-7:   0000000000000000 0000000000000000 0000000000000000 0000000000000000
+fp8-11:  0000000000000000 0000000000000000 0000000000000000 0000000000000000
+fp12-15: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
+fp16-19: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
+fp20-23: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
+fp24-27: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
+fp28-31: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
+
+r00-07 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
+r08-15 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
+r16-23 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
+r24-31 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
+
+  trap 00000000   iar 00000000 msr 00000000 cr 00000000
+    lr 00000000   ctr 00000000 xer 00000000 mq 00000000
+   tid 00000000 fpscr 00000000
+
+*/
+
+
+static void
+hexvalue (unsigned long int value, char *buf, size_t len)
+{
+  char *cp = _itoa_word (value, buf + len, 16, 0);
+  while (cp > buf)
+    *--cp = '0';
+}
+
+
+static void
+register_dump (int fd, struct sigcontext *ctx)
+{
+  char regs[108][8];
+  struct iovec iov[38];
+  struct __mstsafe  *reg_state;
+  int i;
+  int ii;
+  size_t nr = 0;
+
+#define ADD_STRING(str) \
+  iov[nr].iov_base = (char *) str;                                            \
+  iov[nr].iov_len = strlen (str);                                             \
+  ++nr
+#define ADD_MEM(str, len) \
+  iov[nr].iov_base = str;                                                     \
+  iov[nr].iov_len = len;                                                      \
+  ++nr
+
+  reg_state = (struct __mstsafe  *)&ctx->sc_jmpbuf.__jmp_context;
+
+  hexvalue (reg_state->__excp_type, regs[0], 8);
+  hexvalue (reg_state->__iar, regs[1], 8);
+  hexvalue (reg_state->__msr, regs[2], 8);
+  hexvalue (reg_state->__cr, regs[3], 8);
+  hexvalue (reg_state->__lr, regs[4], 8);
+  hexvalue (reg_state->__ctr, regs[5], 8);
+  hexvalue (reg_state->__xer, regs[6], 8);
+  hexvalue (reg_state->__mq, regs[7], 8);
+  hexvalue (reg_state->__tid, regs[8], 8);
+  hexvalue (reg_state->__fpscr, regs[9], 8);
+
+  ii=10;
+  for (i = 0; i <= 96; i++,ii++)
+    hexvalue (reg_state->__gpr[i], regs[ii], 8);
+
+  /* Generate the output.  */
+  ADD_STRING ("Register dump:\n\nfp0-3:   ");
+  ADD_MEM (regs[42], 8);
+  ADD_MEM (regs[43], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[44], 8);
+  ADD_MEM (regs[45], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[46], 8);
+  ADD_MEM (regs[47], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[48], 8);
+  ADD_MEM (regs[49], 8);
+  ADD_STRING ("\nfp4-7:   ");
+  ADD_MEM (regs[50], 8);
+  ADD_MEM (regs[51], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[52], 8);
+  ADD_MEM (regs[53], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[54], 8);
+  ADD_MEM (regs[55], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[56], 8);
+  ADD_MEM (regs[57], 8);
+  ADD_STRING ("\nfp8-11:  ");
+  ADD_MEM (regs[58], 8);
+  ADD_MEM (regs[59], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[60], 8);
+  ADD_MEM (regs[61], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[62], 8);
+  ADD_MEM (regs[63], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[64], 8);
+  ADD_MEM (regs[65], 8);
+  ADD_STRING ("\nfp12-15: ");
+  ADD_MEM (regs[66], 8);
+  ADD_MEM (regs[67], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[68], 8);
+  ADD_MEM (regs[69], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[70], 8);
+  ADD_MEM (regs[71], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[72], 8);
+  ADD_MEM (regs[73], 8);
+  ADD_STRING ("\nfp16-19: ");
+  ADD_MEM (regs[74], 8);
+  ADD_MEM (regs[75], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[76], 8);
+  ADD_MEM (regs[78], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[79], 8);
+  ADD_MEM (regs[80], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[81], 8);
+  ADD_MEM (regs[82], 8);
+  ADD_STRING ("\nfp20-23: ");
+  ADD_MEM (regs[83], 8);
+  ADD_MEM (regs[84], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[85], 8);
+  ADD_MEM (regs[86], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[87], 8);
+  ADD_MEM (regs[88], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[89], 8);
+  ADD_MEM (regs[90], 8);
+  ADD_STRING ("\nfp24-27: ");
+  ADD_MEM (regs[91], 8);
+  ADD_MEM (regs[92], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[93], 8);
+  ADD_MEM (regs[94], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[95], 8);
+  ADD_MEM (regs[96], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[97], 8);
+  ADD_MEM (regs[98], 8);
+  ADD_STRING ("\nfp28-31: ");
+  ADD_MEM (regs[99], 8);
+  ADD_MEM (regs[100], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[101], 8);
+  ADD_MEM (regs[102], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[103], 8);
+  ADD_MEM (regs[104], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[105], 8);
+  ADD_MEM (regs[106], 8);
+  ADD_STRING ("\n\nr00-07 ");
+  ADD_MEM (regs[10], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[11], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[12], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[13], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[14], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[15], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[16], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[17], 8);
+  ADD_STRING ("\nr08-15 ");
+  ADD_MEM (regs[18], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[19], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[20], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[21], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[22], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[23], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[24], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[25], 8);
+  ADD_STRING ("\nr16-23 ");
+  ADD_MEM (regs[26], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[27], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[28], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[29], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[30], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[31], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[32], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[33], 8);
+  ADD_STRING ("\nr24-31 ");
+  ADD_MEM (regs[34], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[35], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[36], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[37], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[38], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[39], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[40], 8);
+  ADD_STRING (" ");
+  ADD_MEM (regs[41], 8);
+  ADD_STRING ("\n\n  trap ");
+  ADD_MEM (regs[0], 8);
+  ADD_STRING ("   iar ");
+  ADD_MEM (regs[1], 8);
+  ADD_STRING (" msr ");
+  ADD_MEM (regs[2], 8);
+  ADD_STRING (" cr ");
+  ADD_MEM (regs[3], 8);
+  ADD_STRING ("\n    lr ");
+  ADD_MEM (regs[4], 8);
+  ADD_STRING ("   ctr ");
+  ADD_MEM (regs[5], 8);
+  ADD_STRING (" xer ");
+  ADD_MEM (regs[6], 8);
+  ADD_STRING (" mq ");
+  ADD_MEM (regs[7], 8);
+  ADD_STRING ("\n   tid ");
+  ADD_MEM (regs[8], 8);
+  ADD_STRING (" fpscr ");
+  ADD_MEM (regs[9], 8);
+  ADD_STRING ("\n");
+
+  /* Write the stuff out.  */
+  writev (fd, iov, nr);
+}
+
+#define REGISTER_DUMP register_dump (fd, ctx)
+
diff --git a/sysdeps/unix/sysv/aix/setitimer.c b/sysdeps/unix/sysv/aix/setitimer.c
new file mode 100644
index 0000000000..444900b99c
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/setitimer.c
@@ -0,0 +1,68 @@
+/* Copyright (C) 1991, 1994, 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 <stddef.h>
+#include <errno.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <signal.h>
+
+extern int __libc_nanosleep (const struct timespec *requested_time,
+			     struct timespec *remaining);
+int
+__setitimer (which, new, old)
+     enum __itimer_which which;
+     const struct itimerval *new;
+     struct itimerval *old;
+{
+  if (new == NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  switch (which)
+   {
+    default:
+      __set_errno (EINVAL);
+      return -1;
+
+    case ITIMER_VIRTUAL:
+    case ITIMER_PROF:
+      __set_errno (ENOSYS);
+      return -1;
+
+    case ITIMER_REAL:
+      break;
+   }
+
+  switch (__fork())
+   {
+    case -1: exit(-1);
+    case  0:
+       {
+        struct timespec ts ={tv_sec:(long int)new->it_value.tv_sec,tv_nsec:0};
+        __libc_nanosleep(&ts,&ts);
+	__kill(getppid(), SIGALRM);
+	exit(0);
+       }
+    default:
+   }
+  return 0;
+}
+weak_alias (__setitimer, setitimer)
diff --git a/sysdeps/unix/sysv/aix/sleep.c b/sysdeps/unix/sysv/aix/sleep.c
new file mode 100644
index 0000000000..3ac5952b3a
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/sleep.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1992, 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 <time.h>
+#include <unistd.h>
+#include <errno.h>
+
+extern int __libc_nanosleep (const struct timespec *requested_time,
+			     struct timespec *remaining);
+
+unsigned int
+__sleep (seconds)
+     unsigned int seconds;
+{
+  struct timespec ts ={tv_sec:(long int)seconds,tv_nsec:0};
+  __libc_nanosleep(&ts,&ts);
+  return 0;
+}
+weak_alias (__sleep, sleep)
diff --git a/sysdeps/unix/sysv/aix/start.c b/sysdeps/unix/sysv/aix/start.c
index d854a55f42..eee21966ef 100644
--- a/sysdeps/unix/sysv/aix/start.c
+++ b/sysdeps/unix/sysv/aix/start.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 93, 1995-1998, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 93, 1995-1998, 2000, 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
@@ -32,6 +32,12 @@ typedef unsigned char   uchar;   /* sb in libc/posix/types.h */
 /* The first piece of initialized data.  */
 int __data_start = 0;
 
++#ifndef HAVE_ELF
+/* Since gcc/crtstuff.c won't define it unless the ELF format is used
+   we will need to define it here.  */
+void *__dso_handle = NULL;
+#endif
+
 extern int errno;
 
 /* extern __pthread_init; */
@@ -108,12 +114,12 @@ asm("
 #endif
        crt0_info.p_argc = (int*)&argc;
 
-/*     crt0_info.threads_init = (FPV) &__pthread_init;  */  
+/*     crt0_info.threads_init = (FPV) &__pthread_init;  */
 
      /*
       * Do run-time linking, if enabled and call the init()
       * for all loaded modules.
-      */ 
+      */
       argc = modinit(argc,&crt0_info,module_count,text_origin,data_origin);
 
       errno=0;
@@ -131,9 +137,9 @@ asm("
  * int modinit(argc,crt0_info,module_count,text,data)
  *
  * argc         - current value of argc.
- * info         - crt0 information passed 
+ * info         - crt0 information passed
  * module_count - number of modules loaded.
- * text         - Beginning of text address 
+ * text         - Beginning of text address
  * data         - Beginning of data address
  */
 
@@ -287,4 +293,3 @@ __RTINIT *find_rtinit(caddr_t text_origin, caddr_t data_origin, int module_count
                      (data_origin - data_sec_hdr->s_vaddr));
   return(rtl);
 }
-
diff --git a/sysdeps/unix/sysv/aix/usleep.c b/sysdeps/unix/sysv/aix/usleep.c
new file mode 100644
index 0000000000..19d57737bc
--- /dev/null
+++ b/sysdeps/unix/sysv/aix/usleep.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1992, 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 <time.h>
+#include <unistd.h>
+#include <errno.h>
+
+extern int __libc_nanosleep (const struct timespec *requested_time,
+			     struct timespec *remaining);
+
+/* Sleep USECONDS microseconds, or until a previously set timer goes off.  */
+int
+usleep (useconds)
+     useconds_t useconds;
+{
+  struct timespec ts ={tv_sec:0,tv_nsec:(long int)useconds * 1000};
+  __libc_nanosleep(&ts,&ts);
+  return 0;
+}