+2017-02-28 Alan Modra <amodra@gmail.com>
+
+ * elflink.c (_bfd_elf_create_dynamic_sections): Don't make
+ dynamic .data.rel.ro read-only.
+ * elf32-arm.c (elf32_arm_finish_dynamic_symbol): Compare section
+ rather than section flags when deciding where copy reloc goes.
+ * elf32-cris.c (elf_cris_finish_dynamic_symbol): Likewise.
+ * elf32-hppa.c (elf32_hppa_finish_dynamic_symbol): Likewise.
+ * elf32-i386.c (elf_i386_finish_dynamic_symbol): Likewise.
+ * elf32-metag.c (elf_metag_finish_dynamic_symbol): Likewise.
+ * elf32-microblaze.c (microblaze_elf_finish_dynamic_symbol): Likewise.
+ * elf32-nios2.c (nios2_elf32_finish_dynamic_symbol): Likewise.
+ * elf32-or1k.c (or1k_elf_finish_dynamic_symbol): Likewise.
+ * elf32-ppc.c (ppc_elf_finish_dynamic_symbol): Likewise.
+ * elf32-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
+ * elf32-tic6x.c (elf32_tic6x_finish_dynamic_symbol): Likewise.
+ * elf32-tilepro.c (tilepro_elf_finish_dynamic_symbol): Likewise.
+ * elf64-ppc.c (ppc64_elf_finish_dynamic_symbol): Likewise.
+ * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
+ * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.
+ * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Likewise.
+ * elfnn-riscv.c (riscv_elf_finish_dynamic_symbol): Likewise.
+ * elfxx-mips.c (_bfd_mips_vxworks_finish_dynamic_symbol): Likewise.
+ * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Likewise.
+ * elfxx-tilegx.c (tilegx_elf_finish_dynamic_symbol): Likewise.
+
2017-02-28 Maciej W. Rozycki <macro@imgtec.com>
* elfxx-mips.c (mips_elf_perform_relocation): Also handle the
+ h->root.u.def.section->output_section->vma
+ h->root.u.def.section->output_offset);
rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_COPY);
- if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
+ if (h->root.u.def.section == htab->root.sdynrelro)
s = htab->root.sreldynrelro;
else
s = htab->root.srelbss;
&& (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak));
- if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
+ if (h->root.u.def.section == htab->root.sdynrelro)
s = htab->root.sreldynrelro;
else
s = htab->root.srelbss;
+ eh->root.u.def.section->output_section->vma);
rela.r_addend = 0;
rela.r_info = ELF32_R_INFO (eh->dynindx, R_PARISC_COPY);
- if ((eh->root.u.def.section->flags & SEC_READONLY) != 0)
+ if (eh->root.u.def.section == htab->etab.sdynrelro)
sec = htab->etab.sreldynrelro;
else
sec = htab->etab.srelbss;
+ h->root.u.def.section->output_section->vma
+ h->root.u.def.section->output_offset);
rel.r_info = ELF32_R_INFO (h->dynindx, R_386_COPY);
- if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
+ if (h->root.u.def.section == htab->elf.sdynrelro)
s = htab->elf.sreldynrelro;
else
s = htab->elf.srelbss;
+ eh->root.u.def.section->output_section->vma);
rel.r_addend = 0;
rel.r_info = ELF32_R_INFO (eh->dynindx, R_METAG_COPY);
- if ((eh->root.u.def.section->flags & SEC_READONLY) != 0)
+ if (eh->root.u.def.section == htab->etab.sdynrelro)
s = htab->etab.sreldynrelro;
else
s = htab->etab.srelbss;
+ h->root.u.def.section->output_offset);
rela.r_info = ELF32_R_INFO (h->dynindx, R_MICROBLAZE_COPY);
rela.r_addend = 0;
- if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
+ if (h->root.u.def.section == htab->elf.sdynrelro)
s = htab->elf.sreldynrelro;
else
s = htab->elf.srelbss;
+ h->root.u.def.section->output_offset);
rela.r_info = ELF32_R_INFO (h->dynindx, R_NIOS2_COPY);
rela.r_addend = 0;
- if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
+ if (h->root.u.def.section == htab->root.sdynrelro)
s = htab->root.sreldynrelro;
else
s = htab->root.srelbss;
+ h->root.u.def.section->output_offset);
rela.r_info = ELF32_R_INFO (h->dynindx, R_OR1K_COPY);
rela.r_addend = 0;
- if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
+ if (h->root.u.def.section == htab->root.sdynrelro)
s = htab->root.sreldynrelro;
else
s = htab->root.srelbss;
if (ppc_elf_hash_entry (h)->has_sda_refs)
s = htab->relsbss;
- else if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
+ else if (h->root.u.def.section == htab->elf.sdynrelro)
s = htab->elf.sreldynrelro;
else
s = htab->elf.srelbss;
+ h->root.u.def.section->output_offset);
rela.r_info = ELF32_R_INFO (h->dynindx, R_390_COPY);
rela.r_addend = 0;
- if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
+ if (h->root.u.def.section == htab->elf.sdynrelro)
s = htab->elf.sreldynrelro;
else
s = htab->elf.srelbss;
+ h->root.u.def.section->output_offset);
rel.r_info = ELF32_R_INFO (h->dynindx, R_C6000_COPY);
rel.r_addend = 0;
- if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
+ if (h->root.u.def.section == htab->elf.sdynrelro)
s = htab->elf.sreldynrelro;
else
s = htab->elf.srelbss;
+ h->root.u.def.section->output_offset);
rela.r_info = ELF32_R_INFO (h->dynindx, R_TILEPRO_COPY);
rela.r_addend = 0;
- if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
+ if (h->root.u.def.section == htab->elf.sdynrelro)
s = htab->elf.sreldynrelro;
else
s = htab->elf.srelbss;
+ h->root.u.def.section->output_offset);
rela.r_info = ELF64_R_INFO (h->dynindx, R_PPC64_COPY);
rela.r_addend = 0;
- if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
+ if (h->root.u.def.section == htab->elf.sdynrelro)
srel = htab->elf.sreldynrelro;
else
srel = htab->elf.srelbss;
+ h->root.u.def.section->output_offset);
rela.r_info = ELF64_R_INFO (h->dynindx, R_390_COPY);
rela.r_addend = 0;
- if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
+ if (h->root.u.def.section == htab->elf.sdynrelro)
s = htab->elf.sreldynrelro;
else
s = htab->elf.srelbss;
+ h->root.u.def.section->output_offset);
rela.r_info = htab->r_info (h->dynindx, R_X86_64_COPY);
rela.r_addend = 0;
- if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
+ if (h->root.u.def.section == htab->elf.sdynrelro)
s = htab->elf.sreldynrelro;
else
s = htab->elf.srelbss;
initialize them at run time. The linker script puts the .dynbss
section into the .bss section of the final image. */
s = bfd_make_section_anyway_with_flags (abfd, ".dynbss",
- (SEC_ALLOC | SEC_LINKER_CREATED));
+ SEC_ALLOC | SEC_LINKER_CREATED);
if (s == NULL)
return FALSE;
htab->sdynbss = s;
if (bed->want_dynrelro)
{
/* Similarly, but for symbols that were originally in read-only
- sections. */
+ sections. This section doesn't really need to have contents,
+ but make it like other .data.rel.ro sections. */
s = bfd_make_section_anyway_with_flags (abfd, ".data.rel.ro",
- (SEC_ALLOC | SEC_READONLY
- | SEC_HAS_CONTENTS
- | SEC_LINKER_CREATED));
+ flags);
if (s == NULL)
return FALSE;
htab->sdynrelro = s;
+ h->root.u.def.section->output_offset);
rela.r_info = ELFNN_R_INFO (h->dynindx, AARCH64_R (COPY));
rela.r_addend = 0;
- if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
+ if (h->root.u.def.section == htab->root.sdynrelro)
s = htab->root.sreldynrelro;
else
s = htab->root.srelbss;
rela.r_offset = sec_addr (h->root.u.def.section) + h->root.u.def.value;
rela.r_info = ELFNN_R_INFO (h->dynindx, R_RISCV_COPY);
rela.r_addend = 0;
- if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
+ if (h->root.u.def.section == htab->elf.sdynrelro)
s = htab->elf.sreldynrelro;
else
s = htab->elf.srelbss;
+ h->root.u.def.value);
rel.r_info = ELF32_R_INFO (h->dynindx, R_MIPS_COPY);
rel.r_addend = 0;
- if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
+ if (h->root.u.def.section == htab->root.sdynrelro)
srel = htab->root.sreldynrelro;
else
srel = htab->root.srelbss;
+ h->root.u.def.section->output_offset);
rela.r_info = SPARC_ELF_R_INFO (htab, NULL, h->dynindx, R_SPARC_COPY);
rela.r_addend = 0;
- if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
+ if (h->root.u.def.section == htab->elf.sdynrelro)
s = htab->elf.sreldynrelro;
else
s = htab->elf.srelbss;
/* This symbols needs a copy reloc. Set it up. */
BFD_ASSERT (h->dynindx != -1);
- if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
+ if (h->root.u.def.section == htab->elf.sdynrelro)
s = htab->elf.sreldynrelro;
else
s = htab->elf.srelbss;