https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119372
Bug ID: 119372
Summary: Aarch64: Compiling with -march=armv8-a+pauth
-mbranch-protection=standard produces autiasp and
retaa in the function epilogue
Product: gcc
Version: 14.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: Alfie.Richards at arm dot com
Target Milestone: ---
When compiling a simple test with "-march=armv8-a+pauth
-mbranch-protection=standard", even though pauth is available only from v8.2-a,
extra "autiasp" instruction is wrongfully generated by gcc-14 but the issues is
fixed in gcc-15.
```
$ cat test.c
extern void callee(void);
void caller(void)
{
callee();
callee();
}
$ aarch64-none-linux-gnu-gcc -march=armv8-a+pauth -mbranch-protection=standard
-c test.c
$ aarch64-none-linux-gnu-objdump -d test.o
test.o: file format elf64-littleaarch64
Disassembly of section .text:
0000000000000000 <caller>:
0: d503233f paciasp
4: a9bf7bfd stp x29, x30, [sp, #-16]!
8: 910003fd mov x29, sp
c: 94000000 bl 0 <callee>
10: 94000000 bl 0 <callee>
14: d503201f nop
18: a8c17bfd ldp x29, x30, [sp], #16
1c: d50323bf autiasp
20: d65f0bff retaa
```
Affects GCC 11 (when support for pauth was added) through 14 (fixed in 15)