[Bug general/24498] 0.176: isn't LTO ready

kloczko.tomasz at gmail dot com sourceware-bugzilla@sourceware.org
Wed Apr 15 15:53:17 GMT 2020


https://sourceware.org/bugzilla/show_bug.cgi?id=24498

--- Comment #14 from kloczek <kloczko.tomasz at gmail dot com> ---
> Sorry, but what are the clto_cflags and lto_ldflags precisely? And we now (also) have some c++ code for the debuginfod server, which I assume needs some CXXFLAGS too?


Here is example from my own build environment.
Below macro is used by %meso, %configure, %cmake and few other.
Only changing that macro it is possible to control LTO and other things 100%
transparently without touching any rpm spec file, or build framework tooling.

$ rpm -E %set_build_flags

        export CFLAGS="${CFLAGS:--O2 -g -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong
-grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
-flto=auto -flto-partition=none}";
        export CXXFLAGS="${CXXFLAGS:--O2 -g -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong
-grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
-flto=auto -flto-partition=none}";
        export FFLAGS="${FFLAGS:--O2 -g -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong
-grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
-I/usr/lib64/gfortran/modules -flto=auto -flto-partition=none}";
        export FCFLAGS="${FCFLAGS:--O2 -g -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong
-grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
-I/usr/lib64/gfortran/modules -flto=auto -flto-partition=none}";
        export LDFLAGS="${LDFLAGS:--Wl,-z,relro -Wl,--as-needed  -Wl,-z,now
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto=auto -flto-partition=none
-fuse-linker-plugin}";
        export AR="/usr/bin/gcc-ar" RANLIB="/usr/bin/gcc-ranlib"
NM="/usr/bin/gcc-nm";
        export CC="gcc" CXX="g++"

I can change as well from GCC to CLang without changes in any build framework
or rpm spec file.

So again: things like LTO, PGO and any even any future optimizations should be
NEVER EVER implemented in build frameworks because all currently available
frameworks are using above env variables.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Elfutils-devel mailing list