diff --git a/_constraints b/_constraints
index 8484de9..6943267 100644
--- a/_constraints
+++ b/_constraints
@@ -8,4 +8,14 @@
8
+
+
+ x86_64
+
+
+
+ 16
+
+
+
diff --git a/chromium.changes b/chromium.changes
index 3ddd0c0..1526a5d 100644
--- a/chromium.changes
+++ b/chromium.changes
@@ -1,3 +1,9 @@
+-------------------------------------------------------------------
+Tue Jul 2 08:55:22 UTC 2019 - Martin Liška
+
+- Enable LTO for x86_64 - add gcc-enable-lto.patch and
+ gcc-lto-rsp-clobber.patch patches.
+
-------------------------------------------------------------------
Tue Jul 2 07:35:44 UTC 2019 - Tomáš Chvátal
diff --git a/chromium.spec b/chromium.spec
index 6d7b6bd..5d5271e 100644
--- a/chromium.spec
+++ b/chromium.spec
@@ -47,6 +47,15 @@
%bcond_with system_vpx
%bcond_with clang
%bcond_with wayland
+%ifarch x86_64
+%if %{?suse_version} > 1500
+%bcond_without lto
+%else
+%bcond_with lto
+%endif
+%else
+%bcond_with lto
+%endif
Name: chromium
Version: 75.0.3770.100
Release: 0
@@ -84,6 +93,8 @@ Patch12: chromium-skia-aarch64-buildfix.patch
Patch13: chromium-gcc.patch
Patch14: chromium-75.0.3770.80-SIOCGSTAMP.patch
Patch15: chromium-75.0.3770.80-pure-virtual-crash-fix.patch
+Patch16: gcc-lto-rsp-clobber.patch
+Patch17: gcc-enable-lto.patch
# Google seem not too keen on merging this but GPU accel is quite important
# https://chromium-review.googlesource.com/c/chromium/src/+/532294
# https://github.com/saiarcot895/chromium-ubuntu-build/tree/master/debian/patches
@@ -510,6 +521,9 @@ export CXX=clang++
ARCH_FLAGS="`echo %{optflags} | sed -e 's/^-g / /g' -e 's/ -g / /g' -e 's/ -g$//g'`"
export CFLAGS="${ARCH_FLAGS} -fpermissive"
export CXXFLAGS="${ARCH_FLAGS} -fpermissive"
+%if %{with lto}
+export LDFLAGS="%{_lto_cflags}"
+%endif
export CC=gcc
export CXX=g++
%if 0%{?suse_version} <= 1500
@@ -631,6 +645,9 @@ myconf_gn+=" is_clang=true clang_base_path=\"/usr\" clang_use_chrome_plugins=fal
%else
myconf_gn+=" is_clang=false"
%endif
+%if %{with lto}
+myconf_gn+=" gcc_lto=true"
+%endif
# The proprietary codecs just force the chromium to say they can use it and
# offload the actual computation to the ffmpeg, otherwise the chromium
diff --git a/gcc-enable-lto.patch b/gcc-enable-lto.patch
index b21645e..d54c354 100644
--- a/gcc-enable-lto.patch
+++ b/gcc-enable-lto.patch
@@ -1,17 +1,17 @@
-Index: chromium-120.0.6099.18/build/config/BUILDCONFIG.gn
-===================================================================
---- chromium-120.0.6099.18.orig/build/config/BUILDCONFIG.gn
-+++ chromium-120.0.6099.18/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.
+diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
+index 7175865b3..d345f6ff9 100644
+--- a/build/config/BUILDCONFIG.gn
++++ b/build/config/BUILDCONFIG.gn
+@@ -130,6 +130,8 @@ declare_args() {
+ # separate flags.
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 = [
+ # Whether we're a traditional desktop unix.
+ is_desktop_linux = current_os == "linux"
+
+@@ -440,6 +442,12 @@ default_compiler_configs = [
"//build/config/sanitizers:default_sanitizer_flags",
]
@@ -23,13 +23,13 @@ Index: chromium-120.0.6099.18/build/config/BUILDCONFIG.gn
+
if (is_win) {
default_compiler_configs += [
- "//build/config/win:default_cfg_compiler",
-Index: chromium-120.0.6099.18/build/config/compiler/BUILD.gn
-===================================================================
---- chromium-120.0.6099.18.orig/build/config/compiler/BUILD.gn
-+++ chromium-120.0.6099.18/build/config/compiler/BUILD.gn
-@@ -2342,6 +2342,10 @@ if (is_win) {
- common_optimize_on_cflags += [ "-fno-math-errno" ]
+ "//build/config/win:default_crt",
+diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
+index 4b24c762b..7da01887a 100644
+--- a/build/config/compiler/BUILD.gn
++++ b/build/config/compiler/BUILD.gn
+@@ -1921,6 +1921,10 @@ if (is_win) {
+ }
}
+config("gcc_lto") {
@@ -37,34 +37,17 @@ Index: chromium-120.0.6099.18/build/config/compiler/BUILD.gn
+}
+
config("default_stack_frames") {
- if (!is_win) {
+ if (is_posix || is_fuchsia) {
if (enable_frame_pointers) {
-Index: chromium-120.0.6099.18/sandbox/linux/BUILD.gn
-===================================================================
---- chromium-120.0.6099.18.orig/sandbox/linux/BUILD.gn
-+++ chromium-120.0.6099.18/sandbox/linux/BUILD.gn
-@@ -253,6 +253,9 @@ component("seccomp_bpf") {
+diff --git a/sandbox/linux/BUILD.gn b/sandbox/linux/BUILD.gn
+index b00a88cfa..db01e988a 100644
+--- a/sandbox/linux/BUILD.gn
++++ b/sandbox/linux/BUILD.gn
+@@ -256,6 +256,7 @@ component("seccomp_bpf") {
"//base",
- "//sandbox:sandbox_buildflags",
+ "//base/third_party/dynamic_annotations",
]
-+ if (gcc_lto) {
-+ configs -= [ "//build/config/compiler:gcc_lto" ]
-+ }
++ configs -= [ "//build/config/compiler:gcc_lto" ]
- if (is_android) {
- sources += [
-Index: chromium-120.0.6099.18/base/BUILD.gn
-===================================================================
---- chromium-120.0.6099.18.orig/base/BUILD.gn
-+++ chromium-120.0.6099.18/base/BUILD.gn
-@@ -3561,6 +3561,10 @@
- sources += [ "location_unittest.cc" ]
- }
-
-+ if (gcc_lto) {
-+ configs -= [ "//build/config/compiler:gcc_lto" ]
-+ }
-+
- if (!is_nacl) {
- sources += [
- "containers/span_rust_unittest.cc",
+ if (is_nacl_nonsfi) {
+ cflags = [ "-fgnu-inline-asm" ]
diff --git a/gcc-lto-rsp-clobber.patch b/gcc-lto-rsp-clobber.patch
new file mode 100644
index 0000000..f733c28
--- /dev/null
+++ b/gcc-lto-rsp-clobber.patch
@@ -0,0 +1,13 @@
+diff --git a/third_party/lss/linux_syscall_support.h b/third_party/lss/linux_syscall_support.h
+index 5d9c2e858..e64703ba0 100644
+--- a/third_party/lss/linux_syscall_support.h
++++ b/third_party/lss/linux_syscall_support.h
+@@ -2405,7 +2405,7 @@ struct kernel_statfs {
+ "d"(LSS_SYSCALL_ARG(parent_tidptr)),
+ "r"(LSS_SYSCALL_ARG(newtls)),
+ "r"(LSS_SYSCALL_ARG(child_tidptr))
+- : "rsp", "memory", "r8", "r10", "r11", "rcx");
++ : "memory", "r8", "r10", "r11", "rcx");
+ }
+ LSS_RETURN(int, __res);
+ }