asection *dynamic, *glink = NULL, *relplt = NULL;
arelent *p;
- if (opd != NULL && !bfd_malloc_and_get_section (abfd, opd, &contents))
+ if (opd != NULL
+ && ((opd->flags & SEC_HAS_CONTENTS) == 0
+ || !bfd_malloc_and_get_section (abfd, opd, &contents)))
{
free_contents_and_exit_err:
count = -1;
size_t extdynsize;
void (*swap_dyn_in) (bfd *, const void *, Elf_Internal_Dyn *);
- if (!bfd_malloc_and_get_section (abfd, dynamic, &dynbuf))
+ if ((dynamic->flags & SEC_HAS_CONTENTS) == 0
+ || !bfd_malloc_and_get_section (abfd, dynamic, &dynbuf))
goto free_contents_and_exit_err;
extdynsize = get_elf_backend_data (abfd)->s->sizeof_dyn;
if (contents == NULL)
{
- if (!bfd_malloc_and_get_section (opd_bfd, opd_sec, &contents))
+ if ((opd_sec->flags & SEC_HAS_CONTENTS) == 0
+ || !bfd_malloc_and_get_section (opd_bfd, opd_sec, &contents))
return (bfd_vma) -1;
ppc64_elf_tdata (opd_bfd)->opd.contents = contents;
}
continue;
sec = bfd_get_section_by_name (ibfd, ".opd");
- if (sec == NULL || sec->size == 0)
+ if (sec == NULL
+ || sec->size == 0
+ || (sec->flags & SEC_HAS_CONTENTS) == 0)
continue;
if (sec->sec_info_type == SEC_INFO_TYPE_JUST_SYMS)
toc = bfd_get_section_by_name (ibfd, ".toc");
if (toc == NULL
|| toc->size == 0
+ || (toc->flags & SEC_HAS_CONTENTS) == 0
|| toc->sec_info_type == SEC_INFO_TYPE_JUST_SYMS
|| discarded_section (toc))
continue;