Index: lib/Driver/ToolChains/Fuchsia.cpp =================================================================== --- lib/Driver/ToolChains/Fuchsia.cpp +++ lib/Driver/ToolChains/Fuchsia.cpp @@ -109,8 +109,7 @@ D.getLTOMode() == LTOK_Thin); } - addSanitizerRuntimes(ToolChain, Args, CmdArgs); - + bool NeedSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs); AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA); ToolChain.addProfileRTLibs(Args, CmdArgs); @@ -134,6 +133,9 @@ } } + if (NeedSanitizerDeps) + linkSanitizerRuntimeDeps(ToolChain, CmdArgs); + AddRunTimeLibs(ToolChain, D, CmdArgs, Args); if (Args.hasArg(options::OPT_pthread) ||