llvm-project/clang/lib/Driver
Ties Stuij e3b2f0226b [clang][ARM] PACBTI-M frontend support
Handle branch protection option on the commandline as well as a function
attribute. One patch for both mechanisms, as they use the same underlying
parsing mechanism.

These are recorded in a set of LLVM IR module-level attributes like we do for
AArch64 PAC/BTI (see https://reviews.llvm.org/D85649):

- command-line options are "translated" to module-level LLVM IR
  attributes (metadata).

- functions have PAC/BTI specific attributes iff the
  __attribute__((target("branch-protection=...))) was used in the function
  declaration.

- command-line option -mbranch-protection to armclang targeting Arm,
following this grammar:

branch-protection ::= "-mbranch-protection=" <protection>
protection ::=  "none" | "standard" | "bti" [ "+" <pac-ret-clause> ]
                | <pac-ret-clause> [ "+" "bti"]
pac-ret-clause ::= "pac-ret" [ "+" <pac-ret-option> ]
pac-ret-option ::= "leaf" ["+" "b-key"] | "b-key" ["+" "leaf"]

b-key is simply a placeholder to make it consistent with AArch64's
version. In Arm, however, it triggers a warning informing that b-key is
unsupported and a-key will be selected instead.

- Handle _attribute_((target(("branch-protection=..."))) for AArch32 with the
same grammer as the commandline options.

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
- Victor Campos
- Ties Stuij

Reviewed By: vhscampos

Differential Revision: https://reviews.llvm.org/D112421
2021-12-01 10:37:16 +00:00
..
ToolChains [clang][ARM] PACBTI-M frontend support 2021-12-01 10:37:16 +00:00
Action.cpp [CUDA][HIP] Add -fuse-cuid 2021-02-08 22:26:12 -05:00
CMakeLists.txt [PowerPC] [Clang] Enable Intel intrinsics support on FreeBSD 2021-11-22 20:42:10 +00:00
Compilation.cpp [clang] Remove redundant calls to c_str() (NFC) 2021-08-31 08:53:51 -07:00
Distro.cpp Add support of the next Ubuntu (Ubuntu 22.04 - Jammy Jellyfish) 2021-10-23 23:55:50 +02:00
Driver.cpp [PowerPC] [Clang] Enable Intel intrinsics support on FreeBSD 2021-11-22 20:42:10 +00:00
DriverOptions.cpp
Job.cpp [clang][driver] NFC: Expose InputInfo in Job instead of plain filenames 2021-07-27 09:18:58 +02:00
Multilib.cpp [clang] Use llvm::erase_if (NFC) 2021-10-17 13:50:29 -07:00
OptionUtils.cpp [NFC] Move OptionUtils from Basic to Driver 2019-12-23 08:11:23 -05:00
Phases.cpp
SanitizerArgs.cpp [clang] Use range-based for loops with llvm::reverse (NFC) 2021-11-17 19:40:48 -08:00
Tool.cpp [clang][driver] NFC: Move InputInfo.h from lib to include 2021-07-27 09:17:39 +02:00
ToolChain.cpp [Driver][Android] Remove unneeded isNoExecStackDefault 2021-11-17 18:15:24 -08:00
Types.cpp [clang] Remove duplication in types::getCompilationPhases() 2021-09-30 14:17:14 -04:00
XRayArgs.cpp [xray] Function coverage groups 2020-09-24 22:09:53 -04:00