diff options
Diffstat (limited to 'bfd/elf64-s390.c')
-rw-r--r-- | bfd/elf64-s390.c | 90 |
1 files changed, 46 insertions, 44 deletions
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index c9db954..2e505f3 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -775,11 +775,11 @@ elf_s390_create_dynamic_sections (bfd *dynobj, htab->elf.splt = bfd_get_linker_section (dynobj, ".plt"); htab->elf.srelplt = bfd_get_linker_section (dynobj, ".rela.plt"); htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss"); - if (!info->shared) + if (!bfd_link_pic (info)) htab->srelbss = bfd_get_linker_section (dynobj, ".rela.bss"); if (!htab->elf.splt || !htab->elf.srelplt || !htab->sdynbss - || (!info->shared && !htab->srelbss)) + || (!bfd_link_pic (info) && !htab->srelbss)) abort (); return TRUE; @@ -856,7 +856,7 @@ elf_s390_tls_transition (struct bfd_link_info *info, int r_type, int is_local) { - if (info->shared) + if (bfd_link_pic (info)) return r_type; switch (r_type) @@ -896,7 +896,7 @@ elf_s390_check_relocs (bfd *abfd, bfd_signed_vma *local_got_refcounts; int tls_type, old_tls_type; - if (info->relocatable) + if (bfd_link_relocatable (info)) return TRUE; BFD_ASSERT (is_s390_elf (abfd)); @@ -1109,7 +1109,7 @@ elf_s390_check_relocs (bfd *abfd, case R_390_TLS_GOTIE20: case R_390_TLS_GOTIE64: case R_390_TLS_IEENT: - if (info->shared) + if (bfd_link_pic (info)) info->flags |= DF_STATIC_TLS; /* Fall through */ @@ -1186,10 +1186,10 @@ elf_s390_check_relocs (bfd *abfd, /* For static linking and executables this reloc will be calculated at linktime otherwise a TLS_TPOFF runtime reloc will be generated. */ - if (r_type == R_390_TLS_LE64 && info->pie) + if (r_type == R_390_TLS_LE64 && bfd_link_pie (info)) break; - if (!info->shared) + if (!bfd_link_pic (info)) break; info->flags |= DF_STATIC_TLS; /* Fall through */ @@ -1215,7 +1215,7 @@ elf_s390_check_relocs (bfd *abfd, adjust_dynamic_symbol. */ h->non_got_ref = 1; - if (!info->shared) + if (!bfd_link_pic (info)) { /* We may need a .plt entry if the function this reloc refers to is in a shared lib. */ @@ -1244,7 +1244,7 @@ elf_s390_check_relocs (bfd *abfd, may need to keep relocations for symbols satisfied by a dynamic library if we manage to avoid copy relocs for the symbol. */ - if ((info->shared + if ((bfd_link_pic (info) && (sec->flags & SEC_ALLOC) != 0 && ((ELF64_R_TYPE (rel->r_info) != R_390_PC16 && ELF64_R_TYPE (rel->r_info) != R_390_PC12DBL @@ -1258,7 +1258,7 @@ elf_s390_check_relocs (bfd *abfd, || h->root.type == bfd_link_hash_defweak || !h->def_regular)))) || (ELIMINATE_COPY_RELOCS - && !info->shared + && !bfd_link_pic (info) && (sec->flags & SEC_ALLOC) != 0 && h != NULL && (h->root.type == bfd_link_hash_defweak @@ -1395,7 +1395,7 @@ elf_s390_gc_sweep_hook (bfd *abfd, bfd_signed_vma *local_got_refcounts; const Elf_Internal_Rela *rel, *relend; - if (info->relocatable) + if (bfd_link_relocatable (info)) return TRUE; htab = elf_s390_hash_table (info); @@ -1505,7 +1505,7 @@ elf_s390_gc_sweep_hook (bfd *abfd, case R_390_PC32: case R_390_PC32DBL: case R_390_PC64: - if (info->shared) + if (bfd_link_pic (info)) break; /* Fall through */ @@ -1645,7 +1645,7 @@ elf_s390_adjust_dynamic_symbol (struct bfd_link_info *info, only references to the symbol are via the global offset table. For such cases we need not do anything here; the relocations will be handled correctly by relocate_section. */ - if (info->shared) + if (bfd_link_pic (info)) return TRUE; /* If there are no references to this symbol that do not use the @@ -1747,7 +1747,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, return FALSE; } - if (info->shared + if (bfd_link_pic (info) || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h)) { asection *s = htab->elf.splt; @@ -1764,7 +1764,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, location in the .plt. This is required to make function pointers compare as equal between the normal executable and the shared library. */ - if (! info->shared + if (! bfd_link_pic (info) && !h->def_regular) { h->root.u.def.section = s; @@ -1800,7 +1800,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, to R_390_TLS_LE64 requiring no TLS entry. For GOTIE12 and IEENT we can save the dynamic TLS relocation. */ if (h->got.refcount > 0 - && !info->shared + && !bfd_link_pic (info) && h->dynindx == -1 && elf_s390_hash_entry(h)->tls_type >= GOT_TLS_IE) { @@ -1846,7 +1846,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, htab->elf.srelgot->size += 2 * sizeof (Elf64_External_Rela); else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT || h->root.type != bfd_link_hash_undefweak) - && (info->shared + && (bfd_link_pic (info) || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))) htab->elf.srelgot->size += sizeof (Elf64_External_Rela); } @@ -1862,7 +1862,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, space for pc-relative relocs that have become local due to symbol visibility changes. */ - if (info->shared) + if (bfd_link_pic (info)) { if (SYMBOL_CALLS_LOCAL (info, h)) { @@ -1989,7 +1989,7 @@ elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, if (htab->elf.dynamic_sections_created) { /* Set the contents of the .interp section to the interpreter. */ - if (info->executable) + if (bfd_link_executable (info)) { s = bfd_get_linker_section (dynobj, ".interp"); if (s == NULL) @@ -2057,7 +2057,7 @@ elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, s->size += GOT_ENTRY_SIZE; if (*local_tls_type == GOT_TLS_GD) s->size += GOT_ENTRY_SIZE; - if (info->shared) + if (bfd_link_pic (info)) srela->size += sizeof (Elf64_External_Rela); } else @@ -2167,7 +2167,7 @@ elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, #define add_dynamic_entry(TAG, VAL) \ _bfd_elf_add_dynamic_entry (info, TAG, VAL) - if (info->executable) + if (bfd_link_executable (info)) { if (!add_dynamic_entry (DT_DEBUG, 0)) return FALSE; @@ -2391,7 +2391,7 @@ elf_s390_relocate_section (bfd *output_bfd, RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, rel, 1, relend, howto, 0, contents); - if (info->relocatable) + if (bfd_link_relocatable (info)) continue; switch (r_type) @@ -2476,8 +2476,10 @@ elf_s390_relocate_section (bfd *output_bfd, finish_dynamic_symbol. */ } } - else if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h) - || (info->shared + else if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, + bfd_link_pic (info), + h) + || (bfd_link_pic (info) && SYMBOL_REFERENCES_LOCAL (info, h)) || (ELF_ST_VISIBILITY (h->other) && h->root.type == bfd_link_hash_undefweak)) @@ -2504,7 +2506,7 @@ elf_s390_relocate_section (bfd *output_bfd, } if ((h->def_regular - && info->shared + && bfd_link_pic (info) && SYMBOL_REFERENCES_LOCAL (info, h)) /* lgrl rx,sym@GOTENT -> larl rx, sym */ && ((r_type == R_390_GOTENT @@ -2554,7 +2556,7 @@ elf_s390_relocate_section (bfd *output_bfd, bfd_put_64 (output_bfd, relocation, htab->elf.sgot->contents + off); - if (info->shared) + if (bfd_link_pic (info)) { asection *s; Elf_Internal_Rela outrel; @@ -2692,7 +2694,7 @@ elf_s390_relocate_section (bfd *output_bfd, && s390_is_ifunc_symbol_p (h) && h->def_regular) { - if (!info->shared || !h->non_got_ref) + if (!bfd_link_pic (info) || !h->non_got_ref) { /* For a non-shared object STT_GNU_IFUNC symbol must go through PLT. */ @@ -2723,7 +2725,7 @@ elf_s390_relocate_section (bfd *output_bfd, if (h->dynindx == -1 || h->forced_local - || info->executable) + || bfd_link_executable (info)) { /* This symbol is resolved locally. */ outrel.r_info = ELF64_R_INFO (0, R_390_IRELATIVE); @@ -2752,7 +2754,7 @@ elf_s390_relocate_section (bfd *output_bfd, if ((input_section->flags & SEC_ALLOC) == 0) break; - if ((info->shared + if ((bfd_link_pic (info) && (h == NULL || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT || h->root.type != bfd_link_hash_undefweak) @@ -2765,7 +2767,7 @@ elf_s390_relocate_section (bfd *output_bfd, && r_type != R_390_PC64) || !SYMBOL_CALLS_LOCAL (info, h))) || (ELIMINATE_COPY_RELOCS - && !info->shared + && !bfd_link_pic (info) && h != NULL && h->dynindx != -1 && !h->non_got_ref @@ -2807,7 +2809,7 @@ elf_s390_relocate_section (bfd *output_bfd, || r_type == R_390_PC32 || r_type == R_390_PC32DBL || r_type == R_390_PC64 - || !info->shared + || !bfd_link_pic (info) || !SYMBOLIC_BIND (info, h) || !h->def_regular)) { @@ -2879,7 +2881,7 @@ elf_s390_relocate_section (bfd *output_bfd, /* Relocations for tls literal pool entries. */ case R_390_TLS_IE64: - if (info->shared) + if (bfd_link_pic (info)) { Elf_Internal_Rela outrel; asection *sreloc; @@ -2907,7 +2909,7 @@ elf_s390_relocate_section (bfd *output_bfd, else if (h != NULL) { tls_type = elf_s390_hash_entry(h)->tls_type; - if (!info->shared && h->dynindx == -1 && tls_type >= GOT_TLS_IE) + if (!bfd_link_pic (info) && h->dynindx == -1 && tls_type >= GOT_TLS_IE) r_type = R_390_TLS_LE64; } if (r_type == R_390_TLS_GD64 && tls_type >= GOT_TLS_IE) @@ -3018,14 +3020,14 @@ elf_s390_relocate_section (bfd *output_bfd, if (local_got_offsets == NULL) abort(); off = local_got_offsets[r_symndx]; - if (info->shared) + if (bfd_link_pic (info)) goto emit_tls_relocs; } else { off = h->got.offset; tls_type = elf_s390_hash_entry(h)->tls_type; - if (info->shared || h->dynindx != -1 || tls_type < GOT_TLS_IE) + if (bfd_link_pic (info) || h->dynindx != -1 || tls_type < GOT_TLS_IE) goto emit_tls_relocs; } @@ -3042,7 +3044,7 @@ elf_s390_relocate_section (bfd *output_bfd, break; case R_390_TLS_LDM64: - if (! info->shared) + if (! bfd_link_pic (info)) /* The literal pool entry this relocation refers to gets ignored by the optimized code of the local exec model. Do nothing and the value will turn out zero. */ @@ -3080,7 +3082,7 @@ elf_s390_relocate_section (bfd *output_bfd, break; case R_390_TLS_LE64: - if (info->shared && !info->pie) + if (bfd_link_pic (info) && !bfd_link_pie (info)) { /* Linking a shared library with non-fpic code requires a R_390_TLS_TPOFF relocation. */ @@ -3117,7 +3119,7 @@ elf_s390_relocate_section (bfd *output_bfd, continue; case R_390_TLS_LDO64: - if (info->shared || (input_section->flags & SEC_DEBUGGING)) + if (bfd_link_pic (info) || (input_section->flags & SEC_DEBUGGING)) relocation -= dtpoff_base (info); else /* When converting LDO to LE, we must negate. */ @@ -3139,7 +3141,7 @@ elf_s390_relocate_section (bfd *output_bfd, if (r_type == R_390_TLS_LOAD) { - if (!info->shared && (h == NULL || h->dynindx == -1)) + if (!bfd_link_pic (info) && (h == NULL || h->dynindx == -1)) { /* IE->LE transition. Four valid cases: lg %rx,(0,%ry) -> sllg %rx,%ry,0 @@ -3181,7 +3183,7 @@ elf_s390_relocate_section (bfd *output_bfd, insn1 = bfd_get_16 (input_bfd, contents + rel->r_offset + 4); if ((insn0 & 0xffff0000) != 0xc0e50000) invalid_tls_insn (input_bfd, input_section, rel); - if (!info->shared && (h == NULL || h->dynindx == -1)) + if (!bfd_link_pic (info) && (h == NULL || h->dynindx == -1)) { /* GD->LE transition. brasl %r14,__tls_get_addr@plt -> brcl 0,. */ @@ -3200,7 +3202,7 @@ elf_s390_relocate_section (bfd *output_bfd, } else if (r_type == R_390_TLS_LDCALL) { - if (!info->shared) + if (!bfd_link_pic (info)) { unsigned int insn0, insn1; @@ -3370,7 +3372,7 @@ elf_s390_finish_ifunc_symbol (bfd *output_bfd, if (!h || h->dynindx == -1 - || ((info->executable + || ((bfd_link_executable (info) || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) && h->def_regular)) { @@ -3512,7 +3514,7 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd, if (h->def_regular && s390_is_ifunc_symbol_p (h)) { - if (info->shared) + if (bfd_link_pic (info)) { /* An explicit GOT slot usage needs GLOB_DAT. If the symbol references local the implicit got.iplt slot @@ -3532,7 +3534,7 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd, return TRUE; } } - else if (info->shared + else if (bfd_link_pic (info) && SYMBOL_REFERENCES_LOCAL (info, h)) { /* If this is a static link, or it is a -Bsymbolic link and |