[compiler-rt] [compiler-rt] Fix building on OpenBSD/amd64 (PR #165086)

Oliver Hunt via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 30 00:01:00 PDT 2025


================
@@ -213,7 +213,7 @@ macro(test_targets)
     if(COMPILER_RT_DEFAULT_TARGET_ONLY)
       add_default_target_arch(${COMPILER_RT_DEFAULT_TARGET_ARCH})
     elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "i[2-6]86|x86|amd64")
-      if(NOT MSVC)
+      if(NOT MSVC AND NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD")
----------------
ojhunt wrote:

Is this OpenBSD specific, or BSD in general and simply hasn't been hit on them yet?

If is OpenBSD specific is there a central config file that is included in all the cmake scripts where you could add something like

```cmake
# I'm blindly assuming `DEFINED` is an operator and not a special form
# of `if`, if the latter this would become if () else()  ...set ... endif()
if (NOT (DEFINED OPENBSD))
  # I also do not know if CMake allows this, because I'm unsure what
  # things are special forms vs operators, because I'm not a cmake person
  set(OPENBSD ("${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD"))
endif()
```

Then `OPENBSD` and `NOT OPENBSD` become available and the script would read better.

Or maybe `OPEN_BSD` if that seems more appropriate.

I have the existence check because it seems _possible_ that cmake might add a builtin like this in the future?

https://github.com/llvm/llvm-project/pull/165086


More information about the llvm-commits mailing list