diff options
author | Fangrui Song <maskray@google.com> | 2020-01-20 14:57:11 -0800 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2020-01-23 17:02:27 -0800 |
commit | 22467e259507f5ead2a87d989251b4c951a587e4 (patch) | |
tree | 6e6abbe968f68f19b18815431fb7a6d617f1eac3 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | f394d22fa82df03eaf72bf1876e2d63bbe6cd00f (diff) | |
download | llvm-22467e259507f5ead2a87d989251b4c951a587e4.zip llvm-22467e259507f5ead2a87d989251b4c951a587e4.tar.gz llvm-22467e259507f5ead2a87d989251b4c951a587e4.tar.bz2 |
Add function attribute "patchable-function-prefix" to support -fpatchable-function-entry=N,M where M>0
Similar to the function attribute `prefix` (prefix data),
"patchable-function-prefix" inserts data (M NOPs) before the function
entry label.
-fpatchable-function-entry=2,1 (1 NOP before entry, 1 NOP after entry)
will look like:
```
.type foo,@function
.Ltmp0: # @foo
nop
foo:
.Lfunc_begin0:
# optional `bti c` (AArch64 Branch Target Identification) or
# `endbr64` (Intel Indirect Branch Tracking)
nop
.section __patchable_function_entries,"awo",@progbits,get,unique,0
.p2align 3
.quad .Ltmp0
```
-fpatchable-function-entry=N,0 + -mbranch-protection=bti/-fcf-protection=branch has two reasonable
placements (https://gcc.gnu.org/ml/gcc-patches/2020-01/msg01185.html):
```
(a) (b)
func: func:
.Ltmp0: bti c
bti c .Ltmp0:
nop nop
```
(a) needs no additional code. If the consensus is to go for (b), we will
need more code in AArch64BranchTargets.cpp / X86IndirectBranchTracking.cpp .
Differential Revision: https://reviews.llvm.org/D73070
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions