This is an archive of the discontinued LLVM Phabricator instance.

[ARM][clang] Define feature test macro for the PACBTI-M extension
ClosedPublic

Authored by stuij on Oct 25 2021, 3:38 AM.

Details

Summary

If the extension string "+pacbti" was given in -march=... or -mcpu=... options the compiler shall define the following preprocessor macros:

__ARM_FEATURE_PAUTH with value 1.
__ARM_FEATURE_BTI with value 1.

This patch is part of a series that adds support for the PACBTI-M extension of
the Armv8.1-M architecture, as detailed here:

https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/armv8-1-m-pointer-authentication-and-branch-target-identification-extension

The PACBTI-M specification can be found in the Armv8-M Architecture Reference
Manual:

https://developer.arm.com/documentation/ddi0553/latest

The following people contributed to this patch:

  • Momchil Velikov
  • Ties Stuij

Diff Detail

Event Timeline

stuij created this revision.Oct 25 2021, 3:38 AM
stuij requested review of this revision.Oct 25 2021, 3:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 25 2021, 3:38 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
miyuki added inline comments.Nov 4 2021, 7:17 AM
clang/lib/Basic/Targets/ARM.cpp
900

Since we decided to have two separate flags, I think this line should be in a separate if statement: if (HasBTI).

chill added a subscriber: chill.Nov 4 2021, 7:28 AM
chill added inline comments.
clang/lib/Basic/Targets/ARM.cpp
900

Agree. If this ever changes, we'd have to modify only around lines 550.

stuij updated this revision to Diff 386195.Nov 10 2021, 9:03 AM

addressing review comment

stuij marked 2 inline comments as done.Nov 10 2021, 9:06 AM
miyuki accepted this revision.Nov 25 2021, 7:56 AM
This revision is now accepted and ready to land.Nov 25 2021, 7:56 AM
stuij updated this revision to Diff 390340.Nov 29 2021, 6:34 AM

reuploading after rebase to resolve patch apply failure