contrib/rpm: enable LTO by default on Fedora 33

With Fedora 33, LTO will be enabled by default via CFLAGS in
redhat-rpm-config ([1]).

That basically sets "CFLAGS=-flto -ffat-lto-objects".

Note that we have our own configure/meson option to enable LTO.
With "--with-lto" we set CFLAGS="-flto -flto-partition=none". This
is necessary due ([2], [3]).

So, disable Fedora's automatism, but turn on the suitable configure
option to get working LTO.

[1] 5baaf4a99c?branch=master
[2] e6cf4213a7 ('build: fix building with LTO')
[3] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48200#c28
This commit is contained in:
Thomas Haller 2020-08-12 11:42:54 +02:00
parent 407a1f1e98
commit 839ba57c7f
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -59,7 +59,11 @@
%bcond_without regen_docs
%bcond_with debug
%bcond_with test
%if 0%{?fedora} >= 33
%bcond_without lto
%else
%bcond_with lto
%endif
%bcond_with sanitizer
%if 0%{?fedora}
%bcond_without connectivity_fedora
@ -134,6 +138,11 @@
%global ebpf_enabled "no"
%endif
# Fedora 33 enables LTO by default by setting CFLAGS="-flto -ffat-lto-objects".
# However, we also require "-flto -flto-partition=none", so disable Fedora's
# default and use our configure option --with-lto instead.
%define _lto_cflags %{nil}
###############################################################################
Name: NetworkManager