[clang] 9c31969 - [AIX] Don't pass namedsects in LTO mode
Jinsong Ji via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 1 12:22:51 PDT 2021
Author: Jinsong Ji
Date: 2021-10-01T19:22:40Z
New Revision: 9c31969e8df2f4b41b05e415fc9a66ff0bfa0802
URL: https://github.com/llvm/llvm-project/commit/9c31969e8df2f4b41b05e415fc9a66ff0bfa0802
DIFF: https://github.com/llvm/llvm-project/commit/9c31969e8df2f4b41b05e415fc9a66ff0bfa0802.diff
LOG: [AIX] Don't pass namedsects in LTO mode
LTO don't need binder option , don't pass it in LTO mode.
Reviewed By: Whitney
Differential Revision: https://reviews.llvm.org/D110955
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 053f6389dc0e..e4bbf498b9cd 100644
--- a/clang/lib/Driver/ToolChains/AIX.cpp
+++ b/clang/lib/Driver/ToolChains/AIX.cpp
@@ -98,8 +98,9 @@ void aix::Linker::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-bnoentry");
}
- // Specify PGO linker option
- if ((Args.hasFlag(options::OPT_fprofile_arcs, options::OPT_fno_profile_arcs,
+ // Specify PGO linker option without LTO
+ if (!D.isUsingLTO() &&
+ (Args.hasFlag(options::OPT_fprofile_arcs, options::OPT_fno_profile_arcs,
false) ||
Args.hasFlag(options::OPT_fprofile_generate,
options::OPT_fno_profile_generate, false) ||
diff --git a/clang/test/Driver/aix-ld.c b/clang/test/Driver/aix-ld.c
index de70c2f03046..fc40e50d4509 100644
--- a/clang/test/Driver/aix-ld.c
+++ b/clang/test/Driver/aix-ld.c
@@ -649,3 +649,58 @@
// CHECK-LD64-SHARED-NOT: "--no-as-needed"
// CHECK-LD64-SHARED: "-lm"
// CHECK-LD64-SHARED: "-lc"
+
+// Check powerpc-ibm-aix7.3.0.0, -fprofile-generate
+// RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: -static \
+// RUN: -fprofile-generate\
+// RUN: -target powerpc-ibm-aix7.3.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN: -unwindlib=libunwind \
+// RUN: | FileCheck --check-prefix=CHECK-PGO-NON-LTO %s
+// CHECK-PGO-NON-LTO-NOT: warning:
+// CHECK-PGO-NON-LTO: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.3.0.0"
+// CHECK-PGO-NON-LTO: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// CHECK-PGO-NON-LTO: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-PGO-NON-LTO: "{{.*}}ld{{(.exe)?}}"
+// CHECK-PGO-NON-LTO: "-bdbg:namedsects"
+// CHECK-PGO-NON-LTO: "-b32"
+// CHECK-PGO-NON-LTO: "-bpT:0x10000000" "-bpD:0x20000000"
+// CHECK-PGO-NON-LTO: "[[SYSROOT]]/usr/lib{{/|\\\\}}crt0.o"
+// CHECK-PGO-NON-LTO-NOT: "-lc++"
+// CHECK-PGO-NON-LTO-NOT: "-lc++abi"
+// CHECK-PGO-NON-LTO: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aix{{/|\\\\}}libclang_rt.builtins-powerpc.a"
+// CHECK-PGO-NON-LTO-NOT: "--as-needed"
+// CHECK-PGO-NON-LTO-NOT: "-lunwind"
+// CHECK-PGO-NON-LTO-NOT: "--no-as-needed"
+// CHECK-PGO-NON-LTO-NOT: "-lm"
+// CHECK-PGO-NON-LTO: "-lc"
+
+// Check powerpc-ibm-aix7.2.5.3, -fprofile-generate, -flto
+// RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: -static \
+// RUN: -fprofile-generate\
+// RUN: -flto\
+// RUN: -target powerpc-ibm-aix7.2.5.3 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN: -unwindlib=libunwind \
+// RUN: | FileCheck --check-prefix=CHECK-PGO-LTO %s
+// CHECK-PGO-LTO-NOT: warning:
+// CHECK-PGO-LTO: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.2.5.3"
+// 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: "-b32"
+// CHECK-PGO-LTO: "-bpT:0x10000000" "-bpD:0x20000000"
+// CHECK-PGO-LTO: "[[SYSROOT]]/usr/lib{{/|\\\\}}crt0.o"
+// CHECK-PGO-LTO-NOT: "-lc++"
+// CHECK-PGO-LTO-NOT: "-lc++abi"
+// CHECK-PGO-LTO: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aix{{/|\\\\}}libclang_rt.builtins-powerpc.a"
+// CHECK-PGO-LTO-NOT: "--as-needed"
+// CHECK-PGO-LTO-NOT: "-lunwind"
+// CHECK-PGO-LTO-NOT: "--no-as-needed"
+// CHECK-PGO-LTO-NOT: "-lm"
+// CHECK-PGO-LTO: "-lc"
More information about the cfe-commits
mailing list