f0940a6390
This is a reland of 40d66d8bf8
The fix disambiguates duplicate symbols in the generated embedded
builtins file.
Original change's description:
> [build] Make separate snapshot for trusted variant
>
> This enables side-by-side snapshots with and without untrusted-code
> mitigations. It'll be the default in all V8 stand-alone builds
> with external startup data. Internal snapshots are not supported.
>
> The files snapshot_blob.bin and snapshot_blob_trusted.bin will be
> bundled with V8 on swarming and the correct file is loaded dependent
> on the --untrusted-code-mitigations runtime flag.
>
> Likewise we embed two snapshots for builtins.
>
> Side-by-side snapshots won't be supported in Chromium.
>
> Bug: v8:7441
> Change-Id: I2949ddfd5773649946b1c8e74751d48ad1d9c524
> Reviewed-on: https://chromium-review.googlesource.com/960004
> Commit-Queue: Michael Achenbach <machenbach@chromium.org>
> Reviewed-by: Jakob Gruber <jgruber@chromium.org>
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#52028}
Bug: v8:7441
Change-Id: I626171d4e07389f0453b4d0a698e2772fd37e8c5
Reviewed-on: https://chromium-review.googlesource.com/968623
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52055}
205 lines
6.4 KiB
Plaintext
205 lines
6.4 KiB
Plaintext
# Copyright 2016 the V8 project authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
import("//build/config/jumbo.gni")
|
|
import("//build/config/sanitizers/sanitizers.gni")
|
|
import("//build/config/v8_target_cpu.gni")
|
|
import("//build/split_static_library.gni")
|
|
|
|
declare_args() {
|
|
# Set flags for tracking code coverage. Uses gcov with gcc and sanitizer
|
|
# coverage with clang.
|
|
v8_code_coverage = false
|
|
|
|
# Includes files needed for correctness fuzzing.
|
|
v8_correctness_fuzzer = false
|
|
|
|
# Adds additional compile target for building multiple architectures at once.
|
|
v8_multi_arch_build = false
|
|
|
|
# Indicate if valgrind was fetched as a custom deps to make it available on
|
|
# swarming.
|
|
v8_has_valgrind = false
|
|
|
|
# Indicate if gcmole was fetched as a hook to make it available on swarming.
|
|
v8_gcmole = false
|
|
|
|
# Turns on compiler optimizations in V8 in Debug build.
|
|
v8_optimized_debug = true
|
|
|
|
# Support for backtrace_symbols on linux.
|
|
v8_enable_backtrace = ""
|
|
|
|
# Enable the snapshot feature, for fast context creation.
|
|
# http://v8project.blogspot.com/2015/09/custom-startup-snapshots.html
|
|
# TODO(thakis): Make snapshots work in 64-bit win/cross builds,
|
|
# https://803591
|
|
v8_use_snapshot = !(is_win && host_os != "win" && target_cpu == "x64")
|
|
|
|
# Enable several snapshots side-by-side (e.g. default and for trusted code).
|
|
v8_use_multi_snapshots = ""
|
|
|
|
# Use external files for startup data blobs:
|
|
# the JS builtins sources and the start snapshot.
|
|
v8_use_external_startup_data = ""
|
|
|
|
# Enable ECMAScript Internationalization API. Enabling this feature will
|
|
# add a dependency on the ICU library.
|
|
v8_enable_i18n_support = true
|
|
|
|
# Use static libraries instead of source_sets.
|
|
v8_static_library = false
|
|
|
|
# Enable monolithic static library for embedders.
|
|
v8_monolithic = false
|
|
}
|
|
|
|
if (v8_use_external_startup_data == "") {
|
|
# If not specified as a gn arg, use external startup data by default if
|
|
# a snapshot is used and if we're not on ios.
|
|
v8_use_external_startup_data = v8_use_snapshot && !is_ios
|
|
}
|
|
|
|
if (v8_use_multi_snapshots == "") {
|
|
v8_use_multi_snapshots = v8_use_external_startup_data && !build_with_chromium
|
|
}
|
|
|
|
if (v8_enable_backtrace == "") {
|
|
v8_enable_backtrace = is_debug && !v8_optimized_debug
|
|
}
|
|
|
|
# Points to // in v8 stand-alone or to //v8/ in chromium. We need absolute
|
|
# paths for all configs in templates as they are shared in different
|
|
# subdirectories.
|
|
v8_path_prefix = get_path_info("../", "abspath")
|
|
|
|
v8_inspector_js_protocol = v8_path_prefix + "/src/inspector/js_protocol.json"
|
|
|
|
###############################################################################
|
|
# Templates
|
|
#
|
|
|
|
# Common configs to remove or add in all v8 targets.
|
|
v8_remove_configs = []
|
|
v8_add_configs = [
|
|
v8_path_prefix + ":features",
|
|
v8_path_prefix + ":toolchain",
|
|
]
|
|
|
|
if (is_debug && !v8_optimized_debug) {
|
|
v8_remove_configs += [ "//build/config/compiler:default_optimization" ]
|
|
v8_add_configs += [ "//build/config/compiler:no_optimize" ]
|
|
} else {
|
|
v8_remove_configs += [ "//build/config/compiler:default_optimization" ]
|
|
|
|
# TODO(crbug.com/621335) Rework this so that we don't have the confusion
|
|
# between "optimize_speed" and "optimize_max".
|
|
if (is_posix && !is_android && !using_sanitizer) {
|
|
v8_add_configs += [ "//build/config/compiler:optimize_speed" ]
|
|
} else {
|
|
v8_add_configs += [ "//build/config/compiler:optimize_max" ]
|
|
}
|
|
}
|
|
|
|
if (v8_code_coverage && !is_clang) {
|
|
v8_add_configs += [
|
|
v8_path_prefix + ":v8_gcov_coverage_cflags",
|
|
v8_path_prefix + ":v8_gcov_coverage_ldflags",
|
|
]
|
|
}
|
|
|
|
if (is_posix && (v8_enable_backtrace || v8_monolithic)) {
|
|
v8_remove_configs += [ "//build/config/gcc:symbol_visibility_hidden" ]
|
|
v8_add_configs += [ "//build/config/gcc:symbol_visibility_default" ]
|
|
}
|
|
|
|
# On MIPS gcc_target_rpath and ldso_path might be needed for all builds.
|
|
if (target_cpu == "mipsel" || target_cpu == "mips64el" ||
|
|
target_cpu == "mips" || target_cpu == "mips64") {
|
|
v8_add_configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
|
|
}
|
|
|
|
# All templates should be kept in sync.
|
|
template("v8_source_set") {
|
|
if (defined(invoker.split_count) && invoker.split_count > 1 &&
|
|
defined(v8_static_library) && v8_static_library && is_win) {
|
|
link_target_type = "split_static_library"
|
|
} else if (defined(v8_static_library) && v8_static_library) {
|
|
link_target_type = "static_library"
|
|
} else {
|
|
if (use_jumbo_build) {
|
|
link_target_type = "jumbo_source_set"
|
|
} else {
|
|
link_target_type = "source_set"
|
|
}
|
|
}
|
|
target(link_target_type, target_name) {
|
|
forward_variables_from(invoker, "*", [ "configs" ])
|
|
configs += invoker.configs
|
|
configs -= v8_remove_configs
|
|
configs += v8_add_configs
|
|
}
|
|
}
|
|
|
|
template("v8_header_set") {
|
|
jumbo_source_set(target_name) {
|
|
forward_variables_from(invoker, "*", [ "configs" ])
|
|
configs += invoker.configs
|
|
configs -= v8_remove_configs
|
|
configs += v8_add_configs
|
|
}
|
|
}
|
|
|
|
template("v8_executable") {
|
|
executable(target_name) {
|
|
forward_variables_from(invoker,
|
|
"*",
|
|
[
|
|
"configs",
|
|
"remove_configs",
|
|
])
|
|
if (defined(invoker.remove_configs)) {
|
|
configs -= invoker.remove_configs
|
|
}
|
|
configs += invoker.configs
|
|
configs -= v8_remove_configs
|
|
configs += v8_add_configs
|
|
if (is_linux) {
|
|
# For enabling ASLR.
|
|
ldflags = [ "-pie" ]
|
|
}
|
|
if (defined(testonly) && testonly && v8_code_coverage) {
|
|
# Only add code coverage cflags for non-test files for performance
|
|
# reasons.
|
|
if (is_clang) {
|
|
configs -= [ "//build/config/sanitizers:default_sanitizer_flags" ]
|
|
configs +=
|
|
[ "//build/config/sanitizers:default_sanitizer_flags_but_coverage" ]
|
|
} else {
|
|
configs -= [ v8_path_prefix + ":v8_gcov_coverage_cflags" ]
|
|
}
|
|
}
|
|
deps += [ v8_path_prefix + ":v8_dump_build_config" ]
|
|
}
|
|
}
|
|
|
|
template("v8_component") {
|
|
component(target_name) {
|
|
forward_variables_from(invoker, "*", [ "configs" ])
|
|
configs += invoker.configs
|
|
configs -= v8_remove_configs
|
|
configs += v8_add_configs
|
|
}
|
|
}
|
|
|
|
template("v8_static_library") {
|
|
static_library(target_name) {
|
|
complete_static_lib = true
|
|
forward_variables_from(invoker, "*", [ "configs" ])
|
|
configs += invoker.configs
|
|
configs -= v8_remove_configs
|
|
configs += v8_add_configs
|
|
}
|
|
}
|