aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-ppc.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elf64-ppc.c')
-rw-r--r--bfd/elf64-ppc.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 193e00b..069bd75 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -2472,7 +2472,9 @@ ppc64_elf_get_synthetic_symtab (bfd *abfd,
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;
@@ -2507,7 +2509,8 @@ ppc64_elf_get_synthetic_symtab (bfd *abfd,
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;
@@ -5536,7 +5539,8 @@ opd_entry_value (asection *opd_sec,
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;
}
@@ -7361,7 +7365,9 @@ ppc64_elf_edit_opd (struct bfd_link_info *info)
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)
@@ -8922,6 +8928,7 @@ ppc64_elf_edit_toc (struct bfd_link_info *info)
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;