aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-s390.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elf32-s390.c')
-rw-r--r--bfd/elf32-s390.c104
1 files changed, 55 insertions, 49 deletions
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index 65c27e0..72ae02e 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -899,16 +899,15 @@ elf_s390_copy_indirect_symbol (bed, dir, ind)
if (ELIMINATE_COPY_RELOCS
&& ind->root.type != bfd_link_hash_indirect
- && dir->dynamic_adjusted)
- {
- /* If called to transfer flags for a weakdef during processing
- of elf_adjust_dynamic_symbol, don't copy non_got_ref.
- We clear it ourselves for ELIMINATE_COPY_RELOCS. */
- dir->ref_dynamic |= ind->ref_dynamic;
- dir->ref_regular |= ind->ref_regular;
- dir->ref_regular_nonweak |= ind->ref_regular_nonweak;
- dir->needs_plt |= ind->needs_plt;
- }
+ && (dir->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0)
+ /* If called to transfer flags for a weakdef during processing
+ of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF.
+ We clear it ourselves for ELIMINATE_COPY_RELOCS. */
+ dir->elf_link_hash_flags |=
+ (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC
+ | ELF_LINK_HASH_REF_REGULAR
+ | ELF_LINK_HASH_REF_REGULAR_NONWEAK
+ | ELF_LINK_HASH_NEEDS_PLT));
else
_bfd_elf_link_hash_copy_indirect (bed, dir, ind);
}
@@ -1069,7 +1068,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
creating a procedure linkage table entry. */
if (h != NULL)
{
- h->needs_plt = 1;
+ h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
h->plt.refcount += 1;
}
break;
@@ -1090,7 +1089,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
if (h != NULL)
{
((struct elf_s390_link_hash_entry *) h)->gotplt_refcount++;
- h->needs_plt = 1;
+ h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
h->plt.refcount += 1;
}
else
@@ -1199,7 +1198,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
sections have not yet been mapped to output sections.
Tentatively set the flag for now, and correct in
adjust_dynamic_symbol. */
- h->non_got_ref = 1;
+ h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
/* We may need a .plt entry if the function this reloc
refers to is in a shared lib. */
@@ -1236,13 +1235,15 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
|| (h != NULL
&& (! info->symbolic
|| h->root.type == bfd_link_hash_defweak
- || !h->def_regular))))
+ || (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0))))
|| (ELIMINATE_COPY_RELOCS
&& !info->shared
&& (sec->flags & SEC_ALLOC) != 0
&& h != NULL
&& (h->root.type == bfd_link_hash_defweak
- || !h->def_regular)))
+ || (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0)))
{
struct elf_s390_dyn_relocs *p;
struct elf_s390_dyn_relocs **head;
@@ -1579,12 +1580,12 @@ elf_s390_adjust_dynamic_symbol (info, h)
will fill in the contents of the procedure linkage table later
(although we could actually do it here). */
if (h->type == STT_FUNC
- || h->needs_plt)
+ || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
{
if (h->plt.refcount <= 0
|| (! info->shared
- && !h->def_dynamic
- && !h->ref_dynamic
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0
&& h->root.type != bfd_link_hash_undefweak
&& h->root.type != bfd_link_hash_undefined))
{
@@ -1594,7 +1595,7 @@ elf_s390_adjust_dynamic_symbol (info, h)
such a case, we don't actually need to build a procedure
linkage table, and we can just do a PC32 reloc instead. */
h->plt.offset = (bfd_vma) -1;
- h->needs_plt = 0;
+ h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h);
}
@@ -1611,14 +1612,16 @@ elf_s390_adjust_dynamic_symbol (info, h)
/* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */
- if (h->u.weakdef != NULL)
+ if (h->weakdef != NULL)
{
- BFD_ASSERT (h->u.weakdef->root.type == bfd_link_hash_defined
- || h->u.weakdef->root.type == bfd_link_hash_defweak);
- h->root.u.def.section = h->u.weakdef->root.u.def.section;
- h->root.u.def.value = h->u.weakdef->root.u.def.value;
+ BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined
+ || h->weakdef->root.type == bfd_link_hash_defweak);
+ h->root.u.def.section = h->weakdef->root.u.def.section;
+ h->root.u.def.value = h->weakdef->root.u.def.value;
if (ELIMINATE_COPY_RELOCS || info->nocopyreloc)
- h->non_got_ref = h->u.weakdef->non_got_ref;
+ h->elf_link_hash_flags
+ = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF)
+ | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF));
return TRUE;
}
@@ -1634,13 +1637,13 @@ elf_s390_adjust_dynamic_symbol (info, h)
/* If there are no references to this symbol that do not use the
GOT, we don't need to generate a copy reloc. */
- if (!h->non_got_ref)
+ if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0)
return TRUE;
/* If -z nocopyreloc was given, we won't generate them either. */
if (info->nocopyreloc)
{
- h->non_got_ref = 0;
+ h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
return TRUE;
}
@@ -1661,7 +1664,7 @@ elf_s390_adjust_dynamic_symbol (info, h)
we'll be keeping the dynamic relocs and avoiding the copy reloc. */
if (p == NULL)
{
- h->non_got_ref = 0;
+ h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
return TRUE;
}
}
@@ -1684,7 +1687,7 @@ elf_s390_adjust_dynamic_symbol (info, h)
if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
{
htab->srelbss->size += sizeof (Elf32_External_Rela);
- h->needs_copy = 1;
+ h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
}
/* We need to figure out the alignment required for this symbol. I
@@ -1745,7 +1748,7 @@ allocate_dynrelocs (h, inf)
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
- && !h->forced_local)
+ && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
{
if (! bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
@@ -1769,7 +1772,7 @@ allocate_dynrelocs (h, inf)
pointers compare as equal between the normal executable and
the shared library. */
if (! info->shared
- && !h->def_regular)
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
{
h->root.u.def.section = s;
h->root.u.def.value = h->plt.offset;
@@ -1788,14 +1791,14 @@ allocate_dynrelocs (h, inf)
else
{
h->plt.offset = (bfd_vma) -1;
- h->needs_plt = 0;
+ h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h);
}
}
else
{
h->plt.offset = (bfd_vma) -1;
- h->needs_plt = 0;
+ h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
elf_s390_adjust_gotplt((struct elf_s390_link_hash_entry *) h);
}
@@ -1828,7 +1831,7 @@ allocate_dynrelocs (h, inf)
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
- && !h->forced_local)
+ && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
{
if (! bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
@@ -1896,9 +1899,9 @@ allocate_dynrelocs (h, inf)
symbols which turn out to need copy relocs or are not
dynamic. */
- if (!h->non_got_ref
- && ((h->def_dynamic
- && !h->def_regular)
+ if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
+ && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
|| (htab->elf.dynamic_sections_created
&& (h->root.type == bfd_link_hash_undefweak
|| h->root.type == bfd_link_hash_undefined))))
@@ -1906,7 +1909,7 @@ allocate_dynrelocs (h, inf)
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
if (h->dynindx == -1
- && !h->forced_local)
+ && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
{
if (! bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
@@ -2369,8 +2372,8 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
|| (info->shared
&& (info->symbolic
|| h->dynindx == -1
- || h->forced_local)
- && h->def_regular)
+ || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
|| (ELF_ST_VISIBILITY (h->other)
&& h->root.type == bfd_link_hash_undefweak))
{
@@ -2550,9 +2553,11 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
&& !info->shared
&& h != NULL
&& h->dynindx != -1
- && !h->non_got_ref
- && ((h->def_dynamic
- && !h->def_regular)
+ && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
+ && (((h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+ && (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0)
|| h->root.type == bfd_link_hash_undefweak
|| h->root.type == bfd_link_hash_undefined)))
{
@@ -2588,7 +2593,8 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
|| r_type == R_390_PC32
|| !info->shared
|| !info->symbolic
- || !h->def_regular))
+ || (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0))
{
outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
outrel.r_addend = rel->r_addend;
@@ -2984,7 +2990,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
not process them. */
if (unresolved_reloc
&& !((input_section->flags & SEC_DEBUGGING) != 0
- && h->def_dynamic))
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
(*_bfd_error_handler)
(_("%B(%A+0x%lx): unresolvable relocation against symbol `%s'"),
input_bfd,
@@ -3188,7 +3194,7 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
loc = htab->srelplt->contents + plt_index * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
- if (!h->def_regular)
+ if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
{
/* Mark the symbol as undefined, rather than as defined in
the .plt section. Leave the value alone. This is a clue
@@ -3225,8 +3231,8 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
if (info->shared
&& (info->symbolic
|| h->dynindx == -1
- || h->forced_local)
- && h->def_regular)
+ || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
{
BFD_ASSERT((h->got.offset & 1) != 0);
rela.r_info = ELF32_R_INFO (0, R_390_RELATIVE);
@@ -3247,7 +3253,7 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
}
- if (h->needs_copy)
+ if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
{
Elf_Internal_Rela rela;
bfd_byte *loc;