summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/ToolChains
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-12-21 22:22:59 -0800
committerFangrui Song <maskray@google.com>2019-12-21 22:47:24 -0800
commit0792ef72564071f21b727d0de3a14d565950290f (patch)
treef2bb660bb416582e6a703e65a799e7c0587ba954 /clang/lib/Driver/ToolChains
parentba0eb7b66fd9dac7bf4883f70b65bded03a4b97a (diff)
downloadbcm5719-llvm-0792ef72564071f21b727d0de3a14d565950290f.tar.gz
bcm5719-llvm-0792ef72564071f21b727d0de3a14d565950290f.zip
[Driver] Verify -mrecord-mcount in Driver, instead of CodeGen after D71627
GCC's x86 and s390 ports support -mrecord-mcount. Other ports reject the option. aarch64-linux-gnu-gcc: error: unrecognized command line option ‘-mrecord-mcount’ Allowing this option can cause failures when building Linux kernel for aarch64, powerpc64, etc, which will think the feature is available if the clang command returns 0.
Diffstat (limited to 'clang/lib/Driver/ToolChains')
-rw-r--r--clang/lib/Driver/ToolChains/Clang.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 2ebfc763705..03100948f56 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -4995,8 +4995,15 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (TC.SupportsProfiling())
Args.AddLastArg(CmdArgs, options::OPT_mnop_mcount);
- if (TC.SupportsProfiling())
- Args.AddLastArg(CmdArgs, options::OPT_mrecord_mcount);
+ if (TC.SupportsProfiling()) {
+ if (Arg *A = Args.getLastArg(options::OPT_mrecord_mcount)) {
+ if (TC.getArch() == llvm::Triple::systemz)
+ A->render(Args, CmdArgs);
+ else
+ D.Diag(diag::err_drv_unsupported_opt_for_target)
+ << A->getAsString(Args) << TripleStr;
+ }
+ }
Args.AddLastArg(CmdArgs, options::OPT_mpacked_stack);
OpenPOWER on IntegriCloud