about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/Makefile4
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/Versions7
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h170
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/bits/mman.h94
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/bits/stat.h108
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/bits/statfs.h58
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/bits/time.h73
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/bits/types.h119
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/brk.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/clone.S86
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/fstatfs64.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/ftruncate64.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/fxstat.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/fxstat64.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/getdents.c2
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/getdents64.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/getrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/gettimeofday.c38
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/glob64.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed3
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/lxstat.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/lxstat64.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/mmap64.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/pread64.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/profil-counter.h27
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/pwrite64.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/readdir.c2
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/readdir64.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/readdir64_r.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/readdir_r.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/recv.c34
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/register-dump.h344
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/send.c31
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/setrlimit64.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sigaction.c99
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h26
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sigpending.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sigprocmask.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sigsuspend.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/statfs64.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sys/perm.h36
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sys/procfs.h127
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sys/reg.h47
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h160
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sys/user.h97
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/syscall.S44
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/syscalls.list44
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sysdep.S56
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sysdep.h205
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/time.c33
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/truncate64.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/umount.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/vfork.S52
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/xstat.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/xstat64.c1
-rw-r--r--sysdeps/unix/x86_64/sysdep.S71
-rw-r--r--sysdeps/unix/x86_64/sysdep.h35
-rw-r--r--sysdeps/x86_64/Implies4
-rw-r--r--sysdeps/x86_64/Makefile6
-rw-r--r--sysdeps/x86_64/Versions5
-rw-r--r--sysdeps/x86_64/__longjmp.S44
-rw-r--r--sysdeps/x86_64/abort-instr.h2
-rw-r--r--sysdeps/x86_64/atomicity.h57
-rw-r--r--sysdeps/x86_64/bits/endian.h7
-rw-r--r--sysdeps/x86_64/bits/setjmp.h47
-rw-r--r--sysdeps/x86_64/bits/string.h26
-rw-r--r--sysdeps/x86_64/bp-asm.h141
-rw-r--r--sysdeps/x86_64/bsd-_setjmp.S39
-rw-r--r--sysdeps/x86_64/bsd-setjmp.S38
-rw-r--r--sysdeps/x86_64/dl-machine.h417
-rw-r--r--sysdeps/x86_64/elf/initfini.c100
-rw-r--r--sysdeps/x86_64/elf/start.S95
-rw-r--r--sysdeps/x86_64/ffs.c38
-rw-r--r--sysdeps/x86_64/ffsll.c41
-rw-r--r--sysdeps/x86_64/fpu/bits/fenv.h93
-rw-r--r--sysdeps/x86_64/fpu/bits/mathdef.h39
-rw-r--r--sysdeps/x86_64/fpu/e_acosl.c1
-rw-r--r--sysdeps/x86_64/fpu/e_atan2l.c2
-rw-r--r--sysdeps/x86_64/fpu/e_exp2l.S38
-rw-r--r--sysdeps/x86_64/fpu/e_expl.c1
-rw-r--r--sysdeps/x86_64/fpu/e_fmodl.S22
-rw-r--r--sysdeps/x86_64/fpu/e_log10l.S66
-rw-r--r--sysdeps/x86_64/fpu/e_log2l.S63
-rw-r--r--sysdeps/x86_64/fpu/e_logl.S56
-rw-r--r--sysdeps/x86_64/fpu/e_powl.S316
-rw-r--r--sysdeps/x86_64/fpu/e_rem_pio2l.c3
-rw-r--r--sysdeps/x86_64/fpu/e_scalbl.S100
-rw-r--r--sysdeps/x86_64/fpu/e_sqrtl.c1
-rw-r--r--sysdeps/x86_64/fpu/fclrexcpt.c52
-rw-r--r--sysdeps/x86_64/fpu/fedisblxcpt.c49
-rw-r--r--sysdeps/x86_64/fpu/feenablxcpt.c49
-rw-r--r--sysdeps/x86_64/fpu/fegetenv.c30
-rw-r--r--sysdeps/x86_64/fpu/fegetexcept.c32
-rw-r--r--sysdeps/x86_64/fpu/fegetround.c33
-rw-r--r--sysdeps/x86_64/fpu/feholdexcpt.c41
-rw-r--r--sysdeps/x86_64/fpu/fesetenv.c89
-rw-r--r--sysdeps/x86_64/fpu/fesetround.c46
-rw-r--r--sysdeps/x86_64/fpu/fgetexcptflg.c36
-rw-r--r--sysdeps/x86_64/fpu/fraiseexcpt.c119
-rw-r--r--sysdeps/x86_64/fpu/fsetexcptflg.c54
-rw-r--r--sysdeps/x86_64/fpu/ftestexcept.c33
-rw-r--r--sysdeps/x86_64/fpu/libm-test-ulps1493
-rw-r--r--sysdeps/x86_64/fpu/math_ldbl.h79
-rw-r--r--sysdeps/x86_64/fpu/printf_fphex.c92
-rw-r--r--sysdeps/x86_64/fpu/s_atanl.c1
-rw-r--r--sysdeps/x86_64/fpu/s_cosl.S32
-rw-r--r--sysdeps/x86_64/fpu/s_expm1l.S83
-rw-r--r--sysdeps/x86_64/fpu/s_fpclassifyl.c2
-rw-r--r--sysdeps/x86_64/fpu/s_isinfl.c1
-rw-r--r--sysdeps/x86_64/fpu/s_isnanl.c1
-rw-r--r--sysdeps/x86_64/fpu/s_log1pl.S71
-rw-r--r--sysdeps/x86_64/fpu/s_logbl.c1
-rw-r--r--sysdeps/x86_64/fpu/s_nextafterl.c1
-rw-r--r--sysdeps/x86_64/fpu/s_nexttoward.c1
-rw-r--r--sysdeps/x86_64/fpu/s_nexttowardf.c1
-rw-r--r--sysdeps/x86_64/fpu/s_rintl.c1
-rw-r--r--sysdeps/x86_64/fpu/s_significandl.c1
-rw-r--r--sysdeps/x86_64/fpu/s_sincosl.S61
-rw-r--r--sysdeps/x86_64/fpu/s_sinl.S30
-rw-r--r--sysdeps/x86_64/fpu/s_tanl.S33
-rw-r--r--sysdeps/x86_64/gmp-mparam.h27
-rw-r--r--sysdeps/x86_64/hp-timing.c2
-rw-r--r--sysdeps/x86_64/hp-timing.h2
-rw-r--r--sysdeps/x86_64/htonl.S35
-rw-r--r--sysdeps/x86_64/memusage.h22
-rw-r--r--sysdeps/x86_64/setjmp.S45
-rw-r--r--sysdeps/x86_64/soft-fp/sfp-machine.h49
-rw-r--r--sysdeps/x86_64/stackinfo.h28
-rw-r--r--sysdeps/x86_64/sysdep.h101
129 files changed, 7224 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/x86_64/Makefile b/sysdeps/unix/sysv/linux/x86_64/Makefile
new file mode 100644
index 0000000000..6564eb0bc5
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/Makefile
@@ -0,0 +1,4 @@
+ifeq ($(subdir),misc)
+sysdep_routines += ioperm iopl
+sysdep_headers += sys/perm.h sys/reg.h
+endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/Versions b/sysdeps/unix/sysv/linux/x86_64/Versions
new file mode 100644
index 0000000000..76ee0ae876
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/Versions
@@ -0,0 +1,7 @@
+libc {
+  GLIBC_2.2.5 {
+    ioperm; iopl;
+
+    __modify_ldt; modify_ldt;
+  }
+}
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h b/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
new file mode 100644
index 0000000000..bb14a9f560
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
@@ -0,0 +1,170 @@
+/* O_*, F_*, FD_* bit values for Linux/x86-64.
+   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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef	_FCNTL_H
+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+#endif
+
+
+#include <sys/types.h>
+
+/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
+   located on an ext2 file system */
+#define O_ACCMODE	   0003
+#define O_RDONLY	     00
+#define O_WRONLY	     01
+#define O_RDWR		     02
+#define O_CREAT		   0100	/* not fcntl */
+#define O_EXCL		   0200	/* not fcntl */
+#define O_NOCTTY	   0400	/* not fcntl */
+#define O_TRUNC		  01000	/* not fcntl */
+#define O_APPEND	  02000
+#define O_NONBLOCK	  04000
+#define O_NDELAY	O_NONBLOCK
+#define O_SYNC		 010000
+#define O_FSYNC		 O_SYNC
+#define O_ASYNC		 020000
+
+#ifdef __USE_GNU
+# define O_DIRECT	 040000	/* Direct disk access.	*/
+# define O_DIRECTORY	0200000	/* Must be a directory.	 */
+# define O_NOFOLLOW	0400000	/* Do not follow links.	 */
+#endif
+
+/* For now Linux has synchronisity options for data and read operations.
+   We define the symbols here but let them do the same as O_SYNC since
+   this is a superset.	*/
+#if defined __USE_POSIX199309 || defined __USE_UNIX98
+# define O_DSYNC	O_SYNC	/* Synchronize data.  */
+# define O_RSYNC	O_SYNC	/* Synchronize read operations.	 */
+#endif
+
+#ifdef __USE_LARGEFILE64
+/* Not necessary, files are always with 64bit off_t.  */
+# define O_LARGEFILE	0
+#endif
+
+/* Values for the second argument to `fcntl'.  */
+#define F_DUPFD		0	/* Duplicate file descriptor.  */
+#define F_GETFD		1	/* Get file descriptor flags.  */
+#define F_SETFD		2	/* Set file descriptor flags.  */
+#define F_GETFL		3	/* Get file status flags.  */
+#define F_SETFL		4	/* Set file status flags.  */
+#define F_GETLK		5	/* Get record locking info.  */
+#define F_SETLK		6	/* Set record locking info (non-blocking).  */
+#define F_SETLKW	7	/* Set record locking info (blocking).	*/
+#define F_GETLK64	F_GETLK	/* Get record locking info.  */
+#define F_SETLK64	F_SETLK	/* Set record locking info (non-blocking).  */
+#define F_SETLKW64	F_SETLKW /* Set record locking info (blocking).	*/
+
+#if defined __USE_BSD || defined __USE_XOPEN2K
+# define F_SETOWN	8	/* Get owner of socket (receiver of SIGIO).  */
+# define F_GETOWN	9	/* Set owner of socket (receiver of SIGIO).  */
+#endif
+
+#ifdef __USE_GNU
+# define F_SETSIG	10	/* Set number of signal to be sent.  */
+# define F_GETSIG	11	/* Get number of signal to be sent.  */
+#endif
+
+#ifdef __USE_GNU
+# define F_SETLEASE	1024	/* Set a lease.	 */
+# define F_GETLEASE	1025	/* Enquire what lease is active.  */
+# define F_NOTIFY	1026	/* Request notfications on a directory.	 */
+#endif
+
+/* For F_[GET|SET]FL.  */
+#define FD_CLOEXEC	1	/* actually anything with low bit set goes */
+
+/* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
+#define F_RDLCK		0	/* Read lock.  */
+#define F_WRLCK		1	/* Write lock.	*/
+#define F_UNLCK		2	/* Remove lock.	 */
+
+/* For old implementation of bsd flock().  */
+#define F_EXLCK		4	/* or 3 */
+#define F_SHLCK		8	/* or 4 */
+
+#ifdef __USE_BSD
+/* Operations for bsd flock(), also used by the kernel implementation.	*/
+# define LOCK_SH	1	/* shared lock */
+# define LOCK_EX	2	/* exclusive lock */
+# define LOCK_NB	4	/* or'd with one of the above to prevent
+				   blocking */
+# define LOCK_UN	8	/* remove lock */
+#endif
+
+#ifdef __USE_GNU
+# define LOCK_MAND	32	/* This is a mandatory flock:	*/
+# define LOCK_READ	64	/* ... which allows concurrent read operations.	 */
+# define LOCK_WRITE	128	/* ... which allows concurrent write operations.  */
+# define LOCK_RW	192	/* ... Which allows concurrent read & write operations.	 */
+#endif
+
+#ifdef __USE_GNU
+/* Types of directory notifications that may be requested with F_NOTIFY.  */
+# define DN_ACCESS	0x00000001	/* File accessed.  */
+# define DN_MODIFY	0x00000002	/* File modified.  */
+# define DN_CREATE	0x00000004	/* File created.  */
+# define DN_DELETE	0x00000008	/* File removed.  */
+# define DN_RENAME	0x00000010	/* File renamed.  */
+# define DN_ATTRIB	0x00000020	/* File changed attibutes.  */
+# define DN_MULTISHOT	0x80000000	/* Don't remove notifier.  */
+#endif
+
+/* We don't need to support __USE_FILE_OFFSET64.  */
+struct flock
+  {
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+    __off_t l_start;	/* Offset where the lock begins.  */
+    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
+    __pid_t l_pid;	/* Process holding the lock.  */
+  };
+
+#ifdef __USE_LARGEFILE64
+struct flock64
+  {
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+    __pid_t l_pid;	/* Process holding the lock.  */
+  };
+#endif
+
+/* Define some more compatibility macros to be backward compatible with
+   BSD systems which did not managed to hide these kernel macros.  */
+#ifdef	__USE_BSD
+# define FAPPEND	O_APPEND
+# define FFSYNC		O_FSYNC
+# define FASYNC		O_ASYNC
+# define FNONBLOCK	O_NONBLOCK
+# define FNDELAY	O_NDELAY
+#endif /* Use BSD.  */
+
+/* Advise to `posix_fadvise'.  */
+#ifdef __USE_XOPEN2K
+# define POSIX_FADV_NORMAL	0 /* No further special treatment.  */
+# define POSIX_FADV_RANDOM	1 /* Expect random page references.  */
+# define POSIX_FADV_SEQUENTIAL	2 /* Expect sequential page references.	 */
+# define POSIX_FADV_WILLNEED	3 /* Will need these pages.  */
+# define POSIX_FADV_DONTNEED	4 /* Don't need these pages.  */
+# define POSIX_FADV_NOREUSE	5 /* Data will be accessed once.  */
+#endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/mman.h b/sysdeps/unix/sysv/linux/x86_64/bits/mman.h
new file mode 100644
index 0000000000..34b985fa9f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/mman.h
@@ -0,0 +1,94 @@
+/* Definitions for POSIX memory map interface.  Linux/x86_64 version.
+   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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _SYS_MMAN_H
+# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
+#endif
+
+/* The following definitions basically come from the kernel headers.
+   But the kernel header is not namespace clean.  */
+
+
+/* Protections are chosen from these bits, OR'd together.  The
+   implementation does not necessarily support PROT_EXEC or PROT_WRITE
+   without PROT_READ.  The only guarantees are that no writing will be
+   allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
+
+#define PROT_READ	0x1		/* Page can be read.  */
+#define PROT_WRITE	0x2		/* Page can be written.  */
+#define PROT_EXEC	0x4		/* Page can be executed.  */
+#define PROT_NONE	0x0		/* Page can not be accessed.  */
+
+/* Sharing types (must choose one and only one of these).  */
+#define MAP_SHARED	0x01		/* Share changes.  */
+#define MAP_PRIVATE	0x02		/* Changes are private.  */
+#ifdef __USE_MISC
+# define MAP_TYPE	0x0f		/* Mask for type of mapping.  */
+#endif
+
+/* Other flags.  */
+#define MAP_FIXED	0x10		/* Interpret addr exactly.  */
+#ifdef __USE_MISC
+# define MAP_FILE	0
+# define MAP_ANONYMOUS	0x20		/* Don't use a file.  */
+# define MAP_ANON	MAP_ANONYMOUS
+# define MAP_32BIT	0x40		/* Only give out 32-bit addresses.  */
+#endif
+
+/* These are Linux-specific.  */
+#ifdef __USE_MISC
+# define MAP_GROWSDOWN	0x0100		/* Stack-like segment.  */
+# define MAP_DENYWRITE	0x0800		/* ETXTBSY */
+# define MAP_EXECUTABLE	0x1000		/* Mark it as an executable.  */
+# define MAP_LOCKED	0x2000		/* Lock the mapping.  */
+# define MAP_NORESERVE	0x4000		/* Don't check for reservations.  */
+#endif
+
+/* Flags to `msync'.  */
+#define MS_ASYNC	1		/* Sync memory asynchronously.  */
+#define MS_SYNC		4		/* Synchronous memory sync.  */
+#define MS_INVALIDATE	2		/* Invalidate the caches.  */
+
+/* Flags for `mlockall'.  */
+#define MCL_CURRENT	1		/* Lock all currently mapped pages.  */
+#define MCL_FUTURE	2		/* Lock all additions to address
+					   space.  */
+
+/* Flags for `mremap'.  */
+#ifdef __USE_GNU
+# define MREMAP_MAYMOVE	1
+#endif
+
+/* Advice to `madvise'.  */
+#ifdef __USE_BSD
+# define MADV_NORMAL	 0	/* No further special treatment.  */
+# define MADV_RANDOM	 1	/* Expect random page references.  */
+# define MADV_SEQUENTIAL 2	/* Expect sequential page references.  */
+# define MADV_WILLNEED	 3	/* Will need these pages.  */
+# define MADV_DONTNEED	 4	/* Don't need these pages.  */
+#endif
+
+/* The POSIX people had to invent similar names for the same things.  */
+#ifdef __USE_XOPEN2K
+# define POSIX_MADV_NORMAL	0 /* No further special treatment.  */
+# define POSIX_MADV_RANDOM	1 /* Expect random page references.  */
+# define POSIX_MADV_SEQUENTIAL	2 /* Expect sequential page references.  */
+# define POSIX_MADV_WILLNEED	3 /* Will need these pages.  */
+# define POSIX_MADV_DONTNEED	4 /* Don't need these pages.  */
+#endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/stat.h b/sysdeps/unix/sysv/linux/x86_64/bits/stat.h
new file mode 100644
index 0000000000..818a58b585
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/stat.h
@@ -0,0 +1,108 @@
+/* Copyright (C) 1999, 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _SYS_STAT_H
+# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
+#endif
+
+/* Versions of the `struct stat' data structure.  */
+#define _STAT_VER_KERNEL	0
+#define _STAT_VER_LINUX		1
+#define _STAT_VER		_STAT_VER_LINUX
+
+/* Versions of the `xmknod' interface.  */
+#define _MKNOD_VER_LINUX	0
+
+struct stat
+  {
+    __dev_t st_dev;		/* Device.  */
+    __ino_t st_ino;		/* File serial number.	*/
+    __nlink_t st_nlink;		/* Link count.  */
+    __mode_t st_mode;		/* File mode.  */
+    __uid_t st_uid;		/* User ID of the file's owner.	*/
+    __gid_t st_gid;		/* Group ID of the file's group.*/
+    int pad0;
+    __dev_t st_rdev;		/* Device number, if device.  */
+    __off_t st_size;		/* Size of file, in bytes.  */
+    __blksize_t st_blksize;	/* Optimal block size for I/O.  */
+    __blkcnt_t st_blocks;	/* Nr. 512-byte blocks allocated.  */
+    __time_t st_atime;		/* Time of last access.  */
+    long int __reserved0;	/* Reserved for atime.nanoseconds.  */
+    __time_t st_mtime;		/* Time of last modification.  */
+    long int __reserved1;	/* Reserved for mtime.nanoseconds.  */
+    __time_t st_ctime;		/* Time of last status change.  */
+    long int __reserved2;	/* Reserved for ctime.nanoseconds.  */
+    long int __unused[3];
+  };
+
+#ifdef __USE_LARGEFILE64
+/* Note stat64 has the same shape as stat.  */
+struct stat64
+  {
+    __dev_t st_dev;		/* Device.  */
+    __ino64_t st_ino;		/* File serial number.  */
+    __nlink_t st_nlink;		/* Link count.  */
+    __mode_t st_mode;		/* File mode.  */
+    __uid_t st_uid;		/* User ID of the file's owner.	*/
+    __gid_t st_gid;		/* Group ID of the file's group.*/
+    int pad0;
+    __dev_t st_rdev;		/* Device number, if device.  */
+    __off_t st_size;		/* Size of file, in bytes.  */
+    __blksize_t st_blksize;	/* Optimal block size for I/O.  */
+    __blkcnt64_t st_blocks;	/* Nr. 512-byte blocks allocated.  */
+    __time_t st_atime;		/* Time of last access.  */
+    long int __reserved0;	/* Reserved for atime.nanoseconds.  */
+    __time_t st_mtime;		/* Time of last modification.  */
+    long int __reserved1;	/* Reserved for mtime.nanoseconds.  */
+    __time_t st_ctime;		/* Time of last status change.  */
+    long int __reserved2;	/* Reserved for ctime.nanoseconds.  */
+    long int __unused[3];
+  };
+#endif
+
+/* Tell code we have these members.  */
+#define	_STATBUF_ST_BLKSIZE
+#define _STATBUF_ST_RDEV
+
+/* Encoding of the file mode.  */
+
+#define	__S_IFMT	0170000	/* These bits determine file type.  */
+
+/* File types.  */
+#define	__S_IFDIR	0040000	/* Directory.  */
+#define	__S_IFCHR	0020000	/* Character device.  */
+#define	__S_IFBLK	0060000	/* Block device.  */
+#define	__S_IFREG	0100000	/* Regular file.  */
+#define	__S_IFIFO	0010000	/* FIFO.  */
+#define	__S_IFLNK	0120000	/* Symbolic link.  */
+#define	__S_IFSOCK	0140000	/* Socket.  */
+
+/* POSIX.1b objects.  Note that these macros always evaluate to zero.  But
+   they do it by enforcing the correct use of the macros.  */
+#define __S_TYPEISMQ(buf)  ((buf)->st_mode - (buf)->st_mode)
+#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
+#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
+
+/* Protection bits.  */
+
+#define	__S_ISUID	04000	/* Set user ID on execution.  */
+#define	__S_ISGID	02000	/* Set group ID on execution.  */
+#define	__S_ISVTX	01000	/* Save swapped text after use (sticky).  */
+#define	__S_IREAD	0400	/* Read by owner.  */
+#define	__S_IWRITE	0200	/* Write by owner.  */
+#define	__S_IEXEC	0100	/* Execute by owner.  */
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/statfs.h b/sysdeps/unix/sysv/linux/x86_64/bits/statfs.h
new file mode 100644
index 0000000000..8fbcec22e2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/statfs.h
@@ -0,0 +1,58 @@
+/* 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _SYS_STATFS_H
+# error "Never include <bits/statfs.h> directly; use <sys/statfs.h> instead."
+#endif
+
+#include <bits/types.h>  /* for __fsid_t and __fsblkcnt_t. */
+
+struct statfs
+  {
+    long int f_type;
+    long int f_bsize;
+    __fsblkcnt_t f_blocks;
+    __fsblkcnt_t f_bfree;
+    __fsblkcnt_t f_bavail;
+    __fsblkcnt_t f_files;
+    __fsblkcnt_t f_ffree;
+    __fsid_t f_fsid;
+    long int f_namelen;
+    long int f_spare[6];
+  };
+
+#ifdef __USE_LARGEFILE64
+/* We already use 64-bit types in the normal structure,
+   so this is the same as the above.  */
+struct statfs64
+  {
+    long int f_type;
+    long int f_bsize;
+    __fsblkcnt64_t f_blocks;
+    __fsblkcnt64_t f_bfree;
+    __fsblkcnt64_t f_bavail;
+    __fsblkcnt64_t f_files;
+    __fsblkcnt64_t f_ffree;
+    __fsid_t f_fsid;
+    long int f_namelen;
+    long int f_spare[6];
+  };
+#endif
+
+/* Tell code we have this member.  */
+#define _STATFS_F_NAMELEN
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/time.h b/sysdeps/unix/sysv/linux/x86_64/bits/time.h
new file mode 100644
index 0000000000..bc3a20af2f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/time.h
@@ -0,0 +1,73 @@
+/* System-dependent timing definitions.  Linux x86-64 version.
+   Copyright (C) 1996, 1997, 1999, 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/*
+ * Never include this file directly; use <time.h> instead.
+ */
+
+#ifndef __need_timeval
+# ifndef _BITS_TIME_H
+#  define _BITS_TIME_H	1
+
+/* ISO/IEC 9899:1990 7.12.1: <time.h>
+   The macro `CLOCKS_PER_SEC' is the number per second of the value
+   returned by the `clock' function. */
+/* CAE XSH, Issue 4, Version 2: <time.h>
+   The value of CLOCKS_PER_SEC is required to be 1 million on all
+   XSI-conformant systems. */
+#  define CLOCKS_PER_SEC  1000000l
+
+#  if !defined __STRICT_ANSI__ && !defined __USE_XOPEN2K
+/* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK
+   presents the real value for clock ticks per second for the system.  */
+#   include <bits/types.h>
+extern long int __sysconf (int);
+#   define CLK_TCK ((__clock_t) __sysconf (2))	/* 2 is _SC_CLK_TCK */
+#  endif
+
+#  ifdef __USE_POSIX199309
+/* Identifier for system-wide realtime clock.  */
+#   define CLOCK_REALTIME	0
+/* High-resolution timer from the CPU.  */
+#   define CLOCK_PROCESS_CPUTIME_ID	2
+/* Thread-specific CPU-time clock.  */
+#   define CLOCK_THREAD_CPUTIME_ID	3
+
+/* Flag to indicate time is absolute.  */
+#   define TIMER_ABSTIME	1
+#  endif
+
+# endif	/* bits/time.h */
+#endif
+
+#ifdef __need_timeval
+# undef __need_timeval
+# ifndef _STRUCT_TIMEVAL
+#  define _STRUCT_TIMEVAL	1
+#  include <bits/types.h>
+
+/* A time value that is accurate to the nearest
+   microsecond but also has a range of years.  */
+struct timeval
+  {
+    __time_t tv_sec;		/* Seconds.  */
+    __suseconds_t tv_usec;	/* Microseconds.  */
+  };
+# endif	/* struct timeval */
+#endif	/* need timeval */
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/types.h b/sysdeps/unix/sysv/linux/x86_64/bits/types.h
new file mode 100644
index 0000000000..36eec20111
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/types.h
@@ -0,0 +1,119 @@
+/* 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/*
+ * Never include this file directly; use <sys/types.h> instead.
+ */
+
+#ifndef	_BITS_TYPES_H
+#define	_BITS_TYPES_H	1
+
+#include <features.h>
+
+#define __need_size_t
+#include <stddef.h>
+
+/* Convenience types.  */
+typedef unsigned char __u_char;
+typedef unsigned short int __u_short;
+typedef unsigned int __u_int;
+typedef unsigned long int __u_long;
+typedef unsigned long int __u_quad_t;
+typedef long int __quad_t;
+typedef signed char __int8_t;
+typedef unsigned char __uint8_t;
+typedef signed short int __int16_t;
+typedef unsigned short int __uint16_t;
+typedef signed int __int32_t;
+typedef unsigned int __uint32_t;
+typedef signed long int __int64_t;
+typedef unsigned long int __uint64_t;
+typedef __quad_t *__qaddr_t;
+
+typedef __uint64_t __dev_t;		/* Type of device numbers.  */
+typedef __uint32_t __uid_t;		/* Type of user identifications.  */
+typedef __uint32_t __gid_t;		/* Type of group identifications.  */
+typedef __uint64_t __ino_t;		/* Type of file serial numbers.  */
+typedef __uint64_t __ino64_t;		/*  "" (LFS) */
+typedef __uint32_t __mode_t;		/* Type of file attribute bitmasks.  */
+typedef __uint64_t __nlink_t;		/* Type of file link counts.  */
+typedef __int64_t  __off_t;		/* Type of file sizes and offsets.  */
+typedef __int64_t  __off64_t;		/*  "" (LFS) */
+typedef __int64_t  __loff_t;		/* Type of file sizes and offsets.  */
+typedef __int32_t  __pid_t;		/* Type of process identifications.  */
+typedef __int64_t  __ssize_t;		/* Type of a byte count, or error.  */
+typedef __uint64_t  __rlim_t;		/* Type of resource counts.  */
+typedef __uint64_t  __rlim64_t;		/*  "" (LFS) */
+typedef __int64_t  __blkcnt_t;		/* Type to count nr disk blocks.  */
+typedef __int64_t  __blkcnt64_t;	/*  "" (LFS) */
+typedef __uint64_t __fsblkcnt_t;	/* Type to count file system blocks.  */
+typedef __uint64_t __fsblkcnt64_t;	/*  "" (LFS) */
+typedef __uint64_t __fsfilcnt_t;	/* Type to count file system inodes.  */
+typedef __uint64_t __fsfilcnt64_t;	/*  "" (LFS) */
+typedef __uint32_t __id_t;		/* General type for IDs.  */
+
+typedef struct
+  {
+    int __val[2];
+  } __fsid_t;				/* Type of file system IDs.  */
+
+/* Everythin' else.  */
+typedef int __daddr_t;			/* Type of a disk address.  */
+typedef char *__caddr_t;		/* Type of a core address.  */
+typedef long int __time_t;
+typedef unsigned int __useconds_t;
+typedef long int __suseconds_t;
+typedef long int __swblk_t;		/* Type of a swap block maybe?  */
+typedef long int __clock_t;
+typedef int __key_t;			/* Type of a SYSV IPC key. */
+
+/* Clock ID used in clock and timer functions.  */
+typedef int __clockid_t;
+
+/* Timer ID returned by `timer_create'.  */
+typedef int __timer_t;
+
+/* Used in `struct shmid_ds'.  */
+typedef int __ipc_pid_t;
+
+/* type to represent block size. */
+typedef long int __blksize_t;
+
+/* Due to incaution, we may have gotten these from a kernel header file.  */
+#undef __FD_SETSIZE
+#undef __FDMASK
+
+/* Number of descriptors that can fit in an `fd_set'.  */
+#define __FD_SETSIZE	1024
+
+/* Used in XTI.  */
+typedef int __t_scalar_t;
+typedef unsigned int __t_uscalar_t;
+
+/* Duplicates info from stdint.h but this is used in unistd.h.  */
+typedef long int __intptr_t;
+
+/* Duplicate info from sys/socket.h.  */
+typedef unsigned int __socklen_t;
+
+/* Now add the thread types.  */
+#if defined __USE_POSIX199506 || defined __USE_UNIX98
+# include <bits/pthreadtypes.h>
+#endif
+
+#endif /* bits/types.h */
diff --git a/sysdeps/unix/sysv/linux/x86_64/brk.c b/sysdeps/unix/sysv/linux/x86_64/brk.c
new file mode 100644
index 0000000000..09b7dd4707
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/brk.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/hppa/brk.c>
diff --git a/sysdeps/unix/sysv/linux/x86_64/clone.S b/sysdeps/unix/sysv/linux/x86_64/clone.S
new file mode 100644
index 0000000000..a2c2c9a3f0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/clone.S
@@ -0,0 +1,86 @@
+/* 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* clone() is even more special than fork() as it mucks with stacks
+   and invokes a function in the right context after its all over.  */
+
+#include <sysdep.h>
+#define _ERRNO_H	1
+#include <bits/errno.h>
+#include <asm-syntax.h>
+#include <bp-sym.h>
+#include <bp-asm.h>
+
+/* The userland implementation is:
+   int clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg),
+   the kernel entry is:
+   int clone (long flags, void *child_stack).
+
+   The parameters are passed in register from userland:
+   rdi: fn
+   rsi: child_stack
+   rdx:	flags
+   rcx: arg
+
+   The kernel expects:
+   rax: system call number
+   rdi: flags
+   rsi: child_stack  */
+
+
+        .text
+ENTRY (BP_SYM (__clone))
+	/* Sanity check arguments.  */
+	movq	$-EINVAL,%rax
+	testq	%rdi,%rdi		/* no NULL function pointers */
+	jz	SYSCALL_ERROR_LABEL
+	testq	%rsi,%rsi		/* no NULL stack pointers */
+	jz	SYSCALL_ERROR_LABEL
+
+	/* Insert the argument onto the new stack.  */
+	subq	$16,%rsi
+	movq	%rcx,8(%rsi)
+
+	/* Save the function pointer.  It will be popped off in the
+	child in the ebx frobbing below.  */
+	movq	%rdi,0(%rsi)
+
+	/* Do the system call.  */
+	movq	%rdx, %rdi
+	movq	$SYS_ify(clone),%rax
+	syscall
+
+	testq	%rax,%rax
+	jl	SYSCALL_ERROR_LABEL
+	jz	thread_start
+
+L(pseudo_end):
+	ret
+
+thread_start:
+	/* Set up arguments for the function call.  */
+	popq	%rax		/* Function to call.  */
+	popq	%rdi		/* Argument.  */
+	call	*%rax
+	/* Call exit with return value from function call. */
+	movq	%rax, %rdi
+	call	JUMPTARGET (_exit)
+
+PSEUDO_END (BP_SYM (__clone))
+
+weak_alias (BP_SYM (__clone), BP_SYM (clone))
diff --git a/sysdeps/unix/sysv/linux/x86_64/fstatfs64.c b/sysdeps/unix/sysv/linux/x86_64/fstatfs64.c
new file mode 100644
index 0000000000..2be4e59ba4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/fstatfs64.c
@@ -0,0 +1 @@
+/* fstatfs64 is the same as fstatfs. */
diff --git a/sysdeps/unix/sysv/linux/x86_64/ftruncate64.c b/sysdeps/unix/sysv/linux/x86_64/ftruncate64.c
new file mode 100644
index 0000000000..673a8b525a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/ftruncate64.c
@@ -0,0 +1 @@
+/* ftruncate64 is the same as ftruncate. */
diff --git a/sysdeps/unix/sysv/linux/x86_64/fxstat.c b/sysdeps/unix/sysv/linux/x86_64/fxstat.c
new file mode 100644
index 0000000000..c25fd7b25e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/fxstat.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/ia64/fxstat.c>
diff --git a/sysdeps/unix/sysv/linux/x86_64/fxstat64.c b/sysdeps/unix/sysv/linux/x86_64/fxstat64.c
new file mode 100644
index 0000000000..9eff9ebeb7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/fxstat64.c
@@ -0,0 +1 @@
+/* fxstat64 is in fxstat.c */
diff --git a/sysdeps/unix/sysv/linux/x86_64/getdents.c b/sysdeps/unix/sysv/linux/x86_64/getdents.c
new file mode 100644
index 0000000000..b4c44cdf10
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/getdents.c
@@ -0,0 +1,2 @@
+#include <sysdeps/unix/sysv/linux/ia64/getdents.c>
+
diff --git a/sysdeps/unix/sysv/linux/x86_64/getdents64.c b/sysdeps/unix/sysv/linux/x86_64/getdents64.c
new file mode 100644
index 0000000000..0df2c8f4c6
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/getdents64.c
@@ -0,0 +1 @@
+/* getdents64 is in getdents.c */
diff --git a/sysdeps/unix/sysv/linux/x86_64/getrlimit64.c b/sysdeps/unix/sysv/linux/x86_64/getrlimit64.c
new file mode 100644
index 0000000000..9feab0e6b8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/getrlimit64.c
@@ -0,0 +1 @@
+/* getrlimit64 is the same as getrlimit. */
diff --git a/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c b/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c
new file mode 100644
index 0000000000..c4fcfd900c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c
@@ -0,0 +1,38 @@
+/* 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <asm/vsyscall.h>
+#include <time.h>
+#include <sys/time.h>
+
+
+/* Get the current time of day and timezone information,
+   putting it into *TV and *TZ.  If TZ is NULL, *TZ is not filled.
+   Returns 0 on success, -1 on errors.  */
+int
+__gettimeofday (struct timeval *tv, struct timezone *tz)
+{
+  /* We're using a virtual syscall here.  */
+  int (*__vgettimeofday)(struct timeval *, struct timezone *)
+    = (int (*)(struct timeval *, struct timezone *)) VSYSCALL_ADDR (__NR_vgettimeofday);
+
+
+  return __vgettimeofday (tv, tz);
+}
+
+weak_alias (__gettimeofday, gettimeofday)
diff --git a/sysdeps/unix/sysv/linux/x86_64/glob64.c b/sysdeps/unix/sysv/linux/x86_64/glob64.c
new file mode 100644
index 0000000000..33918ea6a5
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/glob64.c
@@ -0,0 +1 @@
+/* glob64 is in glob.c */
diff --git a/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed
new file mode 100644
index 0000000000..7dc2698fa8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed
@@ -0,0 +1,3 @@
+/LD_TRACE_LOADED_OBJECTS=1/a\
+add_env="$add_env LD_LIBRARY_VERSION=\\$verify_out"
+s_^\(RTLDLIST=\)\(.*lib\)\(\|64\)\(/[^/]*\.so\.[0-9.]*\)[ 	]*$_\1"\2\4 \264\4"_
diff --git a/sysdeps/unix/sysv/linux/x86_64/lxstat.c b/sysdeps/unix/sysv/linux/x86_64/lxstat.c
new file mode 100644
index 0000000000..648c60a1c0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/lxstat.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/ia64/lxstat.c>
diff --git a/sysdeps/unix/sysv/linux/x86_64/lxstat64.c b/sysdeps/unix/sysv/linux/x86_64/lxstat64.c
new file mode 100644
index 0000000000..bb5dbd0fff
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/lxstat64.c
@@ -0,0 +1 @@
+/* lxstat64 is in lxstat.c */
diff --git a/sysdeps/unix/sysv/linux/x86_64/mmap64.c b/sysdeps/unix/sysv/linux/x86_64/mmap64.c
new file mode 100644
index 0000000000..0dbd384a6a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/mmap64.c
@@ -0,0 +1 @@
+/* mmap64 is the same as mmap. */
diff --git a/sysdeps/unix/sysv/linux/x86_64/pread64.c b/sysdeps/unix/sysv/linux/x86_64/pread64.c
new file mode 100644
index 0000000000..b7f298dea8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/pread64.c
@@ -0,0 +1 @@
+/* Empty since the pread syscall is equivalent.  */
diff --git a/sysdeps/unix/sysv/linux/x86_64/profil-counter.h b/sysdeps/unix/sysv/linux/x86_64/profil-counter.h
new file mode 100644
index 0000000000..41b99e0a88
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/profil-counter.h
@@ -0,0 +1,27 @@
+/* Low-level statistical profiling support function.  Linux/x86-64 version.
+   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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <signal.h>
+#include <sigcontextinfo.h>
+
+static void
+profil_counter (int signo, SIGCONTEXT scp)
+{
+  profil_count ((void *) GET_PC (scp));
+}
diff --git a/sysdeps/unix/sysv/linux/x86_64/pwrite64.c b/sysdeps/unix/sysv/linux/x86_64/pwrite64.c
new file mode 100644
index 0000000000..b7f298dea8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/pwrite64.c
@@ -0,0 +1 @@
+/* Empty since the pread syscall is equivalent.  */
diff --git a/sysdeps/unix/sysv/linux/x86_64/readdir.c b/sysdeps/unix/sysv/linux/x86_64/readdir.c
new file mode 100644
index 0000000000..c0bc09b7f6
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/readdir.c
@@ -0,0 +1,2 @@
+#include <sysdeps/unix/sysv/linux/ia64/readdir.c>
+
diff --git a/sysdeps/unix/sysv/linux/x86_64/readdir64.c b/sysdeps/unix/sysv/linux/x86_64/readdir64.c
new file mode 100644
index 0000000000..9796431dc4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/readdir64.c
@@ -0,0 +1 @@
+/* readdir64 is in readdir.c */
diff --git a/sysdeps/unix/sysv/linux/x86_64/readdir64_r.c b/sysdeps/unix/sysv/linux/x86_64/readdir64_r.c
new file mode 100644
index 0000000000..b8fe9a31b4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/readdir64_r.c
@@ -0,0 +1 @@
+/* readdir64_r is in readdir_r.c */
diff --git a/sysdeps/unix/sysv/linux/x86_64/readdir_r.c b/sysdeps/unix/sysv/linux/x86_64/readdir_r.c
new file mode 100644
index 0000000000..3b953e5528
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/readdir_r.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/ia64/readdir_r.c>
diff --git a/sysdeps/unix/sysv/linux/x86_64/recv.c b/sysdeps/unix/sysv/linux/x86_64/recv.c
new file mode 100644
index 0000000000..9ffeb5e7ed
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/recv.c
@@ -0,0 +1,34 @@
+/* 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/socket.h>
+#include <sysdep.h>
+
+/* Read N bytes into BUF from socket FD.
+   Returns the number read or -1 for errors.  */
+
+ssize_t
+__libc_recv (int fd, void *buf, size_t n, int flags)
+{
+
+  return INLINE_SYSCALL (recvfrom, 6, fd, buf, n, flags, NULL, NULL);
+}
+
+weak_alias (__libc_recv, __recv)
+weak_alias (__recv, recv)
diff --git a/sysdeps/unix/sysv/linux/x86_64/register-dump.h b/sysdeps/unix/sysv/linux/x86_64/register-dump.h
new file mode 100644
index 0000000000..610e05077b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/register-dump.h
@@ -0,0 +1,344 @@
+/* Dump registers.
+   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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; 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>
+
+/* We will print the register dump in this format:
+
+ RAX: XXXXXXXXXXXXXXXX   RBX: XXXXXXXXXXXXXXXX  RCX: XXXXXXXXXXXXXXXX
+ RDX: XXXXXXXXXXXXXXXX   RSI: XXXXXXXXXXXXXXXX  RDI: XXXXXXXXXXXXXXXX
+ RBP: XXXXXXXXXXXXXXXX   R8 : XXXXXXXXXXXXXXXX  R9 : XXXXXXXXXXXXXXXX
+ R10: XXXXXXXXXXXXXXXX   R11: XXXXXXXXXXXXXXXX  R12: XXXXXXXXXXXXXXXX
+ R13: XXXXXXXXXXXXXXXX   R14: XXXXXXXXXXXXXXXX  R15: XXXXXXXXXXXXXXXX
+ RSP: XXXXXXXXXXXXXXXX
+
+ RIP: XXXXXXXXXXXXXXXX   EFLAGS: XXXXXXXX
+
+ CS:  XXXX   DS: XXXX   ES: XXXX   FS: XXXX   GS: XXXX
+
+ Trap:  XXXXXXXX   Error: XXXXXXXX   OldMask: XXXXXXXX
+ RSP/SIGNAL: XXXXXXXXXXXXXXXX  CR2: XXXXXXXX
+
+ FPUCW: XXXXXXXX   FPUSW: XXXXXXXX   TAG: XXXXXXXX
+ IPOFF: XXXXXXXX   CSSEL: XXXX   DATAOFF: XXXXXXXX   DATASEL: XXXX
+
+ ST(0) XXXX XXXXXXXXXXXXXXXX   ST(1) XXXX XXXXXXXXXXXXXXXX
+ ST(2) XXXX XXXXXXXXXXXXXXXX   ST(3) XXXX XXXXXXXXXXXXXXXX
+ ST(4) XXXX XXXXXXXXXXXXXXXX   ST(5) XXXX XXXXXXXXXXXXXXXX
+ ST(6) XXXX XXXXXXXXXXXXXXXX   ST(7) XXXX XXXXXXXXXXXXXXXX
+
+ mxcsr: XXXX
+ XMM0 : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XMM1 : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+ XMM2 : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XMM3 : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+ XMM4 : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XMM5 : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+ XMM6 : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XMM7 : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+ XMM8 : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XMM9 : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+ XMM10: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XMM11: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+ XMM12: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XMM13: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+ XMM14: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XMM15: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+
+ */
+
+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[29][16];
+  char fpregs[32][8];
+  char xmmregs[16][32];
+  struct iovec iov[147];
+  size_t nr = 0;
+  int i;
+
+#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
+
+  /* Generate strings of register contents.  */
+  hexvalue (ctx->rax, regs[0], 16);
+  hexvalue (ctx->rbx, regs[1], 16);
+  hexvalue (ctx->rcx, regs[2], 16);
+  hexvalue (ctx->rdx, regs[3], 16);
+  hexvalue (ctx->rsi, regs[4], 16);
+  hexvalue (ctx->rdi, regs[5], 16);
+  hexvalue (ctx->rbp, regs[6], 16);
+  hexvalue (ctx->r8, regs[7], 16);
+  hexvalue (ctx->r9, regs[8], 16);
+  hexvalue (ctx->r10, regs[9], 16);
+  hexvalue (ctx->r11, regs[10], 16);
+  hexvalue (ctx->r12, regs[11], 16);
+  hexvalue (ctx->r13, regs[12], 16);
+  hexvalue (ctx->r14, regs[13], 16);
+  hexvalue (ctx->r15, regs[14], 16);
+  hexvalue (ctx->rsp, regs[15], 16);
+  hexvalue (ctx->rip, regs[16], 16);
+
+  hexvalue (ctx->eflags, regs[17], 8);
+  hexvalue (ctx->cs, regs[18], 4);
+  hexvalue (ctx->ds, regs[19], 4);
+  hexvalue (ctx->es, regs[20], 4);
+  hexvalue (ctx->fs, regs[21], 4);
+  hexvalue (ctx->gs, regs[22], 4);
+  /* hexvalue (ctx->ss, regs[23], 4); */
+  hexvalue (ctx->trapno, regs[24], 8);
+  hexvalue (ctx->err, regs[25], 8);
+  hexvalue (ctx->oldmask, regs[26], 8);
+  hexvalue (ctx->rsp_at_signal, regs[27], 16);
+  hexvalue (ctx->cr2, regs[28], 8);
+
+  /* Generate the output.  */
+  ADD_STRING ("Register dump:\n\n RAX: ");
+  ADD_MEM (regs[0], 16);
+  ADD_STRING ("   RBX: ");
+  ADD_MEM (regs[1], 16);
+  ADD_STRING ("   RCX: ");
+  ADD_MEM (regs[2], 16);
+  ADD_STRING ("\n RDX: ");
+  ADD_MEM (regs[3], 16);
+  ADD_STRING ("   RSI: ");
+  ADD_MEM (regs[4], 16);
+  ADD_STRING ("   RDI: ");
+  ADD_MEM (regs[5], 16);
+  ADD_STRING ("\n RBP: ");
+  ADD_MEM (regs[6], 16);
+  ADD_STRING ("   R8 : ");
+  ADD_MEM (regs[7], 16);
+  ADD_STRING ("   R9 : ");
+  ADD_MEM (regs[8], 16);
+  ADD_STRING ("\n R10: ");
+  ADD_MEM (regs[9], 16);
+  ADD_STRING ("   R11: ");
+  ADD_MEM (regs[10], 16);
+  ADD_STRING ("   R12: ");
+  ADD_MEM (regs[11], 16);
+  ADD_STRING ("\n R13: ");
+  ADD_MEM (regs[12], 16);
+  ADD_STRING ("   R14: ");
+  ADD_MEM (regs[13], 16);
+  ADD_STRING ("   R15: ");
+  ADD_MEM (regs[14], 16);
+  ADD_STRING ("\n RSP: ");
+  ADD_MEM (regs[15], 16);
+  ADD_STRING ("\n\n RIP: ");
+  ADD_MEM (regs[16], 16);
+  ADD_STRING ("   EFLAGS: ");
+  ADD_MEM (regs[17], 8);
+  ADD_STRING ("\n\n CS: ");
+  ADD_MEM (regs[18], 4);
+  ADD_STRING ("   DS: ");
+  ADD_MEM (regs[19], 4);
+  ADD_STRING ("   ES: ");
+  ADD_MEM (regs[20], 4);
+  ADD_STRING ("   FS: ");
+  ADD_MEM (regs[21], 4);
+  ADD_STRING ("   GS: ");
+  ADD_MEM (regs[22], 4);
+  /*
+  ADD_STRING ("   SS: ");
+  ADD_MEM (regs[23], 4);
+  */
+  ADD_STRING ("\n\n Trap: ");
+  ADD_MEM (regs[24], 8);
+  ADD_STRING ("   Error: ");
+  ADD_MEM (regs[25], 8);
+  ADD_STRING ("   OldMask: ");
+  ADD_MEM (regs[26], 8);
+  ADD_STRING ("\n RSP/signal: ");
+  ADD_MEM (regs[27], 8);
+  ADD_STRING ("   CR2: ");
+  ADD_MEM (regs[28], 8);
+
+  if (ctx->fpstate != NULL)
+    {
+
+      /* Generate output for the FPU control/status registers.  */
+      hexvalue (ctx->fpstate->cw, fpregs[0], 8);
+      hexvalue (ctx->fpstate->sw, fpregs[1], 8);
+      hexvalue (ctx->fpstate->tag, fpregs[2], 8);
+      hexvalue (ctx->fpstate->ipoff, fpregs[3], 8);
+      hexvalue (ctx->fpstate->cssel, fpregs[4], 4);
+      hexvalue (ctx->fpstate->dataoff, fpregs[5], 8);
+      hexvalue (ctx->fpstate->datasel, fpregs[6], 4);
+
+      ADD_STRING ("\n\n FPUCW: ");
+      ADD_MEM (fpregs[0], 8);
+      ADD_STRING ("   FPUSW: ");
+      ADD_MEM (fpregs[1], 8);
+      ADD_STRING ("   TAG: ");
+      ADD_MEM (fpregs[2], 8);
+      ADD_STRING ("\n IPOFF: ");
+      ADD_MEM (fpregs[3], 8);
+      ADD_STRING ("   CSSEL: ");
+      ADD_MEM (fpregs[4], 4);
+      ADD_STRING ("   DATAOFF: ");
+      ADD_MEM (fpregs[5], 8);
+      ADD_STRING ("   DATASEL: ");
+      ADD_MEM (fpregs[6], 4);
+
+      /* Now the real FPU registers.  */
+      hexvalue (ctx->fpstate->_st[0].exponent, fpregs[7], 8);
+      hexvalue (ctx->fpstate->_st[0].significand[3] << 16
+		| ctx->fpstate->_st[0].significand[2], fpregs[8], 8);
+      hexvalue (ctx->fpstate->_st[0].significand[1] << 16
+		| ctx->fpstate->_st[0].significand[0], fpregs[9], 8);
+      hexvalue (ctx->fpstate->_st[1].exponent, fpregs[10], 8);
+      hexvalue (ctx->fpstate->_st[1].significand[3] << 16
+		| ctx->fpstate->_st[1].significand[2], fpregs[11], 8);
+      hexvalue (ctx->fpstate->_st[1].significand[1] << 16
+		| ctx->fpstate->_st[1].significand[0], fpregs[12], 8);
+      hexvalue (ctx->fpstate->_st[2].exponent, fpregs[13], 8);
+      hexvalue (ctx->fpstate->_st[2].significand[3] << 16
+		| ctx->fpstate->_st[2].significand[2], fpregs[14], 8);
+      hexvalue (ctx->fpstate->_st[2].significand[1] << 16
+		| ctx->fpstate->_st[2].significand[0], fpregs[15], 8);
+      hexvalue (ctx->fpstate->_st[3].exponent, fpregs[16], 8);
+      hexvalue (ctx->fpstate->_st[3].significand[3] << 16
+		| ctx->fpstate->_st[3].significand[2], fpregs[17], 8);
+      hexvalue (ctx->fpstate->_st[3].significand[1] << 16
+		| ctx->fpstate->_st[3].significand[0], fpregs[18], 8);
+      hexvalue (ctx->fpstate->_st[4].exponent, fpregs[19], 8);
+      hexvalue (ctx->fpstate->_st[4].significand[3] << 16
+		| ctx->fpstate->_st[4].significand[2], fpregs[20], 8);
+      hexvalue (ctx->fpstate->_st[4].significand[1] << 16
+		| ctx->fpstate->_st[4].significand[0], fpregs[21], 8);
+      hexvalue (ctx->fpstate->_st[5].exponent, fpregs[22], 8);
+      hexvalue (ctx->fpstate->_st[5].significand[3] << 16
+		| ctx->fpstate->_st[5].significand[2], fpregs[23], 8);
+      hexvalue (ctx->fpstate->_st[5].significand[1] << 16
+		| ctx->fpstate->_st[5].significand[0], fpregs[24], 8);
+      hexvalue (ctx->fpstate->_st[6].exponent, fpregs[25], 8);
+      hexvalue (ctx->fpstate->_st[6].significand[3] << 16
+		| ctx->fpstate->_st[6].significand[2], fpregs[26], 8);
+      hexvalue (ctx->fpstate->_st[6].significand[1] << 16
+		| ctx->fpstate->_st[6].significand[0], fpregs[27], 8);
+      hexvalue (ctx->fpstate->_st[7].exponent, fpregs[28], 8);
+      hexvalue (ctx->fpstate->_st[7].significand[3] << 16
+		| ctx->fpstate->_st[7].significand[2], fpregs[29], 8);
+      hexvalue (ctx->fpstate->_st[7].significand[1] << 16
+		| ctx->fpstate->_st[7].significand[0], fpregs[30], 8);
+
+      hexvalue (ctx->fpstate->mxcsr, fpregs[31], 4);
+
+      for (i = 0; i < 16; i++)
+	hexvalue (ctx->fpstate->_xmm[i].element[3] << 24
+		  | ctx->fpstate->_xmm[i].element[2] << 16
+		  | ctx->fpstate->_xmm[i].element[1] << 8
+		  | ctx->fpstate->_xmm[i].element[0], xmmregs[i], 32);
+
+
+      ADD_STRING ("\n\n ST(0) ");
+      ADD_MEM (fpregs[7], 4);
+      ADD_STRING (" ");
+      ADD_MEM (fpregs[8], 8);
+      ADD_MEM (fpregs[9], 8);
+      ADD_STRING ("   ST(1) ");
+      ADD_MEM (fpregs[10], 4);
+      ADD_STRING (" ");
+      ADD_MEM (fpregs[11], 8);
+      ADD_MEM (fpregs[12], 8);
+      ADD_STRING ("\n ST(2) ");
+      ADD_MEM (fpregs[13], 4);
+      ADD_STRING (" ");
+      ADD_MEM (fpregs[14], 8);
+      ADD_MEM (fpregs[15], 8);
+      ADD_STRING ("   ST(3) ");
+      ADD_MEM (fpregs[16], 4);
+      ADD_STRING (" ");
+      ADD_MEM (fpregs[17], 8);
+      ADD_MEM (fpregs[18], 8);
+      ADD_STRING ("\n ST(4) ");
+      ADD_MEM (fpregs[19], 4);
+      ADD_STRING (" ");
+      ADD_MEM (fpregs[20], 8);
+      ADD_MEM (fpregs[21], 8);
+      ADD_STRING ("   ST(5) ");
+      ADD_MEM (fpregs[22], 4);
+      ADD_STRING (" ");
+      ADD_MEM (fpregs[23], 8);
+      ADD_MEM (fpregs[24], 8);
+      ADD_STRING ("\n ST(6) ");
+      ADD_MEM (fpregs[25], 4);
+      ADD_STRING (" ");
+      ADD_MEM (fpregs[26], 8);
+      ADD_MEM (fpregs[27], 8);
+      ADD_STRING ("   ST(7) ");
+      ADD_MEM (fpregs[28], 4);
+      ADD_STRING (" ");
+      ADD_MEM (fpregs[29], 8);
+      ADD_MEM (fpregs[30], 8);
+
+      ADD_STRING ("\n mxcsr: ");
+      ADD_MEM (fpregs[31], 4);
+
+      ADD_STRING ("\n XMM0: ");
+      ADD_MEM (xmmregs[0], 32);
+      ADD_STRING (" XMM1: ");
+      ADD_MEM (xmmregs[0], 32);
+      ADD_STRING ("\n XMM2: ");
+      ADD_MEM (xmmregs[0], 32);
+      ADD_STRING (" XMM3: ");
+      ADD_MEM (xmmregs[0], 32);
+      ADD_STRING ("\n XMM4: ");
+      ADD_MEM (xmmregs[0], 32);
+      ADD_STRING (" XMM5: ");
+      ADD_MEM (xmmregs[0], 32);
+      ADD_STRING ("\n XMM6: ");
+      ADD_MEM (xmmregs[0], 32);
+      ADD_STRING (" XMM7: ");
+      ADD_MEM (xmmregs[0], 32);
+      ADD_STRING ("\n XMM8: ");
+      ADD_MEM (xmmregs[0], 32);
+      ADD_STRING (" XMM9: ");
+      ADD_MEM (xmmregs[0], 32);
+      ADD_STRING ("\n XMM10: ");
+      ADD_MEM (xmmregs[0], 32);
+      ADD_STRING (" XMM11: ");
+      ADD_MEM (xmmregs[0], 32);
+      ADD_STRING ("\n XMM12: ");
+      ADD_MEM (xmmregs[0], 32);
+      ADD_STRING (" XMM13: ");
+      ADD_MEM (xmmregs[0], 32);
+      ADD_STRING ("\n XMM14: ");
+      ADD_MEM (xmmregs[0], 32);
+      ADD_STRING (" XMM15: ");
+      ADD_MEM (xmmregs[0], 32);
+
+    }
+
+  ADD_STRING ("\n");
+
+  /* Write the stuff out.  */
+  writev (fd, iov, nr);
+}
+
+
+#define REGISTER_DUMP register_dump (fd, &ctx)
diff --git a/sysdeps/unix/sysv/linux/x86_64/send.c b/sysdeps/unix/sysv/linux/x86_64/send.c
new file mode 100644
index 0000000000..f162a00f1c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/send.c
@@ -0,0 +1,31 @@
+/* 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <sys/socket.h>
+#include <sysdep.h>
+
+/* Send N bytes of BUF to socket FD.  Returns the number sent or -1.  */
+ssize_t
+__libc_send (int fd, const void *buf, size_t n, int flags)
+{
+  return INLINE_SYSCALL (sendto, 6, fd, buf, n, flags, NULL, NULL);
+}
+
+weak_alias (__libc_send, __send)
+weak_alias (__send, send)
diff --git a/sysdeps/unix/sysv/linux/x86_64/setrlimit64.c b/sysdeps/unix/sysv/linux/x86_64/setrlimit64.c
new file mode 100644
index 0000000000..8edcff0086
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/setrlimit64.c
@@ -0,0 +1 @@
+/* setrlimit64 is the same as setrlimit. */
diff --git a/sysdeps/unix/sysv/linux/x86_64/sigaction.c b/sysdeps/unix/sysv/linux/x86_64/sigaction.c
new file mode 100644
index 0000000000..5aa8b9f43b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/sigaction.c
@@ -0,0 +1,99 @@
+/* POSIX.1 `sigaction' call for Linux/x86-64.
+   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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; 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>
+#include <string.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+#include <kernel-features.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>
+
+/* We do not globally define the SA_RESTORER flag so do it here.  */
+#define SA_RESTORER 0x04000000
+
+extern int __syscall_rt_sigaction (int, const struct kernel_sigaction *__unbounded,
+				   struct kernel_sigaction *__unbounded, size_t);
+
+static void restore_rt (void) asm ("__restore_rt");
+
+
+/* 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
+__libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
+{
+  int result;
+  struct kernel_sigaction kact, koact;
+
+  if (act)
+    {
+      kact.k_sa_handler = act->sa_handler;
+      memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t));
+      kact.sa_flags = act->sa_flags | SA_RESTORER;
+
+      kact.sa_restorer = &restore_rt;
+    }
+
+  /* XXX The size argument hopefully will have to be changed to the
+     real size of the user-level sigset_t.  */
+  result = INLINE_SYSCALL (rt_sigaction, 4,
+			   sig, act ? __ptrvalue (&kact) : NULL,
+			   oact ? __ptrvalue (&koact) : NULL, _NSIG / 8);
+  if (oact && result >= 0)
+    {
+      oact->sa_handler = koact.k_sa_handler;
+      memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t));
+      oact->sa_flags = koact.sa_flags;
+      oact->sa_restorer = koact.sa_restorer;
+    }
+  return result;
+}
+
+weak_alias (__libc_sigaction, __sigaction)
+weak_alias (__libc_sigaction, sigaction)
+
+/* NOTE: Please think twice before making any changes to the bits of
+   code below.  GDB needs some intimate knowledge about it to
+   recognize them as signal trampolines, and make backtraces through
+   signal handlers work right.  Important are both the names
+   (__restore_rt) and the exact instruction sequence.
+   If you ever feel the need to make any changes, please notify the
+   appropriate GDB maintainer.  */
+
+#define RESTORE(name, syscall) RESTORE2 (name, syscall)
+#define RESTORE2(name, syscall) \
+asm						\
+  (						\
+   ".align 16\n"				\
+   "__" #name ":\n"				\
+   "	movq $" #syscall ", %rax\n"		\
+   "	syscall\n"				\
+   );
+
+/* The return code for realtime-signals.  */
+RESTORE (restore_rt, __NR_rt_sigreturn)
diff --git a/sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h b/sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h
new file mode 100644
index 0000000000..38d6fd6a86
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h
@@ -0,0 +1,26 @@
+/* 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define SIGCONTEXT struct sigcontext
+#define SIGCONTEXT_EXTRA_ARGS
+#define GET_PC(ctx)	((void *) ctx.rip)
+#define GET_FRAME(ctx)	((void *) ctx.rbp)
+#define GET_STACK(ctx)	((void *) ctx.rsp_at_signal)
+
+#define CALL_SIGHANDLER(handler, signo, ctx) \
+  (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
diff --git a/sysdeps/unix/sysv/linux/x86_64/sigpending.c b/sysdeps/unix/sysv/linux/x86_64/sigpending.c
new file mode 100644
index 0000000000..c7ddb1fbd8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/sigpending.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/ia64/sigpending.c>
diff --git a/sysdeps/unix/sysv/linux/x86_64/sigprocmask.c b/sysdeps/unix/sysv/linux/x86_64/sigprocmask.c
new file mode 100644
index 0000000000..bc0927f452
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/sigprocmask.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/ia64/sigprocmask.c>
diff --git a/sysdeps/unix/sysv/linux/x86_64/sigsuspend.c b/sysdeps/unix/sysv/linux/x86_64/sigsuspend.c
new file mode 100644
index 0000000000..9c5c79e63e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/sigsuspend.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/ia64/sigsuspend.c>
diff --git a/sysdeps/unix/sysv/linux/x86_64/statfs64.c b/sysdeps/unix/sysv/linux/x86_64/statfs64.c
new file mode 100644
index 0000000000..06bc68826f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/statfs64.c
@@ -0,0 +1 @@
+/* statfs64 is the same as statfs. */
diff --git a/sysdeps/unix/sysv/linux/x86_64/sys/perm.h b/sysdeps/unix/sysv/linux/x86_64/sys/perm.h
new file mode 100644
index 0000000000..382fa92ee3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/sys/perm.h
@@ -0,0 +1,36 @@
+/* Copyright (C) 1996, 1999, 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _SYS_PERM_H
+
+#define _SYS_PERM_H	1
+#include <features.h>
+
+__BEGIN_DECLS
+
+/* Set port input/output permissions.  */
+extern int ioperm (unsigned long int __from, unsigned long int __num,
+		   int __turn_on) __THROW;
+
+
+/* Change I/O privilege level.  */
+extern int iopl (int __level) __THROW;
+
+__END_DECLS
+
+#endif	/* _SYS_PERM_H */
diff --git a/sysdeps/unix/sysv/linux/x86_64/sys/procfs.h b/sysdeps/unix/sysv/linux/x86_64/sys/procfs.h
new file mode 100644
index 0000000000..d774c63706
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/sys/procfs.h
@@ -0,0 +1,127 @@
+/* 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _SYS_PROCFS_H
+#define _SYS_PROCFS_H	1
+
+/* This is somewhat modelled after the file of the same name on SVR4
+   systems.  It provides a definition of the core file format for ELF
+   used on Linux.  It doesn't have anything to do with the /proc file
+   system, even though Linux has one.
+
+   Anyway, the whole purpose of this file is for GDB and GDB only.
+   Don't read too much into it.  Don't use it for anything other than
+   GDB unless you know what you are doing.  */
+
+#include <features.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/user.h>
+
+__BEGIN_DECLS
+
+/* Type for a general-purpose register.  */
+typedef unsigned long elf_greg_t;
+
+/* And the whole bunch of them.  We could have used `struct
+   user_regs_struct' directly in the typedef, but tradition says that
+   the register set is an array, which does have some peculiar
+   semantics, so leave it that way.  */
+#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+
+/* Register set for the extended floating-point registers.  Includes
+   the Pentium III SSE registers in addition to the classic
+   floating-point stuff.  */
+typedef struct user_fpregs_struct elf_fpregset_t;
+
+/* Signal info.  */
+struct elf_siginfo
+  {
+    int si_signo;			/* Signal number.  */
+    int si_code;			/* Extra code.  */
+    int si_errno;			/* Errno.  */
+  };
+
+
+/* Definitions to generate Intel SVR4-like core files.  These mostly
+   have the same names as the SVR4 types with "elf_" tacked on the
+   front to prevent clashes with Linux definitions, and the typedef
+   forms have been avoided.  This is mostly like the SVR4 structure,
+   but more Linuxy, with things that Linux does not support and which
+   GDB doesn't really use excluded.  */
+
+struct elf_prstatus
+  {
+    struct elf_siginfo pr_info;		/* Info associated with signal.  */
+    short int pr_cursig;		/* Current signal.  */
+    unsigned long int pr_sigpend;	/* Set of pending signals.  */
+    unsigned long int pr_sighold;	/* Set of held signals.  */
+    __pid_t pr_pid;
+    __pid_t pr_ppid;
+    __pid_t pr_pgrp;
+    __pid_t pr_sid;
+    struct timeval pr_utime;		/* User time.  */
+    struct timeval pr_stime;		/* System time.  */
+    struct timeval pr_cutime;		/* Cumulative user time.  */
+    struct timeval pr_cstime;		/* Cumulative system time.  */
+    elf_gregset_t pr_reg;		/* GP registers.  */
+    int pr_fpvalid;			/* True if math copro being used.  */
+  };
+
+
+#define ELF_PRARGSZ     (80)    /* Number of chars for args.  */
+
+struct elf_prpsinfo
+  {
+    char pr_state;			/* Numeric process state.  */
+    char pr_sname;			/* Char for pr_state.  */
+    char pr_zomb;			/* Zombie.  */
+    char pr_nice;			/* Nice val.  */
+    unsigned long int pr_flag;		/* Flags.  */
+    unsigned int pr_uid;
+    unsigned int pr_gid;
+    int pr_pid, pr_ppid, pr_pgrp, pr_sid;
+    /* Lots missing */
+    char pr_fname[16];			/* Filename of executable.  */
+    char pr_psargs[ELF_PRARGSZ];	/* Initial part of arg list.  */
+  };
+
+
+/* The rest of this file provides the types for emulation of the
+   Solaris <proc_service.h> interfaces that should be implemented by
+   users of libthread_db.  */
+
+/* Addresses.  */
+typedef void *psaddr_t;
+
+/* Register sets.  Linux has different names.  */
+typedef elf_gregset_t prgregset_t;
+typedef elf_fpregset_t prfpregset_t;
+
+/* We don't have any differences between processes and threads,
+   therefore have only one PID type.  */
+typedef __pid_t lwpid_t;
+
+/* Process status and info.  In the end we do provide typedefs for them.  */
+typedef struct elf_prstatus prstatus_t;
+typedef struct elf_prpsinfo prpsinfo_t;
+
+__END_DECLS
+
+#endif	/* sys/procfs.h */
diff --git a/sysdeps/unix/sysv/linux/x86_64/sys/reg.h b/sysdeps/unix/sysv/linux/x86_64/sys/reg.h
new file mode 100644
index 0000000000..fec64d6f17
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/sys/reg.h
@@ -0,0 +1,47 @@
+/* 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _SYS_REG_H
+#define _SYS_REG_H	1
+
+/* Index into an array of 8 byte longs returned from ptrace for
+   location of the users' stored general purpose registers.  */
+
+#define R15	0
+#define R14	1
+#define R13	2
+#define R12	3
+#define RBP	4
+#define RBX	5
+#define R11	6
+#define R10	7
+#define R9	8
+#define R8	9
+#define RAX	10
+#define RCX	11
+#define RDX	12
+#define RSI	13
+#define RDI	14
+#define ORIG_RAX 15
+#define RIP	16
+#define CS	17
+#define EFLAGS	18
+#define RSP	19
+#define SS	20
+
+#endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h b/sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h
new file mode 100644
index 0000000000..6b69c84db2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h
@@ -0,0 +1,160 @@
+/* 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _SYS_UCONTEXT_H
+#define _SYS_UCONTEXT_H	1
+
+#include <features.h>
+#include <signal.h>
+
+/* We need the signal context definitions even if they are not used
+   included in <signal.h>.  */
+#include <bits/sigcontext.h>
+
+/* Type for general register.  */
+typedef long int greg_t;
+
+/* Number of general registers.  */
+#define NGREG	27
+
+/* Container for all general registers.  */
+typedef greg_t gregset_t[NGREG];
+
+#ifdef __USE_GNU
+/* Number of each register in the `gregset_t' array.  */
+enum
+{
+  REG_GSFS = 0,
+# define REG_GSFS	REG_GSFS
+  REG_ESDS,
+# define REG_ESDS	REG_ESDS
+  REG_R8,
+# define REG_R8		REG_R8
+  REG_R9,
+# define REG_R9		REG_R9
+  REG_R10,
+# define REG_R10	REG_R10
+  REG_R11,
+# define REG_R11	REG_R11
+  REG_R12,
+# define REG_R12	REG_R12
+  REG_R13,
+# define REG_R13	REG_R13
+  REG_R14,
+# define REG_R14	REG_R14
+  REG_R15,
+# define REG_R15	REG_R15
+  REG_RDI,
+# define REG_RDI	REG_RDI
+  REG_RSI,
+# define REG_RSI	REG_RSI
+  REG_RBP,
+# define REG_RBP	REG_RBP
+  REG_RSP,
+# define REG_RSP	REG_RSP
+  REG_RBX,
+# define REG_RBX	REG_RBX
+  REG_RDX,
+# define REG_RDX	REG_RDX
+  REG_RCX,
+# define REG_RCX	REG_RCX
+  REG_RAX,
+# define REG_RAX	REG_RAX
+  REG_TRAPNO,
+# define REG_TRAPNO	REG_TRAPNO
+  REG_ERR,
+# define REG_ERR	REG_ERR
+  REG_RIP,
+# define REG_RIP	REG_RIP
+  REG_CS,
+# define REG_CS		REG_CS
+  REG_EFL,
+# define REG_EFL	REG_EFL
+  REG_URSP,
+# define REG_URSP	REG_URSP
+  REG_SS
+# define REG_SS	REG_SS
+};
+#endif
+
+/* Definitions taken from the kernel headers.  */
+struct _libc_fpreg
+{
+  unsigned short int significand[4];
+  unsigned short int exponent;
+};
+
+struct _libc_fpxreg
+{
+  unsigned short int significand[4];
+  unsigned short int exponent;
+  unsigned short int padding[3];
+};
+
+struct _libc_xmmreg
+{
+  unsigned long int element[4];
+};
+
+struct _libc_fpstate
+{
+  /* Regular FPU environment.  */
+  unsigned long int cw;
+  unsigned long int sw;
+  unsigned long int tag;
+  unsigned long int ipoff;
+  unsigned long int cssel;
+  unsigned long int dataoff;
+  unsigned long int datasel;
+  struct _libc_fpreg _st[16];
+  unsigned short int status;
+  unsigned short int magic;
+  /* FXSR FPU environment.  */
+  
+  unsigned long	int _fxsr_env[6];
+  unsigned long	int mxcsr;
+  unsigned long	int reserved;
+  struct _libc_fpxreg _fxsr_st[8];
+  struct _libc_xmmreg _xmm[16];
+  unsigned long int padding[32];
+};
+
+/* Structure to describe FPU registers.  */
+typedef struct _libc_fpstate fpregset_t;
+
+/* Context to describe whole processor state.  */
+typedef struct
+  {
+    gregset_t gregs;
+    fpregset_t fpregs;
+    unsigned long int oldmask;
+    unsigned long int cr2;
+  } mcontext_t;
+
+/* Userlevel context.  */
+typedef struct ucontext
+  {
+    unsigned long int uc_flags;
+    struct ucontext *uc_link;
+    stack_t uc_stack;
+    mcontext_t uc_mcontext;
+    __sigset_t uc_sigmask;
+    struct _libc_fpstate __fpregs_mem;
+  } ucontext_t;
+
+#endif /* sys/ucontext.h */
diff --git a/sysdeps/unix/sysv/linux/x86_64/sys/user.h b/sysdeps/unix/sysv/linux/x86_64/sys/user.h
new file mode 100644
index 0000000000..2df7b2e46d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/sys/user.h
@@ -0,0 +1,97 @@
+/* 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _SYS_USER_H
+#define _SYS_USER_H	1
+
+/* The whole purpose of this file is for GDB and GDB only.  Don't read
+   too much into it.  Don't use it for anything other than GDB unless
+   you know what you are doing.  */
+
+struct user_fpregs_struct
+{
+  unsigned short int cwd;
+  unsigned short int swd;
+  unsigned short int twd;
+  unsigned short int fop;
+  unsigned int fip;
+  unsigned int fcs;
+  unsigned int foo;
+  unsigned int fos;
+  unsigned int mxcsr;
+  unsigned int reserved;
+  unsigned int st_space[32];   /* 8*16 bytes for each FP-reg = 128 bytes */
+  unsigned int xmm_space[32];  /* 8*16 bytes for each XMM-reg = 128 bytes */
+  unsigned int padding[56];
+};
+
+struct user_regs_struct
+{
+  unsigned long r15;
+  unsigned long r14;
+  unsigned long r13;
+  unsigned long r12;
+  unsigned long rbp;
+  unsigned long rbx;
+  unsigned long r11;
+  unsigned long r10;
+  unsigned long r9;
+  unsigned long r8;
+  unsigned long rax;
+  unsigned long rcx;
+  unsigned long rdx;
+  unsigned long rsi;
+  unsigned long rdi;
+  unsigned long orig_rax;
+  unsigned long rip;
+  unsigned long cs;
+  unsigned long eflags;
+  unsigned long rsp;
+  unsigned long ss;
+  unsigned long fs_base;
+  unsigned long kernel_gs_base;
+};
+
+struct user
+{
+  struct user_regs_struct	regs;
+  int				u_fpvalid;
+  struct user_fpregs_struct	i387;
+  unsigned long int		u_tsize;
+  unsigned long int		u_dsize;
+  unsigned long int		u_ssize;
+  unsigned long			start_code;
+  unsigned long			start_stack;
+  long int			signal;
+  int				reserved;
+  struct user_regs_struct*	u_ar0;
+  struct user_fpregs_struct*	u_fpstate;
+  unsigned long int		magic;
+  char				u_comm [32];
+  int				u_debugreg [8];
+};
+
+#define PAGE_SHIFT		12
+#define PAGE_SIZE		(1UL << PAGE_SHIFT)
+#define PAGE_MASK		(~(PAGE_SIZE-1))
+#define NBPG			PAGE_SIZE
+#define UPAGES			1
+#define HOST_TEXT_START_ADDR	(u.start_code)
+#define HOST_STACK_END_ADDR	(u.start_stack + u.u_ssize * NBPG)
+
+#endif	/* _SYS_USER_H */
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscall.S b/sysdeps/unix/sysv/linux/x86_64/syscall.S
new file mode 100644
index 0000000000..03144ce832
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/syscall.S
@@ -0,0 +1,44 @@
+/* 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+/* Please consult the file sysdeps/unix/sysv/linux/x86-64/sysdep.h for
+   more information about the value -4095 used below.  */
+
+/* Usage: long syscall (syscall_number, arg1, arg2, arg3, arg4, arg5)
+   We need to do some arg shifting, the syscall_number will be in
+   rax.  */
+
+
+	.text
+ENTRY (syscall)
+
+	movq %rdi, %rax		/* Syscall number -> rax.  */
+	movq %rsi, %rdi		/* shift arg1 - arg5.  */
+	movq %rdx, %rsi
+	movq %rcx, %rdx
+	movq %r8, %r10
+	movq %r9, %r8
+	syscall			/* Do the system call.  */
+	cmpq $-4095, %rax	/* Check %rax for error.  */
+	jae SYSCALL_ERROR_LABEL	/* Jump to error handler if error.  */
+L(pseudo_end):
+	ret			/* Return to caller.  */
+
+PSEUDO_END (syscall)
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
new file mode 100644
index 0000000000..be3607bcdb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -0,0 +1,44 @@
+# File name	Caller	Syscall name	# args	Strong name	Weak names
+
+mmap		-	mmap		b:aniiii __mmap		mmap __mmap64 mmap64
+llseek		EXTRA	lseek		i:iii	__libc_lseek64	__llseek llseek __lseek64 lseek64
+pread		-	pread		i:ibni	__libc_pread	__libc_pread64 __pread pread __pread64 pread64
+pwrite		-	pwrite		i:ibni	__libc_pwrite	__libc_pwrite64 __pwrite pwrite __pwrite64 pwrite64
+fstatfs		-	fstatfs		i:ip	__fstatfs	fstatfs __fstatfs64 fstatfs64
+statfs		-	statfs		i:sp	__statfs	statfs statfs64
+getrlimit	-	getrlimit	i:ip	__getrlimit	getrlimit getrlimit64
+setrlimit	-	setrlimit	i:ip	__setrlimit	setrlimit64 setrlimit
+ftruncate	-	ftruncate	i:ii	__ftruncate	ftruncate ftruncate64 __ftruncate64
+truncate	-	truncate	i:si	truncate	truncate64
+ptrace		-	ptrace		i:iipp	__ptrace	ptrace
+
+# semaphore and shm system calls
+msgctl		-	msgctl		i:iip	__msgctl	msgctl
+msgget		-	msgget		i:ii	__msgget	msgget
+msgrcv		-	msgrcv		i:ibnii	__msgrcv	msgrcv
+msgsnd		-	msgsnd		i:ibni	__msgsnd	msgsnd
+shmat		-	shmat		i:ipi	__shmat		shmat
+shmctl		-	shmctl		i:iip	__shmctl	shmctl
+shmdt		-	shmdt		i:s	__shmdt		shmdt
+shmget		-	shmget		i:iii	__shmget	shmget
+semop		-	semop		i:ipi	__semop		semop
+semget		-	semget		i:iii	__semget	semget
+semctl		-	semctl		i:iiii	__semctl	semctl
+
+
+# proper socket implementations:
+accept		-	accept		i:iBN	__libc_accept	__accept accept
+bind		-	bind		i:ipi	__bind		bind
+connect		-	connect		i:ipi	__libc_connect	__connect connect
+getpeername	-	getpeername	i:ipp	__getpeername	getpeername
+getsockname	-	getsockname	i:ipp	__getsockname	getsockname
+getsockopt	-	getsockopt	i:iiiBN	__getsockopt	getsockopt
+listen		-	listen		i:ii	__listen	listen
+recvfrom	-	recvfrom	i:ibniBN	__libc_recvfrom	__recvfrom recvfrom
+recvmsg		-	recvmsg		i:ipi	__libc_recvmsg	recvmsg
+sendmsg		-	sendmsg		i:ipi	__libc_sendmsg	sendmsg
+sendto		-	sendto		i:ibnibn	__libc_sendto	__sendto sendto
+setsockopt	-	setsockopt	i:iiibn	__setsockopt	setsockopt
+shutdown	-	shutdown	i:ii	__shutdown	shutdown
+socket		-	socket		i:iii	__socket	socket
+socketpair	-	socketpair	i:iiif	__socketpair	socketpair
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.S b/sysdeps/unix/sysv/linux/x86_64/sysdep.S
new file mode 100644
index 0000000000..7f041aa730
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.S
@@ -0,0 +1,56 @@
+/* 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+/* Because the Linux version is in fact x86-64/ELF and the start.? file
+   for this system (sysdeps/x86_64/elf/start.S) is also used by The Hurd
+   and therefore this files must not contain the definition of the
+   `errno' variable (I don't know why, ask Roland), we have to define
+   it somewhere else.
+
+   ...and this place is here.  */
+	.bss
+	.globl	errno
+	.type errno,@object
+	.size errno,4
+errno:
+	.space	4
+weak_alias (errno, _errno)
+
+/* The following code is only used in the shared library when we
+   compile the reentrant version.  Otherwise each system call defines
+   each own version.  */
+
+#ifndef PIC
+
+/* The syscall stubs jump here when they detect an error.
+   The code for Linux is almost identical to the canonical Unix
+   code, except that the error number in %rax is negated.  */
+
+#undef CALL_MCOUNT
+#define CALL_MCOUNT /* Don't insert the profiling call, it clobbers %rax.  */
+
+	.text
+ENTRY (__syscall_error)
+	negq %rax
+
+#define __syscall_error __syscall_error_1
+#include <sysdeps/unix/x86_64/sysdep.S>
+
+#endif	/* !PIC */
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
new file mode 100644
index 0000000000..972fa20442
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -0,0 +1,205 @@
+/* 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _LINUX_X86_64_SYSDEP_H
+#define _LINUX_X86_64_SYSDEP_H 1
+
+/* There is some commonality.  */
+#include <sysdeps/unix/x86_64/sysdep.h>
+#include <bp-sym.h>
+#include <bp-asm.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
+#define SYS_ify(syscall_name)	__NR_##syscall_name
+
+/* ELF-like local names start with `.L'.  */
+#undef L
+#define L(name)	.L##name
+
+#ifdef __ASSEMBLER__
+
+/* Linux uses a negative return value to indicate syscall errors,
+   unlike most Unices, which use the condition codes' carry flag.
+
+   Since version 2.1 the return value of a system call might be
+   negative even if the call succeeded.	 E.g., the `lseek' system call
+   might return a large offset.	 Therefore we must not anymore test
+   for < 0, but test for a real error by making sure the value in %eax
+   is a real error number.  Linus said he will make sure the no syscall
+   returns a value in -1 .. -4095 as a valid result so we can savely
+   test with -4095.  */
+
+/* We don't want the label for the error handle to be global when we define
+   it here.  */
+#ifdef PIC
+# define SYSCALL_ERROR_LABEL 0f
+#else
+# define SYSCALL_ERROR_LABEL syscall_error
+#endif
+
+#undef	PSEUDO
+#define	PSEUDO(name, syscall_name, args)				      \
+  .text;								      \
+  ENTRY (name)								      \
+    DO_CALL (args, syscall_name);					      \
+    cmpq $-4095, %rax;							      \
+    jae SYSCALL_ERROR_LABEL;						      \
+  L(pseudo_end):
+
+#undef	PSEUDO_END
+#define	PSEUDO_END(name)						      \
+  SYSCALL_ERROR_HANDLER							      \
+  END (name)
+
+#ifndef PIC
+#define SYSCALL_ERROR_HANDLER	/* Nothing here; code in sysdep.S is used.  */
+#else
+/* Store (- %rax) into errno through the GOT.  */
+#ifdef _LIBC_REENTRANT
+#define SYSCALL_ERROR_HANDLER			\
+0:						\
+  xorq %rdx, %rdx;				\
+  subq %rax, %rdx;				\
+  pushq %rdx					\
+  PUSH_ERRNO_LOCATION_RETURN;			\
+  call BP_SYM (__errno_location)@PLT;		\
+  POP_ERRNO_LOCATION_RETURN;			\
+  popq %rdx;					\
+  movq %rdx, (%rax);				\
+  orq $-1, %rax;				\
+  jmp L(pseudo_end);
+
+/* A quick note: it is assumed that the call to `__errno_location' does
+   not modify the stack!  */
+#else
+#define SYSCALL_ERROR_HANDLER			\
+0:movq errno@GOTPCREL(%RIP), %rcx;		\
+  xorq %rdx, %rdx;				\
+  subq %rax, %rdx;				\
+  movq %rdx, (%rcx);				\
+  orq $-1, %rax;				\
+  jmp L(pseudo_end);
+#endif	/* _LIBC_REENTRANT */
+#endif	/* PIC */
+
+/* Linux/x86-64 takes system call arguments in registers:
+
+    Register setup:
+    system call number	rax
+    arg 1		rdi
+    arg 2		rsi
+    arg 3		rdx
+    arg 4		rcx
+    arg 5		r8
+    arg 6		r9
+
+    return address from
+    syscall		rcx
+    additionally clobered: r12-r15,rbx,rbp
+    eflags from syscall	r11
+
+    The compiler is going to form a call by coming here, through PSEUDO, with arguments:
+
+	syscall number	in the DO_CALL macro
+	arg 1		rdi
+	arg 2		rsi
+	arg 3		rdx
+	arg 4		r10
+	arg 5		r8
+	arg 6		r9
+
+     We have to take care that the stack is alignedto 16 bytes.	 When
+     called the stack is not aligned since the return address has just
+     been pushed.
+
+     Syscalls of more than 6 arguments are not supported.  */
+
+#undef	DO_CALL
+#define DO_CALL(args, syscall_name)		\
+    DOARGS_##args				\
+    movq $SYS_ify (syscall_name), %rax;		\
+    syscall;
+
+#define DOARGS_0 /* nothing */
+#define DOARGS_1 /* nothing */
+#define DOARGS_2 /* nothing */
+#define DOARGS_3 /* nothing */
+#define DOARGS_4 movq %rcx, %r10;
+#define DOARGS_5 DOARGS_4
+#define DOARGS_6 DOARGS_5
+
+#else	/* !__ASSEMBLER__ */
+/* Define a macro which expands inline into the wrapper code for a system
+   call.  */
+#undef INLINE_SYSCALL
+#define INLINE_SYSCALL(name, nr, args...) \
+  ({									      \
+    unsigned long resultvar;						      \
+    LOAD_ARGS_##nr (args)						      \
+    asm volatile (							      \
+    "movq %1, %%rax\n\t"						      \
+    "syscall\n\t"							      \
+    : "=a" (resultvar)							      \
+    : "i" (__NR_##name) ASM_ARGS_##nr : "memory", "cc", "r11", "cx");	      \
+    if (resultvar >= (unsigned long) -4095)				      \
+      {									      \
+	__set_errno (-resultvar);					      \
+	resultvar = (unsigned long) -1;					      \
+      }									      \
+    (long) resultvar; })
+
+#define LOAD_ARGS_0()
+#define ASM_ARGS_0
+
+#define LOAD_ARGS_1(a1)					\
+  register long int _a1 asm ("rdi") = (long) (a1);	\
+  LOAD_ARGS_0 ()
+#define ASM_ARGS_1	ASM_ARGS_0, "r" (_a1)
+
+#define LOAD_ARGS_2(a1, a2)				\
+  register long int _a2 asm ("rsi") = (long) (a2);	\
+  LOAD_ARGS_1 (a1)
+#define ASM_ARGS_2	ASM_ARGS_1, "r" (_a2)
+
+#define LOAD_ARGS_3(a1, a2, a3)				\
+  register long int _a3 asm ("rdx") = (long) (a3);	\
+  LOAD_ARGS_2 (a1, a2)
+#define ASM_ARGS_3	ASM_ARGS_2, "r" (_a3)
+
+#define LOAD_ARGS_4(a1, a2, a3, a4)			\
+  register long int _a4 asm ("r10") = (long) (a4);	\
+  LOAD_ARGS_3 (a1, a2, a3)
+#define ASM_ARGS_4	ASM_ARGS_3, "r" (_a4)
+
+#define LOAD_ARGS_5(a1, a2, a3, a4, a5)			\
+  register long int _a5 asm ("r8") = (long) (a5);	\
+  LOAD_ARGS_4 (a1, a2, a3, a4)
+#define ASM_ARGS_5	ASM_ARGS_4, "r" (_a5)
+
+#define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6)		\
+  register long int _a6 asm ("r9") = (long) (a6);	\
+  LOAD_ARGS_5 (a1, a2, a3, a4, a5)
+#define ASM_ARGS_6	ASM_ARGS_5, "r" (_a6)
+
+#endif	/* __ASSEMBLER__ */
+
+#endif /* linux/x86_64/sysdep.h */
diff --git a/sysdeps/unix/sysv/linux/x86_64/time.c b/sysdeps/unix/sysv/linux/x86_64/time.c
new file mode 100644
index 0000000000..2cb748cfa5
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/time.c
@@ -0,0 +1,33 @@
+/* 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <asm/vsyscall.h>
+#include <time.h>
+#include <sys/time.h>
+
+/* Return the current time as a `time_t' and also put it in *T if T is
+   not NULL.  Time is represented as seconds from Jan 1 00:00:00 1970.  */
+time_t
+time (time_t *t)
+{
+  /* We're using a virtual syscall here.  */
+  time_t (*__vtime)(time_t * time)
+    = (time_t (*)(time_t *)) VSYSCALL_ADDR (__NR_vtime);
+
+  return __vtime (t);
+}
diff --git a/sysdeps/unix/sysv/linux/x86_64/truncate64.c b/sysdeps/unix/sysv/linux/x86_64/truncate64.c
new file mode 100644
index 0000000000..8999768874
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/truncate64.c
@@ -0,0 +1 @@
+/* truncate64 is the same as truncate. */
diff --git a/sysdeps/unix/sysv/linux/x86_64/umount.c b/sysdeps/unix/sysv/linux/x86_64/umount.c
new file mode 100644
index 0000000000..9a91ba5b2f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/umount.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/hppa/umount.c>
diff --git a/sysdeps/unix/sysv/linux/x86_64/vfork.S b/sysdeps/unix/sysv/linux/x86_64/vfork.S
new file mode 100644
index 0000000000..0b5a90a6c8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/vfork.S
@@ -0,0 +1,52 @@
+/* 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; 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 <bits/errno.h>
+
+/* Clone the calling process, but without copying the whole address space.
+   The calling process is suspended until the new process exits or is
+   replaced by a call to `execve'.  Return -1 for errors, 0 to the new process,
+   and the process ID of the new process to the old process.  */
+
+ENTRY (__vfork)
+
+	/* Pop the return PC value into RBX.  */
+	popq	%rbx
+
+	/* Stuff the syscall number in RAX and enter into the kernel.  */
+	movl	$SYS_ify (vfork), %eax
+	syscall
+	cmpl	$-4095, %eax
+	jae	.Lerror		/* Branch forward if it failed.  */
+
+	/* Jump to the return PC.  */
+	jmp	*%rbx
+
+.Lerror:
+	/* Push back the return PC.  */
+	pushq	%rbx
+	jmp	SYSCALL_ERROR_LABEL
+
+.Lpseudo_end:
+	ret
+
+PSEUDO_END (__vfork)
+
+weak_alias (__vfork, vfork)
diff --git a/sysdeps/unix/sysv/linux/x86_64/xstat.c b/sysdeps/unix/sysv/linux/x86_64/xstat.c
new file mode 100644
index 0000000000..c315d841c2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/xstat.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/ia64/xstat.c>
diff --git a/sysdeps/unix/sysv/linux/x86_64/xstat64.c b/sysdeps/unix/sysv/linux/x86_64/xstat64.c
new file mode 100644
index 0000000000..e7acd3b45e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/xstat64.c
@@ -0,0 +1 @@
+/* xstat64 is in xstat.c */
diff --git a/sysdeps/unix/x86_64/sysdep.S b/sysdeps/unix/x86_64/sysdep.S
new file mode 100644
index 0000000000..b26b1db934
--- /dev/null
+++ b/sysdeps/unix/x86_64/sysdep.S
@@ -0,0 +1,71 @@
+/* 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; 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
+#include <bits/errno.h>
+#include <bp-asm.h>
+#include <bp-sym.h>
+
+.globl C_SYMBOL_NAME(errno)
+.globl syscall_error
+
+#undef syscall_error
+#ifdef NO_UNDERSCORES
+__syscall_error:
+#else
+syscall_error:
+#endif
+#if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN
+	/* We translate the system's EWOULDBLOCK error into EAGAIN.
+	   The GNU C library always defines EWOULDBLOCK==EAGAIN.
+	   EWOULDBLOCK_sys is the original number.  */
+	cmpq $EWOULDBLOCK_sys, %rax /* Is it the old EWOULDBLOCK?  */
+	jne notb		/* Branch if not.  */
+	movq $EAGAIN, %rax	/* Yes; translate it to EAGAIN.  */
+notb:
+#endif
+#ifndef	PIC
+# ifndef _LIBC_REENTRANT
+	movq %rax, C_SYMBOL_NAME(errno)
+# else
+	pushq %rax
+	PUSH_ERRNO_LOCATION_RETURN
+	call BP_SYM (__errno_location)
+	POP_ERRNO_LOCATION_RETURN
+	popq %rcx
+	movq %rcx, (%rax)
+# endif
+#else
+# ifndef _LIBC_REENTRANT
+	movq C_SYMBOL_NAME(errno)@GOTPCREL(%rip), %rcx
+	movq %rax, (%rcx)
+# else
+	pushq %rax
+	PUSH_ERRNO_LOCATION_RETURN
+	call C_SYMBOL_NAME (BP_SYM (__errno_location)@PLT)
+	POP_ERRNO_LOCATION_RETURN
+	popq %rcx
+	movq %rcx, (%rax)
+# endif
+#endif
+	movq $-1, %rax
+	ret
+
+#undef	__syscall_error
+END (__syscall_error)
diff --git a/sysdeps/unix/x86_64/sysdep.h b/sysdeps/unix/x86_64/sysdep.h
new file mode 100644
index 0000000000..95e456c17d
--- /dev/null
+++ b/sysdeps/unix/x86_64/sysdep.h
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991, 92, 93, 95, 96, 97, 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdeps/unix/sysdep.h>
+#include <sysdeps/x86_64/sysdep.h>
+
+#ifdef	__ASSEMBLER__
+
+/* This is defined as a separate macro so that other sysdep.h files
+   can include this one and then redefine DO_CALL.  */
+
+#define DO_CALL(syscall_name, args)					      \
+  lea SYS_ify (syscall_name), %rax;					      \
+  syscall
+
+#define	r0		%rax	/* Normal return-value register.  */
+#define	r1		%rbx	/* Secondary return-value register.  */
+#define MOVE(x,y)	movq x, y
+
+#endif	/* __ASSEMBLER__ */
diff --git a/sysdeps/x86_64/Implies b/sysdeps/x86_64/Implies
new file mode 100644
index 0000000000..2b8412b0b6
--- /dev/null
+++ b/sysdeps/x86_64/Implies
@@ -0,0 +1,4 @@
+wordsize-64
+ieee754/ldbl-96
+ieee754/dbl-64
+ieee754/flt-32
diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile
new file mode 100644
index 0000000000..4e64fb0a5e
--- /dev/null
+++ b/sysdeps/x86_64/Makefile
@@ -0,0 +1,6 @@
+# The i387 `long double' is a distinct type we support.
+long-double-fcts = yes
+
+ifeq ($(subdir),csu)
+sysdep_routines += hp-timing
+endif
diff --git a/sysdeps/x86_64/Versions b/sysdeps/x86_64/Versions
new file mode 100644
index 0000000000..42386f4dcc
--- /dev/null
+++ b/sysdeps/x86_64/Versions
@@ -0,0 +1,5 @@
+ld {
+  GLIBC_2.2.5 {
+    _dl_cpuclock_offset;
+  }
+}
diff --git a/sysdeps/x86_64/__longjmp.S b/sysdeps/x86_64/__longjmp.S
new file mode 100644
index 0000000000..1962b7f1aa
--- /dev/null
+++ b/sysdeps/x86_64/__longjmp.S
@@ -0,0 +1,44 @@
+/* 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+#define _ASM
+#define _SETJMP_H
+#include <bits/setjmp.h>
+#include <asm-syntax.h>
+
+/* Jump to the position specified by ENV, causing the
+   setjmp call there to return VAL, or 1 if VAL is 0.
+   void __longjmp (__jmp_buf env, int val).  */
+ENTRY(__longjmp)
+	/* Restore registers.  */
+	movq (JB_RBX*8)(%rdi),%rbx
+	movq (JB_RBP*8)(%rdi),%rbp
+	movq (JB_R12*8)(%rdi),%r12
+	movq (JB_R13*8)(%rdi),%r13
+	movq (JB_R14*8)(%rdi),%r14
+	movq (JB_R15*8)(%rdi),%r15
+	/* Set return value for setjmp.  */
+	test %esi,%esi
+	mov $01,%eax
+	cmove %eax,%esi
+	mov %esi, %eax
+	movq (JB_PC*8)(%rdi),%rdx
+	movq (JB_RSP*8)(%rdi),%rsp
+	jmpq *%rdx
+END (BP_SYM (__longjmp))
diff --git a/sysdeps/x86_64/abort-instr.h b/sysdeps/x86_64/abort-instr.h
new file mode 100644
index 0000000000..810f10379b
--- /dev/null
+++ b/sysdeps/x86_64/abort-instr.h
@@ -0,0 +1,2 @@
+/* An instruction which should crash any program is `hlt'.  */
+#define ABORT_INSTRUCTION asm ("hlt")
diff --git a/sysdeps/x86_64/atomicity.h b/sysdeps/x86_64/atomicity.h
new file mode 100644
index 0000000000..925c9f9da5
--- /dev/null
+++ b/sysdeps/x86_64/atomicity.h
@@ -0,0 +1,57 @@
+/* Low-level functions for atomic operations.  x86-64 version.
+   Copyright (C) 1997, 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _ATOMICITY_H
+#define _ATOMICITY_H	1
+
+#include <inttypes.h>
+
+
+static inline uint32_t
+__attribute__ ((unused))
+exchange_and_add (volatile uint32_t *mem, uint32_t val)
+{
+  register uint32_t result;
+  __asm__ __volatile__ ("lock; xaddl %0,%1"
+			: "=r" (result), "=m" (*mem) : "0" (val), "1" (*mem));
+  return result;
+}
+
+static inline void
+__attribute__ ((unused))
+atomic_add (volatile uint32_t *mem, int val)
+{
+  __asm__ __volatile__ ("lock; addl %1,%0"
+			: "=m" (*mem) : "er" (val), "0" (*mem));
+}
+
+static inline char
+__attribute__ ((unused))
+compare_and_swap (volatile long int *p, long int oldval, long int newval)
+{
+  char ret;
+  long int readval;
+
+  __asm__ __volatile__ ("lock; cmpxchgq %3, %1; sete %0"
+                        : "=q" (ret), "=m" (*p), "=a" (readval)
+                        : "r" (newval), "1" (*p), "a" (oldval));
+  return ret;
+}
+
+#endif /* atomicity.h */
diff --git a/sysdeps/x86_64/bits/endian.h b/sysdeps/x86_64/bits/endian.h
new file mode 100644
index 0000000000..2f59eada25
--- /dev/null
+++ b/sysdeps/x86_64/bits/endian.h
@@ -0,0 +1,7 @@
+/* x86_64 is little-endian.  */
+
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
+#define __BYTE_ORDER __LITTLE_ENDIAN
diff --git a/sysdeps/x86_64/bits/setjmp.h b/sysdeps/x86_64/bits/setjmp.h
new file mode 100644
index 0000000000..be39482d09
--- /dev/null
+++ b/sysdeps/x86_64/bits/setjmp.h
@@ -0,0 +1,47 @@
+/* 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* Define the machine-dependent type `jmp_buf'.  x86-64 version.  */
+
+#ifndef _SETJMP_H
+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
+#endif
+
+/* We only need to save callee-saved registers plus stackpointer and
+   program counter.  */
+#if defined __USE_MISC || defined _ASM
+# define JB_RBX	0
+# define JB_RBP	1
+# define JB_R12	2
+# define JB_R13	3
+# define JB_R14	4
+# define JB_R15	5
+# define JB_RSP	6
+# define JB_PC	7
+# define JB_SIZE (8*8)
+#endif
+
+#ifndef _ASM
+
+typedef long int __jmp_buf[8];
+
+/* Test if longjmp to JMPBUF would unwind the frame
+   containing a local variable at ADDRESS.  */
+#define _JMPBUF_UNWINDS(jmpbuf, address) \
+  ((void *) (address) < (void *) (jmpbuf)[JB_RSP])
+#endif
diff --git a/sysdeps/x86_64/bits/string.h b/sysdeps/x86_64/bits/string.h
new file mode 100644
index 0000000000..708ce78d61
--- /dev/null
+++ b/sysdeps/x86_64/bits/string.h
@@ -0,0 +1,26 @@
+/* Optimized, inlined string functions.  AMD x86-64 version.
+   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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _STRING_H
+# error "Never use <bits/string.h> directly; include <string.h> instead."
+#endif
+
+/* Currently the only purpose of this file is to tell the generic inline
+   macros that unaligned memory access is possible for x86-64.  */
+#define _STRING_ARCH_unaligned	1
diff --git a/sysdeps/x86_64/bp-asm.h b/sysdeps/x86_64/bp-asm.h
new file mode 100644
index 0000000000..ff140ce181
--- /dev/null
+++ b/sysdeps/x86_64/bp-asm.h
@@ -0,0 +1,141 @@
+/* Bounded-pointer definitions for x86-64 assembler.
+   Copyright (C) 2001 Free Software Foundation, Inc.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _bp_asm_h_
+# define _bp_asm_h_ 1
+
+# if __ASSEMBLER__
+
+#  if __BOUNDED_POINTERS__
+
+/* Bounded pointers occupy three words.  */
+#   define PTR_SIZE 24
+/* Bounded pointer return values are passed back through a hidden
+   argument that points to caller-allocate space.  The hidden arg
+   occupies one word on the stack.  */
+#   define RTN_SIZE 6
+/* Although the caller pushes the hidden arg, the callee is
+   responsible for popping it.  */
+#   define RET_PTR ret $RTN_SIZE
+/* Maintain frame pointer chain in leaf assembler functions for the benefit
+   of debugging stack traces when bounds violations occur.  */
+#   define ENTER pushq %rbp; movq %rsp, %rbp
+#   define LEAVE movq %rbp, %rsp; popq %rbp
+/* Stack space overhead of procedure-call linkage: return address and
+   frame pointer.  */
+#   define LINKAGE 16
+/* Stack offset of return address after calling ENTER.  */
+#   define PCOFF 8
+
+/* Int 5 is the "bound range" exception also raised by the "bound"
+   instruction.  */
+#   define BOUNDS_VIOLATED int $5
+
+#   define CHECK_BOUNDS_LOW(VAL_REG, BP_MEM)	\
+	cmpq 8+BP_MEM, VAL_REG;			\
+	jae 0f; /* continue if value >= low */	\
+	BOUNDS_VIOLATED;			\
+    0:
+
+#   define CHECK_BOUNDS_HIGH(VAL_REG, BP_MEM, Jcc)	\
+	cmpq 16+BP_MEM, VAL_REG;			\
+	Jcc 0f; /* continue if value < high */		\
+	BOUNDS_VIOLATED;				\
+    0:
+
+#   define CHECK_BOUNDS_BOTH(VAL_REG, BP_MEM)	\
+	cmpq 8+BP_MEM, VAL_REG;			\
+	jb 1f; /* die if value < low */		\
+	cmpq 16+BP_MEM, VAL_REG;		\
+	jb 0f; /* continue if value < high */	\
+    1:	BOUNDS_VIOLATED;			\
+    0:
+
+#   define CHECK_BOUNDS_BOTH_WIDE(VAL_REG, BP_MEM, LENGTH)	\
+	CHECK_BOUNDS_LOW(VAL_REG, BP_MEM);			\
+	addl LENGTH, VAL_REG;					\
+	cmpq 16+BP_MEM, VAL_REG;					\
+	jbe 0f; /* continue if value <= high */			\
+	BOUNDS_VIOLATED;					\
+    0:	subq LENGTH, VAL_REG /* restore value */
+
+/* Take bounds from BP_MEM and affix them to the pointer
+   value in %rax, stuffing all into memory at RTN(%esp).
+   Use %rdx as a scratch register.  */
+
+#   define RETURN_BOUNDED_POINTER(BP_MEM)	\
+	movq RTN(%rsp), %rdx;			\
+	movq %rax, 0(%rdx);			\
+	movq 8+BP_MEM, %rax;			\
+	movq %rax, 4(%rdx);			\
+	movq 16+BP_MEM, %rax;			\
+	movq %rax, 8(%rdx)
+
+#   define RETURN_NULL_BOUNDED_POINTER		\
+	movl RTN(%rsp), %rdx;			\
+	movl %rax, 0(%rdx);			\
+	movl %rax, 4(%rdx);			\
+	movl %rax, 8(%rdx)
+
+/* The caller of __errno_location is responsible for allocating space
+   for the three-word BP return-value and passing pushing its address
+   as an implicit first argument.  */
+#   define PUSH_ERRNO_LOCATION_RETURN		\
+	subl $16, %esp;				\
+	subl $8, %esp;				\
+	pushq %rsp
+
+/* __errno_location is responsible for popping the implicit first
+   argument, but we must pop the space for the BP itself.  We also
+   dereference the return value in order to dig out the pointer value.  */
+#   define POP_ERRNO_LOCATION_RETURN		\
+	popq %rax;				\
+	addq $16, %rsp
+
+#  else /* !__BOUNDED_POINTERS__ */
+
+/* Unbounded pointers occupy one word.  */
+#   define PTR_SIZE 8
+/* Unbounded pointer return values are passed back in the register %rax.  */
+#   define RTN_SIZE 0
+/* Use simple return instruction for unbounded pointer values.  */
+#   define RET_PTR ret
+/* Don't maintain frame pointer chain for leaf assembler functions.  */
+#   define ENTER
+#   define LEAVE
+/* Stack space overhead of procedure-call linkage: return address only.  */
+#   define LINKAGE 8
+/* Stack offset of return address after calling ENTER.  */
+#   define PCOFF 0
+
+#   define CHECK_BOUNDS_LOW(VAL_REG, BP_MEM)
+#   define CHECK_BOUNDS_HIGH(VAL_REG, BP_MEM, Jcc)
+#   define CHECK_BOUNDS_BOTH(VAL_REG, BP_MEM)
+#   define CHECK_BOUNDS_BOTH_WIDE(VAL_REG, BP_MEM, LENGTH)
+#   define RETURN_BOUNDED_POINTER(BP_MEM)
+
+#   define RETURN_NULL_BOUNDED_POINTER
+
+#   define PUSH_ERRNO_LOCATION_RETURN
+#   define POP_ERRNO_LOCATION_RETURN
+
+#  endif /* !__BOUNDED_POINTERS__ */
+
+# endif /* __ASSEMBLER__ */
+
+#endif /* _bp_asm_h_ */
diff --git a/sysdeps/x86_64/bsd-_setjmp.S b/sysdeps/x86_64/bsd-_setjmp.S
new file mode 100644
index 0000000000..5f29adc7b8
--- /dev/null
+++ b/sysdeps/x86_64/bsd-_setjmp.S
@@ -0,0 +1,39 @@
+/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'.  x86-64 version.
+   Copyright (C) 1994,1995,1996,1997,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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* This just does a tail-call to `__sigsetjmp (ARG, 0)'.
+   We cannot do it in C because it must be a tail-call, so frame-unwinding
+   in setjmp doesn't clobber the state restored by longjmp.  */
+
+#include <sysdep.h>
+#define _ASM
+#define _SETJMP_H
+#include <bits/setjmp.h>
+#include "bp-sym.h"
+#include "bp-asm.h"
+
+ENTRY (BP_SYM (_setjmp))
+	/* Set up arguments, we only need to set the second arg.  */
+	xorq %rsi, %rsi
+#ifdef	PIC
+	jmp C_SYMBOL_NAME (BP_SYM (__sigsetjmp))@PLT
+#else
+	jmp BP_SYM (__sigsetjmp)
+#endif
+END (BP_SYM (_setjmp))
diff --git a/sysdeps/x86_64/bsd-setjmp.S b/sysdeps/x86_64/bsd-setjmp.S
new file mode 100644
index 0000000000..c168f81867
--- /dev/null
+++ b/sysdeps/x86_64/bsd-setjmp.S
@@ -0,0 +1,38 @@
+/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'.  x86-64 version.
+   Copyright (C) 1994,1995,1996,1997,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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* This just does a tail-call to `__sigsetjmp (ARG, 1)'.
+   We cannot do it in C because it must be a tail-call, so frame-unwinding
+   in setjmp doesn't clobber the state restored by longjmp.  */
+
+#include <sysdep.h>
+#define _ASM
+#define _SETJMP_H
+#include <bits/setjmp.h>
+#include "bp-sym.h"
+#include "bp-asm.h"
+
+ENTRY (BP_SYM (setjmp))
+	/* Set up arguments, we only need to set the 2nd arg.  */
+	movq $1, %rsi
+#ifdef	PIC
+#else
+	jmp BP_SYM (__sigsetjmp)
+#endif
+END (BP_SYM (setjmp))
diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
new file mode 100644
index 0000000000..268c2c31d6
--- /dev/null
+++ b/sysdeps/x86_64/dl-machine.h
@@ -0,0 +1,417 @@
+/* Machine-dependent ELF dynamic relocation inline functions.  x86-64 version.
+   Copyright (C) 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Andreas Jaeger <aj@suse.de>.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef dl_machine_h
+#define dl_machine_h
+
+#define ELF_MACHINE_NAME "x86_64"
+
+#include <sys/param.h>
+
+/* Return nonzero iff ELF header is compatible with the running host.  */
+static inline int __attribute__ ((unused))
+elf_machine_matches_host (const Elf64_Ehdr *ehdr)
+{
+  return ehdr->e_machine == EM_X86_64;
+}
+
+
+/* Return the link-time address of _DYNAMIC.  Conveniently, this is the
+   first element of the GOT.  This must be inlined in a function which
+   uses global data.  */
+static inline Elf64_Addr __attribute__ ((unused))
+elf_machine_dynamic (void)
+{
+  register Elf64_Addr addr;
+
+  asm ("leaq _DYNAMIC, %0\n" : "=r" (addr));
+  return addr;
+}
+
+
+/* Return the run-time load address of the shared object.  */
+static inline Elf64_Addr __attribute__ ((unused))
+elf_machine_load_address (void)
+{
+  register Elf64_Addr addr, tmp;
+
+  asm ("leaq _dl_start, %0\n"
+       "leaq _dl_start(%%rip), %1\n"
+       "subq %0, %1\n"
+       : "=r" (tmp), "=r" (addr) : : "cc");
+  return addr;
+}
+
+/* Set up the loaded object described by L so its unrelocated PLT
+   entries will jump to the on-demand fixup code in dl-runtime.c.  */
+
+static inline int __attribute__ ((unused))
+elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
+{
+  Elf64_Addr *got;
+  extern void _dl_runtime_resolve (Elf64_Word);
+  extern void _dl_runtime_profile (Elf64_Word);
+
+  if (l->l_info[DT_JMPREL] && lazy)
+    {
+      /* The GOT entries for functions in the PLT have not yet been filled
+	 in.  Their initial contents will arrange when called to push an
+	 offset into the .rel.plt section, push _GLOBAL_OFFSET_TABLE_[1],
+	 and then jump to _GLOBAL_OFFSET_TABLE[2].  */
+      got = (Elf64_Addr *) D_PTR (l, l_info[DT_PLTGOT]);
+      got[1] = (Elf64_Addr) l;	/* Identify this shared object.  */
+
+      /* The got[2] entry contains the address of a function which gets
+	 called to get the address of a so far unresolved function and
+	 jump to it.  The profiling extension of the dynamic linker allows
+	 to intercept the calls to collect information.  In this case we
+	 don't store the address in the GOT so that all future calls also
+	 end in this function.  */
+      if (__builtin_expect (profile, 0))
+	{
+	  got[2] = (Elf64_Addr) &_dl_runtime_profile;
+
+	  if (_dl_name_match_p (_dl_profile, l))
+	    /* This is the object we are looking for.  Say that we really
+	       want profiling and the timers are started.  */
+	    _dl_profile_map = l;
+	}
+      else
+	/* This function will get called to fix up the GOT entry indicated by
+	   the offset on the stack, and then jump to the resolved address.  */
+	got[2] = (Elf64_Addr) &_dl_runtime_resolve;
+    }
+
+  return lazy;
+}
+
+/* This code is used in dl-runtime.c to call the `fixup' function
+   and then redirect to the address it returns.  */
+#ifndef PROF
+# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\n\
+	.text\n\
+	.globl _dl_runtime_resolve\n\
+	.type _dl_runtime_resolve, @function\n\
+	.align 16\n\
+_dl_runtime_resolve:\n\
+	pushq %rax		# Preserve registers otherwise clobbered.\n\
+	pushq %rcx\n\
+	pushq %rdx\n\
+	pushq %rsi\n\
+	pushq %rdi\n\
+	pushq %r8\n\
+	pushq %r9\n\
+	movq 64(%rsp), %rsi	# Copy args pushed by PLT in register.\n\
+	movq %rsi,%r11		# Multiply by 24\n\
+	addq %r11,%rsi\n\
+	addq %r11,%rsi\n\
+	shlq $3, %rsi\n\
+	movq 56(%rsp), %rdi	# %rdi: link_map, %rsi: reloc_offset\n\
+	call fixup		# Call resolver.\n\
+	movq %rax, %r11		# Save return value\n\
+	popq %r9		# Get register content back.\n\
+	popq %r8\n\
+	popq %rdi\n\
+	popq %rsi\n\
+	popq %rdx\n\
+	popq %rcx\n\
+	popq %rax\n\
+	addq $16,%rsp		# Adjust stack\n\
+	jmp *%r11		# Jump to function address.\n\
+	.size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
+\n\
+	.globl _dl_runtime_profile\n\
+	.type _dl_runtime_profile, @function\n\
+	.align 16\n\
+_dl_runtime_profile:\n\
+	pushq %rax		# Preserve registers otherwise clobbered.\n\
+	pushq %rcx\n\
+	pushq %rdx\n\
+	pushq %rsi\n\
+	pushq %rdi\n\
+	pushq %r8\n\
+	pushq %r9\n\
+	movq 72(%rsp), %rdx	# Load return address if needed\n\
+	movq 64(%rsp), %rsi	# Copy args pushed by PLT in register.\n\
+	movq %rsi,%r11		# Multiply by 24\n\
+	addq %r11,%rsi\n\
+	addq %r11,%rsi\n\
+	shlq $3, %rsi\n\
+	movq 56(%rsp), %rdi	# %rdi: link_map, %rsi: reloc_offset\n\
+	call profile_fixup	# Call resolver.\n\
+	movq %rax, %r11		# Save return value\n\
+	popq %r9		# Get register content back.\n\
+	popq %r8\n\
+	popq %rdi\n\
+	popq %rsi\n\
+	popq %rdx\n\
+	popq %rcx\n\
+	popq %rax\n\
+	addq $16,%rsp		# Adjust stack\n\
+	jmp *%r11		# Jump to function address.\n\
+	.size _dl_runtime_profile, .-_dl_runtime_profile\n\
+	.previous\n\
+");
+#else
+# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\n\
+	.text\n\
+	.globl _dl_runtime_resolve\n\
+	.globl _dl_runtime_profile\n\
+	.type _dl_runtime_resolve, @function\n\
+	.type _dl_runtime_profile, @function\n\
+	.align 16\n\
+_dl_runtime_resolve:\n\
+_dl_runtime_profile:\n\
+	pushq %rax		# Preserve registers otherwise clobbered.\n\
+	pushq %rcx\n\
+	pushq %rdx\n\
+	pushq %rsi\n\
+	pushq %rdi\n\
+	pushq %r8\n\
+	pushq %r9\n\
+	movq 64(%rsp), %rsi	# Copy args pushed by PLT in register.\n\
+	movq %rsi,%r11		# Multiply by 24\n\
+	addq %r11,%rsi\n\
+	addq %r11,%rsi\n\
+	shlq $3, %rsi\n\
+	movq 56(%rsp), %rdi	# %rdi: link_map, %rsi: reloc_offset\n\
+	call fixup		# Call resolver.\n\
+	movq %rax, %r11		# Save return value\n\
+	popq %r9		# Get register content back.\n\
+	popq %r8\n\
+	popq %rdi\n\
+	popq %rsi\n\
+	popq %rdx\n\
+	popq %rcx\n\
+	popq %rax\n\
+	addq $16,%rsp		# Adjust stack\n\
+	jmp *%r11		# Jump to function address.\n\
+	.size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
+	.size _dl_runtime_profile, .-_dl_runtime_profile\n\
+	.previous\n\
+");
+#endif
+
+/* Initial entry point code for the dynamic linker.
+   The C function `_dl_start' is the real entry point;
+   its return value is the user program's entry point.  */
+#define RTLD_START asm ("\n\
+.text\n\
+	.align 16\n\
+.globl _start\n\
+.globl _dl_start_user\n\
+_start:\n\
+	movq %rsp, %rdi\n\
+	call _dl_start\n\
+_dl_start_user:\n\
+	# Save the user entry point address in %r12.\n\
+	movq %rax, %r12\n\
+	# Store the highest stack address\n\
+	movq __libc_stack_end@GOTPCREL(%rip), %rax\n\
+	movq %rsp, (%rax)\n\
+	# See if we were run as a command with the executable file\n\
+	# name as an extra leading argument.\n\
+	movq _dl_skip_args@GOTPCREL(%rip), %rax\n\
+	movl (%rax), %eax\n\
+	# Pop the original argument count.\n\
+	popq %rdx\n\
+	# Adjust the stack pointer to skip _dl_skip_args words.\n\
+	leaq (%rsp,%rax,8), %rsp\n\
+	# Subtract _dl_skip_args from argc.\n\
+	subl %eax, %edx\n\
+	# Push argc back on the stack.\n\
+	pushq %rdx\n\
+	# Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env)\n\
+	# argc -> rsi\n\
+	movq %rdx, %rsi\n\
+	# _dl_loaded -> rdi\n\
+	movq _dl_loaded@GOTPCREL(%rip), %rdi\n\
+	movq (%rdi), %rdi\n\
+	# env -> rcx\n\
+	leaq 16(%rsp,%rdx,8), %rcx\n\
+	# argv -> rdx\n\
+	leaq 8(%rsp), %rdx\n\
+	# Call the function to run the initializers.\n\
+	call _dl_init@PLT\n\
+	# Pass our finalizer function to the user in %rdx, as per ELF ABI.\n\
+	movq _dl_fini@GOTPCREL(%rip), %rdx\n\
+	# Jump to the user's entry point.\n\
+	jmp *%r12\n\
+.previous\n\
+");
+
+/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
+   PLT entries should not be allowed to define the value.
+   ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
+   of the main executable's symbols, as for a COPY reloc.  */
+#define elf_machine_type_class(type) \
+  ((((type) == R_X86_64_JUMP_SLOT) * ELF_RTYPE_CLASS_PLT)  \
+   | (((type) == R_X86_64_COPY) * ELF_RTYPE_CLASS_COPY))
+
+/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
+#define ELF_MACHINE_JMP_SLOT	R_X86_64_JUMP_SLOT
+
+/* The x86-64 never uses Elf64_Rel relocations.  */
+#define ELF_MACHINE_NO_REL 1
+
+/* We define an initialization functions.  This is called very early in
+   _dl_sysdep_start.  */
+#define DL_PLATFORM_INIT dl_platform_init ()
+
+extern const char *_dl_platform;
+
+static inline void __attribute__ ((unused))
+dl_platform_init (void)
+{
+  if (_dl_platform != NULL && *_dl_platform == '\0')
+    /* Avoid an empty string which would disturb us.  */
+    _dl_platform = NULL;
+}
+
+static inline Elf64_Addr
+elf_machine_fixup_plt (struct link_map *map, lookup_t t,
+		       const Elf64_Rela *reloc,
+		       Elf64_Addr *reloc_addr, Elf64_Addr value)
+{
+  return *reloc_addr = value;
+}
+
+/* Return the final value of a plt relocation.  On x86-64 the
+   JUMP_SLOT relocation ignores the addend. */
+static inline Elf64_Addr
+elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc,
+		       Elf64_Addr value)
+{
+  return value;
+}
+
+#endif /* !dl_machine_h */
+
+#ifdef RESOLVE
+
+/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
+   MAP is the object containing the reloc.  */
+
+static inline void
+elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
+		 const Elf64_Sym *sym, const struct r_found_version *version,
+		 Elf64_Addr *const reloc_addr)
+{
+  const unsigned long int r_type = ELF64_R_TYPE (reloc->r_info);
+
+#if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
+  if (__builtin_expect (r_type == R_X86_64_RELATIVE, 0))
+    {
+# if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
+      /* This is defined in rtld.c, but nowhere in the static libc.a;
+	 make the reference weak so static programs can still link.
+	 This declaration cannot be done when compiling rtld.c
+	 (i.e. #ifdef RTLD_BOOTSTRAP) because rtld.c contains the
+	 common defn for _dl_rtld_map, which is incompatible with a
+	 weak decl in the same file.  */
+      weak_extern (_dl_rtld_map);
+      if (map != &_dl_rtld_map) /* Already done in rtld itself.  */
+# endif
+	*reloc_addr = map->l_addr + reloc->r_addend;
+    }
+  else
+#endif
+  if (__builtin_expect (r_type == R_X86_64_NONE, 0))
+    return;
+  else
+    {
+#ifndef RTLD_BOOTSTRAP
+      const Elf64_Sym *const refsym = sym;
+#endif
+      Elf64_Addr value = RESOLVE (&sym, version, r_type);
+      if (sym)
+	value += sym->st_value;
+
+#ifdef RTLD_BOOTSTRAP
+      assert (r_type == R_X86_64_GLOB_DAT || r_type == R_X86_64_JUMP_SLOT);
+      *reloc_addr = value + reloc->r_addend;
+#else
+      switch (r_type)
+	{
+	case R_X86_64_GLOB_DAT:
+	case R_X86_64_JUMP_SLOT:
+	  *reloc_addr = value + reloc->r_addend;
+	  break;
+	case R_X86_64_64:
+	  *reloc_addr = value + reloc->r_addend;
+	  break;
+	case R_X86_64_32:
+	  *(unsigned int *) reloc_addr = value + reloc->r_addend;
+	  break;
+	case R_X86_64_PC32:
+	  *(unsigned int *) reloc_addr = value + reloc->r_addend
+	    - (Elf64_Addr) reloc_addr;
+	  break;
+	case R_X86_64_COPY:
+	  if (sym == NULL)
+	    /* This can happen in trace mode if an object could not be
+	       found.  */
+	    break;
+	  if (__builtin_expect (sym->st_size > refsym->st_size, 0)
+	      || (__builtin_expect (sym->st_size < refsym->st_size, 0)
+		  && _dl_verbose))
+	    {
+	      const char *strtab;
+
+	      strtab = (const char *) D_PTR (map, l_info[DT_STRTAB]);
+	      _dl_error_printf ("\
+%s: Symbol `%s' has different size in shared object, consider re-linking\n",
+				_dl_argv[0] ?: "<program name unknown>",
+				strtab + refsym->st_name);
+	    }
+	  memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
+						   refsym->st_size));
+	  break;
+	default:
+	  _dl_reloc_bad_type (map, r_type, 0);
+	  break;
+	}
+#endif
+    }
+}
+
+static inline void
+elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
+			   Elf64_Addr *const reloc_addr)
+{
+  assert (ELF64_R_TYPE (reloc->r_info) == R_X86_64_RELATIVE);
+  *reloc_addr = l_addr + reloc->r_addend;
+}
+
+static inline void
+elf_machine_lazy_rel (struct link_map *map,
+		      Elf64_Addr l_addr, const Elf64_Rela *reloc)
+{
+  Elf64_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset);
+  const unsigned long int r_type = ELF64_R_TYPE (reloc->r_info);
+
+  /* Check for unexpected PLT reloc type.  */
+  if (__builtin_expect (r_type == R_X86_64_JUMP_SLOT, 1))
+    *reloc_addr += l_addr;
+  else
+    _dl_reloc_bad_type (map, r_type, 1);
+}
+
+#endif /* RESOLVE */
diff --git a/sysdeps/x86_64/elf/initfini.c b/sysdeps/x86_64/elf/initfini.c
new file mode 100644
index 0000000000..b0638aca2f
--- /dev/null
+++ b/sysdeps/x86_64/elf/initfini.c
@@ -0,0 +1,100 @@
+/* Special .init and .fini section support for x86-64.
+   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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   In addition to the permissions in the GNU Lesser General Public
+   License, the Free Software Foundation gives you unlimited
+   permission to link the compiled version of this file with other
+   programs, and to distribute those programs without any restriction
+   coming from the use of this file.  (The GNU Lesser General Public
+   License restrictions do apply in other respects; for example, they
+   cover modification of the file, and distribution when not linked
+   into another program.)
+
+   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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* This file is compiled into assembly code which is then munged by a sed
+   script into two files: crti.s and crtn.s.
+
+   * crti.s puts a function prologue at the beginning of the
+   .init and .fini sections and defines global symbols for
+   those addresses, so they can be called as functions.
+
+   * crtn.s puts the corresponding function epilogues
+   in the .init and .fini sections. */
+
+__asm__ ("\n\
+#include \"defs.h\"\n\
+\n\
+/*@HEADER_ENDS*/\n\
+\n\
+/*@_init_PROLOG_BEGINS*/\n\
+	.align 4\n\
+	.type	call_gmon_start,@function\n\
+call_gmon_start:\n\
+	subq	$8, %rsp\n\
+	movq	__gmon_start__@GOTPCREL(%rip), %rax\n\
+	testq	%rax, %rax\n\
+	je	.L22\n\
+	call	*%rax\n\
+.L22:\n\
+	addq	$8, %rsp\n\
+	ret\n\
+\n\
+	.section .init\n\
+	.align 4\n\
+.globl _init\n\
+	.type	_init,@function\n\
+_init:\n\
+	subq	$8, %rsp\n\
+	/* call	call_gmon_start */\n\
+	ALIGN\n\
+	END_INIT\n\
+\n\
+/*@_init_PROLOG_ENDS*/\n\
+\n\
+/*@_init_EPILOG_BEGINS*/\n\
+	.section .init\n\
+	addq	$8, %rsp\n\
+	ret\n\
+	END_INIT\n\
+\n\
+/*@_init_EPILOG_ENDS*/\n\
+\n\
+/*@_fini_PROLOG_BEGINS*/\n\
+	.section .fini\n\
+	.align 4\n\
+.globl _fini\n\
+	.type	_fini,@function\n\
+_fini:\n\
+	subq	$8, %rsp\n\
+	ALIGN\n\
+	END_FINI\n\
+\n\
+/*@_fini_PROLOG_ENDS*/\n\
+	call	i_am_not_a_leaf@PLT\n\
+\n\
+/*@_fini_EPILOG_BEGINS*/\n\
+	.section .fini\n\
+	addq	$8, %rsp\n\
+	ret\n\
+	END_FINI\n\
+\n\
+/*@_fini_EPILOG_ENDS*/\n\
+\n\
+/*@TRAILER_BEGINS*/\n\
+	.weak	__gmon_start__\n\
+");
diff --git a/sysdeps/x86_64/elf/start.S b/sysdeps/x86_64/elf/start.S
new file mode 100644
index 0000000000..600aaf2566
--- /dev/null
+++ b/sysdeps/x86_64/elf/start.S
@@ -0,0 +1,95 @@
+/* Startup code compliant to the ELF x86-64 ABI.
+   Copyright (C) 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Andreas Jaeger <aj@suse.de>, 2001.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* This is the canonical entry point, usually the first thing in the text
+   segment.  The SVR4/i386 ABI (pages 3-31, 3-32) says that when the entry
+   point runs, most registers' values are unspecified, except for:
+
+   %rdx		Contains a function pointer to be registered with `atexit'.
+		This is how the dynamic linker arranges to have DT_FINI
+		functions called for shared libraries that have been loaded
+		before this code runs.
+
+   %rsp		The stack contains the arguments and environment:
+		0(%rsp)			argc
+		8(%rsp)			argv[0]
+		...
+		(8*argc)(%rsp)		NULL
+		(8*(argc+1))(%rsp)	envp[0]
+		...
+					NULL
+*/
+
+#include "bp-sym.h"
+
+	.text
+	.globl _start
+	.type _start,@function
+_start:
+	/* Clear the frame pointer.  The ABI suggests this be done, to mark
+	   the outermost frame obviously.  */
+	xorq %rbp, %rbp
+
+	/* Extract the arguments as encoded on the stack and set up
+	   the arguments for __libc_start_main (int (*main) (int, char **, char **),
+		   int argc, char *argv,
+		   void (*init) (void), void (*fini) (void),
+		   void (*rtld_fini) (void), void *stack_end).
+	   The arguments are passed via registers and on the stack:
+	main:		%rdi
+	argc:		%rsi
+	argv:		%rdx
+	init:		%rcx
+	fini:		%r8
+	rtld_fini:	%r9
+	stack_end:	stack.	*/
+
+	movq %rdx, %r9		/* Address of the shared library termination
+				   function.  */
+	popq %rsi		/* Pop the argument count.  */
+	movq %rsp, %rdx		/* argv starts just at the current stack top.  */
+	/* Align the stack to a 16 byte boundary to follow the ABI.  */
+	andq  $~15, %rsp
+
+	pushq %rax		/* Push garbage because we push 8 more bytes.  */
+
+	/* Provide the highest stack address to the user code (for stacks
+	   which grow downwards).  */
+	pushq %rsp
+
+	/* Pass address of our own entry points to .fini and .init.  */
+	movq $_fini, %r8
+	movq $_init, %rcx
+
+	movq $BP_SYM (main), %rdi
+
+	/* Call the user's main function, and exit with its value.
+	   But let the libc call main.	  */
+	call BP_SYM (__libc_start_main)
+
+	hlt			/* Crash if somehow `exit' does return.	 */
+
+/* Define a symbol for the first piece of initialized data.  */
+	.data
+	.globl __data_start
+__data_start:
+	.long 0
+	.weak data_start
+	data_start = __data_start
diff --git a/sysdeps/x86_64/ffs.c b/sysdeps/x86_64/ffs.c
new file mode 100644
index 0000000000..791e6ead70
--- /dev/null
+++ b/sysdeps/x86_64/ffs.c
@@ -0,0 +1,38 @@
+/* ffs -- find first set bit in a word, counted from least significant end.
+   For AMD x86-64.
+   This file is part of the GNU C Library.
+   Copyright (C) 1991,92,93,94,97,98,2001 Free Software Foundation, Inc.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <string.h>
+
+#undef	ffs
+
+int
+__ffs (int x)
+{
+  int cnt;
+  int tmp;
+
+  asm ("bsfl %2,%0\n"		/* Count low bits in X and store in %1.  */
+       "cmovel %1,%0\n"		/* If number was zero, use -1 as result.  */
+       : "=&r" (cnt), "=r" (tmp) : "rm" (x), "1" (-1));
+
+  return cnt + 1;
+}
+weak_alias (__ffs, ffs)
diff --git a/sysdeps/x86_64/ffsll.c b/sysdeps/x86_64/ffsll.c
new file mode 100644
index 0000000000..7213c0363b
--- /dev/null
+++ b/sysdeps/x86_64/ffsll.c
@@ -0,0 +1,41 @@
+/* ffsll -- find first set bit in a word, counted from least significant end.
+   For AMD x86-64.
+   This file is part of the GNU C Library.
+   Copyright (C) 1991,92,93,94,97,98,2001 Free Software Foundation, Inc.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define ffsl __something_else
+#include <string.h>
+
+#undef	ffsll
+
+int
+ffsll (long long int x)
+{
+  long long int cnt;
+  long long int tmp;
+
+  asm ("bsfq %2,%0\n"		/* Count low bits in X and store in %1.  */
+       "cmoveq %1,%0\n"		/* If number was zero, use -1 as result.  */
+       : "=&r" (cnt), "=r" (tmp) : "rm" (x), "1" (-1));
+
+  return cnt + 1;
+}
+
+#undef	ffsl
+weak_alias (ffsll, ffsl)
diff --git a/sysdeps/x86_64/fpu/bits/fenv.h b/sysdeps/x86_64/fpu/bits/fenv.h
new file mode 100644
index 0000000000..04576933f5
--- /dev/null
+++ b/sysdeps/x86_64/fpu/bits/fenv.h
@@ -0,0 +1,93 @@
+/* Copyright (C) 1997,1998,1999,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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _FENV_H
+# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
+#endif
+
+
+/* Define bits representing the exception.  We use the bit positions
+   of the appropriate bits in the FPU control word.  */
+enum
+  {
+    FE_INVALID = 0x01,
+#define FE_INVALID	FE_INVALID
+    __FE_DENORM = 0x02,
+    FE_DIVBYZERO = 0x04,
+#define FE_DIVBYZERO	FE_DIVBYZERO
+    FE_OVERFLOW = 0x08,
+#define FE_OVERFLOW	FE_OVERFLOW
+    FE_UNDERFLOW = 0x10,
+#define FE_UNDERFLOW	FE_UNDERFLOW
+    FE_INEXACT = 0x20
+#define FE_INEXACT	FE_INEXACT
+  };
+
+#define FE_ALL_EXCEPT \
+	(FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
+
+/* The ix87 FPU supports all of the four defined rounding modes.  We
+   use again the bit positions in the FPU control word as the values
+   for the appropriate macros.  */
+enum
+  {
+    FE_TONEAREST = 0,
+#define FE_TONEAREST	FE_TONEAREST
+    FE_DOWNWARD = 0x400,
+#define FE_DOWNWARD	FE_DOWNWARD
+    FE_UPWARD = 0x800,
+#define FE_UPWARD	FE_UPWARD
+    FE_TOWARDZERO = 0xc00
+#define FE_TOWARDZERO	FE_TOWARDZERO
+  };
+
+
+/* Type representing exception flags.  */
+typedef unsigned short int fexcept_t;
+
+
+/* Type representing floating-point environment.  This structure
+   corresponds to the layout of the block written by the `fstenv'
+   instruction and has additional fields for the contents of the MXCSR
+   register as written by the `stmxcsr' instruction.  */
+typedef struct
+  {
+    unsigned short int __control_word;
+    unsigned short int __unused1;
+    unsigned short int __status_word;
+    unsigned short int __unused2;
+    unsigned short int __tags;
+    unsigned short int __unused3;
+    unsigned int __eip;
+    unsigned short int __cs_selector;
+    unsigned int __opcode:11;
+    unsigned int __unused4:5;
+    unsigned int __data_offset;
+    unsigned short int __data_selector;
+    unsigned short int __unused5;
+    unsigned int __mxcsr;
+  }
+fenv_t;
+
+/* If the default argument is used we use this value.  */
+#define FE_DFL_ENV	((__const fenv_t *) -1)
+
+#ifdef __USE_GNU
+/* Floating-point environment where none of the exception is masked.  */
+# define FE_NOMASK_ENV	((__const fenv_t *) -2)
+#endif
diff --git a/sysdeps/x86_64/fpu/bits/mathdef.h b/sysdeps/x86_64/fpu/bits/mathdef.h
new file mode 100644
index 0000000000..4131d86565
--- /dev/null
+++ b/sysdeps/x86_64/fpu/bits/mathdef.h
@@ -0,0 +1,39 @@
+/* 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#if !defined _MATH_H && !defined _COMPLEX_H
+# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
+#endif
+
+#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
+# define _MATH_H_MATHDEF	1
+
+/* The x86-64 architecture computes values with the precission of the
+   used type.  */
+typedef float float_t;		/* `float' expressions are evaluated as `float'.  */
+typedef double double_t;	/* `double' expressions are evaluated
+				   as `double'.  */
+
+/* Define `INFINITY' as value of type `float'.  */
+# define INFINITY	HUGE_VALF
+
+/* The values returned by `ilogb' for 0 and NaN respectively.  */
+# define FP_ILOGB0	(-2147483647 - 1)
+# define FP_ILOGBNAN	(-2147483647 - 1)
+
+#endif	/* ISO C99 */
diff --git a/sysdeps/x86_64/fpu/e_acosl.c b/sysdeps/x86_64/fpu/e_acosl.c
new file mode 100644
index 0000000000..1ef6d3c94a
--- /dev/null
+++ b/sysdeps/x86_64/fpu/e_acosl.c
@@ -0,0 +1 @@
+#include "sysdeps/i386/fpu/e_acosl.c"
diff --git a/sysdeps/x86_64/fpu/e_atan2l.c b/sysdeps/x86_64/fpu/e_atan2l.c
new file mode 100644
index 0000000000..bbd549f307
--- /dev/null
+++ b/sysdeps/x86_64/fpu/e_atan2l.c
@@ -0,0 +1,2 @@
+#include "sysdeps/i386/fpu/e_atan2l.c"
+
diff --git a/sysdeps/x86_64/fpu/e_exp2l.S b/sysdeps/x86_64/fpu/e_exp2l.S
new file mode 100644
index 0000000000..336b989098
--- /dev/null
+++ b/sysdeps/x86_64/fpu/e_exp2l.S
@@ -0,0 +1,38 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Adapted for exp2 by Ulrich Drepper <drepper@cygnus.com>.
+ * Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
+ * Public domain.
+ */
+
+#include <machine/asm.h>
+
+ENTRY(__ieee754_exp2l)
+	fldt	8(%rsp)
+/* I added the following ugly construct because exp(+-Inf) resulted
+   in NaN.  The ugliness results from the bright minds at Intel.
+   For the i686 the code can be written better.
+   -- drepper@cygnus.com.  */
+	fxam				/* Is NaN or +-Inf?  */
+	fstsw	%ax
+	movb	$0x45, %dh
+	andb	%ah, %dh
+	cmpb	$0x05, %dh
+	je	1f			/* Is +-Inf, jump.  */
+	fld	%st
+	frndint				/* int(x) */
+	fsubr	%st,%st(1)		/* fract(x) */
+	fxch
+	f2xm1				/* 2^(fract(x)) - 1 */
+	fld1
+	faddp				/* 2^(fract(x)) */
+	fscale				/* e^x */
+	fstp	%st(1)
+	ret
+
+1:	testl	$0x200, %eax		/* Test sign.  */
+	jz	2f			/* If positive, jump.  */
+	fstp	%st
+	fldz				/* Set result to 0.  */
+2:	ret
+END (__ieee754_exp2l)
diff --git a/sysdeps/x86_64/fpu/e_expl.c b/sysdeps/x86_64/fpu/e_expl.c
new file mode 100644
index 0000000000..5042e02db9
--- /dev/null
+++ b/sysdeps/x86_64/fpu/e_expl.c
@@ -0,0 +1 @@
+#include "sysdeps/i386/fpu/e_expl.c"
diff --git a/sysdeps/x86_64/fpu/e_fmodl.S b/sysdeps/x86_64/fpu/e_fmodl.S
new file mode 100644
index 0000000000..2967bf224b
--- /dev/null
+++ b/sysdeps/x86_64/fpu/e_fmodl.S
@@ -0,0 +1,22 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ * Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+ENTRY(__ieee754_fmodl)
+	fldt	24(%rsp)
+	fldt	8(%rsp)
+1:	fprem
+	fstsw	%ax
+	and	$04,%ah
+	jnz	1b
+	fstp	%st(1)
+	ret
+END (__ieee754_fmodl)
diff --git a/sysdeps/x86_64/fpu/e_log10l.S b/sysdeps/x86_64/fpu/e_log10l.S
new file mode 100644
index 0000000000..b4343bef45
--- /dev/null
+++ b/sysdeps/x86_64/fpu/e_log10l.S
@@ -0,0 +1,66 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ *
+ * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
+ * Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+#ifdef __ELF__
+	.section .rodata
+#else
+	.text
+#endif
+	.align ALIGNARG(4)
+	ASM_TYPE_DIRECTIVE(one,@object)
+one:	.double 1.0
+	ASM_SIZE_DIRECTIVE(one)
+	/* It is not important that this constant is precise.  It is only
+	   a value which is known to be on the safe side for using the
+	   fyl2xp1 instruction.  */
+	ASM_TYPE_DIRECTIVE(limit,@object)
+limit:	.double 0.29
+	ASM_SIZE_DIRECTIVE(limit)
+
+
+#ifdef PIC
+#define MO(op) op##(%rip)
+#else
+#define MO(op) op
+#endif
+
+	.text
+ENTRY(__ieee754_log10l)
+	fldlg2			// log10(2)
+	fldt	8(%rsp)		// x : log10(2)
+	fxam
+	fnstsw
+	fld	%st		// x : x : log10(2)
+	andb	$1,%ah
+	jnz	3f		// in case x is NaN or ħInf
+4:	fsubl	MO(one)		// x-1 : x : log10(2)
+	fld	%st		// x-1 : x-1 : x : log10(2)
+	fabs			// |x-1| : x-1 : x : log10(2)
+	fcompl	MO(limit)	// x-1 : x : log10(2)
+	fnstsw			// x-1 : x : log10(2)
+	andb	$0x45, %ah
+	jz	2f
+	fstp	%st(1)		// x-1 : log10(2)
+	fyl2xp1			// log10(x)
+	ret
+
+2:	fstp	%st(0)		// x : log10(2)
+	fyl2x			// log10(x)
+	ret
+
+3:	jp	4b		// in case x is ħInf
+	fstp	%st(1)
+	fstp	%st(1)
+	ret
+END(__ieee754_log10l)
diff --git a/sysdeps/x86_64/fpu/e_log2l.S b/sysdeps/x86_64/fpu/e_log2l.S
new file mode 100644
index 0000000000..7a89b94d9f
--- /dev/null
+++ b/sysdeps/x86_64/fpu/e_log2l.S
@@ -0,0 +1,63 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Adapted for use as log2 by Ulrich Drepper <drepper@cygnus.com>.
+ * Public domain.
+ *
+ * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
+ * Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
+ */
+
+#include <machine/asm.h>
+
+#ifdef __ELF__
+	.section .rodata
+#else
+	.text
+#endif
+	.align ALIGNARG(4)
+	ASM_TYPE_DIRECTIVE(one,@object)
+one:	.double 1.0
+	ASM_SIZE_DIRECTIVE(one)
+	/* It is not important that this constant is precise.  It is only
+	   a value which is known to be on the safe side for using the
+	   fyl2xp1 instruction.  */
+	ASM_TYPE_DIRECTIVE(limit,@object)
+limit:	.double 0.29
+	ASM_SIZE_DIRECTIVE(limit)
+
+
+#ifdef PIC
+#define MO(op) op##(%rip)
+#else
+#define MO(op) op
+#endif
+
+	.text
+ENTRY(__ieee754_log2l)
+	fldl	MO(one)
+	fldt	8(%rsp)		// x : 1
+	fxam
+	fnstsw
+	fld	%st		// x : x : 1
+	andb	$1,%ah
+	jnz	3f		// in case x is NaN or ħInf
+4:	fsub	%st(2), %st	// x-1 : x : 1
+	fld	%st		// x-1 : x-1 : x : 1
+	fabs			// |x-1| : x-1 : x : 1
+	fcompl	MO(limit)	// x-1 : x : 1
+	fnstsw			// x-1 : x : 1
+	andb	$0x45, %ah
+	jz	2f
+	fstp	%st(1)		// x-1 : 1
+	fyl2xp1			// log(x)
+	ret
+
+2:	fstp	%st(0)		// x : 1
+	fyl2x			// log(x)
+	ret
+
+3:	jp	4b		// in case x is ħInf
+	fstp	%st(1)
+	fstp	%st(1)
+	ret
+END (__ieee754_log2l)
diff --git a/sysdeps/x86_64/fpu/e_logl.S b/sysdeps/x86_64/fpu/e_logl.S
new file mode 100644
index 0000000000..a0bed663c8
--- /dev/null
+++ b/sysdeps/x86_64/fpu/e_logl.S
@@ -0,0 +1,56 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ * Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+
+#ifdef __ELF__
+	.section .rodata
+#else
+	.text
+#endif
+	.align ALIGNARG(4)
+	ASM_TYPE_DIRECTIVE(one,@object)
+one:	.double 1.0
+	ASM_SIZE_DIRECTIVE(one)
+	/* It is not important that this constant is precise.  It is only
+	   a value which is known to be on the safe side for using the
+	   fyl2xp1 instruction.  */
+	ASM_TYPE_DIRECTIVE(limit,@object)
+limit:	.double 0.29
+	ASM_SIZE_DIRECTIVE(limit)
+
+
+#ifdef PIC
+#define MO(op) op##(%rip)
+#else
+#define MO(op) op
+#endif
+
+	.text
+ENTRY(__ieee754_logl)
+	fldln2			// log(2)
+	fldt	8(%rsp)		// x : log(2)
+	fld	%st		// x : x : log(2)
+	fsubl	MO(one)		// x-1 : x : log(2)
+	fld	%st		// x-1 : x-1 : x : log(2)
+	fabs			// |x-1| : x-1 : x : log(2)
+	fcompl	MO(limit)	// x-1 : x : log(2)
+	fnstsw			// x-1 : x : log(2)
+	andb	$0x45, %ah
+	jz	2f
+	fstp	%st(1)		// x-1 : log(2)
+	fyl2xp1			// log(x)
+	ret
+
+2:	fstp	%st(0)		// x : log(2)
+	fyl2x			// log(x)
+	ret
+END (__ieee754_logl)
diff --git a/sysdeps/x86_64/fpu/e_powl.S b/sysdeps/x86_64/fpu/e_powl.S
new file mode 100644
index 0000000000..8c690e16cc
--- /dev/null
+++ b/sysdeps/x86_64/fpu/e_powl.S
@@ -0,0 +1,316 @@
+/* ix87 specific implementation of pow function.
+   Copyright (C) 1996, 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <machine/asm.h>
+
+#ifdef __ELF__
+	.section .rodata
+#else
+	.text
+#endif
+
+	.align ALIGNARG(4)
+	ASM_TYPE_DIRECTIVE(infinity,@object)
+inf_zero:
+infinity:
+	.byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f
+	ASM_SIZE_DIRECTIVE(infinity)
+	ASM_TYPE_DIRECTIVE(zero,@object)
+zero:	.double 0.0
+	ASM_SIZE_DIRECTIVE(zero)
+	ASM_TYPE_DIRECTIVE(minf_mzero,@object)
+minf_mzero:
+minfinity:
+	.byte 0, 0, 0, 0, 0, 0, 0xf0, 0xff
+mzero:
+	.byte 0, 0, 0, 0, 0, 0, 0, 0x80
+	ASM_SIZE_DIRECTIVE(minf_mzero)
+	ASM_TYPE_DIRECTIVE(one,@object)
+one:	.double 1.0
+	ASM_SIZE_DIRECTIVE(one)
+	ASM_TYPE_DIRECTIVE(limit,@object)
+limit:	.double 0.29
+	ASM_SIZE_DIRECTIVE(limit)
+
+#ifdef PIC
+#define MO(op) op##(%rip)
+#else
+#define MO(op) op
+#endif
+
+	.text
+ENTRY(__ieee754_powl)
+	fldt	24(%rsp)	// y
+	fxam
+
+
+	fnstsw
+	movb	%ah, %dl
+	andb	$0x45, %ah
+	cmpb	$0x40, %ah	// is y == 0 ?
+	je	11f
+
+	cmpb	$0x05, %ah	// is y == ħinf ?
+	je	12f
+
+	cmpb	$0x01, %ah	// is y == NaN ?
+	je	30f
+
+	fldt	8(%rsp)		// x : y
+
+	fxam
+	fnstsw
+	movb	%ah, %dh
+	andb	$0x45, %ah
+	cmpb	$0x40, %ah
+	je	20f		// x is ħ0
+
+	cmpb	$0x05, %ah
+	je	15f		// x is ħinf
+
+	fxch			// y : x
+
+	/* First see whether `y' is a natural number.  In this case we
+	   can use a more precise algorithm.  */
+	fld	%st		// y : y : x
+	fistpll	-8(%rsp)	// y : x
+	fildll	-8(%rsp)	// int(y) : y : x
+	fucomip	%st(1),%st	// y : x
+	jne	2f
+
+	/* OK, we have an integer value for y.  */
+	mov	-8(%rsp),%eax
+	mov	-4(%rsp),%edx
+	orl	$0, %edx
+	fstp	%st(0)		// x
+	jns	4f		// y >= 0, jump
+	fdivrl	MO(one)		// 1/x		(now referred to as x)
+	negl	%eax
+	adcl	$0, %edx
+	negl	%edx
+4:	fldl	MO(one)		// 1 : x
+	fxch
+
+6:	shrdl	$1, %edx, %eax
+	jnc	5f
+	fxch
+	fmul	%st(1)		// x : ST*x
+	fxch
+5:	fmul	%st(0), %st	// x*x : ST*x
+	shrl	$1, %edx
+	movl	%eax, %ecx
+	orl	%edx, %ecx
+	jnz	6b
+	fstp	%st(0)		// ST*x
+	ret
+
+	/* y is ħNAN */
+30:	fldt	8(%rsp)		// x : y
+	fldl	MO(one)		// 1.0 : x : y
+	fucomip	%st(1),%st	// x : y
+	je	31f
+	fxch			// y : x
+31:	fstp	%st(1)
+	ret
+
+	.align ALIGNARG(4)
+2:	/* y is a real number.  */
+	fxch			// x : y
+	fldl	MO(one)		// 1.0 : x : y
+	fld	%st(1)		// x : 1.0 : x : y
+	fsub	%st(1)		// x-1 : 1.0 : x : y
+	fabs			// |x-1| : 1.0 : x : y
+	fcompl	MO(limit)	// 1.0 : x : y
+	fnstsw
+	fxch			// x : 1.0 : y
+	test	$4500,%eax
+	jz	7f
+	fsub	%st(1)		// x-1 : 1.0 : y
+	fyl2xp1			// log2(x) : y
+	jmp	8f
+
+7:	fyl2x			// log2(x) : y
+8:	fmul	%st(1)		// y*log2(x) : y
+	fst	%st(1)		// y*log2(x) : y*log2(x)
+	frndint			// int(y*log2(x)) : y*log2(x)
+	fsubr	%st, %st(1)	// int(y*log2(x)) : fract(y*log2(x))
+	fxch			// fract(y*log2(x)) : int(y*log2(x))
+	f2xm1			// 2^fract(y*log2(x))-1 : int(y*log2(x))
+	faddl	MO(one)		// 2^fract(y*log2(x)) : int(y*log2(x))
+	fscale			// 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x))
+	fstp	%st(1)		// 2^fract(y*log2(x))*2^int(y*log2(x))
+	ret
+
+
+	// pow(x,ħ0) = 1
+	.align ALIGNARG(4)
+11:	fstp	%st(0)		// pop y
+	fldl	MO(one)
+	ret
+
+	// y == ħinf
+	.align ALIGNARG(4)
+12:	fstp	%st(0)		// pop y
+	fldt	8(%rsp)		// x
+	fabs
+	fcompl	MO(one)		// < 1, == 1, or > 1
+	fnstsw
+	andb	$0x45, %ah
+	cmpb	$0x45, %ah
+	je	13f		// jump if x is NaN
+
+	cmpb	$0x40, %ah
+	je	14f		// jump if |x| == 1
+
+	shlb	$1, %ah
+	xorb	%ah, %dl
+	andl	$2, %edx
+#ifdef PIC
+	lea	inf_zero(%rip),%rcx
+	fldl	(%rcx, %rdx, 4)
+#else
+	fldl	inf_zero(,%rdx, 4)
+#endif
+	ret
+
+	.align ALIGNARG(4)
+14:	fldl	MO(one)
+	ret
+
+	.align ALIGNARG(4)
+13:	fldt	8(%rsp)		// load x == NaN
+	ret
+
+	.align ALIGNARG(4)
+	// x is ħinf
+15:	fstp	%st(0)		// y
+	testb	$2, %dh
+	jz	16f		// jump if x == +inf
+
+	// We must find out whether y is an odd integer.
+	fld	%st		// y : y
+	fistpll	-8(%rsp)	// y
+	fildll	-8(%rsp)	// int(y) : y
+	fucomip %st(1),%st
+	ffreep	%st		// <empty>
+	jne	17f
+
+	// OK, the value is an integer, but is it odd?
+	mov	-8(%rsp), %eax
+	mov	-4(%rsp), %edx
+	andb	$1, %al
+	jz	18f		// jump if not odd
+	// It's an odd integer.
+	shrl	$31, %edx
+#ifdef PIC
+	lea	minf_mzero(%rip),%rcx
+	fldl	(%rcx, %rdx, 8)
+#else
+	fldl	minf_mzero(,%rdx, 8)
+#endif
+	ret
+
+	.align ALIGNARG(4)
+16:	fcompl	MO(zero)
+	fnstsw
+	shrl	$5, %eax
+	andl	$8, %eax
+#ifdef PIC
+	lea	inf_zero(%rip),%rcx
+	fldl	(%rcx, %rax, 1)
+#else
+	fldl	inf_zero(,%rax, 1)
+#endif
+	ret
+
+	.align ALIGNARG(4)
+17:	shll	$30, %edx	// sign bit for y in right position
+18:	shrl	$31, %edx
+#ifdef PIC
+	lea	inf_zero(%rip),%rcx
+	fldl	(%rcx, %rdx, 8)
+#else
+	fldl	inf_zero(,%rdx, 8)
+#endif
+	ret
+
+	.align ALIGNARG(4)
+	// x is ħ0
+20:	fstp	%st(0)		// y
+	testb	$2, %dl
+	jz	21f		// y > 0
+
+	// x is ħ0 and y is < 0.  We must find out whether y is an odd integer.
+	testb	$2, %dh
+	jz	25f
+
+	fld	%st		// y : y
+	fistpll	-8(%rsp)	// y
+	fildll	-8(%rsp)	// int(y) : y
+	fucomip	%st(1),%st
+	ffreep	%st		// <empty>
+	jne	26f
+
+	// OK, the value is an integer, but is it odd?
+	mov	-8(%rsp),%eax
+	mov	-4(%rsp),%edx
+	andb	$1, %al
+	jz	27f		// jump if not odd
+	// It's an odd integer.
+	// Raise divide-by-zero exception and get minus infinity value.
+	fldl	MO(one)
+	fdivl	MO(zero)
+	fchs
+	ret
+
+25:	fstp	%st(0)
+26:
+27:	// Raise divide-by-zero exception and get infinity value.
+	fldl	MO(one)
+	fdivl	MO(zero)
+	ret
+
+	.align ALIGNARG(4)
+	// x is ħ0 and y is > 0.  We must find out whether y is an odd integer.
+21:	testb	$2, %dh
+	jz	22f
+
+	fld	%st		// y : y
+	fistpll	-8(%rsp)	// y
+	fildll	-8(%rsp)	// int(y) : y
+	fucomip %st(1),%st
+	ffreep	%st		// <empty>
+	jne	23f
+
+	// OK, the value is an integer, but is it odd?
+	mov	-8(%rsp),%eax
+	mov	-4(%rsp),%edx
+	andb	$1, %al
+	jz	24f		// jump if not odd
+	// It's an odd integer.
+	fldl	MO(mzero)
+	ret
+
+22:	fstp	%st(0)
+23:
+24:	fldl	MO(zero)
+	ret
+
+END(__ieee754_powl)
diff --git a/sysdeps/x86_64/fpu/e_rem_pio2l.c b/sysdeps/x86_64/fpu/e_rem_pio2l.c
new file mode 100644
index 0000000000..1347b0468c
--- /dev/null
+++ b/sysdeps/x86_64/fpu/e_rem_pio2l.c
@@ -0,0 +1,3 @@
+/* Empty.  This file is only meant to avoid compiling the file with the
+   same name in the libm-ieee754 directory.  The code is not used since
+   there is an assembler version for all users of this file.  */
diff --git a/sysdeps/x86_64/fpu/e_scalbl.S b/sysdeps/x86_64/fpu/e_scalbl.S
new file mode 100644
index 0000000000..6b229705ba
--- /dev/null
+++ b/sysdeps/x86_64/fpu/e_scalbl.S
@@ -0,0 +1,100 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ * Adapted for x86-64 by Andreas Jaeger <aj@suse.de>
+ *
+ * Correct handling of y==-inf <drepper@gnu>
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+#ifdef __ELF__
+	.section .rodata
+#else
+	.text
+#endif
+
+	.align ALIGNARG(4)
+	ASM_TYPE_DIRECTIVE(zero_nan,@object)
+zero_nan:
+	.double 0.0
+nan:	.byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
+minus_zero:
+	.byte 0, 0, 0, 0, 0, 0, 0, 0x80
+	.byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
+	ASM_SIZE_DIRECTIVE(zero_nan)
+
+
+#ifdef PIC
+#define MO(op) op##(%rip)
+#else
+#define MO(op) op
+#endif
+
+	.text
+ENTRY(__ieee754_scalbl)
+	fldt	24(%rsp)
+	fxam
+	fnstsw
+	fldt	8(%rsp)
+	andl	$0x4700, %eax
+	cmpl	$0x0700, %eax
+	je	1f
+	andl	$0x4500, %eax
+	cmpl	$0x0100, %eax
+	je	2f
+	fxam
+	fnstsw
+	andl	$0x4500, %eax
+	cmpl	$0x0100, %eax
+	je	3f
+	fld	%st(1)
+	frndint
+	fcomip	%st(2), %st
+	jne	4f
+	fscale
+	fstp	%st(1)
+	ret
+
+	/* y is -inf */
+1:	fxam
+	fnstsw
+	movl	16(%rsp), %edx
+	shrl	$5, %eax
+	fstp	%st
+	fstp	%st
+	andl	$0x8000, %edx
+	andl	$8, %eax
+	jnz	4f
+	shrl	$11, %edx
+	addl	%edx, %eax
+#ifdef PIC
+	lea	zero_nan(%rip),%rdx
+	fldl	(%rdx,%rax,1)
+#else
+	fldl	zero_nan(%rax, 1)
+#endif
+	ret
+
+	/* The result is NaN, but we must not raise an exception.
+	   So use a variable.  */
+2:	fstp	%st
+	fstp	%st
+	fldl	MO(nan)
+	ret
+
+	/* The first parameter is a NaN.  Return it.  */
+3:	fstp	%st(1)
+	ret
+
+	/* Return NaN and raise the invalid exception.  */
+4:	fstp	%st
+	fstp	%st
+	fldz
+	fdiv	%st
+	ret
+END(__ieee754_scalbl)
diff --git a/sysdeps/x86_64/fpu/e_sqrtl.c b/sysdeps/x86_64/fpu/e_sqrtl.c
new file mode 100644
index 0000000000..90e4e164e5
--- /dev/null
+++ b/sysdeps/x86_64/fpu/e_sqrtl.c
@@ -0,0 +1 @@
+#include "sysdeps/i386/fpu/e_sqrtl.c"
diff --git a/sysdeps/x86_64/fpu/fclrexcpt.c b/sysdeps/x86_64/fpu/fclrexcpt.c
new file mode 100644
index 0000000000..4fc3bfbdc7
--- /dev/null
+++ b/sysdeps/x86_64/fpu/fclrexcpt.c
@@ -0,0 +1,52 @@
+/* Clear given exceptions in current floating-point environment.
+   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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <fenv.h>
+
+int
+feclearexcept (int excepts)
+{
+  fenv_t temp;
+  unsigned int mxcsr;
+
+  /* Mask out unsupported bits/exceptions.  */
+  excepts &= FE_ALL_EXCEPT;
+
+  /* Bah, we have to clear selected exceptions.  Since there is no
+     `fldsw' instruction we have to do it the hard way.  */
+  __asm__ ("fnstenv %0" : "=m" (*&temp));
+
+  /* Clear the relevant bits.  */
+  temp.__status_word &= excepts ^ FE_ALL_EXCEPT;
+
+  /* Put the new data in effect.  */
+  __asm__ ("fldenv %0" : : "m" (*&temp));
+
+  /* And the same procedure for SSE.  */
+  __asm__ ("stmxcsr %0" : "=m" (*&mxcsr));
+
+  /* Clear the relevant bits.  */
+  mxcsr &= ~excepts;
+
+  /* And put them into effect.  */
+  __asm__ ("ldmxcsr %0" : : "m" (*&mxcsr));
+
+  /* Success.  */
+  return 0;
+}
diff --git a/sysdeps/x86_64/fpu/fedisblxcpt.c b/sysdeps/x86_64/fpu/fedisblxcpt.c
new file mode 100644
index 0000000000..e8157da126
--- /dev/null
+++ b/sysdeps/x86_64/fpu/fedisblxcpt.c
@@ -0,0 +1,49 @@
+/* Disable floating-point exceptions.
+   Copyright (C) 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Andreas Jaeger <aj@suse.de>, 2001.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <fenv.h>
+
+int
+fedisableexcept (int excepts)
+{
+  unsigned short int new_exc, old_exc;
+  unsigned int new, old;
+
+  excepts &= FE_ALL_EXCEPT;
+
+  /* Get the current control word of the x87 FPU.  */
+  __asm__ ("fstcw %0" : "=m" (*&new_exc));
+
+  old_exc = (~new_exc) & FE_ALL_EXCEPT;
+
+  new_exc |= excepts;
+  __asm__ ("fldcw %0" : : "m" (*&new_exc));
+
+  /* And now the same for the SSE MXCSR register.  */
+  __asm__ ("stmxcsr %0" : "=m" (*&new));
+
+  /* The SSE exception masks are shifted by 7 bits.  */
+  old = (~new) & (FE_ALL_EXCEPT << 7);
+
+  new |= excepts << 7;
+  __asm__ ("ldmxcsr %0" : : "m" (*&new));
+
+  return old_exc;
+}
diff --git a/sysdeps/x86_64/fpu/feenablxcpt.c b/sysdeps/x86_64/fpu/feenablxcpt.c
new file mode 100644
index 0000000000..43259d0cfb
--- /dev/null
+++ b/sysdeps/x86_64/fpu/feenablxcpt.c
@@ -0,0 +1,49 @@
+/* Enable floating-point exceptions.
+   Copyright (C) 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Andreas Jaeger <aj@suse.de>, 2001.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <fenv.h>
+
+int
+feenableexcept (int excepts)
+{
+  unsigned short int new_exc, old_exc;
+  unsigned int new, old;
+
+  excepts &= FE_ALL_EXCEPT;
+
+  /* Get the current control word of the x87 FPU.  */
+  __asm__ ("fstcw %0" : "=m" (*&new_exc));
+
+  old_exc = (~new_exc) & FE_ALL_EXCEPT;
+
+  new_exc &= ~excepts;
+  __asm__ ("fldcw %0" : : "m" (*&new_exc));
+
+  /* And now the same for the SSE MXCSR register.  */
+  __asm__ ("stmxcsr %0" : "=m" (*&new));
+
+  /* The SSE exception masks are shifted by 7 bits.  */
+  old = (~new) & (FE_ALL_EXCEPT << 7);
+
+  new &= ~(excepts << 7);
+  __asm__ ("ldmxcsr %0" : : "m" (*&new));
+
+  return old_exc;
+}
diff --git a/sysdeps/x86_64/fpu/fegetenv.c b/sysdeps/x86_64/fpu/fegetenv.c
new file mode 100644
index 0000000000..fa5a8dadcb
--- /dev/null
+++ b/sysdeps/x86_64/fpu/fegetenv.c
@@ -0,0 +1,30 @@
+/* Store current floating-point environment.
+   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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <fenv.h>
+
+int
+fegetenv (fenv_t *envp)
+{
+  __asm__ ("fnstenv %0\n"
+	   "stmxcsr %1" : "=m" (*envp), "=m" (envp->__mxcsr));
+
+  /* Success.  */
+  return 0;
+}
diff --git a/sysdeps/x86_64/fpu/fegetexcept.c b/sysdeps/x86_64/fpu/fegetexcept.c
new file mode 100644
index 0000000000..04df4b66a2
--- /dev/null
+++ b/sysdeps/x86_64/fpu/fegetexcept.c
@@ -0,0 +1,32 @@
+/* Get enabled floating-point exceptions.
+   Copyright (C) 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Andreas Jaeger <aj@suse.de>, 2001.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <fenv.h>
+
+int
+fegetexcept (void)
+{
+  unsigned short int exc;
+
+  /* Get the current control word.  */
+  __asm__ ("fstcw %0" : "=m" (*&exc));
+
+  return (~exc) & FE_ALL_EXCEPT;
+}
diff --git a/sysdeps/x86_64/fpu/fegetround.c b/sysdeps/x86_64/fpu/fegetround.c
new file mode 100644
index 0000000000..f237b18d1d
--- /dev/null
+++ b/sysdeps/x86_64/fpu/fegetround.c
@@ -0,0 +1,33 @@
+/* Return current rounding direction.
+   Copyright (C) 1997, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <fenv.h>
+
+int
+fegetround (void)
+{
+  int cw;
+  /* We only check the x87 FPU unit.  The SSE unit should be the same
+     - and if it's not the same there's no way to signal it.  */
+
+  __asm__ ("fnstcw %0" : "=m" (*&cw));
+
+  return cw & 0xc00;
+}
diff --git a/sysdeps/x86_64/fpu/feholdexcpt.c b/sysdeps/x86_64/fpu/feholdexcpt.c
new file mode 100644
index 0000000000..db53d0f07f
--- /dev/null
+++ b/sysdeps/x86_64/fpu/feholdexcpt.c
@@ -0,0 +1,41 @@
+/* Store current floating-point environment and clear exceptions.
+   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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <fenv.h>
+
+int
+feholdexcept (fenv_t *envp)
+{
+  unsigned short int work;
+  unsigned int mxcsr;
+
+  /* Store the environment.  */
+  __asm__ ("fnstenv %0\n"
+	   "stmxcsr %1" : "=m" (*envp), "=m" (envp->__mxcsr));
+
+  /* Now set all exceptions to non-stop, first the x87 FPU.  */
+  work = envp->__control_word | 0x3f;
+  __asm__ ("fldcw %0" : : "m" (*&work));
+
+  /* Set the SSE MXCSR register.  */
+  mxcsr = envp->__mxcsr | 0x1f80;
+  __asm__ ("ldmxcsr %0" : : "m" (*&mxcsr));
+
+  return 0;
+}
diff --git a/sysdeps/x86_64/fpu/fesetenv.c b/sysdeps/x86_64/fpu/fesetenv.c
new file mode 100644
index 0000000000..4527b16ed9
--- /dev/null
+++ b/sysdeps/x86_64/fpu/fesetenv.c
@@ -0,0 +1,89 @@
+/* Install given floating-point environment.
+   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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <fenv.h>
+#include <assert.h>
+
+
+int
+fesetenv (const fenv_t *envp)
+{
+  fenv_t temp;
+
+  /* Install the environment specified by ENVP.  But there are a few
+     values which we do not want to come from the saved environment.
+     Therefore, we get the current environment and replace the values
+     we want to use from the environment specified by the parameter.  */
+  __asm__ ("fnstenv %0\n"
+	   "stmxcsr %1" : "=m" (*&temp), "=m" (*&temp.__mxcsr));
+
+  if (envp == FE_DFL_ENV)
+    {
+      temp.__control_word |= FE_ALL_EXCEPT;
+      temp.__control_word &= ~FE_TOWARDZERO;
+      temp.__status_word &= ~FE_ALL_EXCEPT;
+      temp.__eip = 0;
+      temp.__cs_selector = 0;
+      temp.__opcode = 0;
+      temp.__data_offset = 0;
+      temp.__data_selector = 0;
+      /* Set mask for SSE MXCSR.  */
+      temp.__mxcsr |= (FE_ALL_EXCEPT << 7);
+      /* Set rounding to FE_TOWARDZERO.  */
+      temp.__mxcsr &= ~(FE_TOWARDZERO << 3);
+      /* Disable exceptions.  */
+      temp.__mxcsr &= ~FE_ALL_EXCEPT;
+    }
+  else if (envp == FE_NOMASK_ENV)
+    {
+      temp.__control_word &= ~(FE_ALL_EXCEPT | FE_TOWARDZERO);
+      temp.__status_word &= ~FE_ALL_EXCEPT;
+      temp.__eip = 0;
+      temp.__cs_selector = 0;
+      temp.__opcode = 0;
+      temp.__data_offset = 0;
+      temp.__data_selector = 0;
+      /* Set mask for SSE MXCSR.  */
+      temp.__mxcsr &= ~(FE_ALL_EXCEPT << 7);
+      /* Set rounding to FE_TOWARDZERO.  */
+      temp.__mxcsr &= ~(FE_TOWARDZERO << 3);
+      /* Disable exceptions.  */
+      temp.__mxcsr &= ~FE_ALL_EXCEPT;
+    }
+  else
+    {
+      temp.__control_word &= ~(FE_ALL_EXCEPT | FE_TOWARDZERO);
+      temp.__control_word |= (envp->__control_word
+			      & (FE_ALL_EXCEPT | FE_TOWARDZERO));
+      temp.__status_word &= ~FE_ALL_EXCEPT;
+      temp.__status_word |= envp->__status_word & FE_ALL_EXCEPT;
+      temp.__eip = envp->__eip;
+      temp.__cs_selector = envp->__cs_selector;
+      temp.__opcode = envp->__opcode;
+      temp.__data_offset = envp->__data_offset;
+      temp.__data_selector = envp->__data_selector;
+      temp.__mxcsr = envp->__mxcsr;
+    }
+
+  __asm__ ("fldenv %0\n"
+	   "ldmxcsr %1" : : "m" (temp), "m" (temp.__mxcsr));
+
+  /* Success.  */
+  return 0;
+}
diff --git a/sysdeps/x86_64/fpu/fesetround.c b/sysdeps/x86_64/fpu/fesetround.c
new file mode 100644
index 0000000000..429b7f1d0c
--- /dev/null
+++ b/sysdeps/x86_64/fpu/fesetround.c
@@ -0,0 +1,46 @@
+/* Set current rounding direction.
+   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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <fenv.h>
+
+int
+fesetround (int round)
+{
+  unsigned short int cw;
+  int mxcsr;
+
+  if ((round & ~0xc00) != 0)
+    /* ROUND is no valid rounding mode.  */
+    return 1;
+
+  /* First set the x87 FPU.  */
+  asm ("fnstcw %0" : "=m" (*&cw));
+  cw &= ~0xc00;
+  cw |= round;
+  asm ("fldcw %0" : : "m" (*&cw));
+
+  /* And now the MSCSR register for SSE, the precision is at different bit
+     positions in the different units, we need to shift it 3 bits.  */
+  asm ("stmxcsr %0" : "=m" (*&mxcsr));
+  mxcsr &= ~ 0x6000;
+  mxcsr |= round << 3;
+  asm ("ldmxcsr %0" : : "m" (*&mxcsr));
+
+  return 0;
+}
diff --git a/sysdeps/x86_64/fpu/fgetexcptflg.c b/sysdeps/x86_64/fpu/fgetexcptflg.c
new file mode 100644
index 0000000000..f0681dc9d4
--- /dev/null
+++ b/sysdeps/x86_64/fpu/fgetexcptflg.c
@@ -0,0 +1,36 @@
+/* Store current representation for exceptions.
+   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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <fenv.h>
+
+int
+fegetexceptflag (fexcept_t *flagp, int excepts)
+{
+  fexcept_t temp;
+  unsigned int mxscr;
+
+  /* Get the current exceptions for the x87 FPU and SSE unit.  */
+  __asm__ ("fnstsw %0\n"
+	   "stmxcsr %1" : "=m" (*&temp), "=m" (*&mxscr));
+
+  *flagp = (temp | mxscr) & FE_ALL_EXCEPT & excepts;
+
+  /* Success.  */
+  return 0;
+}
diff --git a/sysdeps/x86_64/fpu/fraiseexcpt.c b/sysdeps/x86_64/fpu/fraiseexcpt.c
new file mode 100644
index 0000000000..96ebb6dea2
--- /dev/null
+++ b/sysdeps/x86_64/fpu/fraiseexcpt.c
@@ -0,0 +1,119 @@
+/* Raise given exceptions.
+   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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <fenv.h>
+#include <math.h>
+
+int
+feraiseexcept (int excepts)
+{
+  /* Raise exceptions represented by EXPECTS.  But we must raise only
+     one signal at a time.  It is important that if the overflow/underflow
+     exception and the inexact exception are given at the same time,
+     the overflow/underflow exception follows the inexact exception.  */
+
+  /* First: invalid exception.  */
+  if ((FE_INVALID & excepts) != 0)
+    {
+      /* One example of a invalid operation is 0.0 / 0.0.  */
+      float f = 0.0;
+
+      __asm__ __volatile__ ("divss %0, %0 " : : "x" (f));
+      (void) &f;
+    }
+
+  /* Next: division by zero.  */
+  if ((FE_DIVBYZERO & excepts) != 0)
+    {
+      float f = 1.0;
+      float g = 0.0;
+
+      __asm__ __volatile__ ("divss %1, %0" : : "x" (f), "x" (g));
+      (void) &f;
+    }
+
+  /* Next: overflow.  */
+  if ((FE_OVERFLOW & excepts) != 0)
+    {
+      /* XXX: Is it ok to only set the x87 FPU?  */
+      /* There is no way to raise only the overflow flag.  Do it the
+	 hard way.  */
+      fenv_t temp;
+
+      /* Bah, we have to clear selected exceptions.  Since there is no
+	 `fldsw' instruction we have to do it the hard way.  */
+      __asm__ __volatile__ ("fnstenv %0" : "=m" (*&temp));
+
+      /* Set the relevant bits.  */
+      temp.__status_word |= FE_OVERFLOW;
+
+      /* Put the new data in effect.  */
+      __asm__ __volatile__ ("fldenv %0" : : "m" (*&temp));
+
+      /* And raise the exception.  */
+      __asm__ __volatile__ ("fwait");
+    }
+
+  /* Next: underflow.  */
+  if ((FE_UNDERFLOW & excepts) != 0)
+    {
+      /* XXX: Is it ok to only set the x87 FPU?  */
+      /* There is no way to raise only the underflow flag.  Do it the
+	 hard way.  */
+      fenv_t temp;
+
+      /* Bah, we have to clear selected exceptions.  Since there is no
+	 `fldsw' instruction we have to do it the hard way.  */
+      __asm__ __volatile__ ("fnstenv %0" : "=m" (*&temp));
+
+      /* Set the relevant bits.  */
+      temp.__status_word |= FE_UNDERFLOW;
+
+      /* Put the new data in effect.  */
+      __asm__ __volatile__ ("fldenv %0" : : "m" (*&temp));
+
+      /* And raise the exception.  */
+      __asm__ __volatile__ ("fwait");
+    }
+
+  /* Last: inexact.  */
+  if ((FE_INEXACT & excepts) != 0)
+    {
+      /* XXX: Is it ok to only set the x87 FPU?  */
+      /* There is no way to raise only the inexact flag.  Do it the
+	 hard way.  */
+      fenv_t temp;
+
+      /* Bah, we have to clear selected exceptions.  Since there is no
+	 `fldsw' instruction we have to do it the hard way.  */
+      __asm__ __volatile__ ("fnstenv %0" : "=m" (*&temp));
+
+      /* Set the relevant bits.  */
+      temp.__status_word |= FE_INEXACT;
+
+      /* Put the new data in effect.  */
+      __asm__ __volatile__ ("fldenv %0" : : "m" (*&temp));
+
+      /* And raise the exception.  */
+      __asm__ __volatile__ ("fwait");
+    }
+
+  /* Success.  */
+  return 0;
+}
diff --git a/sysdeps/x86_64/fpu/fsetexcptflg.c b/sysdeps/x86_64/fpu/fsetexcptflg.c
new file mode 100644
index 0000000000..fc4a42cf31
--- /dev/null
+++ b/sysdeps/x86_64/fpu/fsetexcptflg.c
@@ -0,0 +1,54 @@
+/* Set floating-point environment exception handling.
+   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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <fenv.h>
+#include <math.h>
+
+int
+fesetexceptflag (const fexcept_t *flagp, int excepts)
+{
+  fenv_t temp;
+  unsigned int mxcsr;
+
+  /* XXX: Do we really need to set both the exception in both units?
+     Shouldn't it be enough to set only the SSE unit?  */
+
+  /* Get the current x87 FPU environment.  We have to do this since we
+     cannot separately set the status word.  */
+  __asm__ ("fnstenv %0" : "=m" (*&temp));
+
+  temp.__status_word &= ~(excepts & FE_ALL_EXCEPT);
+  temp.__status_word |= *flagp & excepts & FE_ALL_EXCEPT;
+
+  /* Store the new status word (along with the rest of the environment.
+     Possibly new exceptions are set but they won't get executed unless
+     the next floating-point instruction.  */
+  __asm__ ("fldenv %0" : : "m" (*&temp));
+
+  /* And now the same for SSE.  */
+  __asm__ ("stmxcsr %0" : "=m" (*&mxcsr));
+
+  mxcsr &= (excepts & FE_ALL_EXCEPT);
+  mxcsr |= *flagp & excepts & FE_ALL_EXCEPT;
+
+  __asm__ ("ldmxcsr %0" : : "m" (*&mxcsr));
+
+  /* Success.  */
+  return 0;
+}
diff --git a/sysdeps/x86_64/fpu/ftestexcept.c b/sysdeps/x86_64/fpu/ftestexcept.c
new file mode 100644
index 0000000000..091c25157b
--- /dev/null
+++ b/sysdeps/x86_64/fpu/ftestexcept.c
@@ -0,0 +1,33 @@
+/* Test exception in current environment.
+   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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <fenv.h>
+
+int
+fetestexcept (int excepts)
+{
+  int temp;
+  unsigned int mxscr;
+
+  /* Get current exceptions.  */
+  __asm__ ("fnstsw %0\n"
+	   "stmxcsr %1" : "=m" (*&temp), "=m" (*&mxscr));
+
+  return (temp | mxscr) & excepts & FE_ALL_EXCEPT;
+}
diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
new file mode 100644
index 0000000000..f533d69c6e
--- /dev/null
+++ b/sysdeps/x86_64/fpu/libm-test-ulps
@@ -0,0 +1,1493 @@
+# Begin of automatic generation
+
+# asin
+Test "asin (-0.5) == -pi/6":
+ildouble: 1
+ldouble: 1
+Test "asin (-1.0) == -pi/2":
+ildouble: 1
+ldouble: 1
+Test "asin (0.5) == pi/6":
+ildouble: 1
+ldouble: 1
+Test "asin (0.7) == 0.77539749661075306374035335271498708":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "asin (1.0) == pi/2":
+ildouble: 1
+ldouble: 1
+
+# asinh
+Test "asinh (0.7) == 0.652666566082355786":
+ildouble: 15
+ldouble: 15
+
+# atan2
+Test "atan2 (-0.7, -1.0) == -2.530866689200584621918884506789267":
+float: 3
+ifloat: 3
+Test "atan2 (0.7, -1.0) == 2.530866689200584621918884506789267":
+float: 3
+ifloat: 3
+Test "atan2 (1.4, -0.93) == 2.1571487668237843754887415992772736":
+float: 4
+ifloat: 4
+
+# atanh
+Test "atanh (0.7) == 0.8673005276940531944":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+# cabs
+Test "cabs (-0.7 + 12.4 i) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "cabs (-0.7 - 12.4 i) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "cabs (-12.4 + 0.7 i) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "cabs (-12.4 - 0.7 i) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "cabs (0.7 + 1.2 i) == 1.3892443989449804508432547041028554":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "cabs (0.7 + 12.4 i) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+
+# cacos
+Test "Real part of: cacos (0.7 + 1.2 i) == 1.1351827477151551088992008271819053 - 1.0927647857577371459105272080819308 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacos (0.7 + 1.2 i) == 1.1351827477151551088992008271819053 - 1.0927647857577371459105272080819308 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# cacosh
+Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+double: 1
+float: 7
+idouble: 1
+ifloat: 7
+ildouble: 6
+ldouble: 6
+Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+double: 1
+float: 3
+idouble: 1
+ifloat: 3
+ildouble: 1
+ldouble: 1
+Test "Real part of: cacosh (0.7 + 1.2 i) == 1.0927647857577371459105272080819308 + 1.1351827477151551088992008271819053 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cacosh (0.7 + 1.2 i) == 1.0927647857577371459105272080819308 + 1.1351827477151551088992008271819053 i":
+ildouble: 1
+ldouble: 1
+
+# casin
+Test "Real part of: casin (0.7 + 1.2 i) == 0.4356135790797415103321208644578462 + 1.0927647857577371459105272080819308 i":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+Test "Imaginary part of: casin (0.7 + 1.2 i) == 0.4356135790797415103321208644578462 + 1.0927647857577371459105272080819308 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# casinh
+Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
+double: 5
+float: 1
+idouble: 5
+ifloat: 1
+ildouble: 5
+ldouble: 5
+Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
+double: 3
+float: 6
+idouble: 3
+ifloat: 6
+ildouble: 5
+ldouble: 5
+Test "Real part of: casinh (0.7 + 1.2 i) == 0.97865459559367387689317593222160964 + 0.91135418953156011567903546856170941 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: casinh (0.7 + 1.2 i) == 0.97865459559367387689317593222160964 + 0.91135418953156011567903546856170941 i":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+# catan
+Test "Real part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
+float: 3
+ifloat: 3
+Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: catan (0.7 + 1.2 i) == 1.0785743834118921877443707996386368 + 0.57705737765343067644394541889341712 i":
+float: 4
+ifloat: 4
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: catan (0.7 + 1.2 i) == 1.0785743834118921877443707996386368 + 0.57705737765343067644394541889341712 i":
+double: 1
+idouble: 1
+
+# catanh
+Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
+double: 4
+idouble: 4
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
+float: 4
+ifloat: 4
+Test "Real part of: catanh (0.7 + 1.2 i) == 0.2600749516525135959200648705635915 + 0.97024030779509898497385130162655963 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: catanh (0.7 + 1.2 i) == 0.2600749516525135959200648705635915 + 0.97024030779509898497385130162655963 i":
+float: 6
+ifloat: 6
+
+# cbrt
+Test "cbrt (-0.001) == -0.1":
+ildouble: 102
+ldouble: 102
+Test "cbrt (-27.0) == -3.0":
+double: 1
+idouble: 1
+ildouble: 948
+ldouble: 948
+Test "cbrt (0.7) == 0.8879040017426007084":
+ildouble: 345
+ldouble: 345
+Test "cbrt (0.970299) == 0.99":
+double: 1
+idouble: 1
+ildouble: 142
+ldouble: 142
+Test "cbrt (8) == 2":
+ildouble: 191
+ldouble: 191
+
+# ccos
+Test "Imaginary part of: ccos (-2 - 3 i) == -4.1896256909688072301 - 9.1092278937553365979 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: ccos (0.7 + 1.2 i) == 1.3848657645312111080 - 0.97242170335830028619 i":
+double: 1
+idouble: 1
+Test "Imaginary part of: ccos (0.7 + 1.2 i) == 1.3848657645312111080 - 0.97242170335830028619 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+# ccosh
+Test "Real part of: ccosh (-2 - 3 i) == -3.7245455049153225654 + 0.5118225699873846088 i":
+float: 1
+ifloat: 1
+Test "Imaginary part of: ccosh (-2 - 3 i) == -3.7245455049153225654 + 0.5118225699873846088 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: ccosh (0.7 + 1.2 i) == 0.4548202223691477654 + 0.7070296600921537682 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ccosh (0.7 + 1.2 i) == 0.4548202223691477654 + 0.7070296600921537682 i":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+# cexp
+Test "Real part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Real part of: cexp (0.7 + 1.2 i) == 0.72969890915032360123451688642930727 + 1.8768962328348102821139467908203072 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: cexp (0.7 + 1.2 i) == 0.72969890915032360123451688642930727 + 1.8768962328348102821139467908203072 i":
+float: 1
+ifloat: 1
+
+# clog
+Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i":
+float: 3
+ifloat: 3
+
+# clog10
+Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-2 - 3 i) == 0.5569716761534183846 - 0.9375544629863747085 i":
+double: 1
+float: 5
+idouble: 1
+ifloat: 5
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf + inf i) == inf + 3/4 pi*log10(e) i":
+double: 1
+idouble: 1
+Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Real part of: clog10 (0.7 + 1.2 i) == 0.1427786545038868803 + 0.4528483579352493248 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: clog10 (0.7 + 1.2 i) == 0.1427786545038868803 + 0.4528483579352493248 i":
+double: 1
+idouble: 1
+ildouble: 3
+ldouble: 3
+Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# cos
+Test "cos (0.7) == 0.76484218728448842625585999019186495":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "cos (M_PI_6l * 2.0) == 0.5":
+double: 1
+float: 0.5
+idouble: 1
+ifloat: 0.5
+Test "cos (M_PI_6l * 4.0) == -0.5":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 0.5
+ldouble: 0.5
+Test "cos (pi/2) == 0":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 0.25
+ldouble: 0.25
+
+# cosh
+Test "cosh (0.7) == 1.255169005630943018":
+ildouble: 2
+ldouble: 2
+
+# cpow
+Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
+double: 1
+float: 4
+idouble: 1
+ifloat: 4
+Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
+float: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "Real part of: cpow (2 + 0 i, 10 + 0 i) == 1024.0 + 0.0 i":
+ildouble: 1
+ldouble: 1
+
+# csin
+Test "Imaginary part of: csin (0.7 + 1.2 i) == 1.1664563419657581376 + 1.1544997246948547371 i":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+# csinh
+Test "Imaginary part of: csinh (-2 - 3 i) == 3.5905645899857799520 - 0.5309210862485198052 i":
+double: 1
+idouble: 1
+ildouble: 2
+ldouble: 2
+Test "Real part of: csinh (0.7 + 1.2 i) == 0.27487868678117583582 + 1.1698665727426565139 i":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: csinh (0.7 + 1.2 i) == 0.27487868678117583582 + 1.1698665727426565139 i":
+float: 1
+ifloat: 1
+
+# csqrt
+Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i":
+float: 1
+ifloat: 1
+Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i":
+float: 1
+ifloat: 1
+Test "Real part of: csqrt (0.7 + 1.2 i) == 1.022067610030026450706487883081139 + 0.58704531296356521154977678719838035 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "Imaginary part of: csqrt (0.7 + 1.2 i) == 1.022067610030026450706487883081139 + 0.58704531296356521154977678719838035 i":
+float: 1
+ifloat: 1
+
+# ctan
+Test "Real part of: ctan (-2 - 3 i) == 0.0037640256415042482 - 1.0032386273536098014 i":
+double: 1
+idouble: 1
+ildouble: 439
+ldouble: 439
+Test "Imaginary part of: ctan (-2 - 3 i) == 0.0037640256415042482 - 1.0032386273536098014 i":
+ildouble: 2
+ldouble: 2
+Test "Real part of: ctan (0.7 + 1.2 i) == 0.1720734197630349001 + 0.9544807059989405538 i":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctan (0.7 + 1.2 i) == 0.1720734197630349001 + 0.9544807059989405538 i":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+# ctanh
+Test "Real part of: ctanh (-2 - 3 i) == -0.9653858790221331242 + 0.0098843750383224937 i":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 5
+ldouble: 5
+Test "Imaginary part of: ctanh (-2 - 3 i) == -0.9653858790221331242 + 0.0098843750383224937 i":
+ildouble: 25
+ldouble: 25
+Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i":
+float: 1
+ifloat: 1
+Test "Real part of: ctanh (0.7 + 1.2 i) == 1.3472197399061191630 + 0.4778641038326365540 i":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctanh (0.7 + 1.2 i) == 1.3472197399061191630 + 0.4778641038326365540 i":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# erfc
+Test "erfc (0.7) == 0.32219880616258152702":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "erfc (1.2) == 0.089686021770364619762":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 3
+ldouble: 3
+Test "erfc (2.0) == 0.0046777349810472658379":
+double: 1
+idouble: 1
+Test "erfc (4.1) == 0.67000276540848983727e-8":
+double: 24
+float: 12
+idouble: 24
+ifloat: 12
+ildouble: 12
+ldouble: 12
+Test "erfc (9) == 0.41370317465138102381e-36":
+ildouble: 36
+ldouble: 36
+
+# exp10
+Test "exp10 (-1) == 0.1":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "exp10 (0.7) == 5.0118723362727228500155418688494574":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "exp10 (3) == 1000":
+double: 6
+float: 2
+idouble: 6
+ifloat: 2
+ildouble: 3
+ldouble: 3
+
+# expm1
+Test "expm1 (0.7) == 1.0137527074704765216":
+ildouble: 1
+ldouble: 1
+Test "expm1 (1) == M_El - 1.0":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# fmod
+Test "fmod (-6.5, -2.3) == -1.9":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "fmod (-6.5, 2.3) == -1.9":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "fmod (6.5, -2.3) == 1.9":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "fmod (6.5, 2.3) == 1.9":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# gamma
+Test "gamma (-0.5) == log(2*sqrt(pi))":
+ildouble: 1
+ldouble: 1
+
+# hypot
+Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (0.7, 1.2) == 1.3892443989449804508432547041028554":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271":
+float: 1
+ifloat: 1
+
+# j0
+Test "j0 (10.0) == -0.24593576445134833520":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "j0 (2.0) == 0.22389077914123566805":
+float: 2
+ifloat: 2
+Test "j0 (8.0) == 0.17165080713755390609":
+float: 1
+ifloat: 1
+
+# j1
+Test "j1 (10.0) == 0.043472746168861436670":
+float: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "j1 (2.0) == 0.57672480775687338720":
+double: 1
+idouble: 1
+Test "j1 (8.0) == 0.23463634685391462438":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+# jn
+Test "jn (0, 10.0) == -0.24593576445134833520":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "jn (0, 2.0) == 0.22389077914123566805":
+float: 2
+ifloat: 2
+Test "jn (0, 8.0) == 0.17165080713755390609":
+float: 1
+ifloat: 1
+Test "jn (1, 10.0) == 0.043472746168861436670":
+float: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "jn (1, 2.0) == 0.57672480775687338720":
+double: 1
+idouble: 1
+Test "jn (1, 8.0) == 0.23463634685391462438":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "jn (10, -1.0) == 0.26306151236874532070e-9":
+ildouble: 1
+ldouble: 1
+Test "jn (10, 0.1) == 0.26905328954342155795e-19":
+double: 6
+float: 4
+idouble: 6
+ifloat: 4
+ildouble: 1
+ldouble: 1
+Test "jn (10, 0.7) == 0.75175911502153953928e-11":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "jn (10, 1.0) == 0.26306151236874532070e-9":
+ildouble: 1
+ldouble: 1
+Test "jn (10, 10.0) == 0.20748610663335885770":
+double: 4
+float: 3
+idouble: 4
+ifloat: 3
+ildouble: 2
+ldouble: 2
+Test "jn (10, 2.0) == 0.25153862827167367096e-6":
+float: 4
+ifloat: 4
+ildouble: 1
+ldouble: 1
+Test "jn (3, -1.0) == -0.019563353982668405919":
+ildouble: 1
+ldouble: 1
+Test "jn (3, 0.1) == 0.000020820315754756261429":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "jn (3, 0.7) == 0.0069296548267508408077":
+float: 1
+ifloat: 1
+Test "jn (3, 1.0) == 0.019563353982668405919":
+ildouble: 1
+ldouble: 1
+Test "jn (3, 10.0) == 0.058379379305186812343":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (3, 2.0) == 0.12894324947440205110":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+# lgamma
+Test "lgamma (-0.5) == log(2*sqrt(pi))":
+ildouble: 1
+ldouble: 1
+Test "lgamma (0.7) == 0.26086724653166651439":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "lgamma (1.2) == -0.853740900033158497197e-1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# log
+Test "log (0.7) == -0.35667494393873237891263871124118447":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# log10
+Test "log10 (0.7) == -0.15490195998574316929":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "log10 (e) == log10(e)":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# log1p
+Test "log1p (-0.3) == -0.35667494393873237891263871124118447":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# log2
+Test "log2 (0.7) == -0.51457317282975824043":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# sin
+Test "sin (0.7) == 0.64421768723769105367261435139872014":
+ildouble: 1
+ldouble: 1
+
+# sincos
+Test "sincos (0.7, &sin_res, &cos_res) puts 0.64421768723769105367261435139872014 in sin_res":
+ildouble: 1
+ldouble: 1
+Test "sincos (0.7, &sin_res, &cos_res) puts 0.76484218728448842625585999019186495 in cos_res":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
+double: 1
+float: 0.5
+idouble: 1
+ifloat: 0.5
+Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in sin_res":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res":
+double: 0.2758
+float: 0.3667
+idouble: 0.2758
+ifloat: 0.3667
+ildouble: 0.25
+ldouble: 0.25
+Test "sincos (pi/6, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in cos_res":
+float: 1
+ifloat: 1
+
+# sinh
+Test "sinh (0.7) == 0.75858370183953350346":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# tan
+Test "tan (0.7) == 0.84228838046307944812813500221293775":
+ildouble: 1
+ldouble: 1
+Test "tan (pi/4) == 1":
+double: 0.5
+idouble: 0.5
+
+# tanh
+Test "tanh (0.7) == 0.60436777711716349631":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Test "tanh (-0.7) == -0.60436777711716349631":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# tgamma
+Test "tgamma (-0.5) == -2 sqrt (pi)":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "tgamma (0.5) == sqrt (pi)":
+float: 1
+ifloat: 1
+Test "tgamma (0.7) == 1.29805533264755778568":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "tgamma (4) == 6":
+ildouble: 2
+ldouble: 2
+
+# y0
+Test "y0 (0.7) == -0.19066492933739506743":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "y0 (1.0) == 0.088256964215676957983":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "y0 (1.5) == 0.38244892379775884396":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "y0 (10.0) == 0.055671167283599391424":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "y0 (8.0) == 0.22352148938756622053":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# y1
+Test "y1 (0.1) == -6.4589510947020269877":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "y1 (0.7) == -1.1032498719076333697":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "y1 (1.5) == -0.41230862697391129595":
+float: 1
+ifloat: 1
+Test "y1 (10.0) == 0.24901542420695388392":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+Test "y1 (2.0) == -0.10703243154093754689":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "y1 (8.0) == -0.15806046173124749426":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+# yn
+Test "yn (0, 0.7) == -0.19066492933739506743":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "yn (0, 1.0) == 0.088256964215676957983":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "yn (0, 1.5) == 0.38244892379775884396":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "yn (0, 10.0) == 0.055671167283599391424":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "yn (0, 8.0) == 0.22352148938756622053":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "yn (1, 0.1) == -6.4589510947020269877":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "yn (1, 0.7) == -1.1032498719076333697":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "yn (1, 1.5) == -0.41230862697391129595":
+float: 1
+ifloat: 1
+Test "yn (1, 10.0) == 0.24901542420695388392":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+Test "yn (1, 2.0) == -0.10703243154093754689":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "yn (1, 8.0) == -0.15806046173124749426":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "yn (10, 0.1) == -0.11831335132045197885e19":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 2
+ldouble: 2
+Test "yn (10, 0.7) == -0.42447194260703866924e10":
+double: 3
+idouble: 3
+ildouble: 7
+ldouble: 7
+Test "yn (10, 1.0) == -0.12161801427868918929e9":
+double: 1
+idouble: 1
+Test "yn (10, 10.0) == -0.35981415218340272205":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "yn (10, 2.0) == -129184.54220803928264":
+double: 2
+idouble: 2
+ildouble: 1
+ldouble: 1
+Test "yn (3, 0.1) == -5099.3323786129048894":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "yn (3, 0.7) == -15.819479052819633505":
+double: 3
+float: 1
+idouble: 3
+ifloat: 1
+ildouble: 2
+ldouble: 2
+Test "yn (3, 10.0) == -0.25136265718383732978":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "yn (3, 2.0) == -1.1277837768404277861":
+double: 1
+idouble: 1
+
+# Maximal error of functions:
+Function: "asin":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "asinh":
+ildouble: 15
+ldouble: 15
+
+Function: "atan2":
+float: 4
+ifloat: 4
+
+Function: "atanh":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
+Function: "cabs":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "cacos":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "cacos":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "cacosh":
+double: 1
+float: 7
+idouble: 1
+ifloat: 7
+ildouble: 6
+ldouble: 6
+
+Function: Imaginary part of "cacosh":
+double: 1
+float: 3
+idouble: 1
+ifloat: 3
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "casin":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+
+Function: Imaginary part of "casin":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "casinh":
+double: 5
+float: 1
+idouble: 5
+ifloat: 1
+ildouble: 5
+ldouble: 5
+
+Function: Imaginary part of "casinh":
+double: 3
+float: 6
+idouble: 3
+ifloat: 6
+ildouble: 5
+ldouble: 5
+
+Function: Real part of "catan":
+float: 4
+ifloat: 4
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "catan":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Real part of "catanh":
+double: 4
+float: 1
+idouble: 4
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "catanh":
+float: 6
+ifloat: 6
+
+Function: "cbrt":
+double: 1
+idouble: 1
+ildouble: 948
+ldouble: 948
+
+Function: Real part of "ccos":
+double: 1
+idouble: 1
+
+Function: Imaginary part of "ccos":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "ccosh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "ccosh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "cexp":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "cexp":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "clog":
+float: 3
+ifloat: 3
+
+Function: Real part of "clog10":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "clog10":
+double: 1
+float: 5
+idouble: 1
+ifloat: 5
+ildouble: 3
+ldouble: 3
+
+Function: "cos":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 0.5
+ldouble: 0.5
+
+Function: "cosh":
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "cpow":
+double: 1
+float: 4
+idouble: 1
+ifloat: 4
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "cpow":
+double: 1.1031
+float: 2
+idouble: 1.1031
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "csin":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "csinh":
+float: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Imaginary part of "csinh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "csqrt":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Imaginary part of "csqrt":
+float: 1
+ifloat: 1
+
+Function: Real part of "ctan":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 439
+ldouble: 439
+
+Function: Imaginary part of "ctan":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: Real part of "ctanh":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+ildouble: 5
+ldouble: 5
+
+Function: Imaginary part of "ctanh":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 25
+ldouble: 25
+
+Function: "erfc":
+double: 24
+float: 12
+idouble: 24
+ifloat: 12
+ildouble: 36
+ldouble: 36
+
+Function: "exp10":
+double: 6
+float: 2
+idouble: 6
+ifloat: 2
+ildouble: 3
+ldouble: 3
+
+Function: "expm1":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "fmod":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "gamma":
+ildouble: 1
+ldouble: 1
+
+Function: "hypot":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "j0":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: "j1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: "jn":
+double: 6
+float: 4
+idouble: 6
+ifloat: 4
+ildouble: 2
+ldouble: 2
+
+Function: "lgamma":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "log":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "log10":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "log1p":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "log2":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "sin":
+ildouble: 1
+ldouble: 1
+
+Function: "sincos":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "sinh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "tan":
+double: 0.5
+idouble: 0.5
+ildouble: 1
+ldouble: 1
+
+Function: "tanh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "tgamma":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: "y0":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+ildouble: 2
+ldouble: 2
+
+Function: "y1":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 2
+ldouble: 2
+
+Function: "yn":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+ildouble: 7
+ldouble: 7
+
+# end of automatic generation
diff --git a/sysdeps/x86_64/fpu/math_ldbl.h b/sysdeps/x86_64/fpu/math_ldbl.h
new file mode 100644
index 0000000000..b9ff8dadaf
--- /dev/null
+++ b/sysdeps/x86_64/fpu/math_ldbl.h
@@ -0,0 +1,79 @@
+#ifndef _MATH_PRIVATE_H_
+#error "Never use <math_ldbl.h> directly; include <math_private.h> instead."
+#endif
+
+/* A union which permits us to convert between a long double and
+   three 32 bit ints.  */
+
+typedef union
+{
+  long double value;
+  struct
+  {
+    u_int32_t lsw;
+    u_int32_t msw;
+    int sign_exponent:16;
+    unsigned int empty1:16;
+    unsigned int empty0:32;
+  } parts;
+} ieee_long_double_shape_type;
+
+/* Get three 32 bit ints from a double.  */
+
+#define GET_LDOUBLE_WORDS(exp,ix0,ix1,d)			\
+do {								\
+  ieee_long_double_shape_type ew_u;				\
+  ew_u.value = (d);						\
+  (exp) = ew_u.parts.sign_exponent;				\
+  (ix0) = ew_u.parts.msw;					\
+  (ix1) = ew_u.parts.lsw;					\
+} while (0)
+
+/* Set a double from two 32 bit ints.  */
+
+#define SET_LDOUBLE_WORDS(d,exp,ix0,ix1)			\
+do {								\
+  ieee_long_double_shape_type iw_u;				\
+  iw_u.parts.sign_exponent = (exp);				\
+  iw_u.parts.msw = (ix0);					\
+  iw_u.parts.lsw = (ix1);					\
+  (d) = iw_u.value;						\
+} while (0)
+
+/* Get the more significant 32 bits of a long double mantissa.  */
+
+#define GET_LDOUBLE_MSW(v,d)					\
+do {								\
+  ieee_long_double_shape_type sh_u;				\
+  sh_u.value = (d);						\
+  (v) = sh_u.parts.msw;						\
+} while (0)
+
+/* Set the more significant 32 bits of a long double mantissa from an int.  */
+
+#define SET_LDOUBLE_MSW(d,v)					\
+do {								\
+  ieee_long_double_shape_type sh_u;				\
+  sh_u.value = (d);						\
+  sh_u.parts.msw = (v);						\
+  (d) = sh_u.value;						\
+} while (0)
+
+/* Get int from the exponent of a long double.  */
+
+#define GET_LDOUBLE_EXP(exp,d)					\
+do {								\
+  ieee_long_double_shape_type ge_u;				\
+  ge_u.value = (d);						\
+  (exp) = ge_u.parts.sign_exponent;				\
+} while (0)
+
+/* Set exponent of a long double from an int.  */
+
+#define SET_LDOUBLE_EXP(d,exp)					\
+do {								\
+  ieee_long_double_shape_type se_u;				\
+  se_u.value = (d);						\
+  se_u.parts.sign_exponent = (exp);				\
+  (d) = se_u.value;						\
+} while (0)
diff --git a/sysdeps/x86_64/fpu/printf_fphex.c b/sysdeps/x86_64/fpu/printf_fphex.c
new file mode 100644
index 0000000000..d6ca102a88
--- /dev/null
+++ b/sysdeps/x86_64/fpu/printf_fphex.c
@@ -0,0 +1,92 @@
+/* Print floating point number in hexadecimal notation according to ISO C99.
+   Copyright (C) 1997, 1998, 1999, 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef LONG_DOUBLE_DENORM_BIAS
+# define LONG_DOUBLE_DENORM_BIAS (IEEE854_LONG_DOUBLE_BIAS - 1)
+#endif
+
+#define PRINT_FPHEX_LONG_DOUBLE \
+do {									      \
+      /* The "strange" 80 bit format on ix86 and m68k has an explicit	      \
+	 leading digit in the 64 bit mantissa.  */			      \
+      unsigned long long int num;					      \
+									      \
+									      \
+      num = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32	      \
+	     | fpnum.ldbl.ieee.mantissa1);				      \
+									      \
+      zero_mantissa = num == 0;						      \
+									      \
+      if (sizeof (unsigned long int) > 6)				      \
+	{								      \
+	  numstr = _itoa_word (num, numbuf + sizeof numbuf, 16,		      \
+			       info->spec == 'A');			      \
+	  wnumstr = _itowa_word (num,					      \
+				 wnumbuf + sizeof (wnumbuf) / sizeof (wchar_t),\
+				 16, info->spec == 'A');		      \
+	}								      \
+      else								      \
+	{								      \
+	  numstr = _itoa (num, numbuf + sizeof numbuf, 16, info->spec == 'A');\
+	  wnumstr = _itowa (num,					      \
+			    wnumbuf + sizeof (wnumbuf) / sizeof (wchar_t),    \
+			    16, info->spec == 'A');			      \
+	}								      \
+									      \
+      /* Fill with zeroes.  */						      \
+      while (numstr > numbuf + (sizeof numbuf - 64 / 4))		      \
+	{								      \
+	  *--numstr = '0';						      \
+	  *--wnumstr = L'0';						      \
+	}								      \
+									      \
+      /* We use a full nibble for the leading digit.  */		      \
+      leading = *numstr++;						      \
+									      \
+      /* We have 3 bits from the mantissa in the leading nibble.	      \
+	 Therefore we are here using `IEEE854_LONG_DOUBLE_BIAS + 3'.  */      \
+      exponent = fpnum.ldbl.ieee.exponent;				      \
+									      \
+      if (exponent == 0)						      \
+	{								      \
+	  if (zero_mantissa)						      \
+	    expnegative = 0;						      \
+	  else								      \
+	    {								      \
+	      /* This is a denormalized number.  */			      \
+	      expnegative = 1;						      \
+	      /* This is a hook for the m68k long double format, where the    \
+		 exponent bias is the same for normalized and denormalized    \
+		 numbers.  */						      \
+	      exponent = LONG_DOUBLE_DENORM_BIAS + 3;			      \
+	    }								      \
+	}								      \
+      else if (exponent >= IEEE854_LONG_DOUBLE_BIAS + 3)		      \
+	{								      \
+	  expnegative = 0;						      \
+	  exponent -= IEEE854_LONG_DOUBLE_BIAS + 3;			      \
+	}								      \
+      else								      \
+	{								      \
+	  expnegative = 1;						      \
+	  exponent = -(exponent - (IEEE854_LONG_DOUBLE_BIAS + 3));	      \
+	}								      \
+} while (0)
+
+#include <sysdeps/generic/printf_fphex.c>
diff --git a/sysdeps/x86_64/fpu/s_atanl.c b/sysdeps/x86_64/fpu/s_atanl.c
new file mode 100644
index 0000000000..fd4a455b55
--- /dev/null
+++ b/sysdeps/x86_64/fpu/s_atanl.c
@@ -0,0 +1 @@
+#include "sysdeps/i386/fpu/s_atanl.c"
diff --git a/sysdeps/x86_64/fpu/s_cosl.S b/sysdeps/x86_64/fpu/s_cosl.S
new file mode 100644
index 0000000000..6636fb5ec6
--- /dev/null
+++ b/sysdeps/x86_64/fpu/s_cosl.S
@@ -0,0 +1,32 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ * Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+ENTRY(__cosl)
+	fldt	8(%rsp)
+	fcos
+	fnstsw	%ax
+	testl	$0x400,%eax
+	jnz	1f
+	ret
+	.align ALIGNARG(4)
+1:	fldpi
+	fadd	%st(0)
+	fxch	%st(1)
+2:	fprem1
+	fnstsw	%ax
+	testl	$0x400,%eax
+	jnz	2b
+	fstp	%st(1)
+	fcos
+	ret
+END (__cosl)
+weak_alias (__cosl, cosl)
diff --git a/sysdeps/x86_64/fpu/s_expm1l.S b/sysdeps/x86_64/fpu/s_expm1l.S
new file mode 100644
index 0000000000..fa40e05572
--- /dev/null
+++ b/sysdeps/x86_64/fpu/s_expm1l.S
@@ -0,0 +1,83 @@
+/* ix87 specific implementation of exp(x)-1.
+   Copyright (C) 1996, 1997, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+   Based on code by John C. Bowman <bowman@ipp-garching.mpg.de>.
+   Corrections by H.J. Lu (hjl@gnu.ai.mit.edu), 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+	/* Using: e^x - 1 = 2^(x * log2(e)) - 1 */
+
+#include <machine/asm.h>
+
+#ifdef __ELF__
+	.section .rodata
+#else
+	.text
+#endif
+	.align ALIGNARG(4)
+	ASM_TYPE_DIRECTIVE(minus1,@object)
+minus1:	.double -1.0
+	ASM_SIZE_DIRECTIVE(minus1)
+	ASM_TYPE_DIRECTIVE(one,@object)
+one:	.double 1.0
+	ASM_SIZE_DIRECTIVE(one)
+	ASM_TYPE_DIRECTIVE(l2e,@object)
+l2e:	.tfloat 1.442695040888963407359924681002
+	ASM_SIZE_DIRECTIVE(l2e)
+
+#ifdef PIC
+#define MO(op) op##(%rip)
+#else
+#define MO(op) op
+#endif
+
+	.text
+ENTRY(__expm1l)
+	fldt	8(%rsp)		// x
+	fxam			// Is NaN or +-Inf?
+	fstsw	%ax
+	movb	$0x45, %ch
+	andb	%ah, %ch
+	cmpb	$0x40, %ch
+	je	3f		// If +-0, jump.
+	cmpb	$0x05, %ch
+	je	2f		// If +-Inf, jump.
+
+	fldt	MO(l2e)		// log2(e) : x
+	fmulp			// log2(e)*x
+	fld	%st		// log2(e)*x : log2(e)*x
+	frndint			// int(log2(e)*x) : log2(e)*x
+	fsubr	%st, %st(1)	// int(log2(e)*x) : fract(log2(e)*x)
+	fxch			// fract(log2(e)*x) : int(log2(e)*x)
+	f2xm1			// 2^fract(log2(e)*x)-1 : int(log2(e)*x)
+	fscale			// 2^(log2(e)*x)-2^int(log2(e)*x) : int(log2(e)*x)
+	fxch			// int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fldl	MO(one)		// 1 : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fscale			// 2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fsubrl	MO(one)		// 1-2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fstp	%st(1)		// 1-2^int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
+	fsubrp	%st, %st(1)	// 2^(log2(e)*x)
+	ret
+
+2:	testl	$0x200, %eax	// Test sign.
+	jz	3f		// If positive, jump.
+	fstp	%st
+	fldl	MO(minus1)	// Set result to -1.0.
+3:	ret
+END(__expm1l)
+weak_alias (__expm1l, expm1l)
diff --git a/sysdeps/x86_64/fpu/s_fpclassifyl.c b/sysdeps/x86_64/fpu/s_fpclassifyl.c
new file mode 100644
index 0000000000..856854b0f5
--- /dev/null
+++ b/sysdeps/x86_64/fpu/s_fpclassifyl.c
@@ -0,0 +1,2 @@
+#include <sysdeps/i386/fpu/s_fpclassifyl.c>
+
diff --git a/sysdeps/x86_64/fpu/s_isinfl.c b/sysdeps/x86_64/fpu/s_isinfl.c
new file mode 100644
index 0000000000..ca818b5e90
--- /dev/null
+++ b/sysdeps/x86_64/fpu/s_isinfl.c
@@ -0,0 +1 @@
+#include <sysdeps/i386/fpu/s_isinfl.c>
diff --git a/sysdeps/x86_64/fpu/s_isnanl.c b/sysdeps/x86_64/fpu/s_isnanl.c
new file mode 100644
index 0000000000..06e69c3aeb
--- /dev/null
+++ b/sysdeps/x86_64/fpu/s_isnanl.c
@@ -0,0 +1 @@
+#include <sysdeps/i386/fpu/s_isnanl.c>
diff --git a/sysdeps/x86_64/fpu/s_log1pl.S b/sysdeps/x86_64/fpu/s_log1pl.S
new file mode 100644
index 0000000000..7fbd0e5aaa
--- /dev/null
+++ b/sysdeps/x86_64/fpu/s_log1pl.S
@@ -0,0 +1,71 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ * Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: s_log1p.S,v 1.7 1995/05/09 00:10:58 jtc Exp $")
+
+#ifdef __ELF__
+	.section .rodata
+#else
+	.text
+#endif
+	.align ALIGNARG(4)
+	/* The fyl2xp1 can only be used for values in
+		-1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2
+	   0.29 is a safe value.
+	*/
+limit:	.tfloat 0.29
+	/* Please note:	 we use a double value here.  Since 1.0 has
+	   an exact representation this does not effect the accuracy
+	   but it helps to optimize the code.  */
+one:	.double 1.0
+
+/*
+ * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29,
+ * otherwise fyl2x with the needed extra computation.
+ */
+#ifdef PIC
+#define MO(op) op##(%rip)
+#else
+#define MO(op) op
+#endif
+
+	.text
+ENTRY(__log1pl)
+	fldln2
+
+	fldt	8(%rsp)
+
+	fxam
+	fnstsw
+	fld	%st
+	andb	$1,%ah
+	jnz	3f		// in case x is NaN or ħInf
+4:
+	fabs
+	fldt	MO(limit)
+	fcompp
+	fnstsw
+	andb	$1,%ah
+	jz	2f
+
+	faddl	MO(one)
+	fyl2x
+	ret
+
+2:	fyl2xp1
+	ret
+
+3:	jp	4b		// in case x is ħInf
+	fstp	%st(1)
+	fstp	%st(1)
+	ret
+
+END (__log1pl)
+weak_alias (__log1pl, log1pl)
diff --git a/sysdeps/x86_64/fpu/s_logbl.c b/sysdeps/x86_64/fpu/s_logbl.c
new file mode 100644
index 0000000000..4791ba64e8
--- /dev/null
+++ b/sysdeps/x86_64/fpu/s_logbl.c
@@ -0,0 +1 @@
+#include <sysdeps/i386/fpu/s_logbl.c>
diff --git a/sysdeps/x86_64/fpu/s_nextafterl.c b/sysdeps/x86_64/fpu/s_nextafterl.c
new file mode 100644
index 0000000000..f59f16848f
--- /dev/null
+++ b/sysdeps/x86_64/fpu/s_nextafterl.c
@@ -0,0 +1 @@
+#include <sysdeps/i386/fpu/s_nextafterl.c>
diff --git a/sysdeps/x86_64/fpu/s_nexttoward.c b/sysdeps/x86_64/fpu/s_nexttoward.c
new file mode 100644
index 0000000000..aee2bb5895
--- /dev/null
+++ b/sysdeps/x86_64/fpu/s_nexttoward.c
@@ -0,0 +1 @@
+#include <sysdeps/i386/fpu/s_nexttoward.c>
diff --git a/sysdeps/x86_64/fpu/s_nexttowardf.c b/sysdeps/x86_64/fpu/s_nexttowardf.c
new file mode 100644
index 0000000000..55e95f6916
--- /dev/null
+++ b/sysdeps/x86_64/fpu/s_nexttowardf.c
@@ -0,0 +1 @@
+#include <sysdeps/i386/fpu/s_nexttowardf.c>
diff --git a/sysdeps/x86_64/fpu/s_rintl.c b/sysdeps/x86_64/fpu/s_rintl.c
new file mode 100644
index 0000000000..1cad42e921
--- /dev/null
+++ b/sysdeps/x86_64/fpu/s_rintl.c
@@ -0,0 +1 @@
+#include <sysdeps/i386/fpu/s_rintl.c>
diff --git a/sysdeps/x86_64/fpu/s_significandl.c b/sysdeps/x86_64/fpu/s_significandl.c
new file mode 100644
index 0000000000..a4ad986164
--- /dev/null
+++ b/sysdeps/x86_64/fpu/s_significandl.c
@@ -0,0 +1 @@
+#include <sysdeps/i386/fpu/s_significandl.c>
diff --git a/sysdeps/x86_64/fpu/s_sincosl.S b/sysdeps/x86_64/fpu/s_sincosl.S
new file mode 100644
index 0000000000..9a3025ab5f
--- /dev/null
+++ b/sysdeps/x86_64/fpu/s_sincosl.S
@@ -0,0 +1,61 @@
+/* Compute sine and cosine of argument.
+   Copyright (C) 1997, 2000, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <machine/asm.h>
+#include "bp-sym.h"
+#include "bp-asm.h"
+
+#define PARMS	LINKAGE		/* no space for saved regs */
+#define ANGLE	PARMS
+#define SINP	ANGLE+12
+#define COSP	SINP+PTR_SIZE
+
+	.text
+ENTRY (BP_SYM (__sincosl))
+	ENTER
+
+	fldt	8(%rsp)
+	fsincos
+	fnstsw	%ax
+	testl	$0x400,%eax
+	jnz	1f
+	fstpt	(%rsi)
+	fstpt	(%rdi)
+
+	LEAVE
+	ret
+
+	.align ALIGNARG(4)
+1:	fldpi
+	fadd	%st(0)
+	fxch	%st(1)
+2:	fprem1
+	fnstsw	%ax
+	testl	$0x400,%eax
+	jnz	2b
+	fstp	%st(1)
+	fsincos
+	fstpt	(%rsi)
+	fstpt	(%rdi)
+
+	LEAVE
+	ret
+END (BP_SYM (__sincosl))
+weak_alias (BP_SYM (__sincosl), BP_SYM (sincosl))
diff --git a/sysdeps/x86_64/fpu/s_sinl.S b/sysdeps/x86_64/fpu/s_sinl.S
new file mode 100644
index 0000000000..181f112f4f
--- /dev/null
+++ b/sysdeps/x86_64/fpu/s_sinl.S
@@ -0,0 +1,30 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ * Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
+ */
+
+#include <machine/asm.h>
+
+ENTRY(__sinl)
+	fldt	8(%rsp)
+	fsin
+	fnstsw	%ax
+	testl	$0x400,%eax
+	jnz	1f
+	ret
+	.align ALIGNARG(4)
+1:	fldpi
+	fadd	%st(0)
+	fxch	%st(1)
+2:	fprem1
+	fnstsw	%ax
+	testl	$0x400,%eax
+	jnz	2b
+	fstp	%st(1)
+	fsin
+	ret
+END (__sinl)
+weak_alias (__sinl, sinl)
diff --git a/sysdeps/x86_64/fpu/s_tanl.S b/sysdeps/x86_64/fpu/s_tanl.S
new file mode 100644
index 0000000000..674e908acc
--- /dev/null
+++ b/sysdeps/x86_64/fpu/s_tanl.S
@@ -0,0 +1,33 @@
+/*
+ * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Public domain.
+ *
+ * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
+ * Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
+ */
+
+#include <machine/asm.h>
+
+RCSID("$NetBSD: $")
+
+ENTRY(__tanl)
+	fldt	8(%rsp)
+	fptan
+	fnstsw	%ax
+	testl	$0x400,%eax
+	jnz	1f
+	fstp	%st(0)
+	ret
+1:	fldpi
+	fadd	%st(0)
+	fxch	%st(1)
+2:	fprem1
+	fstsw	%ax
+	testl	$0x400,%eax
+	jnz	2b
+	fstp	%st(1)
+	fptan
+	fstp	%st(0)
+	ret
+END (__tanl)
+weak_alias (__tanl, tanl)
diff --git a/sysdeps/x86_64/gmp-mparam.h b/sysdeps/x86_64/gmp-mparam.h
new file mode 100644
index 0000000000..615e23bd0a
--- /dev/null
+++ b/sysdeps/x86_64/gmp-mparam.h
@@ -0,0 +1,27 @@
+/* gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP 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 MP 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 MP 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. */
+
+#define BITS_PER_MP_LIMB 64
+#define BYTES_PER_MP_LIMB 8
+#define BITS_PER_LONGINT 64
+#define BITS_PER_INT 32
+#define BITS_PER_SHORTINT 16
+#define BITS_PER_CHAR 8
diff --git a/sysdeps/x86_64/hp-timing.c b/sysdeps/x86_64/hp-timing.c
new file mode 100644
index 0000000000..289ca4c3c4
--- /dev/null
+++ b/sysdeps/x86_64/hp-timing.c
@@ -0,0 +1,2 @@
+/* We can use the i686 implementation without changes.  */
+#include <sysdeps/i386/i686/hp-timing.c>
diff --git a/sysdeps/x86_64/hp-timing.h b/sysdeps/x86_64/hp-timing.h
new file mode 100644
index 0000000000..1f24ffcf5e
--- /dev/null
+++ b/sysdeps/x86_64/hp-timing.h
@@ -0,0 +1,2 @@
+/* We can use the i686 implementation without changes.  */
+#include <sysdeps/i386/i686/hp-timing.h>
diff --git a/sysdeps/x86_64/htonl.S b/sysdeps/x86_64/htonl.S
new file mode 100644
index 0000000000..5aba9b3f28
--- /dev/null
+++ b/sysdeps/x86_64/htonl.S
@@ -0,0 +1,35 @@
+/* Change byte order in word.  For AMD x86-64.
+   Copyright (C) 1997, 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+#include "asm-syntax.h"
+
+/*
+   INPUT PARAMETERS:
+   word		%rdi
+*/
+
+	.text
+ENTRY (htonl)
+	movl	%edi, %eax
+	bswap	%eax
+	ret
+END (htonl)
+
+weak_alias (htonl, ntohl)
diff --git a/sysdeps/x86_64/memusage.h b/sysdeps/x86_64/memusage.h
new file mode 100644
index 0000000000..d267cf573e
--- /dev/null
+++ b/sysdeps/x86_64/memusage.h
@@ -0,0 +1,22 @@
+/* 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define GETSP() ({ register uintptr_t stack_ptr asm ("rsp"); stack_ptr; })
+#define GETTIME(low,high) asm ("rdtsc" : "=a" (low), "=d" (high))
+
+#include <sysdeps/generic/memusage.h>
diff --git a/sysdeps/x86_64/setjmp.S b/sysdeps/x86_64/setjmp.S
new file mode 100644
index 0000000000..e40381da31
--- /dev/null
+++ b/sysdeps/x86_64/setjmp.S
@@ -0,0 +1,45 @@
+/* setjmp for x86-64.
+   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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+#define _ASM
+#define _SETJMP_H
+#include <bits/setjmp.h>
+#include <asm-syntax.h>
+
+ENTRY (__sigsetjmp)
+	/* Save registers.  */
+	movq %rbx, (JB_RBX*8)(%rdi)
+	movq %rbp, (JB_RBP*8)(%rdi)
+	movq %r12, (JB_R12*8)(%rdi)
+	movq %r13, (JB_R13*8)(%rdi)
+	movq %r14, (JB_R14*8)(%rdi)
+	movq %r15, (JB_R15*8)(%rdi)
+	leaq 8(%rsp), %rdx	/* Save SP as it will be after we return.  */
+	movq %rdx, (JB_RSP*8)(%rdi)
+	movq (%rsp), %rax	/* Save PC we are returning to now.  */
+	movq %rax, (JB_PC*8)(%rdi)
+
+	/* Make a tail call to __sigjmp_save; it takes the same args.  */
+#ifdef	PIC
+	jmp C_SYMBOL_NAME (BP_SYM (__sigjmp_save))@PLT
+#else
+	jmp BP_SYM (__sigjmp_save)
+#endif
+END (BP_SYM (__sigsetjmp))
diff --git a/sysdeps/x86_64/soft-fp/sfp-machine.h b/sysdeps/x86_64/soft-fp/sfp-machine.h
new file mode 100644
index 0000000000..1cc4e24c68
--- /dev/null
+++ b/sysdeps/x86_64/soft-fp/sfp-machine.h
@@ -0,0 +1,49 @@
+#define _FP_W_TYPE_SIZE		64
+#define _FP_W_TYPE		unsigned long
+#define _FP_WS_TYPE		signed long
+#define _FP_I_TYPE		long
+
+#define __FP_CLZ(r, x)							\
+  do {									\
+    __asm__("bsrq %1,%0" : "=r"(r) : "g"(x) : "cc");			\
+    r ^= 63;								\
+  } while (0)
+
+#define _FP_NANFRAC_S		_FP_QNANBIT_S
+#define _FP_NANFRAC_D		_FP_QNANBIT_D, 0
+#define _FP_NANSIGN_S		1
+#define _FP_NANSIGN_D		1
+
+#define _FP_KEEPNANFRACP 1
+/* Here is something Intel misdesigned: the specs don't define
+   the case where we have two NaNs with same mantissas, but
+   different sign. Different operations pick up different NaNs.
+ */
+#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP)			\
+  do {								\
+    if (_FP_FRAC_GT_##wc(X, Y)					\
+	|| (_FP_FRAC_EQ_##wc(X,Y) && (OP == '+' || OP == '*')))	\
+      {								\
+	R##_s = X##_s;						\
+        _FP_FRAC_COPY_##wc(R,X);				\
+      }								\
+    else							\
+      {								\
+	R##_s = Y##_s;						\
+        _FP_FRAC_COPY_##wc(R,Y);				\
+      }								\
+    R##_c = FP_CLS_NAN;						\
+  } while (0)
+
+#define FP_EX_INVALID           (1 << 0)
+#define FP_EX_DENORM		(1 << 1)
+#define FP_EX_DIVZERO           (1 << 2)
+#define FP_EX_OVERFLOW          (1 << 3)
+#define FP_EX_UNDERFLOW         (1 << 4)
+#define FP_EX_INEXACT           (1 << 5)
+
+#define FP_RND_NEAREST		0
+#define FP_RND_ZERO		3
+#define FP_RND_PINF		2
+#define FP_RND_MINF		1
+
diff --git a/sysdeps/x86_64/stackinfo.h b/sysdeps/x86_64/stackinfo.h
new file mode 100644
index 0000000000..60668d10b1
--- /dev/null
+++ b/sysdeps/x86_64/stackinfo.h
@@ -0,0 +1,28 @@
+/* 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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* This file contains a bit of information about the stack allocation
+   of the processor.  */
+
+#ifndef _STACKINFO_H
+#define _STACKINFO_H	1
+
+/* On x86_64 the stack grows down.  */
+#define _STACK_GROWS_DOWN	1
+
+#endif	/* stackinfo.h */
diff --git a/sysdeps/x86_64/sysdep.h b/sysdeps/x86_64/sysdep.h
new file mode 100644
index 0000000000..2a2ad41e52
--- /dev/null
+++ b/sysdeps/x86_64/sysdep.h
@@ -0,0 +1,101 @@
+/* Assembler macros for x86-64.
+   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 Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdeps/generic/sysdep.h>
+
+#ifdef	__ASSEMBLER__
+
+/* Syntactic details of assembler.  */
+
+#ifdef HAVE_ELF
+
+/* ELF uses byte-counts for .align, most others use log2 of count of bytes.  */
+#define ALIGNARG(log2) 1<<log2
+/* For ELF we need the `.type' directive to make shared libs work right.  */
+#define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg;
+#define ASM_SIZE_DIRECTIVE(name) .size name,.-name;
+
+/* In ELF C symbols are asm symbols.  */
+#undef	NO_UNDERSCORES
+#define NO_UNDERSCORES
+
+#else
+
+#define ALIGNARG(log2) log2
+#define ASM_TYPE_DIRECTIVE(name,type)	/* Nothing is specified.  */
+#define ASM_SIZE_DIRECTIVE(name)	/* Nothing is specified.  */
+
+#endif
+
+
+/* Define an entry point visible from C.  */
+#define	ENTRY(name)							      \
+  ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name);				      \
+  ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function)			      \
+  .align ALIGNARG(4);							      \
+  C_LABEL(name)								      \
+  CALL_MCOUNT
+
+#undef	END
+#define END(name)							      \
+  ASM_SIZE_DIRECTIVE(name)						      \
+
+/* If compiled for profiling, call `mcount' at the start of each function.  */
+#ifdef	PROF
+/* XXX this does not work yet!  */
+/* The mcount code relies on a normal frame pointer being on the stack
+   to locate our caller, so push one just for its benefit.  */
+#define CALL_MCOUNT \
+  pushl %ebp; movl %esp, %ebp; call JUMPTARGET(mcount); popl %ebp;
+#else
+#define CALL_MCOUNT		/* Do nothing.  */
+#endif
+
+#ifdef	NO_UNDERSCORES
+/* Since C identifiers are not normally prefixed with an underscore
+   on this system, the asm identifier `syscall_error' intrudes on the
+   C name space.  Make sure we use an innocuous name.  */
+#define	syscall_error	__syscall_error
+#define mcount		_mcount
+#endif
+
+#define	PSEUDO(name, syscall_name, args)				      \
+lose:									      \
+  jmp JUMPTARGET(syscall_error)						      \
+  .globl syscall_error;							      \
+  ENTRY (name)								      \
+  DO_CALL (syscall_name, args);						      \
+  jb lose
+
+#undef	PSEUDO_END
+#define	PSEUDO_END(name)						      \
+  END (name)
+
+#ifdef PIC
+#define JUMPTARGET(name)	name##@PLT
+#else
+#define JUMPTARGET(name)	name
+#endif
+
+/* Local label name for asm code. */
+#ifndef L
+#define L(name)		name
+#endif
+
+#endif	/* __ASSEMBLER__ */