[PATCH] D138729: [AIX][LTO] Teaching lto-aix-system-assembler Relative Path and Tilde Resolution

Qiongsi Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 25 09:26:14 PST 2022


qiongsiwu1 created this revision.
qiongsiwu1 added reviewers: w2yehia, MaskRay.
qiongsiwu1 added a project: LLVM.
Herald added subscribers: ormris, StephenFan, steven_wu, hiraditya, inglorion.
Herald added a project: All.
qiongsiwu1 requested review of this revision.
Herald added a subscriber: llvm-commits.

The `lto-aix-system-assembler` currently only understands absolute path. This patch teaches the option so that it can resolve relative paths and tilde.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138729

Files:
  llvm/lib/LTO/LTOCodeGenerator.cpp


Index: llvm/lib/LTO/LTOCodeGenerator.cpp
===================================================================
--- llvm/lib/LTO/LTOCodeGenerator.cpp
+++ llvm/lib/LTO/LTOCodeGenerator.cpp
@@ -118,7 +118,7 @@
 
 cl::opt<std::string> AIXSystemAssemblerPath(
     "lto-aix-system-assembler",
-    cl::desc("Absolute path to the system assembler, picked up on AIX only"),
+    cl::desc("Path to a system assembler, picked up on AIX only"),
     cl::value_desc("path"));
 }
 
@@ -253,9 +253,15 @@
          "Runing AIX system assembler when integrated assembler is available!");
 
   // Set the system assembler path.
-  std::string AssemblerPath(llvm::AIXSystemAssemblerPath.empty()
-                                ? "/usr/bin/as"
-                                : llvm::AIXSystemAssemblerPath.c_str());
+  SmallString<256> AssemblerPath("/usr/bin/as");
+  if (!llvm::AIXSystemAssemblerPath.empty()) {
+    if (llvm::sys::fs::real_path(llvm::AIXSystemAssemblerPath, AssemblerPath,
+                                 /* expand_tilde */ true)) {
+      emitError(
+          "Cannot find the assembler specified by lto-aix-system-assembler");
+      return false;
+    }
+  }
 
   // Prepare inputs for the assember.
   const auto &Triple = TargetMach->getTargetTriple();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138729.477990.patch
Type: text/x-patch
Size: 1264 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221125/ca047e5e/attachment.bin>


More information about the llvm-commits mailing list