Add --as-needed to the linker flags to reduce the number of shared
library dependencies, since not all the tests and tools use all the
libraries required by the helper library (for example, many tests do not
use cairo). This helps portability of the binaries and also makes a
very small improvement to the execution speed and memory consumption.

Signed-off-by: Thomas Wood <[email protected]>
---
 tests/Makefile.am | 1 +
 tools/Makefile.am | 1 +
 2 files changed, 2 insertions(+)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index dcac2f3..5aa480b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -52,6 +52,7 @@ LDADD = ../lib/libintel_tools.la $(PCIACCESS_LIBS) 
$(DRM_LIBS) $(LIBUNWIND_LIBS)
 
 LDADD += $(CAIRO_LIBS) $(LIBUDEV_LIBS) $(GLIB_LIBS) -lm
 AM_CFLAGS += $(CAIRO_CFLAGS) $(LIBUDEV_CFLAGS) $(GLIB_CFLAGS)
+AM_LDFLAGS = -Wl,--as-needed
 
 drm_import_export_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
 drm_import_export_LDADD = $(LDADD) -lpthread
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 95f13f9..0aeb173 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -9,6 +9,7 @@ endif
 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/lib
 AM_CFLAGS = $(DEBUG_CFLAGS) $(DRM_CFLAGS) $(PCIACCESS_CFLAGS) $(CWARNFLAGS) 
$(CAIRO_CFLAGS) $(LIBUNWIND_CFLAGS)
 LDADD = $(top_builddir)/lib/libintel_tools.la $(DRM_LIBS) $(PCIACCESS_LIBS) 
$(CAIRO_LIBS) $(LIBUDEV_LIBS) $(LIBUNWIND_LIBS) -lm
+AM_LDFLAGS = -Wl,--as-needed
 
 
 # aubdumper
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to