* readelf.c (get_dynamic_type): Handle DT_GNU_PRELINKED,
[deliverable/binutils-gdb.git] / binutils / readelf.c
index 4649b9b4d0743cc29ac24d4fa7eb2cb0481b58db..9c15d9f25ccf8c8f95455674e6b37c89043c5c80 100644 (file)
@@ -58,6 +58,7 @@
 #include "elf/d30v.h"
 #include "elf/dlx.h"
 #include "elf/fr30.h"
+#include "elf/frv.h"
 #include "elf/h8.h"
 #include "elf/hppa.h"
 #include "elf/i386.h"
@@ -66,6 +67,7 @@
 #include "elf/ia64.h"
 #include "elf/m32r.h"
 #include "elf/m68k.h"
+#include "elf/m68hc11.h"
 #include "elf/mcore.h"
 #include "elf/mips.h"
 #include "elf/mmix.h"
@@ -78,6 +80,7 @@
 #include "elf/sh.h"
 #include "elf/sparc.h"
 #include "elf/v850.h"
+#include "elf/vax.h"
 #include "elf/x86-64.h"
 #include "elf/xstormy16.h"
 
@@ -261,6 +264,7 @@ static int            process_corefile_note_segment  PARAMS ((FILE *, bfd_vma, bfd_vma))
 static int               process_corefile_note_segments PARAMS ((FILE *));
 static int               process_corefile_contents      PARAMS ((FILE *));
 static int               process_arch_specific          PARAMS ((FILE *));
+static int               process_gnu_liblist            PARAMS ((FILE *));
 
 typedef int Elf32_Word;
 
@@ -522,7 +526,7 @@ print_vma (vma, mode)
 
 /* Display a symbol on stdout.  If do_wide is not true then
    format the symbol to be at most WIDTH characters,
-   truhncating as necessary.  If WIDTH is negative then
+   truncating as necessary.  If WIDTH is negative then
    format the string to be exactly - WIDTH characters,
    truncating or padding as necessary.  */
 
@@ -633,6 +637,7 @@ guess_is_rela (e_machine)
     case EM_CYGNUS_MN10300:
     case EM_FR30:
     case EM_CYGNUS_FR30:
+    case EM_CYGNUS_FRV:
     case EM_SH:
     case EM_ALPHA:
     case EM_MCORE:
@@ -646,6 +651,7 @@ guess_is_rela (e_machine)
     case EM_S390_OLD:
     case EM_MMIX:
     case EM_XSTORMY16:
+    case EM_VAX:
       return TRUE;
 
     case EM_MMA:
@@ -665,7 +671,6 @@ guess_is_rela (e_machine)
     case EM_68HC05:
     case EM_SVX:
     case EM_ST19:
-    case EM_VAX:
     default:
       warn (_("Don't know about relocations on this machine architecture\n"));
       return FALSE;
@@ -973,6 +978,11 @@ dump_relocations (file, rel_offset, rel_size, symtab, nsyms, strtab, is_rela)
          rtype = elf_i386_reloc_type (type);
          break;
 
+        case EM_68HC11:
+        case EM_68HC12:
+          rtype = elf_m68hc11_reloc_type (type);
+          break;
+
        case EM_68K:
          rtype = elf_m68k_reloc_type (type);
          break;
@@ -1031,6 +1041,10 @@ dump_relocations (file, rel_offset, rel_size, symtab, nsyms, strtab, is_rela)
          rtype = elf_fr30_reloc_type (type);
          break;
 
+        case EM_CYGNUS_FRV:
+          rtype = elf_frv_reloc_type (type);
+          break;
+
        case EM_MCORE:
          rtype = elf_mcore_reloc_type (type);
          break;
@@ -1109,6 +1123,10 @@ dump_relocations (file, rel_offset, rel_size, symtab, nsyms, strtab, is_rela)
        case EM_XSTORMY16:
          rtype = elf_xstormy16_reloc_type (type);
          break;
+
+       case EM_VAX:
+         rtype = elf_vax_reloc_type (type);
+         break;
        }
 
       if (rtype == NULL)
@@ -1371,6 +1389,12 @@ get_dynamic_type (type)
     case DT_USED:      return "USED";
     case DT_FILTER:    return "FILTER";
 
+    case DT_GNU_PRELINKED: return "GNU_PRELINKED";
+    case DT_GNU_CONFLICT: return "GNU_CONFLICT";
+    case DT_GNU_CONFLICTSZ: return "GNU_CONFLICTSZ";
+    case DT_GNU_LIBLIST: return "GNU_LIBLIST";
+    case DT_GNU_LIBLISTSZ: return "GNU_LIBLISTSZ";
+
     default:
       if ((type >= DT_LOPROC) && (type <= DT_HIPROC))
        {
@@ -1508,6 +1532,7 @@ get_machine_name (e_machine)
     case EM_MN10200:           return "mn10200";
     case EM_CYGNUS_FR30:
     case EM_FR30:              return "Fujitsu FR30";
+    case EM_CYGNUS_FRV:                return "Fujitsu FR-V";
     case EM_PJ_OLD:
     case EM_PJ:                 return "picoJava";
     case EM_MMA:               return "Fujitsu Multimedia Accelerator";
@@ -1908,6 +1933,15 @@ get_machine_flags (e_flags, e_machine)
          if ((e_flags & EF_IA_64_ABSOLUTE))
            strcat (buf, ", absolute");
          break;
+
+       case EM_VAX:
+         if ((e_flags & EF_VAX_NONPIC))
+           strcat (buf, ", non-PIC");
+         if ((e_flags & EF_VAX_DFLOAT))
+           strcat (buf, ", D-Float");
+         if ((e_flags & EF_VAX_GFLOAT))
+           strcat (buf, ", G-Float");
+         break;
        }
     }
 
