[PATCH] powerpc: New feature - HWCAP/HWCAP2 bits in the TCB

Ondřej Bílka neleai@seznam.cz
Thu Jul 9 09:25:00 GMT 2015


On Tue, Jul 07, 2015 at 01:32:17PM +0930, Alan Modra wrote:
> On Fri, Jul 03, 2015 at 09:53:13PM +0200, Ondřej Bílka wrote:
> > hwcap.h:
> > int __hwcap __attribute__ ((visibility ("hidden"))) ;
> > 
> > hwcap.c:
> > 
> > #include <hwcap.h>
> > 
> > // gcc needs to make this first constructor.
> > extern int __global_hwcap;
> > void __attribute__ ((constructor)) 
> > set_hwcap () 
> > {
> >   __hwcap = __global_hwcap;
> > }
> 
> We considered using this scheme.  In fact, I put forward the idea.
> However, it was discarded as second best, due to the need to set up
> GOT/TOC addressing on a variable access.  Nothing beats Steve's single
> instruction "ld r,-0x7068(r13)" to read hwcap.
> 
So you have bigger problem that you need TOC addressing for static
variable access.
That could be avoided with better ABI. If you allocate text segment
before TOC then you could use single instructions to read each static
variable.



More information about the Libc-alpha mailing list