]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix remaining return type of ifunc resolver declaration
authorGabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
Tue, 22 Aug 2017 17:01:07 +0000 (14:01 -0300)
committerGabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
Tue, 22 Aug 2017 22:08:27 +0000 (19:08 -0300)
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.

Tested for powerpc64le and s390x with unpatched GCC.

* include/libc-symbols.h: [!defined HAVE_GCC_IFUNC] (__ifunc):
Change the return type of the ifunc resolver to match the return
type of the target function.

ChangeLog
include/libc-symbols.h

index f64d0eacfa796efa7ce55a192aa25624d380f81e..1890507a018e9a56e1b0f45aa386b559bafd89cf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-08-22  Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>
+
+       * include/libc-symbols.h: [!defined HAVE_GCC_IFUNC] (__ifunc):
+       Change the return type of the ifunc resolver to match the return
+       type of the target function.
+
 2017-08-22  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
        * sysdeps/unix/sysv/linux/x86_64/syscalls.list (pread64): Remove.
index 42fc41a1a567af7c022d74c384c479e465df434d..3617baa8c664b2a627c1e4c291db77e0a05cecbb 100644 (file)
@@ -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);                            \
+  __typeof (type_name) *name##_ifunc (arg) __asm__ (#name);            \
   __ifunc_resolver (type_name, name, expr, arg, init,)                 \
  __asm__ (".type " #name ", %gnu_indirect_function");