mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 16:37:43 +00:00
[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 <sjindel@google.com> Reviewed-by: Alexander Thomas <athom@google.com>
This commit is contained in:
parent
c3c31b74fd
commit
ee1ab89987
|
@ -590,8 +590,6 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration
|
|||
|
||||
bool get _isArm64 => _configuration.architecture == Architecture.arm64;
|
||||
|
||||
bool get _isSimArm64 => _configuration.architecture == Architecture.simarm64;
|
||||
|
||||
bool get _isX64 => _configuration.architecture == Architecture.x64;
|
||||
|
||||
bool get _isIA32 => _configuration.architecture == Architecture.ia32;
|
||||
|
@ -705,12 +703,12 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration
|
|||
Command computeAssembleCommand(String tempDir, List arguments,
|
||||
Map<String, String> environmentOverrides) {
|
||||
String cc, shared, ldFlags;
|
||||
if (_isAndroid || _isSimArm || _isSimArm64) {
|
||||
if (_isAndroid) {
|
||||
var ndk = "third_party/android_tools/ndk";
|
||||
String triple;
|
||||
if (_isArm || _isSimArm) {
|
||||
if (_isArm) {
|
||||
triple = "arm-linux-androideabi";
|
||||
} else if (_isArm64 || _isSimArm64) {
|
||||
} else if (_isArm64) {
|
||||
triple = "aarch64-linux-android";
|
||||
}
|
||||
String host;
|
||||
|
@ -722,7 +720,11 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration
|
|||
cc = "$ndk/toolchains/$triple-4.9/prebuilt/$host-x86_64/bin/$triple-gcc";
|
||||
shared = '-shared';
|
||||
} else if (Platform.isLinux) {
|
||||
cc = 'gcc';
|
||||
if (_isSimArm) {
|
||||
cc = 'arm-linux-gnueabihf-gcc';
|
||||
} else {
|
||||
cc = 'gcc';
|
||||
}
|
||||
shared = '-shared';
|
||||
} else if (Platform.isMacOS) {
|
||||
cc = 'clang';
|
||||
|
|
|
@ -224,6 +224,7 @@ bool LoadedElf::ReadSectionStringTable() {
|
|||
bool LoadedElf::LoadSegments() {
|
||||
// Calculate the total amount of virtual memory needed.
|
||||
uword total_memory = 0;
|
||||
uword maximum_alignment = PageSize();
|
||||
for (uword i = 0; i < header_.num_program_headers; ++i) {
|
||||
const dart::elf::ProgramHeader header = program_table_[i];
|
||||
|
||||
|
@ -235,13 +236,12 @@ bool LoadedElf::LoadSegments() {
|
|||
total_memory);
|
||||
CHECK_ERROR(Utils::IsPowerOfTwo(header.alignment),
|
||||
"Alignment must be a power of two.");
|
||||
CHECK_ERROR(header.alignment <= PageSize(),
|
||||
"Cannot align greater than page size.")
|
||||
maximum_alignment = Utils::Maximum(maximum_alignment, header.alignment);
|
||||
}
|
||||
total_memory = Utils::RoundUp(total_memory, PageSize());
|
||||
|
||||
base_.reset(VirtualMemory::AllocateAligned(
|
||||
total_memory, /*alignment=*/PageSize(),
|
||||
total_memory, /*alignment=*/maximum_alignment,
|
||||
/*is_executable=*/false, /*mapping name=*/filename_.get()));
|
||||
CHECK_ERROR(base_ != nullptr, "Could not reserve virtual memory.");
|
||||
|
||||
|
|
Loading…
Reference in a new issue