This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC target_clone support (functionality question)
- From: Michael Meissner <meissner at linux dot vnet dot ibm dot com>
- To: Evgeny Stupachenko <evstupac at gmail dot com>
- Cc: Michael Meissner <meissner at linux dot vnet dot ibm dot com>, Segher Boessenkool <segher at kernel dot crashing dot org>, David Edelsohn <dje dot gcc at gmail dot com>, Jan Hubicka <hubicka at ucw dot cz>, Uros Bizjak <ubizjak at gmail dot com>, Kirill Yukhin <kirill dot yukhin at gmail dot com>, Richard Biener <rguenther at suse dot de>, Richard Henderson <rth at redhat dot com>, Jakub Jelinek <jakub at redhat dot com>, Richard Earnshaw <richard dot earnshaw at arm dot com>, Marcus Shawcroft <marcus dot shawcroft at arm dot com>, Nick Clifton <nickc at redhat dot com>, Ramana Radhakrishnan <ramana dot radhakrishnan at arm dot com>, Bernd Schmidt <bschmidt at redhat dot com>, Jeff Law <law at redhat dot com>, Hartmut Penner <hepenner at us dot ibm dot com>, Ulrich Weigand <uweigand at de dot ibm dot com>, Andreas Krebbel <Andreas dot Krebbel at de dot ibm dot com>, GCC mailing list <gcc at gcc dot gnu dot org>
- Date: Fri, 5 May 2017 16:50:38 -0400
- Subject: Re: GCC target_clone support (functionality question)
- Authentication-results: sourceware.org; auth=none
- References: <20170505181859.GA11428@ibm-tiger.the-meissners.org> <20170505184530.GA15560@ibm-tiger.the-meissners.org> <CAOvf_xzMMbbQ+adZ+hWYtxACn_6yS50nhhcVYeBuPnUKZNPc2g@mail.gmail.com> <20170505194820.GA29470@ibm-tiger.the-meissners.org> <CAOvf_xyeUdFnfXMszOb8ZcEava+pRmzTP2naErd5U8sr2E1xpw@mail.gmail.com>
On Fri, May 05, 2017 at 01:38:03PM -0700, Evgeny Stupachenko wrote:
> On Fri, May 5, 2017 at 12:48 PM, Michael Meissner
> <meissner@linux.vnet.ibm.com> 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
> >> <meissner@linux.vnet.ibm.com> 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: meissner@linux.vnet.ibm.com, phone: +1 (978) 899-4797