aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2014-03-11 17:58:08 +0000
committerEmil Velikov <[email protected]>2014-03-31 14:56:14 +0100
commitd681b22ed77274a805c6c8e81925c18eeb57a968 (patch)
tree123ac46987e30805fe5ca7b514597ae0b0565f02 /src/gallium
parentd187a150d45cbf5bd3476eab49be5057382c2c86 (diff)
automake: ask the linker to do garbage collection
By doing GC the linker removes all the symbols that are not referenced and/or used by the final library. This results in a saving of ~100K up-to ~600K per (stripped) binary (classic vs gallium drivers). If interested one can ask the compiler to print the sections that are removed using -Wl,--print-gc-sections. v2: Check if ld supports the flag before using it. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Matt Turner <[email protected]> (v1)
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/Automake.inc4
-rw-r--r--src/gallium/targets/egl-static/Makefile.am1
-rw-r--r--src/gallium/targets/gbm/Makefile.am1
-rw-r--r--src/gallium/targets/libgl-xlib/Makefile.am1
-rw-r--r--src/gallium/targets/opencl/Makefile.am1
-rw-r--r--src/gallium/targets/osmesa/Makefile.am1
-rw-r--r--src/gallium/targets/pipe-loader/Makefile.am1
-rw-r--r--src/gallium/targets/xa/Makefile.am1
8 files changed, 11 insertions, 0 deletions
diff --git a/src/gallium/Automake.inc b/src/gallium/Automake.inc
index 1151f916bef..56f1433a0f8 100644
--- a/src/gallium/Automake.inc
+++ b/src/gallium/Automake.inc
@@ -57,6 +57,7 @@ GALLIUM_DRI_LINKER_FLAGS = \
-shared \
-module \
-avoid-version \
+ $(GC_SECTIONS) \
-Wl,--version-script=$(DRI_VERSION_SCRIPT)
GALLIUM_VDPAU_LINKER_FLAGS = \
@@ -65,6 +66,7 @@ GALLIUM_VDPAU_LINKER_FLAGS = \
-no-undefined \
-version-number $(VDPAU_MAJOR):$(VDPAU_MINOR) \
-export-symbols-regex $(VDPAU_EXPORTS) \
+ $(GC_SECTIONS) \
-Wl,--no-undefined
GALLIUM_XVMC_LINKER_FLAGS = \
@@ -73,6 +75,7 @@ GALLIUM_XVMC_LINKER_FLAGS = \
-no-undefined \
-version-number $(XVMC_MAJOR):$(XVMC_MINOR) \
-export-symbols-regex '^XvMC' \
+ $(GC_SECTIONS) \
-Wl,--no-undefined
GALLIUM_OMX_LINKER_FLAGS = \
@@ -80,6 +83,7 @@ GALLIUM_OMX_LINKER_FLAGS = \
-module \
-no-undefined \
-export-symbols-regex $(EXPORTS) \
+ $(GC_SECTIONS) \
-Wl,--no-undefined
GALLIUM_VDPAU_LIB_DEPS = \
diff --git a/src/gallium/targets/egl-static/Makefile.am b/src/gallium/targets/egl-static/Makefile.am
index 55eb3baaa06..58ecf697ce9 100644
--- a/src/gallium/targets/egl-static/Makefile.am
+++ b/src/gallium/targets/egl-static/Makefile.am
@@ -48,6 +48,7 @@ AM_LDFLAGS = \
-module \
-no-undefined \
-avoid-version \
+ $(GC_SECTIONS) \
-Wl,--no-undefined \
-Wl,--version-script=$(top_srcdir)/src/gallium/targets/egl-static/egl.link
diff --git a/src/gallium/targets/gbm/Makefile.am b/src/gallium/targets/gbm/Makefile.am
index c109ddbb463..22b4826391e 100644
--- a/src/gallium/targets/gbm/Makefile.am
+++ b/src/gallium/targets/gbm/Makefile.am
@@ -70,6 +70,7 @@ gbm_gallium_drm_la_LDFLAGS = \
-module \
-no-undefined \
-avoid-version \
+ $(GC_SECTIONS) \
-Wl,--no-undefined
if HAVE_MESA_LLVM
diff --git a/src/gallium/targets/libgl-xlib/Makefile.am b/src/gallium/targets/libgl-xlib/Makefile.am
index d7aec7b5b50..ef3d23ebcd9 100644
--- a/src/gallium/targets/libgl-xlib/Makefile.am
+++ b/src/gallium/targets/libgl-xlib/Makefile.am
@@ -47,6 +47,7 @@ libGL_la_SOURCES = xlib.c
libGL_la_LDFLAGS = \
-no-undefined \
-version-number $(GL_MAJOR):$(GL_MINOR):$(GL_TINY) \
+ $(GC_SECTIONS) \
-Wl,--no-undefined
libGL_la_LIBADD = \
diff --git a/src/gallium/targets/opencl/Makefile.am b/src/gallium/targets/opencl/Makefile.am
index b401d10d7a7..aae31ff3366 100644
--- a/src/gallium/targets/opencl/Makefile.am
+++ b/src/gallium/targets/opencl/Makefile.am
@@ -6,6 +6,7 @@ lib@OPENCL_LIBNAME@_la_LDFLAGS = \
$(LLVM_LDFLAGS) \
-no-undefined \
-version-number 1:0 \
+ $(GC_SECTIONS) \
-Wl,--no-undefined
diff --git a/src/gallium/targets/osmesa/Makefile.am b/src/gallium/targets/osmesa/Makefile.am
index 651fc5d2b45..559135cc5fe 100644
--- a/src/gallium/targets/osmesa/Makefile.am
+++ b/src/gallium/targets/osmesa/Makefile.am
@@ -43,6 +43,7 @@ lib@OSMESA_LIB@_la_LDFLAGS = \
-module \
-no-undefined \
-version-number @OSMESA_VERSION@ \
+ $(GC_SECTIONS) \
-Wl,--no-undefined
diff --git a/src/gallium/targets/pipe-loader/Makefile.am b/src/gallium/targets/pipe-loader/Makefile.am
index 00823fe5bdd..fa463addcc5 100644
--- a/src/gallium/targets/pipe-loader/Makefile.am
+++ b/src/gallium/targets/pipe-loader/Makefile.am
@@ -49,6 +49,7 @@ AM_LDFLAGS = \
-module \
-no-undefined \
-avoid-version \
+ $(GC_SECTIONS) \
-Wl,--no-undefined \
-Wl,--version-script=$(top_srcdir)/src/gallium/targets/pipe-loader/pipe.link
diff --git a/src/gallium/targets/xa/Makefile.am b/src/gallium/targets/xa/Makefile.am
index 214c51df883..21f29cfa65e 100644
--- a/src/gallium/targets/xa/Makefile.am
+++ b/src/gallium/targets/xa/Makefile.am
@@ -67,6 +67,7 @@ endif
libxatracker_la_LDFLAGS = \
-no-undefined \
-version-number $(XA_MAJOR):$(XA_MINOR):$(XA_TINY) \
+ $(GC_SECTIONS) \
-Wl,--no-undefined
if HAVE_MESA_LLVM