I know that this isn't exactly 100% gcc topic, but since it is
intimately coupled to binutils and its linker, I thought
at least someone here has done something similar....
Say yo want to call one of the foo_xxx functions, depending on the
certain functionality of the machine ( like having AVX2 unit etc)
You could check necessary condition during runtimne and call
correspondding function, however that would present indirect jump
penalty that would burden cachelines etc.
If one yould check that condition during dynamic linking or customized
dl-opening of a needed DSO, one could simply do all the needed job there
- ie
check the condition and relocate all the calls to foo to land on foo_A,
or foo_B etc.
That way, there would be no runtime speed penalties...
.