about summary refs log tree commit diff
path: root/elf/dl-profile.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-02-03 19:39:52 +0000
committerUlrich Drepper <drepper@redhat.com>2002-02-03 19:39:52 +0000
commit9710f75d4a4d57fa86f20e011c6dc6e66c590080 (patch)
tree371793321e7797f93456cf680abb268d8607e25c /elf/dl-profile.c
parent654a7a0c299f2f5beca8745a35efd4334f361140 (diff)
downloadglibc-9710f75d4a4d57fa86f20e011c6dc6e66c590080.tar.gz
glibc-9710f75d4a4d57fa86f20e011c6dc6e66c590080.tar.xz
glibc-9710f75d4a4d57fa86f20e011c6dc6e66c590080.zip
Update.
2002-02-03  Andreas Schwab  <schwab@suse.de>

	* sysdeps/posix/readv.c: Use ssize_t for bytes_read.
	* sysdeps/posix/writev.c: Use ssize_t for bytes_written.  Fix comment.

2002-02-03  Thorsten Kukuk  <kukuk@suse.de>

	* sysdeps/posix/writev.c: Check for ssize_t overflow, don't use
	alloca if the memory reqirements are too high.

2002-02-03  Ulrich Drepper  <drepper@redhat.com>

	* elf/dl-load.c (decompose_rpath): Avoid using strstr.
	* elf/dl-minimal.c (_strerror_r): Use _itoa instead of _itoa_word since
	the former is available anyway and speed isn't important here.
	* elf/dl-misc.c (_dl_debug_vdprintf): Likewise.
	* elf/dl-version.c (match_symbol): Likewise.
	(_dl_check_map_versions): Likewise.
	* elf/rtld.c (process_envvars): Likewise.
	(print_statistics): Likewise.
	* sysdeps/generic/dl-sysdep.c (_dl_show_auxv): Likewise.
	* elf/dl-minimal.c (_itoa): Always define it.  Make it work for all
	bases.  Add assert to catch uses of unimplemented features.
	(__strsep): Add assert to catch uses of unimplemented features.
	* elf/dl-object.c (_dl_new_object): Don't use rawmemchr.  Use strchr
	and avoid inline optimization.
	* elf/rtld.c (process_envvars): Likewise.
	* elf/dl-open.c: Don't include <stdio-common/_itoa.h>.
	* elf/dl-profile.c (_dl_start_profile): Help compiler to avoid ffs.
	* elf/rtld.c (dl_main): Avoid strsep inline optimization.

	* stdio-common/_itoa.h: Minor simplifications of the code.
	* stdio-common/_itoa.c: Likewise.

	* elf/dl-reloc.c (_dl_relocate_object): Use _dl_debug_printf
	instead of _dl_printf for debugging info output.

	* sysdeps/mips/atomicity.h (exchange_and_add): Use branch likely.
Diffstat (limited to 'elf/dl-profile.c')
-rw-r--r--elf/dl-profile.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/elf/dl-profile.c b/elf/dl-profile.c
index 83e849561a..19d1865c25 100644
--- a/elf/dl-profile.c
+++ b/elf/dl-profile.c
@@ -19,6 +19,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <assert.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <inttypes.h>
@@ -217,9 +218,23 @@ _dl_start_profile (struct link_map *map, const char *output_dir)
   kcountsize = textsize / HISTFRACTION;
   hashfraction = HASHFRACTION;
   if ((HASHFRACTION & (HASHFRACTION - 1)) == 0)
-    /* If HASHFRACTION is a power of two, mcount can use shifting
-       instead of integer division.  Precompute shift amount.  */
-    log_hashfraction = __ffs (hashfraction * sizeof (*froms)) - 1;
+    {
+      /* If HASHFRACTION is a power of two, mcount can use shifting
+	 instead of integer division.  Precompute shift amount.
+
+	 This is a constant but the compiler cannot compile the
+	 expression away since the __ffs implementation is not known
+	 to the compiler.  Help the compiler by precomputing the
+	 usual cases.  */
+      assert (hashfraction == 2);
+
+      if (sizeof (*froms) == 8)
+	log_hashfraction = 4;
+      else if (sizeof (*froms) == 16)
+	log_hashfraction = 5;
+      else
+	log_hashfraction = __ffs (hashfraction * sizeof (*froms)) - 1;
+    }
   else
     log_hashfraction = -1;
   tossize = textsize / HASHFRACTION;