mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
[vm] Bump max ELF page size to 64K
Some Linux distributions have 64K pages on ARM64. Fixes https://github.com/dart-lang/sdk/issues/47618 TEST=manually tested on a ARM64 Linux with 64K pages Change-Id: Ia96deb5b850785f2ee4402bfaee18c101c02048f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220381 Commit-Queue: Slava Egorov <vegorov@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com>
This commit is contained in:
parent
b74e8e5cec
commit
6d9c58957b
|
@ -6,8 +6,8 @@ import 'dart:io';
|
|||
import 'dart:typed_data';
|
||||
|
||||
// Maximum page size across all supported architectures (arm64 macOS has 16K
|
||||
// pages, the rest are all 4k pages).
|
||||
const elfPageSize = 16384;
|
||||
// pages, some arm64 Linux distributions have 64K pages).
|
||||
const elfPageSize = 65536;
|
||||
const appjitMagicNumber = <int>[0xdc, 0xdc, 0xf6, 0xf6, 0, 0, 0, 0];
|
||||
|
||||
enum Kind { aot, exe }
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
#include "vm/dart_api_state.h"
|
||||
#include "vm/dart_entry.h"
|
||||
#include "vm/debugger.h"
|
||||
#if defined(DART_PRECOMPILED_RUNTIME) && defined(DART_TARGET_OS_LINUX)
|
||||
#include "vm/elf.h"
|
||||
#endif
|
||||
#include "vm/flags.h"
|
||||
#include "vm/handles.h"
|
||||
#include "vm/heap/become.h"
|
||||
|
@ -298,6 +301,16 @@ char* Dart::DartInit(const uint8_t* vm_isolate_snapshot,
|
|||
}
|
||||
start_time_micros_ = OS::GetCurrentMonotonicMicros();
|
||||
VirtualMemory::Init();
|
||||
|
||||
#if defined(DART_PRECOMPILED_RUNTIME) && defined(DART_TARGET_OS_LINUX)
|
||||
if (VirtualMemory::PageSize() > kElfPageSize) {
|
||||
return Utils::SCreate(
|
||||
"Incompatible page size for AOT compiled ELF: expected at most %" Pd
|
||||
", got %" Pd "",
|
||||
kElfPageSize, VirtualMemory::PageSize());
|
||||
}
|
||||
#endif
|
||||
|
||||
OSThread::Init();
|
||||
Zone::Init();
|
||||
#if defined(SUPPORT_TIMELINE)
|
||||
|
|
|
@ -5,14 +5,30 @@
|
|||
#ifndef RUNTIME_VM_ELF_H_
|
||||
#define RUNTIME_VM_ELF_H_
|
||||
|
||||
#include "platform/globals.h"
|
||||
|
||||
#if defined(DART_PRECOMPILER)
|
||||
#include "vm/allocation.h"
|
||||
#include "vm/compiler/runtime_api.h"
|
||||
#include "vm/datastream.h"
|
||||
#include "vm/growable_array.h"
|
||||
#include "vm/zone.h"
|
||||
#endif
|
||||
|
||||
namespace dart {
|
||||
|
||||
// The max page size on all supported architectures. Used to determine
|
||||
// the alignment of load segments, so that they are guaranteed page-aligned,
|
||||
// and no ELF section or segment should have a larger alignment.
|
||||
#if defined(DART_TARGET_OS_LINUX) && defined(TARGET_ARCH_ARM64)
|
||||
// Some Linux distributions on ARM64 select 64 KB page size.
|
||||
// Follow LLVM (https://reviews.llvm.org/D25079) and set maximum page size
|
||||
// to 64 KB for ARM64 Linux builds.
|
||||
static constexpr intptr_t kElfPageSize = 64 * KB;
|
||||
#else
|
||||
static constexpr intptr_t kElfPageSize = 16 * KB;
|
||||
#endif
|
||||
|
||||
#if defined(DART_PRECOMPILER)
|
||||
|
||||
class Dwarf;
|
||||
|
@ -33,10 +49,7 @@ class Elf : public ZoneAllocated {
|
|||
|
||||
Elf(Zone* zone, BaseWriteStream* stream, Type type, Dwarf* dwarf = nullptr);
|
||||
|
||||
// The max page size on all supported architectures. Used to determine
|
||||
// the alignment of load segments, so that they are guaranteed page-aligned,
|
||||
// and no ELF section or segment should have a larger alignment.
|
||||
static constexpr intptr_t kPageSize = 16 * KB;
|
||||
static constexpr intptr_t kPageSize = kElfPageSize;
|
||||
|
||||
bool IsStripped() const { return dwarf_ == nullptr; }
|
||||
|
||||
|
|
Loading…
Reference in a new issue