aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/linkers/linkers.py
diff options
context:
space:
mode:
authorLens <LensPlaysGames@gmail.com>2022-05-09 14:18:01 -0700
committerEli Schwartz <eschwartz93@gmail.com>2022-05-10 17:45:24 -0400
commitb1abda2b4b9ea85551abe073b55092848285ccca (patch)
tree68a42a6b108a2fb3eebce5daba3588e836b1a832 /mesonbuild/linkers/linkers.py
parent65ea833d58f5e4720b89e6f97b38cd7d61b48418 (diff)
downloadmeson-b1abda2b4b9ea85551abe073b55092848285ccca.zip
meson-b1abda2b4b9ea85551abe073b55092848285ccca.tar.gz
meson-b1abda2b4b9ea85551abe073b55092848285ccca.tar.bz2
linkers/MinGW: Allow `efi_application` value for `win_subsystem`
Previously, any value other than `windows` or `console` caused an exception. This change allows for `efi_application` to be passed as the `win_subsystem` to MinGW based linkers.
Diffstat (limited to 'mesonbuild/linkers/linkers.py')
-rw-r--r--mesonbuild/linkers/linkers.py32
1 files changed, 25 insertions, 7 deletions
diff --git a/mesonbuild/linkers/linkers.py b/mesonbuild/linkers/linkers.py
index 4609652..ae55864 100644
--- a/mesonbuild/linkers/linkers.py
+++ b/mesonbuild/linkers/linkers.py
@@ -700,14 +700,32 @@ class GnuLikeDynamicLinkerMixin:
return (args, rpath_dirs_to_remove)
def get_win_subsystem_args(self, value: str) -> T.List[str]:
- if 'windows' in value:
- args = ['--subsystem,windows']
- elif 'console' in value:
- args = ['--subsystem,console']
- else:
- raise MesonException(f'Only "windows" and "console" are supported for win_subsystem with MinGW, not "{value}".')
+ # MinGW only directly supports a couple of the possible
+ # PE application types. The raw integer works as an argument
+ # as well, and is always accepted, so we manually map the
+ # other types here. List of all types:
+ # https://github.com/wine-mirror/wine/blob/3ded60bd1654dc689d24a23305f4a93acce3a6f2/include/winnt.h#L2492-L2507
+ subsystems = {
+ "native": "1",
+ "windows": "windows",
+ "console": "console",
+ "posix": "7",
+ "efi_application": "10",
+ "efi_boot_service_driver": "11",
+ "efi_runtime_driver": "12",
+ "efi_rom": "13",
+ "boot_application": "16",
+ }
+ versionsuffix = None
if ',' in value:
- args[-1] = args[-1] + ':' + value.split(',')[1]
+ value, versionsuffix = value.split(',', 1)
+ newvalue = subsystems.get(value)
+ if newvalue is not None:
+ if versionsuffix is not None:
+ newvalue += f':{versionsuffix}'
+ args = [f'--subsystem,{newvalue}']
+ else:
+ raise mesonlib.MesonBugException(f'win_subsystem: {value!r} not handled in MinGW linker. This should not be possible.')
return self._apply_prefix(args)