[llvm] 1ea49c7 - [CMake] Disable PCH on AIX

Alexis Engelke via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 20 09:50:32 PST 2026


Author: Alexis Engelke
Date: 2026-02-20T17:50:17Z
New Revision: 1ea49c77b36e8ecfc0053db137bf0d68f5021ba5

URL: https://github.com/llvm/llvm-project/commit/1ea49c77b36e8ecfc0053db137bf0d68f5021ba5
DIFF: https://github.com/llvm/llvm-project/commit/1ea49c77b36e8ecfc0053db137bf0d68f5021ba5.diff

LOG: [CMake] Disable PCH on AIX

There are name collisions from transitive system includes, which are
hard to debug without access to AIX systems.

Added: 
    

Modified: 
    llvm/cmake/modules/HandleLLVMOptions.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 0303a8e4ba34c..12607c76f3a74 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -1308,6 +1308,17 @@ if (LLVM_BUILD_INSTRUMENTED AND LLVM_BUILD_INSTRUMENTED_COVERAGE)
 endif()
 
 if(NOT DEFINED CMAKE_DISABLE_PRECOMPILE_HEADERS)
+  if("${CMAKE_SYSTEM_NAME}" MATCHES "AIX")
+    # PCH is working in principle on AIX, but due to transitive includes,
+    # sys/mode.h ends up in the LLVMSupport PCH, which happens to define macros
+    # named S_RESERVED{1,2,3,4}, which cause collisions in CodeViewSymbols.def.
+    # AIX systems are not easily accessible, which makes identifying and
+    # debugging such cases rather 
diff icult. Therefore, disable PCH on AIX by
+    # default.
+    message(NOTICE "Precompiled headers are disabled by default on AIX. "
+      "Pass -DCMAKE_DISABLE_PRECOMPILE_HEADERS=OFF to override.")
+    set(CMAKE_DISABLE_PRECOMPILE_HEADERS ON)
+  endif()
   if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
     # Pre-compiled headers with GCC (tested versions 14+15) provide very little
     # compile-time improvements, but substantially increase the build dir size.


        


More information about the llvm-commits mailing list