summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2016-04-20 20:32:18 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2016-04-20 20:32:18 +0000
commit32773333cbda0c2ca8a643b82fca24a13bc70233 (patch)
tree87f1c8279036db1fa4f092cef5ee3580ee35a0a0
parent3c406c2da52302eb5cced431373f240b9c037841 (diff)
downloadbcm5719-llvm-32773333cbda0c2ca8a643b82fca24a13bc70233.tar.gz
bcm5719-llvm-32773333cbda0c2ca8a643b82fca24a13bc70233.zip
[msan] Implement GetPageSize in the test.
Instead of calling a sanitizer_common function, implement GetPageSize in the test directly. MSan runtime does not export __sanitizer::* symbols, and the current code breaks when the test and the runtime library are in the separate link units (ex. when the test is built as a shared library). llvm-svn: 266910
-rw-r--r--compiler-rt/lib/msan/tests/msan_test.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/compiler-rt/lib/msan/tests/msan_test.cc b/compiler-rt/lib/msan/tests/msan_test.cc
index a7a06a06205..7ba43662f7d 100644
--- a/compiler-rt/lib/msan/tests/msan_test.cc
+++ b/compiler-rt/lib/msan/tests/msan_test.cc
@@ -115,13 +115,9 @@ void *mempcpy(void *dest, const void *src, size_t n);
# define SUPERUSER_GROUP "root"
#endif
-// We cannot include sanitizer_common.h (it conflicts with public interface
-// headers), so just pull this function directly.
-
-namespace __sanitizer {
-uintptr_t GetPageSizeCached();
+static uintptr_t GetPageSize() {
+ return sysconf(_SC_PAGESIZE);
}
-using __sanitizer::GetPageSizeCached;
const size_t kMaxPathLength = 4096;
@@ -3239,7 +3235,7 @@ TEST(MemorySanitizer, memalign) {
TEST(MemorySanitizer, valloc) {
void *a = valloc(100);
- uintptr_t PageSize = GetPageSizeCached();
+ uintptr_t PageSize = GetPageSize();
EXPECT_EQ(0U, (uintptr_t)a % PageSize);
free(a);
}
@@ -3247,7 +3243,7 @@ TEST(MemorySanitizer, valloc) {
// There's no pvalloc() on FreeBSD.
#if !defined(__FreeBSD__)
TEST(MemorySanitizer, pvalloc) {
- uintptr_t PageSize = GetPageSizeCached();
+ uintptr_t PageSize = GetPageSize();
void *p = pvalloc(PageSize + 100);
EXPECT_EQ(0U, (uintptr_t)p % PageSize);
EXPECT_EQ(2 * PageSize, __sanitizer_get_allocated_size(p));
OpenPOWER on IntegriCloud