diff options
author | Dan Liew <dan@su-root.co.uk> | 2018-05-14 15:48:49 +0000 |
---|---|---|
committer | Dan Liew <dan@su-root.co.uk> | 2018-05-14 15:48:49 +0000 |
commit | 7bb5a5d2e5f6c07afefd5fde2d7f858663b3da08 (patch) | |
tree | 8133360fcd3a153c0d0131b79924ec6af1dce3a4 /test/asan | |
parent | 504c4196afe17ab91d73b6a4b691c911c042908b (diff) |
Fix another case where libstdc++ is being inappropriately requested (see
r328775) for all platforms.
Given that this is the second occurance of this problem it seemed worth
fixing this problem in a more generic way. r328775 has been reverted and
now a substitution `%linux_static_libstdcplusplus` has been provided.
This substitution expands to Clang driver arguments to use a static
libstdc++ on Linux and on all other platforms it expands to nothing.
The `asan/TestCases/throw_invoke_test.cc` and
`test/tsan/static_init6.cc` test cases now use this substitution.
rdar://problem/39948818
Differential Revision: https://reviews.llvm.org/D46401
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@332254 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/asan')
-rw-r--r-- | test/asan/TestCases/Linux/throw_invoke_test_libstdcxx.cc | 48 | ||||
-rw-r--r-- | test/asan/TestCases/throw_invoke_test.cc | 1 |
2 files changed, 1 insertions, 48 deletions
diff --git a/test/asan/TestCases/Linux/throw_invoke_test_libstdcxx.cc b/test/asan/TestCases/Linux/throw_invoke_test_libstdcxx.cc deleted file mode 100644 index 69d853888..000000000 --- a/test/asan/TestCases/Linux/throw_invoke_test_libstdcxx.cc +++ /dev/null @@ -1,48 +0,0 @@ -// This the basically the `throw_invoke_test.cc` test but using libstdc++ -// instead of the default. -// RUN: %clangxx_asan %s -o %t -stdlib=libstdc++ -static-libstdc++ && %run %t - -#include <stdio.h> -static volatile int zero = 0; -inline void pretend_to_do_something(void *x) { - __asm__ __volatile__("" : : "r"(x) : "memory"); -} - -__attribute__((noinline)) void ReallyThrow() { - fprintf(stderr, "ReallyThrow\n"); - try { - if (zero == 0) - throw 42; - else if (zero == 1) - throw 1.; - } catch (double x) { - } -} - -__attribute__((noinline)) void Throw() { - int a, b, c, d, e; - pretend_to_do_something(&a); - pretend_to_do_something(&b); - pretend_to_do_something(&c); - pretend_to_do_something(&d); - pretend_to_do_something(&e); - fprintf(stderr, "Throw stack = %p\n", &a); - ReallyThrow(); -} - -__attribute__((noinline)) void CheckStack() { - int ar[100]; - pretend_to_do_something(ar); - for (int i = 0; i < 100; i++) - ar[i] = i; - fprintf(stderr, "CheckStack stack = %p, %p\n", ar, ar + 100); -} - -int main(int argc, char **argv) { - try { - Throw(); - } catch (int a) { - fprintf(stderr, "a = %d\n", a); - } - CheckStack(); -} diff --git a/test/asan/TestCases/throw_invoke_test.cc b/test/asan/TestCases/throw_invoke_test.cc index ade8c0cac..bbfa1c7b9 100644 --- a/test/asan/TestCases/throw_invoke_test.cc +++ b/test/asan/TestCases/throw_invoke_test.cc @@ -1,4 +1,5 @@ // RUN: %clangxx_asan %s -o %t && %run %t +// RUN: %clangxx_asan %s -o %t %linux_static_libstdcplusplus && %run %t #include <stdio.h> static volatile int zero = 0; |