about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@redhat.com>2010-01-18 07:24:09 -0800
committerPetr Baudis <pasky@ucw.cz>2010-05-12 01:28:15 +0200
commit72fe1ad1520b87137b11c315533594a4e350adea (patch)
tree8b8b482d02d51b57734f5544d1c95efb294d8fe0
parente73ad37f1571c67eaa0ea503ae91412f1d7abc6d (diff)
downloadglibc-72fe1ad1520b87137b11c315533594a4e350adea.tar.gz
glibc-72fe1ad1520b87137b11c315533594a4e350adea.tar.xz
glibc-72fe1ad1520b87137b11c315533594a4e350adea.zip
Use correct type when casting d_tag.
(cherry picked from commit db07e962b6ea963dbb345439f6ab9b0cf74d87c5)
-rw-r--r--ChangeLog3
-rw-r--r--elf/dynamic-link.h15
2 files changed, 13 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 6f616515ba..a45e8ee069 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2010-01-18  Andreas Schwab  <schwab@redhat.com>
 
+	* elf/dynamic-link.h (elf_get_dynamic_info): Use correct type when
+	casting d_tag.
+
 	* elf/dynamic-link.h (elf_get_dynamic_info): Ignore negative
 	dynamic entry types.
 
diff --git a/elf/dynamic-link.h b/elf/dynamic-link.h
index dff06556a7..6d7e14282f 100644
--- a/elf/dynamic-link.h
+++ b/elf/dynamic-link.h
@@ -103,6 +103,11 @@ elf_get_dynamic_info (struct link_map *l, ElfW(Dyn) *temp)
 {
   ElfW(Dyn) *dyn = l->l_ld;
   ElfW(Dyn) **info;
+#if __ELF_NATIVE_CLASS == 32
+  typedef Elf32_Word d_tag_utype;
+#elif __ELF_NATIVE_CLASS == 64
+  typedef Elf64_Xword d_tag_utype;
+#endif
 
 #ifndef RTLD_BOOTSTRAP
   if (dyn == NULL)
@@ -113,20 +118,20 @@ elf_get_dynamic_info (struct link_map *l, ElfW(Dyn) *temp)
 
   while (dyn->d_tag != DT_NULL)
     {
-      if ((Elf32_Word) dyn->d_tag < DT_NUM)
+      if ((d_tag_utype) dyn->d_tag < DT_NUM)
 	info[dyn->d_tag] = dyn;
       else if (dyn->d_tag >= DT_LOPROC &&
 	       dyn->d_tag < DT_LOPROC + DT_THISPROCNUM)
 	info[dyn->d_tag - DT_LOPROC + DT_NUM] = dyn;
-      else if ((Elf32_Word) DT_VERSIONTAGIDX (dyn->d_tag) < DT_VERSIONTAGNUM)
+      else if ((d_tag_utype) DT_VERSIONTAGIDX (dyn->d_tag) < DT_VERSIONTAGNUM)
 	info[VERSYMIDX (dyn->d_tag)] = dyn;
-      else if ((Elf32_Word) DT_EXTRATAGIDX (dyn->d_tag) < DT_EXTRANUM)
+      else if ((d_tag_utype) DT_EXTRATAGIDX (dyn->d_tag) < DT_EXTRANUM)
 	info[DT_EXTRATAGIDX (dyn->d_tag) + DT_NUM + DT_THISPROCNUM
 	     + DT_VERSIONTAGNUM] = dyn;
-      else if ((Elf32_Word) DT_VALTAGIDX (dyn->d_tag) < DT_VALNUM)
+      else if ((d_tag_utype) DT_VALTAGIDX (dyn->d_tag) < DT_VALNUM)
 	info[DT_VALTAGIDX (dyn->d_tag) + DT_NUM + DT_THISPROCNUM
 	     + DT_VERSIONTAGNUM + DT_EXTRANUM] = dyn;
-      else if ((Elf32_Word) DT_ADDRTAGIDX (dyn->d_tag) < DT_ADDRNUM)
+      else if ((d_tag_utype) DT_ADDRTAGIDX (dyn->d_tag) < DT_ADDRNUM)
 	info[DT_ADDRTAGIDX (dyn->d_tag) + DT_NUM + DT_THISPROCNUM
 	     + DT_VERSIONTAGNUM + DT_EXTRANUM + DT_VALNUM] = dyn;
       ++dyn;