public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] have ifunc resolver's return type match target
@ 2017-08-20 22:30 Martin Sebor
  2017-08-21 13:26 ` Joseph Myers
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Martin Sebor @ 2017-08-20 22:30 UTC (permalink / raw)
  To: GNU C Library

The following GCC patch has been submitted for review.  It
helps detect mismatches between the type of an ifunc or alias
declaration and the type of the resolver or alias.

   https://gcc.gnu.org/ml/gcc-patches/2017-08/msg01103.html

To let Glibc take advantage of this type checking and avoid
warnings when using the patched GCC when the change above is
committed, the patch below adjusts the Glibc __ifunc_resolver
macro to declare the ifunc resolver so that its return type
matches that of the target.  (I was going to wait to submit it
until after the GCC patch has been accepted but per Joseph's
suggestion I'm posting it here ahead of time.)

The patch has been tested on its own with the system GCC 6.3
and with the patched GCC on x86_64-linux with no regressions.

Martin

diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index fe3ab81..5413e56 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -790,7 +790,8 @@ for linking")

  /* Helper / base  macros for indirect function symbols.  */
  #define __ifunc_resolver(type_name, name, expr, arg, init, classifier) \
-  classifier inhibit_stack_protector void *name##_ifunc (arg) 
              \
+  classifier inhibit_stack_protector                                   \
+  __typeof (type_name) *name##_ifunc (arg)                             \
    {                                                                    \
      init ();                                                           \
      __typeof (type_name) *res = expr;                                  \

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-09-19 17:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).