Skip to content

Commit aea0ea5

Browse files
authored
[llvm-nm] Fix msan error in llvm-nm/wasm/weak-symbols.yaml.test (#65538)
This happened because we had a section ``` - Index: 3 Kind: DATA Name: weak_import_data Flags: [ BINDING_WEAK, UNDEFINED ] ``` Which does not have size. We managed to reproduce it by building llvm under msan with libcxx as a standard library and debug mode with -D_LIBCPP_DEBUG_STRICT_WEAK_ORDERING_CHECK. It called comp(a, a) and full tie detected uninitialized memory This started to happen after https://reviews.llvm.org/D158799
1 parent a07d4c0 commit aea0ea5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/tools/llvm-nm/llvm-nm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1822,7 +1822,7 @@ static bool getSymbolNamesFromObject(SymbolicFile &Obj,
18221822

18231823
if (const WasmObjectFile *WasmObj = dyn_cast<WasmObjectFile>(&Obj)) {
18241824
const WasmSymbol &WasmSym = WasmObj->getWasmSymbol(Sym);
1825-
if (WasmSym.isTypeData())
1825+
if (WasmSym.isTypeData() && !WasmSym.isUndefined())
18261826
S.Size = WasmSym.Info.DataRef.Size;
18271827
}
18281828

0 commit comments

Comments
 (0)