Use a cross linker when cross compiling.

This commit is contained in:
Jussi Pakkanen 2016-11-06 01:17:25 +02:00
parent 335d263315
commit 8d182e00c9
1 changed files with 9 additions and 5 deletions

View File

@ -236,19 +236,23 @@ class Backend():
def determine_linker(self, target, src): def determine_linker(self, target, src):
if isinstance(target, build.StaticLibrary): if isinstance(target, build.StaticLibrary):
if self.build.static_cross_linker is not None: if target.is_cross:
return self.build.static_cross_linker return self.build.static_cross_linker
else: else:
return self.build.static_linker return self.build.static_linker
if len(self.build.compilers) == 1: if target.is_cross:
return self.build.compilers[0] compilers = self.build.cross_compilers
else:
compilers = self.build.compilers
if len(compilers) == 1:
return compilers[0]
# Currently a bit naive. C++ must # Currently a bit naive. C++ must
# be linked with a C++ compiler, but # be linked with a C++ compiler, but
# otherwise we don't care. This will # otherwise we don't care. This will
# become trickier if and when Fortran # become trickier if and when Fortran
# and the like become supported. # and the like become supported.
cpp = None cpp = None
for c in self.build.compilers: for c in compilers:
if c.get_language() == 'cpp': if c.get_language() == 'cpp':
cpp = c cpp = c
break break
@ -256,7 +260,7 @@ class Backend():
for s in src: for s in src:
if c.can_compile(s): if c.can_compile(s):
return cpp return cpp
for c in self.build.compilers: for c in compilers:
if c.get_language() == 'vala': if c.get_language() == 'vala':
continue continue
for s in src: for s in src: