summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViktor Kutuzov <vkutuzov@accesssoftek.com>2015-01-08 13:28:22 +0000
committerViktor Kutuzov <vkutuzov@accesssoftek.com>2015-01-08 13:28:22 +0000
commite01a595dad8cfae07689d94247f30ad8b107e195 (patch)
treec351442f00c7f2b50f02f5fb00cc74f022626fda
parentd3d385d6248548f2b53eaf2bf610646a41d2cfaa (diff)
downloadbcm5719-llvm-e01a595dad8cfae07689d94247f30ad8b107e195.tar.gz
bcm5719-llvm-e01a595dad8cfae07689d94247f30ad8b107e195.zip
[Sanitizers] Fix internal_lseek() to work on FreeBSD
Differential Revision: http://reviews.llvm.org/D6825 llvm-svn: 225443
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h5
-rw-r--r--compiler-rt/lib/sanitizer_common/tests/sanitizer_libc_test.cc7
2 files changed, 8 insertions, 4 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
index 962fc7d60bd..450d9184e99 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
@@ -85,8 +85,9 @@ typedef int fd_t;
// WARNING: OFF_T may be different from OS type off_t, depending on the value of
// _FILE_OFFSET_BITS. This definition of OFF_T matches the ABI of system calls
// like pread and mmap, as opposed to pread64 and mmap64.
-// Mac and Linux/x86-64 are special.
-#if SANITIZER_MAC || (SANITIZER_LINUX && defined(__x86_64__))
+// FreeBSD, Mac and Linux/x86-64 are special.
+#if SANITIZER_FREEBSD || SANITIZER_MAC || \
+ (SANITIZER_LINUX && defined(__x86_64__))
typedef u64 OFF_T;
#else
typedef uptr OFF_T;
diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_libc_test.cc b/compiler-rt/lib/sanitizer_common/tests/sanitizer_libc_test.cc
index 65cbe9a5d14..8712d2c1b2a 100644
--- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_libc_test.cc
+++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_libc_test.cc
@@ -142,8 +142,11 @@ TEST(SanitizerCommon, InternalMmapWithOffset) {
res = internal_ftruncate(fd, page_size * 2);
ASSERT_FALSE(internal_iserror(res));
- internal_lseek(fd, page_size, SEEK_SET);
- internal_write(fd, "AB", 2);
+ res = internal_lseek(fd, page_size, SEEK_SET);
+ ASSERT_FALSE(internal_iserror(res));
+
+ res = internal_write(fd, "AB", 2);
+ ASSERT_FALSE(internal_iserror(res));
char *p = (char *)MapWritableFileToMemory(nullptr, page_size, fd, page_size);
ASSERT_NE(nullptr, p);
OpenPOWER on IntegriCloud