[libc-commits] [libc] [libc] Replace LLVM_COMPILER_IS_GCC_COMPATIBLE with a local check. (PR #119164)

via libc-commits libc-commits at lists.llvm.org
Sun Dec 8 20:26:07 PST 2024


https://github.com/lntue created https://github.com/llvm/llvm-project/pull/119164

None

>From b82ed33861a35494f2880fdcb4305a75f0c0a108 Mon Sep 17 00:00:00 2001
From: Tue Ly <lntue at google.com>
Date: Sun, 8 Dec 2024 23:24:31 -0500
Subject: [PATCH] [libc] Replace LLVM_COMPILER_IS_GCC_COMPATIBLE with a local
 check.

---
 libc/cmake/modules/LLVMLibCCompileOptionRules.cmake | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
index 65851f1c86571a..9657075aab8543 100644
--- a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
+++ b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
@@ -1,3 +1,8 @@
+if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR
+    (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
+    set(LLVM_LIBC_COMPILER_IS_GCC_COMPATIBLE TRUE)
+endif
+
 function(_get_compile_options_from_flags output_var)
   set(compile_options "")
 
@@ -8,7 +13,7 @@ function(_get_compile_options_from_flags output_var)
   check_flag(ADD_EXPLICIT_SIMD_OPT_FLAG ${EXPLICIT_SIMD_OPT_FLAG} ${ARGN})
   check_flag(ADD_MISC_MATH_BASIC_OPS_OPT_FLAG ${MISC_MATH_BASIC_OPS_OPT_FLAG} ${ARGN})
 
-  if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
+  if(LLVM_LIBC_COMPILER_IS_GCC_COMPATIBLE)
     if(ADD_FMA_FLAG)
       if(LIBC_TARGET_ARCHITECTURE_IS_X86_64)
         list(APPEND compile_options "-mavx2")
@@ -96,7 +101,7 @@ function(_get_common_compile_options output_var flags)
 
   set(compile_options ${LIBC_COMPILE_OPTIONS_DEFAULT} ${compile_flags} ${config_flags})
 
-  if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
+  if(LLVM_LIBC_COMPILER_IS_GCC_COMPATIBLE)
     list(APPEND compile_options "-fpie")
 
     if(LLVM_LIBC_FULL_BUILD)
@@ -210,7 +215,7 @@ function(_get_common_test_compile_options output_var c_test flags)
       ${LIBC_TEST_COMPILE_OPTIONS_DEFAULT}
       ${compile_flags})
 
-  if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
+  if(LLVM_LIBC_COMPILER_IS_GCC_COMPATIBLE)
     list(APPEND compile_options "-fpie")
 
     if(LLVM_LIBC_FULL_BUILD)



More information about the libc-commits mailing list