diff --git a/lib/Object/WasmObjectFile.cpp b/lib/Object/WasmObjectFile.cpp index 3b62ccf2315..77fcac5578b 100644 --- a/lib/Object/WasmObjectFile.cpp +++ b/lib/Object/WasmObjectFile.cpp @@ -769,7 +769,7 @@ uint32_t WasmObjectFile::getSymbolFlags(DataRefImpl Symb) const { DEBUG(dbgs() << "getSymbolFlags: ptr=" << &Sym << " " << Sym << "\n"); if (Sym.isWeak()) Result |= SymbolRef::SF_Weak; - else if (Sym.isGlobal()) + if (!Sym.isLocal()) Result |= SymbolRef::SF_Global; switch (Sym.Type) { diff --git a/test/MC/WebAssembly/weak-alias.ll b/test/MC/WebAssembly/weak-alias.ll index 2beef846def..8db83e4c5e1 100644 --- a/test/MC/WebAssembly/weak-alias.ll +++ b/test/MC/WebAssembly/weak-alias.ll @@ -1,4 +1,6 @@ -; RUN: llc -mtriple wasm32-unknown-unknown-wasm -filetype=obj %s -o - | obj2yaml | FileCheck %s +; RUN: llc -mtriple wasm32-unknown-unknown-wasm -filetype=obj %s -o %t.o +; RUN: obj2yaml %t.o | FileCheck %s +; RUN: llvm-objdump -t %t.o | FileCheck --check-prefix=CHECK-SYMS %s ; 'foo_alias()' is weak alias of function 'foo()' ; 'bar_alias' is weak alias of global variable 'bar' @@ -107,3 +109,14 @@ entry: ; CHECK-NEXT: - Index: 1 ; CHECK-NEXT: Name: .data.bar_alias_address ; CHECK-NEXT: ... + +; CHECK-SYMS: SYMBOL TABLE: +; CHECK-SYMS-NEXT: 00000000 g F name foo_alias +; CHECK-SYMS-NEXT: 00000001 g F name call_alias +; CHECK-SYMS-NEXT: 00000002 g F name foo +; CHECK-SYMS-NEXT: 00000002 gw F EXPORT foo_alias +; CHECK-SYMS-NEXT: 00000000 gw EXPORT bar_alias +; CHECK-SYMS-NEXT: 00000001 g F EXPORT call_alias +; CHECK-SYMS-NEXT: 00000002 g F EXPORT foo +; CHECK-SYMS-NEXT: 00000000 g EXPORT bar +; CHECK-SYMS-NEXT: 00000008 g EXPORT bar_alias_address