On 03/31/10 01:10 PM, Alan Coopersmith wrote:
> We currently ship libpixman in OpenSolaris with some files built to use
> MMX&  SSE instructions, and with code to call getisax() to select those
> at runtime.   The functions in question are always called via function
> pointers to allow for CPU-specific optimized routines to be selected by
> just modifying the function pointers at library initialization.
>
> To allow this to work on older CPU's, we have to forcibly override the
> linker by providing a mapfile with:
>     hwcap_1 = V0x0 FPU OVERRIDE;
>
> Now that PSARC/2010/022 Linker-editors: Symbol Capabilities has integrated,
> is there a better solution for us?   I've not been planning to convert whole
> hog to the linker selection of routines, since that would be more of a change
> from other platforms, just wondering if there was now a better way to flag
> that the entire library shouldn't inherit the hwcap of these specific files.

I've applied the symbol capabilities use to libc, libmd and libsoftcrypto,
three libraries that implement optimized functions through psr libraries
on SPARC.  The model takes all the psr content, uses an ld(1) pass with
-z symbolcap to make intermediate objects, and then combines these into
the final library.  This is going though testing at the moment, then it
will need review before integration into ON.

For example, my new libc contains:

oxpoly 631. elfdump -H /lib/libc.so.1 | less

Capabilities Section:  .SUNW_cap

 Symbol Capabilities:
     index  tag               value
       [1]  CA_SUNW_ID       sun4u
       [2]  CA_SUNW_MACH     sun4u

  Symbols:
     index    value      size      type bind oth ver shndx          name
       [1]  0x000f0560 0x000000bc  FUNC LOCL  D    0 .text          
memmove%sun4u
       [7]  0x000f1a2c 0x00001b28  FUNC LOCL  D    0 .text          memcmp%sun4u
      [11]  0x000f061c 0x00001280  FUNC LOCL  D    0 .text          memcpy%sun4u
      [17]  0x000f18a0 0x0000018c  FUNC LOCL  D    0 .text          memset%sun4u

 Symbol Capabilities:
     index  tag               value
       [4]  CA_SUNW_ID       sun4u-opl
       [5]  CA_SUNW_PLAT     SUNW,SPARC-Enterprise

  Symbols:
     index    value      size      type bind oth ver shndx          name
       [2]  0x000f3580 0x00000310  FUNC LOCL  D    0 .text          
memmove%sun4u-opl
       [8]  0x000f41cc 0x00000120  FUNC LOCL  D    0 .text          
memcmp%sun4u-opl
      [12]  0x000f38c0 0x0000076c  FUNC LOCL  D    0 .text          
memcpy%sun4u-opl
      [18]  0x000f4040 0x0000018c  FUNC LOCL  D    0 .text          
memset%sun4u-opl

<and a lot more>

The objects created with -z symbolcap have no "global" capabilities defined, and
thus they do not add any global capabilities to the final library (ie, there's 
no
need for a mapfile OVERRIDE).  However, selecting the appropriate functions is
carried out directly be ld.so.1, there's no getisax() or indirection involved.

Whether you could use this model, and still be able to build the sources to
work in a pre-symbol capabilities environment easily, I don't know.
--

Rod.


Everybody to Everest!

April 2010,  I'll climb to  Mt. Everest Base Camp  as a fund raiser for
The Challenged Athletes Foundation - www.everybodytoeverest.com.  Visit
www.everestchallenge.kintera.org/rie to show your support.  Thanks!
_______________________________________________
tools-linking mailing list
[email protected]

Reply via email to