if ((aflag & SEC_HAS_CONTENTS) == 0)
{
}
- else if (elf_section_data (sectp)->this_hdr.sh_size
- > bfd_get_file_size (abfd))
+ else if (bfd_section_size_insane (abfd, sectp))
{
- bfd_size_type size = elf_section_data (sectp)->this_hdr.sh_size;
- warning (_("Discarding section %s which has a section size (%s"
- ") larger than the file size [in module %s]"),
+ bfd_size_type size = sectp->size;
+ warning (_("Discarding section %s which has an invalid size (%s) "
+ "[in module %s]"),
bfd_section_name (sectp), phex_nz (size, sizeof (size)),
bfd_get_filename (abfd));
}