[compiler-rt] r209735 - [sanitizer] Replace -lpthread with -pthread in tests.

Evgeniy Stepanov eugeni.stepanov at gmail.com
Wed May 28 06:13:31 PDT 2014


Author: eugenis
Date: Wed May 28 08:13:30 2014
New Revision: 209735

URL: http://llvm.org/viewvc/llvm-project?rev=209735&view=rev
Log:
[sanitizer] Replace -lpthread with -pthread in tests.

-lpthread does not work on Android.

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

Modified: compiler-rt/trunk/test/asan/TestCases/Linux/stress_dtls.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/stress_dtls.c?rev=209735&r1=209734&r2=209735&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/stress_dtls.c (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/stress_dtls.c Wed May 28 08:13:30 2014
@@ -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

Modified: compiler-rt/trunk/test/asan/TestCases/Linux/tsd_dtor_leak.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/tsd_dtor_leak.cc?rev=209735&r1=209734&r2=209735&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/tsd_dtor_leak.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/tsd_dtor_leak.cc Wed May 28 08:13:30 2014
@@ -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>

Modified: compiler-rt/trunk/test/asan/TestCases/Linux/uar_signals.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/uar_signals.cc?rev=209735&r1=209734&r2=209735&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/uar_signals.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/uar_signals.cc Wed May 28 08:13:30 2014
@@ -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>

Modified: compiler-rt/trunk/test/asan/TestCases/Linux/unpoison_tls.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/unpoison_tls.cc?rev=209735&r1=209734&r2=209735&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/unpoison_tls.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/unpoison_tls.cc Wed May 28 08:13:30 2014
@@ -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>

Modified: compiler-rt/trunk/test/asan/TestCases/Posix/init-order-dlopen.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/init-order-dlopen.cc?rev=209735&r1=209734&r2=209735&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Posix/init-order-dlopen.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Posix/init-order-dlopen.cc Wed May 28 08:13:30 2014
@@ -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>

Modified: compiler-rt/trunk/test/asan/TestCases/current_allocated_bytes.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/current_allocated_bytes.cc?rev=209735&r1=209734&r2=209735&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/current_allocated_bytes.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/current_allocated_bytes.cc Wed May 28 08:13:30 2014
@@ -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>

Modified: compiler-rt/trunk/test/asan/TestCases/deep_thread_stack.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/deep_thread_stack.cc?rev=209735&r1=209734&r2=209735&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/deep_thread_stack.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/deep_thread_stack.cc Wed May 28 08:13:30 2014
@@ -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>
 

Modified: compiler-rt/trunk/test/asan/TestCases/gc-test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/gc-test.cc?rev=209735&r1=209734&r2=209735&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/gc-test.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/gc-test.cc Wed May 28 08:13:30 2014
@@ -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
 

Modified: compiler-rt/trunk/test/asan/TestCases/init-order-pthread-create.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/init-order-pthread-create.cc?rev=209735&r1=209734&r2=209735&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/init-order-pthread-create.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/init-order-pthread-create.cc Wed May 28 08:13:30 2014
@@ -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>

Modified: compiler-rt/trunk/test/asan/TestCases/stack-overflow.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/stack-overflow.cc?rev=209735&r1=209734&r2=209735&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/stack-overflow.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/stack-overflow.cc Wed May 28 08:13:30 2014
@@ -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>

Modified: compiler-rt/trunk/test/asan/TestCases/stack-use-after-return.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/stack-use-after-return.cc?rev=209735&r1=209734&r2=209735&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/stack-use-after-return.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/stack-use-after-return.cc Wed May 28 08:13:30 2014
@@ -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.
 //

Modified: compiler-rt/trunk/test/asan/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/lit.cfg?rev=209735&r1=209734&r2=209735&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/lit.cfg (original)
+++ compiler-rt/trunk/test/asan/lit.cfg Wed May 28 08:13:30 2014
@@ -26,7 +26,7 @@ config.test_source_root = os.path.dirnam
 # 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.

Modified: compiler-rt/trunk/test/tsan/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/lit.cfg?rev=209735&r1=209734&r2=209735&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/lit.cfg (original)
+++ compiler-rt/trunk/test/tsan/lit.cfg Wed May 28 08:13:30 2014
@@ -24,7 +24,7 @@ config.environment['TSAN_OPTIONS'] = tsa
 
 # 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 = []
 

Modified: compiler-rt/trunk/test/tsan/test_output.sh
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/test_output.sh?rev=209735&r1=209734&r2=209735&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/test_output.sh (original)
+++ compiler-rt/trunk/test/tsan/test_output.sh Wed May 28 08:13:30 2014
@@ -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





More information about the llvm-commits mailing list