diff options
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 8 | ||||
-rw-r--r-- | bfd/elfnn-aarch64.c | 41 |
2 files changed, 49 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index fe2f5b1..a7603da 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +2019-05-24 Szabolcs Nagy <szabolcs.nagy@arm.com> + + * elfnn-aarch64.c (elfNN_aarch64_merge_symbol_attribute): New function. + (struct elf_aarch64_link_hash_table): Add variant_pcs member. + (elfNN_aarch64_allocate_dynrelocs): Update variant_pcs. + (elfNN_aarch64_size_dynamic_sections): Add DT_AARCH64_VARIANT_PCS. + (elf_backend_merge_symbol_attribute): Define. + 2019-05-24 Alan Modra <amodra@gmail.com> * po/SRC-POTFILES.in: Regenerate. diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index 9e28544..761e6b9 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -2681,6 +2681,9 @@ struct elf_aarch64_link_hash_table unsigned int top_index; asection **input_list; + /* JUMP_SLOT relocs for variant PCS symbols may be present. */ + int variant_pcs; + /* The offset into splt of the PLT entry for the TLS descriptor resolver. Special values are 0, if not necessary (or not found to be necessary yet), and -1 if needed but not determined @@ -2895,6 +2898,31 @@ elfNN_aarch64_copy_indirect_symbol (struct bfd_link_info *info, _bfd_elf_link_hash_copy_indirect (info, dir, ind); } +/* Merge non-visibility st_other attributes. */ + +static void +elfNN_aarch64_merge_symbol_attribute (struct elf_link_hash_entry *h, + const Elf_Internal_Sym *isym, + bfd_boolean definition ATTRIBUTE_UNUSED, + bfd_boolean dynamic ATTRIBUTE_UNUSED) +{ + unsigned int isym_sto = isym->st_other & ~ELF_ST_VISIBILITY (-1); + unsigned int h_sto = h->other & ~ELF_ST_VISIBILITY (-1); + + if (isym_sto == h_sto) + return; + + if (isym_sto & ~STO_AARCH64_VARIANT_PCS) + /* Not fatal, this callback cannot fail. */ + _bfd_error_handler (_("unknown attribute for symbol `%s': 0x%02x"), + h->root.root.string, isym_sto); + + /* Note: Ideally we would warn about any attribute mismatch, but + this api does not allow that without substantial changes. */ + if (isym_sto & STO_AARCH64_VARIANT_PCS) + h->other |= STO_AARCH64_VARIANT_PCS; +} + /* Destroy an AArch64 elf linker hash table. */ static void @@ -8571,6 +8599,12 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) updated. */ htab->root.srelplt->reloc_count++; + + /* Mark the DSO in case R_<CLS>_JUMP_SLOT relocs against + variant PCS symbols are present. */ + if (h->other & STO_AARCH64_VARIANT_PCS) + htab->variant_pcs = 1; + } else { @@ -9159,6 +9193,10 @@ elfNN_aarch64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, || !add_dynamic_entry (DT_JMPREL, 0)) return FALSE; + if (htab->variant_pcs + && !add_dynamic_entry (DT_AARCH64_VARIANT_PCS, 0)) + return FALSE; + if (htab->tlsdesc_plt && !(info->flags & DF_BIND_NOW) && (!add_dynamic_entry (DT_TLSDESC_PLT, 0) @@ -10083,6 +10121,9 @@ const struct elf_size_info elfNN_aarch64_size_info = #define elf_backend_copy_indirect_symbol \ elfNN_aarch64_copy_indirect_symbol +#define elf_backend_merge_symbol_attribute \ + elfNN_aarch64_merge_symbol_attribute + /* Create .dynbss, and .rela.bss sections in DYNOBJ, and set up shortcuts to them in our hash. */ #define elf_backend_create_dynamic_sections \ |