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
2fb4d1f751.
pull/8106/head
Martin Storsjö 4 years ago committed by Dylan Baker
parent 521a1b9921
commit c9685ac561
  1. 27
      mesonbuild/linkers.py

@ -668,6 +668,18 @@ class GnuLikeDynamicLinkerMixin:
return (args, rpath_dirs_to_remove) 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): class AppleDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker):
@ -752,18 +764,6 @@ class GnuDynamicLinker(GnuLikeDynamicLinkerMixin, PosixDynamicLinkerMixin, Dynam
"""Representation of GNU ld.bfd and ld.gold.""" """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: def get_accepts_rsp(self) -> bool:
return True return True
@ -802,9 +802,6 @@ class LLVMDynamicLinker(GnuLikeDynamicLinkerMixin, PosixDynamicLinkerMixin, Dyna
return self._apply_prefix('--allow-shlib-undefined') return self._apply_prefix('--allow-shlib-undefined')
return [] return []
def get_win_subsystem_args(self, value: str) -> T.List[str]:
return self._apply_prefix([f'-subsystem:{value}'])
class WASMDynamicLinker(GnuLikeDynamicLinkerMixin, PosixDynamicLinkerMixin, DynamicLinker): class WASMDynamicLinker(GnuLikeDynamicLinkerMixin, PosixDynamicLinkerMixin, DynamicLinker):

Loading…
Cancel
Save