Skip to content

Commit 298777c

Browse files
sstricklcommit-bot@chromium.org
authored andcommitted
[vm] Merge text and data sections in ELF snapshots.
To do this, BitsContainer is changed to be a more rope-like representation of section portions. In addition to containing most of the same information stored per-section previously, each portion also has a section-relative offset that is calculated when it is added. Thus, merging two compatible BitsContainer sections is just adding the portions from the second to the first, tweaking the section-relative offset for each. Other changes in this CL: * Create PseudoSections subclasses for the elf header, program header table, and section header table, so we can treat them more uniformly with the other parts of the ELF snapshot. * We now only allocate as much BSS space in the snapshot as is needed for any text sections in the snapshot, instead of always allocating a big enough BSS space for both VM and isolate, even for deferred snapshots where there is no VM isolate. * We already separated segment and section alignment in previous CLs, so the fact that our own ELF loader needs load segments to be page-aligned no longer means that the sections within those segments also needs to be. Thus, we align individual instructions sections to kMaxObjectAlignment, like readonly data sections, since both hold a single Image object. This removes unnecessary intra-section padding. TEST=Tests that check DWARF information and trybots that use ELF snapshots. Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-dwarf-linux-product-x64-try Change-Id: If0315c8b7b0f31481b676a8901f49cd3a44b5561 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206365 Reviewed-by: Ryan Macnak <[email protected]> Commit-Queue: Tess Strickland <[email protected]>
1 parent 20ba6af commit 298777c

File tree

5 files changed

+877
-694
lines changed

5 files changed

+877
-694
lines changed

runtime/bin/elf_loader.cc

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <bin/file.h>
77
#include <platform/elf.h>
88
#include <platform/globals.h>
9-
#include <vm/bss_relocs.h>
109
#include <vm/cpu.h>
1110
#include <vm/virtual_memory.h>
1211

@@ -239,8 +238,6 @@ class LoadedElf {
239238
const char* dynamic_string_table_ = nullptr;
240239
const dart::elf::Symbol* dynamic_symbol_table_ = nullptr;
241240
uword dynamic_symbol_count_ = 0;
242-
uword* vm_bss_ = nullptr;
243-
uword* isolate_bss_ = nullptr;
244241

245242
DISALLOW_COPY_AND_ASSIGN(LoadedElf);
246243
};
@@ -468,20 +465,11 @@ bool LoadedElf::ReadSections() {
468465
dynamic_symbol_table_ = reinterpret_cast<const dart::elf::Symbol*>(
469466
base_->start() + header.memory_offset);
470467
dynamic_symbol_count_ = header.file_size / sizeof(dart::elf::Symbol);
471-
} else if (strcmp(name, ".bss") == 0) {
472-
auto const bss_size =
473-
(BSS::kVmEntryCount + BSS::kIsolateEntryCount) * kWordSize;
474-
CHECK_ERROR(header.memory_offset != 0, ".bss must be loaded.");
475-
CHECK_ERROR(header.file_size >= bss_size,
476-
".bss does not have enough space.");
477-
vm_bss_ = reinterpret_cast<uword*>(base_->start() + header.memory_offset);
478-
isolate_bss_ = vm_bss_ + BSS::kVmEntryCount;
479468
}
480469
}
481470

482471
CHECK_ERROR(dynamic_string_table_ != nullptr, "Couldn't find .dynstr.");
483472
CHECK_ERROR(dynamic_symbol_table_ != nullptr, "Couldn't find .dynsym.");
484-
CHECK_ERROR(vm_bss_ != nullptr, "Couldn't find .bss.");
485473
return true;
486474
}
487475

0 commit comments

Comments
 (0)