aboutsummaryrefslogtreecommitdiff
path: root/build/config
diff options
context:
space:
mode:
Diffstat (limited to 'build/config')
-rw-r--r--build/config/clang/BUILD.gn2
-rw-r--r--build/config/compiler/BUILD.gn49
-rw-r--r--build/config/compiler/compiler.gni15
-rwxr-xr-xbuild/config/siso/configure_siso.py32
-rw-r--r--build/config/unsafe_buffers_paths.txt24
-rw-r--r--build/config/win/BUILD.gn53
6 files changed, 78 insertions, 97 deletions
diff --git a/build/config/clang/BUILD.gn b/build/config/clang/BUILD.gn
index 8cbeb6e76e..cffc4ef93b 100644
--- a/build/config/clang/BUILD.gn
+++ b/build/config/clang/BUILD.gn
@@ -98,6 +98,8 @@ config("unsafe_buffers") {
if (clang_use_chrome_plugins && clang_unsafe_buffers_paths != "" &&
!use_goma) {
cflags = [
+ "-DUNSAFE_BUFFERS_BUILD",
+
"-Xclang",
"-add-plugin",
"-Xclang",
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index f5b1d46068..78a52a0435 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -67,10 +67,6 @@ declare_args() {
# Requires profiling to be set to true.
enable_full_stack_frames_for_profiling = false
- # When we are going to use gold we need to find it.
- # This is initialized below, after use_gold might have been overridden.
- gold_path = ""
-
# Enable fatal linker warnings. Building Chromium with certain versions
# of binutils can cause linker warning.
fatal_linker_warnings = true
@@ -208,19 +204,9 @@ declare_args() {
declare_args() {
# Set to true to use icf, Identical Code Folding.
- #
- # icf=all is broken in older golds, see
- # https://sourceware.org/bugzilla/show_bug.cgi?id=17704
- # chromeos binutils has been patched with the fix, so always use icf there.
- # The bug only affects x86 and x64, so we can still use ICF when targeting
- # other architectures.
- #
- # lld doesn't have the bug.
use_icf = (is_posix || is_fuchsia) && !is_debug && !using_sanitizer &&
!use_clang_coverage && current_os != "zos" &&
- !(is_android && use_order_profiling) &&
- (use_lld || (use_gold && (is_chromeos || !(current_cpu == "x86" ||
- current_cpu == "x64"))))
+ !(is_android && use_order_profiling) && use_lld
}
if (is_android) {
@@ -515,35 +501,6 @@ config("compiler") {
# Linux-specific compiler flags setup.
# ------------------------------------
- if (use_gold) {
- ldflags += [ "-fuse-ld=gold" ]
- if (!is_android) {
- # On Android, this isn't needed. gcc in the NDK knows to look next to
- # it with -fuse-ld=gold, and clang gets a --gcc-toolchain flag passed
- # above.
- if (gold_path != "") {
- ldflags += [ "-B$gold_path" ]
- }
-
- ldflags += [
- # Experimentation found that using four linking threads
- # saved ~20% of link time.
- # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/281527606915bb36
- # Only apply this to the target linker, since the host
- # linker might not be gold, but isn't used much anyway.
- "-Wl,--threads",
- "-Wl,--thread-count=4",
- ]
- }
-
- # TODO(thestig): Make this flag work with GN.
- #if (!is_official_build && !is_chromeos && !(is_asan || is_lsan || is_tsan || is_msan)) {
- # ldflags += [
- # "-Wl,--detect-odr-violations",
- # ]
- #}
- }
-
if (use_icf && (!is_apple || use_lld)) {
ldflags += [ "-Wl,--icf=all" ]
}
@@ -2372,7 +2329,7 @@ if (is_win) {
common_optimize_on_ldflags += [
# Specifically tell the linker to perform optimizations.
# See http://lwn.net/Articles/192624/ .
- # -O2 enables string tail merge optimization in gold and lld.
+ # -O2 enables string tail merge optimization in lld.
"-Wl,-O2",
"-Wl,--gc-sections",
]
@@ -2804,7 +2761,7 @@ config("symbols") {
# sections" there. Maybe just a bug in nacl_switch_32.S.
_enable_gdb_index =
symbol_level == 2 && !is_apple && !is_nacl && current_cpu != "x86" &&
- current_os != "zos" && (use_gold || use_lld) &&
+ current_os != "zos" && use_lld &&
# Disable on non-fission 32-bit Android because it pushes
# libcomponents_unittests over the 4gb size limit.
!(is_android && !use_debug_fission && current_cpu != "x64" &&
diff --git a/build/config/compiler/compiler.gni b/build/config/compiler/compiler.gni
index 08bd265d24..dff295865e 100644
--- a/build/config/compiler/compiler.gni
+++ b/build/config/compiler/compiler.gni
@@ -78,6 +78,8 @@ declare_args() {
# the default. This is necessary to delay the evaluation of the default
# value expression until after its input values such as use_gold have
# been set, e.g. by a toolchain_args() block.
+ #
+ # TODO(crbug.com/333645515): Remove the placeholder value and set directly.
use_debug_fission = "default"
# Enables support for ThinLTO, which links 3x-10x faster than full LTO. See
@@ -236,15 +238,8 @@ enable_arm_cfi_table = is_android && !is_component_build && current_cpu == "arm"
declare_args() {
# Whether to use the gold linker from binutils instead of lld or bfd.
- use_gold = !use_lld && !(is_castos &&
- (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" ||
- current_cpu == "riscv64")))
+ # TODO(crbug.com/333645515): Remove this variable.
+ use_gold = false
}
# Use relative paths for debug info. This is important to make the build
@@ -276,7 +271,7 @@ assert(
"Invalid use_debug_fission.")
if (use_debug_fission == "default") {
use_debug_fission = is_debug && !is_android && !is_fuchsia && !is_apple &&
- !is_win && (use_gold || use_lld) && cc_wrapper == ""
+ !is_win && use_lld && cc_wrapper == ""
}
# If it wasn't manually set, set to an appropriate default.
diff --git a/build/config/siso/configure_siso.py b/build/config/siso/configure_siso.py
index bcf79ca750..032fb23270 100755
--- a/build/config/siso/configure_siso.py
+++ b/build/config/siso/configure_siso.py
@@ -10,12 +10,39 @@ import sys
THIS_DIR = os.path.abspath(os.path.dirname(__file__))
+SISO_PROJECT_CFG = "SISO_PROJECT"
+SISO_ENV = os.path.join(THIS_DIR, ".sisoenv")
+
+
+def ReadConfig():
+ entries = {}
+ if not os.path.isfile(SISO_ENV):
+ print('The .sisoenv file has not been generated yet')
+ return entries
+ with open(SISO_ENV, 'r') as f:
+ for line in f:
+ parts = line.strip().split('=')
+ if len(parts) > 1:
+ entries[parts[0].strip()] = parts[1].strip()
+ return entries
+
def main():
parser = argparse.ArgumentParser(description="configure siso")
parser.add_argument("--rbe_instance", help="RBE instance to use for Siso")
+ parser.add_argument("--get-siso-project",
+ help="Print the currently configured siso project to "
+ "stdout",
+ action="store_true")
args = parser.parse_args()
+ if args.get_siso_project:
+ config = ReadConfig()
+ if not SISO_PROJECT_CFG in config:
+ return 1
+ print(config[SISO_PROJECT_CFG])
+ return 0
+
project = None
rbe_instance = args.rbe_instance
if rbe_instance:
@@ -24,10 +51,9 @@ def main():
project = elems[1]
rbe_instance = elems[-1]
- siso_env_path = os.path.join(THIS_DIR, ".sisoenv")
- with open(siso_env_path, "w") as f:
+ with open(SISO_ENV, "w") as f:
if project:
- f.write("SISO_PROJECT=%s\n" % project)
+ f.write("%s=%s\n" % (SISO_PROJECT_CFG, project))
if rbe_instance:
f.write("SISO_REAPI_INSTANCE=%s\n" % rbe_instance)
return 0
diff --git a/build/config/unsafe_buffers_paths.txt b/build/config/unsafe_buffers_paths.txt
index b7319dcb74..0c576c7e62 100644
--- a/build/config/unsafe_buffers_paths.txt
+++ b/build/config/unsafe_buffers_paths.txt
@@ -25,9 +25,9 @@
# the `+` line takes precedence and the file will be checked.
#
# To opt individual files out of checks, place `#pragma allow_unsafe_buffers`
-# anywhere in the (source or header) file. These pragmas represent the
-# technical debt and security risk present in the file through unsafe
-# pointer usage.
+# anywhere in the (source or header) file, guarded by
+# `#ifdef UNSAFE_BUFFERS_BUILD`. These pragmas represent the technical debt and
+# security risk present in the file through unsafe pointer usage.
#
# ***
# Recommended process for removing a `-dir/` line from this file:
@@ -37,7 +37,13 @@
# like `-dir/sub_dir/`.
# 2. Add `#pragma allow_unsafe_buffers` to every file in the directory that now
# has a compilation error, with a TODO to the tracking bug for the
-# directory.
+# directory:
+# ```
+# #ifdef UNSAFE_BUFFERS_BUILD
+# // TODO(crbug.com/ABC): Remove this and convert code to safer constructs.
+# #pragma allow_unsafe_buffers
+# #endif
+# ```
# 3. Work through the files in the directory, converting pointers to spans, or
# to owning containers like HeapArray and vector. Remove the pragmas from
# the files when there is no unsafe pointer usage left in each one.
@@ -47,14 +53,8 @@
-android_webview/
-apps/
-ash/
-
--base/
-+base/containers/buffer_iterator_nocompile.nc
-+base/containers/span.h
-+base/strings/cstring_view
-+base/unsafe_buffers_unittest.cc
-+base/unsafe_buffers_nocompile.nc
-
+-base/allocator
+-base/third_party
-build/
-build_overrides/
-buildtools/
diff --git a/build/config/win/BUILD.gn b/build/config/win/BUILD.gn
index 1634e2879a..9ecf8abdcd 100644
--- a/build/config/win/BUILD.gn
+++ b/build/config/win/BUILD.gn
@@ -511,8 +511,9 @@ config("release_crt") {
if (is_component_build) {
cflags = [ "/MD" ]
- # The - in front of crt-static turns the feature off.
- rustflags = [ "-Ctarget-feature=-crt-static" ]
+ # /MD specifies msvcrt.lib as the CRT library, which is the dynamic+release
+ # version. Rust needs to agree, and its default mode is dynamic+release, so
+ # we do nothing here. See https://github.com/rust-lang/rust/issues/39016.
if (use_custom_libcxx) {
# On Windows, including libcpmt[d]/msvcprt[d] explicitly links the C++
@@ -521,6 +522,10 @@ config("release_crt") {
}
} else {
cflags = [ "/MT" ]
+
+ # /MT specifies libcmt.lib as the CRT library, which is the static+release
+ # version. Rust needs to agree, so we tell it to use the static+release CRT
+ # as well. See https://github.com/rust-lang/rust/issues/39016.
rustflags = [ "-Ctarget-feature=+crt-static" ]
if (use_custom_libcxx) {
@@ -534,18 +539,13 @@ config("dynamic_crt") {
# This pulls in the DLL debug CRT and defines _DEBUG
cflags = [ "/MDd" ]
- # /MDd specifies msvcrtd.lib as the CRT library. Rust needs to agree, so
- # we specify it explicitly.
- # Once https://github.com/rust-lang/rust/issues/39016 is resolved we should
- # instead tell rustc which CRT to use (static/dynamic + release/debug). We
- # can't support prebuilt stdlib in this path until then.
- rustflags = [ "-Clink-arg=msvcrtd.lib" ]
-
- # Disable libraries rustc links implicitly;
- # see https://github.com/rust-lang/rust/pull/122268
- rustflags += [
- "-Clink-arg=/nodefaultlib:libcmt.lib",
+ # /MDd specifies msvcrtd.lib as the CRT library. Rust needs to agree, so we
+ # specify it explicitly. Rust defaults to the dynamic+release library, which
+ # we remove here, and then replace. See
+ # https://github.com/rust-lang/rust/issues/39016.
+ rustflags = [
"-Clink-arg=/nodefaultlib:msvcrt.lib",
+ "-Clink-arg=msvcrtd.lib",
]
if (use_custom_libcxx) {
@@ -554,8 +554,9 @@ config("dynamic_crt") {
} else {
cflags = [ "/MD" ]
- # The - in front of crt-static turns the feature off.
- rustflags = [ "-Ctarget-feature=-crt-static" ]
+ # /MD specifies msvcrt.lib as the CRT library, which is the dynamic+release
+ # version. Rust needs to agree, and its default mode is dynamic+release, so
+ # we do nothing here. See https://github.com/rust-lang/rust/issues/39016.
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:msvcprt.lib" ]
@@ -568,18 +569,14 @@ config("static_crt") {
# This pulls in the static debug CRT and defines _DEBUG
cflags = [ "/MTd" ]
- # /MTd specifies libcmtd.lib as the CRT library. Rust needs to agree, so
- # we specify it explicitly.
- # Once https://github.com/rust-lang/rust/issues/39016 is resolved we should
- # instead tell rustc which CRT to use (static/dynamic + release/debug). We
- # can't support prebuilt stdlib in this path until then.
- rustflags = [ "-Clink-arg=libcmtd.lib" ]
-
- # Disable libraries rustc links implicitly;
- # see https://github.com/rust-lang/rust/pull/122268
- rustflags += [
+ # /MTd specifies libcmtd.lib as the CRT library. Rust needs to agree, so we
+ # specify it explicitly. We tell Rust that we're using the static CRT but
+ # remove the release library that it chooses, and replace with the debug
+ # library. See https://github.com/rust-lang/rust/issues/39016.
+ rustflags = [
+ "-Ctarget-feature=+crt-static",
"-Clink-arg=/nodefaultlib:libcmt.lib",
- "-Clink-arg=/nodefaultlib:msvcrt.lib",
+ "-Clink-arg=libcmtd.lib",
]
if (use_custom_libcxx) {
@@ -587,6 +584,10 @@ config("static_crt") {
}
} else {
cflags = [ "/MT" ]
+
+ # /MT specifies libcmt.lib as the CRT library, which is the static+release
+ # version. Rust needs to agree, so we tell it to use the static+release CRT
+ # as well. See https://github.com/rust-lang/rust/issues/39016.
rustflags = [ "-Ctarget-feature=+crt-static" ]
if (use_custom_libcxx) {