summarylogtreecommitdiffstats
path: root/02.lto.patch
diff options
context:
space:
mode:
Diffstat (limited to '02.lto.patch')
-rw-r--r--02.lto.patch20
1 files changed, 20 insertions, 0 deletions
diff --git a/02.lto.patch b/02.lto.patch
new file mode 100644
index 000000000000..eb611f431acb
--- /dev/null
+++ b/02.lto.patch
@@ -0,0 +1,20 @@
+--- makepkg-optimize
++++ makepkg-optimize
+@@ -866,6 +866,17 @@ run_build() {
+ export DISTCC_HOSTS
+ fi
+
++ # Use lto if it is requested (check buildenv and PKGBUILD opts)
++ if check_buildoption "lto" "y" && [[ -f "$(gcc -print-search-dirs | grep install | awk '{print $2 "liblto_plugin.so"}')" ]]; then
++ CFLAGS+=" -flto=$(getconf _NPROCESSORS_ONLN)"
++ CXXFLAGS+=" -flto=$(getconf _NPROCESSORS_ONLN)"
++ LDFLAGS+=" $CFLAGS $CXXFLAGS -Wl,-fuse-linker-plugin"
++ LTOPLUGIN="$(gcc -print-search-dirs | grep install | awk '{print $2 "liblto_plugin.so"}')"
++ ARFLAGS+=" --plugin $LTOPLUGIN"
++ RANLIBFLAGS+=" --plugin $LTOPLUGIN"
++ NMFLAGS+=" --plugin $LTOPLUGIN"
++ fi
++
+ run_function_safe "build"
+ }
+