public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Martin Sebor <msebor@gmail.com>
To: "Gabriel F. T. Gomes" <gftg@linux.vnet.ibm.com>,
	libc-alpha@sourceware.org
Cc: joseph@codesourcery.com
Subject: Re: [PATCH] Fix remaining return type of ifunc resolver declaration
Date: Tue, 22 Aug 2017 18:54:00 -0000	[thread overview]
Message-ID: <f46757ec-ad7a-4cbf-3d75-41a6e253f6ab@gmail.com> (raw)
In-Reply-To: <20170822180214.31800-1-gftg@linux.vnet.ibm.com>

On 08/22/2017 12:02 PM, Gabriel F. T. Gomes wrote:
> Since Martin Sebor's commit
>
> commit ee4e992ebe5f9712faedeefe8958b67d61eaa0f2
> Author: Martin Sebor <msebor@redhat.com>
> Date:   Tue Aug 22 09:35:23 2017 -0600
>
>     Declare ifunc resolver to return a pointer to the same type as the target
>     function to help GCC detect incompatibilities between the two when it's
>     enhanced to do so.
>
> builds for powerpc64le fail in the declaration of some ifunc resolvers,
> because the ifunc is declared with unmatching return types.  One of the
> declarations comes from the __ifunc_resolver macro, which was patched by
> the aforementioned commit:
>
>     /* Helper / base  macros for indirect function symbols.  */
>     #define __ifunc_resolver(type_name, name, expr, arg, init, classifier) \
>       classifier inhibit_stack_protector                                   \
>       __typeof (type_name) *name##_ifunc (arg)                             \
>
> whereas the other comes from the unpatched __ifunc macro when
> HAVE_GCC_IFUNC is not defined:
>
>     # define __ifunc(type_name, name, expr, arg, init)                     \
>       extern __typeof (type_name) name;                                    \
>       void *name##_ifunc (arg) __asm__ (#name);                            \
>
> This patch changes the return type of the ifunc resolver in the __ifunc
> macro, so that it matches the return type of the target function,
> similarly to what the aforementioned commit does.

Sorry about that and thanks for patching it up.  I didn't think
to check all the other __ifunc macros in the file for their uses
of __ifunc_resolver.

Martin

>
> Tested for powerpc64le and s390x with unpatched GCC.
> ---
>  include/libc-symbols.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/libc-symbols.h b/include/libc-symbols.h
> index 42fc41a1a5..65738caaa7 100644
> --- a/include/libc-symbols.h
> +++ b/include/libc-symbols.h
> @@ -831,7 +831,7 @@ for linking")
>
>  # define __ifunc(type_name, name, expr, arg, init)			\
>    extern __typeof (type_name) name;					\
> -  void *name##_ifunc (arg) __asm__ (#name);				\
> +  extern __typeof (type_name) *name##_ifunc (arg) __asm__ (#name);	\
>    __ifunc_resolver (type_name, name, expr, arg, init,)			\
>   __asm__ (".type " #name ", %gnu_indirect_function");
>
>

  reply	other threads:[~2017-08-22 18:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-20 22:30 [PATCH] have ifunc resolver's return type match target Martin Sebor
2017-08-21 13:26 ` Joseph Myers
2017-08-22 18:02 ` [PATCH] Fix remaining return type of ifunc resolver declaration Gabriel F. T. Gomes
2017-08-22 18:54   ` Martin Sebor [this message]
2017-08-22 20:14   ` Joseph Myers
2017-08-22 22:54     ` Gabriel F. T. Gomes
2017-08-23  9:28 ` [PATCH] have ifunc resolver's return type match target Florian Weimer
2017-08-23 14:48   ` Martin Sebor
2017-09-19 17:07     ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f46757ec-ad7a-4cbf-3d75-41a6e253f6ab@gmail.com \
    --to=msebor@gmail.com \
    --cc=gftg@linux.vnet.ibm.com \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).