raven-rhel6/llvm17/clang-fuse-ld.patch
2024-02-21 20:14:44 +06:00

22 lines
792 B
Diff

--- a/lib/Driver/ToolChain.cpp 2015-06-19 23:36:47.000000000 +0200
+++ b/lib/Driver/ToolChain.cpp 2015-07-12 00:43:10.134955874 +0200
@@ -184,6 +184,18 @@ std::string ToolChain::GetFilePath(const
}
std::string ToolChain::GetProgramPath(const char *Name) const {
+ if(!strcmp(Name, "ld")) {
+ // Handle -fuse-ld=XXX the way gcc does
+ if (Arg *A = Args.getLastArg(options::OPT_fuse_ld_EQ)) {
+ StringRef Value = A->getValue();
+ if(Value.empty())
+ return D.GetProgramPath(Name, *this);
+ const char *suffix = Value.str().c_str();
+ char *newName = (char *) alloca(strlen(Name) + strlen(suffix) + 2);
+ sprintf(newName, "%s.%s", Name, suffix);
+ return D.GetProgramPath(newName, *this);
+ }
+ }
return D.GetProgramPath(Name, *this);
}