diff --git a/changes/build/481.bugfix.md b/changes/build/481.bugfix.md index 07900ec40..14e7acbc6 100644 --- a/changes/build/481.bugfix.md +++ b/changes/build/481.bugfix.md @@ -1,2 +1 @@ -Gated the use of `--undefined-version` in the linker because it breaks on older -GNU `ld`. +Make the test of `-Wl,--version-script` more robust. diff --git a/meson.build b/meson.build index 51a6d342c..3a2a385d1 100644 --- a/meson.build +++ b/meson.build @@ -164,14 +164,10 @@ 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 +meson_test_map = meson.current_source_dir() / 'test/meson_test.map' have_version_script = cc.links( - 'int main(){}', - args: f'-Wl,--version-script=@xkbcommon_map@@extra_linker_args@', + 'int main() { return 0; }', + args: f'-Wl,--version-script=@meson_test_map@', name: '-Wl,--version-script', ) diff --git a/test/meson_test.map b/test/meson_test.map new file mode 100644 index 000000000..7d8590ff3 --- /dev/null +++ b/test/meson_test.map @@ -0,0 +1,6 @@ +VERSION_1 { + global: + main; + local: + *; +};