mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[ewasm] Clarify custom section handling in BinaryTransform
This commit is contained in:
@@ -305,13 +305,15 @@ bytes BinaryTransform::run(Module const& _module)
|
||||
ret += exportSection(functionIDs);
|
||||
|
||||
map<string, pair<size_t, size_t>> subModulePosAndSize;
|
||||
for (auto const& sub: _module.subModules)
|
||||
for (auto const& [name, module]: _module.subModules)
|
||||
{
|
||||
// TODO should we prefix and / or shorten the name?
|
||||
bytes data = BinaryTransform::run(sub.second);
|
||||
size_t length = data.size();
|
||||
ret += customSection(sub.first, move(data));
|
||||
subModulePosAndSize[sub.first] = {ret.size() - length, length};
|
||||
bytes data = BinaryTransform::run(module);
|
||||
size_t const length = data.size();
|
||||
ret += customSection(name, move(data));
|
||||
// Skip all the previous sections and the size field of this current custom section.
|
||||
size_t const offset = ret.size() - length;
|
||||
subModulePosAndSize[name] = {offset, length};
|
||||
}
|
||||
|
||||
BinaryTransform bt(
|
||||
|
||||
Reference in New Issue
Block a user