This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Function Multiversioning in GCC6
- From: "O Mahony, Billy" <billy dot o dot mahony at intel dot com>
- To: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Wed, 22 Mar 2017 10:51:44 +0000
- Subject: Function Multiversioning in GCC6
- Authentication-results: sourceware.org; auth=none
Hi,
I've just started playing with FMV in GCC6.
Ideally I was hoping that the 'target' attribute which works only for C++ in GCC4 would now work with C in GCC6. I already have hand-crafted architecture specific versions of some C functions that I'd like to keep. Currently there is a manual selection/dispatch mechanism based on cupid and function pointers but the ifunc mechanism system of __attribute__ target would be much better.
However when I compile the first example in this LWN article https://lwn.net/Articles/691932/ with gcc-6 C compiler it fails with (error: redefinition of 'foo'...) .
Can someone confirm if the target attrib works for with gcc-6 C compiler or is it just the new target_clones attrib that works with the C compiler? If it should work, is there a secret sauce (gcc cli option or whatever) required - the gcc6 manual doesn't say much and the FMV wiki has not been updated since 4.x.
Alternatively is there a way to use target_clones but with specific implementations for each architecture?
Thanks for any help!
Billy.