summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2018-01-13 15:44:54 +0000
committerSam Clegg <sbc@chromium.org>2018-01-13 15:44:54 +0000
commit7c11dbf5b09b5a91587c2b744ef52fa810992ee4 (patch)
tree90be40d9d14e9665b308b8d968b7e4d32a40672e
parent4158eff0f84781e5449961b5544a2eb441f8a26e (diff)
downloadbcm5719-llvm-7c11dbf5b09b5a91587c2b744ef52fa810992ee4.tar.gz
bcm5719-llvm-7c11dbf5b09b5a91587c2b744ef52fa810992ee4.zip
[WebAssembly] Move checking of InputSegment comdat group earlier
This should also fixe an unused varaible warning in the realeae build. llvm-svn: 322440
-rw-r--r--lld/wasm/OutputSegment.h7
-rw-r--r--lld/wasm/Writer.cpp7
2 files changed, 8 insertions, 6 deletions
diff --git a/lld/wasm/OutputSegment.h b/lld/wasm/OutputSegment.h
index 9825ce8e697..420d9744165 100644
--- a/lld/wasm/OutputSegment.h
+++ b/lld/wasm/OutputSegment.h
@@ -25,12 +25,18 @@ public:
void addInputSegment(InputSegment *Segment) {
Alignment = std::max(Alignment, Segment->getAlignment());
+ if (InputSegments.empty())
+ Comdat = Segment->getComdat();
+ else
+ assert(Comdat == Segment->getComdat());
InputSegments.push_back(Segment);
Size = llvm::alignTo(Size, Segment->getAlignment());
Segment->setOutputSegment(this, Size);
Size += Segment->getSize();
}
+ StringRef getComdat() const { return Comdat; }
+
uint32_t getSectionOffset() const { return SectionOffset; }
void setSectionOffset(uint32_t Offset) { SectionOffset = Offset; }
@@ -47,6 +53,7 @@ public:
std::string Header;
private:
+ StringRef Comdat;
uint32_t SectionOffset = 0;
};
diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp
index bb34f265d40..07b7b076102 100644
--- a/lld/wasm/Writer.cpp
+++ b/lld/wasm/Writer.cpp
@@ -439,12 +439,7 @@ void Writer::createLinkingSection() {
ComdatEntry{WASM_COMDAT_FUNCTION, F->getOutputIndex()});
}
for (uint32_t I = 0; I < Segments.size(); ++I) {
- const auto &InputSegments = Segments[I]->InputSegments;
- if (InputSegments.empty())
- continue;
- StringRef Comdat = InputSegments[0]->getComdat();
- for (const InputSegment *IS : InputSegments)
- assert(IS->getComdat() == Comdat);
+ StringRef Comdat = Segments[I]->getComdat();
if (!Comdat.empty())
Comdats[Comdat].emplace_back(ComdatEntry{WASM_COMDAT_DATA, I});
}
OpenPOWER on IntegriCloud