diff --git a/clang/lib/Driver/ToolChains/AIX.cpp b/clang/lib/Driver/ToolChains/AIX.cpp --- a/clang/lib/Driver/ToolChains/AIX.cpp +++ b/clang/lib/Driver/ToolChains/AIX.cpp @@ -243,6 +243,23 @@ CmdArgs.push_back("-lm"); CmdArgs.push_back("-lc"); + + if (Args.hasArg(options::OPT_pg)) { + const char *libProfiled; + const char *usrLibProfiled; + + if (!D.SysRoot.empty()) { + libProfiled = Args.MakeArgString((llvm::Twine("-L") + D.SysRoot) + + "/lib/profiled"); + usrLibProfiled = Args.MakeArgString((llvm::Twine("-L") + D.SysRoot) + + "/usr/lib/profiled"); + } else { + libProfiled = Args.MakeArgString(llvm::Twine("-L/lib/profiled")); + usrLibProfiled = Args.MakeArgString(llvm::Twine("-L/usr/lib/profiled")); + } + CmdArgs.push_back(libProfiled); + CmdArgs.push_back(usrLibProfiled); + } } const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());