[PATCH] D137375: [AIX][pg] Add Correct Search Paths for Profiled Libraries

Michael Francis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 13 10:48:15 PST 2022


francii updated this revision to Diff 475005.
francii added a comment.

Add support for `--sysroot`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137375/new/

https://reviews.llvm.org/D137375

Files:
  clang/lib/Driver/ToolChains/AIX.cpp


Index: clang/lib/Driver/ToolChains/AIX.cpp
===================================================================
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ 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());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137375.475005.patch
Type: text/x-patch
Size: 1051 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221113/39053fb4/attachment-0001.bin>


More information about the cfe-commits mailing list