diff options
| -rw-r--r-- | lld/wasm/OutputSegment.h | 7 | ||||
| -rw-r--r-- | lld/wasm/Writer.cpp | 7 |
2 files changed, 6 insertions, 8 deletions
diff --git a/lld/wasm/OutputSegment.h b/lld/wasm/OutputSegment.h index 420d9744165..9825ce8e697 100644 --- a/lld/wasm/OutputSegment.h +++ b/lld/wasm/OutputSegment.h @@ -25,18 +25,12 @@ 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; } @@ -53,7 +47,6 @@ public: std::string Header; private: - StringRef Comdat; uint32_t SectionOffset = 0; }; diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp index 07b7b076102..bb34f265d40 100644 --- a/lld/wasm/Writer.cpp +++ b/lld/wasm/Writer.cpp @@ -439,7 +439,12 @@ void Writer::createLinkingSection() { ComdatEntry{WASM_COMDAT_FUNCTION, F->getOutputIndex()}); } for (uint32_t I = 0; I < Segments.size(); ++I) { - StringRef Comdat = Segments[I]->getComdat(); + const auto &InputSegments = Segments[I]->InputSegments; + if (InputSegments.empty()) + continue; + StringRef Comdat = InputSegments[0]->getComdat(); + for (const InputSegment *IS : InputSegments) + assert(IS->getComdat() == Comdat); if (!Comdat.empty()) Comdats[Comdat].emplace_back(ComdatEntry{WASM_COMDAT_DATA, I}); } |

