Re: -fPIC issue

Egbert Eich <[email protected]>
Newsgroups gmane.comp.xfree86.expert
Message-ID <[email protected]>
Jakub Jelinek writes:

 > With the exception of Mesa stuff .a XFree86 libraries which are not
 > shipped as shared libs too (.so + .a) aren't performance critical
 > either, and using non-fpic code in them has some bad consequences:

Yes, most of these libraries aren't performance critical.
They don't do much more than providing a C interface
to the underlying request.

 > 1) it means the whole shared libs which link in even one tiny
 >    XFree86 non-fpic .a lib are DT_TEXTREL, which means bigger
 >    overhead when loading them and more unshareable pages.
 > 2) they have more relocations, meaning more time spent in the
 >    dynamic linker on startup.
 > 3) if there are any symbol lookup conflicts, it means those libraries
 >    aren't prelink(8)able, which can mean e.g. that all of KDE
 >    cannot be prelinked [1].

Yes, that's an issue I've learned about today, too.
Thank you for bringing it up here.

I was told prelinking may reduce kde application 
startup time by about 30 to 40 percent. This is 
definitely an aspect to keep in mind.

 > 
 > So IMHO the default XFree86 behaviour, tweakable through imake macros,
 > should be that .a libs which come with a corresponding .so should be
 > -fno-pic while .a libs which don't have a corresponding .so should be
 > -fpic.
 > (Below is a patch I wrote months ago for this).

So far I only marked those libraries that were identified by
toolkits groups as targets of possible encasulation to be build
with -fpic. Currently it is easy enough make ia32 build with pic. 
Just add a:
#define StaticNeedsPicForShared YES
to config/cf/hosts.def. 
Before we decide to add PIC to  more/all .a files without 
corresponding .so we should see if there are arguments 
against this.

 > 
 > As for Mesa, IMHO even libGL.so should be compiled with -fpic, I have some
 > patches which should optimize the performance critical places in there,
 > will test and benchmark them in the following days (had no 3D hardware until
 > recently so couldn't do testing nor measurements) and post them afterwards.
 > 
 > [1] ftp://people.redhat.com/jakub/prelink/
 > 

Have you raised this issue on the MESA/DRI mailing list?
Once you have your benchmarks ready you should do so.

Egbert.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.