@@ -131,6 +131,7 @@ def guess_nix_linker(env: 'Environment', compiler: T.List[str], comp_class: T.Ty
131131 env .coredata .add_lang_args (comp_class .language , comp_class , for_machine , env )
132132 extra_args = extra_args or []
133133
134+ system = env .machines [for_machine ].system
134135 ldflags = env .coredata .get_external_link_args (for_machine , comp_class .language )
135136 extra_args += comp_class ._unix_args_to_native (ldflags , env .machines [for_machine ])
136137
@@ -164,7 +165,7 @@ def guess_nix_linker(env: 'Environment', compiler: T.List[str], comp_class: T.Ty
164165 lld_cls = linkers .LLVMDynamicLinker
165166
166167 linker = lld_cls (
167- compiler , for_machine , comp_class .LINKER_PREFIX , override , version = v )
168+ compiler , for_machine , comp_class .LINKER_PREFIX , override , system = system , version = v )
168169 elif 'Snapdragon' in e and 'LLVM' in e :
169170 linker = linkers .QualcommLLVMDynamicLinker (
170171 compiler , for_machine , comp_class .LINKER_PREFIX , override , version = v )
@@ -222,7 +223,10 @@ def guess_nix_linker(env: 'Environment', compiler: T.List[str], comp_class: T.Ty
222223 elif 'xtools-' in o .split ('\n ' , maxsplit = 1 )[0 ]:
223224 xtools = o .split (' ' , maxsplit = 1 )[0 ]
224225 v = xtools .split ('-' , maxsplit = 2 )[1 ]
225- linker = linkers .AppleDynamicLinker (compiler , for_machine , comp_class .LINKER_PREFIX , override , version = v )
226+ linker = linkers .AppleDynamicLinker (
227+ compiler , for_machine , comp_class .LINKER_PREFIX , override ,
228+ system = system , version = v
229+ )
226230 # detect linker on MacOS - must be after other platforms because the
227231 # "(use -v to see invocation)" will match clang on other platforms,
228232 # but the rest of the checks will fail and call __failed_to_detect_linker.
@@ -241,7 +245,10 @@ def guess_nix_linker(env: 'Environment', compiler: T.List[str], comp_class: T.Ty
241245 break
242246 else :
243247 __failed_to_detect_linker (compiler , check_args , o , e )
244- linker = linkers .AppleDynamicLinker (compiler , for_machine , comp_class .LINKER_PREFIX , override , version = v )
248+ linker = linkers .AppleDynamicLinker (
249+ compiler , for_machine , comp_class .LINKER_PREFIX , override ,
250+ system = system , version = v
251+ )
245252 else :
246253 __failed_to_detect_linker (compiler , check_args , o , e )
247254 return linker
0 commit comments