summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO2
-rw-r--r--PKGBUILD2
-rw-r--r--lto.sh.in25
3 files changed, 22 insertions, 7 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 5e689914f94..63f4de8ec8d 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -36,7 +36,7 @@ pkgbase = makepkg-optimize
source = pkgopts-param_ext.conf
source = compress-param_max.conf
sha1sums = 8f756d02ad1dae9dfbe79e414e557fe96e037549
- sha1sums = 4078b286395e17bbcfbd14244ab48bbfce24988d
+ sha1sums = eee6514ff7abda04755fa04cbc1a4150e14d605e
sha1sums = 6b719a47146aedae186a7e63b6058507c4948d9f
sha1sums = cee5912314c1b84b76f4400a6405cdc224c01828
sha1sums = e8358ced786a996a5763faa42f3541900b86647e
diff --git a/PKGBUILD b/PKGBUILD
index 9378c7fdd29..2275950fdb5 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -22,7 +22,7 @@ source=(${_buildenv[@]}
${_tidy[@]}
${_conf[@]})
sha1sums=('8f756d02ad1dae9dfbe79e414e557fe96e037549'
- '4078b286395e17bbcfbd14244ab48bbfce24988d'
+ 'eee6514ff7abda04755fa04cbc1a4150e14d605e'
'6b719a47146aedae186a7e63b6058507c4948d9f'
'cee5912314c1b84b76f4400a6405cdc224c01828'
'e8358ced786a996a5763faa42f3541900b86647e'
diff --git a/lto.sh.in b/lto.sh.in
index f22af90129b..1bff9ebd50a 100644
--- a/lto.sh.in
+++ b/lto.sh.in
@@ -10,14 +10,29 @@ LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
source "$LIBRARY/util/option.sh"
-build_options+=('lto')
+build_options+=('lto' 'lto-thin')
buildenv_functions+=('buildenv_lto')
buildenv_lto() {
- 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+=" -fuse-linker-plugin"
+ if [ check_buildoption "lto" "y" || check_buildoption "lto-thin" "y" ] && \
+ [[ -f "$(gcc -print-search-dirs | grep install | awk '{print $2 "liblto_plugin.so"}')" ]]; then
+ [[ "$CC" == "clang" ]] && \
+ CFLAGS+=" -flto" || \
+ CFLAGS+=" -flto=$(getconf _NPROCESSORS_ONLN) -flto-partition=none -fno-fat-lto-objects"
+ [[ "$CXX" == "clang++" ]] && \
+ CXXFLAGS+=" -flto" || \
+ CXXFLAGS+=" -flto=$(getconf _NPROCESSORS_ONLN) -flto-partition=none -fno-fat-lto-objects"
+
+ if check_buildoption "lto-thin" "y"; then
+ [[ "$CC" == "clang" ]] && \
+ CFLAGS="${CFLAGS// -flto / -flto=thin }" || \
+ CFLAGS="${CFLAGS// -flto-partition=none / }"
+ [[ "$CXX" == "clang++" ]] && \
+ CXXFLAGS="${CXXFLAGS// -flto / -flto=thin }" || \
+ CXXFLAGS="${CXXFLAGS// -flto-partition=none / }"
+ fi
+
+ LDFLAGS+=" -fuse-linker-plugin $CFLAGS $CXXFLAGS"
LTOPLUGIN="$(gcc -print-search-dirs | grep install | awk '{print $2 "liblto_plugin.so"}')"
ARFLAGS+=" --plugin $LTOPLUGIN"
RANLIBFLAGS+=" --plugin $LTOPLUGIN"