https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82659
Bug ID: 82659 Summary: Unnecessary ENDBR in static/local functions Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: hjl.tools at gmail dot com CC: igor.v.tsimbalist at intel dot com Blocks: 81652 Target Milestone: --- Since the address of the static function, test, is never taken, there is no need for ENDBR: [hjl@gnu-tools-1 cet-4]$ cat x.i extern int x; static void __attribute__ ((noinline, noclone)) test (int i) { x = i; } void bar (int i) { test (i); } [hjl@gnu-tools-1 cet-4]$ make /export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -fcf-protection=full -mcet -O2 -S x.i [hjl@gnu-tools-1 cet-4]$ cat x.s .file "x.i" .text .p2align 4,,15 .type test, @function test: .LFB0: .cfi_startproc endbr64 ^^^^^^^^^^^^^^^^^^ Not needed. movl %edi, x(%rip) ret .cfi_endproc .LFE0: .size test, .-test .p2align 4,,15 .globl bar .type bar, @function bar: .LFB1: .cfi_startproc endbr64 jmp test .cfi_endproc .LFE1: .size bar, .-bar .ident "GCC: (GNU) 8.0.0 20171022 (experimental)" .section .note.GNU-stack,"",@progbits .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 4: [hjl@gnu-tools-1 cet-4]$ Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81652 [Bug 81652] [meta-bug] -fcf-protection=full -mcet bugs