https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98482
--- Comment #8 from Topi Miettinen <toiwoton at gmail dot com> ---
I'm unfortunately ignorant to GCC internals and usage of %r10, but otherwise
the patch looks good to me.
For -mcmodel=large -fPIC, the call sequence probably needs to be similar to how
other extern functions are called under those flags:
.L2:
movabsq $_GLOBAL_OFFSET_TABLE_-.L2, %reg0
leaq .L2(%rip), %reg1
movabsq $__fentry__@PLTOFF, %reg2
addq %reg0, %reg1
addq %reg1, %reg2
call *%reg2