mirror of
https://abf.rosa.ru/djam/chromium-browser-stable.git
synced 2025-02-24 15:12:49 +00:00
82 lines
3.8 KiB
Diff
82 lines
3.8 KiB
Diff
This patch allows us to use LLVM's gold linker on Linux.
|
|
|
|
This patch partly reverts https://chromium.googlesource.com/chromium/src.git/+/0f268cb3af337cf608bd1902148a84195837ad1b%5E%21/
|
|
Also see https://bugs.chromium.org/p/chromium/issues/detail?id=607968 around comment №100.
|
|
I did not understand why the gold linker was disallowed on Linux, it was allowed beforehand.
|
|
|
|
After commit https://chromium.googlesource.com/chromium/src/+/dd160677bc6cd8a5ab468c187f61902a8fbf4b41%5E%21
|
|
use_lld was forced to True on x86_64 even if use_gold was True. On i586 gold was used correctly. Trying to workaround it.
|
|
|
|
this patch temporarily breaks building with use+ldd=true because it forces use_ldd=false and use_gold=true.
|
|
|
|
Author: Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
|
|
--- a/build/config/compiler/BUILD.gn 2018-10-20 12:45:09.760295019 +0300
|
|
+++ b/build/config/compiler/BUILD.gn 2018-10-20 12:51:07.536125696 +0300
|
|
@@ -588,8 +588,7 @@
|
|
# TODO(pcc): Make this conditional on is_official_build rather than on gn
|
|
# flags for specific features.
|
|
if (!is_debug && use_thin_lto && current_toolchain == default_toolchain) {
|
|
- assert(use_lld || target_os == "chromeos",
|
|
- "gold plugin only supported with ChromeOS")
|
|
+ assert(use_lld, "gold plugin cannot be used with lld linker")
|
|
|
|
cflags += [ "-flto=thin" ]
|
|
|
|
--- a/build/config/compiler/compiler.gni 2018-10-21 02:15:50.290369454 +0300
|
|
+++ b/build/config/compiler/compiler.gni 2018-10-21 12:38:18.521273343 +0300
|
|
@@ -63,6 +63,12 @@
|
|
# It's currently not possible to collect AFDO profiles on anything but
|
|
# x86{,_64}.
|
|
using_mismatched_sample_profile = current_cpu != "x64" && current_cpu != "x86"
|
|
+
|
|
+ # ROSA-allow-Gold-on-Linux.patch patches out some code for setting these variables,
|
|
+ # so we have to set them manually
|
|
+ use_lld = false
|
|
+ use_gold = true
|
|
+
|
|
}
|
|
|
|
assert(!is_cfi || use_thin_lto, "CFI requires ThinLTO")
|
|
@@ -157,30 +163,6 @@
|
|
}
|
|
}
|
|
|
|
-declare_args() {
|
|
- # Set to true to use lld, the LLVM linker. This flag may be used on Windows,
|
|
- # Linux or Fuchsia.
|
|
- # TODO(pcc): Enable lld on more architectures on Linux. E.g. we probably need
|
|
- # to fix some of crbug.com/742655 to enable it on ARM.
|
|
- use_lld =
|
|
- is_clang &&
|
|
- (is_win || is_fuchsia || (use_thin_lto && target_os != "chromeos") ||
|
|
- (is_linux && current_cpu == "x64" && target_os != "chromeos") ||
|
|
- (is_android && (current_cpu != "arm" || arm_version >= 7) &&
|
|
- current_cpu != "mipsel" && current_cpu != "mips64el"))
|
|
-}
|
|
-
|
|
-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 == "mipsel" ||
|
|
- current_cpu == "mips64el")) ||
|
|
- (is_android && (current_cpu == "x86" || current_cpu == "x64" ||
|
|
- current_cpu == "arm" || current_cpu == "arm64")))
|
|
-}
|
|
-
|
|
# If it wasn't manually set, set to an appropriate default.
|
|
assert(symbol_level >= -1 && symbol_level <= 2, "Invalid symbol_level")
|
|
if (symbol_level == -1) {
|
|
|
|
--- a/build/config/compiler/BUILD.gn 2018-10-21 01:41:30.065502783 +0300
|
|
+++ b/build/config/compiler/BUILD.gn 2018-10-21 21:33:10.465382423 +0300
|
|
@@ -588,8 +588,6 @@
|
|
# TODO(pcc): Make this conditional on is_official_build rather than on gn
|
|
# flags for specific features.
|
|
if (!is_debug && use_thin_lto && current_toolchain == default_toolchain) {
|
|
- assert(use_lld, "gold plugin cannot be used with lld linker")
|
|
-
|
|
cflags += [ "-flto=thin" ]
|
|
|
|
# Limit the size of the ThinLTO cache to the lesser of 10% of available disk
|