aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-03-06 09:07:56 +0000
committerUlrich Drepper <drepper@redhat.com>2004-03-06 09:07:56 +0000
commit53bfdc1cf6f9360dfc5eb95c906159f949a8f83a (patch)
tree8009e94c553c7170b0f8b94e407d6051a8a5bc1f
parent154d10bdf1984f4fe28f898e07bc25c5367f443e (diff)
downloadglibc-53bfdc1cf6f9360dfc5eb95c906159f949a8f83a.tar
glibc-53bfdc1cf6f9360dfc5eb95c906159f949a8f83a.tar.gz
glibc-53bfdc1cf6f9360dfc5eb95c906159f949a8f83a.tar.bz2
glibc-53bfdc1cf6f9360dfc5eb95c906159f949a8f83a.zip
Update.
2004-03-06 Ulrich Drepper <drepper@redhat.com> * elf/dl-open.c: No need to pass any parameter to _dl_start_profile. They are the same in both places. * elf/dl-profile.c: Likewise. * elf/rtld.c: Likewise. * sysdeps/generic/ldsodefs.h: Likewise. * elf/dl-support.c: Define _dl_profile_output variable. Initialize it.
-rw-r--r--ChangeLog9
-rw-r--r--elf/dl-open.c5
-rw-r--r--elf/dl-profile.c13
-rw-r--r--elf/dl-support.c6
-rw-r--r--elf/rtld.c2
-rw-r--r--sysdeps/generic/ldsodefs.h6
6 files changed, 27 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index d94b82f358..2ef7150b96 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2004-03-06 Ulrich Drepper <drepper@redhat.com>
+
+ * elf/dl-open.c: No need to pass any parameter to _dl_start_profile.
+ They are the same in both places.
+ * elf/dl-profile.c: Likewise.
+ * elf/rtld.c: Likewise.
+ * sysdeps/generic/ldsodefs.h: Likewise.
+ * elf/dl-support.c: Define _dl_profile_output variable. Initialize it.
+
2004-03-05 Ulrich Drepper <drepper@redhat.com>
* elf/Versions: Remove functions which are not exported anymore.
diff --git a/elf/dl-open.c b/elf/dl-open.c
index ce9a959ea7..8af6eefb46 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -305,7 +305,7 @@ dl_open_worker (void *a)
return;
/* It was already open. */
- if (new->l_searchlist.r_list != NULL)
+ if (__builtin_expect (new->l_searchlist.r_list != NULL, 0))
{
/* Let the user know about the opencount. */
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
@@ -362,8 +362,7 @@ dl_open_worker (void *a)
if (old_profile_map == NULL && GL(dl_profile_map) != NULL)
/* We must prepare the profiling. */
- GLRO(dl_start_profile) (GL(dl_profile_map),
- GLRO(dl_profile_output));
+ GLRO(dl_start_profile) ();
}
else
#endif
diff --git a/elf/dl-profile.c b/elf/dl-profile.c
index 3b99fad8ea..8afa8350c2 100644
--- a/elf/dl-profile.c
+++ b/elf/dl-profile.c
@@ -173,7 +173,7 @@ static unsigned int log_hashfraction;
file is found (or created) in OUTPUT_DIR. */
void
internal_function
-_dl_start_profile (struct link_map *map, const char *output_dir)
+_dl_start_profile (void)
{
char *filename;
int fd;
@@ -195,7 +195,8 @@ _dl_start_profile (struct link_map *map, const char *output_dir)
#define SCALE_1_TO_1 0x10000L
/* Compute the size of the sections which contain program code. */
- for (ph = map->l_phdr; ph < &map->l_phdr[map->l_phnum]; ++ph)
+ for (ph = GL(dl_profile_map)->l_phdr;
+ ph < &GL(dl_profile_map)->l_phdr[GL(dl_profile_map)->l_phnum]; ++ph)
if (ph->p_type == PT_LOAD && (ph->p_flags & PF_X))
{
ElfW(Addr) start = (ph->p_vaddr & ~(GLRO(dl_pagesize) - 1));
@@ -211,9 +212,9 @@ _dl_start_profile (struct link_map *map, const char *output_dir)
/* Now we can compute the size of the profiling data. This is done
with the same formulars as in `monstartup' (see gmon.c). */
running = 0;
- lowpc = ROUNDDOWN (mapstart + map->l_addr,
+ lowpc = ROUNDDOWN (mapstart + GL(dl_profile_map)->l_addr,
HISTFRACTION * sizeof (HISTCOUNTER));
- highpc = ROUNDUP (mapend + map->l_addr,
+ highpc = ROUNDUP (mapend + GL(dl_profile_map)->l_addr,
HISTFRACTION * sizeof (HISTCOUNTER));
textsize = highpc - lowpc;
kcountsize = textsize / HISTFRACTION;
@@ -273,9 +274,9 @@ _dl_start_profile (struct link_map *map, const char *output_dir)
/* First determine the output name. We write in the directory
OUTPUT_DIR and the name is composed from the shared objects
soname (or the file name) and the ending ".profile". */
- filename = (char *) alloca (strlen (output_dir) + 1
+ filename = (char *) alloca (strlen (GLRO(dl_profile_output)) + 1
+ strlen (GLRO(dl_profile)) + sizeof ".profile");
- cp = __stpcpy (filename, output_dir);
+ cp = __stpcpy (filename, GLRO(dl_profile_output));
*cp++ = '/';
__stpcpy (__stpcpy (cp, GLRO(dl_profile)), ".profile");
diff --git a/elf/dl-support.c b/elf/dl-support.c
index 44335e8a8e..0b2d0243de 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -49,6 +49,7 @@ int _dl_verbose;
/* We never do profiling. */
const char *_dl_profile;
+const char *_dl_profile_output;
/* Names of shared object for which the RUNPATHs and RPATHs should be
ignored. */
@@ -247,6 +248,11 @@ _dl_non_dynamic_init (void)
_dl_dynamic_weak = *(getenv ("LD_DYNAMIC_WEAK") ?: "") == '\0';
+ _dl_profile_output = getenv ("LD_PROFILE_OUTPUT");
+ if (_dl_profile_output == NULL || _dl_profile_output[0] == '\0')
+ _dl_profile_output
+ = &"/var/tmp\0/var/profile"[__libc_enable_secure ? 9 : 0];
+
if (__libc_enable_secure)
{
static const char *unsecure_envvars[] =
diff --git a/elf/rtld.c b/elf/rtld.c
index cf82d5ad3b..f9e8b8443b 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -1821,7 +1821,7 @@ cannot allocate TLS data structures for initial thread");
needs to have _dl_profile_map set up by the relocator. */
if (__builtin_expect (GL(dl_profile_map) != NULL, 0))
/* We must prepare the profiling. */
- _dl_start_profile (GL(dl_profile_map), GLRO(dl_profile_output));
+ _dl_start_profile ();
if (GL(dl_rtld_map).l_opencount > 1)
{
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index e6e144f9eb..cdb0735d49 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -476,8 +476,7 @@ struct rtld_global_ro
void (*) (void *), void *);
void (internal_function *_dl_signal_error) (int, const char *, const char *,
const char *);
- void (internal_function *_dl_start_profile) (struct link_map *,
- const char *);
+ void (internal_function *_dl_start_profile) (void);
void (*_dl_mcount) (ElfW(Addr) frompc, ElfW(Addr) selfpc);
lookup_t (internal_function *_dl_lookup_symbol) (const char *,
struct link_map *,
@@ -797,8 +796,7 @@ extern void _dl_init_paths (const char *library_path) internal_function;
/* Gather the information needed to install the profiling tables and start
the timers. */
-extern void _dl_start_profile (struct link_map *map, const char *output_dir)
- internal_function attribute_hidden;
+extern void _dl_start_profile (void) internal_function attribute_hidden;
/* The actual functions used to keep book on the calls. */
extern void _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc);