2014-11-11 22:03:55 +00:00
|
|
|
# Copyright (c) 2014, 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.
|
|
|
|
|
2019-12-19 23:12:53 +00:00
|
|
|
import("../sdk_args.gni")
|
2018-05-14 15:26:37 +00:00
|
|
|
import("configs.gni")
|
2017-01-30 17:55:20 +00:00
|
|
|
import("runtime_args.gni")
|
|
|
|
|
2023-01-19 10:36:51 +00:00
|
|
|
import("//build/config/sysroot.gni")
|
|
|
|
|
2019-05-07 00:43:33 +00:00
|
|
|
if (is_fuchsia) {
|
|
|
|
import("//build/fuchsia/sdk.gni")
|
|
|
|
}
|
|
|
|
|
2015-09-25 19:41:03 +00:00
|
|
|
config("dart_public_config") {
|
2018-11-26 16:30:33 +00:00
|
|
|
include_dirs = [
|
|
|
|
".",
|
|
|
|
"include",
|
|
|
|
]
|
2015-09-25 19:41:03 +00:00
|
|
|
}
|
|
|
|
|
2016-09-23 14:47:36 +00:00
|
|
|
# Adds PRODUCT define if Flutter has specified "release" for dart_runtime_mode
|
|
|
|
config("dart_maybe_product_config") {
|
2014-11-11 22:59:00 +00:00
|
|
|
defines = []
|
2015-10-22 19:26:41 +00:00
|
|
|
|
2016-10-26 15:50:54 +00:00
|
|
|
if (dart_runtime_mode != "develop" && dart_runtime_mode != "profile" &&
|
|
|
|
dart_runtime_mode != "release") {
|
2016-04-22 14:00:03 +00:00
|
|
|
print("Invalid |dart_runtime_mode|")
|
|
|
|
assert(false)
|
2014-11-11 22:59:00 +00:00
|
|
|
}
|
|
|
|
|
2016-04-22 14:00:03 +00:00
|
|
|
if (dart_runtime_mode == "release") {
|
2016-04-13 19:55:16 +00:00
|
|
|
if (dart_debug) {
|
2016-04-22 14:00:03 +00:00
|
|
|
print("Debug and release mode are mutually exclusive.")
|
2016-04-13 19:55:16 +00:00
|
|
|
}
|
|
|
|
assert(!dart_debug)
|
2016-10-26 15:50:54 +00:00
|
|
|
defines += [ "PRODUCT" ]
|
2016-04-13 19:55:16 +00:00
|
|
|
}
|
2016-04-22 14:00:03 +00:00
|
|
|
}
|
2016-04-13 19:55:16 +00:00
|
|
|
|
2017-07-16 04:43:47 +00:00
|
|
|
# This is a config to use to build PRODUCT mode artifacts in a RELEASE build.
|
|
|
|
# If a DEBUG build has been specified it will be ignored.
|
|
|
|
config("dart_product_config") {
|
|
|
|
defines = []
|
2020-06-17 16:12:26 +00:00
|
|
|
cflags = []
|
2017-07-16 04:43:47 +00:00
|
|
|
if (!dart_debug) {
|
|
|
|
defines += [ "PRODUCT" ]
|
2020-06-17 16:12:26 +00:00
|
|
|
if (is_posix) {
|
|
|
|
cflags = [
|
|
|
|
# This is the equivalent from `build/config/BUILDCONFIG.gn` which includes
|
|
|
|
# `build/config/gcc:symbol_visibility_hidden` in product mode.
|
|
|
|
"-fvisibility=hidden",
|
|
|
|
]
|
|
|
|
}
|
2017-07-16 04:43:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-23 14:47:36 +00:00
|
|
|
config("dart_precompiled_runtime_config") {
|
|
|
|
defines = []
|
2018-05-23 20:35:53 +00:00
|
|
|
defines += [
|
|
|
|
"DART_PRECOMPILED_RUNTIME",
|
|
|
|
"EXCLUDE_CFE_AND_KERNEL_PLATFORM",
|
|
|
|
]
|
2016-09-23 14:47:36 +00:00
|
|
|
}
|
|
|
|
|
[build] Re-add linker flags to create empty section in AOT runtime.
To avoid these flags being applied to unexpected build rules, we
separate them out into a separate config that is then pulled in
explicitly in the `dart_precompiled_runtime{,_product}` executable
rules. Only those two executables need the additional empty section:
the product version because it becomes `dartaotruntime` in the SDK
bundle, and the non-product version because some of our tests build
standalone executables using it.
The linker flags were originally removed due to
https://github.com/flutter/flutter/issues/112687.
With the recent removal of bitcode support from Flutter (see
https://github.com/flutter/flutter/issues/107883), I can build
the `ios_release` target locally without any issue.
This also reverts the clang DEPS changes from CL 256208 (again).
TEST=pkg/dartdev/test/commands/compile_test
Bug: https://github.com/dart-lang/sdk/issues/49783
Cq-Include-Trybots: luci.dart.try:analyzer-mac-release-try,dart-sdk-mac-arm64-try,dart-sdk-mac-try,pkg-mac-release-arm64-try,pkg-mac-release-try,vm-kernel-precomp-mac-product-x64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try
Change-Id: Ie46402ec2eeda23109247eb9d7a64935ec2052cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262429
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2022-10-07 09:26:18 +00:00
|
|
|
config("add_empty_macho_section_config") {
|
|
|
|
if (is_mac) {
|
|
|
|
# We create an empty __space_for_note section in a __CUSTOM segment to
|
|
|
|
# reserve the header space needed for inserting a snapshot into the
|
|
|
|
# executable when creating standalone executables. This segment and section
|
|
|
|
# is removed in standalone executables, replaced with a note that points to
|
|
|
|
# the snapshot in the file.
|
|
|
|
#
|
|
|
|
# (A segment load command with a single section is 132 bytes in 32-bit
|
|
|
|
# executables and 152 bytes in 64-bit ones, and a note load command is
|
|
|
|
# always 40 bytes.)
|
|
|
|
#
|
|
|
|
# Keep this in sync with the constants reservedSegmentName and
|
|
|
|
# reservedSectionName in pkg/dart2native/lib/macho_utils.dart.
|
|
|
|
ldflags = [ "-Wl,-add_empty_section,__CUSTOM,__space_for_note" ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-22 14:00:03 +00:00
|
|
|
# Controls DART_PRECOMPILER #define.
|
|
|
|
config("dart_precompiler_config") {
|
|
|
|
defines = []
|
2016-10-26 15:50:54 +00:00
|
|
|
defines += [ "DART_PRECOMPILER" ]
|
2023-01-04 18:14:56 +00:00
|
|
|
if (is_clang) {
|
|
|
|
cflags = [ "-fno-omit-frame-pointer" ]
|
|
|
|
}
|
2016-04-22 14:00:03 +00:00
|
|
|
}
|
|
|
|
|
2017-10-31 17:33:13 +00:00
|
|
|
config("dart_os_config") {
|
2016-02-25 21:44:28 +00:00
|
|
|
defines = []
|
|
|
|
|
2019-09-27 21:14:11 +00:00
|
|
|
if (target_os == "android") {
|
2021-07-02 19:06:45 +00:00
|
|
|
defines += [ "DART_TARGET_OS_ANDROID" ]
|
2019-09-27 21:14:11 +00:00
|
|
|
} else if (target_os == "fuchsia") {
|
2021-07-02 19:06:45 +00:00
|
|
|
defines += [ "DART_TARGET_OS_FUCHSIA" ]
|
2019-09-27 21:14:11 +00:00
|
|
|
} else if (target_os == "ios") {
|
2021-07-02 19:06:45 +00:00
|
|
|
defines += [ "DART_TARGET_OS_MACOS" ]
|
|
|
|
defines += [ "DART_TARGET_OS_MACOS_IOS" ]
|
2019-09-27 21:14:11 +00:00
|
|
|
} else if (target_os == "linux") {
|
2021-07-02 19:06:45 +00:00
|
|
|
defines += [ "DART_TARGET_OS_LINUX" ]
|
2019-09-27 21:14:11 +00:00
|
|
|
} else if (target_os == "mac") {
|
2021-07-02 19:06:45 +00:00
|
|
|
defines += [ "DART_TARGET_OS_MACOS" ]
|
2019-09-27 21:14:11 +00:00
|
|
|
} else if (target_os == "win") {
|
2021-07-02 19:06:45 +00:00
|
|
|
defines += [ "DART_TARGET_OS_WINDOWS" ]
|
2020-12-04 22:46:12 +00:00
|
|
|
} else if (target_os == "winuwp") {
|
|
|
|
defines += [
|
2021-07-02 19:06:45 +00:00
|
|
|
"DART_TARGET_OS_WINDOWS",
|
|
|
|
"DART_TARGET_OS_WINDOWS_UWP",
|
2020-12-04 22:46:12 +00:00
|
|
|
]
|
2019-09-27 21:14:11 +00:00
|
|
|
} else {
|
|
|
|
print("Unknown target_os: $target_os")
|
|
|
|
assert(false)
|
2017-06-21 22:19:17 +00:00
|
|
|
}
|
2017-10-31 17:33:13 +00:00
|
|
|
}
|
|
|
|
|
2018-03-28 19:39:49 +00:00
|
|
|
# We need to build gen_snapshot targeting Fuchsia during a build of the SDK
|
|
|
|
# targeting Mac and Linux. This configuration is used to unconditionally target
|
|
|
|
# Fuchsia. It should not be combined with dart_os_config.
|
|
|
|
config("dart_os_fuchsia_config") {
|
2021-07-02 19:06:45 +00:00
|
|
|
defines = [ "DART_TARGET_OS_FUCHSIA" ]
|
2018-03-28 19:39:49 +00:00
|
|
|
}
|
|
|
|
|
2017-10-31 17:33:13 +00:00
|
|
|
config("dart_arch_config") {
|
|
|
|
defines = []
|
2017-06-21 22:19:17 +00:00
|
|
|
|
2019-09-27 21:14:11 +00:00
|
|
|
if (dart_target_arch == "arm") {
|
|
|
|
defines += [ "TARGET_ARCH_ARM" ]
|
|
|
|
} else if (dart_target_arch == "arm64") {
|
|
|
|
defines += [ "TARGET_ARCH_ARM64" ]
|
|
|
|
} else if (dart_target_arch == "x64") {
|
|
|
|
defines += [ "TARGET_ARCH_X64" ]
|
|
|
|
} else if (dart_target_arch == "ia32" || dart_target_arch == "x86") {
|
|
|
|
defines += [ "TARGET_ARCH_IA32" ]
|
[vm] Support RISC-V.
Implements a backend targeting RV32GC and RV64GC, based on Linux standardizing around GC. The assembler is written to make it easy to disable usage of C, but because the sizes of some instruction sequences are compile-time constants, an additional build configuration would need to be defined to make use of it.
The assembler and disassembler cover every RV32/64GC instruction. The simulator covers all instructions except accessing CSRs and the floating point state accessible through such, include accrued exceptions and dynamic rounding mode.
Quirks:
- RISC-V is a compare-and-branch architecture, but some existing "architecture-independent" parts of the Dart compiler assume a condition code architecture. To avoid rewriting these parts, we use a peephole in the assembler to map to compare-and-branch. See Assembler::BranchIf. Luckily nothing depended on taking multiple branches on the same condition code set.
- There are no hardware overflow checks, so we must use Hacker's Delight style software checks. Often these are very cheap: if the sign of one operand is known, a single branch is needed.
- The ranges of RISC-V branches and jumps are such that we use 3 levels of generation for forward branches, instead of the 2 levels of near and far branches used on ARM[64]. Nearly all code is handled by the first two levels with 20-bits of range, with enormous regex matchers triggering the third level that uses aupic+jalr to get 32-bits of range.
- For PC-relative calls in AOT, we always generate auipc+jalr pairs with 32-bits of range, so we never generate trampolines.
- Only a subset of registers are available in some compressed instructions, so we assign the most popular uses to these registers. In particular, THR, TMP[2], CODE and PP. This has the effect of assigning CODE and PP to volatile registers in the C calling convention, whereas they are assigned preserved registers on the other architectures. As on ARM64, PP is untagged; this is so short indices can be accessed with a compressed instruction.
- There are no push or pop instructions, so combining pushes and pops is preferred so we can update SP once.
- The C calling convention has a strongly aligned stack, but unlike on ARM64 we don't need to use an alternate stack pointer. The author ensured language was added to the RISC-V psABI making the OS responsible for realigning the stack pointer for signal handlers, allowing Dart to leave the stack pointer misaligned from the C calling convention's point of view until a foreign call.
- We don't bother with the link register tracking done on ARM[64]. Instead we make use of an alternate link register to avoid inline spilling in the write barrier.
Unimplemented:
- non-trivial FFI cases
- Compressed pointers - No intention to implement.
- Unboxed SIMD - We might make use of the V extension registers when the V extension is ratified.
- BigInt intrinsics
TEST=existing tests for IL level, new tests for assembler/disassembler/simulator
Bug: https://github.com/dart-lang/sdk/issues/38587
Bug: https://github.com/dart-lang/sdk/issues/48164
Change-Id: I991d1df4be5bf55efec5371b767b332d37dfa3e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217289
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-01-20 00:57:57 +00:00
|
|
|
} else if (dart_target_arch == "riscv32") {
|
|
|
|
defines += [ "TARGET_ARCH_RISCV32" ]
|
|
|
|
} else if (dart_target_arch == "riscv64") {
|
|
|
|
defines += [ "TARGET_ARCH_RISCV64" ]
|
2019-09-27 21:14:11 +00:00
|
|
|
} else {
|
|
|
|
print("Invalid dart_target_arch: $dart_target_arch")
|
|
|
|
assert(false)
|
2016-02-25 21:44:28 +00:00
|
|
|
}
|
2017-10-31 17:33:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
config("dart_config") {
|
|
|
|
defines = []
|
2016-02-25 21:44:28 +00:00
|
|
|
|
|
|
|
if (dart_debug) {
|
2016-10-26 15:50:54 +00:00
|
|
|
defines += [ "DEBUG" ]
|
2016-02-25 21:44:28 +00:00
|
|
|
} else {
|
2016-10-26 15:50:54 +00:00
|
|
|
defines += [ "NDEBUG" ]
|
2016-02-25 21:44:28 +00:00
|
|
|
}
|
|
|
|
|
2018-11-15 23:19:38 +00:00
|
|
|
include_dirs = [ "include" ]
|
2017-01-30 17:55:20 +00:00
|
|
|
if (dart_use_tcmalloc) {
|
|
|
|
defines += [ "DART_USE_TCMALLOC" ]
|
|
|
|
include_dirs += [ "../third_party/tcmalloc/gperftools/src" ]
|
|
|
|
}
|
2021-12-08 00:25:10 +00:00
|
|
|
if (dart_use_mallinfo2) {
|
|
|
|
defines += [ "DART_USE_MALLINFO2" ]
|
|
|
|
}
|
2017-01-30 17:55:20 +00:00
|
|
|
|
2021-01-28 23:15:15 +00:00
|
|
|
if (dart_use_compressed_pointers) {
|
|
|
|
defines += [ "DART_COMPRESSED_POINTERS" ]
|
|
|
|
}
|
|
|
|
|
2017-05-21 06:30:06 +00:00
|
|
|
if (is_fuchsia) {
|
2020-06-18 00:24:31 +00:00
|
|
|
if (using_fuchsia_gn_sdk) {
|
2020-06-24 20:35:19 +00:00
|
|
|
lib_dirs = [ root_out_dir + "/lib" ]
|
2020-06-18 00:24:31 +00:00
|
|
|
}
|
|
|
|
if (using_fuchsia_gn_sdk || using_fuchsia_sdk) {
|
2019-05-07 00:43:33 +00:00
|
|
|
# TODO(chinmaygarde): Currenty these targets need to be build in the
|
|
|
|
# Fuchsia tree as well as outside it using the SDK. However, not all
|
|
|
|
# Fuchsia features are available in the SDK. As these features are added,
|
|
|
|
# the guards can be removed. Eventually, only SDK builds will be present.
|
|
|
|
# Then, this flag can be removed completely.
|
|
|
|
defines += [ "FUCHSIA_SDK" ]
|
|
|
|
} else {
|
|
|
|
include_dirs += [ "//zircon/system/ulib/zx/include" ]
|
|
|
|
}
|
2017-04-19 22:50:59 +00:00
|
|
|
}
|
|
|
|
|
2021-06-28 15:57:52 +00:00
|
|
|
# Below are flags copied from ../build/config/compiler/BUILD.gn that should
|
|
|
|
# be preserved even when the Dart VM and runtime are compiled out-of-tree,
|
|
|
|
# for example in the Flutter Engine build. They ensure that the Dart VM
|
|
|
|
# and runtime are compiled with optimizations unless explicitly requested
|
|
|
|
# otherwise with the `dart_debug` and `dart_debug_optimization_level`
|
|
|
|
# flags.
|
|
|
|
if (is_win) {
|
|
|
|
if (dart_debug) {
|
2022-03-14 11:23:48 +00:00
|
|
|
if (is_clang && dart_debug_optimization_level != "2") {
|
|
|
|
cflags = [
|
|
|
|
"-d${dart_debug_optimization_level}",
|
|
|
|
"/Oy-",
|
|
|
|
]
|
|
|
|
} else {
|
|
|
|
cflags = [
|
|
|
|
"/O${dart_debug_optimization_level}",
|
|
|
|
"/Oy-",
|
|
|
|
]
|
|
|
|
}
|
2021-06-28 15:57:52 +00:00
|
|
|
} else {
|
|
|
|
cflags = [
|
|
|
|
"/O2",
|
|
|
|
"/Ob2",
|
|
|
|
"/Oy-",
|
|
|
|
"/Oi",
|
|
|
|
"/Gw",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
} else {
|
2016-10-04 16:19:07 +00:00
|
|
|
cflags = [
|
|
|
|
"-Wno-unused-parameter",
|
2019-03-23 00:52:41 +00:00
|
|
|
"-Wno-unused-private-field",
|
2016-10-04 16:19:07 +00:00
|
|
|
"-Wnon-virtual-dtor",
|
|
|
|
"-Wvla",
|
|
|
|
"-Woverloaded-virtual",
|
2018-09-17 22:27:43 +00:00
|
|
|
"-Wno-comments", # Conflicts with clang-format.
|
2016-10-04 16:19:07 +00:00
|
|
|
"-g3",
|
|
|
|
"-ggdb3",
|
|
|
|
"-fno-rtti",
|
|
|
|
"-fno-exceptions",
|
2016-02-25 21:44:28 +00:00
|
|
|
]
|
2020-05-16 00:26:32 +00:00
|
|
|
if (is_clang) {
|
2022-03-30 17:34:20 +00:00
|
|
|
cflags += [
|
|
|
|
"-Wimplicit-fallthrough",
|
|
|
|
"-fno-strict-vtable-pointers", # Handle assignment updates vtable
|
|
|
|
# pointers.
|
|
|
|
]
|
2020-05-16 00:26:32 +00:00
|
|
|
} else {
|
2019-10-17 16:51:32 +00:00
|
|
|
cflags += [ "-Wno-cast-function-type" ]
|
|
|
|
}
|
2016-02-25 21:44:28 +00:00
|
|
|
|
2018-10-16 22:11:05 +00:00
|
|
|
ldflags = []
|
|
|
|
if (is_clang && dart_vm_code_coverage) {
|
|
|
|
cflags += [
|
|
|
|
"-O0",
|
|
|
|
"-fprofile-arcs",
|
|
|
|
"-ftest-coverage",
|
|
|
|
]
|
|
|
|
ldflags += [ "--coverage" ]
|
|
|
|
} else if (dart_debug) {
|
2017-01-24 16:36:37 +00:00
|
|
|
cflags += [ "-O${dart_debug_optimization_level}" ]
|
2016-10-04 16:19:07 +00:00
|
|
|
} else {
|
2023-01-24 00:54:29 +00:00
|
|
|
cflags += [ "-O2" ]
|
2016-10-04 16:19:07 +00:00
|
|
|
}
|
|
|
|
|
2019-01-09 02:56:22 +00:00
|
|
|
if (is_fuchsia) {
|
|
|
|
# safe-stack does not work with the interpreter.
|
2021-08-11 01:14:22 +00:00
|
|
|
cflags += [
|
|
|
|
"-fno-sanitize=safe-stack",
|
|
|
|
"-Wno-deprecated-copy",
|
|
|
|
]
|
2019-01-09 02:56:22 +00:00
|
|
|
}
|
2016-02-25 21:44:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
[vm/ffi] `FfiNative` process lookup
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>
2022-10-25 10:57:07 +00:00
|
|
|
config("dart_testing_config") {
|
|
|
|
defines = [ "TESTING" ]
|
|
|
|
}
|
|
|
|
|
2018-09-25 23:58:57 +00:00
|
|
|
config("dart_shared_lib") {
|
|
|
|
if (dart_lib_export_symbols) {
|
|
|
|
defines = [ "DART_SHARED_LIB" ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-25 21:29:42 +00:00
|
|
|
config("dart_libfuzzer_config") {
|
|
|
|
defines = [ "FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION" ]
|
|
|
|
cflags = [ "-fsanitize=address,fuzzer-no-link" ]
|
|
|
|
ldflags = [ "-fsanitize=address,fuzzer" ]
|
|
|
|
}
|
|
|
|
|
2017-04-10 20:44:21 +00:00
|
|
|
source_set("dart_api") {
|
|
|
|
public_configs = [ ":dart_public_config" ]
|
|
|
|
sources = [
|
2022-03-09 14:17:44 +00:00
|
|
|
"include/analyze_snapshot_api.h",
|
2017-04-10 20:44:21 +00:00
|
|
|
"include/dart_api.h",
|
2020-09-25 15:16:14 +00:00
|
|
|
"include/dart_api_dl.c",
|
[vm/ffi] Expose a subset of dart_(native_)api.h for dynamic linking.
This CL introduces dart_api_dl.h which exposes a subset of dart_api.h
and dart_native_api.h for dynamic linking at runtime through the FFI.
Dynamic linking is done through including dart_api_dl.cc in a shared
library and passing NativeApi.initializeApiDLData to the init function.
This CL also includes Native API versioning to deal with possible
version skew between native api version against which native libraries
are compiled and the version in the DartVM the code is run on.
The subset of symbols in the CL includes handle related symbols, error
related symbols, handle scope symbols, and native port sumbols.
Design: http://go/dart-ffi-expose-dart-api
Closes: https://github.com/dart-lang/sdk/issues/40607
Closes: https://github.com/dart-lang/sdk/issues/36858
Closes: https://github.com/dart-lang/sdk/issues/41319
Closes: https://github.com/flutter/flutter/issues/46887
Closes: https://github.com/flutter/flutter/issues/47061
Misc:
Closes: https://github.com/dart-lang/sdk/issues/42260
Change-Id: I9e557808dbc99b341f23964cbddbb05f26d7a6c5
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-mac-debug-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-nnbd-linux-debug-x64-try,analyzer-nnbd-linux-release-try,front-end-nnbd-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145592
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-06-18 07:30:43 +00:00
|
|
|
"include/dart_api_dl.h",
|
2017-04-10 20:44:21 +00:00
|
|
|
"include/dart_native_api.h",
|
|
|
|
"include/dart_tools_api.h",
|
[vm/ffi] Expose a subset of dart_(native_)api.h for dynamic linking.
This CL introduces dart_api_dl.h which exposes a subset of dart_api.h
and dart_native_api.h for dynamic linking at runtime through the FFI.
Dynamic linking is done through including dart_api_dl.cc in a shared
library and passing NativeApi.initializeApiDLData to the init function.
This CL also includes Native API versioning to deal with possible
version skew between native api version against which native libraries
are compiled and the version in the DartVM the code is run on.
The subset of symbols in the CL includes handle related symbols, error
related symbols, handle scope symbols, and native port sumbols.
Design: http://go/dart-ffi-expose-dart-api
Closes: https://github.com/dart-lang/sdk/issues/40607
Closes: https://github.com/dart-lang/sdk/issues/36858
Closes: https://github.com/dart-lang/sdk/issues/41319
Closes: https://github.com/flutter/flutter/issues/46887
Closes: https://github.com/flutter/flutter/issues/47061
Misc:
Closes: https://github.com/dart-lang/sdk/issues/42260
Change-Id: I9e557808dbc99b341f23964cbddbb05f26d7a6c5
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-mac-debug-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-nnbd-linux-debug-x64-try,analyzer-nnbd-linux-release-try,front-end-nnbd-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145592
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-06-18 07:30:43 +00:00
|
|
|
"include/dart_version.h",
|
|
|
|
"include/internal/dart_api_dl_impl.h",
|
2017-04-10 20:44:21 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2018-05-14 15:26:37 +00:00
|
|
|
library_for_all_configs("libdart") {
|
|
|
|
target_type = dart_component_kind
|
2017-07-16 04:43:47 +00:00
|
|
|
extra_deps = [
|
2018-05-14 15:26:37 +00:00
|
|
|
":generate_version_cc_file",
|
2020-03-10 21:56:11 +00:00
|
|
|
"third_party/double-conversion/src:libdouble_conversion",
|
2017-07-16 04:43:47 +00:00
|
|
|
]
|
2019-03-01 18:05:40 +00:00
|
|
|
if (is_fuchsia) {
|
2020-06-18 00:24:31 +00:00
|
|
|
if (using_fuchsia_gn_sdk) {
|
|
|
|
extra_deps += [
|
2020-07-10 18:10:05 +00:00
|
|
|
"$fuchsia_sdk_root/build/config:runtime_library_group",
|
2020-06-18 00:24:31 +00:00
|
|
|
"$fuchsia_sdk_root/pkg/fdio",
|
|
|
|
"$fuchsia_sdk_root/pkg/trace-engine",
|
2020-08-26 03:46:33 +00:00
|
|
|
"//build/fuchsia/config/clang:c++-runtime-deps",
|
2020-06-18 00:24:31 +00:00
|
|
|
]
|
|
|
|
} else if (using_fuchsia_sdk) {
|
2019-10-18 01:33:03 +00:00
|
|
|
extra_deps += [
|
|
|
|
"$fuchsia_sdk_root/pkg:fdio",
|
|
|
|
"$fuchsia_sdk_root/pkg:trace-engine",
|
|
|
|
]
|
2019-05-07 00:43:33 +00:00
|
|
|
} else {
|
|
|
|
extra_deps += [
|
|
|
|
"//zircon/public/lib/fbl",
|
2020-05-16 00:04:22 +00:00
|
|
|
"//zircon/system/ulib/trace-engine",
|
2019-05-07 00:43:33 +00:00
|
|
|
]
|
|
|
|
}
|
2019-03-01 18:05:40 +00:00
|
|
|
}
|
2018-05-14 15:26:37 +00:00
|
|
|
configurable_deps = [
|
2017-08-15 04:54:34 +00:00
|
|
|
"platform:libdart_platform",
|
2018-05-14 15:26:37 +00:00
|
|
|
"vm:libdart_lib",
|
|
|
|
"vm:libdart_vm",
|
2017-03-29 17:12:00 +00:00
|
|
|
]
|
2020-04-16 22:59:03 +00:00
|
|
|
compiler_lib = "vm:libdart_compiler"
|
2018-09-25 23:58:57 +00:00
|
|
|
extra_configs = [ ":dart_shared_lib" ]
|
2018-05-14 15:26:37 +00:00
|
|
|
include_dirs = [ "." ]
|
|
|
|
public_configs = [ ":dart_public_config" ]
|
|
|
|
sources = [
|
|
|
|
"$target_gen_dir/version.cc",
|
2022-03-09 14:17:44 +00:00
|
|
|
"include/analyze_snapshot_api.h",
|
2018-05-14 15:26:37 +00:00
|
|
|
"include/dart_api.h",
|
|
|
|
"include/dart_native_api.h",
|
|
|
|
"include/dart_tools_api.h",
|
2022-03-09 14:17:44 +00:00
|
|
|
"vm/analyze_snapshot_api_impl.cc",
|
2018-05-14 15:26:37 +00:00
|
|
|
"vm/dart_api_impl.cc",
|
|
|
|
"vm/native_api_impl.cc",
|
|
|
|
"vm/version.h",
|
2017-07-16 04:43:47 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2014-11-11 22:03:55 +00:00
|
|
|
action("generate_version_cc_file") {
|
|
|
|
inputs = [
|
|
|
|
"../tools/utils.py",
|
|
|
|
"../tools/VERSION",
|
|
|
|
"vm/version_in.cc",
|
|
|
|
]
|
2018-06-11 18:22:09 +00:00
|
|
|
if (dart_version_git_info) {
|
2019-12-19 23:12:53 +00:00
|
|
|
inputs += [ "$default_git_folder/logs/HEAD" ]
|
2018-06-11 18:22:09 +00:00
|
|
|
}
|
2014-11-11 22:03:55 +00:00
|
|
|
output = "$target_gen_dir/version.cc"
|
2020-03-10 21:56:11 +00:00
|
|
|
outputs = [ output ]
|
2014-11-11 22:03:55 +00:00
|
|
|
|
|
|
|
script = "../tools/make_version.py"
|
|
|
|
args = [
|
2015-01-21 15:18:23 +00:00
|
|
|
"--quiet",
|
2016-10-26 15:50:54 +00:00
|
|
|
"--output",
|
|
|
|
rebase_path(output, root_build_dir),
|
|
|
|
"--input",
|
|
|
|
rebase_path("vm/version_in.cc", root_build_dir),
|
2014-11-11 22:03:55 +00:00
|
|
|
]
|
2018-01-08 16:15:22 +00:00
|
|
|
if (!dart_version_git_info) {
|
2018-02-16 20:44:48 +00:00
|
|
|
args += [ "--no_git_hash" ]
|
|
|
|
}
|
2020-09-03 10:00:24 +00:00
|
|
|
if (!verify_sdk_hash) {
|
|
|
|
args += [ "--no_sdk_hash" ]
|
|
|
|
}
|
2014-11-11 22:03:55 +00:00
|
|
|
}
|