This patch implements __attribute__((target("branch-protection=..."))) in a manner, compatible with the analogous GCC feature:
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
You should also update AttrDocs.td for the new feature.
clang/include/clang/Basic/DiagnosticSemaKinds.td | ||
---|---|---|
2599 | Invalid -> invalid should perhaps have '%0' to show what part is invalid? | |
clang/lib/CodeGen/TargetInfo.cpp | ||
5063–5064 | Don't do hasAttr<> followed by getAttr<>, you should do: if (const auto *TA = FD->getAttr<TargetAttr>()) | |
5072 | auto * |
I think this also needs a check to make sure the selected architecture supports PAC/BTI. Gcc gives an unknown target attribute or pragma error if this is used for a non-AArch64 target.
Moved parsing out of Attr.td to TargetInfo, following the example (good or bad) of validateOutputConstraint or validateGlobalregisterVariable ;)
Now issue a warning if attribute is not supported by target, like for other unsupported target options.
clang/lib/Basic/Targets/AArch64.cpp | ||
---|---|---|
112 | This completely duplicates the ParseAArch64BranchProtection function in the driver, could we share one implementation between the command line option and attribute? |
Invalid -> invalid
should perhaps have '%0' to show what part is invalid?