The .note.gnu.property must be in the assembly file to indicate the
support for BTI otherwise BTI will be disabled for the whole library.
__unw_getcontext and libunwind::Registers_arm64::jumpto() may be called
indirectly therefore they should start with a landing pad.
Details
- Reviewers
phosek tamas.petz chill olista01 miyuki compnerd - Group Reviewers
Restricted Project - Commits
- rGf34ae1b9de68: [AArch64] Add v8.5 Branch Target Identification support.
Diff Detail
Event Timeline
Please help me how to add a test for it, in the current state this patch won't do anything because the standard build for libunwind does not add -mbranch-protection=standard (or bti).
libunwind/src/assembly.h | ||
---|---|---|
47 | This will be emitted for all functions, but we need only one per object file, isn't it ? Also, could you, please, rename PPC64OPD{1,2} to TARGET_OPD{1,2}, or {ARCH ...}, something like that. |
I suggest adding a CMake variable to configure the branch protection option used when building the C++ libraries
libunwind/src/assembly.h | ||
---|---|---|
46 | Just use defined(__aarch64__). I deleted __arm64__ in D77829 | |
48 | I am worried that we may want to change the section type for .note.gnu.property https://sourceware.org/pipermail/binutils/2020-April/000372.html |
Mostly good apart from the renaming issue and a nit about comments. I have some patches in the BTI/PAC area, so I am confident.
libunwind/src/assembly.h | ||
---|---|---|
47 | @chill | |
53 | The comments can be added right after .long |
libunwind/src/assembly.h | ||
---|---|---|
62 | This really needs to use a new macro. I expect a __ARM_FEATURE_BTI_DEFAULT toolchain capable of assembling bti c |
libunwind/src/assembly.h | ||
---|---|---|
163 | All right, of these are to stay named PPC64_OPD, then just add a new line with, say, AARCH64_BTI, e..g #define DEFINE_LIBUNWIND_FUNCTION(name) \ .globl SYMBOL_NAME(name) SEPARATOR \ HIDDEN_SYMBOL(SYMBOL_NAME(name)) SEPARATOR \ SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \ PPC64_OPD1 \ SYMBOL_NAME(name): \ PPC64_OPD2 \ AARCH64_BTI |
libunwind/src/assembly.h | ||
---|---|---|
53 | Missed this comment in the previous version. |
libunwind/src/assembly.h | ||
---|---|---|
51 | I'm not sure if the defined(__aarch64__) check is absolutely required, but it doesn't give the wrong result. |
libunwind/src/assembly.h | ||
---|---|---|
51 | Thanks, fixed it. |
libunwind/src/assembly.h | ||
---|---|---|
51–63 | adding the flag to only the assembly files would be huge change in the cmake files, so I revoke my idea to drop the note from here. |
Just use defined(__aarch64__). I deleted __arm64__ in D77829