[ASan] Explicitly specify -ldl/-lpthread in RUN-lines where needed
authorAlexey Samsonov <samsonov@google.com>
Fri, 4 Apr 2014 12:24:46 +0000 (12:24 +0000)
committerAlexey Samsonov <samsonov@google.com>
Fri, 4 Apr 2014 12:24:46 +0000 (12:24 +0000)
llvm-svn: 205623

15 files changed:
compiler-rt/test/asan/TestCases/Linux/function-sections-are-bad.cc
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/unpoison_tls.cc
compiler-rt/test/asan/TestCases/asan-symbolize-sanity-test.cc
compiler-rt/test/asan/TestCases/current_allocated_bytes.cc
compiler-rt/test/asan/TestCases/deep_thread_stack.cc
compiler-rt/test/asan/TestCases/dlclose-test.cc
compiler-rt/test/asan/TestCases/gc-test.cc
compiler-rt/test/asan/TestCases/init-order-dlopen.cc
compiler-rt/test/asan/TestCases/init-order-pthread-create.cc
compiler-rt/test/asan/TestCases/shared-lib-test.cc
compiler-rt/test/asan/TestCases/stack-overflow.cc
compiler-rt/test/asan/TestCases/stack-use-after-return.cc
compiler-rt/test/asan/TestCases/start-deactivated.cc

index 0bbeb39..1481132 100644 (file)
@@ -1,6 +1,6 @@
 // Check that --gc-sections does not throw away (or localize) parts of sanitizer
 // interface.
-// RUN: %clang_asan %s -Wl,--gc-sections -o %t
+// RUN: %clang_asan %s -Wl,--gc-sections -ldl -o %t
 // RUN: %clang_asan %s -DBUILD_SO -fPIC -o %t-so.so -shared
 // RUN: %t 2>&1
 
index 24946c8..474bd63 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 -o %t
+// RUN: %clangxx_asan %s -ldl -lpthread -o %t
 // RUN: %t 0 3
 // RUN: %t 2 3
 // RUN: ASAN_OPTIONS=verbosity=2 %t 10 2 2>&1 | FileCheck %s
index a1d89ee..2716982 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 -o %t
+// RUN: %clangxx_asan -O1 %s -lpthread -o %t
 // RUN: ASAN_OPTIONS=quarantine_size=1 %t
 #include <pthread.h>
 #include <stdio.h>
index d67c4f9..60d8ff2 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 -o %t && %t 2>&1
+// RUN: %clangxx_asan -O1 %s -lpthread -o %t && %t 2>&1
 
 #include <assert.h>
 #include <pthread.h>
index c61850f..6ff3a46 100644 (file)
@@ -2,7 +2,7 @@
 // shared object files.
 
 // RUN: %clangxx_asan -O0 %p/SharedLibs/shared-lib-test-so.cc -fPIC -shared -o %t-so.so
-// RUN: %clangxx_asan -O0 %s -o %t
+// RUN: %clangxx_asan -O0 %s -ldl -o %t
 // RUN: ASAN_OPTIONS=symbolize=0 not %t 2>&1 | %asan_symbolize | FileCheck %s
 #include <dlfcn.h>
 #include <stdio.h>
index 669cf15..353ed72 100644 (file)
@@ -1,5 +1,5 @@
-// RUN: %clangxx_asan -O0 %s -o %t && %t
-// RUN: %clangxx_asan -O2 %s -o %t && %t
+// RUN: %clangxx_asan -O0 %s -lpthread -o %t && %t
+// RUN: %clangxx_asan -O2 %s -lpthread -o %t && %t
 
 #include <assert.h>
 #include <pthread.h>
index 92e0d66..7ea1427 100644 (file)
@@ -1,7 +1,7 @@
-// RUN: %clangxx_asan -O0 %s -o %t && not %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O1 %s -o %t && not %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O2 %s -o %t && not %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O3 %s -o %t && not %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O0 %s -lpthread -o %t && not %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O1 %s -lpthread -o %t && not %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O2 %s -lpthread -o %t && not %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O3 %s -lpthread -o %t && not %t 2>&1 | FileCheck %s
 
 #include <pthread.h>
 
index 03ed160..2c81e47 100644 (file)
 // It works on i368/x86_64 Linux, but not necessary anywhere else.
 // REQUIRES: x86_64-supported-target,i386-supported-target
 
