Standalone support for AOT as dylibs on Fuchsia.

BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2774993002 .
This commit is contained in:
Ryan Macnak 2017-03-24 14:52:18 -07:00
parent bfde95b58f
commit a42b802bcc
3 changed files with 47 additions and 3 deletions

View file

@ -4,6 +4,7 @@
import("gypi_contents.gni")
import("../runtime_args.gni")
import("../../build/compiled_action.gni")
# Generate a resources.cc file for the service isolate without Observatory.
action("gen_resources_cc") {
@ -691,14 +692,47 @@ dart_executable("dart_bootstrap") {
}
if (defined(is_fuchsia) && is_fuchsia) {
hello_fuchsia_source = rebase_path("../tests/vm/dart/hello_fuchsia_test.dart")
copy("hello_fuchsia") {
sources = [
"../tests/vm/dart/hello_fuchsia_test.dart",
hello_fuchsia_source,
]
outputs = [
"$root_out_dir/hello_fuchsia.dart",
]
}
hello_fuchsia_assembly = "$target_gen_dir/hello_fuchsia.S"
compiled_action("hello_fuchsia_assembly") {
inputs = [
hello_fuchsia_source,
]
outputs = [
hello_fuchsia_assembly,
]
tool = ":dart_bootstrap"
args = [
"--snapshot-kind=app-aot",
"--snapshot=" + rebase_path(hello_fuchsia_assembly),
hello_fuchsia_source,
]
}
shared_library("hello_fuchsia_dylib") {
deps = [
":hello_fuchsia_assembly",
]
sources = [
hello_fuchsia_assembly,
]
cflags = [
"-nostdlib",
"-nostartfiles",
]
output_name = "hello_fuchsia"
}
}
executable("process_test") {

View file

@ -6,7 +6,10 @@
#if defined(HOST_OS_FUCHSIA)
#include "bin/extensions.h"
#include <dlfcn.h> // NOLINT
#include <dlfcn.h>
#include <launchpad/vmo.h>
#include <magenta/dlfcn.h>
#include "platform/assert.h"
@ -20,7 +23,11 @@ const char* kIsolateSnapshotInstructionsSymbolName =
"_kDartIsolateSnapshotInstructions";
void* Extensions::LoadExtensionLibrary(const char* library_file) {
return dlopen(library_file, RTLD_LAZY);
mx_handle_t vmo = launchpad_vmo_from_file(library_file);
if (vmo <= 0) {
return NULL;
}
return dlopen_vmo(vmo, RTLD_LAZY);
}

View file

@ -6703,6 +6703,9 @@ Dart_CreateAppAOTSnapshotAsBlobs(uint8_t** vm_snapshot_data_buffer,
#elif !defined(DART_PRECOMPILER)
return Api::NewError(
"This VM was built without support for AOT compilation.");
#elif defined(TARGET_OS_FUCHSIA)
return Api::NewError(
"AOT as blobs is not supported on Fuchsia; use dylibs instead.");
#else
API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());