diff options
author | Derek Schuff <dschuff@chromium.org> | 2024-02-02 10:44:52 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-02 10:44:52 -0800 |
commit | ef1f999e13bd58394bc1099c87a470d91682153d (patch) | |
tree | 510139b4e4e8c42d9f418ac8581a0cf9bcea8172 /llvm/lib/Object/WasmObjectFile.cpp | |
parent | d4de4c3eafa9b70c255a4d6d5a14dccff79d10e9 (diff) | |
download | llvm-ef1f999e13bd58394bc1099c87a470d91682153d.zip llvm-ef1f999e13bd58394bc1099c87a470d91682153d.tar.gz llvm-ef1f999e13bd58394bc1099c87a470d91682153d.tar.bz2 |
[Object][Wasm] Move WasmSymbolInfo directly into WasmSymbol (NFC) (#80219)
Move the WasmSymbolInfos from their own vector on the WasmLinkingData
directly into the WasmSymbol object. Removing the const-ref to an
external object allows the vector of WasmSymbols to be safely
expanded/reallocated; generating symbol info from the name section will
require this, as the numbers of function and data segment names are
stored separately.
This is a step toward generating symbol information from name sections
for #76107
Diffstat (limited to 'llvm/lib/Object/WasmObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/WasmObjectFile.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp index 953e7c7..4778562 100644 --- a/llvm/lib/Object/WasmObjectFile.cpp +++ b/llvm/lib/Object/WasmObjectFile.cpp @@ -642,9 +642,7 @@ Error WasmObjectFile::parseLinkingSectionSymtab(ReadContext &Ctx) { uint32_t Count = readVaruint32(Ctx); // Clear out any symbol information that was derived from the exports // section. - LinkingData.SymbolTable.clear(); Symbols.clear(); - LinkingData.SymbolTable.reserve(Count); Symbols.reserve(Count); StringSet<> SymbolNames; @@ -844,9 +842,7 @@ Error WasmObjectFile::parseLinkingSectionSymtab(ReadContext &Ctx) { return make_error<GenericBinaryError>("duplicate symbol name " + Twine(Info.Name), object_error::parse_failed); - LinkingData.SymbolTable.emplace_back(Info); - Symbols.emplace_back(LinkingData.SymbolTable.back(), GlobalType, TableType, - Signature); + Symbols.emplace_back(Info, GlobalType, TableType, Signature); LLVM_DEBUG(dbgs() << "Adding symbol: " << Symbols.back() << "\n"); } @@ -1390,7 +1386,6 @@ Error WasmObjectFile::parseGlobalSection(ReadContext &Ctx) { Error WasmObjectFile::parseExportSection(ReadContext &Ctx) { uint32_t Count = readVaruint32(Ctx); Exports.reserve(Count); - LinkingData.SymbolTable.reserve(Count); Symbols.reserve(Count); for (uint32_t I = 0; I < Count; I++) { wasm::WasmExport Ex; @@ -1455,9 +1450,7 @@ Error WasmObjectFile::parseExportSection(ReadContext &Ctx) { } Exports.push_back(Ex); if (Ex.Kind != wasm::WASM_EXTERNAL_MEMORY) { - LinkingData.SymbolTable.emplace_back(Info); - Symbols.emplace_back(LinkingData.SymbolTable.back(), GlobalType, - TableType, Signature); + Symbols.emplace_back(Info, GlobalType, TableType, Signature); LLVM_DEBUG(dbgs() << "Adding symbol: " << Symbols.back() << "\n"); } } |