[PATCH] D146443: [AIX] Consolidate Crt0Basename logic

Michael Francis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 20 17:47:23 PDT 2023


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4c483a046d2f: [AIX] Consolidate Crt0Basename logic (authored by francii).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146443

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
@@ -163,19 +163,19 @@
     CmdArgs.push_back("-bpD:0x110000000");
   }
 
-  auto getCrt0Basename = [&Args, IsArch32Bit] {
-    if (Arg *A = Args.getLastArgNoClaim(options::OPT_p, options::OPT_pg)) {
-      // Enable gprofiling when "-pg" is specified.
-      if (A->getOption().matches(options::OPT_pg))
-        return IsArch32Bit ? "gcrt0.o" : "gcrt0_64.o";
-      // Enable profiling when "-p" is specified.
-      return IsArch32Bit ? "mcrt0.o" : "mcrt0_64.o";
-    }
-    return IsArch32Bit ? "crt0.o" : "crt0_64.o";
-  };
-
   if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles,
                    options::OPT_shared, options::OPT_r)) {
+    auto getCrt0Basename = [&Args, IsArch32Bit] {
+      if (Arg *A = Args.getLastArgNoClaim(options::OPT_p, options::OPT_pg)) {
+        // Enable gprofiling when "-pg" is specified.
+        if (A->getOption().matches(options::OPT_pg))
+          return IsArch32Bit ? "gcrt0.o" : "gcrt0_64.o";
+        // Enable profiling when "-p" is specified.
+        return IsArch32Bit ? "mcrt0.o" : "mcrt0_64.o";
+      }
+      return IsArch32Bit ? "crt0.o" : "crt0_64.o";
+    };
+
     CmdArgs.push_back(
         Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename())));
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146443.506808.patch
Type: text/x-patch
Size: 1426 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230321/58cd7bc6/attachment.bin>


More information about the cfe-commits mailing list