making use of --dynamic-list-cpp-typeinfo

Dirk Mueller <[email protected]> Tue, 19 Sep 2006 17:11:29 +0200
Newsgroups gmane.comp.kde.devel.optimize
Message-ID <[email protected]>
--Boundary-00=_hiAEFt381s+BrHc
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


Hi, 

since about a week, the GNU binutils have gained support for reducing 
intra-shared lib relocation overhead. Via a special flag, you can ask the 
linker to resolve relocations any uninteresting or only a certain set of 
symbols always internally. This is a significant gain for C++, where you 
normally don't make use of LD_PRELOAD's that overwrite C++ mangled symbols. 

I've tested this against libqt3-3.3.6, and it reduces the symbol relocations 
by about 60%, reducing library footprint by about 8% and improving relocation 
startup time by far more than 50%. 

On a fully internally linked KDE 3.x system, I measured a relocation speedup 
of something between 20-40%. I've not done login time benchmarking. 

Below is a patch for KDE 3.x for further testing. 


Dirk


--Boundary-00=_hiAEFt381s+BrHc
Content-Type: text/x-diff;
  charset="us-ascii";
  name="diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="diff"

Index: admin/acinclude.m4.in
===================================================================
--- admin/acinclude.m4.in	(revision 585965)
+++ admin/acinclude.m4.in	(working copy)
@@ -991,7 +991,7 @@ if test -z "$kde_x_libraries" || test "x
   X_LDFLAGS="-L$x_libraries"
 fi
 all_includes="$X_INCLUDES"
-all_libraries="$X_LDFLAGS $LDFLAGS_AS_NEEDED $LDFLAGS_NEW_DTAGS"
+all_libraries="$X_LDFLAGS $LDFLAGS_AS_NEEDED $LDFLAGS_NEW_DTAGS $LDFLAGS_DYNAMIC_LIST"
 
 # Check for libraries that X11R6 Xt/Xaw programs need.
 ac_save_LDFLAGS="$LDFLAGS"
@@ -1727,6 +1727,16 @@ AC_DEFUN([KDE_CHECK_NEW_LDFLAGS],
   AC_SUBST(LDFLAGS_NEW_DTAGS)
 ])
 
+dnl Check if the linker supports --dynamic-list-cpp-typeinfo
+AC_DEFUN([KDE_CHECK_DYNAMIC_LIST],
+[
+  LDFLAGS_DYNAMIC_LIST=""
+  KDE_CHECK_COMPILER_FLAG([Wl,--dynamic-list-cpp-typeinfo],
+      [LDFLAGS_DYNAMIC_LIST="-Wl,--dynamic-list-cpp-typeinfo"])
+
+  AC_SUBST(LDFLAGS_DYNAMIC_LIST)
+])
+
 AC_DEFUN([KDE_CHECK_NMCHECK],
 [
   AC_ARG_ENABLE(nmcheck,AC_HELP_STRING([--enable-nmcheck],[enable automatic namespace cleanness check]),
@@ -3347,6 +3357,7 @@ AC_DEFUN([AC_CHECK_COMPILERS],
   AC_SUBST(ENABLE_PERMISSIVE_FLAG)
 
   KDE_CHECK_NEW_LDFLAGS
+  KDE_CHECK_DYNAMIC_LIST
   KDE_CHECK_FINAL
   KDE_CHECK_CLOSURE
   KDE_CHECK_NMCHECK

--Boundary-00=_hiAEFt381s+BrHc
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Kde-optimize mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-optimize

--Boundary-00=_hiAEFt381s+BrHc--