[systemd-devel] [PATCH] build-sys: add configure option to disable LTO/gold
Cristian RodrÃguez
crrodriguez at opensuse.org
Wed Feb 18 10:45:53 PST 2015
LTO may be unreliable, does not work properly in several archs
It may crash or produce wrong code.
Compiler developers also said we should not provide production
RPM packages with LTO enabled.
GOLD also does not work everywhere.
---
configure.ac | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
index 9a2235b..38194ca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -207,10 +207,15 @@ AS_CASE([$CC], [*clang*],
-Wno-gnu-variable-sized-type-not-at-end \
])])
-AS_CASE([$CFLAGS], [*-O[[12345\ ]]*],
- [CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
- -flto -ffat-lto-objects])],
- [AC_MSG_RESULT([skipping -flto, optimization not enabled])])
+AC_ARG_ENABLE([lto], AS_HELP_STRING([--disable-lto], [Disable Link time optimization]))
+AS_IF([test "x$enable_lto" != "xno"], [
+AS_CASE([$CFLAGS], [*-O[[12345\ ]]*], [
+ CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [-flto -ffat-lto-objects])
+ CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS],[-Wl,-fuse-ld=gold])
+ ],
+[AC_MSG_RESULT([skipping -flto, optimization not enabled])])
+])
+
AC_SUBST([OUR_CFLAGS], "$with_cflags $sanitizer_cflags")
AS_CASE([$CFLAGS], [*-O[[12345\ ]]*],
@@ -226,7 +231,7 @@ CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
-Wl,-z,relro \
-Wl,-z,now \
-pie \
- -Wl,-fuse-ld=gold])
+ ])
AC_SUBST([OUR_LDFLAGS], "$with_ldflags $sanitizer_ldflags")
AC_CHECK_SIZEOF(pid_t)
--
2.3.0
More information about the systemd-devel
mailing list