This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [ppc] Include hwcap as ifunc argument


On Mon, 2012-05-21 at 09:58 -0700, Richard Henderson wrote:
> Aside from the x86 port, there are only two targets that have ifunc
> support in glibc mainline: ppc and arm.  It would be awesomely handy
> if we switch these targets to mirror the sparc lead in passing along
> the dl_hwcap contents as an argument to the resolver, *and* to do it
> in the same release as adding getauxval.  There are some clever things
> we can do at static link time if we know that getauxval corresponds to
> the availability of the ifunc argument.
> 
> Dave, dunno if you wanna change the signature of the arg from int to
> unsigned long for 64-bit?  It just seemed prudent to do that here...
> 
> I'll present a similar patch for arm shortly...
> 
> Ok?
> 
> 
> r~

Hi Richard,  Your patch is missing a closing parenthesis and per
Roland's recent comments I believe "unsigned long" should be "unsigned
long int".  Here's a corrected patch that builds and passes make check
on ppc[32|64].

Ryan S. Arnold

diff --git a/sysdeps/powerpc/powerpc32/dl-irel.h b/sysdeps/powerpc/powerpc32/dl-irel.h
index c8e50ee..7cbcf4c 100644
--- a/sysdeps/powerpc/powerpc32/dl-irel.h
+++ b/sysdeps/powerpc/powerpc32/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/powerpc/powerpc64/dl-irel.h b/sysdeps/powerpc/powerpc64/dl-irel.h
index 7270275..b216cf9 100644
--- a/sysdeps/powerpc/powerpc64/dl-irel.h
+++ b/sysdeps/powerpc/powerpc64/dl-irel.h
@@ -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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]