Skip to content

[libc] Replace LLVM_COMPILER_IS_GCC_COMPATIBLE with a local check. #119164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 9, 2024

Conversation

lntue
Copy link
Contributor

@lntue lntue commented Dec 9, 2024

No description provided.

@lntue lntue requested a review from SchrodingerZhu December 9, 2024 04:26
@llvmbot llvmbot added the libc label Dec 9, 2024
@llvmbot
Copy link
Member

llvmbot commented Dec 9, 2024

@llvm/pr-subscribers-libc

Author: None (lntue)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/119164.diff

1 Files Affected:

  • (modified) libc/cmake/modules/LLVMLibCCompileOptionRules.cmake (+8-3)
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)

Copy link
Contributor

@SchrodingerZhu SchrodingerZhu left a comment

Choose a reason for hiding this comment

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

LGTM.

@lntue lntue merged commit 4dcc2f5 into llvm:main Dec 9, 2024
7 checks passed
@lntue lntue deleted the fullbuild branch December 9, 2024 04:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants