mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 13:30:12 +01:00
gallium: Fix undefined symbols in version scripts
Currently, multiple version scripts unconditionally use symbols from gallium drivers that may not be enabled, which causes linking to fail with --no-undefined-version (as is default in LLD 17), and can cause issues with LTO. This commit adds logic to generate version scripts based on the enabled gallium drivers, ensuring only defined symbols are used. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8003 Signed-off-by: Violet Purcell <vimproved@inventati.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25551>
This commit is contained in:
parent
c76cb19b01
commit
667de678a0
13 changed files with 86 additions and 47 deletions
|
|
@ -19,6 +19,20 @@
|
|||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
sym_config = configuration_data()
|
||||
|
||||
foreach d : [[with_gallium_r300 or with_gallium_radeonsi or with_gallium_r600, 'radeon_drm_winsys_create'],
|
||||
[with_gallium_radeonsi, 'amdgpu_winsys_create'],
|
||||
[with_gallium_nouveau, 'nouveau_drm_screen_create'],
|
||||
[with_gallium_freedreno, 'fd_drm_screen_create_renderonly'],
|
||||
[with_llvm and with_gallium_radeonsi, 'ac_init_shared_llvm_once']]
|
||||
if d[0]
|
||||
sym_config.set(d[1], d[1] + ';')
|
||||
else
|
||||
sym_config.set(d[1], '')
|
||||
endif
|
||||
endforeach
|
||||
|
||||
inc_gallium_drivers = include_directories('drivers')
|
||||
inc_gallium_winsys = include_directories('winsys')
|
||||
inc_gallium_winsys_sw = include_directories('winsys/sw')
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
global:
|
||||
__driDriverGetExtensions*;
|
||||
nouveau_drm_screen_create;
|
||||
radeon_drm_winsys_create;
|
||||
amdgpu_winsys_create;
|
||||
fd_drm_screen_create_renderonly;
|
||||
ac_init_shared_llvm_once;
|
||||
local:
|
||||
*;
|
||||
};
|
||||
11
src/gallium/targets/dri/dri.sym.in
Normal file
11
src/gallium/targets/dri/dri.sym.in
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
global:
|
||||
__driDriverGetExtensions*;
|
||||
@nouveau_drm_screen_create@
|
||||
@radeon_drm_winsys_create@
|
||||
@amdgpu_winsys_create@
|
||||
@fd_drm_screen_create_renderonly@
|
||||
@ac_init_shared_llvm_once@
|
||||
local:
|
||||
*;
|
||||
};
|
||||
|
|
@ -28,9 +28,11 @@ gallium_dri_ld_args = []
|
|||
gallium_dri_link_depends = []
|
||||
gallium_dri_drivers = []
|
||||
|
||||
dri_sym = configure_file(input : 'dri.sym.in', output : 'dri.sym', configuration : sym_config)
|
||||
|
||||
if with_ld_version_script
|
||||
gallium_dri_ld_args += ['-Wl,--version-script', join_paths(meson.current_source_dir(), 'dri.sym')]
|
||||
gallium_dri_link_depends += files('dri.sym')
|
||||
gallium_dri_ld_args += ['-Wl,--version-script', join_paths(meson.current_build_dir(), 'dri.sym')]
|
||||
gallium_dri_link_depends += dri_sym
|
||||
endif
|
||||
if with_ld_dynamic_list
|
||||
gallium_dri_ld_args += ['-Wl,--dynamic-list', join_paths(meson.current_source_dir(), '../dri.dyn')]
|
||||
|
|
|
|||
|
|
@ -25,9 +25,11 @@
|
|||
omx_link_args = []
|
||||
omx_link_depends = []
|
||||
|
||||
omx_sym = configure_file(input : 'omx.sym.in', output : 'omx.sym', configuration : sym_config)
|
||||
|
||||
if with_ld_version_script
|
||||
omx_link_args += ['-Wl,--version-script', join_paths(meson.current_source_dir(), 'omx.sym')]
|
||||
omx_link_depends += files('omx.sym')
|
||||
omx_link_args += ['-Wl,--version-script', join_paths(meson.current_build_dir(), 'omx.sym')]
|
||||
omx_link_depends += omx_sym
|
||||
endif
|
||||
|
||||
libomx_gallium = shared_library(
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
# Workaround for an LLVM warning with -simplifycfg-sink-common
|
||||
# due to LLVM being initialized multiple times.
|
||||
radeon_drm_winsys_create;
|
||||
amdgpu_winsys_create;
|
||||
ac_init_shared_llvm_once;
|
||||
@radeon_drm_winsys_create@
|
||||
@amdgpu_winsys_create@
|
||||
@ac_init_shared_llvm_once@
|
||||
local:
|
||||
*;
|
||||
};
|
||||
|
|
@ -37,13 +37,6 @@ if (with_gallium_va or with_gallium_vdpau or with_gallium_omx != 'disabled')
|
|||
pipe_loader_link_with += libgalliumvlwinsys
|
||||
endif
|
||||
|
||||
if with_ld_version_script
|
||||
pipe_loader_link_args += [
|
||||
'-Wl,--version-script', join_paths(meson.current_source_dir(), 'pipe.sym')
|
||||
]
|
||||
pipe_loader_link_deps += files('pipe.sym')
|
||||
endif
|
||||
|
||||
pipe_loader_install_dir = join_paths(get_option('libdir'), 'gallium-pipe')
|
||||
|
||||
_kmsro_targets = [
|
||||
|
|
@ -70,6 +63,30 @@ pipe_loaders = [
|
|||
]
|
||||
|
||||
foreach x : pipe_loaders
|
||||
pipe_sym_config = configuration_data()
|
||||
|
||||
foreach d : [[x[1] in ['r300', 'r600', 'radeonsi'], 'radeon_drm_winsys_create'],
|
||||
[x[1] in ['vmwgfx', 'r600', 'r300', 'nouveau', 'msm', 'kmsro', 'iris', 'crocus', 'radeonsi'],
|
||||
'driver_descriptor'],
|
||||
[x[1] == 'radeonsi', 'amdgpu_winsys_create'],
|
||||
[x[1] == 'radeonsi' and with_llvm, 'ac_init_shared_llvm_once'],
|
||||
[x[1] == 'swrast', 'swrast_driver_descriptor']]
|
||||
if d[0]
|
||||
pipe_sym_config.set(d[1], d[1] + ';')
|
||||
else
|
||||
pipe_sym_config.set(d[1], '')
|
||||
endif
|
||||
endforeach
|
||||
|
||||
pipe_sym = configure_file(input : 'pipe.sym.in', output : 'pipe_@0@.sym'.format(x[1]), configuration : pipe_sym_config)
|
||||
|
||||
if with_ld_version_script
|
||||
pipe_loader_link_args += [
|
||||
'-Wl,--version-script', join_paths(meson.current_build_dir(), 'pipe_@0@.sym'.format(x[1]))
|
||||
]
|
||||
pipe_loader_link_deps += pipe_sym
|
||||
endif
|
||||
|
||||
if x[0]
|
||||
shared_library(
|
||||
'pipe_@0@'.format(x[1]),
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
{
|
||||
global:
|
||||
driver_descriptor;
|
||||
swrast_driver_descriptor;
|
||||
@driver_descriptor@
|
||||
@swrast_driver_descriptor@
|
||||
|
||||
# Workaround for an LLVM warning with -simplifycfg-sink-common
|
||||
# due to LLVM being initialized multiple times.
|
||||
radeon_drm_winsys_create;
|
||||
amdgpu_winsys_create;
|
||||
ac_init_shared_llvm_once;
|
||||
@radeon_drm_winsys_create@
|
||||
@amdgpu_winsys_create@
|
||||
@ac_init_shared_llvm_once@
|
||||
local:
|
||||
*;
|
||||
};
|
||||
|
|
@ -26,9 +26,11 @@ va_link_args = []
|
|||
va_link_depends = []
|
||||
va_drivers = []
|
||||
|
||||
va_sym = configure_file(input : 'va.sym.in', output : 'va.sym', configuration : sym_config)
|
||||
|
||||
if with_ld_version_script
|
||||
va_link_args += ['-Wl,--version-script', join_paths(meson.current_source_dir(), 'va.sym')]
|
||||
va_link_depends += files('va.sym')
|
||||
va_link_args += ['-Wl,--version-script', join_paths(meson.current_build_dir(), 'va.sym')]
|
||||
va_link_depends += va_sym
|
||||
endif
|
||||
if with_ld_dynamic_list
|
||||
va_link_args += ['-Wl,--dynamic-list', join_paths(meson.current_source_dir(), '../dri.dyn')]
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
# Workaround for an LLVM warning with -simplifycfg-sink-common
|
||||
# due to LLVM being initialized multiple times.
|
||||
radeon_drm_winsys_create;
|
||||
amdgpu_winsys_create;
|
||||
ac_init_shared_llvm_once;
|
||||
@radeon_drm_winsys_create@
|
||||
@amdgpu_winsys_create@
|
||||
@ac_init_shared_llvm_once@
|
||||
local:
|
||||
*;
|
||||
};
|
||||
|
|
@ -26,9 +26,11 @@ vdpau_link_args = []
|
|||
vdpau_link_depends = []
|
||||
vdpau_drivers = []
|
||||
|
||||
vdpau_sym = configure_file(input : 'vdpau.sym.in', output : 'vdpau.sym', configuration : sym_config)
|
||||
|
||||
if with_ld_version_script
|
||||
vdpau_link_args += ['-Wl,--version-script', join_paths(meson.current_source_dir(), 'vdpau.sym')]
|
||||
vdpau_link_depends += files('vdpau.sym')
|
||||
vdpau_link_args += ['-Wl,--version-script', join_paths(meson.current_build_dir(), 'vdpau.sym')]
|
||||
vdpau_link_depends += vdpau_sym
|
||||
endif
|
||||
if with_ld_dynamic_list
|
||||
vdpau_link_args += ['-Wl,--dynamic-list', join_paths(meson.current_source_dir(), '../dri.dyn')]
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
global:
|
||||
vdp_imp_device_create_x11;
|
||||
nouveau_drm_screen_create;
|
||||
radeon_drm_winsys_create;
|
||||
amdgpu_winsys_create;
|
||||
ac_init_shared_llvm_once;
|
||||
local:
|
||||
*;
|
||||
};
|
||||
10
src/gallium/targets/vdpau/vdpau.sym.in
Normal file
10
src/gallium/targets/vdpau/vdpau.sym.in
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
global:
|
||||
vdp_imp_device_create_x11;
|
||||
@nouveau_drm_screen_create@
|
||||
@radeon_drm_winsys_create@
|
||||
@amdgpu_winsys_create@
|
||||
@ac_init_shared_llvm_once@
|
||||
local:
|
||||
*;
|
||||
};
|
||||
Loading…
Add table
Reference in a new issue