[sanitizer] Replace -lpthread with -pthread in tests.
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Wed, 28 May 2014 13:13:30 +0000 (13:13 +0000)
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Wed, 28 May 2014 13:13:30 +0000 (13:13 +0000)
-lpthread does not work on Android.

llvm-svn: 209735

14 files changed:
compiler-rt/test/asan/TestCases/Linux/stress_dtls.c
compiler-rt/test/asan/TestCases/Linux/tsd_dtor_leak.cc
compiler-rt/test/asan/TestCases/Linux/uar_signals.cc
compiler-rt/test/asan/TestCases/Linux/unpoison_tls.cc
compiler-rt/test/asan/TestCases/Posix/init-order-dlopen.cc
compiler-rt/test/asan/TestCases/current_allocated_bytes.cc
compiler-rt/test/asan/TestCases/deep_thread_stack.cc
compiler-rt/test/asan/TestCases/gc-test.cc
compiler-rt/test/asan/TestCases/init-order-pthread-create.cc
compiler-rt/test/asan/TestCases/stack-overflow.cc
compiler-rt/test/asan/TestCases/stack-use-after-return.cc
compiler-rt/test/asan/lit.cfg
compiler-rt/test/tsan/lit.cfg
compiler-rt/test/tsan/test_output.sh

index 814adf3..cb901ee 100644 (file)
@@ -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
index fdac964..221f6ac 100644 (file)
@@ -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 <pthread.h>
 #include <stdio.h>
index 3c50fcf..94e603a 100644 (file)
@@ -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 <signal.h>
 #include <stdlib.h>
 #include <stdio.h>
index 4c693b4..9c1d74b 100644 (file)
@@ -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 <assert.h>
 #include <pthread.h>
index f7b0d6a..2b86ace 100644 (file)
@@ -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 <dlfcn.h>
index a9cd159..413d1a2 100644 (file)
@@ -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 <assert.h>
 #include <pthread.h>
index 1e802b0..23c8bc8 100644 (file)
@@ -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 <pthread.h>
 
index b15e668..76113ec 100644 (file)
@@ -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
 
index e333436..eeff308 100644 (file)
@@ -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 <stdio.h>
index 4861fd2..4b9e75b 100644 (file)
@@ -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 <assert.h>
index e31a63c..437c457 100644 (file)
@@ -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.
 //
index ad9786f..ac88223 100644 (file)
@@ -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.
index ae21971..7b7c2bb 100644 (file)
@@ -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 = []
 
index 8a15a67..c22258f 100755 (executable)
@@ -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