summaryrefslogtreecommitdiff
path: root/bfd/elf32-i386.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elf32-i386.c')
-rw-r--r--bfd/elf32-i386.c96
1 files changed, 45 insertions, 51 deletions
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index f689bee56be..5763acc00e9 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -784,16 +784,17 @@ elf_i386_copy_indirect_symbol (const struct elf_backend_data *bed,
if (ELIMINATE_COPY_RELOCS
&& ind->root.type != bfd_link_hash_indirect
- && (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
- | ELF_LINK_POINTER_EQUALITY_NEEDED));
+ && 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->pointer_equality_needed |= ind->pointer_equality_needed;
+ }
else
_bfd_elf_link_hash_copy_indirect (bed, dir, ind);
}
@@ -893,7 +894,7 @@ elf_i386_check_relocs (bfd *abfd,
if (h == NULL)
continue;
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+ h->needs_plt = 1;
h->plt.refcount += 1;
break;
@@ -1018,13 +1019,13 @@ elf_i386_check_relocs (bfd *abfd,
sections have not yet been mapped to output sections.
Tentatively set the flag for now, and correct in
adjust_dynamic_symbol. */
- h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
+ h->non_got_ref = 1;
/* We may need a .plt entry if the function this reloc
refers to is in a shared lib. */
h->plt.refcount += 1;
if (r_type != R_386_PC32)
- h->elf_link_hash_flags |= ELF_LINK_POINTER_EQUALITY_NEEDED;
+ h->pointer_equality_needed = 1;
}
/* If we are creating a shared library, and this is a reloc
@@ -1054,15 +1055,13 @@ elf_i386_check_relocs (bfd *abfd,
|| (h != NULL
&& (! info->symbolic
|| h->root.type == bfd_link_hash_defweak
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+ || !h->def_regular))))
|| (ELIMINATE_COPY_RELOCS
&& !info->shared
&& (sec->flags & SEC_ALLOC) != 0
&& h != NULL
&& (h->root.type == bfd_link_hash_defweak
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)))
+ || !h->def_regular)))
{
struct elf_i386_dyn_relocs *p;
struct elf_i386_dyn_relocs **head;
@@ -1326,7 +1325,7 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info,
will fill in the contents of the procedure linkage table later,
when we know the address of the .got section. */
if (h->type == STT_FUNC
- || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
+ || h->needs_plt)
{
if (h->plt.refcount <= 0
|| SYMBOL_CALLS_LOCAL (info, h)
@@ -1339,7 +1338,7 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info,
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->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ h->needs_plt = 0;
}
return TRUE;
@@ -1355,16 +1354,14 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info,
/* 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->weakdef != NULL)
+ if (h->u.weakdef != NULL)
{
- 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;
+ 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;
if (ELIMINATE_COPY_RELOCS || info->nocopyreloc)
- 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));
+ h->non_got_ref = h->u.weakdef->non_got_ref;
return TRUE;
}
@@ -1380,13 +1377,13 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info,
/* 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->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0)
+ if (!h->non_got_ref)
return TRUE;
/* If -z nocopyreloc was given, we won't generate them either. */
if (info->nocopyreloc)
{
- h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
+ h->non_got_ref = 0;
return TRUE;
}
@@ -1407,7 +1404,7 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info,
we'll be keeping the dynamic relocs and avoiding the copy reloc. */
if (p == NULL)
{
- h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
+ h->non_got_ref = 0;
return TRUE;
}
}
@@ -1430,7 +1427,7 @@ elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info,
if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
{
htab->srelbss->size += sizeof (Elf32_External_Rel);
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
+ h->needs_copy = 1;
}
/* We need to figure out the alignment required for this symbol. I
@@ -1487,7 +1484,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *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->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ && !h->forced_local)
{
if (! bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
@@ -1511,7 +1508,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
pointers compare as equal between the normal executable and
the shared library. */
if (! info->shared
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ && !h->def_regular)
{
h->root.u.def.section = s;
h->root.u.def.value = h->plt.offset;
@@ -1530,13 +1527,13 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
else
{
h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ h->needs_plt = 0;
}
}
else
{
h->plt.offset = (bfd_vma) -1;
- h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+ h->needs_plt = 0;
}
/* If R_386_TLS_{IE_32,IE,GOTIE} symbol is now local to the binary,
@@ -1555,7 +1552,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *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->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ && !h->forced_local)
{
if (! bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
@@ -1634,9 +1631,9 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
symbols which turn out to need copy relocs or are not
dynamic. */
- 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)
+ if (!h->non_got_ref
+ && ((h->def_dynamic
+ && !h->def_regular)
|| (htab->elf.dynamic_sections_created
&& (h->root.type == bfd_link_hash_undefweak
|| h->root.type == bfd_link_hash_undefined))))
@@ -1644,7 +1641,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *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->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
+ && !h->forced_local)
{
if (! bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
@@ -2344,11 +2341,9 @@ elf_i386_relocate_section (bfd *output_bfd,
&& !info->shared
&& h != NULL
&& h->dynindx != -1
- && (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->non_got_ref
+ && ((h->def_dynamic
+ && !h->def_regular)
|| h->root.type == bfd_link_hash_undefweak
|| h->root.type == bfd_link_hash_undefined)))
{
@@ -2381,8 +2376,7 @@ elf_i386_relocate_section (bfd *output_bfd,
&& (r_type == R_386_PC32
|| !info->shared
|| !info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))
+ || !h->def_regular))
outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
else
{
@@ -2912,7 +2906,7 @@ elf_i386_relocate_section (bfd *output_bfd,
not process them. */
if (unresolved_reloc
&& !((input_section->flags & SEC_DEBUGGING) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
+ && h->def_dynamic))
{
(*_bfd_error_handler)
(_("%B(%A+0x%lx): unresolvable relocation against symbol `%s'"),
@@ -3045,7 +3039,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
loc = htab->srelplt->contents + plt_index * sizeof (Elf32_External_Rel);
bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ if (!h->def_regular)
{
/* Mark the symbol as undefined, rather than as defined in
the .plt section. Leave the value if there were any
@@ -3056,7 +3050,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
called from a binary, there is no need to slow down
shared libraries because of that. */
sym->st_shndx = SHN_UNDEF;
- if ((h->elf_link_hash_flags & ELF_LINK_POINTER_EQUALITY_NEEDED) == 0)
+ if (!h->pointer_equality_needed)
sym->st_value = 0;
}
}
@@ -3102,7 +3096,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
}
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
+ if (h->needs_copy)
{
Elf_Internal_Rela rel;
bfd_byte *loc;