This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC target_clone support (functionality question)

On Fri, May 05, 2017 at 01:38:03PM -0700, Evgeny Stupachenko wrote:
> On Fri, May 5, 2017 at 12:48 PM, Michael Meissner
> <> wrote:
> > On Fri, May 05, 2017 at 12:32:03PM -0700, Evgeny Stupachenko wrote:
> >> Hi Michael,
> >>
> >> On Fri, May 5, 2017 at 11:45 AM, Michael Meissner
> >> <> wrote:
> >> > This message is separated from the question about moving code, as it is a
> >> > questions about the functionality of target_clone support.
> >> >
> >> > Right now it looks like target_clone only generates the ifunc handler if there
> >> > is a call to the function in the object file.  It does not generate the ifunc
> >> > handler if there is no call.
> >> >
> >> > For the default function, it generates the normal name.  This means that any
> >> > function that calls the function from a different object module will only get
> >> > the standard function.  From a library and user perspective, I think this is
> >> > wrong.  Instead the default function should be generated with a different name,
> >> > and the ifunc function should list the standard name.  Then you don't have to
> >> > change all of the other calls in the object file, the normal ifunc handling
> >> > will handle it.  It also means you can more easily put this function in a
> >> > library and automatically call the appropriate version.
> >>
> >> I think library issue could be resolved using special headers. You can
> >> look into GLIBC, there should be similar technique.
> >> When you call resolver from initial (default) function, you make an
> >> assumption that ifunc is supported.
> >
> > Yes, ifunc should be required before you even consider using target_clone.
> If function foo() called using regular name it usually means that
> there is no information about ifunc support.

The whole point of ifunc is that the caller should not need to know whether a
function is a normal function or an ifunc function.  The linker handles it all
making it go through the PLT like it does for shared library functions.

I don't understand what you mean by this:

> Another object file which
> is built with target_clones will have foo() definition with
> foo.resolver inside.

And for users outside of GLIBC, it is more cumbersome to have to have the whole
infrastructure to build separate versions of the file, and then write separate
ifunc declaration.

Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email:, phone: +1 (978) 899-4797

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]