X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=bfd%2Felf32-hppa.c;h=1deebf4f038ee595757be714e2429331620300a2;hb=ffc2605c41d026cf5710704848b7c3b1cdbdcf49;hp=eab384b7ed7331a21e4be3dd86320fa81a0086b2;hpb=e81830c5c61a8665c098189d069cc68b0df113d3;p=binutils-gdb.git diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index eab384b7ed7..1deebf4f038 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -1,5 +1,5 @@ /* BFD back-end for HP PA-RISC ELF files. - Copyright (C) 1990-2016 Free Software Foundation, Inc. + Copyright (C) 1990-2017 Free Software Foundation, Inc. Original code by Center for Software Science @@ -1919,6 +1919,21 @@ elf32_hppa_adjust_dynamic_symbol (struct bfd_link_info *info, return _bfd_elf_adjust_dynamic_copy (info, eh, sec); } +/* Make an undefined weak symbol dynamic. */ + +static bfd_boolean +ensure_undef_weak_dynamic (struct bfd_link_info *info, + struct elf_link_hash_entry *eh) +{ + if (eh->dynindx == -1 + && !eh->forced_local + && eh->type != STT_PARISC_MILLI + && eh->root.type == bfd_link_hash_undefweak + && ELF_ST_VISIBILITY (eh->other) == STV_DEFAULT) + return bfd_elf_link_record_dynamic_symbol (info, eh); + return TRUE; +} + /* Allocate space in the .plt for entries that won't have relocations. ie. plabel entries. */ @@ -1942,15 +1957,8 @@ allocate_plt_static (struct elf_link_hash_entry *eh, void *inf) if (htab->etab.dynamic_sections_created && eh->plt.refcount > 0) { - /* Make sure this symbol is output as a dynamic symbol. - Undefined weak syms won't yet be marked as dynamic. */ - if (eh->dynindx == -1 - && !eh->forced_local - && eh->type != STT_PARISC_MILLI) - { - if (! bfd_elf_link_record_dynamic_symbol (info, eh)) - return FALSE; - } + if (!ensure_undef_weak_dynamic (info, eh)) + return FALSE; if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), eh)) { @@ -1968,6 +1976,8 @@ allocate_plt_static (struct elf_link_hash_entry *eh, void *inf) sec = htab->etab.splt; eh->plt.offset = sec->size; sec->size += PLT_ENTRY_SIZE; + if (bfd_link_pic (info)) + htab->etab.srelplt->size += sizeof (Elf32_External_Rela); } else { @@ -2024,15 +2034,8 @@ allocate_dynrelocs (struct elf_link_hash_entry *eh, void *inf) if (eh->got.refcount > 0) { - /* Make sure this symbol is output as a dynamic symbol. - Undefined weak syms won't yet be marked as dynamic. */ - if (eh->dynindx == -1 - && !eh->forced_local - && eh->type != STT_PARISC_MILLI) - { - if (! bfd_elf_link_record_dynamic_symbol (info, eh)) - return FALSE; - } + if (!ensure_undef_weak_dynamic (info, eh)) + return FALSE; sec = htab->etab.sgot; eh->got.offset = sec->size; @@ -2092,14 +2095,8 @@ allocate_dynrelocs (struct elf_link_hash_entry *eh, void *inf) if (ELF_ST_VISIBILITY (eh->other) != STV_DEFAULT) hh->dyn_relocs = NULL; - /* Make sure undefined weak symbols are output as a dynamic - symbol in PIEs. */ - else if (eh->dynindx == -1 - && !eh->forced_local) - { - if (! bfd_elf_link_record_dynamic_symbol (info, eh)) - return FALSE; - } + else if (!ensure_undef_weak_dynamic (info, eh)) + return FALSE; } } else @@ -2116,15 +2113,8 @@ allocate_dynrelocs (struct elf_link_hash_entry *eh, void *inf) && (eh->root.type == bfd_link_hash_undefweak || eh->root.type == bfd_link_hash_undefined)))) { - /* Make sure this symbol is output as a dynamic symbol. - Undefined weak syms won't yet be marked as dynamic. */ - if (eh->dynindx == -1 - && !eh->forced_local - && eh->type != STT_PARISC_MILLI) - { - if (! bfd_elf_link_record_dynamic_symbol (info, eh)) - return FALSE; - } + if (!ensure_undef_weak_dynamic (info, eh)) + return FALSE; /* If that succeeded, we know we'll be keeping all the relocs. */ @@ -4442,7 +4432,7 @@ elf32_hppa_finish_dynamic_symbol (bfd *output_bfd, + 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; @@ -4656,6 +4646,7 @@ elf32_hppa_elf_get_symbol_type (Elf_Internal_Sym *elf_sym, int type) #define elf_backend_want_dynrelro 1 #define elf_backend_rela_normal 1 #define elf_backend_dtrel_excludes_plt 1 +#define elf_backend_no_page_alias 1 #define TARGET_BIG_SYM hppa_elf32_vec #define TARGET_BIG_NAME "elf32-hppa"