about summary refs log tree commit diff
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
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
-rw-r--r--ChangeLog29
-rw-r--r--Makeconfig46
-rw-r--r--Makerules65
-rw-r--r--debug/Makefile4
-rw-r--r--dlfcn/Makefile8
-rw-r--r--iconvdata/Makefile30
-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
16 files changed, 659 insertions, 38 deletions
diff --git a/ChangeLog b/ChangeLog
index 762d47844b..e7d7af847f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+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.
+
 2001-06-19  Ulrich Drepper  <drepper@redhat.com>
 
 	* po/es.po: Update from translation team.
@@ -423,9 +446,9 @@
 	(cvlist_t): New type.
 	(CVLIST, CVLIST_FIRST, CVLIST_REST): New macros.
 	(conversion_lists): New array.
-	(BODY for TO_LOOP): Keep track of Unicode 3.1 language tag. If "ja",
-	prefer conversion to Japanese character sets. If "zh", prefer
-	conversion to GB2312. If "ko", prefer conversion to KSC5601. Small
+	(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
 	optimizations.
 	(INIT_PARAMS): Add tag.
 	(UPDATE_PARAMS): Add tag.
diff --git a/Makeconfig b/Makeconfig
index 26884f82d2..3b9f62f5dc 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -423,6 +423,7 @@ endif
 endif
 ifndef link-libc
 ifeq (yes,$(build-shared))
+ifeq ($(elf),yes)
 # We need the versioned name of libc.so in the deps of $(others) et al
 # so that the symlink to libc.so is created before anything tries to
 # run the linked programs.
@@ -431,6 +432,13 @@ link-libc = -Wl,-rpath-link=$(rpath-link) \
 	    $(common-objpfx)$(patsubst %,$(libtype.oS),c) $(gnulib)
 # This is how to find at build-time things that will be installed there.
 rpath-dirs = math elf dlfcn nss nis rt resolv crypt
+else
+ifneq (,$(findstring aix,$(config-os)))
+link-libc = $(common-objpfx)libc.so \
+	    $(common-objpfx)$(patsubst %,$(libtype.oS),c) $(gnulib)
+rpath-dirs = math dlfcn nss nis rt resolv crypt
+endif
+endif
 rpath-link = \
 $(common-objdir):$(subst $(empty) ,:,$(patsubst ../$(subdir),.,$(rpath-dirs:%=$(common-objpfx)%)))
 elfobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)elf)
@@ -441,6 +449,21 @@ link-libc = $(common-objpfx)libc.a $(otherlibs) $(gnulib) $(common-objpfx)libc.a
 endif
 endif
 
+# Differences in the linkers on the various platforms.
+ifeq ($(elf),yes)
+LDFLAGS-rpath-ORIGIN = -Wl,-rpath,'$$ORIGIN'
+LDFLAGS-soname-fname = -Wl,-soname,$(@F)
+LDFLAGS-rdynamic = -rdynamic
+LDFLAGS-Bsymbolic = -Bsymbolic
+else
+ifneq (,$(findstring aix,$(config-os)))
+LDFLAGS-rpath-ORIGIN =
+LDFLAGS-soname-fname =
+LDFLAGS-rdynamic = -Wl,-bdynamic
+LDFLAGS-Bsymbolic = -Wl,-bsymbolic
+endif
+endif
+
 # Choose the default search path for the dynamic linker based on
 # where we will install libraries.
 ifneq ($(libdir),$(slibdir))
@@ -493,7 +516,7 @@ elf-objpfx = $(common-objpfx)elf/
 # How to run a program we just linked with our library.
 # The program binary is assumed to be $(word 2,$^).
 built-program-file = $(dir $(word 2,$^))$(notdir $(word 2,$^))
