[PATCH] D124046: [AIX] Always pass namedsects option when linking with PGO.

wael yehia via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 21 10:02:15 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf296b4c44462: [AIX] Always pass namedsects option when linking with PGO. (authored by w2yehia).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124046

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/test/Driver/aix-ld.c


Index: clang/test/Driver/aix-ld.c
===================================================================
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -692,7 +692,7 @@
 // CHECK-PGO-LTO:     "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-PGO-LTO:     "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-PGO-LTO:     "{{.*}}ld{{(.exe)?}}"
-// CHECK-PGO-LTO-NOT: "-bdbg:namedsects"
+// CHECK-PGO-LTO:     "-bdbg:namedsects"
 // CHECK-PGO-LTO:     "-b32"
 // CHECK-PGO-LTO:     "-bpT:0x10000000" "-bpD:0x20000000"
 // CHECK-PGO-LTO:     "[[SYSROOT]]/usr/lib{{/|\\\\}}crt0.o"
Index: clang/lib/Driver/ToolChains/AIX.cpp
===================================================================
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -98,9 +98,10 @@
     CmdArgs.push_back("-bnoentry");
   }
 
-  // Specify PGO linker option without LTO
-  if (!D.isUsingLTO() &&
-      (Args.hasFlag(options::OPT_fprofile_arcs, options::OPT_fno_profile_arcs,
+  // PGO instrumentation generates symbols belonging to special sections, and
+  // the linker needs to place all symbols in a particular section together in
+  // memory; the AIX linker does that under an option.
+  if (Args.hasFlag(options::OPT_fprofile_arcs, options::OPT_fno_profile_arcs,
                     false) ||
        Args.hasFlag(options::OPT_fprofile_generate,
                     options::OPT_fno_profile_generate, false) ||
@@ -115,7 +116,7 @@
        Args.hasFlag(options::OPT_fcs_profile_generate_EQ,
                     options::OPT_fno_profile_generate, false) ||
        Args.hasArg(options::OPT_fcreate_profile) ||
-       Args.hasArg(options::OPT_coverage)))
+       Args.hasArg(options::OPT_coverage))
     CmdArgs.push_back("-bdbg:namedsects");
 
   // Specify linker output file.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124046.424240.patch
Type: text/x-patch
Size: 1797 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220421/a12e6cef/attachment.bin>


More information about the cfe-commits mailing list