[uClibc-cvs] uClibc/ldso/ldso/powerpc elfinterp.c,1.37,1.38

Erik Andersen andersen at uclibc.org
Sat Feb 14 11:54:06 UTC 2004


Update of /var/cvs/uClibc/ldso/ldso/powerpc
In directory nail:/home/andersen/CVS/uClibc/ldso/ldso/powerpc

Modified Files:
	elfinterp.c 
Log Message:
Give gcc branch prediction some hits on obviously unlikely branches


Index: elfinterp.c
===================================================================
RCS file: /var/cvs/uClibc/ldso/ldso/powerpc/elfinterp.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- elfinterp.c	14 Feb 2004 11:30:34 -0000	1.37
+++ elfinterp.c	14 Feb 2004 11:54:03 -0000	1.38
@@ -194,7 +194,7 @@
 	debug_sym(symtab,strtab,symtab_index);
 	debug_reloc(symtab,strtab,this_reloc);
 
-	if (ELF32_R_TYPE(this_reloc->r_info) != R_PPC_JMP_SLOT) {
+	if (unlikely(ELF32_R_TYPE(this_reloc->r_info) != R_PPC_JMP_SLOT)) {
 		_dl_dprintf(2, "%s: Incorrect relocation type in jump relocation\n", _dl_progname);
 		_dl_exit(1);
 	};
@@ -211,7 +211,7 @@
 	/* Get the address of the GOT entry */
 	finaladdr = (Elf32_Addr) _dl_find_hash(symname,
 			tpnt->symbol_scope, ELF_RTYPE_CLASS_PLT);
-	if (!finaladdr) {
+	if (unlikely(!finaladdr)) {
 		_dl_dprintf(2, "%s: can't resolve symbol '%s'\n", _dl_progname, symname);
 		_dl_exit(1);
 	};
@@ -351,7 +351,7 @@
 	case R_PPC_REL24:
 	{
 		Elf32_Sword delta = finaladdr - (Elf32_Word)reloc_addr;
-		if(delta<<6>>6 != delta){
+		if(unlikely(delta<<6>>6 != delta)) {
 			_dl_dprintf(2, "%s: symbol '%s' R_PPC_REL24 is out of range.\n\t"
 					"Compile shared libraries with -fPIC!\n",
 				    _dl_progname, symname);
@@ -472,7 +472,7 @@
 		if (symtab_index)
 		  _dl_dprintf(2, "symbol '%s': ", strtab + symtab[symtab_index].st_name);
 
-		if (res <0)
+		if (unlikely(res <0))
 		{
 		        int reloc_type = ELF32_R_TYPE(rpnt->r_info);
 #if defined (__SUPPORT_LD_DEBUG__)
@@ -482,7 +482,7 @@
 #endif
 			_dl_exit(-res);
 		}
-		else if (res >0)
+		if (unlikely(res >0))
 		{
 			_dl_dprintf(2, "can't resolve symbol\n");
 			return res;




More information about the uClibc-cvs mailing list