build: remove -flto-partition=none when building with GCC
Older versions of GCC (< 12) have issues building NM with LTO because they drop libnm symbols added via '_asm__(".symver " ...)', which we use to support symbols backported to older versions of the DSO. Nowadays, GCC supports a new "__symver__" attribute that is LTO-friendly; use that when possible and remove the -flto-partition=none hack, as it increases memory usage when compiling. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1714 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2142
This commit is contained in:
12
meson.build
12
meson.build
@@ -173,13 +173,13 @@ 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)
|
||||
cc_version = cc.version()
|
||||
if cc.get_id() == 'clang'
|
||||
if cc_version <= '18.0.0'
|
||||
error('Clang version should be greater than 18.0.0, got : ' + cc_version)
|
||||
endif
|
||||
else
|
||||
# Meson already adds '-flto'
|
||||
elif cc_version < '12.0'
|
||||
# GCC < 12 breaks libnm symbol versioning with LTO, use workarounds
|
||||
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
|
||||
|
Reference in New Issue
Block a user