================
@@ -135,6 +154,32 @@ CreateCI(const llvm::opt::ArgStringList &Argv) {
 
   Clang->getFrontendOpts().DisableFree = false;
   Clang->getCodeGenOpts().DisableFree = false;
+
+  // clang-repl always compiles position-independent code (it injects -fPIC),
+  // so a PCH that was built with a different PIC level is incompatible: mixing
+  // the two leads to relocations that may be out of range once the JIT maps
+  // code more than 2GB away. PICLevel is a "compatible" language option, so 
the
+  // ASTReader would otherwise accept the mismatch silently. Reject it up front
+  // here, before any Interpreter/FrontendAction is constructed.
+  StringRef PCHInclude = Clang->getPreprocessorOpts().ImplicitPCHInclude;
+  if (!PCHInclude.empty()) {
----------------
vgvassilev wrote:

Can we make this condition also work for pcm (C++/Clang modules)? The rest of 
the code should be largely the same.

https://github.com/llvm/llvm-project/pull/201286
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to