diff options
author | Sam Clegg <sbc@chromium.org> | 2019-05-29 15:41:08 +0000 |
---|---|---|
committer | Sam Clegg <sbc@chromium.org> | 2019-05-29 15:41:08 +0000 |
commit | 56e970d45d021f69e57c351ff1c85cec7c7a03b6 (patch) | |
tree | 0a2f490af460849d661447c12c72bd3b9c0c78bd | |
parent | 9ce37466043ee2f6ea8ed074f947c528ab0be37d (diff) | |
download | bcm5719-llvm-56e970d45d021f69e57c351ff1c85cec7c7a03b6.tar.gz bcm5719-llvm-56e970d45d021f69e57c351ff1c85cec7c7a03b6.zip |
[WebAssembly] Move direct call tracking from member to local. NFC.
This data structure is only needed temporarily while symbols are being
created.
This is a followup on rL361678.
Differential Revision: https://reviews.llvm.org/D62548
llvm-svn: 361977
-rw-r--r-- | lld/wasm/InputFiles.cpp | 13 | ||||
-rw-r--r-- | lld/wasm/InputFiles.h | 7 |
2 files changed, 10 insertions, 10 deletions
diff --git a/lld/wasm/InputFiles.cpp b/lld/wasm/InputFiles.cpp index a9d6abff4ab..e1c4fa7b747 100644 --- a/lld/wasm/InputFiles.cpp +++ b/lld/wasm/InputFiles.cpp @@ -272,7 +272,14 @@ void ObjFile::parse(bool IgnoreComdats) { } 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<bool> 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 @@ void ObjFile::parse(bool IgnoreComdats) { // 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 @@ void ObjFile::parse(bool IgnoreComdats) { } } size_t Idx = Symbols.size(); - Symbols.push_back(createUndefined(WasmSym, SymbolIsCalledDirectly[Idx])); + Symbols.push_back(createUndefined(WasmSym, IsCalledDirectly[Idx])); } } diff --git a/lld/wasm/InputFiles.h b/lld/wasm/InputFiles.h index 64ac208daa6..f5b4532fa92 100644 --- a/lld/wasm/InputFiles.h +++ b/lld/wasm/InputFiles.h @@ -69,13 +69,6 @@ protected: // List of all symbols referenced or defined by this file. std::vector<Symbol *> 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<bool> SymbolIsCalledDirectly; private: const Kind FileKind; |