On Mon, Mar 18, 2013 at 10:02 AM, Paul Pluzhnikov <ppluzhni...@google.com> wrote: > +cc libc-alpha > > On Mon, Mar 18, 2013 at 9:05 AM, Xinliang David Li <davi...@google.com> wrote: >> Interesting idea about lazy IFUNC relocation. > >> On Mon, Mar 18, 2013 at 2:02 AM, Richard Biener >> <richard.guent...@gmail.com> wrote: > >>> On Fri, Mar 15, 2013 at 10:55 PM, Sriraman Tallam <tmsri...@google.com> >>> wrote: > >>>> This patch is meant for google/gcc-4_7 but I want this to be >>>> considered for trunk when it opens again. This patch makes it easy to >>>> test for code coverage of multiversioned functions. Here is a >>>> motivating example: > >>> Err. As we are using IFUNCs isn't it simply possible to do this in >>> the dynamic loader - for example by simlply pre-loading a library >>> with the IFUNC relocators implemented differently? Thus, shouldn't >>> we simply provide such library as a convenience? > > A similar need exists in glibc itself: it too has multiversioned functions, > and lack of testing has led to recent bugs in some of them. > > HJ has added a framework to test IFUNCs to glibc late last year, but it > would be nice to have a more general IFUNC control, so I could e.g. run > a binary on SSE4-capable machine A as that binary would run on SSE2-only > capable machine B. > > (We've had a few bugs recently, were the crash would only show on machine > B and not A. These are a pain to debug, as I may not have access to B.) > > If such a controller is implemented, I'd think it would have to be part > of GLIBC (or part of the ld-linux itself), and not of libgcc. > > LD_CPU_FEATURES=sse,sse2 ./a.out # run as if only sse and sse2 are > available >
We can pass environment variables to IFUNC selector. Maybe we can enable it for debug build. -- H.J.