[systemd-devel] [PATCH] build-sys: add configure option to disable LTO/gold
Umut Tezduyar Lindskog
umut at tezduyar.com
Thu Feb 19 00:05:12 PST 2015
For the reference, LTO doesn't work with systemd 218 on mips:
http://lists.freedesktop.org/archives/systemd-devel/2014-December/026326.html
On Wed, Feb 18, 2015 at 7:45 PM, Cristian RodrÃguez
<crrodriguez at opensuse.org> wrote:
> 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
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
More information about the systemd-devel
mailing list