+2010-01-04 Roland McGrath <roland@redhat.com>
+
+ * 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 <roland@redhat.com>
* readelf.c (print_string_section): Punt SHT_NOBITS like empty
/* 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 <drepper@redhat.com>, 1999.
{
struct section_argument *next;
const char *arg;
+ bool implicit;
};
/* Number of sections in the file. */
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;
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':
}
/* Fall through. */
case 'x':
- add_dump_section (arg);
+ add_dump_section (arg, false);
any_control_option = true;
break;
case 'N':
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;
}
}