https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115673
--- Comment #24 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to H.J. Lu from comment #21)
> Created attachment 60337 [details]
> A patch with tests
This patch isn't necessary. It is OK to indirect call via memory for
-mforce-indirect-call. The old codegen is
f2:
.LFB2:
.cfi_startproc
pushq %rbx
.cfi_def_cfa_offset 16
.cfi_offset 3, -16
movq f1@GOTPCREL(%rip), %rbx
call *%rbx
leaq f3(%rip), %rax
call *%rax
movq %rbx, %rax
popq %rbx
.cfi_def_cfa_offset 8
jmp *%rax
.cfi_endproc
The current one is better:
2:
.LFB2:
.cfi_startproc
subq $8, %rsp
.cfi_def_cfa_offset 16
call *f1@GOTPCREL(%rip)
leaq f3(%rip), %rax
call *%rax
addq $8, %rsp
.cfi_def_cfa_offset 8
jmp *f1@GOTPCREL(%rip)
.cfi_endproc