[WebAssembly] Don't allow functions to be named more than once

Even though a function can have multiple names in the
linking standards (i.e. due to aliases), there can only
be one name for a given function in the NAME section.

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

llvm-svn: 322383
diff --git a/lld/wasm/InputChunks.h b/lld/wasm/InputChunks.h
index 7b70c5c..0ddf5a9 100644
--- a/lld/wasm/InputChunks.h
+++ b/lld/wasm/InputChunks.h
@@ -110,7 +110,7 @@
 public:
   InputFunction(const WasmSignature &S, const WasmFunction &Func,
                 const ObjFile &F)
-      : InputChunk(F), Signature(S), Function(Func) {}
+      : InputChunk(F), Signature(S), WrittenToNameSec(false), Function(Func) {}
 
   uint32_t getSize() const override { return Function.Size; }
   const uint8_t *getData() const override {
@@ -126,6 +126,8 @@
 
   const WasmSignature &Signature;
 
+  unsigned WrittenToNameSec : 1;
+
 protected:
   uint32_t getInputSectionOffset() const override {
     return Function.CodeSectionOffset;