X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=bfd%2Felfxx-x86.c;h=acb2cc8528db8f69bd5168da42cd64bcdabd1905;hb=afc41ffb993a275d7f5460e8f5a4341729caab4f;hp=119929bb093854596314648d8ab2393b66726907;hpb=5af6f000d88622107e7382d337af2884fd211da2;p=binutils-gdb.git diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c index 119929bb093..acb2cc8528d 100644 --- a/bfd/elfxx-x86.c +++ b/bfd/elfxx-x86.c @@ -524,6 +524,24 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) { 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); @@ -1484,11 +1502,13 @@ elf_x86_size_or_finish_relative_reloc } 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 @@ -1940,9 +1960,9 @@ _bfd_elf_x86_valid_reloc_p (asection *input_section, 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; @@ -1963,7 +1983,9 @@ _bfd_elf_x86_valid_reloc_p (asection *input_section, 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; @@ -2388,7 +2410,6 @@ _bfd_x86_elf_finish_dynamic_sections (bfd *output_bfd, 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); @@ -2447,8 +2468,6 @@ _bfd_x86_elf_finish_dynamic_sections (bfd *output_bfd, 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; @@ -2467,28 +2486,6 @@ _bfd_x86_elf_finish_dynamic_sections (bfd *output_bfd, 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;