@@ -2167,6 +2201,7 @@ get_section_type_name (sh_type)
     case 0x6ffffffc:           return "VERDEF";
     case 0x7ffffffd:           return "AUXILIARY";
     case 0x7fffffff:           return "FILTER";
+    case SHT_GNU_LIBLIST:      return "GNU_LIBLIST";
 
     default:
       if ((sh_type >= SHT_LOPROC) && (sh_type <= SHT_HIPROC))
@@ -4728,6 +4763,8 @@ process_dynamic_segment (file)
        case DT_MOVESZ  :
        case DT_INIT_ARRAYSZ:
        case DT_FINI_ARRAYSZ:
+       case DT_GNU_CONFLICTSZ:
+       case DT_GNU_LIBLISTSZ:
          if (do_dynamic)
            {
              print_vma (entry->d_un.d_val, UNSIGNED);
@@ -4776,6 +4813,20 @@ process_dynamic_segment (file)
          /* The value of this entry is ignored.  */
          break;
 
+       case DT_GNU_PRELINKED:
+         if (do_dynamic)
+           {
+             struct tm * tmp;
+             time_t time = entry->d_un.d_val;
+
+             tmp = gmtime (&time);
+             printf ("%04u-%02u-%02uT%02u:%02u:%02u\n",
+                     tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
+                     tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
+
+           }
+         break;
+
        default:
          if ((entry->d_tag >= DT_VERSYM) && (entry->d_tag <= DT_VERNEEDNUM))
            version_info [DT_VERSIONTAGIDX (entry->d_tag)] =
@@ -9342,6 +9393,86 @@ process_mips_specific (file)
   return 1;
 }
 
+static int
+process_gnu_liblist (file)
+     FILE * file;
+{
+  Elf_Internal_Shdr * section, * string_sec;
+  Elf32_External_Lib * elib;
+  char * strtab;
+  size_t cnt;
+  unsigned i;
+
+  if (! do_arch)
+    return 0;
+
+  for (i = 0, section = section_headers;
+       i < elf_header.e_shnum;
+       i++, section ++)
+    {
+      switch (section->sh_type)
+       {
+       case SHT_GNU_LIBLIST:
+         elib = ((Elf32_External_Lib *)
+                get_data (NULL, file, section->sh_offset, section->sh_size,
+                          _("liblist")));
+
+         if (elib == NULL)
+           break;
+         string_sec = SECTION_HEADER (section->sh_link);
+
+         strtab = (char *) get_data (NULL, file, string_sec->sh_offset,
+                                     string_sec->sh_size,
+                                     _("liblist string table"));
+
+         if (strtab == NULL
+             || section->sh_entsize != sizeof (Elf32_External_Lib))
+           {
+             free (elib);
+             break;
+           }
+
+         printf (_("\nLibrary list section '%s' contains %lu entries:\n"),
+                 SECTION_NAME (section),
+                 (long) (section->sh_size / sizeof (Elf32_External_Lib)));
+
+         puts ("     Library              Time Stamp          Checksum   Version Flags");
+
+         for (cnt = 0; cnt < section->sh_size / sizeof (Elf32_External_Lib);
+              ++cnt)
+           {
+             Elf32_Lib liblist;
+             time_t time;
+             char timebuf[20];
+             struct tm * tmp;
+
+             liblist.l_name = BYTE_GET (elib[cnt].l_name);
+             time = BYTE_GET (elib[cnt].l_time_stamp);
+             liblist.l_checksum = BYTE_GET (elib[cnt].l_checksum);
+             liblist.l_version = BYTE_GET (elib[cnt].l_version);
+             liblist.l_flags = BYTE_GET (elib[cnt].l_flags);
+
+             tmp = gmtime (&time);
+             sprintf (timebuf, "%04u-%02u-%02uT%02u:%02u:%02u",
+                      tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
+                      tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
+
+             printf ("%3lu: ", (unsigned long) cnt);
+             if (do_wide)
+               printf ("%-20s", strtab + liblist.l_name);
+             else
+               printf ("%-20.20s", strtab + liblist.l_name);
+             printf (" %s %#010lx %-7ld %-7ld\n", timebuf, liblist.l_checksum,
+                     liblist.l_version, liblist.l_flags);
+           }
+
+         free (elib);
+       }
+    }
+
+  return 1;
+}
+
 static const char *
 get_note_type (e_type)
      unsigned e_type;
@@ -9789,6 +9920,8 @@ process_file (file_name)
 
   process_corefile_contents (file);
 
+  process_gnu_liblist (file);
+
   process_arch_specific (file);
 
   fclose (file);
This page took 0.033391 seconds and 4 git commands to generate.