public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: libc-alpha@sourceware.org, libc-ports@sourceware.org
Subject: Include hwcap as ifunc argument
Date: Fri, 25 May 2012 17:44:00 -0000	[thread overview]
Message-ID: <4FBFC4EC.1060209@twiddle.net> (raw)
In-Reply-To: <4FBA744A.6000702@twiddle.net>

[-- Attachment #1: Type: text/plain, Size: 64 bytes --]

Committed as follows, after re-testing on arm, ppc[32/64].


r~

[-- Attachment #2: z1 --]
[-- Type: text/plain, Size: 1686 bytes --]

        * sysdeps/arm/dl-irel.h (elf_ifunc_invoke): Pass dl_hwcap.
        * sysdeps/arm/dl-machine.h (elf_machine_rel): Use elf_ifunc_invoke.
        (elf_machine_rela): Likewise.



diff --git a/sysdeps/arm/dl-irel.h b/sysdeps/arm/dl-irel.h
index 5141031..5b1964e 100644
--- a/sysdeps/arm/dl-irel.h
+++ b/sysdeps/arm/dl-irel.h
@@ -29,7 +29,7 @@ static inline Elf32_Addr
 __attribute ((always_inline))
 elf_ifunc_invoke (Elf32_Addr addr)
 {
-  return ((Elf32_Addr (*) (void)) (addr)) ();
+  return ((Elf32_Addr (*) (unsigned long int)) (addr)) (GLRO(dl_hwcap));
 }
 
 static inline void
diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
index 58cf418..8d905e8 100644
--- a/sysdeps/arm/dl-machine.h
+++ b/sysdeps/arm/dl-machine.h
@@ -25,6 +25,7 @@
 #include <sys/param.h>
 #include <tls.h>
 #include <dl-tlsdesc.h>
+#include <dl-irel.h>
 
 #define CLEAR_CACHE(BEG,END)						\
   INTERNAL_SYSCALL_ARM (cacheflush, , 3, (BEG), (END), 0)
@@ -377,7 +378,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
 	  && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0)
 	  && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1)
 	  && __builtin_expect (!skip_ifunc, 1))
-	value = ((Elf32_Addr (*) (void)) value) ();
+	value = elf_ifunc_invoke (value);
 
       switch (r_type)
 	{
@@ -551,7 +552,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 	  && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0)
 	  && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1)
 	  && __builtin_expect (!skip_ifunc, 1))
-	value = ((Elf32_Addr (*) (void)) value) ();
+	value = elf_ifunc_invoke (value);
 
       switch (r_type)
 	{

[-- Attachment #3: z2 --]
[-- Type: text/plain, Size: 3723 bytes --]

        * sysdeps/powerpc/powerpc32/dl-irel.h (elf_ifunc_invoke): Pass
        dl_hwcap to ifunc resolver.
        * sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_rela): Use
        elf_ifunc_invoke.
        * sysdeps/powerpc/powerpc64/dl-irel.h (elf_ifunc_invoke): Pass
        dl_hwcap to ifunc resolver.
        * sysdeps/powerpc/powerpc64/dl-machine.h (resolve_ifunc): Likewise.



diff --git a/sysdeps/powerpc/powerpc32/dl-irel.h b/sysdeps/powerpc/powerpc32/dl-irel.h
index c8e50ee..ebaf44a 100644
--- a/sysdeps/powerpc/powerpc32/dl-irel.h
+++ b/sysdeps/powerpc/powerpc32/dl-irel.h
@@ -1,6 +1,6 @@
 /* Machine-dependent ELF indirect relocation inline functions.
    PowerPC version.
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -29,7 +29,7 @@ static inline Elf32_Addr
 __attribute ((always_inline))
 elf_ifunc_invoke (Elf32_Addr addr)
 {
-  return ((Elf32_Addr (*) (void)) (addr)) ();
+  return ((Elf32_Addr (*) (unsigned long int)) (addr)) (GLRO(dl_hwcap));
 }
 
 static inline void
diff --git a/sysdeps/powerpc/powerpc32/dl-machine.h b/sysdeps/powerpc/powerpc32/dl-machine.h
index 45868f5..3ae27a4 100644
--- a/sysdeps/powerpc/powerpc32/dl-machine.h
+++ b/sysdeps/powerpc/powerpc32/dl-machine.h
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  PowerPC version.
-   Copyright (C) 1995-2003, 2005, 2006, 2011 Free Software Foundation, Inc.
+   Copyright (C) 1995-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -23,6 +23,7 @@
 
 #include <assert.h>
 #include <dl-tls.h>
+#include <dl-irel.h>
 
 /* Translate a processor specific dynamic tag to the index
    in l_info array.  */
@@ -308,7 +309,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
       && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0)
       && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1)
       && __builtin_expect (!skip_ifunc, 1))
-    value = ((Elf32_Addr (*) (void)) value) ();
+    value = elf_ifunc_invoke (value);
 
   /* A small amount of code is duplicated here for speed.  In libc,
      more than 90% of the relocs are R_PPC_RELATIVE; in the X11 shared
diff --git a/sysdeps/powerpc/powerpc64/dl-irel.h b/sysdeps/powerpc/powerpc64/dl-irel.h
index 7270275..ced0f3f 100644
--- a/sysdeps/powerpc/powerpc64/dl-irel.h
+++ b/sysdeps/powerpc/powerpc64/dl-irel.h
@@ -1,6 +1,6 @@
 /* Machine-dependent ELF indirect relocation inline functions.
    PowerPC64 version.
-   Copyright (C) 2009, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -31,7 +31,7 @@ static inline Elf64_Addr
 __attribute ((always_inline))
 elf_ifunc_invoke (Elf64_Addr addr)
 {
-  return ((Elf64_Addr (*) (void)) (addr)) ();
+  return ((Elf64_Addr (*) (unsigned long int)) (addr)) (GLRO(dl_hwcap));
 }
 
 static inline void
diff --git a/sysdeps/powerpc/powerpc64/dl-machine.h b/sysdeps/powerpc/powerpc64/dl-machine.h
index a964a29..7c7d768 100644
--- a/sysdeps/powerpc/powerpc64/dl-machine.h
+++ b/sysdeps/powerpc/powerpc64/dl-machine.h
@@ -545,7 +545,7 @@ resolve_ifunc (Elf64_Addr value,
       value = (Elf64_Addr) &opd;
     }
 #endif
-  return ((Elf64_Addr (*) (void)) value) ();
+  return ((Elf64_Addr (*) (unsigned long int)) value) (GLRO(dl_hwcap));
 }
 
 /* Perform the relocation specified by RELOC and SYM (which is fully

  parent reply	other threads:[~2012-05-25 17:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4FBA744A.6000702@twiddle.net>
2012-05-24 14:40 ` [ppc] " Richard Henderson
2012-05-24 14:45   ` Joseph S. Myers
2012-05-24 19:47   ` David Miller
2012-05-25 17:44 ` Richard Henderson [this message]
2012-06-04 21:22   ` Ryan S. Arnold
2012-06-04 22:14     ` Richard Henderson
2012-06-08 14:01       ` Andreas Krebbel
2012-06-08 14:49         ` Richard Henderson

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=4FBFC4EC.1060209@twiddle.net \
    --to=rth@twiddle.net \
    --cc=libc-alpha@sourceware.org \
    --cc=libc-ports@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).