- filedata->dynamic_strings
- = (char *) get_data (NULL, filedata, section->sh_offset,
- 1, section->sh_size, _("dynamic strings"));
- filedata->dynamic_strings_length
- = filedata->dynamic_strings == NULL ? 0 : section->sh_size;
- }
- else if (section->sh_type == SHT_SYMTAB_SHNDX)
- {
- elf_section_list * entry = xmalloc (sizeof * entry);
-
- entry->hdr = section;
- entry->next = filedata->symtab_shndx_list;
- filedata->symtab_shndx_list = entry;
- }
- else if (section->sh_type == SHT_SYMTAB)
- CHECK_ENTSIZE (section, i, Sym);
- else if (section->sh_type == SHT_GROUP)
- CHECK_ENTSIZE_VALUES (section, i, GRP_ENTRY_SIZE, GRP_ENTRY_SIZE);
- else if (section->sh_type == SHT_REL)
- CHECK_ENTSIZE (section, i, Rel);
- else if (section->sh_type == SHT_RELA)
- CHECK_ENTSIZE (section, i, Rela);
- else if ((do_debugging || do_debug_info || do_debug_abbrevs
- || do_debug_lines || do_debug_pubnames || do_debug_pubtypes
- || do_debug_aranges || do_debug_frames || do_debug_macinfo
- || do_debug_str || do_debug_loc || do_debug_ranges
- || do_debug_addr || do_debug_cu_index || do_debug_links)
- && (const_strneq (name, ".debug_")
- || const_strneq (name, ".zdebug_")))
+ entry->hdr = section;
+ entry->next = filedata->symtab_shndx_list;
+ filedata->symtab_shndx_list = entry;
+ }
+ break;
+
+ case SHT_SYMTAB:
+ CHECK_ENTSIZE (section, i, Sym);
+ break;
+
+ case SHT_GROUP:
+ CHECK_ENTSIZE_VALUES (section, i, GRP_ENTRY_SIZE, GRP_ENTRY_SIZE);
+ break;
+
+ case SHT_REL:
+ CHECK_ENTSIZE (section, i, Rel);
+ if (do_checks && section->sh_size == 0)
+ warn (_("Section '%s': zero-sized relocation section\n"), name);
+ break;
+
+ case SHT_RELA:
+ CHECK_ENTSIZE (section, i, Rela);
+ if (do_checks && section->sh_size == 0)
+ warn (_("Section '%s': zero-sized relocation section\n"), name);
+ break;
+
+ case SHT_NOTE:
+ case SHT_PROGBITS:
+ /* Having a zero sized section is not illegal according to the
+ ELF standard, but it might be an indication that something
+ is wrong. So issue a warning if we are running in lint mode. */
+ if (do_checks && section->sh_size == 0)
+ warn (_("Section '%s': has a size of zero - is this intended ?\n"), name);
+ break;
+
+ default:
+ break;
+ }
+
+ if ((do_debugging || do_debug_info || do_debug_abbrevs
+ || do_debug_lines || do_debug_pubnames || do_debug_pubtypes
+ || do_debug_aranges || do_debug_frames || do_debug_macinfo
+ || do_debug_str || do_debug_loc || do_debug_ranges
+ || do_debug_addr || do_debug_cu_index || do_debug_links)
+ && (const_strneq (name, ".debug_")
+ || const_strneq (name, ".zdebug_")))