------- Comment #4 from hjl dot tools at gmail dot com 2009-06-24 16:07 ------- (In reply to comment #3) > Option 2) is certainly the least intrusive in the compiler and you can use it > even with foo's prototype and calling it from the same CU, just use asm. > __typeof (foo) * > __attribute__ ((ifunc)) > foo_ifunc (void) __asm ("foo") > { > <return address of foo_{1,2,3}> > } > If you don't have a prototype, you can use the variant originally mentioned in > option 2). Most users will wrap this stuff in a macro anyway and in that case > whether they use just an attribute or attribute and __asm is not a big deal.
I think we enforce type check on return value of ifunc function. This is a user feature. Option 3 is the most user friendly. We only need to change the return type to a pointer to function prototype inside ifunc function body. I have a patch for option 3. It isn't too bad. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40528