This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] readelf.c: wrong branch prediction


I've been playing with the debugpred and noticed, that every time when
running the eu-readelf -r, e.g., src/readelf -r src/readelf, we get:

   readelf.c:1845: wrong=148, correct=0   <==== WARNING

If the prediction should be changed, here's a patch.

2011-05-15  Marek Polacek  <mpolacek@redhat.com>

        * readelf.c (handle_relocs_rela): Correct branch prediction.

--- elfutils/src/readelf.c.mp	2011-05-09 15:01:18.583423977 +0200
+++ elfutils/src/readelf.c	2011-05-15 12:44:50.170209204 +0200
@@ -1841,7 +1841,7 @@ handle_relocs_rela (Ebl *ebl, GElf_Ehdr 
 	    printf ("\
   %#0*" PRIx64 "  %-15s %#0*" PRIx64 "  %+6" PRId64 " %s\n",
 		    class == ELFCLASS32 ? 10 : 18, rel->r_offset,
-		    likely (ebl_reloc_type_check (ebl,
+		    unlikely (ebl_reloc_type_check (ebl,
 						  GELF_R_TYPE (rel->r_info)))
 		    /* Avoid the leading R_ which isn't carrying any
 		       information.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]