aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/WasmObjectFile.cpp
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2023-02-24 10:09:07 -0800
committerSam Clegg <sbc@chromium.org>2023-02-27 14:20:01 -0800
commitd65ed8cde0a2b595a36f031d65158b08e6421b4f (patch)
treede0068d477e842f4283c863f814c585bc202e69c /llvm/lib/Object/WasmObjectFile.cpp
parent45391e139452777a30030006de7c9b332571b74a (diff)
downloadllvm-d65ed8cde0a2b595a36f031d65158b08e6421b4f.zip
llvm-d65ed8cde0a2b595a36f031d65158b08e6421b4f.tar.gz
llvm-d65ed8cde0a2b595a36f031d65158b08e6421b4f.tar.bz2
[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
Diffstat (limited to 'llvm/lib/Object/WasmObjectFile.cpp')
-rw-r--r--llvm/lib/Object/WasmObjectFile.cpp13
1 files changed, 12 insertions, 1 deletions
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()) {