using target clones

Dave Love fx@gnu.org
Thu Feb 14 16:35:00 GMT 2019


I'm trying to use the target_clones attribute on C functions in a
library (BLIS linear algebra, for what it's worth) and failing.  This is
with gcc-6 on Debian stable, i.e. with recent enough binutils, if that
makes a difference.

The functions are in their own source files (actually a set of numeric
type variants of each).  It seems experimentally as if the functions
have to be obviously used somehow, possibly in the same file, to get a
resolver function for some reason.  I can get a resolver in the object
with a dummy call in the source file.  However, when I build a shared
library with the result, the resolver and clones disappear from the
result.  I've also tried LTO to no avail, hoping that might help, as the
kernels are called from elsewhere in the library.

This seems a canonical sort of use for clones, but I can't find any
guidance on making it work.  Can someone reveal a relevant trick, or
explain what's going wrong?  Thanks.



More information about the Gcc-help mailing list