[systemd-devel] [PATCH] Changing configure.ac to make LTO optional.

David Herrmann dh.herrmann at gmail.com
Tue Jul 21 05:01:23 PDT 2015


Hi

On Mon, Jul 20, 2015 at 4:56 PM, Kinsella, Ray <ray.kinsella at intel.com> wrote:
> There is a bug in GCC LTO such that it ignores assembler directives.
> This patch makes LTO enabled by default but also allows it to be disabled
> if required.
>
> See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47785

This is a gcc bug. They better fix it and backport it to stable. We do
not work around bugs in other software, unless they explicitly state
why it is not fixed in stable releases. I cannot see a statement why
this bug is unhandled since _2011_.

If gcc developers reject to respond to bug-reports, why do
distributions compile gcc with LTO enabled?

Anyway, why don't you use this workaround instead:
    ./configure CFLAGS="$CFLAGS -flto=n"

*confused*
David

> ---
>  configure.ac | 17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 999f9f8..294c440 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -194,11 +194,18 @@ AS_CASE([$CC], [*clang*],
>                 -Wno-gnu-variable-sized-type-not-at-end \
>          ])])
>
> -AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
> -        [CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
> -               -flto -ffat-lto-objects])],
> -        [AC_MSG_RESULT([skipping -flto, optimization not enabled])])
> -AC_SUBST([OUR_CFLAGS], "$with_cflags $sanitizer_cflags")
> +AC_ARG_ENABLE(lto,
> +        [AS_HELP_STRING([--enable-lto], [Enable link time optimization])],
> +               enable_lto=$enableval,
> +               enable_lto=yes; default_enable_lto=yes)
> +
> +if test "x$enable_lto" != "xno"; then
> +        AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
> +                [CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
> +                    -flto -ffat-lto-objects])],
> +                [AC_MSG_RESULT([skipping -flto, optimization not enabled])])
> +        AC_SUBST([OUR_CFLAGS], "$with_cflags $sanitizer_cflags")
> +fi
>
>  AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
>          [CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\
> --
> 2.1.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