Skip to content

Commit

Permalink
Reland "Remove third_party/binutils""
Browse files Browse the repository at this point in the history
This is a reland of 9792bfb
Should work once https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2183291
has rolled in https://chromium-review.googlesource.com/c/chromium/src/+/2185229

Original change's description:
> Remove third_party/binutils"
>
> R=thakis
> CC=thestig
>
> Bug: 1067854
> Change-Id: I5e20c17210111c2f2c74888f45f4eb72172bca94
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2181970
> Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
> Commit-Queue: Ben Pastene <bpastene@chromium.org>
> Auto-Submit: Thomas Anderson <thomasanderson@chromium.org>
> Reviewed-by: Ben Pastene <bpastene@chromium.org>
> Reviewed-by: Nico Weber <thakis@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#765766}

Bug: 1067854
Change-Id: I21e3491a0d8302c35836ca4c12b84100a6308d41
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2184772
Reviewed-by: Thomas Anderson <thomasanderson@chromium.org>
Reviewed-by: Ben Pastene <bpastene@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#766143}
  • Loading branch information
tanderson-google authored and Commit Bot committed May 6, 2020
1 parent 1af8562 commit 9869e86
Show file tree
Hide file tree
Showing 18 changed files with 20 additions and 799 deletions.
1 change: 0 additions & 1 deletion .gn
Expand Up @@ -340,7 +340,6 @@ check_targets = [
"//third_party/ashmem/*",
"//third_party/axe-core/*",
"//third_party/bazel/*",
"//third_party/binutils/*",
"//third_party/blanketjs/*",

# "//third_party/blink/*", # Errors: https://crbug.com/800764
Expand Down
12 changes: 0 additions & 12 deletions DEPS
Expand Up @@ -4069,18 +4069,6 @@ hooks = [
'condition': 'checkout_mac',
'action': ['python', 'src/build/mac_toolchain.py'],
},
# Pull binutils for linux, enabled debug fission for faster linking /
# debugging when used with clang on Ubuntu Precise.
# https://code.google.com/p/chromium/issues/detail?id=352046
{
'name': 'binutils',
'pattern': 'src/third_party/binutils',
'condition': 'host_os == "linux" and host_cpu != "mips64"',
'action': [
'python',
'src/third_party/binutils/download.py',
],
},
{
# Update the prebuilt clang toolchain.
# Note: On Win, this should run after win_toolchain, as it may use it.
Expand Down
53 changes: 15 additions & 38 deletions build/config/compiler/BUILD.gn
Expand Up @@ -62,7 +62,7 @@ declare_args() {

# 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 = false
gold_path = ""

# Enable fatal linker warnings. Building Chromium with certain versions
# of binutils can cause linker warning.
Expand Down Expand Up @@ -155,30 +155,15 @@ declare_args() {
#
# icf=all is broken in older golds, see
# https://sourceware.org/bugzilla/show_bug.cgi?id=17704
# See also https://crbug.com/663886
# `linux_use_bundled_binutils` is to avoid breaking Linux distros which may
# still have a buggy gold.
# 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 && !(is_android && use_order_profiling) &&
(use_lld ||
(use_gold &&
((!is_android && linux_use_bundled_binutils) || is_chromeos ||
!(current_cpu == "x86" || current_cpu == "x64"))))
}

# Apply the default logic for these values if they were not set explicitly.
if (gold_path == false) {
if (use_gold) {
gold_path = rebase_path("//third_party/binutils/Linux_x64/Release/bin",
root_build_dir)
} else {
gold_path = ""
}
(use_lld || (use_gold && (is_chromeos || !(current_cpu == "x86" ||
current_cpu == "x64"))))
}

if (use_debug_fission == "default") {
Expand Down Expand Up @@ -420,19 +405,19 @@ config("compiler") {
# 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.
ldflags += [ "-B$gold_path" ]

if (linux_use_bundled_binutils) {
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",
]
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.
Expand All @@ -441,20 +426,12 @@ config("compiler") {
# "-Wl,--detect-odr-violations",
# ]
#}
} else if (linux_use_bundled_binutils) {
# Gold is the default linker for the bundled binutils so we explicitly
# enable the bfd linker when use_gold is not set.
ldflags += [ "-fuse-ld=bfd" ]
}

if (use_icf) {
ldflags += [ "-Wl,--icf=all" ]
}

if (linux_use_bundled_binutils) {
cflags += [ "-B$binutils_path" ]
}

if (is_linux) {
cflags += [ "-pthread" ]
# Do not use the -pthread ldflag here since it becomes a no-op
Expand Down
10 changes: 0 additions & 10 deletions build/config/compiler/compiler.gni
Expand Up @@ -42,16 +42,6 @@ declare_args() {
# example, don't omit the frame pointer and leave in symbols.
enable_profiling = false

# Whether to use the binary binutils checked into third_party/binutils.
# These are not multi-arch so cannot be used except on x86 and x86-64 (the
# only two architectures that are currently checked in). Turn this off when
# you are using a custom toolchain and need to control -B in cflags.
linux_use_bundled_binutils =
linux_use_bundled_binutils_override && is_linux &&
(current_cpu == "x64" || current_cpu == "x86")
binutils_path = rebase_path("//third_party/binutils/Linux_x64/Release/bin",
root_build_dir)

# use_debug_fission: whether to use split DWARF debug info
# files. This can reduce link time significantly, but is incompatible
# with some utilities such as icecc and ccache. Requires gold and
Expand Down
8 changes: 4 additions & 4 deletions build/toolchain/cros_toolchain.gni
Expand Up @@ -55,8 +55,8 @@ declare_args() {
cros_host_cc = "${clang_base_path}/bin/clang"
cros_host_cxx = "${clang_base_path}/bin/clang++"
cros_host_is_clang = true
cros_host_nm = "${binutils_path}/nm"
cros_host_readelf = "${binutils_path}/readelf"
cros_host_nm = ""
cros_host_readelf = ""
cros_host_extra_cflags = ""
cros_host_extra_cppflags = ""
cros_host_extra_cxxflags = ""
Expand All @@ -67,8 +67,8 @@ declare_args() {
cros_v8_snapshot_cc = "${clang_base_path}/bin/clang"
cros_v8_snapshot_cxx = "${clang_base_path}/bin/clang++"
cros_v8_snapshot_is_clang = true
cros_v8_snapshot_nm = "${binutils_path}/nm"
cros_v8_snapshot_readelf = "${binutils_path}/readelf"
cros_v8_snapshot_nm = ""
cros_v8_snapshot_readelf = ""
cros_v8_snapshot_extra_cflags = ""
cros_v8_snapshot_extra_cppflags = ""
cros_v8_snapshot_extra_cxxflags = ""
Expand Down
3 changes: 0 additions & 3 deletions build_overrides/build.gni
Expand Up @@ -12,9 +12,6 @@ import("//build/config/gclient_args.gni")
# Some non-Chromium builds don't support building java targets.
enable_java_templates = true

# Some non-Chromium builds don't use Chromium's third_party/binutils.
linux_use_bundled_binutils_override = true

# Allows different projects to specify their own suppressions and blacklist
# files for sanitizer tools.
# asan_suppressions_file = "path/to/asan_suppressions.cc"
Expand Down
1 change: 0 additions & 1 deletion docs/linux/build_instructions.md
Expand Up @@ -183,7 +183,6 @@ it. e.g. Intel, Opera, Samsung (this is not useful if you're using Goma).
In order to use `icecc`, set the following GN args:

```
linux_use_bundled_binutils=false
use_debug_fission=false
is_clang=false
```
Expand Down
3 changes: 1 addition & 2 deletions testing/buildbot/trybot_analyze_config.json
Expand Up @@ -85,8 +85,7 @@
"exclusions": [
"build/linux/sysroot_ld_path.sh",
"build/linux/sysroot_scripts/sysroots.json",
"testing/xvfb.py",
"third_party/binutils/Linux_x64/binutils.tar.bz2.sha1"
"testing/xvfb.py"
]
},
"win": {
Expand Down
8 changes: 0 additions & 8 deletions third_party/binutils/.gitignore

This file was deleted.

0 comments on commit 9869e86

Please sign in to comment.