about summary refs log tree commit diff
path: root/elf/dl-open.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-06-18 16:51:12 +0000
committerUlrich Drepper <drepper@redhat.com>1998-06-18 16:51:12 +0000
commit5ad49c070734c57f35cfe045572fb22158870c78 (patch)
treed17a62167c0996bbe744522fcb819446817cdc04 /elf/dl-open.c
parent2827300fbe8b237b825aa29b95f24026aedd4b20 (diff)
downloadglibc-5ad49c070734c57f35cfe045572fb22158870c78.tar.gz
glibc-5ad49c070734c57f35cfe045572fb22158870c78.tar.xz
glibc-5ad49c070734c57f35cfe045572fb22158870c78.zip
Update.
1998-06-18 16:40  Ulrich Drepper  <drepper@cygnus.com>

	* libc.map: Add _dl_profile_map, _dl_profile_output, _dl_start_profile,
	_dl_mcount, _dl_mcount_wrapper.
	* elf/Makefile (routines): Add dl-profstub.
	* elf/dl-profstub.c: New file.
	* elf/dl-support.c: Don't define _dl_profile_map.
	* elf/rtld.c: Likewise.
	* elf/dlfcn.h: Define DL_CALL_FCT macro.
	* elf/ldsodefs.h: Declare _dl_profile_output, _dl_mcount_wrapper.
	Define _CALL_DL_FCT.
	* iconv/gconv.c: Use _CALL_DL_FCT to call function from dynamically
	loaded object.
	* iconv/gconv_db.c: Likewise.
	* iconv/skeleton.c: Likewise.
	* nss/getXXbyYY_r.c: Likewise.
	* nss/getXXent_r.c: Likewise.
	* nss/nsswitch.c: Likewise.
Diffstat (limited to 'elf/dl-open.c')
-rw-r--r--elf/dl-open.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 4c4c8abdc5..2b9590913f 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -101,9 +101,27 @@ _dl_open (const char *file, int mode)
 	     magic ward.  */
 	  asm ("" : "=r" (reloc) : "0" (reloc));
 
-	  (*reloc) (l, _dl_object_relocation_scope (l),
-		    ((mode & RTLD_BINDING_MASK) == RTLD_LAZY
-		     || _dl_profile != NULL), _dl_profile != NULL);
+#ifdef PIC
+	  if (_dl_profile != NULL)
+	    {
+	      /* If this here is the shared object which we want to profile
+		 make sure the profile is started.  We can find out whether
+	         this is necessary or not by observing the `_dl_profile_map'
+	         variable.  If was NULL but is not NULL afterwars we must
+		 start the profiling.  */
+	      struct link_map *old_profile_map = _dl_profile_map;
+
+	      (*reloc) (l, _dl_object_relocation_scope (l), 1, 1);
+
+	      if (old_profile_map == NULL && _dl_profile_map != NULL)
+		/* We must prepare the profiling.  */
+		_dl_start_profile (_dl_profile_map, _dl_profile_output);
+	    }
+	  else
+#endif
+	    (*reloc) (l, _dl_object_relocation_scope (l),
+		      (mode & RTLD_BINDING_MASK) == RTLD_LAZY, 0);
+
 	  *_dl_global_scope_end = NULL;
 	}