[clang] f296b4c - [AIX] Always pass namedsects option when linking with PGO.
Wael Yehia via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 21 10:02:03 PDT 2022
Author: Wael Yehia
Date: 2022-04-21T17:01:37Z
New Revision: f296b4c444625f84be1db27cfd52a3d16387f456
URL: https://github.com/llvm/llvm-project/commit/f296b4c444625f84be1db27cfd52a3d16387f456
DIFF: https://github.com/llvm/llvm-project/commit/f296b4c444625f84be1db27cfd52a3d16387f456.diff
LOG: [AIX] Always pass namedsects option when linking with PGO.
Differential Revision: https://reviews.llvm.org/D124046
Added:
Modified:
clang/lib/Driver/ToolChains/AIX.cpp
clang/test/Driver/aix-ld.c
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/AIX.cpp b/clang/lib/Driver/ToolChains/AIX.cpp
index e4bbf498b9cd6..37316a792f6d1 100644
--- a/clang/lib/Driver/ToolChains/AIX.cpp
+++ b/clang/lib/Driver/ToolChains/AIX.cpp
@@ -98,9 +98,10 @@ void aix::Linker::ConstructJob(Compilation &C, const JobAction &JA,
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 @@ void aix::Linker::ConstructJob(Compilation &C, const JobAction &JA,
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.
diff --git a/clang/test/Driver/aix-ld.c b/clang/test/Driver/aix-ld.c
index 6a1b006bf1e3b..eccae132763d5 100644
--- a/clang/test/Driver/aix-ld.c
+++ b/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"
More information about the cfe-commits
mailing list