[v2,8/8] Rely on HP_TIMING_AVAIL implies HP_SMALL_TIMING_AVAIL

Message ID 1404363026-23526-9-git-send-email-rth@twiddle.net
State Committed
Headers

Commit Message

Richard Henderson July 3, 2014, 4:50 a.m. UTC
  ---
 elf/dl-support.c           |  8 +-------
 elf/rtld.c                 | 18 +++++-------------
 sysdeps/generic/ldsodefs.h |  2 +-
 3 files changed, 7 insertions(+), 21 deletions(-)
  

Comments

Roland McGrath July 3, 2014, 6:36 a.m. UTC | #1
If that's actually the case, then there is no point whatsoever in having
both macros in the first place.  Instead of your last patch, just make
everything test HP_TIMING_AVAIL and do away with the "small" distinction
everywhere.
  
Richard Henderson July 3, 2014, 3:19 p.m. UTC | #2
On 07/02/2014 11:36 PM, Roland McGrath wrote:
> If that's actually the case, then there is no point whatsoever in having
> both macros in the first place.  Instead of your last patch, just make
> everything test HP_TIMING_AVAIL and do away with the "small" distinction
> everywhere.
> 

It's only ld.so in which I've made the substitution.  The "large" version is
still used in e.g. clock_gettime and friends.


r~
  
Roland McGrath July 4, 2014, 3:10 a.m. UTC | #3
> It's only ld.so in which I've made the substitution.  The "large" version is
> still used in e.g. clock_gettime and friends.

OK.  The comments could certainly be more clear.
  

Patch

diff --git a/elf/dl-support.c b/elf/dl-support.c
index e435436..6618dcc 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -129,12 +129,6 @@  void *_dl_random;
 /* Get architecture specific initializer.  */
 #include <dl-procinfo.c>
 
-/* We expect less than a second for relocation.  */
-#ifdef HP_SMALL_TIMING_AVAIL
-# undef HP_TIMING_AVAIL
-# define HP_TIMING_AVAIL HP_SMALL_TIMING_AVAIL
-#endif
-
 /* Initial value of the CPU clock.  */
 #ifndef HP_TIMING_NONAVAIL
 hp_timing_t _dl_cpuclock_offset;
@@ -315,7 +309,7 @@  _dl_non_dynamic_init (void)
   _dl_main_map.l_phdr = GL(dl_phdr);
   _dl_main_map.l_phnum = GL(dl_phnum);
 
-  if (HP_TIMING_AVAIL)
+  if (HP_SMALL_TIMING_AVAIL)
     HP_TIMING_NOW (_dl_cpuclock_offset);
 
   _dl_verbose = *(getenv ("LD_WARN") ?: "") == '\0' ? 0 : 1;
diff --git a/elf/rtld.c b/elf/rtld.c
index 8239269..d5cace8 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -195,12 +195,6 @@  static void dl_main (const ElfW(Phdr) *phdr, ElfW(Word) phnum,
 static struct libname_list _dl_rtld_libname;
 static struct libname_list _dl_rtld_libname2;
 
-/* We expect less than a second for relocation.  */
-#ifdef HP_SMALL_TIMING_AVAIL
-# undef HP_TIMING_AVAIL
-# define HP_TIMING_AVAIL HP_SMALL_TIMING_AVAIL
-#endif
-
 /* Variable for statistics.  */
 #ifndef HP_TIMING_NONAVAIL
 static hp_timing_t relocate_time;
@@ -270,7 +264,7 @@  _dl_start_final (void *arg, struct dl_start_final_info *info)
 {
   ElfW(Addr) start_addr;
 
-  if (HP_TIMING_AVAIL)
+  if (HP_SMALL_TIMING_AVAIL)
     {
       /* If it hasn't happen yet record the startup time.  */
       if (! HP_TIMING_INLINE)
@@ -302,9 +296,7 @@  _dl_start_final (void *arg, struct dl_start_final_info *info)
 # endif
 #endif
 
-#if HP_TIMING_AVAIL
   HP_TIMING_NOW (GL(dl_cpuclock_offset));
-#endif
 
   /* Initialize the stack end variable.  */
   __libc_stack_end = __builtin_frame_address (0);
@@ -317,7 +309,7 @@  _dl_start_final (void *arg, struct dl_start_final_info *info)
 
 #ifndef HP_TIMING_NONAVAIL
   hp_timing_t rtld_total_time;
-  if (HP_TIMING_AVAIL)
+  if (HP_SMALL_TIMING_AVAIL)
     {
       hp_timing_t end_time;
 
@@ -359,7 +351,7 @@  _dl_start (void *arg)
 #define RESOLVE_MAP(sym, version, flags) (&bootstrap_map)
 #include "dynamic-link.h"
 
-  if (HP_TIMING_INLINE && HP_TIMING_AVAIL)
+  if (HP_TIMING_INLINE && HP_SMALL_TIMING_AVAIL)
 #ifdef DONT_USE_BOOTSTRAP_MAP
     HP_TIMING_NOW (start_time);
 #else
@@ -2589,7 +2581,7 @@  print_statistics (hp_timing_t *rtld_total_timep)
   char *wp;
 
   /* Total time rtld used.  */
-  if (HP_TIMING_AVAIL)
+  if (HP_SMALL_TIMING_AVAIL)
     {
       HP_TIMING_PRINT (buf, sizeof (buf), *rtld_total_timep);
       _dl_debug_printf ("\nruntime linker statistics:\n"
@@ -2657,7 +2649,7 @@  print_statistics (hp_timing_t *rtld_total_timep)
 
 #ifndef HP_TIMING_NONAVAIL
   /* Time spend while loading the object and the dependencies.  */
-  if (HP_TIMING_AVAIL)
+  if (HP_SMALL_TIMING_AVAIL)
     {
       char pbuf[30];
       HP_TIMING_PRINT (buf, sizeof (buf), load_time);
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 2acddaa..e01df84 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -319,7 +319,7 @@  struct rtld_global
   /* The object to be initialized first.  */
   EXTERN struct link_map *_dl_initfirst;
 
-#if HP_TIMING_AVAIL || HP_SMALL_TIMING_AVAIL
+#if HP_SMALL_TIMING_AVAIL
   /* Start time on CPU clock.  */
   EXTERN hp_timing_t _dl_cpuclock_offset;
 #endif