https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85620
H.J. Lu <hjl.tools at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2018-05-02 CC| |igor.v.tsimbalist at intel dot com Blocks| |81652 Summary|swapcontext isn't marked |Missing ENDBR after |return twice |swapcontext Ever confirmed|0 |1 --- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> --- [hjl@gnu-skx-1 ucontext-1]$ cat y.i struct ucontext; typedef struct ucontext ucontext_t; extern int swapcontext (ucontext_t *__restrict __oucp, const ucontext_t *__restrict __ucp); extern int res; void foo (ucontext_t *oucp, ucontext_t *ucp) { res = swapcontext (oucp, ucp); } [hjl@gnu-skx-1 ucontext-1]$ make y.s /export/build/gnu/gcc-8-test/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/gcc-8-test/build-x86_64-linux/gcc/ -O2 -fcf-protection -S y.i [hjl@gnu-skx-1 ucontext-1]$ cat y.s .file "y.i" .text .p2align 4,,15 .globl foo .type foo, @function foo: .LFB0: .cfi_startproc endbr64 subq $8, %rsp .cfi_def_cfa_offset 16 call swapcontext <<<<<<< This may return via indirect branch. <<<<<<<<<<< Need ENDBR here. movl %eax, res(%rip) addq $8, %rsp .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE0: .size foo, .-foo .ident "GCC: (GNU) 8.1.1 20180502" .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-skx-1 ucontext-1]$ Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81652 [Bug 81652] [meta-bug] -fcf-protection=full bugs