[compiler-rt] r254015 - [compiler-rt] [msan] Couple of fixes for msan with libc++
Adhemerval Zanella via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 24 12:28:48 PST 2015
Author: azanella
Date: Tue Nov 24 14:28:48 2015
New Revision: 254015
URL: http://llvm.org/viewvc/llvm-project?rev=254015&view=rev
Log:
[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.
Modified:
compiler-rt/trunk/lib/msan/tests/msan_test.cc
Modified: compiler-rt/trunk/lib/msan/tests/msan_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/tests/msan_test.cc?rev=254015&r1=254014&r2=254015&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/tests/msan_test.cc (original)
+++ compiler-rt/trunk/lib/msan/tests/msan_test.cc Tue Nov 24 14:28:48 2015
@@ -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,
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(v
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, SmallPreAllocatedS
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);
More information about the llvm-commits
mailing list