File gcc-enable-lto.patch of Package chromium.18138
Index: chromium-111.0.5563.64/build/config/BUILDCONFIG.gn
===================================================================
--- chromium-111.0.5563.64.orig/build/config/BUILDCONFIG.gn
+++ chromium-111.0.5563.64/build/config/BUILDCONFIG.gn
@@ -135,6 +135,8 @@ declare_args() {
# set "is_official_build" to true for any build intended to ship to end-users.
is_official_build = false
+ gcc_lto = false
+
# Set to true when compiling with the Clang compiler.
is_clang = current_os != "linux" ||
(current_cpu != "s390x" && current_cpu != "s390" &&
@@ -354,6 +356,12 @@ default_compiler_configs = [
"//build/config/sanitizers:default_sanitizer_flags",
]
+if (gcc_lto) {
+ default_compiler_configs += [
+ "//build/config/compiler:gcc_lto",
+ ]
+}
+
if (is_win) {
default_compiler_configs += [
"//build/config/win:default_cfg_compiler",
Index: chromium-111.0.5563.64/build/config/compiler/BUILD.gn
===================================================================
--- chromium-111.0.5563.64.orig/build/config/compiler/BUILD.gn
+++ chromium-111.0.5563.64/build/config/compiler/BUILD.gn
@@ -2079,6 +2079,10 @@ if (is_win) {
}
}
+config("gcc_lto") {
+ cflags = [ "-flto" ]
+}
+
config("default_stack_frames") {
if (!is_win) {
if (enable_frame_pointers) {
Index: chromium-111.0.5563.64/sandbox/linux/BUILD.gn
===================================================================
--- chromium-111.0.5563.64.orig/sandbox/linux/BUILD.gn
+++ chromium-111.0.5563.64/sandbox/linux/BUILD.gn
@@ -253,6 +253,9 @@ component("seccomp_bpf") {
"//build:chromeos_buildflags",
"//sandbox:sandbox_buildflags",
]
+ if (gcc_lto) {
+ configs -= [ "//build/config/compiler:gcc_lto" ]
+ }
if (is_android) {
sources += [
Index: chromium-111.0.5563.64/base/BUILD.gn
===================================================================
--- chromium-111.0.5563.64.orig/base/BUILD.gn
+++ chromium-111.0.5563.64/base/BUILD.gn
@@ -3748,6 +3748,10 @@ test("base_unittests") {
}
}
+ if (gcc_lto) {
+ configs -= [ "//build/config/compiler:gcc_lto" ]
+ }
+
if (use_partition_alloc) {
sources += [
"allocator/partition_allocator/address_pool_manager_unittest.cc",