[Buildroot] [PATCH v2 4/4] package/glibc: force -fno-lto

Norbert Lange nolange79 at gmail.com
Sat Oct 17 22:17:43 UTC 2020


glibc requires compilation barriers between files, and will
fail with LTO enabled.
So force LTO off by appending -fno-lto to the flags, but only
if the GCC version is recent enough that an LTO build would
be possible.

Signed-off-by: Norbert Lange <nolange79 at gmail.com>
---
 package/glibc/glibc.mk | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/package/glibc/glibc.mk b/package/glibc/glibc.mk
index 4721177d83..6d07495edc 100644
--- a/package/glibc/glibc.mk
+++ b/package/glibc/glibc.mk
@@ -67,6 +67,11 @@ ifeq ($(BR2_ENABLE_DEBUG),y)
 GLIBC_EXTRA_CFLAGS += -g
 endif
 
+# glibc explicitly requires compile barriers between files
+ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_7),y)
+GLIBC_EXTRA_CFLAGS += -fno-lto
+endif
+
 # The stubs.h header is not installed by install-headers, but is
 # needed for the gcc build. An empty stubs.h will work, as explained
 # in http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html. The same trick
-- 
2.28.0



More information about the buildroot mailing list