diff options
author | Sam Clegg <sbc@chromium.org> | 2018-06-22 15:13:10 +0000 |
---|---|---|
committer | Sam Clegg <sbc@chromium.org> | 2018-06-22 15:13:10 +0000 |
commit | 6c6567e2390b7006f7d60a4417551e71da92c422 (patch) | |
tree | 8fb516a270f00b6117bbe621f8004babe049f195 /lld/wasm | |
parent | 1bfc38d8602b04b8b83a54900191903419026b37 (diff) |
Revert "[WebAssembly] Error on mismatched function signature in final output"
This caused a lot of issues on the WebAssembly waterfall.
In particular, until with the signature of `main`. We
probably want a better solution for main before we re-land.
Reverts rL335192
Diffstat (limited to 'lld/wasm')
-rw-r--r-- | lld/wasm/Driver.cpp | 3 | ||||
-rw-r--r-- | lld/wasm/MarkLive.cpp | 5 | ||||
-rw-r--r-- | lld/wasm/SymbolTable.cpp | 25 | ||||
-rw-r--r-- | lld/wasm/Symbols.h | 6 |
4 files changed, 11 insertions, 28 deletions
diff --git a/lld/wasm/Driver.cpp b/lld/wasm/Driver.cpp index c24496c6ecc..70a36046ad9 100644 --- a/lld/wasm/Driver.cpp +++ b/lld/wasm/Driver.cpp @@ -483,8 +483,7 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) { return; // Do size optimizations: garbage collection - if (Config->GcSections) - markLive(); + markLive(); // Write the result to the file. writeResult(); diff --git a/lld/wasm/MarkLive.cpp b/lld/wasm/MarkLive.cpp index c9dbbf59c95..018b3255b55 100644 --- a/lld/wasm/MarkLive.cpp +++ b/lld/wasm/MarkLive.cpp @@ -34,6 +34,9 @@ using namespace lld; using namespace lld::wasm; void lld::wasm::markLive() { + if (!Config->GcSections) + return; + LLVM_DEBUG(dbgs() << "markLive\n"); SmallVector<InputChunk *, 256> Q; @@ -42,8 +45,6 @@ void lld::wasm::markLive() { return; LLVM_DEBUG(dbgs() << "markLive: " << Sym->getName() << "\n"); Sym->markLive(); - if (Sym->SignatureMismatch) - error("function signature mismatch: " + Sym->getName()); if (InputChunk *Chunk = Sym->getChunk()) Q.push_back(Chunk); }; diff --git a/lld/wasm/SymbolTable.cpp b/lld/wasm/SymbolTable.cpp index 77b2f18c286..1180cfc6759 100644 --- a/lld/wasm/SymbolTable.cpp +++ b/lld/wasm/SymbolTable.cpp @@ -106,7 +106,7 @@ static void reportTypeError(const Symbol *Existing, const InputFile *File, " in " + toString(File)); } -static void checkFunctionType(Symbol *Existing, const InputFile *File, +static void checkFunctionType(const Symbol *Existing, const InputFile *File, const WasmSignature *NewSig) { auto ExistingFunction = dyn_cast<FunctionSymbol>(Existing); if (!ExistingFunction) { @@ -114,27 +114,12 @@ static void checkFunctionType(Symbol *Existing, const InputFile *File, return; } - const WasmSignature *OldSig = ExistingFunction->getFunctionType(); if (OldSig && NewSig && *NewSig != *OldSig) { - // Don't generate more than one warning per symbol. - if (Existing->SignatureMismatch) - return; - Existing->SignatureMismatch = true; - - std::string msg = ("function signature mismatch: " + Existing->getName() + - "\n>>> defined as " + toString(*OldSig) + " in " + - toString(Existing->getFile()) + "\n>>> defined as " + - toString(*NewSig) + " in " + toString(File)) - .str(); - // A function signature mismatch is only really problem if the mismatched - // symbol is included in the final output, and gc-sections can remove the - // offending uses. Therefore we delay reporting this as an error when - // section GC is enabled. - if (Config->GcSections) - warn(msg); - else - error(msg); + warn("function signature mismatch: " + Existing->getName() + + "\n>>> defined as " + toString(*OldSig) + " in " + + toString(Existing->getFile()) + "\n>>> defined as " + + toString(*NewSig) + " in " + toString(File)); } } diff --git a/lld/wasm/Symbols.h b/lld/wasm/Symbols.h index ab974770d36..a1a41bea9dc 100644 --- a/lld/wasm/Symbols.h +++ b/lld/wasm/Symbols.h @@ -93,12 +93,11 @@ public: // True if this symbol was referenced by a regular (non-bitcode) object. unsigned IsUsedInRegularObj : 1; - unsigned SignatureMismatch : 1; protected: Symbol(StringRef Name, Kind K, uint32_t Flags, InputFile *F) - : IsUsedInRegularObj(false), SignatureMismatch(false), Name(Name), - SymbolKind(K), Flags(Flags), File(F), Referenced(!Config->GcSections) {} + : IsUsedInRegularObj(false), Name(Name), SymbolKind(K), Flags(Flags), + File(F), Referenced(!Config->GcSections) {} StringRef Name; Kind SymbolKind; @@ -341,7 +340,6 @@ T *replaceSymbol(Symbol *S, ArgT &&... Arg) { T *S2 = new (S) T(std::forward<ArgT>(Arg)...); S2->IsUsedInRegularObj = SymCopy.IsUsedInRegularObj; - S2->SignatureMismatch = SymCopy.SignatureMismatch; return S2; } |