{
asection *sreloc;
+ if (eh->def_protected
+ && elf_has_no_copy_on_protected (h->root.u.def.section->owner))
+ {
+ /* Disallow copy relocation against non-copyable protected
+ symbol. */
+ asection *s = p->sec->output_section;
+ if (s != NULL && (s->flags & SEC_READONLY) != 0)
+ {
+ info->callbacks->einfo
+ /* xgettext:c-format */
+ (_("%F%P: %pB: copy relocation against non-copyable "
+ "protected symbol `%s' in %pB\n"),
+ p->sec->owner, h->root.root.string,
+ h->root.u.def.section->owner);
+ return false;
+ }
+ }
+
sreloc = elf_section_data (p->sec)->sreloc;
BFD_ASSERT (sreloc != NULL);
}
else
{
- /* Allow undefined symbol only at the sizing phase. */
+ /* Allow undefined symbol only at the sizing phase.
+ Otherwise skip undefined symbol here. Undefined
+ symbol will be reported by relocate_section. */
if (outrel == NULL)
relocation = 0;
else
- abort ();
+ continue;
}
}
else
irel = *rel;
/* Only allow relocations against absolute symbol, which can be
- resolved as absolute value + addend. GOTPCREL relocations
- are allowed since absolute value + addend is stored in the
- GOT slot. */
+ resolved as absolute value + addend. GOTPCREL and GOT32
+ relocations are allowed since absolute value + addend is
+ stored in the GOT slot. */
if (bed->target_id == X86_64_ELF_DATA)
{
r_type &= ~R_X86_64_converted_reloc_bit;
else
valid_p = (r_type == R_386_32
|| r_type == R_386_16
- || r_type == R_386_8);
+ || r_type == R_386_8
+ || r_type == R_386_GOT32
+ || r_type == R_386_GOT32X);
if (valid_p)
*no_dynreloc_p = true;
asection *sdyn;
bfd_byte *dyncon, *dynconend;
bfd_size_type sizeof_dyn;
- bfd_size_type dt_relr_bitmap_count;
bed = get_elf_backend_data (output_bfd);
htab = elf_x86_hash_table (info, bed->target_id);
if (sdyn == NULL || htab->elf.sgot == NULL)
abort ();
- dt_relr_bitmap_count = htab->dt_relr_bitmap.count;
-
sizeof_dyn = bed->s->sizeof_dyn;
dyncon = sdyn->contents;
dynconend = sdyn->contents + sdyn->size;
break;
continue;
- case DT_NULL:
- if (dt_relr_bitmap_count != 0)
- {
- /* Convert 3 spare dynamic tags to DT_RELR, DT_RELRSZ and
- DT_RELRENT for compact relative relocation. */
- s = htab->elf.srelrdyn;
- dyn.d_tag = DT_RELR;
- dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
- (*bed->s->swap_dyn_out) (output_bfd, &dyn, dyncon);
- dyncon += sizeof_dyn;
- dyn.d_tag = DT_RELRSZ;
- dyn.d_un.d_val = s->size;
- (*bed->s->swap_dyn_out) (output_bfd, &dyn, dyncon);
- dyncon += sizeof_dyn;
- dyn.d_tag = DT_RELRENT;
- dyn.d_un.d_val = ABI_64_P (output_bfd) ? 8 : 4;
- elf_section_data (s->output_section)->this_hdr.sh_entsize
- = dyn.d_un.d_val;
- dt_relr_bitmap_count = 0;
- }
- break;
-
case DT_PLTGOT:
s = htab->elf.sgotplt;
dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;