Commit 53352fda authored by Ben Pastene's avatar Ben Pastene Committed by Commit Bot

chromeos: Pass path to gomacc to CrOS' toolchain wrapper via arg.

Instead of env var:
https://source.chromium.org/chromium/chromium/src/+/master:third_party/chromite/cli/cros/cros_chrome_sdk.py;l=1105

The use of that env var is preventing Simple Chrome from being built
with goma outside of the shell. So instead, this will pass in gomacc
to the toolchain wrapper via "--gomacc-path" arg.
https://source.chromium.org/chromiumos/chromiumos/codesearch/+/master:src/third_party/toolchain-utils/compiler_wrapper/gomacc_flag.go;l=16

Bug: 937821, 1011928
Change-Id: Ie11d78173188996ddeec36629bd0192111726459
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2052218Reviewed-by: default avatarTakuto Ikuta <tikuta@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Commit-Queue: Ben Pastene <bpastene@chromium.org>
Cr-Commit-Position: refs/heads/master@{#741476}
parent d2730490
......@@ -15,6 +15,14 @@ template("cros_toolchain") {
gcc_toolchain(target_name) {
forward_variables_from(invoker, "*")
# CrOS's target toolchain wrapper prefers to invoke gomacc itself, so pass
# it the gomacc path via cmd-line arg. Otherwise, for both CrOS's host
# wrapper (used in the ebuild) and Chrome's clang (used in Simple Chrome),
# prepend gomacc like normal.
if (use_goma && toolchain_args.needs_gomacc_path_arg) {
extra_cppflags += " --gomacc-path $goma_dir/gomacc"
}
# Relativize path if compiler is specified such that not to lookup from $PATH
# and cc/cxx does not contain additional flags.
if (cc != get_path_info(cc, "file") && string_replace(cc, " ", "") == cc) {
......@@ -53,6 +61,7 @@ cros_toolchain("target") {
toolchain_args = {
cc_wrapper = ""
needs_gomacc_path_arg = true
clang_use_chrome_plugins = false
current_cpu = target_cpu
current_os = "chromeos"
......@@ -86,6 +95,7 @@ cros_toolchain("nacl_bootstrap") {
toolchain_args = {
cc_wrapper = ""
needs_gomacc_path_arg = true
clang_use_chrome_plugins = false
current_cpu = target_cpu
current_os = "chromeos"
......@@ -116,6 +126,7 @@ cros_toolchain("host") {
toolchain_args = {
cc_wrapper = ""
needs_gomacc_path_arg = false
clang_use_chrome_plugins = false
is_clang = cros_host_is_clang
current_cpu = host_cpu
......@@ -144,6 +155,7 @@ cros_toolchain("v8_snapshot") {
toolchain_args = {
cc_wrapper = ""
needs_gomacc_path_arg = false
clang_use_chrome_plugins = false
is_clang = cros_v8_snapshot_is_clang
if (target_cpu == "x86" || target_cpu == "arm" || target_cpu == "mipsel") {
......
......@@ -154,11 +154,12 @@ template("gcc_toolchain") {
# toolchain args, use those values, otherwise default to the global one.
# This works because the only reasonable override that toolchains might
# supply for these values are to force-disable them.
# But if has_gomacc_path is set in simple chrome build, we assumes that
# *chromeos* compiler wrapper find gomacc from GOMACC_PATH envvar.
# Note: In this case, we use gomacc for host toolchain compiling.
# But if needs_gomacc_path_arg is set in a Chrome OS build, the toolchain
# wrapper will have picked up gomacc via cmd-line arg. So need to prepend
# gomacc in that case.
if (toolchain_uses_goma &&
(!has_gomacc_path || invoker_toolchain_args.current_os != "chromeos")) {
(!defined(invoker_toolchain_args.needs_gomacc_path_arg) ||
!invoker_toolchain_args.needs_gomacc_path_arg)) {
goma_path = "$goma_dir/gomacc"
compiler_prefix = "${goma_path} "
} else {
......
......@@ -8,11 +8,6 @@ declare_args() {
# Set to true to enable distributed compilation using Goma.
use_goma = false
# This flag is for ChromeOS compiler wrapper.
# By passing gomacc path via GOMACC_PATH environment variable, ChromeOS'
# compiler wrapper invokes gomacc inside it.
has_gomacc_path = false
# Set the default value based on the platform.
if (host_os == "win") {
# Absolute directory containing the gomacc.exe binary.
......
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