[PATCH] D73070: Add function attribute "patchable-function-prefix" to support -fpatchable-function-entry=N,M where M>0
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 20 16:46:03 PST 2020
MaskRay created this revision.
MaskRay added reviewers: craig.topper, nickdesaulniers, nsz, ostannard, peter.smith.
Herald added subscribers: llvm-commits, hiraditya, kristof.beyls.
Herald added a project: LLVM.
MaskRay added a child revision: D73071: [X86] 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, at 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", at 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 .
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D73070
Files:
llvm/include/llvm/CodeGen/AsmPrinter.h
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/IR/Verifier.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/test/CodeGen/AArch64/patchable-function-entry-bti.ll
llvm/test/CodeGen/AArch64/patchable-function-entry.ll
llvm/test/Verifier/invalid-patchable-function-entry.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73070.239211.patch
Type: text/x-patch
Size: 7574 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200121/469a4f55/attachment.bin>
More information about the llvm-commits
mailing list