[llvm] [Verifier] Check function attributes related to branch protection (NFC) (PR #70565)
Momchil Velikov via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 2 04:52:24 PDT 2023
================
@@ -2231,6 +2231,26 @@ void Verifier::verifyFunctionAttrs(FunctionType *FT, AttributeList Attrs,
checkUnsignedBaseTenFuncAttr(Attrs, "patchable-function-prefix", V);
checkUnsignedBaseTenFuncAttr(Attrs, "patchable-function-entry", V);
checkUnsignedBaseTenFuncAttr(Attrs, "warn-stack-size", V);
+
+ if (auto A = Attrs.getFnAttr("sign-return-address"); A.isValid()) {
+ StringRef S = A.getValueAsString();
+ if (S != "none" && S != "all" && S != "non-leaf")
+ CheckFailed("invalid value for 'sign-return-address' attribute: " + S, V);
+ }
+
+ if (auto A = Attrs.getFnAttr("sign-return-address-key"); A.isValid()) {
+ StringRef S = A.getValueAsString();
+ if (!S.equals_insensitive("a_key") && !S.equals_insensitive("b_key"))
----------------
momchil-velikov wrote:
This matches the assertion in `AArch64MachineFunctionInfo.cpp`. Although clang/LLVM are inconsistent, some places use `==` some `equals_insensitive`.
https://github.com/llvm/llvm-project/pull/70565
More information about the llvm-commits
mailing list