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.
pull/6416/head
Jussi Pakkanen 4 years ago committed by GitHub
parent 6e7d5a0c61
commit 7ec3af95e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      cross/armclang-linux.txt
  2. 2
      mesonbuild/compilers/c.py
  3. 29
      mesonbuild/environment.py

@ -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'

@ -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)

@ -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)

Loading…
Cancel
Save