https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98482
--- Comment #9 from Uroš Bizjak <ubizjak at gmail dot com> --- (In reply to Topi Miettinen from comment #8) > 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 We are only lucky to get one temporary register (%r10), so perhaps the above could be implemented for NO_PROFILE_COUNTERS targets, where %r11 is also available.