Skip to content

Commit

Permalink
linkers: fix LLD linker response file handling
Browse files Browse the repository at this point in the history
Correct base classes so GNU-like linkers all default to supporting response files.
  • Loading branch information
benoit-pierre committed Sep 14, 2023
1 parent 22da2c3 commit f7bfbd6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mesonbuild/linkers/linkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,9 @@ def _apply_prefix(self, arg: T.Union[str, T.List[str]]) -> T.List[str]: ...
"boot_application": "16",
}

def get_accepts_rsp(self) -> bool:
return True

def get_buildtype_args(self, buildtype: str) -> T.List[str]:
# We can override these in children by just overriding the
# _BUILDTYPE_ARGS value.
Expand Down Expand Up @@ -846,9 +849,6 @@ class GnuDynamicLinker(GnuLikeDynamicLinkerMixin, PosixDynamicLinkerMixin, Dynam

"""Representation of GNU ld.bfd and ld.gold."""

def get_accepts_rsp(self) -> bool:
return True


class GnuGoldDynamicLinker(GnuDynamicLinker):

Expand Down
21 changes: 21 additions & 0 deletions unittests/allplatformstests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4853,3 +4853,24 @@ def test_c_cpp_stds(self):
# The first supported std should be selected
self.setconf('-Dcpp_std=c++11,gnu++11,vc++11')
self.assertEqual(self.getconf('cpp_std'), 'c++11')

def test_rsp_support(self):
env = get_fake_env()
cc = detect_c_compiler(env, MachineChoice.HOST)
if cc.linker.id in {
'ld.bfd',
'ld.gold',
'ld.lld',
'ld.mold',
'ld.qcld',
'ld.wasm',
'link',
'lld-link',
'mwldarm',
'mwldeppc',
'optlink',
'xilink',
}:
assert cc.linker.get_accepts_rsp() == True
else:
assert cc.linker.get_accepts_rsp() == False

0 comments on commit f7bfbd6

Please sign in to comment.