From 357a4c8377e1df779b4853d5748f01f608e660c3 Mon Sep 17 00:00:00 2001 From: Vassil Vassilev Date: Sat, 19 Mar 2022 17:57:47 +0000 Subject: [PATCH] OrcV2 is more strict with linkage. When we compile incremental inputs we store each input in a separate llvm::Module. In order to preserve the semantics, we make all symbols from each module with external linkage, that is, accessible from other modules. This model works well for almost all symbols, except for the clang-generated ones which have the same name. For example clang stores strings in variables `.strN` which may clash accross modules. Luckily, these strings are used within a single module and thus we can avoid the JIT error by keeping them with their non-external linkage. --- lib/Interpreter/BackendPasses.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/Interpreter/BackendPasses.cpp b/lib/Interpreter/BackendPasses.cpp index 6f7b2440..4096cf0e 100644 --- a/lib/Interpreter/BackendPasses.cpp +++ b/lib/Interpreter/BackendPasses.cpp @@ -43,6 +43,8 @@ namespace { if (GV.isDeclaration()) return false; // no change. + if (GV.getName().startswith(".str")) + return false; // GV is a definition. llvm::GlobalValue::LinkageTypes LT = GV.getLinkage();