[lld] r361977 - [WebAssembly] Move direct call tracking from member to local. NFC.
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Wed May 29 08:41:08 PDT 2019
Author: sbc
Date: Wed May 29 08:41:08 2019
New Revision: 361977
URL: http://llvm.org/viewvc/llvm-project?rev=361977&view=rev
Log:
[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
Modified:
lld/trunk/wasm/InputFiles.cpp
lld/trunk/wasm/InputFiles.h
Modified: lld/trunk/wasm/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/InputFiles.cpp?rev=361977&r1=361976&r2=361977&view=diff
==============================================================================
--- lld/trunk/wasm/InputFiles.cpp (original)
+++ lld/trunk/wasm/InputFiles.cpp Wed May 29 08:41:08 2019
@@ -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]));
}
}
Modified: lld/trunk/wasm/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/InputFiles.h?rev=361977&r1=361976&r2=361977&view=diff
==============================================================================
--- lld/trunk/wasm/InputFiles.h (original)
+++ lld/trunk/wasm/InputFiles.h Wed May 29 08:41:08 2019
@@ -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;
More information about the llvm-commits
mailing list