diff options
author | davem <davem@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-20 20:54:49 +0000 |
---|---|---|
committer | davem <davem@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-20 20:54:49 +0000 |
commit | b0fda11bb09ebce641e82463e705916893c72b8d (patch) | |
tree | 2ab90885e8bb4f79a14bf5c0a8e796699c93c6ad /libsanitizer | |
parent | cac0c158c4092623e68441a1225c1c3850e18fd4 (diff) | |
download | gcc-b0fda11bb09ebce641e82463e705916893c72b8d.tar.gz |
Fix sanitizer build on sparc64.
* sanitizer_common/sanitizer_linux.cc
(SANITIZER_LINUX_USES_64BIT_SYSCALLS): Define.
(internal_mmap): Use it.
(internal_filesize): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193676 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libsanitizer')
-rw-r--r-- | libsanitizer/ChangeLog | 7 | ||||
-rw-r--r-- | libsanitizer/sanitizer_common/sanitizer_linux.cc | 13 |
2 files changed, 18 insertions, 2 deletions
diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog index 7aade5066d4..22f65b29926 100644 --- a/libsanitizer/ChangeLog +++ b/libsanitizer/ChangeLog @@ -1,3 +1,10 @@ +2012-11-20 Konstantin Serebryany <konstantin.s.serebryany@gmail.com> + + * sanitizer_common/sanitizer_linux.cc + (SANITIZER_LINUX_USES_64BIT_SYSCALLS): Define. + (internal_mmap): Use it. + (internal_filesize): Likewise. + 2012-11-16 Tom Tromey <tromey@redhat.com> * configure.ac: Invoke AM_MAINTAINER_MODE. diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.cc b/libsanitizer/sanitizer_common/sanitizer_linux.cc index e90a68ca1c4..f2a0d39ca99 100644 --- a/libsanitizer/sanitizer_common/sanitizer_linux.cc +++ b/libsanitizer/sanitizer_common/sanitizer_linux.cc @@ -29,12 +29,21 @@ #include <unistd.h> #include <errno.h> +// Are we using 32-bit or 64-bit syscalls? +// x32 (which defines __x86_64__) has __WORDSIZE == 32 +// but it still needs to use 64-bit syscalls. +#if defined(__x86_64__) || __WORDSIZE == 64 +# define SANITIZER_LINUX_USES_64BIT_SYSCALLS 1 +#else +# define SANITIZER_LINUX_USES_64BIT_SYSCALLS 0 +#endif + namespace __sanitizer { // --------------- sanitizer_libc.h void *internal_mmap(void *addr, uptr length, int prot, int flags, int fd, u64 offset) { -#if defined __x86_64__ +#if SANITIZER_LINUX_USES_64BIT_SYSCALLS 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 +76,7 @@ uptr internal_write(fd_t fd, const void *buf, uptr count) { } uptr internal_filesize(fd_t fd) { -#if defined __x86_64__ +#if SANITIZER_LINUX_USES_64BIT_SYSCALLS struct stat st; if (syscall(__NR_fstat, fd, &st)) return -1; |