Skip to content

Commit

Permalink
[Darwin] Fix link flags for Cilksan and Cilkscale on Darwin.
Browse files Browse the repository at this point in the history
  • Loading branch information
neboat committed Jul 2, 2020
1 parent b79d386 commit 68e7d10
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 14 additions & 1 deletion clang/lib/Driver/ToolChains/Darwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1144,6 +1144,17 @@ void DarwinClang::AddLinkSanitizerLibArgs(const ArgList &Args,
AddLinkRuntimeLib(Args, CmdArgs, Sanitizer, RLO, Shared);
}

void DarwinClang::AddCilktoolRTLibs(const ArgList &Args,
ArgStringList &CmdArgs) const {
if (Arg *A = Args.getLastArg(options::OPT_fcilktool_EQ)) {
StringRef Val = A->getValue();
auto RLO = RuntimeLinkOptions(RLO_AlwaysLink);
AddLinkRuntimeLib(Args, CmdArgs, Val, RLO);
// Link in the C++ standard library
AddCXXStdlibLibArgs(Args, CmdArgs);
}
}

ToolChain::RuntimeLibType DarwinClang::GetRuntimeLibType(
const ArgList &Args) const {
if (Arg* A = Args.getLastArg(options::OPT_rtlib_EQ)) {
Expand Down Expand Up @@ -1193,7 +1204,7 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
if (Sanitize.needsTsanRt())
AddLinkSanitizerLibArgs(Args, CmdArgs, "tsan");
if (Sanitize.needsCilksanRt())
AddLinkSanitizerLibArgs(Args, CmdArgs, "cilk");
AddLinkSanitizerLibArgs(Args, CmdArgs, "cilksan");
if (Sanitize.needsFuzzer() && !Args.hasArg(options::OPT_dynamiclib)) {
AddLinkSanitizerLibArgs(Args, CmdArgs, "fuzzer", /*shared=*/false);

Expand All @@ -1205,6 +1216,8 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
AddLinkSanitizerLibArgs(Args, CmdArgs, "stats");
}

AddCilktoolRTLibs(Args, CmdArgs);

const XRayArgs &XRay = getXRayArgs();
if (XRay.needsXRayRt()) {
AddLinkRuntimeLib(Args, CmdArgs, "xray");
Expand Down
3 changes: 3 additions & 0 deletions clang/lib/Driver/ToolChains/Darwin.h
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,9 @@ class LLVM_LIBRARY_VISIBILITY DarwinClang : public Darwin {
StringRef Sanitizer,
bool shared = true) const;

void AddCilktoolRTLibs(const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const;

bool AddGnuCPlusPlusIncludePaths(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args,
llvm::SmallString<128> Base,
Expand Down

0 comments on commit 68e7d10

Please sign in to comment.