| Index: build/config/BUILDCONFIG.gn
|
| diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
|
| index 4f3a223c32d23ab7b79007add5081deac14bdf7e..54686c28651adb45b12b85325395494c88ebf111 100644
|
| --- a/build/config/BUILDCONFIG.gn
|
| +++ b/build/config/BUILDCONFIG.gn
|
| @@ -142,9 +142,45 @@ declare_args() {
|
| # every toolchain can pass through the "global" value via toolchain_args().
|
| host_toolchain = ""
|
|
|
| + # This arg is used when we want to tell the JIT-code-generating v8 code
|
| + # that we want to have it generate code for an architecture that is different
|
| + # than the architecture that v8 will actually run on, and that we will
|
| + # then run the code under an emulator. For example, we might run v8
|
| + # on x86, but generate arm code and run that under emulation.
|
| + #
|
| + # This arg is defined here rather than in the v8 project because we want
|
| + # some of the common architecture-specific args (like arm_float_abi or
|
| + # mips_arch_variant) to be set to their defaults either if the current_cpu
|
| + # applies *or* if the v8_target_cpu applies.
|
| + v8_target_cpu = ""
|
| +
|
| + # Compile for Memory Sanitizer to find uninitialized reads.
|
| + #
|
| + # TODO: This is here so that we can set a good default for v8_target_cpu
|
| + # when running under the sanitizer, but this is something of a layering
|
| + # violation and it would be nice if there was some other way to do this.
|
| + is_msan = false
|
| +
|
| # DON'T ADD MORE FLAGS HERE. Read the comment above.
|
| }
|
|
|
| +if (v8_target_cpu == "") {
|
| + if (is_msan) {
|
| + # Running the V8-generated code on an ARM simulator is a powerful hack that
|
| + # allows the tool to see the memory accesses from JITted code. Without this
|
| + # flag, JS code causes false positive reports from MSan.
|
| + v8_target_cpu = "arm64"
|
| + } else {
|
| + v8_target_cpu = target_cpu
|
| + }
|
| +}
|
| +
|
| +declare_args() {
|
| + # This argument is declared here so that it can be overridden in
|
| + # toolchains. It should never be explicitly set by the user.
|
| + v8_current_cpu = v8_target_cpu
|
| +}
|
| +
|
| assert(!(is_debug && is_official_build), "Can't do official debug builds")
|
|
|
| # ==============================================================================
|
| @@ -215,10 +251,15 @@ if (target_os == "android") {
|
| } else if (target_os == "ios") {
|
| _default_toolchain = "//build/toolchain/mac:ios_clang_$target_cpu"
|
| } else if (target_os == "linux") {
|
| + if (v8_current_cpu != current_cpu) {
|
| + _target_cpus = "${target_cpu}_v8_${v8_current_cpu}"
|
| + } else {
|
| + _target_cpus = target_cpu
|
| + }
|
| if (is_clang) {
|
| - _default_toolchain = "//build/toolchain/linux:clang_$target_cpu"
|
| + _default_toolchain = "//build/toolchain/linux:clang_${_target_cpus}"
|
| } else {
|
| - _default_toolchain = "//build/toolchain/linux:$target_cpu"
|
| + _default_toolchain = "//build/toolchain/linux:${_target_cpus}"
|
| }
|
| } else if (target_os == "mac") {
|
| assert(host_os == "mac", "Mac cross-compiles are unsupported.")
|
|
|