[lld][WebAssembly] Fix __start/__stop symbols when combining input segments

We should be generating one __start/__stop pair per output segment
not per input segment.  The test wasn't catching this because it was
only linking a single object file.

Fixes PR41565

Differential Revision: https://reviews.llvm.org/D64148

llvm-svn: 365308
diff --git a/lld/wasm/InputChunks.cpp b/lld/wasm/InputChunks.cpp
index efb8d31..cb62f96 100644
--- a/lld/wasm/InputChunks.cpp
+++ b/lld/wasm/InputChunks.cpp
@@ -107,8 +107,10 @@
   for (const WasmRelocation &Rel : Relocations) {
     uint8_t *Loc = Buf + Rel.Offset + Off;
     uint32_t Value = File->calcNewValue(Rel);
-    LLVM_DEBUG(dbgs() << "apply reloc: type=" << relocTypeToString(Rel.Type)
-                      << " addend=" << Rel.Addend << " index=" << Rel.Index
+    LLVM_DEBUG(dbgs() << "apply reloc: type=" << relocTypeToString(Rel.Type));
+    if (Rel.Type != R_WASM_TYPE_INDEX_LEB)
+      LLVM_DEBUG(dbgs() << " sym=" << File->getSymbols()[Rel.Index]->getName());
+    LLVM_DEBUG(dbgs() << " addend=" << Rel.Addend << " index=" << Rel.Index
                       << " value=" << Value << " offset=" << Rel.Offset
                       << "\n");