Skip to content

Commit 56feddb

Browse files
committed
[compiler-rt] Fix building on OpenBSD/amd64
OpenBSD/amd64 does not use multi-lib. Enabling the CET support on amd64 exposed that CMake was using a multi-lib build on amd64. OpenBSD 64-bit platforms do not support multi-lib.
1 parent 7be3cac commit 56feddb

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

compiler-rt/cmake/base-config-ix.cmake

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ macro(test_targets)
213213
if(COMPILER_RT_DEFAULT_TARGET_ONLY)
214214
add_default_target_arch(${COMPILER_RT_DEFAULT_TARGET_ARCH})
215215
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "i[2-6]86|x86|amd64")
216-
if(NOT MSVC)
216+
if(NOT MSVC AND NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD")
217217
test_target_arch(x86_64 "" "-m64")
218218
test_target_arch(i386 __i386__ "-m32")
219219
else()
@@ -234,13 +234,29 @@ macro(test_targets)
234234
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "powerpc64le|ppc64le")
235235
test_target_arch(powerpc64le "" "-m64")
236236
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "powerpc")
237-
test_target_arch(powerpc "" "-m32")
238-
test_target_arch(powerpc64 "" "-m64")
237+
if(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD")
238+
test_target_arch(powerpc "" "-m32")
239+
test_target_arch(powerpc64 "" "-m64")
240+
else()
241+
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
242+
test_target_arch(powerpc "" "-m32")
243+
else()
244+
test_target_arch(powerpc64 "" "-m64")
245+
endif()
246+
endif()
239247
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "s390x")
240248
test_target_arch(s390x "" "")
241249
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "sparc")
242-
test_target_arch(sparc "" "-m32")
243-
test_target_arch(sparcv9 "" "-m64")
250+
if(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD")
251+
test_target_arch(sparc "" "-m32")
252+
test_target_arch(sparcv9 "" "-m64")
253+
else()
254+
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
255+
test_target_arch(sparc "" "-m32")
256+
else()
257+
test_target_arch(sparcv9 "" "-m64")
258+
endif()
259+
endif()
244260
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "mips")
245261
CHECK_SYMBOL_EXISTS (_MIPS_ARCH_MIPS32R6 "" COMPILER_RT_MIPS32R6)
246262
CHECK_SYMBOL_EXISTS (_MIPS_ARCH_MIPS64R6 "" COMPILER_RT_MIPS64R6)

0 commit comments

Comments
 (0)