From patchwork Mon Nov 12 23:36:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: PATCH: PR other/55292: libsanitizer doesn't support x32 Date: Mon, 12 Nov 2012 13:36:07 -0000 From: H.J. Lu X-Patchwork-Id: 198501 Message-Id: <20121112233606.GA6375@gmail.com> To: gcc-patches@gcc.gnu.org Hi, Linux/x32 doesn't have __NR_mmap2/__NR_fstat64 and uses __NR_mmap/__NR_fstat, just like Linux/x86-64. Tested on Linux/x32. OK to install? Thanks. H.J. --- 2012-11-12 H.J. Lu PR other/55292 * sanitizer_common/sanitizer_linux.cc (internal_mmap): Use __NR_mmap if __x86_64__ is defined. (internal_filesize): Use __NR_fstat if __x86_64__ is defined. diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.cc b/libsanitizer/sanitizer_common/sanitizer_linux.cc index ab6c5a4..5d29018 100644 --- a/libsanitizer/sanitizer_common/sanitizer_linux.cc +++ b/libsanitizer/sanitizer_common/sanitizer_linux.cc @@ -34,7 +34,7 @@ namespace __sanitizer { // --------------- sanitizer_libc.h void *internal_mmap(void *addr, uptr length, int prot, int flags, int fd, u64 offset) { -#if __WORDSIZE == 64 +#if __WORDSIZE == 64 || defined __x86_64__ return (void *)syscall(__NR_mmap, addr, length, prot, flags, fd, offset); #else return (void *)syscall(__NR_mmap2, addr, length, prot, flags, fd, offset); @@ -67,7 +67,7 @@ uptr internal_write(fd_t fd, const void *buf, uptr count) { } uptr internal_filesize(fd_t fd) { -#if __WORDSIZE == 64 +#if __WORDSIZE == 64 || defined __x86_64__ struct stat st; if (syscall(__NR_fstat, fd, &st)) return -1;