[lld][WebAssembly] Preserve symbol flags in --relocatable output
Fixes https://github.com/emscripten-core/emscripten/issues/8879
Differential Revision: https://reviews.llvm.org/D67729
llvm-svn: 372660
diff --git a/lld/wasm/SymbolTable.cpp b/lld/wasm/SymbolTable.cpp
index 44417b0..b53ddaf 100644
--- a/lld/wasm/SymbolTable.cpp
+++ b/lld/wasm/SymbolTable.cpp
@@ -401,6 +401,7 @@
LLVM_DEBUG(dbgs() << "addUndefinedFunction: " << name << " ["
<< (sig ? toString(*sig) : "none")
<< "] IsCalledDirectly:" << isCalledDirectly << "\n");
+ assert(flags & WASM_SYMBOL_UNDEFINED);
Symbol *s;
bool wasInserted;
@@ -443,6 +444,7 @@
Symbol *SymbolTable::addUndefinedData(StringRef name, uint32_t flags,
InputFile *file) {
LLVM_DEBUG(dbgs() << "addUndefinedData: " << name << "\n");
+ assert(flags & WASM_SYMBOL_UNDEFINED);
Symbol *s;
bool wasInserted;
@@ -464,6 +466,7 @@
InputFile *file,
const WasmGlobalType *type) {
LLVM_DEBUG(dbgs() << "addUndefinedGlobal: " << name << "\n");
+ assert(flags & WASM_SYMBOL_UNDEFINED);
Symbol *s;
bool wasInserted;