On Mon, 27 Mar 2023 at 14:45, Leif Lindholm <quic_llind...@quicinc.com> wrote: > > On Mon, Mar 27, 2023 at 13:00:56 +0200, Ard Biesheuvel wrote: > > Implement a CPP macro that can be called from .S files to emit the .note > > section carrying the annotation that informs the linker that the object > > file is compatible with BTI control flow integrity checks. > > > > Signed-off-by: Ard Biesheuvel <a...@kernel.org> > > --- > > MdePkg/Include/AArch64/ProcessorBind.h | 31 ++++++++++++++++++++ > > 1 file changed, 31 insertions(+) > > > > diff --git a/MdePkg/Include/AArch64/ProcessorBind.h > > b/MdePkg/Include/AArch64/ProcessorBind.h > > index abe2571245c665f3..11814f1ffaef698a 100644 > > --- a/MdePkg/Include/AArch64/ProcessorBind.h > > +++ b/MdePkg/Include/AArch64/ProcessorBind.h > > @@ -186,6 +186,37 @@ typedef INT64 INTN; > > #define GCC_ASM_IMPORT(func__) \ > > .extern _CONCATENATE (__USER_LABEL_PREFIX__, func__) > > > > +#if defined(__ARM_FEATURE_BTI_DEFAULT) && __ARM_FEATURE_BTI_DEFAULT == 1 > > +#define AARCH64_BTI(__type) \ > > + .ifnc __type, ;\ > > + bti __type ;\ > > + .endif ;\ > > This didn't jump out at me until looking at the consumer side. > This overlays two different sets of functionality depending on whether > an option is given to the macro or not, which feels semantically > suboptimal to me (i.e. it makes my head hurt). > > Could we split this into two macros - one that inserts the instruction > and one that inserts the note, and expand the latter in the former? >
Yeah, fair point. So AARCH64_BTI_NOTE() to emit the note, and AARCH64_BTI() to emit the instruction as well as the note. -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#101949): https://edk2.groups.io/g/devel/message/101949 Mute This Topic: https://groups.io/mt/97879282/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-