[PATCH] manual: Document indirect functions (IFUNC)

Andreas Schwab schwab@suse.de
Wed Jun 17 10:21:02 GMT 2026


On Jun 17 2026, Yury Khrustalev wrote:

> On Wed, Jun 10, 2026 at 03:24:06PM -0300, Adhemerval Zanella wrote:
>> +Indirect functions are usually defined using the @code{ifunc} function
>> +attribute provided by GCC and compatible compilers:
>> +
>> +@smallexample
>> +static int
>> +my_func_generic (int a)
>> +@{
>> +  /* @r{@dots{}} */
>> +@}
>> +
>> +static int
>> +my_func_vectorized (int a)
>> +@{
>> +  /* @r{@dots{}} */
>> +@}
>> +
>> +/* @r{The resolver returns the address of the selected
>> +   implementation.}  */
>> +static int (*my_func_resolver (void)) (int)
>
> Perhaps, static int (*my_func_resolver (int)) (void)?

static typeof (my_func_generic) *
my_func_resolver (void)

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


More information about the Libc-alpha mailing list