diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2019-11-19 09:30:46 -0800 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2019-12-02 16:39:06 -0800 |
commit | ef9aeb188ea2bc7353e59916c18901cde90fa2b3 (patch) | |
tree | d1525c3c53703d1adb4c077399ab39909863c7dc /mesonbuild/compilers | |
parent | 7658e67f92ba55e2d8e466f818293a001f34a65f (diff) | |
download | meson-ef9aeb188ea2bc7353e59916c18901cde90fa2b3.zip meson-ef9aeb188ea2bc7353e59916c18901cde90fa2b3.tar.gz meson-ef9aeb188ea2bc7353e59916c18901cde90fa2b3.tar.bz2 |
Allow selecting the dynamic linker
This uses the normal meson mechanisms, an LD environment variable or via
cross/native files.
Fixes: #6057
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r-- | mesonbuild/compilers/compilers.py | 6 | ||||
-rw-r--r-- | mesonbuild/compilers/mixins/gnu.py | 4 | ||||
-rw-r--r-- | mesonbuild/compilers/mixins/visualstudio.py | 4 | ||||
-rw-r--r-- | mesonbuild/compilers/rust.py | 6 |
4 files changed, 19 insertions, 1 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 52a2788..818c62c 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -1178,6 +1178,12 @@ class Compiler: def get_dependency_link_args(self, dep): return dep.get_link_args() + @classmethod + def use_linker_args(cls, linker: str) -> typing.List[str]: + """Get a list of arguments to pass to the compiler to set the linker. + """ + return [] + def get_largefile_args(compiler): ''' diff --git a/mesonbuild/compilers/mixins/gnu.py b/mesonbuild/compilers/mixins/gnu.py index 64b0d3b..6683486 100644 --- a/mesonbuild/compilers/mixins/gnu.py +++ b/mesonbuild/compilers/mixins/gnu.py @@ -299,6 +299,10 @@ class GnuLikeCompiler(metaclass=abc.ABCMeta): return ['-isystem' + path] return ['-I' + path] + @classmethod + def use_linker_args(cls, linker: str) -> typing.List[str]: + return ['-fuse-ld={}'.format(linker)] + class GnuCompiler(GnuLikeCompiler): """ diff --git a/mesonbuild/compilers/mixins/visualstudio.py b/mesonbuild/compilers/mixins/visualstudio.py index 60b07c4..4798bdc 100644 --- a/mesonbuild/compilers/mixins/visualstudio.py +++ b/mesonbuild/compilers/mixins/visualstudio.py @@ -381,3 +381,7 @@ class VisualStudioLikeCompiler(metaclass=abc.ABCMeta): def get_argument_syntax(self) -> str: return 'msvc' + + @classmethod + def use_linker_args(cls, linker: str) -> typing.List[str]: + return [] diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py index a17b697..405afea 100644 --- a/mesonbuild/compilers/rust.py +++ b/mesonbuild/compilers/rust.py @@ -32,7 +32,7 @@ rust_optimization_args = {'0': [], class RustCompiler(Compiler): - LINKER_PREFIX = '-Wl,' + # rustc doesn't invoke the compiler itself, it doesn't need a LINKER_PREFIX def __init__(self, exelist, version, for_machine: MachineChoice, is_cross, info: 'MachineInfo', exe_wrapper=None, **kwargs): @@ -109,3 +109,7 @@ class RustCompiler(Compiler): def get_std_exe_link_args(self): return [] + + # Rust does not have a use_linker_args because it dispatches to a gcc-like + # C compiler for dynamic linking, as such we invoke the C compiler's + # use_linker_args method instead. |