about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-07-21 06:43:05 +0000
committerUlrich Drepper <drepper@redhat.com>2000-07-21 06:43:05 +0000
commitf53c03c20d6039d78cf1ccb43fbbbe79e0ec7e9e (patch)
treefa9ef879669c57ff5becd3911f5ee26211229ecd
parentd052b31b79a3681db7de04177a55b04354320a61 (diff)
downloadglibc-f53c03c20d6039d78cf1ccb43fbbbe79e0ec7e9e.tar.gz
glibc-f53c03c20d6039d78cf1ccb43fbbbe79e0ec7e9e.tar.xz
glibc-f53c03c20d6039d78cf1ccb43fbbbe79e0ec7e9e.zip
Update.
	* elf/rtld.c: Define _dl_bind_not variable.
	(process_envvars): Recognize LD_BIND_NOT and set _dl_bind_not.
	* elf/dl-support.c: Likewise.
	* sysdeps/generic/ldsodefs.h: Declare _dl_bind_not.
	* elf/dl-runtime.c (fixup): Don't remember looked up value if
	_dl_bind_not.
	(profile_fixup): Likewise.
-rw-r--r--ChangeLog8
-rw-r--r--elf/dl-runtime.c6
-rw-r--r--elf/dl-support.c5
-rw-r--r--elf/rtld.c8
-rw-r--r--sysdeps/generic/ldsodefs.h3
5 files changed, 28 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 47ee8b7f2b..5d9be22c22 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2000-07-20  Ulrich Drepper  <drepper@redhat.com>
 
+	* elf/rtld.c: Define _dl_bind_not variable.
+	(process_envvars): Recognize LD_BIND_NOT and set _dl_bind_not.
+	* elf/dl-support.c: Likewise.
+	* sysdeps/generic/ldsodefs.h: Declare _dl_bind_not.
+	* elf/dl-runtime.c (fixup): Don't remember looked up value if
+	_dl_bind_not.
+	(profile_fixup): Likewise.
+
 	* libio/Makefile (routines): Add fwide.
 	* libio/iofwide.c (_IO_fwide): Remove locking.  This is done in
 	fwide now.  Internal calls to _IO_fwide must do locking themselves
diff --git a/elf/dl-runtime.c b/elf/dl-runtime.c
index bff27e721e..57746092f1 100644
--- a/elf/dl-runtime.c
+++ b/elf/dl-runtime.c
@@ -117,6 +117,9 @@ fixup (
   value = elf_machine_plt_value (l, reloc, value);
 
   /* Finally, fix up the plt itself.  */
+  if (__builtin_expect (_dl_bind_not, 0))
+    return value;
+
   return elf_machine_fixup_plt (l, result, reloc, rel_addr, value);
 }
 #endif
@@ -205,7 +208,8 @@ profile_fixup (
       value = elf_machine_plt_value (l, reloc, value);
 
       /* Store the result for later runs.  */
-      *resultp = value;
+      if (__builtin_expect (! _dl_bind_not, 1))
+	*resultp = value;
     }
 
   (*mcount_fct) (retaddr, value);
diff --git a/elf/dl-support.c b/elf/dl-support.c
index 8b1103966a..ec0bbb22bb 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -67,6 +67,9 @@ void *__libc_stack_end;
 /* Path where the binary is found.  */
 const char *_dl_origin_path;
 
+/* Nonzero if runtime lookup should not update the .got/.plt.  */
+int _dl_bind_not;
+
 /* Initially empty list of loaded objects.  */
 struct link_map *_dl_loaded;
 
@@ -109,6 +112,8 @@ non_dynamic_init (void)
 
   _dl_lazy = *(getenv ("LD_BIND_NOW") ?: "") == '\0';
 
+  _dl_bind_not = *(getenv ("LD_BIND_NOT") ?: "") != '\0';
+
   _dl_dynamic_weak = *(getenv ("LD_DYNAMIC_WEAK") ?: "") == '\0';
 
 #ifdef DL_PLATFORM_INIT
diff --git a/elf/rtld.c b/elf/rtld.c
index 8276b79a71..1d144c536e 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -96,6 +96,7 @@ int _dl_debug_statistics;
 const char *_dl_inhibit_rpath;		/* RPATH values which should be
 					   ignored.  */
 const char *_dl_origin_path;
+int _dl_bind_not;
 
 /* This is a pointer to the map for the main object and through it to
    all loaded objects.  */
@@ -1363,7 +1364,12 @@ process_envvars (enum mode *modep, int *lazyp)
 	case 8:
 	  /* Do we bind early?  */
 	  if (memcmp (&envline[3], "BIND_NOW", 8) == 0)
-	    bind_now = envline[12] != '\0';
+	    {
+	      bind_now = envline[12] != '\0';
+	      break;
+	    }
+	  if (memcmp (&envline[3], "BIND_NOT", 8) == 0)
+	    _dl_bind_not = envline[12] != '\0';
 	  break;
 
 	case 9:
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 2f81770fb1..b4b01e8a73 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -195,6 +195,9 @@ extern int _dl_dynamic_weak;
 /* The array with message we print as a last resort.  */
 extern const char _dl_out_of_memory[];
 
+/* Nonzero if runtime lookups should not update the .got/.plt.  */
+extern int _dl_bind_not;
+
 /* OS-dependent function to open the zero-fill device.  */
 extern int _dl_sysdep_open_zero_fill (void); /* dl-sysdep.c */