diff options
author | Fangrui Song <maskray@google.com> | 2020-01-29 18:00:57 -0800 |
---|---|---|
committer | Hans Wennborg <hans@chromium.org> | 2020-02-03 13:57:25 +0100 |
commit | cbd4815dec165fc4190f30cd6f409334c7e59063 (patch) | |
tree | a922b02faef07f334b74dd041d8e97ac8c945ee1 /llvm/include | |
parent | dd50560c38dbdcf1e809f15b4f3c26152f439a03 (diff) | |
download | bcm5719-llvm-cbd4815dec165fc4190f30cd6f409334c7e59063.tar.gz bcm5719-llvm-cbd4815dec165fc4190f30cd6f409334c7e59063.zip |
[AArch64] -fpatchable-function-entry=N,0: place patch label after BTI
Summary:
For -fpatchable-function-entry=N,0 -mbranch-protection=bti, after
9a24488cb67a90f889529987275c5e411ce01dda, we place the NOP sled after
the initial BTI.
```
.Lfunc_begin0:
bti c
nop
nop
.section __patchable_function_entries,"awo",@progbits,f,unique,0
.p2align 3
.xword .Lfunc_begin0
```
This patch adds a label after the initial BTI and changes the __patchable_function_entries entry to reference the label:
```
.Lfunc_begin0:
bti c
.Lpatch0:
nop
nop
.section __patchable_function_entries,"awo",@progbits,f,unique,0
.p2align 3
.xword .Lpatch0
```
This placement is compatible with the resolution in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92424 .
A local linkage function whose address is not taken does not need a BTI.
Placing the patch label after BTI has the advantage that code does not
need to differentiate whether the function has an initial BTI.
Reviewers: mrutland, nickdesaulniers, nsz, ostannard
Subscribers: kristof.beyls, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73680
(cherry picked from commit 06b8e32d4fd3f634f793e3bc0bc4fdb885e7a3ac)
Diffstat (limited to 'llvm/include')
-rw-r--r-- | llvm/include/llvm/CodeGen/AsmPrinter.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/include/llvm/CodeGen/AsmPrinter.h b/llvm/include/llvm/CodeGen/AsmPrinter.h index a860ce2773e..c710c5d7055 100644 --- a/llvm/include/llvm/CodeGen/AsmPrinter.h +++ b/llvm/include/llvm/CodeGen/AsmPrinter.h @@ -135,7 +135,6 @@ public: MapVector<const MCSymbol *, GOTEquivUsePair> GlobalGOTEquivs; private: - MCSymbol *CurrentFnBegin = nullptr; MCSymbol *CurrentFnEnd = nullptr; MCSymbol *CurExceptionSym = nullptr; @@ -148,6 +147,8 @@ private: static char ID; protected: + MCSymbol *CurrentFnBegin = nullptr; + /// Protected struct HandlerInfo and Handlers permit target extended /// AsmPrinter adds their own handlers. struct HandlerInfo { |