This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: Support LD_SYMBOLIC and LD_SYMBOLIC_FUNCTIONS


I rebuilt firefox with -Bsymbolic-functions. It significantly reduced
number of relocations in DSOs and improved firefox load time.  This
patch allows me to apply -Bsymbolic-functions on firefox by just
setting LD_SYMBOLIC_FUNCTIONS before compiling it.  It will make it
trivial to rebuild any or all packages with -Bsymbolic-functions and
improve system performance.


H.J.
----
2007-01-24  H.J. Lu  <hongjiu.lu@intel.com>

	* NEWS: Mention LD_SYMBOLIC and LD_SYMBOLIC_FUNCTIONS.

	* ld.texinfo: Document LD_SYMBOLIC and LD_SYMBOLIC_FUNCTIONS.

	* ldmain.c (main): Handle LD_SYMBOLIC and
	LD_SYMBOLIC_FUNCTIONS.

--- ld/NEWS.env	2007-01-19 06:51:40.000000000 -0800
+++ ld/NEWS	2007-01-24 19:39:09.000000000 -0800
@@ -1,4 +1,7 @@
 -*- text -*-
+* ELF: Support environment variables, LD_SYMBOLIC for -Bsymbolic and
+  LD_SYMBOLIC_FUNCTIONS for -Bsymbolic-functions.
+
 * Add a new command line option '--default-script=FILE' or '-dT FILE'
   which specifies a replacement for the built in, default linker
   script.
--- ld/ld.texinfo.env	2007-01-19 07:14:37.000000000 -0800
+++ ld/ld.texinfo	2007-01-24 19:32:24.000000000 -0800
@@ -1144,14 +1144,21 @@ When creating a shared library, bind ref
 definition within the shared library, if any.  Normally, it is possible
 for a program linked against a shared library to override the definition
 within the shared library.  This option is only meaningful on ELF
-platforms which support shared libraries.
+platforms which support shared libraries.  If @option{-Bsymbolic} is not
+used when linking a shared library, the linker will also turn on this
+option if the environment variable @code{LD_SYMBOLIC} is set.
 
 @kindex -Bsymbolic-functions
 @item -Bsymbolic-functions
 When creating a shared library, bind references to global function
 symbols to the definition within the shared library, if any. 
 This option is only meaningful on ELF platforms which support shared
-libraries.
+libraries.  If @option{-Bsymbolic-functions} is not used when linking a
+shared library, the linker will also turn on this option if the
+environment variable @code{LD_SYMBOLIC_FUNCTIONS} is set.  When
+both environment variables @code{LD_SYMBOLIC} and
+@code{LD_SYMBOLIC_FUNCTIONS} are set, @code{LD_SYMBOLIC} will take
+precedent.
 
 @kindex --dynamic-list=@var{dynamic-list-file}
 @item --dynamic-list=@var{dynamic-list-file}
--- ld/ldmain.c.env	2007-01-24 18:32:10.000000000 -0800
+++ ld/ldmain.c	2007-01-24 19:42:38.000000000 -0800
@@ -256,7 +256,12 @@ main (int argc, char **argv)
   command_line.warn_mismatch = TRUE;
   command_line.check_section_addresses = TRUE;
   command_line.accept_unknown_input_arch = FALSE;
-  command_line.symbolic = symbolic_unset;
+  if (getenv ("LD_SYMBOLIC") != NULL)
+    command_line.symbolic = symbolic;
+  else if (getenv ("LD_SYMBOLIC_FUNCTIONS") != NULL)
+    command_line.symbolic = symbolic_functions;
+  else
+    command_line.symbolic = symbolic_unset;
   command_line.dynamic_list = dynamic_list_unset;
 
   sort_section = none;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]