]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
0.134 items
authorRoland McGrath <roland@redhat.com>
Sat, 5 Apr 2008 00:40:51 +0000 (00:40 +0000)
committerRoland McGrath <roland@redhat.com>
Sat, 5 Apr 2008 00:40:51 +0000 (00:40 +0000)
NEWS
backends/ChangeLog
backends/alpha_init.c
backends/alpha_symbol.c
backends/sparc_symbol.c

diff --git a/NEWS b/NEWS
index 2c644dc86b77d36a47bb48d773dfd396a00c303d..ba4c3be7e1da4fc3d21d0d0ba59c5f3d58e2bf43 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,9 @@
+Version 0.134:
+
+elflint: backend improvements for sparc, alpha
+
+libdwfl, libelf: bug fixes
+
 Version 0.133:
 
 readelf, elflint, libebl: SHT_GNU_ATTRIBUTE section handling (readelf -A)
index c72c238417a83fa1ff9b93531781c43a56d9ba44..06e9041f82c8a48065f046fb2cb9326409951f8e 100644 (file)
@@ -1,3 +1,8 @@
+2008-04-04  Roland McGrath  <roland@redhat.com>
+
+       * alpha_symbol.c (alpha_check_special_section): New function.
+       * alpha_init.c (alpha_init): Initialize check_special_section hook.
+
 2008-03-31  Roland McGrath  <roland@redhat.com>
 
        * sparc_symbol.c (sparc_symbol_type_name): New function.
index 3c9e29d2b013f5fc7a51146392df1607ccf1193c..1ca99abc52e723414c94f4e58d2082246eea6d18 100644 (file)
@@ -55,6 +55,7 @@ alpha_init (elf, machine, eh, ehlen)
   HOOK (eh, reloc_simple_type);
   HOOK (eh, return_value_location);
   HOOK (eh, machine_section_flag_check);
+  HOOK (eh, check_special_section);
   HOOK (eh, register_info);
   HOOK (eh, core_note);
   HOOK (eh, auxv_info);
index dc3cce569dd5c255b6f717ddad13ba7e9b69874e..aa45c61ee576d975db8bba0f648b3004e24634a4 100644 (file)
@@ -1,5 +1,5 @@
 /* Alpha specific symbolic name handling.
-   Copyright (C) 2002, 2005, 2007 Red Hat, Inc.
+   Copyright (C) 2002,2005,2007,2008 Red Hat, Inc.
    This file is part of Red Hat elfutils.
    Written by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -77,3 +77,47 @@ alpha_machine_section_flag_check (GElf_Xword sh_flags)
 {
   return (sh_flags &~ (SHF_ALPHA_GPREL)) == 0;
 }
+
+bool
+alpha_check_special_section (Ebl *ebl,
+                            int ndx __attribute__ ((unused)),
+                            const GElf_Shdr *shdr,
+                            const char *sname __attribute__ ((unused)))
+{
+  if ((shdr->sh_flags
+       & (SHF_WRITE | SHF_EXECINSTR)) == (SHF_WRITE | SHF_EXECINSTR)
+      && shdr->sh_addr != 0)
+    {
+      /* This is ordinarily flagged, but is valid for an old-style PLT.
+
+        Look for the SHT_DYNAMIC section and the DT_PLTGOT tag in it.
+        Its d_ptr should match the .plt section's sh_addr.  */
+
+      Elf_Scn *scn = NULL;
+      while ((scn = elf_nextscn (ebl->elf, scn)) != NULL)
+       {
+         GElf_Shdr scn_shdr;
+         if (likely (gelf_getshdr (scn, &scn_shdr) != NULL)
+             && scn_shdr.sh_type == SHT_DYNAMIC
+             && scn_shdr.sh_entsize != 0)
+           {
+             GElf_Addr pltgot = 0;
+             Elf_Data *data = elf_getdata (scn, NULL);
+             if (data != NULL)
+               for (size_t i = 0; i < data->d_size / scn_shdr.sh_entsize; ++i)
+                 {
+                   GElf_Dyn dyn;
+                   if (unlikely (gelf_getdyn (data, i, &dyn) == NULL))
+                     break;
+                   if (dyn.d_tag == DT_PLTGOT)
+                     pltgot = dyn.d_un.d_ptr;
+                   else if (dyn.d_tag == DT_ALPHA_PLTRO && dyn.d_un.d_val != 0)
+                     return false; /* This PLT should not be writable.  */
+                 }
+             return pltgot == shdr->sh_addr;
+           }
+       }
+    }
+
+  return false;
+}
index 27de54c04cfe4b538e4dc159a86984a06822f606..7896e9f469f9ef48522e95750c117817bab2a204 100644 (file)
@@ -73,7 +73,6 @@ sparc_check_special_section (Ebl *ebl,
                             const GElf_Shdr *shdr,
                             const char *sname __attribute__ ((unused)))
 {
-  ebl=ebl;
   if ((shdr->sh_flags & (SHF_WRITE | SHF_EXECINSTR))
       == (SHF_WRITE | SHF_EXECINSTR))
     {