summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/ToolChains
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2020-01-04 16:58:11 -0800
committerFangrui Song <maskray@google.com>2020-01-10 09:57:39 -0800
commitf17ae668a96eeb69f0664f126cf672e1a05754d2 (patch)
tree6d63004713914e91e9f07fecec32233cac4be725 /clang/lib/Driver/ToolChains
parenta44c434b68e515ce9f2627367c83ff6b22328261 (diff)
downloadbcm5719-llvm-f17ae668a96eeb69f0664f126cf672e1a05754d2.tar.gz
bcm5719-llvm-f17ae668a96eeb69f0664f126cf672e1a05754d2.zip
[Driver][CodeGen] Add -fpatchable-function-entry=N[,0]
In the backend, this feature is implemented with the function attribute "patchable-function-entry". Both the attribute and XRay use TargetOpcode::PATCHABLE_FUNCTION_ENTER, so the two features are incompatible. Reviewed By: ostannard, MaskRay Differential Revision: https://reviews.llvm.org/D72222
Diffstat (limited to 'clang/lib/Driver/ToolChains')
-rw-r--r--clang/lib/Driver/ToolChains/Clang.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index fbb772bb370..8fdf1f23e28 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -5002,6 +5002,24 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
const XRayArgs &XRay = TC.getXRayArgs();
XRay.addArgs(TC, Args, CmdArgs, InputType);
+ if (Arg *A = Args.getLastArg(options::OPT_fpatchable_function_entry_EQ)) {
+ StringRef S0 = A->getValue(), S = S0;
+ unsigned Size, Start = 0;
+ if (!Triple.isAArch64() && Triple.getArch() != llvm::Triple::x86 &&
+ Triple.getArch() != llvm::Triple::x86_64)
+ D.Diag(diag::err_drv_unsupported_opt_for_target)
+ << A->getAsString(Args) << TripleStr;
+ else if (S.consumeInteger(10, Size) ||
+ (!S.empty() && (!S.consume_front(",") ||
+ S.consumeInteger(10, Start) || !S.empty())))
+ D.Diag(diag::err_drv_invalid_argument_to_option)
+ << S0 << A->getOption().getName();
+ else if (Start)
+ D.Diag(diag::err_drv_unsupported_fpatchable_function_entry_argument);
+ else
+ CmdArgs.push_back(Args.MakeArgString(A->getSpelling() + Twine(Size)));
+ }
+
if (TC.SupportsProfiling()) {
Args.AddLastArg(CmdArgs, options::OPT_pg);
OpenPOWER on IntegriCloud