-// RUN: %clangxx_asan -O0 %p/SharedLibs/dlclose-test-so.cc \
-// RUN:     -fPIC -shared -o %t-so.so
-// RUN: %clangxx_asan -O0 %s -o %t && %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O1 %p/SharedLibs/dlclose-test-so.cc \
-// RUN:     -fPIC -shared -o %t-so.so
-// RUN: %clangxx_asan -O1 %s -o %t && %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O2 %p/SharedLibs/dlclose-test-so.cc \
-// RUN:     -fPIC -shared -o %t-so.so
-// RUN: %clangxx_asan -O2 %s -o %t && %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O3 %p/SharedLibs/dlclose-test-so.cc \
-// RUN:     -fPIC -shared -o %t-so.so
-// RUN: %clangxx_asan -O3 %s -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O0 %p/SharedLibs/dlclose-test-so.cc -fPIC -shared -o %t-so.so
+// RUN: %clangxx_asan -O0 %s -ldl -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O1 %p/SharedLibs/dlclose-test-so.cc -fPIC -shared -o %t-so.so
+// RUN: %clangxx_asan -O1 %s -ldl -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O2 %p/SharedLibs/dlclose-test-so.cc -fPIC -shared -o %t-so.so
+// RUN: %clangxx_asan -O2 %s -ldl -o %t && %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O3 %p/SharedLibs/dlclose-test-so.cc -fPIC -shared -o %t-so.so
+// RUN: %clangxx_asan -O3 %s -ldl -o %t && %t 2>&1 | FileCheck %s
 
 #include <assert.h>
 #include <dlfcn.h>
index 9841464..8115262 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clangxx_asan  %s -o %t
+// RUN: %clangxx_asan %s -lpthread -o %t
 // RUN: ASAN_OPTIONS=detect_stack_use_after_return=1 %t 2>&1 | FileCheck %s --check-prefix=CHECK1
 // RUN: ASAN_OPTIONS=detect_stack_use_after_return=0 %t 2>&1 | FileCheck %s --check-prefix=CHECK0
 
index d30d119..4334def 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 -o %t -Wl,--export-dynamic || \
-// RUN:     %clangxx_asan -O0 %s -o %t
+// RUN: %clangxx_asan -O0 %s -lpthread -ldl -o %t -Wl,--export-dynamic || \
+// RUN:     %clangxx_asan -O0 %s -lpthread -ldl -o %t
 // RUN: ASAN_OPTIONS=strict_init_order=true %t 2>&1 | FileCheck %s
 #include <dlfcn.h>
 #include <pthread.h>
index 5203121..96e0865 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 -o %t
+// RUN: %clangxx_asan %s %p/Helpers/init-order-pthread-create-extra.cc -lpthread -o %t
 // RUN: ASAN_OPTIONS=strict_init_order=true %t
 
 #include <stdio.h>
index 126903a..275d7c7 100644 (file)
@@ -1,15 +1,11 @@
-// RUN: %clangxx_asan -O0 %p/SharedLibs/shared-lib-test-so.cc \
-// RUN:     -fPIC -shared -o %t-so.so
-// RUN: %clangxx_asan -O0 %s -o %t && not %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O1 %p/SharedLibs/shared-lib-test-so.cc \
-// RUN:     -fPIC -shared -o %t-so.so
-// RUN: %clangxx_asan -O1 %s -o %t && not %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O2 %p/SharedLibs/shared-lib-test-so.cc \
-// RUN:     -fPIC -shared -o %t-so.so
-// RUN: %clangxx_asan -O2 %s -o %t && not %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O3 %p/SharedLibs/shared-lib-test-so.cc \
-// RUN:     -fPIC -shared -o %t-so.so
-// RUN: %clangxx_asan -O3 %s -o %t && not %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O0 %p/SharedLibs/shared-lib-test-so.cc -fPIC -shared -o %t-so.so
+// RUN: %clangxx_asan -O0 %s -ldl -o %t && not %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O1 %p/SharedLibs/shared-lib-test-so.cc -fPIC -shared -o %t-so.so
+// RUN: %clangxx_asan -O1 %s -ldl -o %t && not %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O2 %p/SharedLibs/shared-lib-test-so.cc -fPIC -shared -o %t-so.so
+// RUN: %clangxx_asan -O2 %s -ldl -o %t && not %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O3 %p/SharedLibs/shared-lib-test-so.cc -fPIC -shared -o %t-so.so
+// RUN: %clangxx_asan -O3 %s -ldl -o %t && not %t 2>&1 | FileCheck %s
 
 #include <dlfcn.h>
 #include <stdio.h>
