From 35b76b7ca78bae25af722eb8ffd050424bf40a9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Tue, 11 Feb 2025 16:27:27 +0100 Subject: [PATCH] build: remove -flto-partition=none As reported in https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1714, it was added to workaround a bug in GCC. That bug was fixed long ago thus this option is no longer needed. Moreover, it increases the memory usage during the build and we are geting some failures when building in ppc64 systems that we suspect are due to memory exhaustion. Fixes https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1714 --- contrib/fedora/rpm/NetworkManager.spec | 5 ----- meson.build | 16 ++++------------ 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/contrib/fedora/rpm/NetworkManager.spec b/contrib/fedora/rpm/NetworkManager.spec index 2af0f44602..6e1a1e0d24 100644 --- a/contrib/fedora/rpm/NetworkManager.spec +++ b/contrib/fedora/rpm/NetworkManager.spec @@ -164,11 +164,6 @@ %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 diff --git a/meson.build b/meson.build index 4f6d14da9a..335a7348ee 100644 --- a/meson.build +++ b/meson.build @@ -172,18 +172,10 @@ if enable_ld_gc endif enable_lto = get_option('b_lto') -if enable_lto - if cc.get_id() == 'clang' - clang_version = cc.version() - if clang_version <= '18.0.0' - error('Clang version should be greater then 18.0.0 got : ' + clang_version) - endif - else - # Meson already adds '-flto' - lto_flag = '-flto-partition=none' - assert(cc.has_argument(lto_flag), '-flto-partition=none not supported. Disable link-time optimization with -Db_lto=false.') - common_flags += lto_flag - common_ldflags += lto_flag +if enable_lto and cc.get_id() == 'clang' + clang_version = cc.version() + if clang_version <= '18.0.0' + error('Clang version should be greater then 18.0.0 got : ' + clang_version) endif endif