diff options
| author | Roland McGrath <[email protected]> | 2010-01-04 20:25:09 -0800 |
|---|---|---|
| committer | Roland McGrath <[email protected]> | 2010-01-04 20:25:09 -0800 |
| commit | e4061d064e300d2f94c2d528f4dff6e85290ba51 (patch) | |
| tree | 7faad6971bb0d8d1252364416b866b6d02b78a62 /src | |
| parent | 2cfe33f4212519586066558a9e18d8e2e0887567 (diff) | |
readelf: No complaints for missing named sections implicit in -a.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/readelf.c | 17 |
2 files changed, 17 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index c0e277a9..a5cafc17 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2010-01-04 Roland McGrath <[email protected]> + + * readelf.c (struct section_argument): Add bool member 'implicit'. + (parse_opt): Set it for -a cases, clear it for -x args. + (for_each_section_argument): Don't complain about a missing section by + name if it's implicit. + 2009-11-16 Roland McGrath <[email protected]> * readelf.c (print_string_section): Punt SHT_NOBITS like empty diff --git a/src/readelf.c b/src/readelf.c index 34565679..1b8dc6ea 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -1,5 +1,5 @@ /* Print information from ELF file in human-readable form. - Copyright (C) 1999-2008, 2009 Red Hat, Inc. + Copyright (C) 1999-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <[email protected]>, 1999. @@ -202,6 +202,7 @@ struct section_argument { struct section_argument *next; const char *arg; + bool implicit; }; /* Number of sections in the file. */ @@ -282,11 +283,12 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state __attribute__ ((unused))) { - void add_dump_section (const char *name) + void add_dump_section (const char *name, bool implicit) { struct section_argument *a = xmalloc (sizeof *a); a->arg = name; a->next = NULL; + a->implicit = implicit; struct section_argument ***tailp = key == 'x' ? &dump_data_sections_tail : &string_sections_tail; **tailp = a; @@ -308,9 +310,9 @@ parse_opt (int key, char *arg, print_arch = true; print_notes = true; print_debug_sections |= section_exception; - add_dump_section (".strtab"); - add_dump_section (".dynstr"); - add_dump_section (".comment"); + add_dump_section (".strtab", true); + add_dump_section (".dynstr", true); + add_dump_section (".comment", true); any_control_option = true; break; case 'A': @@ -408,7 +410,7 @@ parse_opt (int key, char *arg, } /* Fall through. */ case 'x': - add_dump_section (arg); + add_dump_section (arg, false); any_control_option = true; break; case 'N': @@ -7514,7 +7516,8 @@ for_each_section_argument (Elf *elf, const struct section_argument *list, if (unlikely (scn == NULL)) { - error (0, 0, gettext ("\nsection '%s' does not exist"), a->arg); + if (!a->implicit) + error (0, 0, gettext ("\nsection '%s' does not exist"), a->arg); continue; } } |
