diff options
-rw-r--r-- | src/ChangeLog | 5 | ||||
-rw-r--r-- | src/readelf.c | 16 |
2 files changed, 12 insertions, 9 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 5cba1cb5..0c9858cd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-08-11 Roland McGrath <roland@redhat.com> + + * readelf.c (for_each_section_argument): Process all sections with + matching name, not just the first. + 2010-07-26 Roland McGrath <roland@redhat.com> * readelf.c (print_ops): Take new argument for CU version. diff --git a/src/readelf.c b/src/readelf.c index 1564e37f..48f07317 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -7758,6 +7758,7 @@ for_each_section_argument (Elf *elf, const struct section_argument *list, { /* Need to look up the section by name. */ scn = NULL; + bool found = false; while ((scn = elf_nextscn (elf, scn)) != NULL) { if (gelf_getshdr (scn, &shdr_mem) == NULL) @@ -7766,18 +7767,15 @@ for_each_section_argument (Elf *elf, const struct section_argument *list, if (name == NULL) continue; if (!strcmp (name, a->arg)) - break; + { + found = true; + (*dump) (scn, &shdr_mem, name); + } } - if (unlikely (scn == NULL)) - { - if (!a->implicit) - error (0, 0, gettext ("\nsection '%s' does not exist"), a->arg); - continue; - } + if (unlikely (!found) && !a->implicit) + error (0, 0, gettext ("\nsection '%s' does not exist"), a->arg); } - - (*dump) (scn, &shdr_mem, name); } } |