summary refs log tree commit diff
path: root/elf/ldsodefs.h
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/ldsodefs.h
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/ldsodefs.h')
-rw-r--r--elf/ldsodefs.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/elf/ldsodefs.h b/elf/ldsodefs.h
index 45c2a5ec64..6814f25556 100644
--- a/elf/ldsodefs.h
+++ b/elf/ldsodefs.h
@@ -127,6 +127,8 @@ extern int _dl_zerofd;
 extern const char *_dl_profile;
 /* Map of shared object to be profiled.  */
 extern struct link_map *_dl_profile_map;
+/* Filename of the output file.  */
+extern const char *_dl_profile_output;
 
 /* If nonzero the appropriate debug information is printed.  */
 extern int _dl_debug_libs;
@@ -409,6 +411,11 @@ extern void _dl_start_profile (struct link_map *map, const char *output_dir)
 /* The actual functions used to keep book on the calls.  */
 extern void _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc);
 
+/* This function is simply a wrapper around the _dl_mcount function
+   which does not require a FROMPC parameter since this is the
+   calling function.  */
+extern void _dl_mcount_wrapper (ElfW(Addr) selfpc);
+
 
 /* Show the members of the auxiliary array passed up from the kernel.  */
 extern void _dl_show_auxv (void) internal_function;
@@ -424,6 +431,18 @@ extern const struct r_strlenpair *_dl_important_hwcaps (const char *platform,
 							size_t *max_capstrlen)
      internal_function;
 
+
+/* When we do profiling we have the problem that uses of `dlopen'ed
+   objects don't use the PLT but instead use a pointer to the function.
+   We still want to have profiling data and in these cases we must do
+   the work of calling `_dl_mcount' ourself.  The following macros
+   helps do it.  */
+#define _CALL_DL_FCT(fctp, args) \
+  ({ if (_dl_profile_map != NULL)					      \
+       _dl_mcount_wrapper ((ElfW(Addr)) fctp);				      \
+     (*fctp) args;							      \
+  })
+
 __END_DECLS
 
 #endif /* ldsodefs.h */