[google][4.7]Using CPU mocks to test code coverage of multiversioned functions

Sriraman Tallam tmsriram@google.com
Mon Mar 25 21:24:00 GMT 2013


On Mon, Mar 18, 2013 at 10:44 PM, Alan Modra <amodra@gmail.com> wrote:
> On Mon, Mar 18, 2013 at 06:18:58PM +0100, Richard Biener wrote:
>> I was asking for the ifunc selector to be
>> Overridable by ld_preload or a similar mechanism at dynamic load time.
> Please don't.  Calling an ifunc resolver function in another library
> is just asking for trouble with current glibc.  Why?  Well, the other
> library containing the resolver function may not have had any dynamic
> relocations applied.  So if the resolver makes use of the GOT (to read
> some variable), it will use unrelocated addresses.  You'll segfault if
> you're lucky.

Does this also mean that Paul's idea of doing:

LD_CPU_FEATURES=sse,sse2 ./a.out  # run as if only sse and sse2 are available

is fraught with risk when used with IFUNC, particularly on x86_64?

Shouldn't the IFUNC resolver go through the GOT even in this case.
This could work well for the MV testing problem I explained earlier,
but if this is not feasible with IFUNC in play I would like my
original proposal reconsidered.


> For anyone playing with ifunc, please test out your great ideas on
> i386, ppc32, mips, arm, etc. *NOT* x86_64 or powerpc64 which both
> avoid the GOT in many cases.
> --
> Alan Modra
> Australia Development Lab, IBM

More information about the Gcc-patches mailing list