mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
![Daco Harkes](/assets/img/avatar_default.png)
This CL makes `FfiNative`s use `DynamicLibrary.process()` lookup if resolving with the resolver set by `Dart_SetFfiNativeResolver` fails. Also moves the implementation over from ffi.cc to ffi_dynamic_library.cc so the implementation can be shared with `DynamicLibrary.process()`. Moves the implementation behind non-simulator and non-precompiler. However, the implementation is tested in vm/cc tests which are in precompiler mode. So enables the implementation if TESTED is defined. This CL massages the build files so that TESTED is properly defined when compiling the runtime for the vm/cc tests, and links the ole32 symbols on windows for vm/cc tests. (And some unrelated small cleanup changes here and there.) TEST=tests/ffi/native_assets/process_test.dart Change-Id: I25395d381db1d9b4b7a5759171a798a1140a6140 Cq-Include-Trybots: luci.dart.try:vm-kernel-win-debug-x64c-try,vm-kernel-win-debug-x64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-precomp-win-debug-x64c-try,dart-sdk-win-try,vm-kernel-win-release-x64-try,vm-kernel-win-release-ia32-try,vm-kernel-precomp-win-product-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264982 Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Daco Harkes <dacoharkes@google.com>
289 lines
7.9 KiB
Plaintext
289 lines
7.9 KiB
Plaintext
# Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
|
|
# for details. All rights reserved. Use of this source code is governed by a
|
|
# BSD-style license that can be found in the LICENSE file.
|
|
|
|
_dart_runtime = get_path_info("../runtime", "abspath")
|
|
|
|
_base_config = [
|
|
"$_dart_runtime:dart_arch_config",
|
|
"$_dart_runtime:dart_config",
|
|
"$_dart_runtime:dart_os_config",
|
|
]
|
|
|
|
_base_fuchsia_config = [
|
|
"$_dart_runtime:dart_arch_config",
|
|
"$_dart_runtime:dart_config",
|
|
"$_dart_runtime:dart_os_fuchsia_config",
|
|
]
|
|
|
|
_base_host_targeting_host_config = [ "$_dart_runtime:dart_config" ]
|
|
|
|
_maybe_product = [ "$_dart_runtime:dart_maybe_product_config" ]
|
|
|
|
_product = [ "$_dart_runtime:dart_product_config" ]
|
|
|
|
_jit_config = _base_config + _maybe_product
|
|
|
|
_jit_product_config = _base_config + _product
|
|
|
|
_base_libfuzzer_config = [ "$_dart_runtime:dart_libfuzzer_config" ]
|
|
|
|
_libfuzzer_config = _base_config + _base_libfuzzer_config
|
|
|
|
_precompiled_runtime_config =
|
|
_base_config + [
|
|
"$_dart_runtime:dart_maybe_product_config",
|
|
"$_dart_runtime:dart_precompiled_runtime_config",
|
|
]
|
|
|
|
_precompiled_runtime_product_config =
|
|
_base_config + [
|
|
"$_dart_runtime:dart_precompiled_runtime_config",
|
|
"$_dart_runtime:dart_product_config",
|
|
]
|
|
|
|
_precompiler_base = [ "$_dart_runtime:dart_precompiler_config" ]
|
|
|
|
_precompiler_config = _base_config + _precompiler_base + _maybe_product
|
|
|
|
_precompiler_testing_config =
|
|
_precompiler_config + [ "$_dart_runtime:dart_testing_config" ]
|
|
|
|
_precompiler_product_config = _base_config + _precompiler_base + _product
|
|
|
|
_precompiler_fuchsia_config =
|
|
_base_fuchsia_config + _precompiler_base + _maybe_product
|
|
|
|
_precompiler_product_fuchsia_config =
|
|
_base_fuchsia_config + _precompiler_base + _product
|
|
|
|
_precompiler_host_targeting_host_config =
|
|
_base_host_targeting_host_config + _precompiler_base + _maybe_product
|
|
|
|
_precompiler_product_host_targeting_host_config =
|
|
_base_host_targeting_host_config + _precompiler_base + _product
|
|
|
|
_all_configs = [
|
|
{
|
|
suffix = "_jit"
|
|
configs = _jit_config
|
|
snapshot = true
|
|
compiler = true
|
|
is_product = false
|
|
},
|
|
{
|
|
suffix = "_jit_product"
|
|
configs = _jit_product_config
|
|
snapshot = true
|
|
compiler = true
|
|
is_product = true
|
|
},
|
|
{
|
|
suffix = "_precompiled_runtime"
|
|
configs = _precompiled_runtime_config
|
|
snapshot = true
|
|
compiler = false
|
|
is_product = false
|
|
},
|
|
{
|
|
suffix = "_precompiled_runtime_product"
|
|
configs = _precompiled_runtime_product_config
|
|
snapshot = true
|
|
compiler = false
|
|
is_product = true
|
|
},
|
|
{
|
|
suffix = "_precompiler"
|
|
configs = _precompiler_config
|
|
snapshot = false
|
|
compiler = true
|
|
is_product = false
|
|
},
|
|
{
|
|
suffix = "_precompiler_testing"
|
|
configs = _precompiler_testing_config
|
|
snapshot = false
|
|
compiler = true
|
|
is_product = false
|
|
},
|
|
{
|
|
suffix = "_precompiler_product"
|
|
configs = _precompiler_product_config
|
|
snapshot = false
|
|
compiler = true
|
|
is_product = true
|
|
},
|
|
{
|
|
suffix = "_precompiler_fuchsia"
|
|
configs = _precompiler_fuchsia_config
|
|
snapshot = false
|
|
compiler = true
|
|
is_product = false
|
|
},
|
|
{
|
|
suffix = "_precompiler_product_fuchsia"
|
|
configs = _precompiler_product_fuchsia_config
|
|
snapshot = false
|
|
compiler = true
|
|
is_product = true
|
|
},
|
|
{
|
|
suffix = "_precompiler_host_targeting_host"
|
|
configs = _precompiler_host_targeting_host_config
|
|
snapshot = false
|
|
compiler = true
|
|
is_product = false
|
|
},
|
|
{
|
|
suffix = "_precompiler_product_host_targeting_host"
|
|
configs = _precompiler_product_host_targeting_host_config
|
|
snapshot = false
|
|
compiler = true
|
|
is_product = true
|
|
},
|
|
{
|
|
suffix = "_libfuzzer"
|
|
configs = _libfuzzer_config
|
|
snapshot = true
|
|
compiler = true
|
|
is_product = false
|
|
},
|
|
]
|
|
|
|
# This template creates a target for each of the configurations listed above.
|
|
# For example:
|
|
#
|
|
# library_for_all_configs("libfoo") {
|
|
# target_type = "source_set"
|
|
# sources = [ "foo.c" ]
|
|
# configurable_deps [ ":libbar" ]
|
|
# }
|
|
#
|
|
# will make a source_set target for libfoo_jit, libfoo_jit_product, etc. that
|
|
# depends on libbar_jit, libbar_jit_product etc. respectively.
|
|
#
|
|
# Parameters
|
|
#
|
|
# target_type (required):
|
|
# The target declaration or template to repeat for each configuration.
|
|
#
|
|
# configurable_deps (optional):
|
|
# Dependencies of this target, which are themselves generated by
|
|
# library_for_all_configs(). The listed dependencies will be suffixed with
|
|
# a string that matches the configuration.
|
|
#
|
|
# extra_deps (optional):
|
|
# Regular additional deps that don't receive special treatment.
|
|
#
|
|
# extra_configs (optional):
|
|
# Any configs needed in addition to the ones above.
|
|
#
|
|
# snapshot_sources (optional):
|
|
# Additional sources to include when the configuration has a snapshot.
|
|
#
|
|
template("library_for_all_configs") {
|
|
assert(defined(invoker.target_type))
|
|
extra_configs = []
|
|
if (defined(invoker.extra_configs)) {
|
|
extra_configs += invoker.extra_configs
|
|
}
|
|
configurable_deps = []
|
|
if (defined(invoker.configurable_deps)) {
|
|
configurable_deps += invoker.configurable_deps
|
|
}
|
|
extra_deps = []
|
|
if (defined(invoker.extra_deps)) {
|
|
extra_deps += invoker.extra_deps
|
|
}
|
|
extra_product_deps = []
|
|
if (defined(invoker.extra_product_deps)) {
|
|
extra_product_deps += invoker.extra_product_deps
|
|
}
|
|
extra_nonproduct_deps = []
|
|
if (defined(invoker.extra_nonproduct_deps)) {
|
|
extra_nonproduct_deps += invoker.extra_nonproduct_deps
|
|
}
|
|
foreach(conf, _all_configs) {
|
|
target(invoker.target_type, "${target_name}${conf.suffix}") {
|
|
forward_variables_from(invoker,
|
|
"*",
|
|
[
|
|
"extra_configs",
|
|
"extra_deps",
|
|
"configurable_deps",
|
|
])
|
|
configs += conf.configs + extra_configs
|
|
configured_deps = []
|
|
foreach(dep, configurable_deps) {
|
|
configured_deps += [ "${dep}${conf.suffix}" ]
|
|
}
|
|
if (defined(compiler_lib)) {
|
|
if (conf.compiler) {
|
|
configured_deps += [ "${compiler_lib}${conf.suffix}" ]
|
|
} else {
|
|
not_needed([ "compiler_lib" ])
|
|
}
|
|
}
|
|
deps = configured_deps + extra_deps
|
|
if (conf.is_product) {
|
|
deps += extra_product_deps
|
|
} else {
|
|
deps += extra_nonproduct_deps
|
|
}
|
|
if (conf.snapshot) {
|
|
if (defined(snapshot_sources)) {
|
|
sources += snapshot_sources
|
|
}
|
|
} else {
|
|
if (defined(snapshot_sources)) {
|
|
not_needed([ "snapshot_sources" ])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
template("library_for_all_configs_with_compiler") {
|
|
assert(defined(invoker.target_type))
|
|
extra_configs = []
|
|
if (defined(invoker.extra_configs)) {
|
|
extra_configs += invoker.extra_configs
|
|
}
|
|
configurable_deps = []
|
|
if (defined(invoker.configurable_deps)) {
|
|
configurable_deps += invoker.configurable_deps
|
|
}
|
|
extra_deps = []
|
|
if (defined(invoker.extra_deps)) {
|
|
extra_deps += invoker.extra_deps
|
|
}
|
|
foreach(conf, _all_configs) {
|
|
if (conf.compiler) {
|
|
target(invoker.target_type, "${target_name}${conf.suffix}") {
|
|
forward_variables_from(invoker,
|
|
"*",
|
|
[
|
|
"extra_configs",
|
|
"extra_deps",
|
|
"configurable_deps",
|
|
])
|
|
configs += conf.configs + extra_configs
|
|
configured_deps = []
|
|
foreach(dep, configurable_deps) {
|
|
configured_deps += [ "${dep}${conf.suffix}" ]
|
|
}
|
|
deps = configured_deps + extra_deps
|
|
if (conf.snapshot) {
|
|
if (defined(snapshot_sources)) {
|
|
sources += snapshot_sources
|
|
}
|
|
} else {
|
|
if (defined(snapshot_sources)) {
|
|
not_needed([ "snapshot_sources" ])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|