summaryrefslogtreecommitdiff
path: root/lib/Linker
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2017-02-03 17:01:14 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2017-02-03 17:01:14 +0000
commita06bb017cf114e17ce0260d4eef6e4ed49de568d (patch)
tree88f47f2556002c1099c2edfea30f472ca3e41bcc /lib/Linker
parentfa65bcf4a183c511cdab16209db855dd3a463497 (diff)
IRMover: Merge flags LinkModuleInlineAsm and IsPerformingImport.
Currently these flags are always the inverse of each other, so there is no need to keep them separate. Differential Revision: https://reviews.llvm.org/D29471 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294016 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Linker')
-rw-r--r--lib/Linker/IRMover.cpp21
-rw-r--r--lib/Linker/LinkModules.cpp1
2 files changed, 11 insertions, 11 deletions
diff --git a/lib/Linker/IRMover.cpp b/lib/Linker/IRMover.cpp
index 468d86d6e0d..15a46a2d042 100644
--- a/lib/Linker/IRMover.cpp
+++ b/lib/Linker/IRMover.cpp
@@ -395,11 +395,12 @@ class IRLinker {
Worklist.push_back(GV);
}
- /// Flag whether the ModuleInlineAsm string in Src should be linked with
- /// (concatenated into) the ModuleInlineAsm string for the destination
- /// module. It should be true for full LTO, but not when importing for
- /// ThinLTO, otherwise we can have duplicate symbols.
- bool LinkModuleInlineAsm;
+ /// Whether we are importing globals for ThinLTO, as opposed to linking the
+ /// source module. If this flag is set, it means that we can rely on some
+ /// other object file to define any non-GlobalValue entities defined by the
+ /// source module. This currently causes us to not link retained types in
+ /// debug info metadata and module inline asm.
+ bool IsPerformingImport;
/// Set to true when all global value body linking is complete (including
/// lazy linking). Used to prevent metadata linking from creating new
@@ -491,10 +492,10 @@ public:
IRMover::IdentifiedStructTypeSet &Set, std::unique_ptr<Module> SrcM,
ArrayRef<GlobalValue *> ValuesToLink,
std::function<void(GlobalValue &, IRMover::ValueAdder)> AddLazyFor,
- bool LinkModuleInlineAsm, bool IsPerformingImport)
+ bool IsPerformingImport)
: DstM(DstM), SrcM(std::move(SrcM)), AddLazyFor(std::move(AddLazyFor)),
TypeMap(Set), GValMaterializer(*this), LValMaterializer(*this),
- SharedMDs(SharedMDs), LinkModuleInlineAsm(LinkModuleInlineAsm),
+ SharedMDs(SharedMDs), IsPerformingImport(IsPerformingImport),
Mapper(ValueMap, RF_MoveDistinctMDs | RF_IgnoreMissingLocals, &TypeMap,
&GValMaterializer),
AliasMCID(Mapper.registerAlternateMappingContext(AliasValueMap,
@@ -1294,7 +1295,7 @@ Error IRLinker::run() {
DstM.setTargetTriple(mergeTriples(SrcTriple, DstTriple));
// Append the module inline asm string.
- if (LinkModuleInlineAsm && !SrcM->getModuleInlineAsm().empty()) {
+ if (!IsPerformingImport && !SrcM->getModuleInlineAsm().empty()) {
if (DstM.getModuleInlineAsm().empty())
DstM.setModuleInlineAsm(SrcM->getModuleInlineAsm());
else
@@ -1433,10 +1434,10 @@ IRMover::IRMover(Module &M) : Composite(M) {
Error IRMover::move(
std::unique_ptr<Module> Src, ArrayRef<GlobalValue *> ValuesToLink,
std::function<void(GlobalValue &, ValueAdder Add)> AddLazyFor,
- bool LinkModuleInlineAsm, bool IsPerformingImport) {
+ bool IsPerformingImport) {
IRLinker TheIRLinker(Composite, SharedMDs, IdentifiedStructTypes,
std::move(Src), ValuesToLink, std::move(AddLazyFor),
- LinkModuleInlineAsm, IsPerformingImport);
+ IsPerformingImport);
Error E = TheIRLinker.run();
Composite.dropTriviallyDeadConstantArrays();
return E;
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp
index 50936fa55f7..f11fd54f4af 100644
--- a/lib/Linker/LinkModules.cpp
+++ b/lib/Linker/LinkModules.cpp
@@ -538,7 +538,6 @@ bool ModuleLinker::run() {
[this](GlobalValue &GV, IRMover::ValueAdder Add) {
addLazyFor(GV, Add);
},
- /* LinkModuleInlineAsm */ true,
/* IsPerformingImport */ false)) {
handleAllErrors(std::move(E), [&](ErrorInfoBase &EIB) {
DstM.getContext().diagnose(LinkDiagnosticInfo(DS_Error, EIB.message()));