[llvm] aea0ea5 - [llvm-nm] Fix msan error in llvm-nm/wasm/weak-symbols.yaml.test (#65538)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 6 15:30:34 PDT 2023
Author: Daniel Kutenin
Date: 2023-09-06T15:30:30-07:00
New Revision: aea0ea57b703efb2c376404001cad61b7d99d2fb
URL: https://github.com/llvm/llvm-project/commit/aea0ea57b703efb2c376404001cad61b7d99d2fb
DIFF: https://github.com/llvm/llvm-project/commit/aea0ea57b703efb2c376404001cad61b7d99d2fb.diff
LOG: [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
Added:
Modified:
llvm/tools/llvm-nm/llvm-nm.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-nm/llvm-nm.cpp b/llvm/tools/llvm-nm/llvm-nm.cpp
index 129eb895bafeeb0..79213b3b2c27e31 100644
--- a/llvm/tools/llvm-nm/llvm-nm.cpp
+++ b/llvm/tools/llvm-nm/llvm-nm.cpp
@@ -1822,7 +1822,7 @@ static bool getSymbolNamesFromObject(SymbolicFile &Obj,
if (const WasmObjectFile *WasmObj = dyn_cast<WasmObjectFile>(&Obj)) {
const WasmSymbol &WasmSym = WasmObj->getWasmSymbol(Sym);
- if (WasmSym.isTypeData())
+ if (WasmSym.isTypeData() && !WasmSym.isUndefined())
S.Size = WasmSym.Info.DataRef.Size;
}
More information about the llvm-commits
mailing list