diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2015-11-24 20:28:48 +0000 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2015-11-24 20:28:48 +0000 |
commit | 29ffb68259bfefe0a2ec649f0912cba4f71e85ba (patch) | |
tree | 95cf3e9b0d5cc6c9aa5d85b751ab97bac1467884 | |
parent | 4c31fcfcf5951e0eeed26103f010d082c98aa36f (diff) | |
download | bcm5719-llvm-29ffb68259bfefe0a2ec649f0912cba4f71e85ba.tar.gz bcm5719-llvm-29ffb68259bfefe0a2ec649f0912cba4f71e85ba.zip |
[compiler-rt] [msan] Couple of fixes for msan with libc++
This patch adds some fixes for MSAN with libc++ for aarch64:
1. Adds the libmsan_loadable name for aarch64.
2. Fixes some pthread_attr_setstacksize for aarch64, since glibc sets
the mininum stack size to be higher than the x86_64 default (16KB
vs 128KB).
3. Fixes a swprintf null char constant definition.
llvm-svn: 254015
-rw-r--r-- | compiler-rt/lib/msan/tests/msan_test.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/compiler-rt/lib/msan/tests/msan_test.cc b/compiler-rt/lib/msan/tests/msan_test.cc index 57938329d27..b7162b3c081 100644 --- a/compiler-rt/lib/msan/tests/msan_test.cc +++ b/compiler-rt/lib/msan/tests/msan_test.cc @@ -1883,7 +1883,7 @@ TEST(MemorySanitizer, swprintf) { ASSERT_EQ(buff[1], '2'); ASSERT_EQ(buff[2], '3'); ASSERT_EQ(buff[6], '7'); - ASSERT_EQ(buff[7], 0); + ASSERT_EQ(buff[7], L'\0'); EXPECT_POISONED(buff[8]); } @@ -2886,6 +2886,8 @@ static void GetPathToLoadable(char *buf, size_t sz) { static const char basename[] = "libmsan_loadable.mips64.so"; #elif defined(__mips64) static const char basename[] = "libmsan_loadable.mips64el.so"; +#elif defined(__aarch64__) + static const char basename[] = "libmsan_loadable.aarch64.so"; #endif int res = snprintf(buf, sz, "%.*s/%s", (int)dir_len, program_path, basename); @@ -2992,6 +2994,14 @@ static void *SmallStackThread_threadfn(void* data) { return 0; } +#ifdef PTHREAD_STACK_MIN +# define SMALLSTACKSIZE PTHREAD_STACK_MIN +# define SMALLPRESTACKSIZE PTHREAD_STACK_MIN +#else +# define SMALLSTACKSIZE 64 * 1024 +# define SMALLPRESTACKSIZE 16 * 1024 +#endif + TEST(MemorySanitizer, SmallStackThread) { pthread_attr_t attr; pthread_t t; @@ -2999,7 +3009,7 @@ TEST(MemorySanitizer, SmallStackThread) { int res; res = pthread_attr_init(&attr); ASSERT_EQ(0, res); - res = pthread_attr_setstacksize(&attr, 64 * 1024); + res = pthread_attr_setstacksize(&attr, SMALLSTACKSIZE); ASSERT_EQ(0, res); res = pthread_create(&t, &attr, SmallStackThread_threadfn, NULL); ASSERT_EQ(0, res); @@ -3016,7 +3026,7 @@ TEST(MemorySanitizer, SmallPreAllocatedStackThread) { res = pthread_attr_init(&attr); ASSERT_EQ(0, res); void *stack; - const size_t kStackSize = 16 * 1024; + const size_t kStackSize = SMALLPRESTACKSIZE; res = posix_memalign(&stack, 4096, kStackSize); ASSERT_EQ(0, res); res = pthread_attr_setstack(&attr, stack, kStackSize); |