From c9e822b1544ac198e8b30a119caa3c6261d1c304 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Fri, 10 Jan 2025 13:58:39 +0100 Subject: [PATCH] Use test map for checking --version-script, instead of full map Various problems can occur when using the full `xkbcommon.map` file when checking whether the `--version-script` linker option works in `meson.build`. For instance, newer linkers typically complain about non-existing symbols, so in commit ebe4157 `--undefined-version` was added to work around that. But then in commit 1d8a25d6 another workaround needed to be added for older linkers. It is better to use a minimalistic linker script for testing instead. The other workarounds can then be removed. --- meson.build | 8 +------- meson_test.map | 1 + 2 files changed, 2 insertions(+), 7 deletions(-) create mode 100644 meson_test.map diff --git a/meson.build b/meson.build index 51a6d342..496aa36b 100644 --- a/meson.build +++ b/meson.build @@ -163,15 +163,9 @@ configh_data.set('WIN32_LEAN_AND_MEAN', 1) xkbcommon_map = meson.current_source_dir() / 'xkbcommon.map' -# Supports -Wl,--version-script? -if cc.has_link_argument('-Wl,--undefined-version') - extra_linker_args = ',--undefined-version' -else - extra_linker_args = '' -endif have_version_script = cc.links( 'int main(){}', - args: f'-Wl,--version-script=@xkbcommon_map@@extra_linker_args@', + args: '-Wl,--version-script=' + meson.current_source_dir()/'meson_test.map', name: '-Wl,--version-script', ) diff --git a/meson_test.map b/meson_test.map new file mode 100644 index 00000000..5f3049af --- /dev/null +++ b/meson_test.map @@ -0,0 +1 @@ +TEST {};