[compiler-rt] compiler-rt: Fix FLOAT16 feature detection (PR #69842)

via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 21 06:20:18 PDT 2023


https://github.com/littlewu2508 created https://github.com/llvm/llvm-project/pull/69842

I'm submitting this patch authored by @tstellar:

CMAKE_TRY_COMPILE_TARGET_TYPE defaults to EXECUTABLE, which causes any feature detection code snippet without a main function to fail, so we need to make sure it gets explicitly set to STATIC_LIBRARY.

I think maybe it should be up-streamed, since it causes some issues [1,2] in some distros. Please have a review to see whether this patch should be applied in upstream, or just in distro.

[1] https://github.com/ROCmSoftwarePlatform/rocFFT/issues/439
[2] https://github.com/ROCmSoftwarePlatform/rocBLAS/issues/1350

>From 9a2ca2504806de5680b5781530c8d7fed92ff2e6 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Tue, 29 Aug 2023 15:49:55 -0700
Subject: [PATCH] compiler-rt: Fix FLOAT16 feature detection

CMAKE_TRY_COMPILE_TARGET_TYPE defaults to EXECUTABLE, which causes
any feature detection code snippet without a main function to fail,
so we need to make sure it gets explicitly set to STATIC_LIBRARY.
---
 compiler-rt/lib/builtins/CMakeLists.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
index cf2648233b0cf8f..a983e2e4ddeac33 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -5,7 +5,6 @@
 if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
   cmake_minimum_required(VERSION 3.20.0)
 
-  set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
   project(CompilerRTBuiltins C ASM)
   set(COMPILER_RT_STANDALONE_BUILD TRUE)
   set(COMPILER_RT_BUILTINS_STANDALONE_BUILD TRUE)
@@ -50,6 +49,8 @@ if (COMPILER_RT_STANDALONE_BUILD)
     ON)
 endif()
 
+set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
+
 include(builtin-config-ix)
 include(CMakeDependentOption)
 include(CMakePushCheckState)



More information about the llvm-commits mailing list