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

Alexander Potapenko glider at google.com
Thu Sep 19 10:12:46 PDT 2013


Author: glider
Date: Thu Sep 19 12:12:45 2013
New Revision: 191012

URL: http://llvm.org/viewvc/llvm-project?rev=191012&view=rev
Log:
[ASan] Fix init-order-dlopen.cc test to not depend on the -Wl,-undefined,dynamic_lookup being passed to the linker.

Modified:
    compiler-rt/trunk/lib/asan/lit_tests/TestCases/SharedLibs/init-order-dlopen-so.cc
    compiler-rt/trunk/lib/asan/lit_tests/TestCases/init-order-dlopen.cc

Modified: compiler-rt/trunk/lib/asan/lit_tests/TestCases/SharedLibs/init-order-dlopen-so.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/TestCases/SharedLibs/init-order-dlopen-so.cc?rev=191012&r1=191011&r2=191012&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/lit_tests/TestCases/SharedLibs/init-order-dlopen-so.cc (original)
+++ compiler-rt/trunk/lib/asan/lit_tests/TestCases/SharedLibs/init-order-dlopen-so.cc Thu Sep 19 12:12:45 2013
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <unistd.h>
 
-void inc_global();
+extern "C" void inc_global();
 
 int slow_init() {
   sleep(1);

Modified: compiler-rt/trunk/lib/asan/lit_tests/TestCases/init-order-dlopen.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/TestCases/init-order-dlopen.cc?rev=191012&r1=191011&r2=191012&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/lit_tests/TestCases/init-order-dlopen.cc (original)
+++ compiler-rt/trunk/lib/asan/lit_tests/TestCases/init-order-dlopen.cc Thu Sep 19 12:12:45 2013
@@ -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++;
 }





More information about the llvm-commits mailing list