@@ -130,7 +130,7 @@ void *_dl_random;
#include <dl-procinfo.c>
/* Initial value of the CPU clock. */
-#ifndef HP_TIMING_NONAVAIL
+#if HP_TIMING_INLINE
hp_timing_t _dl_cpuclock_offset;
#endif
@@ -314,8 +314,9 @@ _dl_non_dynamic_init (void)
_dl_main_map.l_phdr = GL(dl_phdr);
_dl_main_map.l_phnum = GL(dl_phnum);
- if (HP_SMALL_TIMING_AVAIL)
- HP_TIMING_NOW (_dl_cpuclock_offset);
+#if HP_TIMING_INLINE
+ HP_TIMING_NOW (_dl_cpuclock_offset);
+#endif
_dl_verbose = *(getenv ("LD_WARN") ?: "") == '\0' ? 0 : 1;
@@ -46,6 +46,10 @@
#include <assert.h>
+#if !HP_TIMING_INLINE
+# define HP_TIMING_NONAVAIL 1
+#endif
+
/* Avoid PLT use for our local calls at startup. */
extern __typeof (__mempcpy) __mempcpy attribute_hidden;
@@ -335,7 +339,7 @@ static ElfW(Addr) _dl_start_final (void *arg);
struct dl_start_final_info
{
struct link_map l;
-#if !defined HP_TIMING_NONAVAIL && HP_TIMING_INLINE
+#ifndef HP_TIMING_NONAVAIL
hp_timing_t start_time;
#endif
};
@@ -371,16 +375,9 @@ _dl_start_final (void *arg, struct dl_start_final_info *info)
{
ElfW(Addr) start_addr;
- if (HP_SMALL_TIMING_AVAIL)
- {
- /* If it hasn't happen yet record the startup time. */
- if (! HP_TIMING_INLINE)
- HP_TIMING_NOW (start_time);
#if !defined DONT_USE_BOOTSTRAP_MAP && !defined HP_TIMING_NONAVAIL
- else
- start_time = info->start_time;
+ start_time = info->start_time;
#endif
- }
/* Transfer data about ourselves to the permanent link_map structure. */
#ifndef DONT_USE_BOOTSTRAP_MAP
@@ -403,7 +400,9 @@ _dl_start_final (void *arg, struct dl_start_final_info *info)
# endif
#endif
+#if HP_TIMING_INLINE
HP_TIMING_NOW (GL(dl_cpuclock_offset));
+#endif
/* Initialize the stack end variable. */
__libc_stack_end = __builtin_frame_address (0);
@@ -416,16 +415,13 @@ _dl_start_final (void *arg, struct dl_start_final_info *info)
#ifndef HP_TIMING_NONAVAIL
hp_timing_t rtld_total_time;
- if (HP_SMALL_TIMING_AVAIL)
- {
- hp_timing_t end_time;
+ hp_timing_t end_time;
- /* Get the current time. */
- HP_TIMING_NOW (end_time);
+ /* Get the current time. */
+ HP_TIMING_NOW (end_time);
- /* Compute the difference. */
- HP_TIMING_DIFF (rtld_total_time, start_time, end_time);
- }
+ /* Compute the difference. */
+ HP_TIMING_DIFF (rtld_total_time, start_time, end_time);
#endif
if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_STATISTICS))
@@ -459,11 +455,12 @@ _dl_start (void *arg)
#define RESOLVE_MAP(sym, version, flags) BOOTSTRAP_MAP
#include "dynamic-link.h"
- if (HP_TIMING_INLINE && HP_SMALL_TIMING_AVAIL)
-#ifdef DONT_USE_BOOTSTRAP_MAP
+#ifndef HP_TIMING_NONAVAIL
+# ifdef DONT_USE_BOOTSTRAP_MAP
HP_TIMING_NOW (start_time);
-#else
+# else
HP_TIMING_NOW (info.start_time);
+# endif
#endif
/* Partly clean the `bootstrap_map' structure up. Don't use
@@ -1050,12 +1047,16 @@ of this helper program; chances are you did not intend to run this program.\n\
}
else
{
+#ifndef HP_TIMING_NONAVAIL
HP_TIMING_NOW (start);
+#endif
_dl_map_object (NULL, rtld_progname, lt_executable, 0,
__RTLD_OPENEXEC, LM_ID_BASE);
+#ifndef HP_TIMING_NONAVAIL
HP_TIMING_NOW (stop);
HP_TIMING_DIFF (load_time, start, stop);
+#endif
}
/* Now the map for the main executable is available. */
@@ -1619,11 +1620,15 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
if (__glibc_unlikely (preloadlist != NULL))
{
+#ifndef HP_TIMING_NONAVAIL
HP_TIMING_NOW (start);
+#endif
npreloads += handle_ld_preload (preloadlist, main_map);
+#ifndef HP_TIMING_NONAVAIL
HP_TIMING_NOW (stop);
HP_TIMING_DIFF (diff, start, stop);
HP_TIMING_ACCUM_NT (load_time, diff);
+#endif
}
/* There usually is no ld.so.preload file, it should only be used
@@ -1682,9 +1687,9 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
problem = NULL;
file[file_size - 1] = '\0';
}
-
+#ifndef HP_TIMING_NONAVAIL
HP_TIMING_NOW (start);
-
+#endif
if (file != problem)
{
char *p;
@@ -1700,11 +1705,11 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
npreloads += do_preload (p, main_map, preload_file);
}
-
+#ifndef HP_TIMING_NONAVAIL
HP_TIMING_NOW (stop);
HP_TIMING_DIFF (diff, start, stop);
HP_TIMING_ACCUM_NT (load_time, diff);
-
+#endif
/* We don't need the file anymore. */
__munmap (file, file_size);
}
@@ -1727,12 +1732,15 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
/* Load all the libraries specified by DT_NEEDED entries. If LD_PRELOAD
specified some libraries to load, these are inserted before the actual
dependencies in the executable's searchlist for symbol resolution. */
+#ifndef HP_TIMING_NONAVAIL
HP_TIMING_NOW (start);
+#endif
_dl_map_object_deps (main_map, preloads, npreloads, mode == trace, 0);
+#ifndef HP_TIMING_NONAVAIL
HP_TIMING_NOW (stop);
HP_TIMING_DIFF (diff, start, stop);
HP_TIMING_ACCUM_NT (load_time, diff);
-
+#endif
/* Mark all objects as being in the global scope. */
for (i = main_map->l_searchlist.r_nlist; i > 0; )
main_map->l_searchlist.r_list[--i]->l_global = 1;
@@ -2127,9 +2135,8 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
#ifndef HP_TIMING_NONAVAIL
hp_timing_t start;
hp_timing_t stop;
-#endif
-
HP_TIMING_NOW (start);
+#endif
assert (main_map->l_info [VALIDX (DT_GNU_CONFLICTSZ)] != NULL);
conflict = (ElfW(Rela) *)
main_map->l_info [ADDRIDX (DT_GNU_CONFLICT)]->d_un.d_ptr;
@@ -2137,8 +2144,10 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
((char *) conflict
+ main_map->l_info [VALIDX (DT_GNU_CONFLICTSZ)]->d_un.d_val);
_dl_resolve_conflicts (main_map, conflict, conflictend);
+#ifndef HP_TIMING_NONAVAIL
HP_TIMING_NOW (stop);
HP_TIMING_DIFF (relocate_time, start, stop);
+#endif
}
@@ -2169,12 +2178,12 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
#ifndef HP_TIMING_NONAVAIL
hp_timing_t start;
hp_timing_t stop;
+ HP_TIMING_NOW (start);
#endif
/* If we are profiling we also must do lazy reloaction. */
GLRO(dl_lazy) |= consider_profiling;
- HP_TIMING_NOW (start);
unsigned i = main_map->l_searchlist.r_nlist;
while (i-- > 0)
{
@@ -2201,10 +2210,11 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
if (l->l_tls_blocksize != 0 && tls_init_tp_called)
_dl_add_to_slotinfo (l);
}
+#ifndef HP_TIMING_NONAVAIL
HP_TIMING_NOW (stop);
HP_TIMING_DIFF (relocate_time, start, stop);
-
+#endif
/* Now enable profiling if needed. Like the previous call,
this has to go here because the calls it makes should use the
rtld versions of the functions (particularly calloc()), but it
@@ -2250,15 +2260,17 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
hp_timing_t start;
hp_timing_t stop;
hp_timing_t add;
+ HP_TIMING_NOW (start);
#endif
- HP_TIMING_NOW (start);
/* Mark the link map as not yet relocated again. */
GL(dl_rtld_map).l_relocated = 0;
_dl_relocate_object (&GL(dl_rtld_map), main_map->l_scope, 0, 0);
+#ifndef HP_TIMING_NONAVAIL
HP_TIMING_NOW (stop);
HP_TIMING_DIFF (add, start, stop);
HP_TIMING_ACCUM_NT (relocate_time, add);
+#endif
}
/* Do any necessary cleanups for the startup OS interface code.
@@ -962,7 +962,7 @@ __reclaim_stacks (void)
}
-#if HP_TIMING_AVAIL
+#if HP_TIMING_INLINE
# undef __find_thread_by_id
/* Find a thread given the thread ID. */
attribute_hidden
@@ -342,7 +342,7 @@ struct pthread
/* Lock for synchronizing setxid calls. */
unsigned int setxid_futex;
-#if HP_TIMING_AVAIL
+#if HP_TIMING_INLINE
/* Offset of the CPU clock at start thread start time. */
hp_timing_t cpuclock_offset;
#endif
@@ -276,7 +276,7 @@ __pthread_initialize_minimal_internal (void)
THREAD_SETMEM (pd, user_stack, true);
if (LLL_LOCK_INITIALIZER != 0)
THREAD_SETMEM (pd, lock, LLL_LOCK_INITIALIZER);
-#if HP_TIMING_AVAIL
+#if HP_TIMING_INLINE
THREAD_SETMEM (pd, cpuclock_offset, GL(dl_cpuclock_offset));
#endif
@@ -21,7 +21,7 @@
#include "pthreadP.h"
-#if HP_TIMING_AVAIL
+#if HP_TIMING_INLINE
int
__pthread_clock_gettime (clockid_t clock_id, hp_timing_t freq,
struct timespec *tp)
@@ -21,7 +21,7 @@
#include "pthreadP.h"
-#if HP_TIMING_AVAIL
+#if HP_TIMING_INLINE
int
__pthread_clock_settime (clockid_t clock_id, hp_timing_t offset)
{
@@ -379,7 +379,7 @@ START_THREAD_DEFN
{
struct pthread *pd = START_THREAD_SELF;
-#if HP_TIMING_AVAIL
+#if HP_TIMING_INLINE
/* Remember the time when the thread was started. */
hp_timing_t now;
HP_TIMING_NOW (now);
@@ -352,7 +352,7 @@ struct rtld_global
/* The object to be initialized first. */
EXTERN struct link_map *_dl_initfirst;
-#if HP_SMALL_TIMING_AVAIL
+#if HP_TIMING_INLINE
/* Start time on CPU clock. */
EXTERN hp_timing_t _dl_cpuclock_offset;
#endif
@@ -62,7 +62,7 @@ int __libc_multiple_libcs = 0; /* Defining this here avoids the inclusion
void *__libc_stack_end = NULL;
rtld_hidden_data_def(__libc_stack_end)
-#if HP_TIMING_AVAIL
+#if HP_TIMING_INLINE
hp_timing_t _dl_cpuclock_offset;
#endif
@@ -246,7 +246,7 @@ unfmh(); /* XXX */
/* Initialize frequently used global variable. */
GLRO(dl_pagesize) = __getpagesize ();
-#if HP_TIMING_AVAIL
+#if HP_TIMING_INLINE
HP_TIMING_NOW (_dl_cpuclock_offset);
#endif
@@ -83,7 +83,7 @@ __libc_fork (void)
if (__fork_generation_pointer != NULL)
*__fork_generation_pointer += __PTHREAD_ONCE_FORK_GEN_INCR;
-#if HP_TIMING_AVAIL
+#if HP_TIMING_INLINE
/* The CPU clock of the thread and process have to be set to zero. */
hp_timing_t now;
HP_TIMING_NOW (now);
@@ -24,7 +24,7 @@
#include <libc-internal.h>
-#if HP_TIMING_AVAIL
+#if HP_TIMING_INLINE
static long int nsec; /* Clock frequency of the processor. */
static int
@@ -87,7 +87,7 @@ __clock_getres (clockid_t clock_id, struct timespec *res)
break;
default:
-#if HP_TIMING_AVAIL
+#if HP_TIMING_INLINE
if ((clock_id & ((1 << CLOCK_IDFIELD_SIZE) - 1))
== CLOCK_THREAD_CPUTIME_ID)
retval = hp_timing_getres (res);
@@ -96,7 +96,7 @@ __clock_getres (clockid_t clock_id, struct timespec *res)
__set_errno (EINVAL);
break;
-#if HP_TIMING_AVAIL
+#if HP_TIMING_INLINE
case CLOCK_PROCESS_CPUTIME_ID:
case CLOCK_THREAD_CPUTIME_ID:
retval = hp_timing_getres (res);
@@ -24,7 +24,7 @@
#include <ldsodefs.h>
-#if HP_TIMING_AVAIL
+#if HP_TIMING_INLINE
/* Clock frequency of the processor. We make it a 64-bit variable
because some jokers are already playing with processors with more
than 4GHz. */
@@ -105,7 +105,7 @@ __clock_gettime (clockid_t clock_id, struct timespec *tp)
break;
default:
-#if HP_TIMING_AVAIL
+#if HP_TIMING_INLINE
if ((clock_id & ((1 << CLOCK_IDFIELD_SIZE) - 1))
== CLOCK_THREAD_CPUTIME_ID)
retval = hp_timing_gettime (clock_id, tp);
@@ -114,7 +114,7 @@ __clock_gettime (clockid_t clock_id, struct timespec *tp)
__set_errno (EINVAL);
break;
-#if HP_TIMING_AVAIL
+#if HP_TIMING_INLINE
case CLOCK_PROCESS_CPUTIME_ID:
retval = hp_timing_gettime (clock_id, tp);
break;
@@ -22,7 +22,7 @@
#include <hp-timing.h>
#include <sysdep-cancel.h>
-#if HP_TIMING_AVAIL
+#if HP_TIMING_INLINE
# define CPUCLOCK_P(clock) \
((clock) == CLOCK_PROCESS_CPUTIME_ID \
|| ((clock) & ((1 << CLOCK_IDFIELD_SIZE) - 1)) == CLOCK_THREAD_CPUTIME_ID)
@@ -21,7 +21,7 @@
#include <ldsodefs.h>
-#if HP_TIMING_AVAIL
+#if HP_TIMING_INLINE
/* Clock frequency of the processor. We make it a 64-bit variable
because some jokers are already playing with processors with more
than 4GHz. */
@@ -93,7 +93,7 @@ __clock_settime (clockid_t clock_id, const struct timespec *tp)
break;
default:
-# if HP_TIMING_AVAIL
+# if HP_TIMING_INLINE
if (CPUCLOCK_WHICH (clock_id) == CLOCK_PROCESS_CPUTIME_ID
|| CPUCLOCK_WHICH (clock_id) == CLOCK_THREAD_CPUTIME_ID)
retval = hp_timing_settime (clock_id, tp);
@@ -39,10 +39,10 @@ static long int posix_sysconf (int name);
static long int
has_cpuclock (int name)
{
-# if defined __NR_clock_getres || HP_TIMING_AVAIL
+# if defined __NR_clock_getres || HP_TIMING_INLINE
/* If we have HP_TIMING, we will fall back on that if the system
call does not work, so we support it either way. */
-# if !HP_TIMING_AVAIL
+# if !HP_TIMING_INLINE
/* Check using the clock_getres system call. */
struct timespec ts;
INTERNAL_SYSCALL_DECL (err);