Skip to content

Commit ee1ab89

Browse files
sjindel-googlecommit-bot@chromium.org
authored andcommitted
[vm/infra] Fix compiler_configuration to use existing cross-compiler.
Also fix the ELF loader to allow segment alignment >page size. Change-Id: Icc4c2eaae44171e74cc41d9f2b06701acad86a90 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118983 Commit-Queue: Samir Jindel <[email protected]> Reviewed-by: Alexander Thomas <[email protected]>
1 parent c3c31b7 commit ee1ab89

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

pkg/test_runner/lib/src/compiler_configuration.dart

+8-6
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,6 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration
590590

591591
bool get _isArm64 => _configuration.architecture == Architecture.arm64;
592592

593-
bool get _isSimArm64 => _configuration.architecture == Architecture.simarm64;
594-
595593
bool get _isX64 => _configuration.architecture == Architecture.x64;
596594

597595
bool get _isIA32 => _configuration.architecture == Architecture.ia32;
@@ -705,12 +703,12 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration
705703
Command computeAssembleCommand(String tempDir, List arguments,
706704
Map<String, String> environmentOverrides) {
707705
String cc, shared, ldFlags;
708-
if (_isAndroid || _isSimArm || _isSimArm64) {
706+
if (_isAndroid) {
709707
var ndk = "third_party/android_tools/ndk";
710708
String triple;
711-
if (_isArm || _isSimArm) {
709+
if (_isArm) {
712710
triple = "arm-linux-androideabi";
713-
} else if (_isArm64 || _isSimArm64) {
711+
} else if (_isArm64) {
714712
triple = "aarch64-linux-android";
715713
}
716714
String host;
@@ -722,7 +720,11 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration
722720
cc = "$ndk/toolchains/$triple-4.9/prebuilt/$host-x86_64/bin/$triple-gcc";
723721
shared = '-shared';
724722
} else if (Platform.isLinux) {
725-
cc = 'gcc';
723+
if (_isSimArm) {
724+
cc = 'arm-linux-gnueabihf-gcc';
725+
} else {
726+
cc = 'gcc';
727+
}
726728
shared = '-shared';
727729
} else if (Platform.isMacOS) {
728730
cc = 'clang';

runtime/bin/elf_loader.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ bool LoadedElf::ReadSectionStringTable() {
224224
bool LoadedElf::LoadSegments() {
225225
// Calculate the total amount of virtual memory needed.
226226
uword total_memory = 0;
227+
uword maximum_alignment = PageSize();
227228
for (uword i = 0; i < header_.num_program_headers; ++i) {
228229
const dart::elf::ProgramHeader header = program_table_[i];
229230

@@ -235,13 +236,12 @@ bool LoadedElf::LoadSegments() {
235236
total_memory);
236237
CHECK_ERROR(Utils::IsPowerOfTwo(header.alignment),
237238
"Alignment must be a power of two.");
238-
CHECK_ERROR(header.alignment <= PageSize(),
239-
"Cannot align greater than page size.")
239+
maximum_alignment = Utils::Maximum(maximum_alignment, header.alignment);
240240
}
241241
total_memory = Utils::RoundUp(total_memory, PageSize());
242242

243243
base_.reset(VirtualMemory::AllocateAligned(
244-
total_memory, /*alignment=*/PageSize(),
244+
total_memory, /*alignment=*/maximum_alignment,
245245
/*is_executable=*/false, /*mapping name=*/filename_.get()));
246246
CHECK_ERROR(base_ != nullptr, "Could not reserve virtual memory.");
247247

0 commit comments

Comments
 (0)