[llvm] bd933cc - [CMake] Disable PCH reuse for plugins in non-PIC builds (#186643)

via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 15 00:52:26 PDT 2026


Author: Alexis Engelke
Date: 2026-03-15T07:52:21Z
New Revision: bd933ccd6fed9401de318a45ddf3bed5690e5389

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

LOG: [CMake] Disable PCH reuse for plugins in non-PIC builds (#186643)

Plugins are always PIC and therefore cannot reuse non-PIC PCH.

Added: 
    

Modified: 
    llvm/cmake/modules/AddLLVM.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 251fe90e3e83a..4538d80179764 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -603,6 +603,11 @@ function(llvm_add_library name)
       message(STATUS "${name} ignored -- Loadable modules not supported on this platform.")
       return()
     endif()
+    # Disable PCH reuse for plugins if PIC is globally disabled, plugins are
+    # always PIC and reusing a non-PIC PCH causes an option mismatch.
+    if(NOT LLVM_ENABLE_PIC)
+      set(ARG_DISABLE_PCH_REUSE TRUE)
+    endif()
   else()
     if(ARG_PLUGIN_TOOL)
       message(WARNING "PLUGIN_TOOL without MODULE doesn't make sense.")


        


More information about the llvm-commits mailing list