LTO: Add -flto to LDFLAGS for clang

Message ID 20211224080035.1203489-1-allan@archlinux.org
State New
Headers show
Series LTO: Add -flto to LDFLAGS for clang | expand

Commit Message

Allan McRae Dec. 24, 2021, 8 a.m. UTC
GCC automatically detects when it is linking LTO objects, but clang does
not.  Add -flto to LDFLAGS to make this work for clang too.

Signed-off-by: Allan McRae <allan@archlinux.org>
---
 scripts/libmakepkg/buildenv/lto.sh.in | 1 +
 1 file changed, 1 insertion(+)

Patch

diff --git a/scripts/libmakepkg/buildenv/lto.sh.in b/scripts/libmakepkg/buildenv/lto.sh.in
index 1f1ca53f..c3bd0fa4 100644
--- a/scripts/libmakepkg/buildenv/lto.sh.in
+++ b/scripts/libmakepkg/buildenv/lto.sh.in
@@ -33,5 +33,6 @@  buildenv_lto() {
 	if check_option "lto" "y"; then
 		CFLAGS+=" -flto"
 		CXXFLAGS+=" -flto"
+		LDFLAGS+=" -flto"
 	fi
 }