[all-commits] [llvm/llvm-project] 235055: [LowerTypeTests, ARM] Support Armv8-M BTI in jump t...
Simon Tatham via All-commits
all-commits at lists.llvm.org
Fri Aug 11 09:42:35 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 235055cacadbb2e3e1fc523ebb49ae5879f848aa
https://github.com/llvm/llvm-project/commit/235055cacadbb2e3e1fc523ebb49ae5879f848aa
Author: Simon Tatham <simon.tatham at arm.com>
Date: 2023-08-11 (Fri, 11 Aug 2023)
Changed paths:
M llvm/lib/Transforms/IPO/LowerTypeTests.cpp
M llvm/test/Transforms/LowerTypeTests/function-arm-thumb.ll
A llvm/test/Transforms/LowerTypeTests/function-thumb-bti.ll
M llvm/test/Transforms/LowerTypeTests/function.ll
Log Message:
-----------
[LowerTypeTests,ARM] Support Armv8-M BTI in jump tables.
This adds support for the branch target enforcement system available
in 32-bit Armv8-M, following the pattern of the implementation that
already exists for the analogous AArch64 feature. If we're generating
a Thumb jump table, and branch target enforcement is enabled in the
module being processed, then we must put a BTI instruction at the
start of each jump table entry, to make it a valid target for an
indirect branch.
Also, we clear the branch-target-enforcement flag on the naked
function that contains the jump table asm statement, to ensure a spare
BTI doesn't accidentally appear at the start of that. (Again, this is
how AArch64 already does it.) This is done unconditionally, on the
theory that clearing those flags should be harmless in any existing
situation.
To avoid too much tedious code duplication, I've factored out
AArch64's check for branch target enforcement into a helper method of
LowerTypeTestsModule, so that it can be called more conveniently from
lots of places. While I was doing that, I also made it cache its
result, so it no longer calls M.getModuleFlag with the same string key
for every single jump table entry it generates.
Reviewed By: MaskRay, danielkiss, olista01
Differential Revision: https://reviews.llvm.org/D157688
More information about the All-commits
mailing list