-ifeq (yes,$(build-shared))
+ifeq (yesyes,$(build-shared)$(elf))
 comma = ,
 sysdep-library-path = \
 $(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\
@@ -758,6 +781,13 @@ postclean-generated += soversions.mk
 before-compile += $(common-objpfx)gnu/lib-names.h
 ifeq ($(soversions.mk-done),t)
 $(common-objpfx)gnu/lib-names.h: $(common-objpfx)gnu/lib-names.stmp; @:
+ifneq (,$(findstring aix,$(config-os)))
+$(common-objpfx)gnu/lib-names.stmp: $(..)sysdeps/unix/sysv/aix/gnu/lib-names.h
+	$(make-target-directory)
+	@rm -f ${@:stmp=T} $@
+	@cp $(..)sysdeps/unix/sysv/aix/gnu/lib-names.h $(common-objpfx)gnu
+	touch $@
+else
 $(common-objpfx)gnu/lib-names.stmp: $(common-objpfx)soversions.mk
 	$(make-target-directory)
 	@rm -f ${@:stmp=T} $@
@@ -786,6 +816,7 @@ $(common-objpfx)gnu/lib-names.stmp: $(common-objpfx)soversions.mk
 	$(move-if-change) ${@:stmp=T} ${@:stmp=h}
 	touch $@
 endif
+endif
 
 common-generated += gnu/lib-names.h gnu/lib-names.stmp
 
@@ -815,10 +846,21 @@ else
 libdl = $(common-objpfx)dlfcn/libdl.a
 endif
 else
-# No ELF - no libdl, at least for now.
+ifneq (,$(findstring aix,$(config-os)))
+ifeq ($(build-shared),yes)
+dlfcn = dlfcn
+libdl = $(common-objpfx)dlfcn/libdl.so$(libdl.so-version)
+else
+# No libdl without shared libs on AIX
+dlfcn =
+libdl =
+endif
+else
+# No ELF, no AIX - no libdl, at least for now.
 dlfcn =
 libdl =
 endif
+endif
 
 # These are the subdirectories containing the library source.  The order
 # is more or less arbitrary.  The sorting step will take care of the
diff --git a/Makerules b/Makerules
index 596f3cf3b0..56455e6d7b 100644
--- a/Makerules
+++ b/Makerules
@@ -351,7 +351,7 @@ endif
 
 # Modify the list of routines we build for different targets
 
-ifeq (yes,$(build-shared))
+ifeq (yesyes,$(build-shared)$(elf))
 ifndef libc.so-version
 # Undefine this because it can't work when we libc.so is unversioned.
 static-only-routines =
@@ -392,8 +392,13 @@ endif
 # $(LDLIBS-%.so) may contain -l switches to generate run-time dependencies
 # on other shared objects.
 lib%.so: lib%_pic.a $(+preinit) $(+postinit) $(+interp)
+ifneq (,$(findstring aix,$(config-os)))
+	(echo '#!'; \
+	 dump -g $< | sed '1,6d' | cut -f2 | sort | uniq) > $(<:a=exp)
+endif
 	$(build-shlib)
 
+ifeq ($(elf),yes)
 define build-shlib-helper
 $(LINK.o) -shared -Wl,-O1 $(sysdep-LDFLAGS) $(config-LDFLAGS) \
 	  $(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \
@@ -402,6 +407,18 @@ $(LINK.o) -shared -Wl,-O1 $(sysdep-LDFLAGS) $(config-LDFLAGS) \
 	  $(LDFLAGS.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
 	  -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link)
 endef
+else
+ifneq (,$(findstring aix,$(config-os)))
+define build-shlib-helper
+$(LINK.o) -G -bM:SRE -bnoentry -bE:$(<:a=exp) \
+	  $(sysdep-LDFLAGS) $(config-LDFLAGS) $(extra-B-$(@F:lib%.so=%).so) \
+	  $(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \
+	  $(LDFLAGS.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
+	  -L$(subst :, -L,$(rpath-link))
+endef
+else
+endif
+endif
 
 ifeq (yes,$(elf))
 # binutils only position loadable notes into the first page for binaries,
@@ -419,18 +436,36 @@ $(build-shlib-helper) -o $@ -T $@.lds \
 rm -f $@.lds
 endef
 else
+ifneq (,$(findstring aix,$(config-os)))
+define build-shlib
+$(build-shlib-helper) \
+	-o $@ \
+	$(filter-out $(map-file) $(+preinit) $(+postinit),$^) \
+	$(no-whole-archive) $(LDLIBS-$(@F:lib%.so=%).so)
+endef
 define build-shlib
 $(build-shlib-helper) \
 	  $(build-shlib-objlist)
 endef
 endif
+endif
 
+ifneq (,$(findstring aix,$(config-os)))
+define build-module-helper
+$(LINK.o) -Wl,-G -Wl,-bM:SRE -Wl,-bnoentry -Wl,-bexpall \
+	  $(sysdep-LDFLAGS) $(config-LDFLAGS) \
+	  $(load-map-file) \
+	  $(LDFLAGS.so) $(LDFLAGS-$(@F:%.so=%).so) \
+	  -L$(subst :, -L,$(rpath-link)) -Wl,-L=$(rpath-link)
+endef
+else
 define build-module-helper
 $(LINK.o) -shared $(sysdep-LDFLAGS) $(config-LDFLAGS) \
 	  -B$(csu-objpfx) $(load-map-file) \
 	  $(LDFLAGS.so) $(LDFLAGS-$(@F:%.so=%).so) \
 	  -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link)
 endef
+endif
 
 # This macro is similar to build-shlib but it does not define a soname
 # and it does not depend on the destination name to start with `lib'.
@@ -450,12 +485,22 @@ $(build-module-helper) -o $@ -T $@.lds \
 rm -f $@.lds
 endef
 else
+ifneq (,$(findstring aix,$(config-os)))
+define build-module
+$(build-module-helper) \
+	  -o $@ \
+	  $(filter-out $(map-file) $(+preinit) $(+postinit),$^) \
+	  $(no-whole-archive) $(LDLIBS-$(@F:%.so=%).so)
+endef
+else
+define build-module
 define build-module
 $(build-module-helper) \
 	  -o $@ \
 	  $(build-module-objlist)
 endef
 endif
+endif
 
 build-module-helper-objlist = \
 	$(patsubst %_pic.a,$(whole-archive) %_pic.a $(no-whole-archive),\
@@ -481,6 +526,7 @@ LDFLAGS-c.so += -u __register_frame
 # contains some of libc_pic.a already, which will prevent the COMMONs
 # from being allocated in libc.so, which introduces evil dependencies
 # between libc.so and ld.so, which can make it impossible to upgrade.
+ifeq ($(elf),yes)
 $(common-objpfx)libc_pic.os: $(common-objpfx)libc_pic.a
 	$(LINK.o) -nostdlib -nostartfiles -r -o $@ \
 	$(LDFLAGS-c_pic.os) -Wl,-d -Wl,--whole-archive $^
@@ -500,6 +546,23 @@ $(common-objpfx)libc.so$(libc.so-version): $(common-objpfx)libc.so
 common-generated += libc.so$(libc.so-version)
 endif
 endif
+else
+ifneq (,$(findstring aix,$(config-os)))
+$(common-objpfx)libc.so: $(common-objpfx)libc_pic.a
+	@rm -f $@
+	(echo '#!'; \
+	 dump -g $^ | sed '1,6d' | cut -f2 | sort | uniq) > $(^:a=exp)
+	sed '/__mulh/d;/__mull/d;/__divss/d;/__divus/d;/__quoss/d;/__quous/d' \
+	    /lib/syscalls.exp > $(common-objpfx)syscalls.exp
+	$(LINK.o) -G -bM:SRE -bnoentry -bE:$(^:a=exp) \
+		  -bE:$(common-objpfx)syscalls.exp \
+		  -bI:$(common-objpfx)syscalls.exp \
+		  -L$(common-objpfx) -o $@ $^
+# AIX runtime ld wants libc.so to be libc.a(shr.o) hardwired
+	cp $@ $(common-objpfx)shr.o
+	$(AR) $(ARFLAGS) $(common-objpfx)libc.a $(common-objpfx)shr.o
+endif
+endif
 
 # Figure out the source filenames in this directory.
 
diff --git a/debug/Makefile b/debug/Makefile
index afc80bf5a9..b33f52831b 100644
--- a/debug/Makefile
+++ b/debug/Makefile
@@ -73,7 +73,7 @@ $(objpfx)xtrace: xtrace.sh
 # a statically-linked program that hasn't already loaded it.
 $(objpfx)libSegFault.so: $(common-objpfx)libc.so \
 			 $(common-objpfx)libc_nonshared.a \
-			 $(common-objpfx)elf/ld.so
+			 $(elf-objpfx)$(rtld-installed-name)
 $(objpfx)libpcprofile.so: $(common-objpfx)libc.so \
 			  $(common-objpfx)libc_nonshared.a \
-			  $(common-objpfx)elf/ld.so
+			  $(elf-objpfx)$(rtld-installed-name)
diff --git a/dlfcn/Makefile b/dlfcn/Makefile
index 7bd7468993..190e2bf6b7 100644
--- a/dlfcn/Makefile
+++ b/dlfcn/Makefile
@@ -63,11 +63,11 @@ $(objpfx)failtest.out: $(objpfx)failtestmod.so
 $(objpfx)tst-dladdr: $(libdl)
 $(objpfx)tst-dladdr.out: $(objpfx)glreflib1.so
 
-LDFLAGS-default = -rdynamic
+LDFLAGS-default = $(LDFLAGS-rdynamic)
 $(objpfx)default: $(libdl) $(objpfx)defaultmod1.so $(objpfx)defaultmod2.so
-$(objpfx)defaultmod1.so: $(libdl)
-LDFLAGS-defaultmod2.so = -Bsymbolic
-$(objpfx)defaultmod2.so: $(libdl)
+$(objpfx)defaultmod1.so: $(libdl) $(common-objpfx)libc_nonshared.a
+LDFLAGS-defaultmod2.so = $(LDFLAGS-Bsymbolic)
+$(objpfx)defaultmod2.so: $(libdl) $(common-objpfx)libc_nonshared.a
 
 $(objpfx)errmsg1: $(libdl)
 $(objpfx)errmsg1.out: $(objpfx)errmsg1 $(objpfx)errmsg1mod.so
diff --git a/iconvdata/Makefile b/iconvdata/Makefile
index ce1a87930c..7faa9c8c6a 100644
--- a/iconvdata/Makefile
+++ b/iconvdata/Makefile
@@ -63,35 +63,35 @@ libGB-routines := gb2312
 libCNS-routines := cns11643l1 cns11643
 libISOIR165-routines := iso-ir-165
 
-LDFLAGS-EUC-KR.so = -Wl,-rpath,'$$ORIGIN'
+LDFLAGS-EUC-KR.so = $(LDFLAGS-rpath-ORIGIN)
 $(objpfx)EUC-KR.so: $(objpfx)libKSC.so
-LDFLAGS-JOHAB.so = -Wl,-rpath,'$$ORIGIN'
+LDFLAGS-JOHAB.so = $(LDFLAGS-rpath-ORIGIN)
 $(objpfx)JOHAB.so: $(objpfx)libKSC.so
-LDFLAGS-UHC.so = -Wl,-rpath,'$$ORIGIN'
+LDFLAGS-UHC.so = $(LDFLAGS-rpath-ORIGIN)
 $(objpfx)UHC.so: $(objpfx)libKSC.so
-LDFLAGS-EUC-JP.so = -Wl,-rpath,'$$ORIGIN'
+LDFLAGS-EUC-JP.so = $(LDFLAGS-rpath-ORIGIN)
 $(objpfx)EUC-JP.so: $(objpfx)libJIS.so
-LDFLAGS-EUC-CN.so = -Wl,-rpath,'$$ORIGIN'
+LDFLAGS-EUC-CN.so = $(LDFLAGS-rpath-ORIGIN)
 $(objpfx)EUC-CN.so: $(objpfx)libGB.so
-LDFLAGS-EUC-TW.so = -Wl,-rpath,'$$ORIGIN'
+LDFLAGS-EUC-TW.so = $(LDFLAGS-rpath-ORIGIN)
 $(objpfx)EUC-TW.so: $(objpfx)libCNS.so
 
-LDFLAGS-ISO-2022-JP.so = -Wl,-rpath,'$$ORIGIN'
+LDFLAGS-ISO-2022-JP.so = $(LDFLAGS-rpath-ORIGIN)
 $(objpfx)ISO-2022-JP.so: $(objpfx)libJIS.so $(objpfx)libGB.so \
 			 $(objpfx)libCNS.so $(objpfx)libKSC.so
-LDFLAGS-ISO-2022-KR.so = -Wl,-rpath,'$$ORIGIN'
+LDFLAGS-ISO-2022-KR.so = $(LDFLAGS-rpath-ORIGIN)
 $(objpfx)ISO-2022-KR.so: $(objpfx)libKSC.so
-LDFLAGS-ISO-2022-CN.so = -Wl,-rpath,'$$ORIGIN'
+LDFLAGS-ISO-2022-CN.so = $(LDFLAGS-rpath-ORIGIN)
 $(objpfx)ISO-2022-CN.so: $(objpfx)libGB.so $(objpfx)libCNS.so
-LDFLAGS-ISO-2022-CN-EXT.so = -Wl,-rpath,'$$ORIGIN'
+LDFLAGS-ISO-2022-CN-EXT.so = $(LDFLAGS-rpath-ORIGIN)
 $(objpfx)ISO-2022-CN-EXT.so: $(objpfx)libGB.so $(objpfx)libCNS.so \
 			     $(objpfx)libISOIR165.so
 
-LDFLAGS-libJIS.so = -Wl,-soname,$(@F)
-LDFLAGS-libKSC.so = -Wl,-soname,$(@F)
-LDFLAGS-libGB.so = -Wl,-soname,$(@F)
-LDFLAGS-libCNS.so = -Wl,-soname,$(@F)
-LDFLAGS-libISOIR165.so = -Wl,-soname,$(@F)
+LDFLAGS-libJIS.so = $(LDFLAGS-soname-fname)
+LDFLAGS-libKSC.so = $(LDFLAGS-soname-fname)
+LDFLAGS-libGB.so = $(LDFLAGS-soname-fname)
+LDFLAGS-libCNS.so = $(LDFLAGS-soname-fname)
+LDFLAGS-libISOIR165.so = $(LDFLAGS-soname-fname)
 
 distribute := gconv-modules extra-module.mk gap.awk gaptab.awk		    \
 	      gen-8bit.sh gen-8bit-gap.sh gen-8bit-gap-1.sh		    \
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;
+}