aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-sparc.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elf32-sparc.c')
-rw-r--r--bfd/elf32-sparc.c103
1 files changed, 56 insertions, 47 deletions
diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c
index c44a50a..5b80533 100644
--- a/bfd/elf32-sparc.c
+++ b/bfd/elf32-sparc.c
@@ -1098,7 +1098,7 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs)
break;
}
- h->needs_plt = 1;
+ h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
if (ELF32_R_TYPE (rel->r_info) == R_SPARC_PLT32)
goto r_sparc_plt32;
@@ -1108,7 +1108,7 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs)
case R_SPARC_PC10:
case R_SPARC_PC22:
if (h != NULL)
- h->non_got_ref = 1;
+ h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
if (h != NULL
&& strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
@@ -1132,7 +1132,7 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs)
case R_SPARC_UA16:
case R_SPARC_UA32:
if (h != NULL)
- h->non_got_ref = 1;
+ h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
r_sparc_plt32:
if (h != NULL && !info->shared)
@@ -1169,12 +1169,14 @@ elf32_sparc_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))))
|| (!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 elf32_sparc_dyn_relocs *p;
struct elf32_sparc_dyn_relocs **head;
@@ -1455,11 +1457,14 @@ elf32_sparc_adjust_dynamic_symbol (info, h)
/* Make sure we know what is going on here. */
BFD_ASSERT (htab->elf.dynobj != NULL
- && (h->needs_plt
- || h->u.weakdef != NULL
- || (h->def_dynamic
- && h->ref_regular
- && !h->def_regular)));
+ && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT)
+ || h->weakdef != NULL
+ || ((h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+ && (h->elf_link_hash_flags
+ & ELF_LINK_HASH_REF_REGULAR) != 0
+ && (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0)));
/* If this is a function, put it in the procedure linkage table. We
will fill in the contents of the procedure linkage table later
@@ -1469,7 +1474,7 @@ elf32_sparc_adjust_dynamic_symbol (info, h)
some of their functions as STT_NOTYPE when they really should be
STT_FUNC. */
if (h->type == STT_FUNC
- || h->needs_plt
+ || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0
|| (h->type == STT_NOTYPE
&& (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
@@ -1477,8 +1482,8 @@ elf32_sparc_adjust_dynamic_symbol (info, h)
{
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))
{
@@ -1488,7 +1493,7 @@ elf32_sparc_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 WDISP30 reloc instead. */
h->plt.offset = (bfd_vma) -1;
- h->needs_plt = 0;
+ h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
}
return TRUE;
@@ -1499,12 +1504,12 @@ elf32_sparc_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;
return TRUE;
}
@@ -1520,7 +1525,7 @@ elf32_sparc_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;
eh = (struct elf32_sparc_link_hash_entry *) h;
@@ -1535,7 +1540,7 @@ elf32_sparc_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;
}
@@ -1556,7 +1561,7 @@ elf32_sparc_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
@@ -1615,7 +1620,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;
@@ -1644,7 +1649,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;
@@ -1659,13 +1664,13 @@ 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;
}
}
else
{
h->plt.offset = (bfd_vma) -1;
- h->needs_plt = 0;
+ h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
}
/* If R_SPARC_TLS_IE_{HI22,LO10} symbol is now local to the binary,
@@ -1684,7 +1689,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;
@@ -1723,8 +1728,8 @@ allocate_dynrelocs (h, inf)
if (info->shared)
{
- if (h->def_regular
- && (h->forced_local
+ if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
+ && ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0
|| info->symbolic))
{
struct elf32_sparc_dyn_relocs **pp;
@@ -1746,9 +1751,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))))
@@ -1756,7 +1761,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;
@@ -2224,8 +2229,8 @@ elf32_sparc_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)))
{
/* This is actually a static link, or it is a
-Bsymbolic link and the symbol is defined
@@ -2373,13 +2378,16 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
|| (h != NULL
&& h->dynindx != -1
&& (! info->symbolic
- || !h->def_regular))))
+ || (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0))))
|| (!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)))
{
@@ -2444,7 +2452,8 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
become local. */
else if (h != NULL && ! is_plt
&& ((! info->symbolic && h->dynindx != -1)
- || !h->def_regular))
+ || (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0))
{
BFD_ASSERT (h->dynindx != -1);
outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
@@ -2840,7 +2849,7 @@ elf32_sparc_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,
@@ -3091,7 +3100,7 @@ elf32_sparc_finish_dynamic_symbol (output_bfd, info, h, sym)
loc += (h->plt.offset / PLT_ENTRY_SIZE - 4) * 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. */
@@ -3100,7 +3109,8 @@ elf32_sparc_finish_dynamic_symbol (output_bfd, info, h, sym)
Otherwise, the PLT entry would provide a definition for
the symbol even if the symbol wasn't defined anywhere,
and so the symbol would never be NULL. */
- if (!h->ref_regular_nonweak)
+ if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK)
+ == 0)
sym->st_value = 0;
}
}
@@ -3132,7 +3142,7 @@ elf32_sparc_finish_dynamic_symbol (output_bfd, info, h, sym)
initialized in the relocate_section function. */
if (info->shared
&& (info->symbolic || h->dynindx == -1)
- && h->def_regular)
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
{
asection *sec = h->root.u.def.section;
rela.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE);
@@ -3153,7 +3163,7 @@ elf32_sparc_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)
{
asection *s;
Elf_Internal_Rela rela;
@@ -3371,8 +3381,6 @@ elf32_sparc_final_write_processing (abfd, linker)
switch (bfd_get_mach (abfd))
{
case bfd_mach_sparc :
- case bfd_mach_sparc_sparclet :
- case bfd_mach_sparc_sparclite :
break; /* nothing to do */
case bfd_mach_sparc_v8plus :
elf_elfheader (abfd)->e_machine = EM_SPARC32PLUS;
@@ -3391,6 +3399,7 @@ elf32_sparc_final_write_processing (abfd, linker)
| EF_SPARC_SUN_US3;
break;
case bfd_mach_sparc_sparclite_le :
+ elf_elfheader (abfd)->e_machine = EM_SPARC;
elf_elfheader (abfd)->e_flags |= EF_SPARC_LEDATA;
break;
default :