From c9685ac5612eb040961efe5dc60a91fc5aa686b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 15 Dec 2020 12:51:33 +0200 Subject: [PATCH] Fix the subsystem options for lld in mingw mode lld in gnu like mode (e.g. for mingw) needs these options in the same for as gnu ld, thus remove the lld specific code bit and move the code for gnu like options into GnuLikeDynamicLinkerMixin. This unbreaks linking with lld for mingw targets after 2fb4d1f7512a4ec125883fd65115ab33a5b06b6f. --- mesonbuild/linkers.py | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/mesonbuild/linkers.py b/mesonbuild/linkers.py index fcc280cba..e74457b08 100644 --- a/mesonbuild/linkers.py +++ b/mesonbuild/linkers.py @@ -668,6 +668,18 @@ 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 mesonlib.MesonException(f'Only "windows" and "console" are supported for win_subsystem with MinGW, not "{value}".') + if ',' in value: + args[-1] = args[-1] + ':' + value.split(',')[1] + + return self._apply_prefix(args) + class AppleDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker): @@ -752,18 +764,6 @@ class GnuDynamicLinker(GnuLikeDynamicLinkerMixin, PosixDynamicLinkerMixin, Dynam """Representation of GNU ld.bfd and ld.gold.""" - 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 mesonlib.MesonException(f'Only "windows" and "console" are supported for win_subsystem with MinGW, not "{value}".') - if ',' in value: - args[-1] = args[-1] + ':' + value.split(',')[1] - - return self._apply_prefix(args) - def get_accepts_rsp(self) -> bool: return True @@ -802,9 +802,6 @@ class LLVMDynamicLinker(GnuLikeDynamicLinkerMixin, PosixDynamicLinkerMixin, Dyna return self._apply_prefix('--allow-shlib-undefined') return [] - def get_win_subsystem_args(self, value: str) -> T.List[str]: - return self._apply_prefix([f'-subsystem:{value}']) - class WASMDynamicLinker(GnuLikeDynamicLinkerMixin, PosixDynamicLinkerMixin, DynamicLinker):