@@ -187,6 +187,7 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr
187
187
188
188
target = aatriplet (platform)
189
189
host_target = aatriplet (host_platform)
190
+ clang_use_lld = (! isnothing (gcc_version) && ! isnothing (clang_version) && clang_version >= v " 16" && gcc_version >= v " 5" )
190
191
191
192
function wrapper (io:: IO ,
192
193
prog:: String ;
@@ -343,7 +344,7 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr
343
344
])
344
345
end
345
346
end
346
- if Sys. islinux (p) && ! isnothing (gcc_version) && (clang_version >= v " 16" )
347
+ if Sys. islinux (p) && ! isnothing (gcc_version) ! isnothing (clang_version) && (clang_version >= v " 16" )
347
348
append! (flags, [" --gcc-install-dir=/opt/$(aatriplet (p)) /lib/gcc/$(aatriplet (p)) /$(gcc_version) " ])
348
349
end
349
350
if Sys. iswindows (p)
@@ -409,6 +410,7 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr
409
410
append! (flags, get_march_flags (arch (p), march (p), " clang" ))
410
411
end
411
412
if Sys. isapple (p)
413
+ macos_version_flags = clang_use_lld ? (min_macos_version_flags ()[1 ],) : min_macos_version_flags ()
412
414
append! (flags, String[
413
415
# On MacOS, we need to override the typical C++ include search paths, because it always includes
414
416
# the toolchain C++ headers first. Valentin tracked this down to:
@@ -421,7 +423,7 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr
421
423
# `clang` as a linker (and we have no real way to detect that in the wrapper), which will
422
424
# cause `clang` to complain about compiler flags being passed in.
423
425
" -Wno-unused-command-line-argument" ,
424
- min_macos_version_flags () ... ,
426
+ macos_version_flags ... ,
425
427
])
426
428
end
427
429
sanitize_compile_flags! (p, flags)
@@ -467,7 +469,9 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr
467
469
end
468
470
# we want to use a particular linker with clang. But we want to avoid warnings about unused
469
471
# flags when just compiling, so we put it into "linker-only flags".
470
- push! (flags, " -fuse-ld=$(aatriplet (p)) " )
472
+ if ! clang_use_lld
473
+ push! (flags, " -fuse-ld=$(aatriplet (p)) " )
474
+ end
471
475
472
476
sanitize_link_flags! (p, flags)
473
477
0 commit comments