mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-18 01:20:50 +01:00
build: meson: fix computing NM exported symbols
The script didn't include all the symbols needed by plugins because libNetworkManager.a, as built by meson, doesn't include symbols from other static libraries that are linked in. Since we used libNetworkManager.a to know which symbols are potentiall available from NM, the result was an incomplete list. Unfortunately, the only way to include the whole static library is to create a dependency object and use 'link_whole', but this is only available in meson >= 0.46. Since 'link_whole' is available for executables in meson >= 0.40, create a fake executable and use that to enumerate symbols. Also add tests to check that plugins can be loaded correctly. Fixes:dfa2a2b40c(cherry picked from commit19a718bc13)
This commit is contained in:
parent
fc22330c1c
commit
3711c31467
2 changed files with 32 additions and 2 deletions
|
|
@ -252,11 +252,27 @@ subdir('settings/plugins')
|
|||
create_exports_networkmanager = join_paths(meson.source_root(), 'tools', 'create-exports-NetworkManager.sh')
|
||||
symbol_map_name = 'NetworkManager.ver'
|
||||
|
||||
# libNetworkManager.a, as built by meson doesn't contain all symbols
|
||||
# from libNetworkManagerBase.a and other static libraries, unless we
|
||||
# add dependencies with link_whole, only supported in meson >= 0.46.
|
||||
# Create an executable with full symbols that we use in place of the
|
||||
# library to enumerate the symbols.
|
||||
network_manager_sym = executable(
|
||||
'nm-full-symbols',
|
||||
'main.c',
|
||||
c_args: nm_cflags,
|
||||
link_args: '-Wl,--no-gc-sections',
|
||||
dependencies: nm_deps,
|
||||
link_whole: [libnetwork_manager, libnetwork_manager_base, libnm_core],
|
||||
install: false,
|
||||
)
|
||||
|
||||
# this uses symbols from nm-full-symbols instead of libNetworkManager.a
|
||||
ver_script = custom_target(
|
||||
symbol_map_name,
|
||||
input: meson.source_root(),
|
||||
output: symbol_map_name,
|
||||
depends: [ libnetwork_manager, core_plugins ],
|
||||
depends: [ network_manager_sym, core_plugins ],
|
||||
command: [create_exports_networkmanager, '--called-from-build', '@INPUT@']
|
||||
)
|
||||
|
||||
|
|
@ -273,3 +289,12 @@ network_manager = executable(
|
|||
install: true,
|
||||
install_dir: nm_sbindir
|
||||
)
|
||||
|
||||
if enable_tests
|
||||
foreach plugin : core_plugins
|
||||
test ('sym/' + plugin.full_path().split('/')[-1],
|
||||
network_manager,
|
||||
args: '--version',
|
||||
env: ['LD_BIND_NOW=1', 'LD_PRELOAD=' + plugin.full_path()])
|
||||
endforeach
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -35,7 +35,12 @@ call_nm() {
|
|||
}
|
||||
|
||||
get_symbols_nm () {
|
||||
call_nm ./src/${libs}libNetworkManager.a |
|
||||
if [ -z "$from_meson" ]; then
|
||||
base=./src/.libs/libNetworkManager.a
|
||||
else
|
||||
base=./src/nm-full-symbols
|
||||
fi
|
||||
call_nm "$base" |
|
||||
sed -n 's/^[tTDGRBS] //p' |
|
||||
_sort
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue