[compiler-rt] r335524 - [UBsan] Enable ubsan minimal unit tests on OpenBSD
David Carlier via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 25 14:10:25 PDT 2018
Author: devnexen
Date: Mon Jun 25 14:10:25 2018
New Revision: 335524
URL: http://llvm.org/viewvc/llvm-project?rev=335524&view=rev
Log:
[UBsan] Enable ubsan minimal unit tests on OpenBSD
OpenBSD needs lld linker for sanitisers.
Disabling lint checking as some symbols cannot be defined and block the proper unit tests launch.
Reviewers: lebedev.ri, vitalybuka
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D48528
Modified:
compiler-rt/trunk/cmake/Modules/SanitizerUtils.cmake
compiler-rt/trunk/test/ubsan_minimal/lit.common.cfg
Modified: compiler-rt/trunk/cmake/Modules/SanitizerUtils.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/SanitizerUtils.cmake?rev=335524&r1=335523&r2=335524&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/SanitizerUtils.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/SanitizerUtils.cmake Mon Jun 25 14:10:25 2018
@@ -81,7 +81,7 @@ macro(add_sanitizer_rt_version_list name
endmacro()
# Add target to check code style for sanitizer runtimes.
-if(CMAKE_HOST_UNIX)
+if(CMAKE_HOST_UNIX AND NOT OS_NAME MATCHES "OpenBSD")
add_custom_target(SanitizerLintCheck
COMMAND env LLVM_CHECKOUT=${LLVM_MAIN_SRC_DIR} SILENT=1 TMPDIR=
PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
@@ -90,5 +90,8 @@ if(CMAKE_HOST_UNIX)
DEPENDS ${SANITIZER_LINT_SCRIPT}
COMMENT "Running lint check for sanitizer sources..."
VERBATIM)
+else()
+ add_custom_target(SanitizerLintCheck
+ COMMAND echo "No lint check")
endif()
Modified: compiler-rt/trunk/test/ubsan_minimal/lit.common.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/ubsan_minimal/lit.common.cfg?rev=335524&r1=335523&r2=335524&view=diff
==============================================================================
--- compiler-rt/trunk/test/ubsan_minimal/lit.common.cfg (original)
+++ compiler-rt/trunk/test/ubsan_minimal/lit.common.cfg Mon Jun 25 14:10:25 2018
@@ -22,6 +22,12 @@ target_cflags = [get_required_attr(confi
clang_ubsan_cflags = ["-fsanitize-minimal-runtime"] + target_cflags
clang_ubsan_cxxflags = config.cxx_mode_flags + clang_ubsan_cflags
+# OpenBSD needs lld linker to function
+# TODO update the frontend driver
+if config.host_os == 'OpenBSD':
+ clang_ubsan_cflags.append("-fuse-ld=lld")
+ clang_ubsan_cxxflags.append("-fuse-ld=lld")
+
# Define %clang and %clangxx substitutions to use in test RUN lines.
config.substitutions.append( ("%clang ", build_invocation(clang_ubsan_cflags)) )
config.substitutions.append( ("%clangxx ", build_invocation(clang_ubsan_cxxflags)) )
@@ -30,7 +36,7 @@ config.substitutions.append( ("%clangxx
config.suffixes = ['.c', '.cc', '.cpp']
# Check that the host supports UndefinedBehaviorSanitizerMinimal tests
-if config.host_os not in ['Linux', 'FreeBSD', 'NetBSD', 'Darwin']: # TODO: Windows
+if config.host_os not in ['Linux', 'FreeBSD', 'NetBSD', 'Darwin', 'OpenBSD']: # TODO: Windows
config.unsupported = True
# Don't target x86_64h if the test machine can't execute x86_64h binaries.
More information about the llvm-commits
mailing list