[vm] Add sizes to ELF static symbols for Code payloads.

Change-Id: I7868ec621e08773b7d379e95fe091e820bf29c94
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139807
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Teagan Strickland <sstrickl@google.com>
This commit is contained in:
Teagan Strickland 2020-03-18 10:23:36 +00:00 committed by commit-bot@chromium.org
parent 9a640dfe51
commit 5f8802b82f
3 changed files with 8 additions and 5 deletions

View file

@ -124,7 +124,8 @@ void Dwarf::AddCode(const Code& code,
ASSERT(name != nullptr);
ASSERT(payload_start >= 0);
auto const virtual_address = elf_->NextMemoryOffset() + payload_start;
elf_->AddStaticSymbol(elf_->NextSectionIndex(), name, virtual_address);
elf_->AddStaticSymbol(elf_->NextSectionIndex(), name, virtual_address,
code.Size());
ASSERT(!code.IsNull());
ASSERT(code_to_address_.Lookup(&code) == nullptr);

View file

@ -650,7 +650,8 @@ intptr_t Elf::AddText(const char* name, const uint8_t* bytes, intptr_t size) {
void Elf::AddStaticSymbol(intptr_t section,
const char* name,
size_t memory_offset) {
intptr_t address,
intptr_t size) {
// Lazily allocate the static string and symbol tables, as we only add static
// symbols in unstripped ELF files.
if (strtab_ == nullptr) {
@ -661,8 +662,8 @@ void Elf::AddStaticSymbol(intptr_t section,
auto const name_index = strtab_->AddString(name);
auto const info = (elf::STB_GLOBAL << 4) | elf::STT_FUNC;
Symbol* symbol = new (zone_)
Symbol(name, name_index, info, section, memory_offset, /*size=*/0);
Symbol* symbol =
new (zone_) Symbol(name, name_index, info, section, address, size);
symtab_->AddSymbol(symbol);
}

View file

@ -33,7 +33,8 @@ class Elf : public ZoneAllocated {
void AddDebug(const char* name, const uint8_t* bytes, intptr_t size);
void AddStaticSymbol(intptr_t section,
const char* name,
size_t memory_offset);
intptr_t address,
intptr_t size);
void Finalize();