summaryrefslogtreecommitdiff
path: root/chromium/build/toolchain
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-12 14:27:29 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-13 09:35:20 +0000
commitc30a6232df03e1efbd9f3b226777b07e087a1122 (patch)
treee992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/build/toolchain
parent7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff)
downloadqtwebengine-chromium-85-based.tar.gz
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/build/toolchain')
-rw-r--r--chromium/build/toolchain/OWNERS1
-rwxr-xr-xchromium/build/toolchain/gcc_solink_wrapper.py78
-rw-r--r--chromium/build/toolchain/gcc_toolchain.gni2
-rw-r--r--chromium/build/toolchain/mac/BUILD.gn7
-rwxr-xr-xchromium/build/toolchain/mac/linker_driver.py2
-rw-r--r--chromium/build/toolchain/toolchain.gni12
-rw-r--r--chromium/build/toolchain/win/BUILD.gn10
-rw-r--r--chromium/build/toolchain/win/midl.gni2
-rw-r--r--chromium/build/toolchain/win/midl.py10
-rw-r--r--chromium/build/toolchain/win/setup_toolchain.py8
10 files changed, 93 insertions, 39 deletions
diff --git a/chromium/build/toolchain/OWNERS b/chromium/build/toolchain/OWNERS
index 0a8dcda56c5..37c7730cbcf 100644
--- a/chromium/build/toolchain/OWNERS
+++ b/chromium/build/toolchain/OWNERS
@@ -1,4 +1,5 @@
dpranke@chromium.org
+dpranke@google.com
scottmg@chromium.org
# Clang Static Analyzer.
diff --git a/chromium/build/toolchain/gcc_solink_wrapper.py b/chromium/build/toolchain/gcc_solink_wrapper.py
index 5bb7b9513f0..66b7f0cad6c 100755
--- a/chromium/build/toolchain/gcc_solink_wrapper.py
+++ b/chromium/build/toolchain/gcc_solink_wrapper.py
@@ -12,6 +12,7 @@ does not have a POSIX-like shell (e.g. Windows).
import argparse
import os
+import shlex
import subprocess
import sys
@@ -22,7 +23,10 @@ def CollectSONAME(args):
"""Replaces: readelf -d $sofile | grep SONAME"""
toc = ''
readelf = subprocess.Popen(wrapper_utils.CommandToRun(
- [args.readelf, '-d', args.sofile]), stdout=subprocess.PIPE, bufsize=-1)
+ [args.readelf, '-d', args.sofile]),
+ stdout=subprocess.PIPE,
+ bufsize=-1,
+ universal_newlines=True)
for line in readelf.stdout:
if 'SONAME' in line:
toc += line
@@ -32,11 +36,11 @@ def CollectSONAME(args):
def CollectDynSym(args):
"""Replaces: nm --format=posix -g -D -p $sofile | cut -f1-2 -d' '"""
toc = ''
- nm = subprocess.Popen(
- wrapper_utils.CommandToRun(
- [args.nm, '--format=posix', '-g', '-D', '-p', args.sofile]),
- stdout=subprocess.PIPE,
- bufsize=-1)
+ nm = subprocess.Popen(wrapper_utils.CommandToRun(
+ [args.nm, '--format=posix', '-g', '-D', '-p', args.sofile]),
+ stdout=subprocess.PIPE,
+ bufsize=-1,
+ universal_newlines=True)
for line in nm.stdout:
toc += ' '.join(line.split(' ', 2)[:2]) + '\n'
return nm.wait(), toc
@@ -59,6 +63,23 @@ def UpdateTOC(tocfile, toc):
open(tocfile, 'w').write(toc)
+def CollectInputs(out, args):
+ for x in args:
+ if x.startswith('@'):
+ with open(x[1:]) as rsp:
+ CollectInputs(out, shlex.split(rsp.read()))
+ elif not x.startswith('-') and (x.endswith('.o') or x.endswith('.a')):
+ out.write(x)
+ out.write('\n')
+
+
+def InterceptFlag(flag, command):
+ ret = flag in command
+ if ret:
+ command.remove(flag)
+ return ret
+
+
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--readelf',
@@ -96,21 +117,10 @@ def main():
fast_env = dict(os.environ)
fast_env['LC_ALL'] = 'C'
- # Extract the --link-only argument, which goes for a ride through ldflags into
- # the command, but is meant to be intercepted by this wrapper script (not
- # passed to the linker). https://crbug.com/954311 tracks finding a better way
- # to plumb this argument.
- link_only = '--link-only' in args.command
- if link_only:
- args.command.remove('--link-only')
-
- # First, run the actual link.
- command = wrapper_utils.CommandToRun(args.command)
- result = wrapper_utils.RunLinkWithOptionalMapFile(command, env=fast_env,
- map_file=args.map_file)
-
- if result != 0:
- return result
+ # Extract flags passed through ldflags but meant for this script.
+ # https://crbug.com/954311 tracks finding a better way to plumb these.
+ link_only = InterceptFlag('--link-only', args.command)
+ collect_inputs_only = InterceptFlag('--collect-inputs-only', args.command)
# If only linking, we are likely generating a partitioned .so that will be
# split apart later. In that case:
@@ -125,13 +135,29 @@ def main():
# tools would need to be updated to handle and/or not complain about
# partitioned libraries. Instead, to keep Ninja happy, simply create dummy
# files for the TOC and stripped lib.
- if link_only:
- with open(args.output, 'w'):
- pass
- with open(args.tocfile, 'w'):
- pass
+ if link_only or collect_inputs_only:
+ open(args.output, 'w').close()
+ open(args.tocfile, 'w').close()
+
+ # Instead of linking, records all inputs to a file. This is used by
+ # enable_resource_whitelist_generation in order to avoid needing to
+ # link (which is slow) to build the resources whitelist.
+ if collect_inputs_only:
+ with open(args.sofile, 'w') as f:
+ CollectInputs(f, args.command)
+ if args.map_file:
+ open(args.map_file, 'w').close()
return 0
+ # First, run the actual link.
+ command = wrapper_utils.CommandToRun(args.command)
+ result = wrapper_utils.RunLinkWithOptionalMapFile(command,
+ env=fast_env,
+ map_file=args.map_file)
+
+ if result != 0 or link_only:
+ return result
+
# Next, generate the contents of the TOC file.
result, toc = CollectTOC(args)
if result != 0:
diff --git a/chromium/build/toolchain/gcc_toolchain.gni b/chromium/build/toolchain/gcc_toolchain.gni
index 775c35c8780..1c7bf7e7ab8 100644
--- a/chromium/build/toolchain/gcc_toolchain.gni
+++ b/chromium/build/toolchain/gcc_toolchain.gni
@@ -171,7 +171,7 @@ template("gcc_toolchain") {
# Chrome OS builders. So we pass in an explicit value.
goma_ld =
rebase_path("//tools/clang/scripts/goma_ld.py", root_build_dir) +
- " --gomacc ${goma_path} --jobs 100 -- "
+ " --gomacc ${goma_path} --jobs 200 -- "
} else {
goma_ld = ""
not_needed([ "goma_path" ])
diff --git a/chromium/build/toolchain/mac/BUILD.gn b/chromium/build/toolchain/mac/BUILD.gn
index add57c71bbe..8fdada0f022 100644
--- a/chromium/build/toolchain/mac/BUILD.gn
+++ b/chromium/build/toolchain/mac/BUILD.gn
@@ -477,6 +477,13 @@ mac_toolchain("clang_arm") {
}
}
+mac_toolchain("clang_arm64") {
+ toolchain_args = {
+ current_cpu = "arm64"
+ current_os = "mac"
+ }
+}
+
mac_toolchain("clang_x64") {
toolchain_args = {
current_cpu = "x64"
diff --git a/chromium/build/toolchain/mac/linker_driver.py b/chromium/build/toolchain/mac/linker_driver.py
index e5170505853..453259a40d5 100755
--- a/chromium/build/toolchain/mac/linker_driver.py
+++ b/chromium/build/toolchain/mac/linker_driver.py
@@ -278,8 +278,8 @@ _LINKER_DRIVER_ACTIONS = [
('dsymutilpath,', SetDsymutilPath),
('dsym,', RunDsymUtil),
('unstripped,', RunSaveUnstripped),
- ('strip,', RunStrip),
('strippath,', SetStripPath),
+ ('strip,', RunStrip),
]
diff --git a/chromium/build/toolchain/toolchain.gni b/chromium/build/toolchain/toolchain.gni
index 552ceb67e65..80c2e7b5e4a 100644
--- a/chromium/build/toolchain/toolchain.gni
+++ b/chromium/build/toolchain/toolchain.gni
@@ -31,15 +31,15 @@ if (generate_linker_map) {
is_official_build,
"Linker map files should only be generated when is_official_build = true")
assert(current_os == "android" || current_os == "linux" ||
- target_os == "android" || target_os == "linux",
- "Linker map files should only be generated for Android and Linux")
+ target_os == "android" || target_os == "linux" ||
+ target_os == "chromeos",
+ "Linker map files should only be generated for Android, Linux, " +
+ "or ChromeOS.")
}
declare_args() {
- if (is_clang) {
- # Clang compiler version. Clang files are placed at version-dependent paths.
- clang_version = "11.0.0"
- }
+ # Clang compiler version. Clang files are placed at version-dependent paths.
+ clang_version = "11.0.0"
}
# Check target_os here instead of is_ios as this file is loaded for secondary
diff --git a/chromium/build/toolchain/win/BUILD.gn b/chromium/build/toolchain/win/BUILD.gn
index 0c356e16296..be0893059aa 100644
--- a/chromium/build/toolchain/win/BUILD.gn
+++ b/chromium/build/toolchain/win/BUILD.gn
@@ -446,12 +446,20 @@ template("win_toolchains") {
environment = "environment." + toolchain_arch
prefix = rebase_path("$clang_base_path/bin", root_build_dir)
cl = "${clang_prefix}$prefix/${clang_cl}"
+ _clang_lib_dir =
+ rebase_path("$clang_base_path/lib/clang/$clang_version/lib/windows",
+ root_build_dir)
if (host_os == "win") {
# Flip the slashes so that copy/paste of the command works.
cl = string_replace(cl, "/", "\\")
+
+ # And to match the other -libpath flags.
+ _clang_lib_dir = string_replace(_clang_lib_dir, "/", "\\")
}
+
sys_include_flags = "${win_toolchain_data.include_flags_imsvc}"
- sys_lib_flags = "${win_toolchain_data.libpath_flags}"
+ sys_lib_flags =
+ "-libpath:$_clang_lib_dir ${win_toolchain_data.libpath_flags}"
toolchain_args = {
if (defined(invoker.toolchain_args)) {
diff --git a/chromium/build/toolchain/win/midl.gni b/chromium/build/toolchain/win/midl.gni
index ee7dc479e88..72e79ebaa35 100644
--- a/chromium/build/toolchain/win/midl.gni
+++ b/chromium/build/toolchain/win/midl.gni
@@ -123,6 +123,8 @@ template("midl") {
dlldata_file,
interface_identifier_file,
proxy_file,
+ rebase_path("//third_party/llvm-build/Release+Asserts/bin/clang-cl.exe",
+ root_build_dir),
"{{source}}",
"/char",
"signed",
diff --git a/chromium/build/toolchain/win/midl.py b/chromium/build/toolchain/win/midl.py
index 6d6fab05a50..5483173e58c 100644
--- a/chromium/build/toolchain/win/midl.py
+++ b/chromium/build/toolchain/win/midl.py
@@ -173,8 +173,8 @@ def overwrite_cls_guid(h_file, iid_file, tlb_file, dynamic_guid):
overwrite_cls_guid_tlb(tlb_file, dynamic_guid)
-def main(arch, gendir, outdir, dynamic_guid, tlb, h, dlldata, iid, proxy, idl,
- *flags):
+def main(arch, gendir, outdir, dynamic_guid, tlb, h, dlldata, iid, proxy, clang,
+ idl, *flags):
# Copy checked-in outputs to final location.
source = gendir
if os.path.isdir(os.path.join(source, os.path.basename(idl))):
@@ -204,6 +204,10 @@ def main(arch, gendir, outdir, dynamic_guid, tlb, h, dlldata, iid, proxy, idl,
env_pairs = open(arch).read()[:-2].split('\0')
env_dict = dict([item.split('=', 1) for item in env_pairs])
+ # Extract the /D options and send them to the preprocessor.
+ preprocessor_options = '-E -nologo -Wno-nonportable-include-path'
+ preprocessor_options += ''.join(
+ [' ' + flag for flag in flags if flag.startswith('/D')])
args = ['midl', '/nologo'] + list(flags) + [
'/out', tmp_dir,
'/tlb', tlb,
@@ -211,6 +215,8 @@ def main(arch, gendir, outdir, dynamic_guid, tlb, h, dlldata, iid, proxy, idl,
'/dlldata', dlldata,
'/iid', iid,
'/proxy', proxy,
+ '/cpp_cmd', clang,
+ '/cpp_opt', preprocessor_options,
idl]
try:
popen = subprocess.Popen(args, shell=True, env=env_dict,
diff --git a/chromium/build/toolchain/win/setup_toolchain.py b/chromium/build/toolchain/win/setup_toolchain.py
index 9c936c69d68..1a7c3d74b5c 100644
--- a/chromium/build/toolchain/win/setup_toolchain.py
+++ b/chromium/build/toolchain/win/setup_toolchain.py
@@ -153,10 +153,14 @@ def _LoadToolchainEnv(cpu, sdk_dir, target_store):
if (cpu != 'x64'):
# x64 is default target CPU thus any other CPU requires a target set
cpu_arg += '_' + cpu
- args = [script_path, cpu_arg]
+ args = [script_path, cpu_arg, ]
# Store target must come before any SDK version declaration
if (target_store):
- args.append(['store'])
+ args.append('store')
+ # Explicitly specifying the SDK version to build with to avoid accidentally
+ # building with a new and untested SDK. This should stay in sync with the
+ # packaged toolchain in build/vs_toolchain.py.
+ args.append('10.0.19041.0')
variables = _LoadEnvFromBat(args)
return _ExtractImportantEnvironment(variables)