Making use of GCC Visibility reduces huge ELF symbols. based on https://bugs.freedesktop.org/show_bug.cgi?id=2749 Signed-off-by: Jim Huang Index: xorg-server-1.3.0.0/configure.ac =================================================================== --- xorg-server-1.3.0.0.orig/configure.ac 2007-05-27 00:39:38.000000000 +0800 +++ xorg-server-1.3.0.0/configure.ac 2007-05-27 00:39:38.000000000 +0800 @@ -301,6 +301,22 @@ AC_MSG_RESULT([$mmx_capable]) AM_CONDITIONAL(MMX_CAPABLE, [test "x$mmx_capable" = xyes]) +# Checks if -fvisibility=hidden works or not. +AC_MSG_CHECKING([whether the compiler supports the visibility arg]) +AC_TRY_COMPILE([ +void +#if defined(__GNUC__) && (__GNUC__ >= 4) +foo () {}; +#endif +], [], [ + has_visibility=yes + CFLAGS="$CFLAGS -fvisibility=hidden" +], [ + has_visibility=no +] +) +AC_MSG_RESULT($has_visibility) +AM_CONDITIONAL(HAVE_VISIBILITY, [test "x$has_visibility" = xyes]) OSNAME=`uname -srm` AC_DEFINE_UNQUOTED(OSNAME, "$OSNAME", Index: xorg-server-1.3.0.0/fb/Makefile.am =================================================================== --- xorg-server-1.3.0.0.orig/fb/Makefile.am 2006-11-17 02:01:23.000000000 +0800 +++ xorg-server-1.3.0.0/fb/Makefile.am 2007-05-27 00:39:38.000000000 +0800 @@ -23,6 +23,10 @@ --param large-function-growth=10000 endif +if HAVE_VISIBILITY +AM_CFLAGS += -fvisibility=hidden +endif + libfbmmx_la_SOURCES = \ fbmmx.c \ fbmmx.h Index: xorg-server-1.3.0.0/fb/fb.h =================================================================== --- xorg-server-1.3.0.0.orig/fb/fb.h 2006-11-17 02:01:23.000000000 +0800 +++ xorg-server-1.3.0.0/fb/fb.h 2007-05-27 00:39:38.000000000 +0800 @@ -25,6 +25,12 @@ #ifndef _FB_H_ #define _FB_H_ +#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) +# define FB_EXPORT __attribute__((visibility("default"))) +#else +# define FB_EXPORT +#endif + #include #include "scrnintstr.h" #include "pixmap.h" Index: xorg-server-1.3.0.0/fb/fballpriv.c =================================================================== --- xorg-server-1.3.0.0.orig/fb/fballpriv.c 2006-11-17 02:01:23.000000000 +0800 +++ xorg-server-1.3.0.0/fb/fballpriv.c 2007-05-27 00:39:38.000000000 +0800 @@ -42,7 +42,7 @@ } #ifndef FB_NO_WINDOW_PIXMAPS int fbWinPrivateIndex; -int fbGetWinPrivateIndex(void) +FB_EXPORT int fbGetWinPrivateIndex(void) { return fbWinPrivateIndex; } Index: xorg-server-1.3.0.0/fb/fbbltone.c =================================================================== --- xorg-server-1.3.0.0.orig/fb/fbbltone.c 2006-11-17 02:01:23.000000000 +0800 +++ xorg-server-1.3.0.0/fb/fbbltone.c 2007-05-27 00:39:38.000000000 +0800 @@ -80,7 +80,7 @@ #endif #if FB_SHIFT == 6 -CARD8 fb8Lane[256] = { +static CARD8 fb8Lane[256] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, @@ -97,33 +97,33 @@ 242, 243, 244,245,246,247,248,249,250,251,252,253,254,255, }; -CARD8 fb16Lane[256] = { +static CARD8 fb16Lane[256] = { 0x00, 0x03, 0x0c, 0x0f, 0x30, 0x33, 0x3c, 0x3f, 0xc0, 0xc3, 0xcc, 0xcf, 0xf0, 0xf3, 0xfc, 0xff, }; -CARD8 fb32Lane[16] = { +static CARD8 fb32Lane[16] = { 0x00, 0x0f, 0xf0, 0xff, }; #endif #if FB_SHIFT == 5 -CARD8 fb8Lane[16] = { +static CARD8 fb8Lane[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; -CARD8 fb16Lane[16] = { +static CARD8 fb16Lane[16] = { 0, 3, 12, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -CARD8 fb32Lane[16] = { +static CARD8 fb32Lane[16] = { 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; #endif -CARD8 *fbLaneTable[33] = { +static CARD8 *fbLaneTable[33] = { 0, 0, 0, 0, 0, 0, 0, 0, fb8Lane, 0, 0, 0, 0, 0, 0, 0, fb16Lane, 0, 0, 0, 0, 0, 0, 0, Index: xorg-server-1.3.0.0/fb/fbcmap.c =================================================================== --- xorg-server-1.3.0.0.orig/fb/fbcmap.c 2006-09-18 14:04:17.000000000 +0800 +++ xorg-server-1.3.0.0/fb/fbcmap.c 2007-05-27 00:39:38.000000000 +0800 @@ -273,7 +273,7 @@ return nresult; } -Bool +FB_EXPORT Bool fbCreateDefColormap(ScreenPtr pScreen) { unsigned short zero = 0, ones = 0xFFFF; @@ -630,7 +630,7 @@ return miExpandDirectColors(pmap, ndef, indefs, outdefs); } -Bool +FB_EXPORT Bool fbCreateDefColormap(ScreenPtr pScreen) { return miCreateDefColormap(pScreen); Index: xorg-server-1.3.0.0/fb/fboverlay.c =================================================================== --- xorg-server-1.3.0.0.orig/fb/fboverlay.c 2006-09-18 14:04:17.000000000 +0800 +++ xorg-server-1.3.0.0/fb/fboverlay.c 2007-05-27 00:39:38.000000000 +0800 @@ -36,7 +36,7 @@ int fbOverlayGeneration; int fbOverlayScreenPrivateIndex = -1; -int fbOverlayGetScreenPrivateIndex(void) +FB_EXPORT int fbOverlayGetScreenPrivateIndex(void) { return fbOverlayScreenPrivateIndex; } @@ -335,7 +335,7 @@ return retval; } -Bool +FB_EXPORT Bool fbOverlayFinishScreenInit(ScreenPtr pScreen, pointer pbits1, pointer pbits2, Index: xorg-server-1.3.0.0/fb/fbpict.c =================================================================== --- xorg-server-1.3.0.0.orig/fb/fbpict.c 2007-01-30 14:03:18.000000000 +0800 +++ xorg-server-1.3.0.0/fb/fbpict.c 2007-05-27 00:39:38.000000000 +0800 @@ -1360,7 +1360,7 @@ #endif /* RENDER */ -Bool +FB_EXPORT Bool fbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats) { Index: xorg-server-1.3.0.0/fb/fbscreen.c =================================================================== --- xorg-server-1.3.0.0.orig/fb/fbscreen.c 2006-11-17 02:01:23.000000000 +0800 +++ xorg-server-1.3.0.0/fb/fbscreen.c 2007-05-27 00:39:38.000000000 +0800 @@ -99,7 +99,7 @@ } #endif -Bool +FB_EXPORT Bool fbSetupScreen(ScreenPtr pScreen, pointer pbits, /* pointer to screen bitmap */ int xsize, /* in pixels */ Index: xorg-server-1.3.0.0/fb/fbseg.c =================================================================== --- xorg-server-1.3.0.0.orig/fb/fbseg.c 2006-11-17 02:01:23.000000000 +0800 +++ xorg-server-1.3.0.0/fb/fbseg.c 2007-05-27 00:39:38.000000000 +0800 @@ -569,7 +569,7 @@ return bres; } -void +FB_EXPORT void fbBres (DrawablePtr pDrawable, GCPtr pGC, int dashOffset,