Skip to content

Commit

Permalink
build: Disable stdcall alias-ing and use kill-at
Browse files Browse the repository at this point in the history
Disable stdcall aliasing and enable kill-at to ensure our exported
functions don't have the @8, @40, etc suffixes.

This still keeps `--enable-stdcall-fixup` as otherwise the linker can
get confused trying to find exports from the .def. This does not result
in aliases being added, just for them to be found to add to the export
table.

This also switches d3d11 to use the MinGW provided dxgi.lib for linking
and d3d10 to use the MinGW provided d3d11.lib for linking.
Unfortunately the .a's we output seem to still have the @BLAH that we
killed so we cannot use them for internal linkage since using kill-at.

Tested that what we get out of MinGW now is what we want with dllexp.

Supercedes: #3590
  • Loading branch information
misyltoad committed Aug 1, 2023
1 parent 9b019d2 commit 8b6b260
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ if platform == 'windows'
if cpu_family == 'x86'
link_args += [
'-Wl,--enable-stdcall-fixup',
'-Wl,--add-stdcall-alias',
]
'-Wl,--kill-at',
]
endif

lib_d3d9 = cpp.find_library('d3d9')
Expand Down
7 changes: 5 additions & 2 deletions src/d3d10/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ d3d10_core_src = [
d3d10_core_ld_args = []
d3d10_core_link_depends = []

if platform != 'windows'
if platform == 'windows'
d3d10_d3d11_dep = lib_d3d11
else
d3d10_core_ld_args += [ '-Wl,--version-script', join_paths(meson.current_source_dir(), 'd3d10core.sym') ]
d3d10_core_link_depends += files('d3d10core.sym')
d3d10_d3d11_dep = d3d11_dep
endif

d3d10_core_dll = shared_library('d3d10core'+dll_ext, d3d10_core_src, d3d10_core_res,
name_prefix : dxvk_name_prefix,
dependencies : [ d3d11_dep ],
dependencies : [ d3d10_d3d11_dep ],
include_directories : dxvk_include_path,
install : true,
vs_module_defs : 'd3d10core'+def_spec_ext,
Expand Down
7 changes: 5 additions & 2 deletions src/d3d11/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,18 @@ d3d11_shaders = files([
d3d11_ld_args = []
d3d11_link_depends = []

if platform != 'windows'
if platform == 'windows'
d3d11_dxgi_dep = lib_dxgi
else
d3d11_ld_args += [ '-Wl,--version-script', join_paths(meson.current_source_dir(), 'd3d11.sym') ]
d3d11_link_depends += files('d3d11.sym')
d3d11_dxgi_dep = dxgi_dep
endif

d3d11_dll = shared_library('d3d11'+dll_ext, dxgi_common_src + d3d11_src + d3d10_src,
glsl_generator.process(d3d11_shaders), d3d11_res,
name_prefix : dxvk_name_prefix,
dependencies : [ dxgi_dep, dxbc_dep, dxvk_dep ],
dependencies : [ d3d11_dxgi_dep, dxbc_dep, dxvk_dep ],
include_directories : dxvk_include_path,
install : true,
vs_module_defs : 'd3d11'+def_spec_ext,
Expand Down
4 changes: 2 additions & 2 deletions src/d3d9/d3d9_include.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

//for some reason we need to specify __declspec(dllexport) for MinGW
#if defined(__WINE__) || !defined(_WIN32)
#define DLLEXPORT __attribute__((visibility("default")))
#define DLLEXPORT __attribute__((visibility("default")))
#else
#define DLLEXPORT
#define DLLEXPORT
#endif


Expand Down
4 changes: 1 addition & 3 deletions src/dxgi/dxgi_include.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
//for some reason we need to specify __declspec(dllexport) for MinGW
#if defined(__WINE__) || !defined(_WIN32)
#define DLLEXPORT __attribute__((visibility("default")))
#elif defined(_MSC_VER)
#define DLLEXPORT
#else
#define DLLEXPORT __declspec(dllexport)
#define DLLEXPORT
#endif

#include "../util/com/com_guid.h"
Expand Down

0 comments on commit 8b6b260

Please sign in to comment.