> Reviewing these arguments I arrived at the following conclusion: > > A. PIC .a libraries themselves are not usable as shared libs. > B. The performance issue matters significantly only on IA32.
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: 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]. 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). 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/ --- xc/config/cf/linux.cf.jj Tue Jan 15 16:22:31 2002 +++ xc/config/cf/linux.cf Wed Aug 14 14:26:31 2002 @@ -306,6 +306,8 @@ InstallNamedTargetNoClobber(install,file # endif #endif +#define NormalOnlyLibWithPIC YES + /* The DRM module requires kernel services that appeared in late 2.1.x kernels and are known to be present in 2.2.x kernels. Unfortunately, the kernel API is a moving target and the module may break with new --- xc/config/cf/Library.tmpl.jj Mon Aug 27 13:40:55 2001 +++ xc/config/cf/Library.tmpl Wed Aug 14 14:26:31 2002 @@ -140,30 +140,37 @@ LIB_MT_DEFINES = LibraryMTDefines # define _NormalObjCplusplusCompile(options) $(_NULLCMD_) # define _NormalCleanDir() $(_NULLCMD_) #else -# if DoSharedLib && SeparateSharedCompile +# if DoSharedLib && SeparateSharedCompile && !DoSharedLibWithoutPIC # define _NormalLibMkdir() _LibMkdir(unshared) # define _NormalObjCompile(options) UnsharedLibObjCompile(options) # define _NormalObjCplusplusCompile(options) UnsharedLibObjCplusplusCompile(options) # define _NormalCleanDir() LibCleanDir(unshared) # else -# define _NormalLibMkdir() $(_NULLCMD_) -# define _NormalObjCompile(options) NormalLibObjCompile(options) -# define _NormalObjCplusplusCompile(options) NormalLibObjCplusplusCompile(options) -# define _NormalCleanDir() $(_NULLCMD_) +# if NormalOnlyLibWithPIC && !DoSharedLibWithoutPIC && SeparateSharedCompile +# define _NormalLibMkdir() $(_NULLCMD_) +# define _NormalObjCompile(options) NormalSharedLibObjCompile(options) +# define _NormalObjCplusplusCompile(options) +NormalSharedLibObjCplusplusCompile(options) +# define _NormalCleanDir() $(_NULLCMD_) +# else +# define _NormalLibMkdir() $(_NULLCMD_) +# define _NormalObjCompile(options) NormalLibObjCompile(options) +# define _NormalObjCplusplusCompile(options) NormalLibObjCplusplusCompile(options) +# define _NormalCleanDir() $(_NULLCMD_) +# endif # endif #endif -#if !DoSharedLib || (DoNormalLib && !SeparateSharedCompile) +#if !DoSharedLib || (DoNormalLib && (!SeparateSharedCompile || DoSharedLibWithoutPIC)) # define _SharedObjCompile(options) $(_NULLCMD_) # define _SharedObjCplusplusCompile(options) $(_NULLCMD_) #else # if SeparateSharedCompile # define _SharedObjCompile(options) NormalSharedLibObjCompile(options) # define _SharedObjCplusplusCompile(options) NormalSharedLibObjCplusplusCompile(options) -#else -# define _SharedObjCompile(options) NormalLibObjCompile(options) -# define _SharedObjCplusplusCompile(options) NormalLibObjCplusplusCompile(options) -#endif +# else +# define _SharedObjCompile(options) NormalLibObjCompile(options) +# define _SharedObjCplusplusCompile(options) NormalLibObjCplusplusCompile(options) +# endif #endif #ifndef DoExtraLib --- xc/lib/GL/dri/drm/Imakefile.jj Thu Oct 4 14:28:21 2001 +++ xc/lib/GL/dri/drm/Imakefile Wed Aug 14 14:26:31 2002 @@ -1,14 +1,15 @@ XCOMM $XFree86: xc/lib/GL/dri/drm/Imakefile,v 1.17 2001/08/29 11:56:44 alanh Exp $ +#define DoSharedLibWithoutPIC SharedLibGlxWithoutPIC #if GlxUseBuiltInDRIDriver -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) +#define DoNormalLib NormalLibGlx +#define DoSharedLib SharedLibGlx #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx #else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoNormalLib NO +#define DoSharedLib YES #define DoExtraLib NO #define DoDebugLib NO #define DoProfileLib NO --- xc/lib/GL/dri/Imakefile.jj Mon Apr 2 22:29:32 2001 +++ xc/lib/GL/dri/Imakefile Wed Aug 14 14:26:31 2002 @@ -2,8 +2,9 @@ XCOMM $XFree86: xc/lib/GL/dri/Imakefile, #include <Threads.tmpl> -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) +#define DoNormalLib NormalLibGlx +#define DoSharedLib SharedLibGlx +#define DoSharedLibWithoutPIC SharedLibGlxWithoutPIC #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx --- xc/lib/GL/glx/Imakefile.jj Wed Aug 14 14:26:29 2002 +++ xc/lib/GL/glx/Imakefile Wed Aug 14 14:26:31 2002 @@ -18,8 +18,9 @@ XCOMM are Copyright (c) 1991-9 Silicon G #include <Threads.tmpl> -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) +#define DoNormalLib NormalLibGlx +#define DoSharedLib SharedLibGlx +#define DoSharedLibWithoutPIC SharedLibGlxWithoutPIC #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx --- xc/lib/GL/mesa/dri/Imakefile.jj Mon Apr 2 22:29:33 2001 +++ xc/lib/GL/mesa/dri/Imakefile Wed Aug 14 14:26:31 2002 @@ -1,14 +1,15 @@ XCOMM $XFree86: xc/lib/GL/mesa/dri/Imakefile,v 1.4 2001/03/23 20:56:32 dawes Exp $ +#define DoSharedLibWithoutPIC SharedLibGlxWithoutPIC #if GlxUseBuiltInDRIDriver -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) +#define DoNormalLib NormalLibGlx +#define DoSharedLib SharedLibGlx #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx #else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoNormalLib NO +#define DoSharedLib YES #define DoExtraLib NO #define DoDebugLib NO #define DoProfileLib NO --- xc/lib/GL/mesa/src/OSmesa/Imakefile.jj Wed Aug 14 14:26:27 2002 +++ xc/lib/GL/mesa/src/OSmesa/Imakefile Wed Aug 14 15:27:38 2002 @@ -2,8 +2,9 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/OSmes #include <Threads.tmpl> -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) +#define DoNormalLib NormalLibGlx +#define DoSharedLib SharedLibGlx +#define DoSharedLibWithoutPIC SharedLibGlxWithoutPIC #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx @@ -32,7 +33,7 @@ MESA_INCLUDES = -I$(MESASRCDIR)/src/OSme SRCS = osmesa.c OBJS = osmesa.o $(MESAOBJS) -#if DoSharedLib +#if DoSharedLib && !DoSharedLibWithoutPIC UOBJS = unshared/osmesa.o $(MESAUOBJS) #else UOBJS = $(OBJS) --- xc/lib/GL/mesa/src/X86/Imakefile.jj Wed May 2 11:06:03 2001 +++ xc/lib/GL/mesa/src/X86/Imakefile Wed Aug 14 14:26:31 2002 @@ -4,17 +4,18 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/X86/I * Only need SharedLib build unless OSMesa lib is built, or driver is built * in to libGL */ +#define DoSharedLibWithoutPIC SharedLibGlxWithoutPIC #if BuildXF86DRI && !GlxUseSGISI && \ (GlxUseBuiltInDRIDriver || \ !GlxBuiltInMesa || !defined(GlxDriverUsesMesa)) -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) +#define DoNormalLib NormalLibGlx +#define DoSharedLib SharedLibGlx #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx #else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoNormalLib NO +#define DoSharedLib YES #define DoExtraLib NO #define DoDebugLib NO #define DoProfileLib NO --- xc/lib/GL/mesa/src/X86/Imakefile.inc.jj Wed May 2 11:06:03 2001 +++ xc/lib/GL/mesa/src/X86/Imakefile.inc Wed Aug 14 15:28:44 2002 @@ -46,7 +46,7 @@ MESA_X86_OBJS = $(MESAX86BUILDDIR)common $(MESAX86BUILDDIR)x86_xform_raw3.o \ $(MESAX86BUILDDIR)x86_xform_raw4.o -#if DoSharedLib +#if DoSharedLib && !DoSharedLibWithoutPIC MESA_X86_UOBJS = $(MESAX86BUILDDIR)unshared/common_x86.o \ $(MESAX86BUILDDIR)common_x86_asm.o \ $(MESAX86BUILDDIR)unshared/x86.o \ --- xc/lib/GL/mesa/src/drv/common/Imakefile.jj Mon Apr 2 22:29:34 2001 +++ xc/lib/GL/mesa/src/drv/common/Imakefile Wed Aug 14 14:26:31 2002 @@ -1,14 +1,15 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/common/Imakefile,v 1.5 2001/03/23 20:56:33 dawes Exp $ +#define DoSharedLibWithoutPIC SharedLibGlxWithoutPIC #if GlxUseBuiltInDRIDriver -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) +#define DoNormalLib NormalLibGlx +#define DoSharedLib SharedLibGlx #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx #else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoNormalLib NO +#define DoSharedLib YES #define DoExtrasLib NO #define DoDebugLib NO #define DoProfileLib NO --- xc/lib/GL/mesa/src/drv/ffb/Imakefile.jj Thu May 10 12:56:10 2001 +++ xc/lib/GL/mesa/src/drv/ffb/Imakefile Wed Aug 14 14:26:31 2002 @@ -3,15 +3,16 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/f #include <Threads.tmpl> +#define DoSharedLibWithoutPIC SharedLibGlxWithoutPIC #if GlxUseBuiltInDRIDriver -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) +#define DoNormalLib NormalLibGlx +#define DoSharedLib SharedLibGlx #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx #else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoNormalLib NO +#define DoSharedLib YES #define DoExtrasLib NO #define DoDebugLib NO #define DoProfileLib NO --- xc/lib/GL/mesa/src/drv/gamma/Imakefile.jj Thu May 10 12:56:11 2001 +++ xc/lib/GL/mesa/src/drv/gamma/Imakefile Wed Aug 14 14:26:31 2002 @@ -2,15 +2,16 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/g #include <Threads.tmpl> +#define DoSharedLibWithoutPIC SharedLibGlxWithoutPIC #if GlxUseBuiltInDRIDriver -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) +#define DoNormalLib NormalLibGlx +#define DoSharedLib SharedLibGlx #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx #else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoNormalLib NO +#define DoSharedLib YES #define DoExtrasLib NO #define DoDebugLib NO #define DoProfileLib NO --- xc/lib/GL/mesa/src/drv/i810/Imakefile.jj Thu May 10 12:56:11 2001 +++ xc/lib/GL/mesa/src/drv/i810/Imakefile Wed Aug 14 14:26:31 2002 @@ -2,15 +2,16 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/i #include <Threads.tmpl> +#define DoSharedLibWithoutPIC SharedLibGlxWithoutPIC #if GlxUseBuiltInDRIDriver -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) +#define DoNormalLib NormalLibGlx +#define DoSharedLib SharedLibGlx #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx #else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoNormalLib NO +#define DoSharedLib YES #define DoExtrasLib NO #define DoDebugLib NO #define DoProfileLib NO --- xc/lib/GL/mesa/src/drv/i830/Imakefile.jj Thu Oct 4 14:28:21 2001 +++ xc/lib/GL/mesa/src/drv/i830/Imakefile Wed Aug 14 14:26:31 2002 @@ -2,15 +2,16 @@ XCOMM $XFree86$ #include <Threads.tmpl> +#define DoSharedLibWithoutPIC SharedLibGlxWithoutPIC #if GlxUseBuiltInDRIDriver -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) +#define DoNormalLib NormalLibGlx +#define DoSharedLib SharedLibGlx #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx #else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoNormalLib NO +#define DoSharedLib YES #define DoExtrasLib NO #define DoDebugLib NO #define DoProfileLib NO --- xc/lib/GL/mesa/src/drv/mga/Imakefile.jj Thu May 10 12:56:11 2001 +++ xc/lib/GL/mesa/src/drv/mga/Imakefile Wed Aug 14 14:26:31 2002 @@ -2,15 +2,16 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/m #include <Threads.tmpl> +#define DoSharedLibWithoutPIC SharedLibGlxWithoutPIC #if GlxUseBuiltInDRIDriver -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) +#define DoNormalLib NormalLibGlx +#define DoSharedLib SharedLibGlx #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx #else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoNormalLib NO +#define DoSharedLib YES #define DoExtrasLib NO #define DoDebugLib NO #define DoProfileLib NO --- xc/lib/GL/mesa/src/drv/r128/Imakefile.jj Thu May 10 12:56:11 2001 +++ xc/lib/GL/mesa/src/drv/r128/Imakefile Wed Aug 14 14:26:31 2002 @@ -2,15 +2,16 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r #include <Threads.tmpl> +#define DoSharedLibWithoutPIC SharedLibGlxWithoutPIC #if GlxUseBuiltInDRIDriver -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) +#define DoNormalLib NormalLibGlx +#define DoSharedLib SharedLibGlx #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx #else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoNormalLib NO +#define DoSharedLib YES #define DoExtrasLib NO #define DoDebugLib NO #define DoProfileLib NO --- xc/lib/GL/mesa/src/drv/radeon/Imakefile.jj Fri Nov 2 18:29:26 2001 +++ xc/lib/GL/mesa/src/drv/radeon/Imakefile Wed Aug 14 14:26:31 2002 @@ -2,15 +2,16 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/r #include <Threads.tmpl> +#define DoSharedLibWithoutPIC SharedLibGlxWithoutPIC #if GlxUseBuiltInDRIDriver -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) +#define DoNormalLib NormalLibGlx +#define DoSharedLib SharedLibGlx #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx #else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoNormalLib NO +#define DoSharedLib YES #define DoExtrasLib NO #define DoDebugLib NO #define DoProfileLib NO --- xc/lib/GL/mesa/src/drv/sis/Imakefile.jj Fri Nov 2 18:29:27 2001 +++ xc/lib/GL/mesa/src/drv/sis/Imakefile Wed Aug 14 14:26:31 2002 @@ -2,15 +2,16 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/s #include <Threads.tmpl> +#define DoSharedLibWithoutPIC SharedLibGlxWithoutPIC #if GlxUseBuiltInDRIDriver -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) +#define DoNormalLib NormalLibGlx +#define DoSharedLib SharedLibGlx #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx #else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoNormalLib NO +#define DoSharedLib YES #define DoExtrasLib NO #define DoDebugLib NO #define DoProfileLib NO --- xc/lib/GL/mesa/src/drv/tdfx/Imakefile.jj Fri Aug 17 22:51:06 2001 +++ xc/lib/GL/mesa/src/drv/tdfx/Imakefile Wed Aug 14 14:26:31 2002 @@ -2,15 +2,16 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/drv/t #include <Threads.tmpl> +#define DoSharedLibWithoutPIC SharedLibGlxWithoutPIC #if GlxUseBuiltInDRIDriver -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) +#define DoNormalLib NormalLibGlx +#define DoSharedLib SharedLibGlx #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx #else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoNormalLib NO +#define DoSharedLib YES #define DoExtrasLib NO #define DoDebugLib NO #define DoProfileLib NO --- xc/lib/GL/mesa/src/Imakefile.jj Wed May 2 11:06:02 2001 +++ xc/lib/GL/mesa/src/Imakefile Wed Aug 14 14:26:31 2002 @@ -6,17 +6,18 @@ XCOMM $XFree86: xc/lib/GL/mesa/src/Imake * Only need SharedLib build unless OSMesa lib is built, or driver is built * in to libGL */ +#define DoSharedLibWithoutPIC SharedLibGlxWithoutPIC #if BuildXF86DRI && !GlxUseSGISI && \ (GlxUseBuiltInDRIDriver || \ !GlxBuiltInMesa || !defined(GlxDriverUsesMesa)) -#define DoNormalLib (NormalLibGlx || SharedLibGlxWithoutPIC) -#define DoSharedLib (SharedLibGlx && !SharedLibGlxWithoutPIC) +#define DoNormalLib NormalLibGlx +#define DoSharedLib SharedLibGlx #define DoExtraLib SharedLibGlx #define DoDebugLib DebugLibGlx #define DoProfileLib ProfileLibGlx #else -#define DoNormalLib SharedLibGlxWithoutPIC -#define DoSharedLib !SharedLibGlxWithoutPIC +#define DoNormalLib NO +#define DoSharedLib YES #define DoExtraLib NO #define DoDebugLib NO #define DoProfileLib NO _______________________________________________ Xpert mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/xpert
