[ASan] Fix init-order-dlopen.cc test to not depend on the -Wl,-undefined,dynamic_lookup being passed to the linker.

llvm-svn: 191012
This commit is contained in:
Alexander Potapenko 2013-09-19 17:12:45 +00:00
parent 81e6a60efa
commit 8f5d907aea
2 changed files with 7 additions and 2 deletions

View File

@ -1,7 +1,7 @@
#include <stdio.h>
#include <unistd.h>
void inc_global();
extern "C" void inc_global();
int slow_init() {
sleep(1);

View File

@ -1,8 +1,12 @@
// Regression test for
// https://code.google.com/p/address-sanitizer/issues/detail?id=178
// Assume we're on Darwin and try to pass -U to the linker. If this flag is
// unsupported, don't use it.
// RUN: %clangxx_asan -O0 %p/SharedLibs/init-order-dlopen-so.cc \
// RUN: -fPIC -shared -o %t-so.so
// RUN: -fPIC -shared -o %t-so.so -Wl,-U,_inc_global || \
// RUN: %clangxx_asan -O0 %p/SharedLibs/init-order-dlopen-so.cc \
// RUN: -fPIC -shared -o %t-so.so
// If the linker doesn't support --export-dynamic (which is ELF-specific),
// try to link without that option.
// FIXME: find a better solution.
@ -24,6 +28,7 @@ int foo() {
int global = foo();
__attribute__((visibility("default")))
extern "C"
void inc_global() {
global++;
}