Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linkers: fix LLD linker response file handling #12252

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions mesonbuild/linkers/linkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,9 @@
"boot_application": "16",
}

def get_accepts_rsp(self) -> bool:
return True

def get_pie_args(self) -> T.List[str]:
return ['-pie']

Expand Down Expand Up @@ -845,13 +848,10 @@
id = 'ld64.lld'


class GnuDynamicLinker(GnuLikeDynamicLinkerMixin, PosixDynamicLinkerMixin, DynamicLinker):

Check warning

Code scanning / CodeQL

Conflicting attributes in base classes Warning

Base classes have conflicting values for attribute 'thread_flags':
Function thread_flags
and
Function thread_flags
.
Base classes have conflicting values for attribute 'get_coverage_args':
Function get_coverage_args
and
Function get_coverage_args
.
Base classes have conflicting values for attribute 'get_link_whole_for':
Function get_link_whole_for
and
Function get_link_whole_for
.
Base classes have conflicting values for attribute 'build_rpath_args':
Function build_rpath_args
and
Function build_rpath_args
.
Base classes have conflicting values for attribute 'get_win_subsystem_args':
Function get_win_subsystem_args
and
Function get_win_subsystem_args
.
Base classes have conflicting values for attribute 'get_pie_args':
Function get_pie_args
and
Function get_pie_args
.
Base classes have conflicting values for attribute 'get_asneeded_args':
Function get_asneeded_args
and
Function get_asneeded_args
.
Base classes have conflicting values for attribute 'get_soname_args':
Function get_soname_args
and
Function get_soname_args
.
Base classes have conflicting values for attribute '_OPTIMIZATION_ARGS':
Dict
and
Dict
.
Base classes have conflicting values for attribute 'get_accepts_rsp':
Function get_accepts_rsp
and
Function get_accepts_rsp
.
Base classes have conflicting values for attribute 'get_std_shared_lib_args':
Function get_std_shared_lib_args
and
Function get_std_shared_lib_args
.
Base classes have conflicting values for attribute 'get_lto_args':
Function get_lto_args
and
Function get_lto_args
.
Base classes have conflicting values for attribute 'sanitizer_args':
Function sanitizer_args
and
Function sanitizer_args
.
Base classes have conflicting values for attribute 'get_allow_undefined_args':
Function get_allow_undefined_args
and
Function get_allow_undefined_args
.
Base classes have conflicting values for attribute 'export_dynamic_args':
Function export_dynamic_args
and
Function export_dynamic_args
.
Base classes have conflicting values for attribute 'import_library_args':
Function import_library_args
and
Function import_library_args
.
Base classes have conflicting values for attribute 'no_undefined_args':
Function no_undefined_args
and
Function no_undefined_args
.
Base classes have conflicting values for attribute 'fatal_warnings':
Function fatal_warnings
and
Function fatal_warnings
.

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

def get_accepts_rsp(self) -> bool:
return True


class GnuGoldDynamicLinker(GnuDynamicLinker):

Expand All @@ -874,7 +874,7 @@
return ['-Wl,--thinlto-cache-dir=' + path]


class LLVMDynamicLinker(GnuLikeDynamicLinkerMixin, PosixDynamicLinkerMixin, DynamicLinker):

Check warning

Code scanning / CodeQL

Conflicting attributes in base classes Warning

Base classes have conflicting values for attribute 'thread_flags':
Function thread_flags
and
Function thread_flags
.
Base classes have conflicting values for attribute 'get_coverage_args':
Function get_coverage_args
and
Function get_coverage_args
.
Base classes have conflicting values for attribute 'get_link_whole_for':
Function get_link_whole_for
and
Function get_link_whole_for
.
Base classes have conflicting values for attribute 'build_rpath_args':
Function build_rpath_args
and
Function build_rpath_args
.
Base classes have conflicting values for attribute 'get_pie_args':
Function get_pie_args
and
Function get_pie_args
.
Base classes have conflicting values for attribute 'get_soname_args':
Function get_soname_args
and
Function get_soname_args
.
Base classes have conflicting values for attribute '_OPTIMIZATION_ARGS':
Dict
and
Dict
.
Base classes have conflicting values for attribute 'get_accepts_rsp':
Function get_accepts_rsp
and
Function get_accepts_rsp
.
Base classes have conflicting values for attribute 'get_std_shared_lib_args':
Function get_std_shared_lib_args
and
Function get_std_shared_lib_args
.
Base classes have conflicting values for attribute 'get_lto_args':
Function get_lto_args
and
Function get_lto_args
.
Base classes have conflicting values for attribute 'sanitizer_args':
Function sanitizer_args
and
Function sanitizer_args
.
Base classes have conflicting values for attribute 'export_dynamic_args':
Function export_dynamic_args
and
Function export_dynamic_args
.
Base classes have conflicting values for attribute 'import_library_args':
Function import_library_args
and
Function import_library_args
.
Base classes have conflicting values for attribute 'fatal_warnings':
Function fatal_warnings
and
Function fatal_warnings
.

"""Representation of LLVM's ld.lld linker.

Expand Down Expand Up @@ -936,7 +936,7 @@
raise mesonlib.MesonBugException(f'win_subsystem: {value} not handled in lld linker. This should not be possible.')


class WASMDynamicLinker(GnuLikeDynamicLinkerMixin, PosixDynamicLinkerMixin, DynamicLinker):

Check warning

Code scanning / CodeQL

Conflicting attributes in base classes Warning

Base classes have conflicting values for attribute 'thread_flags':
Function thread_flags
and
Function thread_flags
.
Base classes have conflicting values for attribute 'get_coverage_args':
Function get_coverage_args
and
Function get_coverage_args
.
Base classes have conflicting values for attribute 'get_link_whole_for':
Function get_link_whole_for
and
Function get_link_whole_for
.
Base classes have conflicting values for attribute 'get_win_subsystem_args':
Function get_win_subsystem_args
and
Function get_win_subsystem_args
.
Base classes have conflicting values for attribute 'get_pie_args':
Function get_pie_args
and
Function get_pie_args
.
Base classes have conflicting values for attribute '_OPTIMIZATION_ARGS':
Dict
and
Dict
.
Base classes have conflicting values for attribute 'get_accepts_rsp':
Function get_accepts_rsp
and
Function get_accepts_rsp
.
Base classes have conflicting values for attribute 'get_std_shared_lib_args':
Function get_std_shared_lib_args
and
Function get_std_shared_lib_args
.
Base classes have conflicting values for attribute 'get_lto_args':
Function get_lto_args
and
Function get_lto_args
.
Base classes have conflicting values for attribute 'sanitizer_args':
Function sanitizer_args
and
Function sanitizer_args
.
Base classes have conflicting values for attribute 'export_dynamic_args':
Function export_dynamic_args
and
Function export_dynamic_args
.
Base classes have conflicting values for attribute 'import_library_args':
Function import_library_args
and
Function import_library_args
.
Base classes have conflicting values for attribute 'fatal_warnings':
Function fatal_warnings
and
Function fatal_warnings
.

"""Emscripten's wasm-ld."""

Expand Down
9 changes: 9 additions & 0 deletions unittests/allplatformstests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5010,3 +5010,12 @@ 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)
has_rsp = cc.linker.id in {
'ld.bfd', 'ld.gold', 'ld.lld', 'ld.mold', 'ld.qcld', 'ld.wasm',
'link', 'lld-link', 'mwldarm', 'mwldeppc', 'optlink', 'xilink',
}
self.assertEqual(cc.linker.get_accepts_rsp(), has_rsp)
Loading