[compiler-rt] r343987 - Don't harcode -ldl test/sanitizer_common/TestCases

Kamil Rytarowski via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 8 11:04:00 PDT 2018


Author: kamil
Date: Mon Oct  8 11:04:00 2018
New Revision: 343987

URL: http://llvm.org/viewvc/llvm-project?rev=343987&view=rev
Log:
Don't harcode -ldl test/sanitizer_common/TestCases

Summary:
The dl library does not exist on all system and in particular
this breaks build on NetBSD. Make it conditional and
enable only for Linux, following the approach from other
test suites in the same repository.

Reviewers: joerg, vitalybuka

Reviewed By: vitalybuka

Subscribers: kubamracek, llvm-commits, #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D52994

Modified:
    compiler-rt/trunk/test/sanitizer_common/TestCases/get_module_and_offset_for_pc.cc
    compiler-rt/trunk/test/sanitizer_common/TestCases/sanitizer_coverage_symbolize.cc
    compiler-rt/trunk/test/sanitizer_common/TestCases/sanitizer_coverage_trace_pc_guard.cc
    compiler-rt/trunk/test/sanitizer_common/lit.common.cfg

Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/get_module_and_offset_for_pc.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/get_module_and_offset_for_pc.cc?rev=343987&r1=343986&r2=343987&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/get_module_and_offset_for_pc.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/get_module_and_offset_for_pc.cc Mon Oct  8 11:04:00 2018
@@ -1,6 +1,6 @@
 // RUN: mkdir -p %t-dir
 // RUN: %clangxx -DSHARED %s -shared -o %t-dir/get_module_and_offset_for_pc.so -fPIC
-// RUN: %clangxx -DSO_DIR=\"%t-dir\" -O0 %s -ldl -o %t
+// RUN: %clangxx -DSO_DIR=\"%t-dir\" -O0 %s -o %t
 // RUN: %run %t 2>&1 | FileCheck %s
 
 // UNSUPPORTED: i386-darwin

Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/sanitizer_coverage_symbolize.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/sanitizer_coverage_symbolize.cc?rev=343987&r1=343986&r2=343987&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/sanitizer_coverage_symbolize.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/sanitizer_coverage_symbolize.cc Mon Oct  8 11:04:00 2018
@@ -7,7 +7,7 @@
 // RUN: rm -rf $DIR
 // RUN: mkdir -p $DIR
 // RUN: cd $DIR
-// RUN: %clangxx -O0 -fsanitize-coverage=trace-pc-guard %s -ldl -o %t
+// RUN: %clangxx -O0 -fsanitize-coverage=trace-pc-guard %s -o %t
 // RUN: %env_tool_opts=coverage=1 %t 2>&1 | FileCheck %s
 // RUN: rm -rf $DIR
 

Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/sanitizer_coverage_trace_pc_guard.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/sanitizer_coverage_trace_pc_guard.cc?rev=343987&r1=343986&r2=343987&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/sanitizer_coverage_trace_pc_guard.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/sanitizer_coverage_trace_pc_guard.cc Mon Oct  8 11:04:00 2018
@@ -9,7 +9,7 @@
 // RUN: rm -rf $DIR
 // RUN: mkdir -p $DIR
 // RUN: cd $DIR
-// RUN: %clangxx -O0 -fsanitize-coverage=trace-pc-guard %s -ldl -o %t
+// RUN: %clangxx -O0 -fsanitize-coverage=trace-pc-guard %s -o %t
 // RUN: %env_tool_opts=coverage=1 %t 2>&1 | FileCheck %s
 // RUN: %sancovcc  -covered-functions -strip_path_prefix=TestCases/ *.sancov %t 2>&1 | \
 // RUN:   FileCheck --check-prefix=CHECK-SANCOV %s

Modified: compiler-rt/trunk/test/sanitizer_common/lit.common.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/lit.common.cfg?rev=343987&r1=343986&r2=343987&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/lit.common.cfg (original)
+++ compiler-rt/trunk/test/sanitizer_common/lit.common.cfg Mon Oct  8 11:04:00 2018
@@ -46,7 +46,13 @@ if default_tool_options_str:
   config.environment[tool_options] = default_tool_options_str
   default_tool_options_str += ':'
 
+if config.host_os in ['Linux']:
+  extra_link_flags = ["-ldl"]
+else:
+  extra_link_flags = []
+
 clang_cflags = config.debug_info_flags + tool_cflags + [config.target_cflags]
+clang_cflags += extra_link_flags
 clang_cxxflags = config.cxx_mode_flags + clang_cflags
 
 def build_invocation(compile_flags):




More information about the llvm-commits mailing list