[Bug target/102952] New code-gen options for retpolines and straight line speculation

hjl.tools at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Oct 27 22:42:59 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102952

--- Comment #17 from H.J. Lu <hjl.tools at gmail dot com> ---
[hjl@gnu-tgl-2 pr102952]$ cat z2.i
extern void (*fptr) (int, int);

void
foo (int x, int y)
{
  fptr (x, y);
}
[hjl@gnu-tgl-2 pr102952]$ make z2.s
/export/build/gnu/tools-build/gcc-gitlab-debug/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/tools-build/gcc-gitlab-debug/build-x86_64-linux/gcc/ -O2
-mindirect-branch=thunk -mindirect-branch-cs-prefix -mharden-sls=all -S z2.i
[hjl@gnu-tgl-2 pr102952]$ cat z2.s
        .file   "z2.i"
        .text
        .p2align 4
        .globl  foo
        .type   foo, @function
foo:
.LFB0:
        .cfi_startproc
        movq    fptr(%rip), %rax
        jmp     __x86_indirect_thunk_rax

Is int3 needed here?

        .cfi_endproc
.LFE0:
        .size   foo, .-foo
        .section       
.text.__x86_indirect_thunk_rax,"axG",@progbits,__x86_indirect_thunk_rax,comdat
        .globl  __x86_indirect_thunk_rax
        .hidden __x86_indirect_thunk_rax
        .type   __x86_indirect_thunk_rax, @function
__x86_indirect_thunk_rax:
.LFB1:
        .cfi_startproc
        call    .LIND1
.LIND0:
        pause
        lfence
        jmp     .LIND0
.LIND1:
        .cfi_def_cfa_offset 16
        mov     %rax, (%rsp)
        ret
        int3   <<<<<<<<<<<<<<<<<<<< Is this needed?
        .cfi_endproc
.LFE1:
        .ident  "GCC: (GNU) 12.0.0 20211027 (experimental)"
        .section        .note.GNU-stack,"",@progbits
[hjl@gnu-tgl-2 pr102952]$


More information about the Gcc-bugs mailing list