Submitted By: Robert Connolly <robert@linuxfromscratch.org> (ashes)
Date: 2006-08-12
Initial Package Version: 2.17
Upstream Status: From Upstream
Origin: http://sourceware.org/ml/binutils/2006-06/msg00218.html
	http://sourceware.org/ml/binutils-cvs/2006-06/msg00095.html
Description: This adds -z lazy option, inverse of -z now.

diff -Naur binutils-2.17.orig/ld/ChangeLog binutils-2.17/ld/ChangeLog
--- binutils-2.17.orig/ld/ChangeLog	2006-06-12 13:07:28.000000000 +0000
+++ binutils-2.17/ld/ChangeLog	2006-08-13 00:42:29.000000000 +0000
@@ -1,3 +1,10 @@
+2006-06-14  Kevin F. Quinn  <kevquinn@gentoo.org>
+
+	* ld.texinfo: Document new -z lazy option.
+	* emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Handle
+	new option.
+	(gld${EMULATION_NAME}_list_options): Update help text.
+
 2006-06-12  Fred Fish  <fnf@specifix.com>
 
 	* emulparams/elf32bmip.sh (OTHER_SECTIONS): Keep the
diff -Naur binutils-2.17.orig/ld/emultempl/elf32.em binutils-2.17/ld/emultempl/elf32.em
--- binutils-2.17.orig/ld/emultempl/elf32.em	2006-06-12 13:05:04.000000000 +0000
+++ binutils-2.17/ld/emultempl/elf32.em	2006-08-13 00:43:21.000000000 +0000
@@ -1826,6 +1826,11 @@
 	  link_info.flags |= (bfd_vma) DF_BIND_NOW;
 	  link_info.flags_1 |= (bfd_vma) DF_1_NOW;
 	}
+      else if (strcmp (optarg, "lazy") == 0)
+	{
+	  link_info.flags &= ~(bfd_vma) DF_BIND_NOW;
+	  link_info.flags_1 &= ~(bfd_vma) DF_1_NOW;
+	}
       else if (strcmp (optarg, "origin") == 0)
 	{
 	  link_info.flags |= (bfd_vma) DF_ORIGIN;
@@ -1893,6 +1898,7 @@
   fprintf (file, _("  -z execstack\t\tMark executable as requiring executable stack\n"));
   fprintf (file, _("  -z initfirst\t\tMark DSO to be initialized first at runtime\n"));
   fprintf (file, _("  -z interpose\t\tMark object to interpose all DSOs but executable\n"));
+  fprintf (file, _("  -z lazy\t\tMark object lazy runtime binding (default)\n"));
   fprintf (file, _("  -z loadfltr\t\tMark object requiring immediate process\n"));
   fprintf (file, _("  -z muldefs\t\tAllow multiple definitions\n"));
   fprintf (file, _("  -z nocombreloc\tDon't merge dynamic relocs into one section\n"));
diff -Naur binutils-2.17.orig/ld/ld.texinfo binutils-2.17/ld/ld.texinfo
--- binutils-2.17.orig/ld/ld.texinfo	2006-05-10 13:43:47.000000000 +0000
+++ binutils-2.17/ld/ld.texinfo	2006-08-13 00:42:56.000000000 +0000
@@ -962,6 +962,12 @@
 Marks the object that its symbol table interposes before all symbols
 but the primary executable.
 
+@item lazy
+When generating an executable or shared library, mark it to tell the
+dynamic linker to defer function call resolution to the point when
+the function is called (lazy binding), rather than at load time.
+Lazy binding is the default.
+
 @item loadfltr
 Marks  the object that its filters be processed immediately at
 runtime.
