Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions compiler-rt/cmake/base-config-ix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

# 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?

test_target_arch(x86_64 "" "-m64")
test_target_arch(i386 __i386__ "-m32")
else()
Expand All @@ -234,13 +234,29 @@ macro(test_targets)
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "powerpc64le|ppc64le")
test_target_arch(powerpc64le "" "-m64")
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "powerpc")
test_target_arch(powerpc "" "-m32")
test_target_arch(powerpc64 "" "-m64")
if(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD")
Copy link
Contributor

@ojhunt ojhunt Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these needed, my assumption is that test_target_arch should be handling this automatically?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(edit: I had misremembered the x86 path when I wrote the original comment)

test_target_arch(powerpc "" "-m32")
test_target_arch(powerpc64 "" "-m64")
else()
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
test_target_arch(powerpc "" "-m32")
else()
test_target_arch(powerpc64 "" "-m64")
endif()
endif()
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "s390x")
test_target_arch(s390x "" "")
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "sparc")
test_target_arch(sparc "" "-m32")
test_target_arch(sparcv9 "" "-m64")
if(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

test_target_arch(sparc "" "-m32")
test_target_arch(sparcv9 "" "-m64")
else()
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
test_target_arch(sparc "" "-m32")
else()
test_target_arch(sparcv9 "" "-m64")
endif()
endif()
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "mips")
CHECK_SYMBOL_EXISTS (_MIPS_ARCH_MIPS32R6 "" COMPILER_RT_MIPS32R6)
CHECK_SYMBOL_EXISTS (_MIPS_ARCH_MIPS64R6 "" COMPILER_RT_MIPS64R6)
Expand Down