about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix')
-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
57 files changed, 2357 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__ */