linkers: Add get_base_link_args method to static linkers

MSVC needs an argument to static linkers for doing LTO, so we need a way
for the static linker to tell us that.
pull/5700/head
Dylan Baker 6 years ago committed by Nirbheek Chauhan
parent 7eb1d89095
commit 24c4c079e7
  1. 4
      mesonbuild/backend/ninjabackend.py
  2. 4
      mesonbuild/linkers.py

@ -2467,7 +2467,9 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
# Add linker args for linking this target derived from 'base' build # Add linker args for linking this target derived from 'base' build
# options passed on the command-line, in default_options, etc. # options passed on the command-line, in default_options, etc.
# These have the lowest priority. # These have the lowest priority.
if not isinstance(target, build.StaticLibrary): if isinstance(target, build.StaticLibrary):
commands += linker.get_base_link_args(self.get_base_options_for_target(target))
else:
commands += compilers.get_base_link_args(self.get_base_options_for_target(target), commands += compilers.get_base_link_args(self.get_base_options_for_target(target),
linker, linker,
isinstance(target, build.SharedModule)) isinstance(target, build.SharedModule))

@ -33,6 +33,10 @@ class StaticLinker:
""" """
return mesonlib.is_windows() return mesonlib.is_windows()
def get_base_link_args(self, options: 'OptionDictType') -> typing.List[str]:
"""Like compilers.get_base_link_args, but for the static linker."""
return []
def get_exelist(self) -> typing.List[str]: def get_exelist(self) -> typing.List[str]:
return self.exelist.copy() return self.exelist.copy()

Loading…
Cancel
Save