From 15d71b598ed19f79a8ed6a816b136a6b8f61a078 Mon Sep 17 00:00:00 2001 From: Evgeniy Stepanov Date: Wed, 28 May 2014 13:13:30 +0000 Subject: [PATCH] [sanitizer] Replace -lpthread with -pthread in tests. -lpthread does not work on Android. llvm-svn: 209735 --- .../test/asan/TestCases/Linux/stress_dtls.c | 4 ++-- .../asan/TestCases/Linux/tsd_dtor_leak.cc | 2 +- .../test/asan/TestCases/Linux/uar_signals.cc | 2 +- .../test/asan/TestCases/Linux/unpoison_tls.cc | 2 +- .../asan/TestCases/Posix/init-order-dlopen.cc | 4 ++-- .../asan/TestCases/current_allocated_bytes.cc | 4 ++-- .../test/asan/TestCases/deep_thread_stack.cc | 8 +++---- compiler-rt/test/asan/TestCases/gc-test.cc | 2 +- .../TestCases/init-order-pthread-create.cc | 2 +- .../test/asan/TestCases/stack-overflow.cc | 24 +++++++++---------- .../asan/TestCases/stack-use-after-return.cc | 12 +++++----- compiler-rt/test/asan/lit.cfg | 2 +- compiler-rt/test/tsan/lit.cfg | 2 +- compiler-rt/test/tsan/test_output.sh | 2 +- 14 files changed, 36 insertions(+), 36 deletions(-) diff --git a/compiler-rt/test/asan/TestCases/Linux/stress_dtls.c b/compiler-rt/test/asan/TestCases/Linux/stress_dtls.c index 814adf3e8c59..cb901ee59953 100644 --- a/compiler-rt/test/asan/TestCases/Linux/stress_dtls.c +++ b/compiler-rt/test/asan/TestCases/Linux/stress_dtls.c @@ -9,7 +9,7 @@ // RUN: %clangxx_asan -x c -DSO_NAME=f0 %s -shared -o %t-f0.so -fPIC // RUN: %clangxx_asan -x c -DSO_NAME=f1 %s -shared -o %t-f1.so -fPIC // RUN: %clangxx_asan -x c -DSO_NAME=f2 %s -shared -o %t-f2.so -fPIC -// RUN: %clangxx_asan %s -ldl -lpthread -o %t +// RUN: %clangxx_asan %s -ldl -pthread -o %t // RUN: %run %t 0 3 // RUN: %run %t 2 3 // RUN: ASAN_OPTIONS=verbosity=2 %run %t 10 2 2>&1 | FileCheck %s @@ -31,7 +31,7 @@ /* cc=your-compiler -$cc stress_dtls.c -lpthread -ldl +$cc stress_dtls.c -pthread -ldl for((i=0;i<100;i++)); do $cc -fPIC -shared -DSO_NAME=f$i -o a.out-f$i.so stress_dtls.c; done diff --git a/compiler-rt/test/asan/TestCases/Linux/tsd_dtor_leak.cc b/compiler-rt/test/asan/TestCases/Linux/tsd_dtor_leak.cc index fdac964bfe64..221f6accd932 100644 --- a/compiler-rt/test/asan/TestCases/Linux/tsd_dtor_leak.cc +++ b/compiler-rt/test/asan/TestCases/Linux/tsd_dtor_leak.cc @@ -1,6 +1,6 @@ // Regression test for a leak in tsd: // https://code.google.com/p/address-sanitizer/issues/detail?id=233 -// RUN: %clangxx_asan -O1 %s -lpthread -o %t +// RUN: %clangxx_asan -O1 %s -pthread -o %t // RUN: ASAN_OPTIONS=quarantine_size=1 %run %t #include #include diff --git a/compiler-rt/test/asan/TestCases/Linux/uar_signals.cc b/compiler-rt/test/asan/TestCases/Linux/uar_signals.cc index 3c50fcfd10f1..94e603a49907 100644 --- a/compiler-rt/test/asan/TestCases/Linux/uar_signals.cc +++ b/compiler-rt/test/asan/TestCases/Linux/uar_signals.cc @@ -1,6 +1,6 @@ // This test checks that the implementation of use-after-return // is async-signal-safe. -// RUN: %clangxx_asan -O1 %s -o %t -lpthread && %run %t +// RUN: %clangxx_asan -O1 %s -o %t -pthread && %run %t #include #include #include diff --git a/compiler-rt/test/asan/TestCases/Linux/unpoison_tls.cc b/compiler-rt/test/asan/TestCases/Linux/unpoison_tls.cc index 4c693b4293bb..9c1d74b28e5f 100644 --- a/compiler-rt/test/asan/TestCases/Linux/unpoison_tls.cc +++ b/compiler-rt/test/asan/TestCases/Linux/unpoison_tls.cc @@ -1,7 +1,7 @@ // Test that TLS is unpoisoned on thread death. // REQUIRES: x86_64-supported-target,i386-supported-target -// RUN: %clangxx_asan -O1 %s -lpthread -o %t && %run %t 2>&1 +// RUN: %clangxx_asan -O1 %s -pthread -o %t && %run %t 2>&1 #include #include diff --git a/compiler-rt/test/asan/TestCases/Posix/init-order-dlopen.cc b/compiler-rt/test/asan/TestCases/Posix/init-order-dlopen.cc index f7b0d6acaa2e..2b86ace2c534 100644 --- a/compiler-rt/test/asan/TestCases/Posix/init-order-dlopen.cc +++ b/compiler-rt/test/asan/TestCases/Posix/init-order-dlopen.cc @@ -10,8 +10,8 @@ // If the linker doesn't support --export-dynamic (which is ELF-specific), // try to link without that option. // FIXME: find a better solution. -// RUN: %clangxx_asan -O0 %s -lpthread -ldl -o %t -Wl,--export-dynamic || \ -// RUN: %clangxx_asan -O0 %s -lpthread -ldl -o %t +// RUN: %clangxx_asan -O0 %s -pthread -ldl -o %t -Wl,--export-dynamic || \ +// RUN: %clangxx_asan -O0 %s -pthread -ldl -o %t // RUN: ASAN_OPTIONS=strict_init_order=true %run %t 2>&1 | FileCheck %s #if !defined(SHARED_LIB) #include diff --git a/compiler-rt/test/asan/TestCases/current_allocated_bytes.cc b/compiler-rt/test/asan/TestCases/current_allocated_bytes.cc index a9cd159494ec..413d1a215473 100644 --- a/compiler-rt/test/asan/TestCases/current_allocated_bytes.cc +++ b/compiler-rt/test/asan/TestCases/current_allocated_bytes.cc @@ -1,5 +1,5 @@ -// RUN: %clangxx_asan -O0 %s -lpthread -o %t && %run %t -// RUN: %clangxx_asan -O2 %s -lpthread -o %t && %run %t +// RUN: %clangxx_asan -O0 %s -pthread -o %t && %run %t +// RUN: %clangxx_asan -O2 %s -pthread -o %t && %run %t #include #include diff --git a/compiler-rt/test/asan/TestCases/deep_thread_stack.cc b/compiler-rt/test/asan/TestCases/deep_thread_stack.cc index 1e802b089c2a..23c8bc88fb03 100644 --- a/compiler-rt/test/asan/TestCases/deep_thread_stack.cc +++ b/compiler-rt/test/asan/TestCases/deep_thread_stack.cc @@ -1,7 +1,7 @@ -// RUN: %clangxx_asan -O0 %s -lpthread -o %t && not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O1 %s -lpthread -o %t && not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O2 %s -lpthread -o %t && not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O3 %s -lpthread -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O0 %s -pthread -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O1 %s -pthread -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O2 %s -pthread -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O3 %s -pthread -o %t && not %run %t 2>&1 | FileCheck %s #include diff --git a/compiler-rt/test/asan/TestCases/gc-test.cc b/compiler-rt/test/asan/TestCases/gc-test.cc index b15e668107fa..76113ec4279f 100644 --- a/compiler-rt/test/asan/TestCases/gc-test.cc +++ b/compiler-rt/test/asan/TestCases/gc-test.cc @@ -1,4 +1,4 @@ -// RUN: %clangxx_asan %s -lpthread -o %t +// RUN: %clangxx_asan %s -pthread -o %t // RUN: env ASAN_OPTIONS=detect_stack_use_after_return=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 // RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK0 diff --git a/compiler-rt/test/asan/TestCases/init-order-pthread-create.cc b/compiler-rt/test/asan/TestCases/init-order-pthread-create.cc index e3334364e536..eeff308a4cd5 100644 --- a/compiler-rt/test/asan/TestCases/init-order-pthread-create.cc +++ b/compiler-rt/test/asan/TestCases/init-order-pthread-create.cc @@ -1,7 +1,7 @@ // Check that init-order checking is properly disabled if pthread_create is // called. -// RUN: %clangxx_asan %s %p/Helpers/init-order-pthread-create-extra.cc -lpthread -o %t +// RUN: %clangxx_asan %s %p/Helpers/init-order-pthread-create-extra.cc -pthread -o %t // RUN: env ASAN_OPTIONS=strict_init_order=true %run %t #include diff --git a/compiler-rt/test/asan/TestCases/stack-overflow.cc b/compiler-rt/test/asan/TestCases/stack-overflow.cc index 4861fd211806..4b9e75b98afd 100644 --- a/compiler-rt/test/asan/TestCases/stack-overflow.cc +++ b/compiler-rt/test/asan/TestCases/stack-overflow.cc @@ -1,18 +1,18 @@ // Test ASan detection of stack-overflow condition. -// RUN: %clangxx_asan -O0 %s -DSMALL_FRAME -lpthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O3 %s -DSMALL_FRAME -lpthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O0 %s -DSAVE_ALL_THE_REGISTERS -lpthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O3 %s -DSAVE_ALL_THE_REGISTERS -lpthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O0 %s -lpthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O3 %s -lpthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O0 %s -DSMALL_FRAME -pthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O3 %s -DSMALL_FRAME -pthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O0 %s -DSAVE_ALL_THE_REGISTERS -pthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O3 %s -DSAVE_ALL_THE_REGISTERS -pthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O0 %s -pthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O3 %s -pthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O0 %s -DTHREAD -DSMALL_FRAME -lpthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O3 %s -DTHREAD -DSMALL_FRAME -lpthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O0 %s -DTHREAD -DSAVE_ALL_THE_REGISTERS -lpthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O3 %s -DTHREAD -DSAVE_ALL_THE_REGISTERS -lpthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O0 %s -DTHREAD -lpthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O3 %s -DTHREAD -lpthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O0 %s -DTHREAD -DSMALL_FRAME -pthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O3 %s -DTHREAD -DSMALL_FRAME -pthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O0 %s -DTHREAD -DSAVE_ALL_THE_REGISTERS -pthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O3 %s -DTHREAD -DSAVE_ALL_THE_REGISTERS -pthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O0 %s -DTHREAD -pthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O3 %s -DTHREAD -pthread -o %t && env ASAN_OPTIONS=use_sigaltstack=1 not %run %t 2>&1 | FileCheck %s // RUN: not %run %t 2>&1 | FileCheck %s #include diff --git a/compiler-rt/test/asan/TestCases/stack-use-after-return.cc b/compiler-rt/test/asan/TestCases/stack-use-after-return.cc index e31a63cfef2a..437c457748c4 100644 --- a/compiler-rt/test/asan/TestCases/stack-use-after-return.cc +++ b/compiler-rt/test/asan/TestCases/stack-use-after-return.cc @@ -1,14 +1,14 @@ // RUN: export ASAN_OPTIONS=detect_stack_use_after_return=1 -// RUN: %clangxx_asan -O0 %s -lpthread -o %t && not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O1 %s -lpthread -o %t && not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O2 %s -lpthread -o %t && not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O3 %s -lpthread -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O0 %s -pthread -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O1 %s -pthread -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O2 %s -pthread -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O3 %s -pthread -o %t && not %run %t 2>&1 | FileCheck %s // RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %run %t // Regression test for a CHECK failure with small stack size and large frame. -// RUN: %clangxx_asan -O3 %s -lpthread -o %t -DkSize=10000 -DUseThread -DkStackSize=65536 && not %run %t 2>&1 | FileCheck --check-prefix=THREAD %s +// RUN: %clangxx_asan -O3 %s -pthread -o %t -DkSize=10000 -DUseThread -DkStackSize=65536 && not %run %t 2>&1 | FileCheck --check-prefix=THREAD %s // // Test that we can find UAR in a thread other than main: -// RUN: %clangxx_asan -DUseThread -O2 %s -lpthread -o %t && not %run %t 2>&1 | FileCheck --check-prefix=THREAD %s +// RUN: %clangxx_asan -DUseThread -O2 %s -pthread -o %t && not %run %t 2>&1 | FileCheck --check-prefix=THREAD %s // // Test the max_uar_stack_size_log/min_uar_stack_size_log flag. // diff --git a/compiler-rt/test/asan/lit.cfg b/compiler-rt/test/asan/lit.cfg index ad9786f3eaee..ac88223b82f0 100644 --- a/compiler-rt/test/asan/lit.cfg +++ b/compiler-rt/test/asan/lit.cfg @@ -26,7 +26,7 @@ config.test_source_root = os.path.dirname(__file__) # GCC-ASan doesn't link in all the necessary libraries automatically, so # we have to do it ourselves. if config.compiler_id == 'GNU': - extra_linkflags = ["-lpthread", "-lstdc++", "-ldl"] + extra_linkflags = ["-pthread", "-lstdc++", "-ldl"] else: extra_linkflags = [] # Setup default compiler flags used with -fsanitize=address option. diff --git a/compiler-rt/test/tsan/lit.cfg b/compiler-rt/test/tsan/lit.cfg index ae2197135a72..7b7c2bb71b1d 100644 --- a/compiler-rt/test/tsan/lit.cfg +++ b/compiler-rt/test/tsan/lit.cfg @@ -24,7 +24,7 @@ config.environment['TSAN_OPTIONS'] = tsan_options # GCC driver doesn't add necessary compile/link flags with -fsanitize=thread. if config.compiler_id == 'GNU': - extra_cflags = ["-fPIE", "-lpthread", "-ldl", "-lstdc++", "-lrt", "-pie"] + extra_cflags = ["-fPIE", "-pthread", "-ldl", "-lstdc++", "-lrt", "-pie"] else: extra_cflags = [] diff --git a/compiler-rt/test/tsan/test_output.sh b/compiler-rt/test/tsan/test_output.sh index 8a15a673862f..c22258fa172d 100755 --- a/compiler-rt/test/tsan/test_output.sh +++ b/compiler-rt/test/tsan/test_output.sh @@ -14,7 +14,7 @@ BLACKLIST=$HERE/Helpers/blacklist.txt # TODO: add testing for all of -O0...-O3 CFLAGS="-fsanitize=thread -fsanitize-blacklist=$BLACKLIST -fPIE -O1 -g -Wall" -LDFLAGS="-pie -lpthread -ldl -lrt -lm -Wl,--whole-archive $TSAN_DIR/rtl/libtsan.a -Wl,--no-whole-archive" +LDFLAGS="-pie -pthread -ldl -lrt -lm -Wl,--whole-archive $TSAN_DIR/rtl/libtsan.a -Wl,--no-whole-archive" test_file() { SRC=$1