[ASan] Explicitly specify -ldl/-lpthread in RUN-lines where needed

llvm-svn: 205623
This commit is contained in:
Alexey Samsonov 2014-04-04 12:24:46 +00:00
parent 3f1fa3d545
commit 7dc3c0fb2b
15 changed files with 51 additions and 66 deletions

View 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

View 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

View 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>

View 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>

View 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>

View 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>

View 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>

View File

@ -14,18 +14,14 @@
// 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>

View 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

View 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>

View 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>

View 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>

View 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>

View 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.
//

View 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>