D: Fix incorrect arch handling in D linkers

pull/4231/head
GoaLitiuM 7 years ago committed by Jussi Pakkanen
parent 83ad728e19
commit bc4bf03871
  1. 6
      mesonbuild/environment.py
  2. 9
      mesonbuild/linkers.py

@ -905,11 +905,11 @@ This is probably wrong, it should always point to the native compiler.''' % evar
if p.returncode == 0 and ('armar' in linker or 'armar.exe' in linker): if p.returncode == 0 and ('armar' in linker or 'armar.exe' in linker):
return ArmarLinker(linker) return ArmarLinker(linker)
if 'DMD32 D Compiler' in out or 'DMD64 D Compiler' in out: if 'DMD32 D Compiler' in out or 'DMD64 D Compiler' in out:
return DLinker(linker, compiler.is_64, compiler.is_msvc) return DLinker(linker, compiler.arch)
if 'LDC - the LLVM D compiler' in out: if 'LDC - the LLVM D compiler' in out:
return DLinker(linker, compiler.is_64, compiler.is_msvc) return DLinker(linker, compiler.arch)
if 'GDC' in out and ' based on D ' in out: if 'GDC' in out and ' based on D ' in out:
return DLinker(linker, compiler.is_64, compiler.is_msvc) return DLinker(linker, compiler.arch)
if p.returncode == 0: if p.returncode == 0:
return ArLinker(linker) return ArLinker(linker)
if p.returncode == 1 and err.startswith('usage'): # OSX if p.returncode == 1 and err.startswith('usage'): # OSX

@ -139,11 +139,10 @@ class ArmarLinker(ArLinker):
return False return False
class DLinker(StaticLinker): class DLinker(StaticLinker):
def __init__(self, exelist, is_64, is_msvc): def __init__(self, exelist, arch):
self.exelist = exelist self.exelist = exelist
self.id = exelist[0] self.id = exelist[0]
self.is_64 = is_64 self.arch = arch
self.is_msvc = is_msvc
def can_linker_accept_rsp(self): def can_linker_accept_rsp(self):
return mesonlib.is_windows() return mesonlib.is_windows()
@ -165,9 +164,9 @@ class DLinker(StaticLinker):
def get_linker_always_args(self): def get_linker_always_args(self):
if is_windows(): if is_windows():
if self.is_64: if self.arch == 'x86_64':
return ['-m64'] return ['-m64']
elif self.is_msvc and self.id == 'dmd': elif self.arch == 'x86_mscoff' and self.id == 'dmd':
return ['-m32mscoff'] return ['-m32mscoff']
return ['-m32'] return ['-m32']
return [] return []

Loading…
Cancel
Save