Add missing aliases for off64_t functions in 64-bit land.

See the comment in SYSCALLS.TXT for an explanation.

Change-Id: I33d4056e84160c3cca74b7b588e9924a569753ed
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index e5e3c4d..cb9af1c 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -104,9 +104,6 @@
 int         __open:open(const char*, int, mode_t)  all
 int         __openat:openat(int, const char*, int, mode_t) all
 int         close(int)                      all
-off_t       lseek(int, off_t, int)           arm,x86,mips
-off_t       lseek|lseek64(int, off_t, int)   x86_64
-int         __llseek:_llseek(int, unsigned long, unsigned long, off64_t*, int)  arm,x86,mips
 pid_t       getpid()    all
 void*       mmap(void*, size_t, int, int, int, long)  x86_64
 void*       __mmap2:mmap2(void*, size_t, int, int, int, long)   arm,x86,mips
@@ -133,8 +130,6 @@
 int         dup2(int, int)   all
 int         select:_newselect(int, struct fd_set*, struct fd_set*, struct fd_set*, struct timeval*)  arm,x86,mips
 int         select(int, struct fd_set*, struct fd_set*, struct fd_set*, struct timeval*)  x86_64
-int         ftruncate(int, off_t)  all
-int         ftruncate64(int, off64_t) arm,x86,mips
 int         getdents:getdents64(unsigned int, struct dirent*, unsigned int)   all
 int         fsync(int)  all
 int         fdatasync(int) all
@@ -144,8 +139,6 @@
 int         __fcntl64:fcntl64(int, int, void*)  arm,x86,mips
 int         __fstatfs64:fstatfs64(int, size_t, struct statfs*)  arm,x86,mips
 int         fstatfs(int, struct statfs*)  x86_64
-ssize_t     sendfile(int out_fd, int in_fd, off_t* offset, size_t count)  all
-ssize_t     sendfile64(int out_fd, int in_fd, off64_t* offset, size_t count)  arm,x86,mips
 int         fstatat:fstatat64(int dirfd, const char* path, struct stat* buf, int flags)   arm,x86,mips
 int         mkdirat(int dirfd, const char* pathname, mode_t mode)  all
 int         fchownat(int dirfd, const char* path, uid_t owner, gid_t group, int flags)  all
@@ -156,6 +149,23 @@
 ssize_t     flistxattr(int, char*, size_t) all
 int         fremovexattr(int, const char*) all
 
+# Paired off_t/off64_t system calls. On 64-bit systems,
+# sizeof(off_t) == sizeof(off64_t), so there we emit two symbols that are
+# aliases. On 32-bit systems, we have two different system calls.
+# That means that every system call in this section should take three lines.
+off_t lseek(int, off_t, int) arm,mips,x86
+int __llseek:_llseek(int, unsigned long, unsigned long, off64_t*, int) arm,mips,x86
+off_t lseek|lseek64(int, off_t, int) x86_64
+int ftruncate(int, off_t) arm,mips,x86
+int ftruncate64(int, off64_t) arm,mips,x86
+int ftruncate|ftruncate64(int, off_t) x86_64
+ssize_t sendfile(int out_fd, int in_fd, off_t* offset, size_t count) arm,mips,x86
+ssize_t sendfile64(int out_fd, int in_fd, off64_t* offset, size_t count) arm,mips,x86
+ssize_t sendfile|sendfile64(int out_fd, int in_fd, off_t* offset, size_t count) x86_64
+int truncate(const char*, off_t) arm,mips,x86
+int truncate64(const char*, off64_t) arm,mips,x86
+int truncate|truncate64(const char*, off_t) x86_64
+
 # file system
 int     link(const char*, const char*)  all
 int     unlink(const char*)             all
@@ -184,8 +194,6 @@
 int     faccessat(int, const char*, int, int)  all
 int     symlink(const char*, const char*)  all
 int     fchdir(int)    all
-int     truncate(const char*, off_t)    all
-int     truncate64(const char*, off64_t)    arm,x86,mips
 int     setxattr(const char*, const char*, const void*, size_t, int) all
 int     lsetxattr(const char*, const char*, const void*, size_t, int) all
 ssize_t getxattr(const char*, const char*, void*, size_t) all
@@ -311,7 +319,7 @@
 
 int     eventfd:eventfd2(unsigned int, int)  all
 
-# ARM-specific ARM_NR_BASE == 0x0f0000 == 983040
+# ARM-specific
 int     __set_tls:__ARM_NR_set_tls(void*)                                 arm
 int     cacheflush:__ARM_NR_cacheflush(long start, long end, long flags)  arm
 
diff --git a/libc/arch-x86_64/syscalls/ftruncate.S b/libc/arch-x86_64/syscalls/ftruncate.S
index 2560ade..5157fec 100644
--- a/libc/arch-x86_64/syscalls/ftruncate.S
+++ b/libc/arch-x86_64/syscalls/ftruncate.S
@@ -16,3 +16,6 @@
 1:
     ret
 END(ftruncate)
+
+    .globl _C_LABEL(ftruncate64)
+    .equ _C_LABEL(ftruncate64), _C_LABEL(ftruncate)
diff --git a/libc/arch-x86_64/syscalls/sendfile.S b/libc/arch-x86_64/syscalls/sendfile.S
index 565276e..4aa2a31 100644
--- a/libc/arch-x86_64/syscalls/sendfile.S
+++ b/libc/arch-x86_64/syscalls/sendfile.S
@@ -17,3 +17,6 @@
 1:
     ret
 END(sendfile)
+
+    .globl _C_LABEL(sendfile64)
+    .equ _C_LABEL(sendfile64), _C_LABEL(sendfile)
diff --git a/libc/arch-x86_64/syscalls/truncate.S b/libc/arch-x86_64/syscalls/truncate.S
index 2fe7a9d..6da3140 100644
--- a/libc/arch-x86_64/syscalls/truncate.S
+++ b/libc/arch-x86_64/syscalls/truncate.S
@@ -16,3 +16,6 @@
 1:
     ret
 END(truncate)
+
+    .globl _C_LABEL(truncate64)
+    .equ _C_LABEL(truncate64), _C_LABEL(truncate)