[lld] r322440 - [WebAssembly] Move checking of InputSegment comdat group earlier
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 13 07:44:54 PST 2018
Author: sbc
Date: Sat Jan 13 07:44:54 2018
New Revision: 322440
URL: http://llvm.org/viewvc/llvm-project?rev=322440&view=rev
Log:
[WebAssembly] Move checking of InputSegment comdat group earlier
This should also fixe an unused varaible warning in the realeae
build.
Modified:
lld/trunk/wasm/OutputSegment.h
lld/trunk/wasm/Writer.cpp
Modified: lld/trunk/wasm/OutputSegment.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/OutputSegment.h?rev=322440&r1=322439&r2=322440&view=diff
==============================================================================
--- lld/trunk/wasm/OutputSegment.h (original)
+++ lld/trunk/wasm/OutputSegment.h Sat Jan 13 07:44:54 2018
@@ -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;
};
Modified: lld/trunk/wasm/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Writer.cpp?rev=322440&r1=322439&r2=322440&view=diff
==============================================================================
--- lld/trunk/wasm/Writer.cpp (original)
+++ lld/trunk/wasm/Writer.cpp Sat Jan 13 07:44:54 2018
@@ -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});
}
More information about the llvm-commits
mailing list