aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2010-01-19 13:51:29 +0000
committerAlan Modra <amodra@gmail.com>2010-01-19 13:51:29 +0000
commit2046a35d20ffeb5cfeb1df687925b1fbedb87dcf (patch)
tree3606c9a3651c1a9df6106376030134643302cc81 /binutils
parentecd12bc14d85421fcf992cda5af1d534cc8736e0 (diff)
downloadgdb-2046a35d20ffeb5cfeb1df687925b1fbedb87dcf.zip
gdb-2046a35d20ffeb5cfeb1df687925b1fbedb87dcf.tar.gz
gdb-2046a35d20ffeb5cfeb1df687925b1fbedb87dcf.tar.bz2
* readelf.c (process_file_header): Handle e_phnum extension.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/readelf.c10
2 files changed, 14 insertions, 1 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 03ae2ed..923cb24 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -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
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 122bd73..8c9edce 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -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))