diff --git a/Source/Tools/Flax.Build/Platforms/Unix/UnixToolchain.cs b/Source/Tools/Flax.Build/Platforms/Unix/UnixToolchain.cs index eb4c8f183..373dde534 100644 --- a/Source/Tools/Flax.Build/Platforms/Unix/UnixToolchain.cs +++ b/Source/Tools/Flax.Build/Platforms/Unix/UnixToolchain.cs @@ -61,6 +61,11 @@ namespace Flax.Build.Platforms /// protected string LdPath; + /// + /// The type of the linker. + /// + protected string LdKind; + /// /// The clang tool version. /// @@ -91,7 +96,19 @@ namespace Flax.Build.Platforms RanlibPath = UnixPlatform.Which("ranlib"); StripPath = UnixPlatform.Which("strip"); ObjcopyPath = UnixPlatform.Which("objcopy"); - LdPath = UnixPlatform.Which("ld"); + + LdPath = UnixPlatform.Which("ld.lld"); + LdKind = "lld"; + if (LdPath == null) + { + LdPath = UnixPlatform.Which("ld.gold"); + LdKind = "gold"; + } + if (LdPath == null) + { + LdPath = UnixPlatform.Which("ld"); + LdKind = null; + } } else { @@ -478,6 +495,9 @@ namespace Flax.Build.Platforms // TODO: linkEnvironment.LinkTimeCodeGeneration // TODO: linkEnvironment.Optimization // TODO: linkEnvironment.UseIncrementalLinking + + if (!string.IsNullOrEmpty(LdKind)) + args.Add(string.Format("-fuse-ld={0}", LdKind)); } SetupLinkFilesArgs(graph, options, args, outputFilePath);