On 6/6/19 5:21 AM, Dave Martin wrote: >> +/* >> + * Create the PT_NOTE that will enable BTI in the page tables. >> + * This will be created by the compiler with -mbranch-protection=standard, >> + * but as of 2019-03-29, this is has not been committed to gcc mainline. >> + * This will probably be in GCC10. > > FYI, GCC9 has it.
Thanks. >> + */ >> +asm(".section .note.gnu.property,\"a\"\n\ >> + .align 3\n\ >> + .long 4\n\ >> + .long 16\n\ >> + .long 5\n\ >> + .string \"GNU\"\n\ >> + .long 0xc0000000\n\ >> + .long 4\n\ >> + .long 1\n\ >> + .align 3\n\ >> + .previous"); > > Note, this won't be enough to generate the PT_GNU_PROPERTY entry in the > program header table using older tools. > > This may be work-round-able with a linker script, but I haven't looked > into it. Yes, a linker script can create such an entry. >> +AARCH64_TESTS += bti-1 >> +bti-1: LDFLAGS += -nostartfiles -nodefaultlibs -nostdlib >> + > > Doesn't -nostdlib imply -nodefaultlibs and -nostartfiles? I don't believe so, but I'll double-check. r~