diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp index f8c8c24d6fda..be881e57484a 100644 --- a/clang/lib/Driver/ToolChains/Darwin.cpp +++ b/clang/lib/Driver/ToolChains/Darwin.cpp @@ -3459,10 +3459,7 @@ void DarwinClang::AddLinkTapirRuntime(const ArgList &Args, case TapirTargetID::OpenCilk: { bool StaticOpenCilk = Args.hasArg(options::OPT_static_libopencilk); bool UseAsan = getSanitizerArgs(Args).needsAsanRt(); - auto RLO = RLO_AlwaysLink; - if (!StaticOpenCilk) - RLO = RuntimeLinkOptions(RLO | RLO_AddRPath); // If pedigrees are enabled, link the OpenCilk pedigree library. if (Args.hasArg(options::OPT_fopencilk_enable_pedigrees)) @@ -3483,6 +3480,11 @@ void DarwinClang::AddLinkTapirRuntime(const ArgList &Args, : "opencilk-personality-c", RLO, !StaticOpenCilk); + if (!StaticOpenCilk) + // Add rpath flag for linking the final Tapir runtime library, to avoid + // warnings about ignoring duplicate rpaths. + RLO = RuntimeLinkOptions(RLO | RLO_AddRPath); + // Link the opencilk runtime. We do this after linking the personality // function, to ensure that symbols are resolved correctly when using static // linking.