aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ExecutionEngine/Orc/Layer.cpp
diff options
context:
space:
mode:
authorJonas Hahnfeld <jonas.hahnfeld@cern.ch>2023-01-24 10:54:55 +0100
committerJonas Hahnfeld <jonas.hahnfeld@cern.ch>2023-02-03 11:16:19 +0100
commit87d7838202267a011639fcbf97263556ccf091dc (patch)
tree3c7e355c5897325b5fcd651b647131d19ab39b15 /llvm/lib/ExecutionEngine/Orc/Layer.cpp
parent1e72920c8859771c03177623ad7519543d78eb7d (diff)
downloadllvm-87d7838202267a011639fcbf97263556ccf091dc.zip
llvm-87d7838202267a011639fcbf97263556ccf091dc.tar.gz
llvm-87d7838202267a011639fcbf97263556ccf091dc.tar.bz2
[ORC] Drop Comdat when discarding IR symbol
According to the IR verifier, "Declaration[s] may not be in a Comdat!" This is a re-commit of 76b3f0b4d5a0b8c54147c4c73a30892bbca76467 with updates to the test: * Force emission of the extra-module, to trigger the bug after D138264, by providing a second symbol @g, and making the comdat nodeduplicate. (Technically only one is needed, but two should be safer.) * Name the comdat $f to avoid failure on Windows: LLVM ERROR: Associative COMDAT symbol 'c' does not exist. Differential Revision: https://reviews.llvm.org/D142443
Diffstat (limited to 'llvm/lib/ExecutionEngine/Orc/Layer.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/Orc/Layer.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/ExecutionEngine/Orc/Layer.cpp b/llvm/lib/ExecutionEngine/Orc/Layer.cpp
index 95380d91..3368d32 100644
--- a/llvm/lib/ExecutionEngine/Orc/Layer.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/Layer.cpp
@@ -125,6 +125,10 @@ void IRMaterializationUnit::discard(const JITDylib &JD,
assert(!I->second->isDeclaration() &&
"Discard should only apply to definitions");
I->second->setLinkage(GlobalValue::AvailableExternallyLinkage);
+ // According to the IR verifier, "Declaration[s] may not be in a Comdat!"
+ // Remove it, if this is a GlobalObject.
+ if (auto *GO = dyn_cast<GlobalObject>(I->second))
+ GO->setComdat(nullptr);
SymbolToDefinition.erase(I);
}