build: Use linker version scripts to control visibility.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2018-01-15 13:49:01 +01:00 committed by Alexandre Julliard
parent 4605d1275c
commit 41715a2f33
6 changed files with 104 additions and 0 deletions

View File

@ -68,6 +68,9 @@ libvkd3d_shader_la_SOURCES = \
libs/vkd3d-shader/vkd3d_shader_main.c \ libs/vkd3d-shader/vkd3d_shader_main.c \
libs/vkd3d-shader/vkd3d_shader_private.h libs/vkd3d-shader/vkd3d_shader_private.h
libvkd3d_shader_la_LIBADD = libvkd3d-common.la @SPIRV_TOOLS_LIBS@ libvkd3d_shader_la_LIBADD = libvkd3d-common.la @SPIRV_TOOLS_LIBS@
if HAVE_LD_VERSION_SCRIPT
libvkd3d_shader_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libs/vkd3d-shader/vkd3d_shader.map
endif
libvkd3d_la_SOURCES = \ libvkd3d_la_SOURCES = \
include/d3d12.idl \ include/d3d12.idl \
@ -85,11 +88,17 @@ libvkd3d_la_SOURCES = \
libs/vkd3d/vkd3d_private.h \ libs/vkd3d/vkd3d_private.h \
libs/vkd3d/vulkan_procs.h libs/vkd3d/vulkan_procs.h
libvkd3d_la_LIBADD = libvkd3d-common.la libvkd3d-shader.la @PTHREAD_LIBS@ @VULKAN_LIBS@ libvkd3d_la_LIBADD = libvkd3d-common.la libvkd3d-shader.la @PTHREAD_LIBS@ @VULKAN_LIBS@
if HAVE_LD_VERSION_SCRIPT
libvkd3d_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libs/vkd3d/vkd3d.map
endif
libvkd3d_utils_la_SOURCES = \ libvkd3d_utils_la_SOURCES = \
libs/vkd3d-utils/vkd3d_utils_main.c \ libs/vkd3d-utils/vkd3d_utils_main.c \
libs/vkd3d-utils/vkd3d_utils_private.h libs/vkd3d-utils/vkd3d_utils_private.h
libvkd3d_utils_la_LIBADD = libvkd3d-common.la libvkd3d.la libvkd3d_utils_la_LIBADD = libvkd3d-common.la libvkd3d.la
if HAVE_LD_VERSION_SCRIPT
libvkd3d_utils_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libs/vkd3d-utils/vkd3d_utils.map
endif
EXTRA_DIST = LICENSE EXTRA_DIST = LICENSE

View File

@ -30,6 +30,8 @@ AM_SILENT_RULES([yes])
LT_PREREQ([2.4.2]) LT_PREREQ([2.4.2])
LT_INIT LT_INIT
gl_LD_VERSION_SCRIPT
dnl Check compiler specific flags dnl Check compiler specific flags
AC_SUBST([VKD3D_CFLAGS]) AC_SUBST([VKD3D_CFLAGS])
AS_IF([test "x${GCC}" = "xyes"], AS_IF([test "x${GCC}" = "xyes"],

View File

@ -0,0 +1,14 @@
{
global:
vkd3d_shader_compile_dxbc;
vkd3d_shader_find_signature_element;
vkd3d_shader_free_root_signature;
vkd3d_shader_free_shader_code;
vkd3d_shader_free_shader_signature;
vkd3d_shader_parse_input_signature;
vkd3d_shader_parse_root_signature;
vkd3d_shader_scan_dxbc;
vkd3d_shader_serialize_root_signature;
local: *;
};

View File

@ -0,0 +1,13 @@
{
global:
D3D12CreateDevice;
D3D12CreateRootSignatureDeserializer;
D3D12GetDebugInterface;
D3D12SerializeRootSignature;
vkd3d_create_event;
vkd3d_destroy_event;
vkd3d_signal_event;
vkd3d_wait_event;
local: *;
};

18
libs/vkd3d/vkd3d.map Normal file
View File

@ -0,0 +1,18 @@
{
global:
vkd3d_create_device;
vkd3d_create_image_resource;
vkd3d_create_instance;
vkd3d_create_root_signature_deserializer;
vkd3d_get_vk_device;
vkd3d_get_vk_format;
vkd3d_get_vk_instance;
vkd3d_get_vk_physical_device;
vkd3d_get_vk_queue;
vkd3d_get_vk_queue_family_index;
vkd3d_instance_decref;
vkd3d_instance_incref;
vkd3d_serialize_root_signature;
local: *;
};

48
m4/ld-version-script.m4 Normal file
View File

@ -0,0 +1,48 @@
# ld-version-script.m4 serial 4
dnl Copyright (C) 2008-2018 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl From Simon Josefsson
# FIXME: The test below returns a false positive for mingw
# cross-compiles, 'local:' statements does not reduce number of
# exported symbols in a DLL. Use --disable-ld-version-script to work
# around the problem.
# gl_LD_VERSION_SCRIPT
# --------------------
# Check if LD supports linker scripts, and define automake conditional
# HAVE_LD_VERSION_SCRIPT if so.
AC_DEFUN([gl_LD_VERSION_SCRIPT],
[
AC_ARG_ENABLE([ld-version-script],
[AS_HELP_STRING([--enable-ld-version-script],
[enable linker version script (default is enabled when possible)])],
[have_ld_version_script=$enableval],
[AC_CACHE_CHECK([if LD -Wl,--version-script works],
[gl_cv_sys_ld_version_script],
[gl_cv_sys_ld_version_script=no
save_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
echo foo >conftest.map
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
[],
[cat > conftest.map <<EOF
VERS_1 {
global: sym;
};
VERS_2 {
global: sym;
} VERS_1;
EOF
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
[gl_cv_sys_ld_version_script=yes])])
rm -f conftest.map
LDFLAGS=$save_LDFLAGS])
have_ld_version_script=$gl_cv_sys_ld_version_script])
AM_CONDITIONAL([HAVE_LD_VERSION_SCRIPT],
[test "$have_ld_version_script" = yes])
])