* readelf.c (process_file_header): Handle e_phnum extension.
authorAlan Modra <amodra@gmail.com>
Tue, 19 Jan 2010 13:51:29 +0000 (13:51 +0000)
committerAlan Modra <amodra@gmail.com>
Tue, 19 Jan 2010 13:51:29 +0000 (13:51 +0000)
binutils/ChangeLog
binutils/readelf.c

index 03ae2eda665d86641c31f24676e44200eb2b4165..923cb24acbf9ef082f6313040f8c09624005e890 100644 (file)
@@ -1,3 +1,8 @@
+2010-01-19  Daisuke Hatayama  <d.hatayama@jp.fujitsu.com>
+           Alan Modra <amodra@gmail.com>
+
+        * readelf.c (process_file_header): Handle e_phnum extension.
+
 2010-01-14  Tristan Gingold  <gingold@adacore.com>
 
        * dwarf.c (get_AT_name): Handle DW_AT_use_GNAT_descriptive_type
index 122bd7357dd8268728d1e44e346c972f8fb82f32..8c9edce232ef333ce6f629887d4453ff7d44e487 100644 (file)
@@ -3340,8 +3340,13 @@ process_file_header (void)
              (long) elf_header.e_ehsize);
       printf (_("  Size of program headers:           %ld (bytes)\n"),
              (long) elf_header.e_phentsize);
-      printf (_("  Number of program headers:         %ld\n"),
+      printf (_("  Number of program headers:         %ld"),
              (long) elf_header.e_phnum);
+      if (section_headers != NULL
+         && elf_header.e_phnum == PN_XNUM
+         && section_headers[0].sh_info != 0)
+       printf (_(" (%ld)"), (long) section_headers[0].sh_info);
+      putc ('\n', stdout);
       printf (_("  Size of section headers:           %ld (bytes)\n"),
              (long) elf_header.e_shentsize);
       printf (_("  Number of section headers:         %ld"),
@@ -3362,6 +3367,9 @@ process_file_header (void)
 
   if (section_headers != NULL)
     {
+      if (elf_header.e_phnum == PN_XNUM
+         && section_headers[0].sh_info != 0)
+       elf_header.e_phnum = section_headers[0].sh_info;
       if (elf_header.e_shnum == SHN_UNDEF)
        elf_header.e_shnum = section_headers[0].sh_size;
       if (elf_header.e_shstrndx == (SHN_XINDEX & 0xffff))