From 8f5d907aead7be75f2d2be1fa52dca35145e61d7 Mon Sep 17 00:00:00 2001 From: Alexander Potapenko Date: Thu, 19 Sep 2013 17:12:45 +0000 Subject: [PATCH] [ASan] Fix init-order-dlopen.cc test to not depend on the -Wl,-undefined,dynamic_lookup being passed to the linker. llvm-svn: 191012 --- .../lit_tests/TestCases/SharedLibs/init-order-dlopen-so.cc | 2 +- .../lib/asan/lit_tests/TestCases/init-order-dlopen.cc | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler-rt/lib/asan/lit_tests/TestCases/SharedLibs/init-order-dlopen-so.cc b/compiler-rt/lib/asan/lit_tests/TestCases/SharedLibs/init-order-dlopen-so.cc index 20ef2d8a00bb..dc097a520d03 100644 --- a/compiler-rt/lib/asan/lit_tests/TestCases/SharedLibs/init-order-dlopen-so.cc +++ b/compiler-rt/lib/asan/lit_tests/TestCases/SharedLibs/init-order-dlopen-so.cc @@ -1,7 +1,7 @@ #include #include -void inc_global(); +extern "C" void inc_global(); int slow_init() { sleep(1); diff --git a/compiler-rt/lib/asan/lit_tests/TestCases/init-order-dlopen.cc b/compiler-rt/lib/asan/lit_tests/TestCases/init-order-dlopen.cc index 001fa8a9a24e..90f099d3f2e1 100644 --- a/compiler-rt/lib/asan/lit_tests/TestCases/init-order-dlopen.cc +++ b/compiler-rt/lib/asan/lit_tests/TestCases/init-order-dlopen.cc @@ -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++; }