[lld] r322441 - Revert "[WebAssembly] Move checking of InputSegment comdat group earlier"

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 13 07:57:48 PST 2018


Author: sbc
Date: Sat Jan 13 07:57:48 2018
New Revision: 322441

URL: http://llvm.org/viewvc/llvm-project?rev=322441&view=rev
Log:
Revert "[WebAssembly] Move checking of InputSegment comdat group earlier"

This reverts commit 7421eab7ccf2e14518f4526a084a5afc76ac9c6a.

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=322441&r1=322440&r2=322441&view=diff
==============================================================================
--- lld/trunk/wasm/OutputSegment.h (original)
+++ lld/trunk/wasm/OutputSegment.h Sat Jan 13 07:57:48 2018
@@ -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;
 };
 

Modified: lld/trunk/wasm/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Writer.cpp?rev=322441&r1=322440&r2=322441&view=diff
==============================================================================
--- lld/trunk/wasm/Writer.cpp (original)
+++ lld/trunk/wasm/Writer.cpp Sat Jan 13 07:57:48 2018
@@ -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});
   }




More information about the llvm-commits mailing list