Commit c8be2f62 authored by Yuta Hijikata's avatar Yuta Hijikata Committed by Chromium LUCI CQ

LaCrOS: Prepare //build for target_os switch of lacros-chrome.

The patch is made in preparation to switching lacros build from
target_os=linux to target_os=chromeos. This will prevent lacros from
changing behaviour after the switch.

Unlike other patches with similar changes, //build changes are done
manually following similar rules outlined in http://go/lacros-macros.

Bug: 1052397
Cq-Depend: chromium:2581632
Change-Id: Ieda2c12eafa2e3f1a75ca024ecda60362fb2515e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2581183Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Commit-Queue: Yuta Hijikata <ythjkt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#837967}
parent e3c99b0b
......@@ -12,8 +12,8 @@ import("//build/config/chromeos/ui_mode.gni")
# NOTE: Because Chrome OS builds may depend on targets built with the Android
# toolchain, this GNI file may be read and processed from within Chrome OS
# toolchains. Checking |is_android| here would therefore be too restrictive.
assert(is_android || is_chromeos ||
(is_linux && chromeos_is_browser_only && also_build_ash_chrome))
assert(is_android || is_chromeos_ash ||
(is_chromeos_lacros && also_build_ash_chrome))
declare_args() {
# Adds intrumentation to each function. Writes a file with the order that
......
......@@ -11,8 +11,8 @@ import("//build/config/chromeos/ui_mode.gni")
# NOTE: Because Chrome OS builds may depend on targets built with the Android
# toolchain, this GNI file may be read and processed from within Chrome OS
# toolchains. Checking |is_android| here would therefore be too restrictive.
if (is_android || is_chromeos ||
(is_linux && chromeos_is_browser_only && also_build_ash_chrome)) {
if (is_android || is_chromeos_ash ||
(is_chromeos_lacros && also_build_ash_chrome)) {
import("//build/config/chromecast_build.gni")
import("//build_overrides/build.gni")
import("abi.gni")
......
import("//build/config/c++/c++.gni")
import("//build/config/chrome_build.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/dcheck_always_on.gni")
import("//buildtools/deps_revisions.gni")
......@@ -20,7 +21,7 @@ declare_args() {
# TODO(xiaohuic): https://crbug/917533 Crashes on internal ChromeOS build.
# Do unconditionally once the underlying problem is fixed.
if (is_chromeos && is_chrome_branded) {
if (is_chromeos_ash && is_chrome_branded) {
libcxx_abi_unstable = false
}
......
......@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/sanitizers/sanitizers.gni")
declare_args() {
......@@ -10,11 +11,11 @@ declare_args() {
# standard library support.
# Don't check in changes that set this to false for more platforms; doing so
# is not supported.
use_custom_libcxx =
is_fuchsia || is_android || is_mac || (is_ios && !use_xcode_clang) ||
(is_win && is_clang) ||
((is_linux || is_chromeos) &&
(!is_chromeos || default_toolchain != "//build/toolchain/cros:target"))
use_custom_libcxx = is_fuchsia || is_android || is_mac ||
(is_ios && !use_xcode_clang) || (is_win && is_clang) ||
((is_linux || is_chromeos) &&
(!is_chromeos_ash ||
default_toolchain != "//build/toolchain/cros:target"))
# Use libc++ instead of stdlibc++ when using the host_cpu toolchain, even if
# use_custom_libcxx is false. This is useful for cross-compiles where a custom
......
......@@ -3,8 +3,9 @@
# found in the LICENSE file.
import("//build/config/chromeos/rules.gni")
import("//build/config/chromeos/ui_mode.gni")
assert(is_chromeos)
assert(is_chromeos_ash)
declare_args() {
# The location to a file used to dump symbols ordered by Call-Chain Clustering (C3)
......
......@@ -4,10 +4,11 @@
import("//build/config/chrome_build.gni")
import("//build/config/chromeos/args.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/gclient_args.gni")
import("//build/config/python.gni")
assert(is_chromeos)
assert(is_chromeos_ash)
# Determine the real paths for various items in the SDK, which may be used
# in the 'generate_runner_script' template below. We do so outside the template
......
......@@ -8,6 +8,7 @@ import("//build/config/c++/c++.gni")
import("//build/config/chrome_build.gni")
import("//build/config/chromecast_build.gni")
import("//build/config/chromeos/args.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/clang/clang.gni")
import("//build/config/compiler/compiler.gni")
import("//build/config/coverage/coverage.gni")
......@@ -118,7 +119,7 @@ declare_args() {
# the space overhead is too great. We should use some mixture of profiles and
# optimization settings to better tune the size increase.
thin_lto_enable_optimizations =
(is_chromeos || is_android || is_win) && is_official_build
(is_chromeos_ash || is_android || is_win) && is_official_build
# Initialize all local variables with a pattern. This flag will fill
# uninitialized floating-point types (and 32-bit pointers) with 0xFF and the
......@@ -147,7 +148,7 @@ declare_args() {
enable_wmax_tokens =
!is_official_build &&
((is_mac && target_cpu == "x64" && !use_system_xcode) ||
(is_linux && !is_chromeos && target_cpu == "x64") ||
((is_linux || is_chromeos_lacros) && target_cpu == "x64") ||
(is_win && target_cpu == "x86") || (is_win && target_cpu == "x64") ||
(is_android && target_cpu == "arm") ||
(is_android && target_cpu == "arm64"))
......@@ -175,13 +176,14 @@ declare_args() {
# other architectures.
#
# lld doesn't have the bug.
use_icf = (is_posix || is_fuchsia) && !is_debug && !using_sanitizer &&
!use_clang_coverage && !(is_android && use_order_profiling) &&
(use_lld || (use_gold && (is_chromeos || !(current_cpu == "x86" ||
current_cpu == "x64"))))
use_icf =
(is_posix || is_fuchsia) && !is_debug && !using_sanitizer &&
!use_clang_coverage && !(is_android && use_order_profiling) &&
(use_lld || (use_gold && (is_chromeos_ash || !(current_cpu == "x86" ||
current_cpu == "x64"))))
}
if (is_android || (is_chromeos && is_chromeos_device)) {
if (is_android || (is_chromeos_ash && is_chromeos_device)) {
# Set the path to use orderfile for linking Chrome
# Note that this is for using only one orderfile for linking
# the Chrome binary/library.
......@@ -192,7 +194,7 @@ if (is_android || (is_chromeos && is_chromeos_device)) {
# Allow downstream tools to set orderfile path with
# another variable.
chrome_orderfile_path = default_chrome_orderfile
} else if (is_chromeos && is_chromeos_device) {
} else if (is_chromeos_ash && is_chromeos_device) {
chrome_orderfile_path = "//chromeos/profiles/chromeos.orderfile.txt"
}
}
......@@ -240,7 +242,7 @@ config("compiler") {
configs += [ "//build/config/android:compiler" ]
} else if (is_linux || is_chromeos) {
configs += [ "//build/config/linux:compiler" ]
if (is_chromeos) {
if (is_chromeos_ash) {
configs += [ "//build/config/chromeos:compiler" ]
}
} else if (is_nacl) {
......@@ -291,7 +293,7 @@ config("compiler") {
} else {
cflags += [ "-fstack-protector" ]
}
} else if ((is_posix && !is_chromeos && !is_nacl) || is_fuchsia) {
} else if ((is_posix && !is_chromeos_ash && !is_nacl) || is_fuchsia) {
# TODO(phajdan.jr): Use -fstack-protector-strong when our gcc supports it.
# See also https://crbug.com/533294
cflags += [ "--param=ssp-buffer-size=4" ]
......@@ -662,7 +664,7 @@ config("compiler") {
import_instr_limit = -1
if (is_android) {
import_instr_limit = 5
} else if (is_chromeos) {
} else if (is_chromeos_ash) {
# Not much performance difference was noted between the default (100)
# and these. ARM was originally set lower than x86 to keep the size
# bloat of ThinLTO to <10%, but that's potentially no longer true.
......@@ -1213,7 +1215,7 @@ config("compiler_arm_thumb") {
}
config("compiler_arm") {
if (current_cpu == "arm" && is_chromeos) {
if (current_cpu == "arm" && is_chromeos_ash) {
# arm is normally the default mode for clang, but on chromeos a wrapper
# is used to pass -mthumb, and therefor change the default.
cflags = [ "-marm" ]
......@@ -1652,7 +1654,7 @@ config("chromium_code") {
# ChromeOS: http://crbug.com/940863
# Chromecast: http://crbug.com/942554
has_dchecks = is_debug || dcheck_always_on
if (!has_dchecks && is_chromeos && is_chrome_branded) {
if (!has_dchecks && is_chromeos_ash && is_chrome_branded) {
# Temporarily disable -Wextra-semi for Chrome on Chrome OS.
} else if (is_chromecast && chromecast_branding != "public") {
# Temporarily disable -Wextra-semi for Chromecast.
......@@ -1755,7 +1757,8 @@ config("no_rtti") {
# (de)allocate memory on a different heap, which would spell trouble if pointers
# to heap-allocated memory are passed over shared library boundaries.
config("export_dynamic") {
if (is_linux || export_libcxxabi_from_executables) {
# TODO(crbug.com/1052397): Revisit after target_os flip is completed.
if (is_linux || is_chromeos_lacros || export_libcxxabi_from_executables) {
ldflags = [ "-rdynamic" ]
}
}
......@@ -1894,7 +1897,7 @@ config("no_incompatible_pointer_warnings") {
cflags += [ "-Wno-incompatible-pointer-types" ]
} else if (current_cpu == "mipsel" || current_cpu == "mips64el") {
cflags += [ "-w" ]
} else if (is_chromeos && current_cpu == "arm") {
} else if (is_chromeos_ash && current_cpu == "arm") {
cflags += [ "-w" ]
}
}
......@@ -2037,7 +2040,7 @@ config("optimize") {
} else {
cflags = [ "-Os" ] + common_optimize_on_cflags
}
} else if (is_chromeos) {
} else if (is_chromeos_ash) {
# TODO(gbiv): This is partially favoring size over speed. CrOS exclusively
# uses clang, and -Os in clang is more of a size-conscious -O2 than "size at
# any cost" (AKA -Oz). It'd be nice to:
......@@ -2185,9 +2188,8 @@ if (is_clang && is_a_target_toolchain) {
} else if (clang_use_default_sample_profile) {
assert(build_with_chromium,
"Our default profiles currently only apply to Chromium")
assert(
is_android || chromeos_is_browser_only || is_chromeos || is_chromecast,
"The current platform has no default profile")
assert(is_android || is_chromeos_lacros || is_chromeos_ash || is_chromecast,
"The current platform has no default profile")
if (is_android || is_chromecast) {
_clang_sample_profile = "//chrome/android/profiles/afdo.prof"
} else {
......@@ -2471,7 +2473,7 @@ if (is_apple) {
}
}
if (is_chromeos && is_chromeos_device) {
if (is_chromeos_ash && is_chromeos_device) {
# This config is intended to be a temporary to facilitate
# the transition to use orderfile in Chrome OS. Once orderfile
# use becomes a default in Chrome OS, this config should not
......@@ -2483,7 +2485,7 @@ if (is_chromeos && is_chromeos_device) {
}
}
if (is_android || (is_chromeos && is_chromeos_device)) {
if (is_android || (is_chromeos_ash && is_chromeos_device)) {
# Use orderfile for linking Chrome on Android and Chrome OS.
# This config enables using an orderfile for linking in LLD.
# TODO: Consider using call graph sort instead, at least on Android.
......
......@@ -5,6 +5,7 @@
import("//build/config/chrome_build.gni")
import("//build/config/chromecast_build.gni")
import("//build/config/chromeos/args.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/compiler/pgo/pgo.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/toolchain/cc_wrapper.gni")
......@@ -125,7 +126,9 @@ declare_args() {
# Determine whether to enable or disable frame pointers, based on the platform
# and build arguments.
if (is_chromeos) {
# TODO(crbug.com/1052397): Consider changing is_chromeos_ash to is_chromeos after
# lacros-chrome switches to target_os="chromeos".
if (is_chromeos_ash) {
# ChromeOS generally prefers frame pointers, to support CWP.
# However, Clang does not currently generate usable frame pointers in ARM
# 32-bit builds (https://bugs.llvm.org/show_bug.cgi?id=18505) so disable them
......@@ -197,14 +200,14 @@ declare_args() {
declare_args() {
# Whether to use the gold linker from binutils instead of lld or bfd.
use_gold =
!use_lld && !(is_chromecast && is_linux &&
(current_cpu == "arm" || current_cpu == "mipsel")) &&
((is_linux && (current_cpu == "x64" || current_cpu == "x86" ||
current_cpu == "arm" || current_cpu == "arm64" ||
current_cpu == "mipsel" || current_cpu == "mips64el")) ||
(is_android && (current_cpu == "x86" || current_cpu == "x64" ||
current_cpu == "arm" || current_cpu == "arm64")))
use_gold = !use_lld && !(is_chromecast && is_linux &&
(current_cpu == "arm" || current_cpu == "mipsel")) &&
(((is_linux || is_chromeos_lacros) &&
(current_cpu == "x64" || current_cpu == "x86" ||
current_cpu == "arm" || current_cpu == "arm64" ||
current_cpu == "mipsel" || current_cpu == "mips64el")) ||
(is_android && (current_cpu == "x86" || current_cpu == "x64" ||
current_cpu == "arm" || current_cpu == "arm64")))
}
# Use relative paths for debug info. This is important to make the build
......
......@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/clang/clang.gni")
import("//build/config/compiler/compiler.gni")
import("//build/config/compiler/pgo/pgo.gni")
......@@ -49,7 +50,7 @@ config("pgo_optimization_flags") {
} else if (is_mac) {
_pgo_target = "mac"
inputs = [ "//chrome/build/mac.pgo.txt" ]
} else if (is_linux) {
} else if (is_linux || is_chromeos_lacros) {
_pgo_target = "linux"
inputs = [ "//chrome/build/linux.pgo.txt" ]
}
......
......@@ -13,7 +13,10 @@ declare_args() {
# 2 : Used during the PGO (optimization) phase.
chrome_pgo_phase = 0
if (is_official_build &&
(is_win || is_mac || (is_linux && !chromeos_is_browser_only && !is_chromecast))) {
# TODO(crbug.com/1052397): Remove chromeos_is_browser_only once
# target_os switch for lacros-chrome is completed.
(is_win || is_mac ||
(is_linux && !chromeos_is_browser_only && !is_chromecast))) {
chrome_pgo_phase = 2
}
......
......@@ -30,7 +30,7 @@ declare_args() {
use_dbus = (is_linux || is_chromeos) && !is_chromecast
use_gio = is_linux && !is_chromeos && !is_chromecast
use_gio = is_linux && !is_chromecast
}
#
# =============================================
......
......@@ -24,11 +24,13 @@ config("compiler") {
config("runtime_library") {
# Set here because OS_CHROMEOS cannot be autodetected in build_config.h like
# OS_LINUX and the like.
if (is_chromeos) {
# TODO(crbug.com/1052397): Consider changing is_chromeos_ash to is_chromeos after
# lacros-chrome switches to target_os="chromeos".
if (is_chromeos_ash) {
defines = [ "OS_CHROMEOS" ]
}
if ((!(is_chromeos || chromeos_is_browser_only) ||
if ((!(is_chromeos_ash || is_chromeos_lacros) ||
default_toolchain != "//build/toolchain/cros:target") &&
(!use_custom_libcxx || current_cpu == "mipsel")) {
libs = [ "atomic" ]
......
......@@ -5,7 +5,7 @@
import("//build/config/linux/gtk/gtk.gni")
import("//build/config/linux/pkg_config.gni")
assert(is_linux && !is_chromeos, "This file should only be referenced on Linux")
assert(is_linux, "This file should only be referenced on Linux")
# GN doesn't check visibility for configs so we give this an obviously internal
# name to discourage random targets from accidentally depending on this and
......@@ -31,12 +31,12 @@ group("gtk") {
# These are all for WebRTC.
"//examples:peerconnection_client",
"//remoting/host/linux",
"//remoting/host/it2me:common",
"//remoting/host/it2me:remote_assistance_host",
"//remoting/host:common",
"//remoting/host/file_transfer",
"//remoting/host:remoting_me2me_host_static",
"//remoting/host/file_transfer",
"//remoting/host/it2me:common",
"//remoting/host/it2me:remote_assistance_host",
"//remoting/host/linux",
"//remoting/test:it2me_standalone_host_main",
"//webrtc/examples:peerconnection_client",
]
......
......@@ -7,5 +7,7 @@ import("//build/config/ui.gni")
declare_args() {
use_pangocairo =
is_linux && !is_chromeos && !is_chromecast && !chromeos_is_browser_only
# TODO(crbug.com/1052397): Remove !chromeos_is_browser_only once
# lacros-chrome switches to target_os="chromeos"
is_linux && !is_chromecast && !chromeos_is_browser_only
}
......@@ -2,9 +2,11 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/dcheck_always_on.gni")
declare_args() {
# Use LogErrorNotReached() for NOTREACHED().
enable_log_error_not_reached = is_chromeos && !(is_debug || dcheck_always_on)
enable_log_error_not_reached =
is_chromeos_ash && !(is_debug || dcheck_always_on)
}
......@@ -3,6 +3,7 @@
# found in the LICENSE file.
import("//build/config/chromecast_build.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/ui.gni")
import("//build/toolchain/toolchain.gni")
......@@ -65,11 +66,11 @@ declare_args() {
} else {
ozone_platform = "cast"
}
} else if (is_chromeos) {
} else if (is_chromeos_ash) {
ozone_platform = "x11"
ozone_platform_drm = true
ozone_platform_x11 = true
} else if (is_linux) {
} else if (is_linux || is_chromeos_lacros) {
ozone_platform = "x11"
ozone_platform_wayland = true
ozone_platform_x11 = true
......
......@@ -5,6 +5,7 @@
import("//build/config/chrome_build.gni")
import("//build/config/chromecast_build.gni")
import("//build/config/chromeos/args.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/profiling/profiling.gni")
import("//build/toolchain/toolchain.gni")
......@@ -55,15 +56,20 @@ declare_args() {
#
# Disable this on linux-chromeos to avoid using ThinLTO there;
# crbug.com/1033839. Similarly, don't use this on ARC builds.
is_cfi = is_official_build &&
((target_os == "linux" && !is_chromeos && target_cpu == "x64") ||
(target_os == "chromeos" && is_chromeos_device))
#
# TODO(crbug.com/1159424): Reassess the validity of the next expression.
is_cfi =
is_official_build &&
(((target_os == "linux" || is_chromeos_lacros) && target_cpu == "x64") ||
(target_os == "chromeos" && is_chromeos_device && !is_chromeos_lacros))
# Enable checks for indirect function calls via a function pointer.
# TODO(pcc): remove this when we're ready to add these checks by default.
# https://crbug.com/701919
use_cfi_icall = target_os == "linux" && !is_chromeos && target_cpu == "x64" &&
is_official_build
#
# TODO(crbug.com/1159424): Reassess the validity of the next expression.
use_cfi_icall = (target_os == "linux" || is_chromeos_lacros) &&
target_cpu == "x64" && is_official_build
# Print detailed diagnostics when Control Flow Integrity detects a violation.
use_cfi_diag = false
......
......@@ -29,8 +29,7 @@ declare_args() {
# Indicates if the UI toolkit depends on X11.
# Enabled by default. Can be disabled if Ozone only build is required and
# vice-versa.
use_x11 =
is_linux && !is_chromecast && !is_chromeos && !chromeos_is_browser_only
use_x11 = is_linux && !is_chromecast && !is_chromeos_lacros
# Indicates if Aura is enabled. Aura is a low-level windowing library, sort
# of a replacement for GDI or GTK.
......@@ -46,14 +45,14 @@ declare_args() {
}
# Make sure glib is not used if building for ChromeOS/Chromecast
assert(!use_glib || (is_linux && !is_chromeos && !is_chromecast))
assert(!use_glib || (is_linux && !is_chromecast))
# Whether to use atk, the Accessibility ToolKit library
use_atk = is_linux && !is_chromecast && use_glib
# Whether using Xvfb to provide a display server for a test might be
# necessary.
use_xvfb_in_this_config = (is_linux && !is_chromeos) || chromeos_is_browser_only
use_xvfb_in_this_config = is_linux || is_chromeos_lacros
#
# =============================================
# PLEASE DO NOT ADD MORE FLAGS TO THIS FILE
......
......@@ -8,6 +8,7 @@
assert(current_toolchain == default_toolchain)
import("//build/config/android/config.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/compiler/compiler.gni")
import("//build/config/mac/symbols.gni")
import("//build/config/sanitizers/sanitizers.gni")
......@@ -36,7 +37,8 @@ if (concurrent_links == -1) {
} else {
_args += [ "--mem_per_link_gb=10" ]
}
} else if (use_clang_coverage || use_sanitizer_coverage || use_fuzzing_engine) {
} else if (use_clang_coverage || use_sanitizer_coverage ||
use_fuzzing_engine) {
# Sanitizer coverage instrumentation increases linker memory consumption
# significantly.
_args = [ "--mem_per_link_gb=16" ]
......@@ -60,7 +62,7 @@ if (concurrent_links == -1) {
} else {
_args = [ "--mem_per_link_gb=4" ]
}
} else if (is_linux && !is_chromeos && symbol_level == 0) {
} else if ((is_linux || is_chromeos_lacros) && symbol_level == 0) {
# Memory consumption on link without debug symbols is low on linux.
_args = [ "--mem_per_link_gb=3" ]
} else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment