summaryrefslogtreecommitdiff
path: root/bfd/elf64-sh64.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elf64-sh64.c')
-rw-r--r--bfd/elf64-sh64.c75
1 files changed, 33 insertions, 42 deletions
diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c
index ea6f4df34ea..c2e1034020d 100644
--- a/bfd/elf64-sh64.c
+++ b/bfd/elf64-sh64.c
@@ -1653,8 +1653,7 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
&& elf_hash_table (info)->dynamic_sections_created
&& (! info->shared
|| (! info->symbolic && h->dynindx != -1)
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))
+ || !h->def_regular))
/* The cases above are those in which relocation is
overwritten in the switch block below. The cases
below are those in which we must defer relocation
@@ -1662,8 +1661,7 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
addresses when creating a shared library. */
|| (info->shared
&& ((! info->symbolic && h->dynindx != -1)
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ || !h->def_regular)
&& ((r_type == R_SH_64
&& !(ELF_ST_VISIBILITY (h->other) == STV_INTERNAL
|| ELF_ST_VISIBILITY (h->other) == STV_HIDDEN))
@@ -1679,8 +1677,7 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
thus ld.so will not process them. */
|| (sec->output_section == NULL
&& ((input_section->flags & SEC_DEBUGGING) != 0
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC) != 0)))
+ && h->def_dynamic)))
relocation = 0;
else if (sec->output_section == NULL)
{
@@ -1747,8 +1744,7 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|| (h != NULL
&& h->dynindx != -1
&& (! info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+ || !h->def_regular))))
{
Elf_Internal_Rela outrel;
bfd_byte *loc;
@@ -1807,8 +1803,7 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
become local. */
if (h == NULL
|| ((info->symbolic || h->dynindx == -1)
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) != 0))
+ && h->def_regular))
{
relocate = TRUE;
outrel.r_info = ELF64_R_INFO (0, R_SH_RELATIVE64);
@@ -1906,7 +1901,7 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
&& (info->symbolic || h->dynindx == -1
|| ELF_ST_VISIBILITY (h->other) == STV_INTERNAL
|| ELF_ST_VISIBILITY (h->other) == STV_HIDDEN)
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
+ && h->def_regular))
{
/* This is actually a static link, or it is a
-Bsymbolic link and the symbol is defined
@@ -2720,7 +2715,7 @@ sh_elf64_check_relocs (bfd *abfd, struct bfd_link_info *info,
return FALSE;
}
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+ h->needs_plt = 1;
break;
@@ -2744,14 +2739,14 @@ sh_elf64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|| ELF_ST_VISIBILITY (h->other) == STV_HIDDEN)
break;
- h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
+ h->needs_plt = 1;
break;
case R_SH_64:
case R_SH_64_PCREL:
if (h != NULL)
- h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
+ h->non_got_ref = 1;
/* If we are creating a shared library, and this is a reloc
against a global symbol, or a non PC relative reloc
@@ -2770,8 +2765,7 @@ sh_elf64_check_relocs (bfd *abfd, struct bfd_link_info *info,
&& (ELF32_R_TYPE (rel->r_info) != R_SH_64_PCREL
|| (h != NULL
&& (! info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+ || !h->def_regular))))
{
/* When creating a shared object, we must copy these
reloc types into the output file. We create a reloc
@@ -2935,7 +2929,7 @@ sh64_elf64_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
}
h = (struct elf_link_hash_entry *) bh;
- h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF;
+ h->non_elf = 0;
h->type = STT_DATALABEL;
}
else
@@ -3294,7 +3288,7 @@ sh64_elf64_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
return FALSE;
h = (struct elf_link_hash_entry *) bh;
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
+ h->def_regular = 1;
h->type = STT_OBJECT;
if (info->shared
@@ -3393,31 +3387,28 @@ sh64_elf64_adjust_dynamic_symbol (struct bfd_link_info *info,
/* Make sure we know what is going on here. */
BFD_ASSERT (dynobj != NULL
- && ((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)));
+ && (h->needs_plt
+ || h->u.weakdef != NULL
+ || (h->def_dynamic
+ && h->ref_regular
+ && !h->def_regular)));
/* If this is a function, put it in the procedure linkage table. We
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 (! info->shared
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0)
+ && !h->def_dynamic
+ && !h->ref_dynamic)
{
/* This case can occur if we saw a PLT reloc in an input
file, but the symbol was never referred to by a dynamic
object. In such a case, we don't actually need to build
a procedure linkage table, and we can just do a REL64
reloc instead. */
- BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0);
+ BFD_ASSERT (h->needs_plt);
return TRUE;
}
@@ -3442,7 +3433,7 @@ sh64_elf64_adjust_dynamic_symbol (struct bfd_link_info *info,
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 = s->size;
@@ -3472,12 +3463,12 @@ sh64_elf64_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;
return TRUE;
}
@@ -3493,7 +3484,7 @@ sh64_elf64_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;
/* We must allocate the symbol in our .dynbss section, which will
@@ -3520,7 +3511,7 @@ sh64_elf64_adjust_dynamic_symbol (struct bfd_link_info *info,
srel = bfd_get_section_by_name (dynobj, ".rela.bss");
BFD_ASSERT (srel != NULL);
srel->size += sizeof (Elf64_External_Rela);
- 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
@@ -3564,7 +3555,7 @@ sh64_elf64_discard_copies (struct elf_sh64_link_hash_entry *h,
h = (struct elf_sh64_link_hash_entry *) h->root.root.u.i.link;
/* We only discard relocs for symbols defined in a regular object. */
- if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+ if (!h->root.def_regular)
return TRUE;
for (s = h->pcrel_relocs_copied; s != NULL; s = s->next)
@@ -3872,7 +3863,7 @@ sh64_elf64_finish_dynamic_symbol (bfd *output_bfd,
loc = srel->contents + plt_index * sizeof (Elf64_External_Rela);
bfd_elf64_swap_reloca_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 alone. */
@@ -3905,7 +3896,7 @@ sh64_elf64_finish_dynamic_symbol (bfd *output_bfd,
initialized in the relocate_section function. */
if (info->shared
&& (info->symbolic || h->dynindx == -1)
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
+ && h->def_regular)
{
rel.r_info = ELF64_R_INFO (0, R_SH_RELATIVE64);
rel.r_addend = (h->root.u.def.value
@@ -3924,7 +3915,7 @@ sh64_elf64_finish_dynamic_symbol (bfd *output_bfd,
bfd_elf64_swap_reloca_out (output_bfd, &rel, loc);
}
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
+ if (h->needs_copy)
{
asection *s;
Elf_Internal_Rela rel;