[PATCH] D48528: [UBsan] Enable ubsan minimal unit tests on OpenBSD

David CARLIER via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 25 11:49:19 PDT 2018


devnexen updated this revision to Diff 152738.

https://reviews.llvm.org/D48528

Files:
  cmake/Modules/SanitizerUtils.cmake
  test/ubsan_minimal/lit.common.cfg


Index: test/ubsan_minimal/lit.common.cfg
===================================================================
--- test/ubsan_minimal/lit.common.cfg
+++ test/ubsan_minimal/lit.common.cfg
@@ -22,15 +22,21 @@
 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)) )
 
 # Default test suffixes.
 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.
Index: cmake/Modules/SanitizerUtils.cmake
===================================================================
--- cmake/Modules/SanitizerUtils.cmake
+++ cmake/Modules/SanitizerUtils.cmake
@@ -81,14 +81,17 @@
 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}
       COMPILER_RT=${COMPILER_RT_SOURCE_DIR}
       ${SANITIZER_LINT_SCRIPT}
     DEPENDS ${SANITIZER_LINT_SCRIPT}
     COMMENT "Running lint check for sanitizer sources..."
     VERBATIM)
+else()
+  add_custom_target(SanitizerLintCheck
+    COMMAND echo "No lint check")
 endif()
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48528.152738.patch
Type: text/x-patch
Size: 2006 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180625/f29fecba/attachment.bin>


More information about the llvm-commits mailing list