diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2020-01-06 16:49:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-06 16:49:34 +0200 |
commit | 7ec3af95e5b93845e5d757bfc3b8bab53ce895b1 (patch) | |
tree | da376562415ced929f2d76ec6e38f2c23470a4c0 | |
parent | 6e7d5a0c61c10f28f761f211f9e33fc63b8a3da5 (diff) | |
download | meson-7ec3af95e5b93845e5d757bfc3b8bab53ce895b1.zip meson-7ec3af95e5b93845e5d757bfc3b8bab53ce895b1.tar.gz meson-7ec3af95e5b93845e5d757bfc3b8bab53ce895b1.tar.bz2 |
Updated linker MR (#6407)
* environment: Fix passing always args to a number of less common linkers
These are mostly (oops xilink) proprietary linkers I can't use for
various reasons.
Fixes: #6332
* Add intelfix from scivision.
* Ifort fix from scivision.
* PGI fix from scivision.
* Cuda fix from scivision.
* Fix linker passing for armclang.
-rw-r--r-- | cross/armclang-linux.txt | 2 | ||||
-rw-r--r-- | mesonbuild/compilers/c.py | 2 | ||||
-rw-r--r-- | mesonbuild/environment.py | 29 |
3 files changed, 21 insertions, 12 deletions
diff --git a/cross/armclang-linux.txt b/cross/armclang-linux.txt index 2772d82..6df78d6 100644 --- a/cross/armclang-linux.txt +++ b/cross/armclang-linux.txt @@ -26,7 +26,7 @@ ar = '/opt/arm/developmentstudio-2019.0/sw/ARMCompiler6.12/bin/armar' [properties] -#c_args = ['--target=aarch64-arm-none-eabi'] +c_args = ['--target=aarch64-arm-none-eabi'] [host_machine] system = 'baremetal' diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index aa48f7a..8a15609 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -146,7 +146,7 @@ class EmscriptenCCompiler(LinkerEnvVarsMixin, EmscriptenMixin, BasicLinkerIsComp class ArmclangCCompiler(ArmclangCompiler, CCompiler): def __init__(self, exelist, version, for_machine: MachineChoice, - info: 'MachineInfo', is_cross, exe_wrapper=None, **kwargs): + is_cross, info: 'MachineInfo', exe_wrapper=None, **kwargs): CCompiler.__init__(self, exelist, version, for_machine, is_cross, info, exe_wrapper, **kwargs) ArmclangCompiler.__init__(self) diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 26727ad..cc726ce 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -819,7 +819,8 @@ class Environment: _, o, e = Popen_safe(compiler + check_args) v = search_version(o) if o.startswith('LLD'): - linker = LLVMDynamicLinker(compiler, for_machine, 'lld', comp_class.LINKER_PREFIX, override, version=v) # type: DynamicLinker + linker = LLVMDynamicLinker( + compiler, for_machine, 'lld', comp_class.LINKER_PREFIX, override, version=v) # type: DynamicLinker elif e.startswith('lld-link: '): # Toolchain wrapper got in the way; this happens with e.g. https://github.com/mstorsjo/llvm-mingw # Let's try to extract the linker invocation command to grab the version. @@ -963,7 +964,7 @@ class Environment: version = search_version(arm_ver_str) full_version = arm_ver_str cls = ArmclangCCompiler if lang == 'c' else ArmclangCPPCompiler - linker = ArmClangDynamicLinker(for_machine, [], version=version) + linker = ArmClangDynamicLinker(for_machine, version=version) return cls( ccache + compiler, version, for_machine, is_cross, info, exe_wrap, full_version=full_version, linker=linker) @@ -1010,11 +1011,13 @@ class Environment: return cls( ccache + compiler, version, for_machine, is_cross, info, exe_wrap, full_version=full_version, linker=linker) + if 'Intel(R) C++ Intel(R)' in err: version = search_version(err) target = 'x86' if 'IA-32' in err else 'x86_64' cls = IntelClCCompiler if lang == 'c' else IntelClCPPCompiler - linker = XilinkDynamicLinker(for_machine, version=version) + self.coredata.add_lang_args(cls.language, cls, for_machine, self) + linker = XilinkDynamicLinker(for_machine, [], version=version) return cls( compiler, version, for_machine, is_cross, info=info, exe_wrap=exe_wrap, target=target, linker=linker) @@ -1044,6 +1047,7 @@ class Environment: target, linker=linker) if 'PGI Compilers' in out: cls = PGICCompiler if lang == 'c' else PGICPPCompiler + self.coredata.add_lang_args(cls.language, cls, for_machine, self) linker = PGIDynamicLinker(compiler, for_machine, 'pgi', cls.LINKER_PREFIX, [], version=version) return cls( ccache + compiler, version, for_machine, is_cross, @@ -1111,8 +1115,10 @@ class Environment: # the full version: version = out.strip().split('V')[-1] cpp_compiler = self.detect_cpp_compiler(for_machine) - linker = CudaLinker(compiler, for_machine, 'nvlink', CudaCompiler.LINKER_PREFIX, version=CudaLinker.parse_version()) - return CudaCompiler(ccache + compiler, version, for_machine, is_cross, exe_wrap, host_compiler=cpp_compiler, info=info, linker=linker) + cls = CudaCompiler + self.coredata.add_lang_args(cls.language, cls, for_machine, self) + linker = CudaLinker(compiler, for_machine, 'nvlink', CudaCompiler.LINKER_PREFIX, [], version=CudaLinker.parse_version()) + return cls(ccache + compiler, version, for_machine, is_cross, exe_wrap, host_compiler=cpp_compiler, info=info, linker=linker) raise EnvironmentException('Could not find suitable CUDA compiler: "' + ' '.join(compilers) + '"') def detect_fortran_compiler(self, for_machine: MachineChoice): @@ -1175,8 +1181,10 @@ class Environment: if 'Intel(R) Visual Fortran' in err: version = search_version(err) target = 'x86' if 'IA-32' in err else 'x86_64' + cls = IntelClFortranCompiler + self.coredata.add_lang_args(cls.language, cls, for_machine, self) linker = XilinkDynamicLinker(for_machine, [], version=version) - return IntelClFortranCompiler( + return cls( compiler, version, for_machine, is_cross, target, info, exe_wrap, linker=linker) @@ -1192,10 +1200,11 @@ class Environment: exe_wrap, full_version=full_version) if 'PGI Compilers' in out: - linker = PGIDynamicLinker( - compiler, for_machine, 'pgi', - PGIFortranCompiler.LINKER_PREFIX, version=version) - return PGIFortranCompiler( + cls = PGIFortranCompiler + self.coredata.add_lang_args(cls.language, cls, for_machine, self) + linker = PGIDynamicLinker(compiler, for_machine, 'pgi', + cls.LINKER_PREFIX, [], version=version) + return cls( compiler, version, for_machine, is_cross, info, exe_wrap, full_version=full_version, linker=linker) |