about summary refs log tree commit diff
path: root/sysdeps/arm/dl-machine.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-08-24 08:53:35 +0000
committerUlrich Drepper <drepper@redhat.com>2001-08-24 08:53:35 +0000
commit1721af3f967b6bf2d51cb09854fe719d0fbd40ba (patch)
tree7b8b881d877864ab9596fc5bc5586586bdf6006b /sysdeps/arm/dl-machine.h
parentc65c9d8ba06fe2b9202a84b31895c7633574bc92 (diff)
downloadglibc-1721af3f967b6bf2d51cb09854fe719d0fbd40ba.tar.gz
glibc-1721af3f967b6bf2d51cb09854fe719d0fbd40ba.tar.xz
glibc-1721af3f967b6bf2d51cb09854fe719d0fbd40ba.zip
Update.
2001-08-24  Ulrich Drepper  <drepper@redhat.com>

	* elf/do-rel.h (elf_dynamic_do_rel): If not relocating lazily, don't
	call elf_machine_rel for the last DT_RELCOUNT relocations but instead
	elf_machine_rel_relative.
	* sysdeps/alpha/dl-machine.h: Define elf_machine_rel_relative.
	Minor optimizations.
	* sysdeps/arm/dl-machine.h: Likewise.
	* sysdeps/cris/dl-machine.h: Likewise.
	* sysdeps/hppa/dl-machine.h: Likewise.
	* sysdeps/i386/dl-machine.h: Likewise.
	* sysdeps/ia64/dl-machine.h: Likewise.
	* sysdeps/m68k/dl-machine.h: Likewise.
	* sysdeps/mips/dl-machine.h: Likewise.
	* sysdeps/powerpc/dl-machine.h: Likewise.
	* sysdeps/s390/s390-32/dl-machine.h: Likewise.
	* sysdeps/s390/s390-64/dl-machine.h: Likewise.
	* sysdeps/sh/dl-machine.h: Likewise.
	* sysdeps/sparc/sparc32/dl-machine.h: Likewise.
	* sysdeps/sparc/sparc64/dl-machine.h: Likewise.
Diffstat (limited to 'sysdeps/arm/dl-machine.h')
-rw-r--r--sysdeps/arm/dl-machine.h28
1 files changed, 21 insertions, 7 deletions
diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
index 24fe366784..7dfed999d0 100644
--- a/sysdeps/arm/dl-machine.h
+++ b/sysdeps/arm/dl-machine.h
@@ -412,21 +412,27 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
 		 const Elf32_Sym *sym, const struct r_found_version *version,
 		 Elf32_Addr *const reloc_addr)
 {
-  if (ELF32_R_TYPE (reloc->r_info) == R_ARM_RELATIVE)
+  const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
+
+  if (__builtin_expect (r_type == R_ARM_RELATIVE, 0))
     {
 #ifndef RTLD_BOOTSTRAP
       if (map != &_dl_rtld_map) /* Already done in rtld itself.  */
 #endif
 	*reloc_addr += map->l_addr;
     }
-  else if (ELF32_R_TYPE (reloc->r_info) != R_ARM_NONE)
+#ifndef RTLD_BOOTSTRAP
+  else if (__builtin_expect (r_type == R_ARM_NONE, 0))
+    return;
+#endif
+  else
     {
       const Elf32_Sym *const refsym = sym;
-      Elf32_Addr value = RESOLVE (&sym, version, ELF32_R_TYPE (reloc->r_info));
+      Elf32_Addr value = RESOLVE (&sym, version, reloc->r_type);
       if (sym)
 	value += sym->st_value;
 
-      switch (ELF32_R_TYPE (reloc->r_info))
+      switch (r_type)
 	{
 	case R_ARM_COPY:
 	  if (sym == NULL)
@@ -505,22 +511,30 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
 	  }
 	break;
 	default:
-	  _dl_reloc_bad_type (map, ELF32_R_TYPE (reloc->r_info), 0);
+	  _dl_reloc_bad_type (map, r_type, 0);
 	  break;
 	}
     }
 }
 
 static inline void
+elf_machine_rel_relative (Elf32_Addr l_addr, const Elf32_Rel *reloc,
+			  Elf32_Addr *const reloc_addr)
+{
+  *reloc_addr += l_addr;
+}
+
+static inline void
 elf_machine_lazy_rel (struct link_map *map,
 		      Elf32_Addr l_addr, const Elf32_Rel *reloc)
 {
   Elf32_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset);
+  const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
   /* Check for unexpected PLT reloc type.  */
-  if (ELF32_R_TYPE (reloc->r_info) == R_ARM_JUMP_SLOT)
+  if (__builtin_expect (r_type == R_ARM_JUMP_SLOT, 1))
     *reloc_addr += l_addr;
   else
-    _dl_reloc_bad_type (map, ELF32_R_TYPE (reloc->r_info), 1);
+    _dl_reloc_bad_type (map, r_type, 1);
 }
 
 #endif /* RESOLVE */