Skip to content

Commit e68fc75

Browse files
committed
Add library specific version scripts that match enabled features
LLD is stricter with version scripts and will complain about nonexisting symbols in version files. Signed-off-by: Alfred Wingate <parona@protonmail.com>
1 parent 215b362 commit e68fc75

3 files changed

Lines changed: 23 additions & 9 deletions

File tree

src/mangohud.version

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,5 @@
33
global:
44
overlay_GetInstanceProcAddr;
55
overlay_GetDeviceProcAddr;
6-
glX*;
7-
egl*;
8-
dlsym;
9-
mangohud_find_glx_ptr;
10-
mangohud_find_egl_ptr;
116
local: *;
127
};

src/mangohud_opengl.version.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
global:
3+
@x11_symbols@
4+
@wayland_symbols@
5+
local: *;
6+
};

src/meson.build

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,6 @@ if is_unixy
168168
endif
169169

170170
link_args = cc.get_supported_link_arguments(['-Wl,-Bsymbolic-functions', '-Wl,-z,relro', '-Wl,--exclude-libs,ALL', '-lGL', '-static-libstdc++'])
171-
# meson fails to check version-script so just force add
172-
link_args += '-Wl,--version-script,@0@'.format(join_paths(meson.current_source_dir(), 'mangohud.version'))
173171

174172
mangohud_static_lib = static_library(
175173
'MangoHud',
@@ -211,11 +209,25 @@ mangohud_shared_lib = shared_library(
211209
'MangoHud',
212210
objects: mangohud_static_lib.extract_all_objects(),
213211
link_with: mangohud_static_lib,
214-
link_args : link_args,
212+
link_args : [link_args, '-Wl,--version-script,@0@'.format(join_paths(meson.current_source_dir(), 'mangohud.version'))],
215213
install_dir : libdir_mangohud,
216214
install: true
217215
)
218216

217+
mangohud_opengl_syms = configuration_data()
218+
if get_option('with_x11').enabled()
219+
mangohud_opengl_syms.set('x11_symbols', 'glX*; mangohud_find_glx_ptr;')
220+
endif
221+
if get_option('with_wayland').enabled()
222+
mangohud_opengl_syms.set('wayland_symbols', 'egl*; mangohud_find_egl_ptr;')
223+
endif
224+
225+
mangohud_opengl_version_file = configure_file(
226+
input: 'mangohud_opengl.version.in',
227+
output: 'mangohud_opengl.version',
228+
configuration: mangohud_opengl_syms,
229+
)
230+
219231
mangohud_opengl_shared_lib = shared_library(
220232
'MangoHud_opengl',
221233
mangohud_version,
@@ -244,8 +256,9 @@ mangohud_opengl_shared_lib = shared_library(
244256
json_dep,
245257
implot_dep],
246258
include_directories : [inc_common],
247-
link_args : link_args,
259+
link_args : [link_args, '-Wl,--version-script,@0@'.format(join_paths(meson.current_build_dir(), 'mangohud_opengl.version'))],
248260
link_with: mangohud_static_lib,
261+
link_depends: mangohud_opengl_version_file,
249262
install_dir : libdir_mangohud,
250263
install: true
251264
)

0 commit comments

Comments
 (0)