mesa: Use -Bsymbolic in the linker to locally resolve Mesa-internal symbols.
authorEric Anholt <eric@anholt.net>
Fri, 20 Sep 2013 19:37:04 +0000 (12:37 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 23 Sep 2013 19:45:22 +0000 (12:45 -0700)
Normally, LD_PRELOAD will take precedence over your own symbols, which you
want for things like malloc() in libc.  But we don't have any local
symbols we would want overridden (like hash_table_insert(), for example!),
so tell the linker to resolve them internally.  This also avoids calls
through the PLT.

Saves almost 100k on libdricore's size, and gets us a bunch of the
performance back that we had with non-dricore.

Reviewed-by: Ian Romanick <ian.d.romanick@.intel.com>
configure.ac
src/mesa/drivers/dri/i915/Makefile.am
src/mesa/drivers/dri/i965/Makefile.am
src/mesa/drivers/dri/nouveau/Makefile.am
src/mesa/drivers/dri/r200/Makefile.am
src/mesa/drivers/dri/radeon/Makefile.am
src/mesa/drivers/dri/swrast/Makefile.am
src/mesa/libdricore/Makefile.am

index d280e389a6275b523529a2943be29dc7846aa0ba..4c99603cceedd9de8d3d7241403e680a093217bb 100644 (file)
@@ -1032,10 +1032,13 @@ if test "x$enable_dri" = xyes; then
     # put all the necessary libs together
     DRI_LIB_DEPS="$DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm $PTHREAD_LIBS $DLOPEN_LIBS"
     GALLIUM_DRI_LIB_DEPS="$GALLIUM_DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm $CLOCK_LIB $PTHREAD_LIBS $DLOPEN_LIBS"
+
+    DRI_DRIVER_LDFLAGS="-module -avoid-version -shared -Wl,-Bsymbolic"
 fi
 AM_CONDITIONAL(NEED_LIBDRICORE, test -n "$DRI_DIRS")
 AC_SUBST([EXPAT_INCLUDES])
 AC_SUBST([DRI_LIB_DEPS])
+AC_SUBST([DRI_DRIVER_LDFLAGS])
 AC_SUBST([GALLIUM_DRI_LIB_DEPS])
 
 case $DRI_DIRS in
index 978917c6c3e7b95e86c66b611f0b023b20fef3ef..f66967d751f17fb575c1ac69b630ac03c646b2e7 100644 (file)
@@ -52,7 +52,7 @@ dri_LTLIBRARIES = i915_dri.la
 endif
 
 i915_dri_la_SOURCES = $(i915_FILES)
-i915_dri_la_LDFLAGS = -module -avoid-version -shared
+i915_dri_la_LDFLAGS = $(DRI_DRIVER_LDFLAGS)
 i915_dri_la_LIBADD = \
        ../common/libdricommon.la \
        $(DRI_LIB_DEPS) \
index 27c67d10ec0fd8cea8ccc2ce9958d6523cd617fa..541e0d6e0678e9fc641ae79c9f87f54f85cf7cc4 100644 (file)
@@ -72,7 +72,7 @@ TEST_LIBS = \
 i965_dri_la_SOURCES =
 nodist_EXTRA_i965_dri_la_SOURCES = dummy2.cpp
 i965_dri_la_LIBADD = $(COMMON_LIBS)
-i965_dri_la_LDFLAGS = -module -avoid-version -shared
+i965_dri_la_LDFLAGS = $(DRI_DRIVER_LDFLAGS)
 
 TESTS = \
         test_eu_compact \
index 2b47f75340f89992263e1f42531c78f7d2d0019e..7172e62558cd4fe05ebe9b500f24193b7df90888 100644 (file)
@@ -42,7 +42,7 @@ endif
 nouveau_vieux_dri_la_SOURCES = \
        $(NOUVEAU_C_FILES)
 
-nouveau_vieux_dri_la_LDFLAGS = -module -avoid-version -shared
+nouveau_vieux_dri_la_LDFLAGS = $(DRI_DRIVER_LDFLAGS)
 nouveau_vieux_dri_la_LIBADD = \
        ../common/libdricommon.la \
        $(DRI_LIB_DEPS) \
index 4357922341ba5f22e0e7fc6b3369d22375ba69b8..fc0482a6ee7863404a01db151ca913a96e510fc8 100644 (file)
@@ -45,7 +45,7 @@ endif
 r200_dri_la_SOURCES = \
         $(R200_C_FILES)
 
-r200_dri_la_LDFLAGS = -module -avoid-version -shared
+r200_dri_la_LDFLAGS = $(DRI_DRIVER_LDFLAGS)
 r200_dri_la_LIBADD = \
        ../common/libdricommon.la \
        $(DRI_LIB_DEPS) \
index 43de05972b0b38d189031c43345965edaeffabe5..d13b803aeccad1ca72ad720f8f134e1a1d633c0a 100644 (file)
@@ -45,7 +45,7 @@ endif
 radeon_dri_la_SOURCES = \
         $(RADEON_C_FILES)
 
-radeon_dri_la_LDFLAGS = -module -avoid-version -shared
+radeon_dri_la_LDFLAGS = $(DRI_DRIVER_LDFLAGS)
 radeon_dri_la_LIBADD = \
        ../common/libdricommon.la \
        $(DRI_LIB_DEPS) \
index d3da19651cba62413824c194657a34766414f637..fb9b8a05072759e6c46610645159e050a99a34a6 100644 (file)
@@ -42,7 +42,8 @@ endif
 swrast_dri_la_SOURCES = \
        $(SWRAST_C_FILES)
 
-swrast_dri_la_LDFLAGS = -module -avoid-version -shared
+swrast_dri_la_LDFLAGS = $(DRI_DRIVER_LDFLAGS)
+
 swrast_dri_la_LIBADD = \
        $(DRI_LIB_DEPS)
 
index 106c7db9b6c6faab8aab866ec579f7a950573993..686e478734fad6e73d3a62637d5499a10384f537 100644 (file)
@@ -37,7 +37,11 @@ libdricore@VERSION@_la_SOURCES = \
        $(LIBGLCPP_FILES) \
        $(LIBGLSL_GENERATED_CXX_FILES) \
        $(LIBGLSL_FILES)
-libdricore@VERSION@_la_LDFLAGS = -version-number 1:0
+libdricore@VERSION@_la_LDFLAGS = \
+        -version-number 1:0 \
+       -Wl,-Bsymbolic \
+        $()
+
 libdricore@VERSION@_la_LIBADD = \
         ../program/libdricore_program.la \
         $()