const XRayArgs &XRay = TC.getXRayArgs();
XRay.addArgs(TC, Args, CmdArgs, InputType);
- if (TC.SupportsProfiling())
+ if (TC.SupportsProfiling()) {
Args.AddLastArg(CmdArgs, options::OPT_pg);
- if (TC.SupportsProfiling())
- Args.AddLastArg(CmdArgs, options::OPT_mfentry);
-
- if (TC.SupportsProfiling())
- Args.AddLastArg(CmdArgs, options::OPT_mnop_mcount);
-
- if (TC.SupportsProfiling()) {
+ llvm::Triple::ArchType Arch = TC.getArch();
+ if (Arg *A = Args.getLastArg(options::OPT_mfentry)) {
+ if (Arch == llvm::Triple::systemz || Arch == llvm::Triple::x86 ||
+ Arch == llvm::Triple::x86_64)
+ A->render(Args, CmdArgs);
+ else
+ D.Diag(diag::err_drv_unsupported_opt_for_target)
+ << A->getAsString(Args) << TripleStr;
+ }
+ if (Arg *A = Args.getLastArg(options::OPT_mnop_mcount)) {
+ if (Arch == llvm::Triple::systemz)
+ A->render(Args, CmdArgs);
+ else
+ D.Diag(diag::err_drv_unsupported_opt_for_target)
+ << A->getAsString(Args) << TripleStr;
+ }
if (Arg *A = Args.getLastArg(options::OPT_mrecord_mcount)) {
- if (TC.getArch() == llvm::Triple::systemz)
+ if (Arch == llvm::Triple::systemz)
A->render(Args, CmdArgs);
else
D.Diag(diag::err_drv_unsupported_opt_for_target)
-// RUN: %clang -target s390x -c -### %s -mrecord-mcount 2>&1 | FileCheck %s
+// RUN: %clang -target s390x -c -### %s -mnop-mcount -mrecord-mcount 2>&1 | FileCheck %s
+
+// CHECK: "-mnop-mcount"
// CHECK: "-mrecord-mcount"
-// RUN: %clang -target x86_64 -c -### %s -mrecord-mcount 2>&1 | FileCheck --check-prefix=ERR1 %s
-// RUN: %clang -target aarch64 -c -### %s -mrecord-mcount 2>&1 | FileCheck --check-prefix=ERR2 %s
+// RUN: %clang -target x86_64 -c -### %s -mnop-mcount -mrecord-mcount 2>&1 | FileCheck --check-prefix=ERR1 %s
+// RUN: %clang -target aarch64 -c -### %s -mnop-mcount -mrecord-mcount 2>&1 | FileCheck --check-prefix=ERR2 %s
+// ERR1: error: unsupported option '-mnop-mcount' for target 'x86_64'
// ERR1: error: unsupported option '-mrecord-mcount' for target 'x86_64'
+// ERR2: error: unsupported option '-mnop-mcount' for target 'aarch64'
// ERR2: error: unsupported option '-mrecord-mcount' for target 'aarch64'
--- /dev/null
+// RUN: %clang -target s390x -c -### %s -mfentry 2>&1 | FileCheck %s
+// RUN: %clang -target i386 -c -### %s -mfentry 2>&1 | FileCheck %s
+// RUN: %clang -target x86_64 -c -### %s -mfentry 2>&1 | FileCheck %s
+
+// CHECK: "-mfentry"
+
+// RUN: %clang -target powerpc64le -c -### %s -mfentry 2>&1 | FileCheck --check-prefix=ERR %s
+
+// ERR: error: unsupported option '-mfentry' for target 'powerpc64le'