if (num_bytes == 0 || section->sh_type == SHT_NOBITS)
{
- printf (_("\nSection '%s' has no data to dump.\n"),
+ printf (_("Section '%s' has no data to dump.\n"),
printable_section_name (section));
return NULL;
}
unsigned char * start;
bfd_boolean some_strings_shown;
- real_start = start = (unsigned char *) get_section_contents (section,
- file);
+ real_start = start = (unsigned char *) get_section_contents (section, file);
if (start == NULL)
- return FALSE;
+ /* PR 21820: Do not fail if the section was empty. */
+ return (section->sh_size == 0 || section->sh_type == SHT_NOBITS) ? TRUE : FALSE;
+
num_bytes = section->sh_size;
printf (_("\nString dump of section '%s':\n"), printable_section_name (section));
real_start = start = (unsigned char *) get_section_contents (section, file);
if (start == NULL)
- return FALSE;
+ /* PR 21820: Do not fail if the section was empty. */
+ return (section->sh_size == 0 || section->sh_type == SHT_NOBITS) ? TRUE : FALSE;
section_size = section->sh_size;