chiark / gitweb /
build-sys: accommodate gcc-4.9.0 link-time optimization (LTO) changes
authorJohn <jpsinthemix@verizon.net>
Wed, 4 Jun 2014 15:45:42 +0000 (17:45 +0200)
committerKay Sievers <kay@vrfy.org>
Wed, 4 Jun 2014 15:47:20 +0000 (17:47 +0200)
systemd fails to build (symbols not found/resolved during cgls link step)
under gcc-4.9.0 due to link-time optimization (lto) changes, in particular
from gcc-4.9.0/NEWS:

  + When using a linker plugin, compiling with the -flto option
    now generates slim objects files (.o) which only contain
    intermediate language representation for LTO. Use
    -ffat-lto-objects to create files which contain additionally
    the object code. To generate static libraries suitable for LTO
    processing, use gcc-ar and gcc-ranlib; to list symbols from a
    slim object file use gcc-nm. (Requires that ar, ranlib and nm
    have been compiled with plugin support.)

Both -flto and -ffat-lto-objects are now needed when building and linking
against static libs w/LTO.

configure.ac

index 6ee4d5fed181d40ac2ae46982086e8cd49a428c4..3252e65c989221ed85d34051c41a676357fb35bb 100644 (file)
@@ -178,7 +178,7 @@ CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
         --param=ssp-buffer-size=4])
 AS_CASE([$CFLAGS], [*-O[[12345\ ]]*],
         [CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
-               -flto])],
+               -flto -ffat-lto-objects])],
         [AC_MSG_RESULT([skipping -flto, optimization not enabled])])
 AC_SUBST([OUR_CFLAGS], "$with_cflags $sanitizer_cflags")