[clang] [Clang][Interpreter] Force GOT access for external data references (PR #201286)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 22 14:01:11 PDT 2026


================
@@ -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()) {
----------------
aokblast wrote:

Fix it

https://github.com/llvm/llvm-project/pull/201286


More information about the cfe-commits mailing list