diff --git a/lld/wasm/InputFiles.h b/lld/wasm/InputFiles.h --- a/lld/wasm/InputFiles.h +++ b/lld/wasm/InputFiles.h @@ -69,13 +69,6 @@ // List of all symbols referenced or defined by this file. std::vector Symbols; - // Bool for each symbol, true if called directly. This allows us to implement - // a weaker form of signature checking where undefined functions that are not - // called directly (i.e. only address taken) don't have to match the defined - // function's signature. We cannot do this for directly called functions - // because those signatures are checked at validation times. - // See https://bugs.llvm.org/show_bug.cgi?id=40412 - std::vector SymbolIsCalledDirectly; private: const Kind FileKind; diff --git a/lld/wasm/InputFiles.cpp b/lld/wasm/InputFiles.cpp --- a/lld/wasm/InputFiles.cpp +++ b/lld/wasm/InputFiles.cpp @@ -272,7 +272,14 @@ } uint32_t SectionIndex = 0; - SymbolIsCalledDirectly.resize(WasmObj->getNumberOfSymbols(), false); + + // Bool for each symbol, true if called directly. This allows us to implement + // a weaker form of signature checking where undefined functions that are not + // called directly (i.e. only address taken) don't have to match the defined + // function's signature. We cannot do this for directly called functions + // because those signatures are checked at validation times. + // See https://bugs.llvm.org/show_bug.cgi?id=40412 + std::vector IsCalledDirectly(WasmObj->getNumberOfSymbols(), false); for (const SectionRef &Sec : WasmObj->sections()) { const WasmSection &Section = WasmObj->getWasmSection(Sec); // Wasm objects can have at most one code and one data section. @@ -292,7 +299,7 @@ // directly for (const WasmRelocation &Reloc : Section.Relocations) if (Reloc.Type == R_WASM_FUNCTION_INDEX_LEB) - SymbolIsCalledDirectly[Reloc.Index] = true; + IsCalledDirectly[Reloc.Index] = true; } TypeMap.resize(getWasmObj()->types().size()); @@ -342,7 +349,7 @@ } } size_t Idx = Symbols.size(); - Symbols.push_back(createUndefined(WasmSym, SymbolIsCalledDirectly[Idx])); + Symbols.push_back(createUndefined(WasmSym, IsCalledDirectly[Idx])); } }