index 56d510d..dce116e 100644 (file)
@@ -1,18 +1,18 @@
 // Test ASan detection of stack-overflow condition.
 
-// RUN: %clangxx_asan -O0 %s -DSMALL_FRAME -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O3 %s -DSMALL_FRAME -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O0 %s -DSAVE_ALL_THE_REGISTERS -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O3 %s -DSAVE_ALL_THE_REGISTERS -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O0 %s -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O3 %s -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O0 %s -DSMALL_FRAME -lpthread -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O3 %s -DSMALL_FRAME -lpthread -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O0 %s -DSAVE_ALL_THE_REGISTERS -lpthread -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O3 %s -DSAVE_ALL_THE_REGISTERS -lpthread -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O0 %s -lpthread -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O3 %s -lpthread -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %t 2>&1 | FileCheck %s
 
-// RUN: %clangxx_asan -O0 %s -DTHREAD -DSMALL_FRAME -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O3 %s -DTHREAD -DSMALL_FRAME -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O0 %s -DTHREAD -DSAVE_ALL_THE_REGISTERS -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O3 %s -DTHREAD -DSAVE_ALL_THE_REGISTERS -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O0 %s -DTHREAD -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan -O3 %s -DTHREAD -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O0 %s -DTHREAD -DSMALL_FRAME -lpthread -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O3 %s -DTHREAD -DSMALL_FRAME -lpthread -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O0 %s -DTHREAD -DSAVE_ALL_THE_REGISTERS -lpthread -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O3 %s -DTHREAD -DSAVE_ALL_THE_REGISTERS -lpthread -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O0 %s -DTHREAD -lpthread -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O3 %s -DTHREAD -lpthread -o %t && ASAN_OPTIONS=use_sigaltstack=1 not %t 2>&1 | FileCheck %s
 
 #include <assert.h>
 #include <stdlib.h>
index dc38be9..736eea2 100644 (file)
@@ -1,20 +1,14 @@
 // RUN: export ASAN_OPTIONS=detect_stack_use_after_return=1
-// RUN: %clangxx_asan  -O0 %s -o %t && \
-// RUN:   not %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan  -O1 %s -o %t && \
-// RUN:   not %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan  -O2 %s -o %t && \
-// RUN:   not %t 2>&1 | FileCheck %s
-// RUN: %clangxx_asan  -O3 %s -o %t && \
-// RUN:   not %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan  -O0 %s -lpthread -o %t && not %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan  -O1 %s -lpthread -o %t && not %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan  -O2 %s -lpthread -o %t && not %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan  -O3 %s -lpthread -o %t && not %t 2>&1 | FileCheck %s
 // RUN: ASAN_OPTIONS=detect_stack_use_after_return=0 %t
 // Regression test for a CHECK failure with small stack size and large frame.
-// RUN: %clangxx_asan  -O3 %s -o %t -DkSize=10000 -DUseThread -DkStackSize=65536 && \
-// RUN:   not %t 2>&1 | FileCheck --check-prefix=THREAD %s
+// RUN: %clangxx_asan  -O3 %s -lpthread -o %t -DkSize=10000 -DUseThread -DkStackSize=65536 && not %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 -o %t && \
-// RUN:   not %t 2>&1 | FileCheck --check-prefix=THREAD %s
+// RUN: %clangxx_asan  -DUseThread -O2 %s -lpthread -o %t && not %t 2>&1 | FileCheck --check-prefix=THREAD %s
 //
 // Test the max_uar_stack_size_log/min_uar_stack_size_log flag.
 //
index a069766..7e703d6 100644 (file)
@@ -2,10 +2,9 @@
 // Main executable is uninstrumented, but linked to ASan runtime. The shared
 // library is instrumented. Memory errors before dlopen are not detected.
 
-// RUN: %clangxx_asan -O0 %p/SharedLibs/start-deactivated-so.cc \
-// RUN:     -fPIC -shared -o %t-so.so
+// RUN: %clangxx_asan -O0 %p/SharedLibs/start-deactivated-so.cc -fPIC -shared -o %t-so.so
 // RUN: %clangxx -O0 %s -c -o %t.o
-// RUN: %clangxx_asan -O0 %t.o -o %t
+// RUN: %clangxx_asan -O0 %t.o -ldl -o %t
 // RUN: ASAN_OPTIONS=start_deactivated=1 not %t 2>&1 | FileCheck %s
 
 #include <dlfcn.h>