Merge pull request #6090 from GoaLitiuM/master

d: Fix various linking issues
pull/6094/head
Jussi Pakkanen 5 years ago committed by GitHub
commit dea2c093d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      mesonbuild/compilers/d.py
  2. 24
      mesonbuild/environment.py

@ -394,7 +394,10 @@ class DmdLikeCompilerMixin:
return Compiler.get_soname_args(self, *args, **kwargs)
def get_allow_undefined_link_args(self) -> typing.List[str]:
return self.linker.get_allow_undefined_args()
args = []
for arg in self.linker.get_allow_undefined_args():
args.append('-L=' + arg)
return args
class DCompiler(Compiler):
@ -637,6 +640,9 @@ class GnuDCompiler(DCompiler, GnuCompiler):
return parameter_list
def get_allow_undefined_link_args(self) -> typing.List[str]:
return self.linker.get_allow_undefined_args()
class LLVMDCompiler(DmdLikeCompilerMixin, LinkerEnvVarsMixin, BasicLinkerIsCompilerMixin, DCompiler):
@ -667,6 +673,9 @@ class LLVMDCompiler(DmdLikeCompilerMixin, LinkerEnvVarsMixin, BasicLinkerIsCompi
def get_pic_args(self):
return ['-relocation-model=pic']
def get_std_shared_lib_link_args(self):
return ['-shared']
def get_crt_link_args(self, crt_val, buildtype):
return self.get_crt_args(crt_val, buildtype)

@ -1369,12 +1369,15 @@ class Environment:
# LDC seems to require a file
m = self.machines[for_machine]
if m.is_windows() or m.is_cygwin():
# Getting LDC on windows to give useful linker output when not
# doing real work is painfully hard. It ships with a verison of
# lld-link, so just assume that we're going to use lld-link
# with it.
_, o, _ = Popen_safe(['lld-link.exe', '--version'])
linker = ClangClDynamicLinker(for_machine, version=search_version(o))
if is_msvc:
linker = MSVCDynamicLinker(for_machine, version=version)
else:
# Getting LDC on windows to give useful linker output when not
# doing real work is painfully hard. It ships with a verison of
# lld-link, so just assume that we're going to use lld-link
# with it.
_, o, _ = Popen_safe(['lld-link.exe', '--version'])
linker = ClangClDynamicLinker(for_machine, version=search_version(o))
else:
with tempfile.NamedTemporaryFile(suffix='.d') as f:
linker = self._guess_nix_linker(
@ -1393,7 +1396,14 @@ class Environment:
# DMD seems to require a file
m = self.machines[for_machine]
if m.is_windows() or m.is_cygwin():
linker = OptlinkDynamicLinker(for_machine, version=full_version)
if is_msvc:
linker = MSVCDynamicLinker(for_machine, version=version)
elif arch == 'x86':
linker = OptlinkDynamicLinker(for_machine, version=full_version)
else:
# DMD ships with lld-link
_, o, _ = Popen_safe(['lld-link.exe', '--version'])
linker = ClangClDynamicLinker(for_machine, version=search_version(o))
else:
with tempfile.NamedTemporaryFile(suffix='.d') as f:
linker = self._guess_nix_linker(

Loading…
Cancel
Save