[clang] ec094d2 - [z/OS][pg] Throw error when using -pg on z/OS
Michael Francis via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 9 08:14:34 PST 2023
Author: Michael Francis
Date: 2023-02-09T16:14:29Z
New Revision: ec094d259ecfdd82b951f644bc9a28e487e53c60
URL: https://github.com/llvm/llvm-project/commit/ec094d259ecfdd82b951f644bc9a28e487e53c60
DIFF: https://github.com/llvm/llvm-project/commit/ec094d259ecfdd82b951f644bc9a28e487e53c60.diff
LOG: [z/OS][pg] Throw error when using -pg on z/OS
Throw an error when trying to compile with `-pg` on z/OS,
as the platform does not support `gprof`.
Reviewed By: cebowleratibm, MaskRay
Differential Revision: https://reviews.llvm.org/D137756
Added:
clang/test/Driver/zos-profiling-error.c
Modified:
clang/lib/Driver/ToolChains/Clang.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 3aff071d75394..58d6215670ad6 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6338,6 +6338,12 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
<< A->getAsString(Args) << TripleStr;
}
}
+ if (Arg *A = Args.getLastArgNoClaim(options::OPT_pg)) {
+ if (TC.getTriple().isOSzOS()) {
+ D.Diag(diag::err_drv_unsupported_opt_for_target)
+ << A->getAsString(Args) << TripleStr;
+ }
+ }
if (Args.getLastArg(options::OPT_fapple_kext) ||
(Args.hasArg(options::OPT_mkernel) && types::isCXX(InputType)))
diff --git a/clang/test/Driver/zos-profiling-error.c b/clang/test/Driver/zos-profiling-error.c
new file mode 100644
index 0000000000000..e969dc31a245a
--- /dev/null
+++ b/clang/test/Driver/zos-profiling-error.c
@@ -0,0 +1,2 @@
+// RUN: %clang 2>&1 -### --target=s390x-none-zos -pg -S %s | FileCheck -check-prefix=FAIL-PG-NAME %s
+// FAIL-PG-NAME: error: unsupported option '-pg' for target 's390x-none-zos'
More information about the cfe-commits
mailing list