From d65ed8cde0a2b595a36f031d65158b08e6421b4f Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Fri, 24 Feb 2023 10:09:07 -0800 Subject: [lld][WebAssembly] Fix handling of mixed strong and weak references When adding a undefined symbols to the symbol table, if the existing reference is weak replace the symbol flags with (potentially) non-weak binding. Fixes: https://github.com/llvm/llvm-project/issues/60829 Differential Revision: https://reviews.llvm.org/D144747 --- llvm/lib/Object/WasmObjectFile.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Object/WasmObjectFile.cpp') diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp index 400911d..471b68f 100644 --- a/llvm/lib/Object/WasmObjectFile.cpp +++ b/llvm/lib/Object/WasmObjectFile.cpp @@ -38,7 +38,18 @@ using namespace object; void WasmSymbol::print(raw_ostream &Out) const { Out << "Name=" << Info.Name << ", Kind=" << toString(wasm::WasmSymbolType(Info.Kind)) << ", Flags=0x" - << Twine::utohexstr(Info.Flags); + << Twine::utohexstr(Info.Flags) << " ["; + switch (getBinding()) { + case wasm::WASM_SYMBOL_BINDING_GLOBAL: Out << "global"; break; + case wasm::WASM_SYMBOL_BINDING_LOCAL: Out << "local"; break; + case wasm::WASM_SYMBOL_BINDING_WEAK: Out << "weak"; break; + } + if (isHidden()) { + Out << ", hidden"; + } else { + Out << ", default"; + } + Out << "]"; if (!isTypeData()) { Out << ", ElemIndex=" << Info.ElementIndex; } else if (isDefined()) { -- cgit v1.1