aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-cris.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elf32-cris.c')
-rw-r--r--bfd/elf32-cris.c86
1 files changed, 43 insertions, 43 deletions
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index 439ce11..3031173 100644
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -1092,7 +1092,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
time. FIXME: Not sure this example covers the
h->elf_link_hash_flags test, though it's there in
other targets. */
- if (info->shared
+ if (bfd_link_pic (info)
&& ((!SYMBOLIC_BIND (info, h) && h->dynindx != -1)
|| !h->def_regular)
&& (input_section->flags & SEC_ALLOC) != 0
@@ -1103,7 +1103,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|| r_type == R_CRIS_16_PCREL
|| r_type == R_CRIS_32_PCREL))
relocation = 0;
- else if (!info->relocatable && unresolved_reloc
+ else if (!bfd_link_relocatable (info) && unresolved_reloc
&& (_bfd_elf_section_offset (output_bfd, info,
input_section,
rel->r_offset)
@@ -1125,7 +1125,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
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)
@@ -1165,7 +1165,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
these call-specific relocs don't address non-functions. */
if (h != NULL
&& (h->got.offset == (bfd_vma) -1
- || (!info->shared
+ || (!bfd_link_pic (info)
&& !(h->def_regular
|| (!h->def_dynamic
&& h->root.type == bfd_link_hash_undefweak)))))
@@ -1207,20 +1207,20 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
BFD_ASSERT (off != (bfd_vma) -1);
if (!elf_hash_table (info)->dynamic_sections_created
- || (! info->shared
+ || (! bfd_link_pic (info)
&& (h->def_regular
|| h->type == STT_FUNC
|| h->needs_plt))
- || (info->shared
+ || (bfd_link_pic (info)
&& (SYMBOLIC_BIND (info, h) || h->dynindx == -1)
&& h->def_regular))
{
- /* This wasn't checked above for ! info->shared, but
+ /* This wasn't checked above for ! bfd_link_pic (info), but
must hold there if we get here; the symbol must
be defined in the regular program or be undefweak
or be a function or otherwise need a PLT. */
BFD_ASSERT (!elf_hash_table (info)->dynamic_sections_created
- || info->shared
+ || bfd_link_pic (info)
|| h->def_regular
|| h->type == STT_FUNC
|| h->needs_plt
@@ -1266,7 +1266,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
{
bfd_put_32 (output_bfd, relocation, sgot->contents + off);
- if (info->shared)
+ if (bfd_link_pic (info))
{
Elf_Internal_Rela outrel;
bfd_byte *loc;
@@ -1327,7 +1327,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
defined in an ordinary (non-DSO) object or is undefined weak. */
if (h != NULL
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- && !(!info->shared
+ && !(!bfd_link_pic (info)
&& (h->def_regular
|| (!h->def_dynamic
&& h->root.type == bfd_link_hash_undefweak))))
@@ -1426,7 +1426,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
case R_CRIS_8:
case R_CRIS_16:
case R_CRIS_32:
- if (info->shared
+ if (bfd_link_pic (info)
&& r_symndx != STN_UNDEF
&& (input_section->flags & SEC_ALLOC) != 0
&& ((r_type != R_CRIS_8_PCREL
@@ -1557,7 +1557,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
if (h != NULL
&& (input_section->flags & SEC_ALLOC) != 0
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- && (info->shared
+ && (bfd_link_pic (info)
|| (!h->def_regular
&& h->root.type != bfd_link_hash_undefined)))
{
@@ -1592,7 +1592,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
asection *sgotplt = bfd_get_linker_section (dynobj, ".got.plt");
BFD_ASSERT (sgotplt != NULL);
- if (info->shared)
+ if (bfd_link_pic (info))
{
Elf_Internal_Rela outrel;
bfd_byte *loc;
@@ -1631,7 +1631,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
break;
case R_CRIS_32_GD:
- if (info->shared)
+ if (bfd_link_pic (info))
{
bfd_set_error (bfd_error_invalid_operation);
@@ -1662,7 +1662,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
return FALSE;
}
- if (!info->shared
+ if (!bfd_link_pic (info)
&& (h == NULL || h->def_regular || ELF_COMMON_DEF_P (h)))
{
/* Known contents of the GOT. */
@@ -1783,7 +1783,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
break;
case R_CRIS_32_IE:
- if (info->shared)
+ if (bfd_link_pic (info))
{
bfd_set_error (bfd_error_invalid_operation);
@@ -1814,7 +1814,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
return FALSE;
}
- if (!info->shared
+ if (!bfd_link_pic (info)
&& (h == NULL || h->def_regular || ELF_COMMON_DEF_P (h)))
{
/* Known contents of the GOT. */
@@ -1920,7 +1920,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
case R_CRIS_32_TPREL:
/* This relocation must only be performed against symbols
defined in an ordinary (non-DSO) object. */
- if (info->shared)
+ if (bfd_link_pic (info))
{
bfd_set_error (bfd_error_invalid_operation);
@@ -2139,7 +2139,7 @@ elf_cris_finish_dynamic_symbol (bfd *output_bfd,
got_base = sgotplt->output_section->vma + sgotplt->output_offset;
/* Fill in the entry in the procedure linkage table. */
- if (! info->shared)
+ if (! bfd_link_pic (info))
{
memcpy (splt->contents + h->plt.offset, plt_entry,
plt_entry_size);
@@ -2215,7 +2215,7 @@ elf_cris_finish_dynamic_symbol (bfd *output_bfd,
references to the function symbol are redirected to the PLT. */
if (h->got.offset != (bfd_vma) -1
&& (elf_cris_hash_entry (h)->reg_got_refcount > 0)
- && (info->shared
+ && (bfd_link_pic (info)
|| (h->dynindx != -1
&& h->plt.offset == (bfd_vma) -1
&& !h->def_regular
@@ -2244,7 +2244,7 @@ elf_cris_finish_dynamic_symbol (bfd *output_bfd,
initialized in the relocate_section function. */
where = sgot->contents + (h->got.offset &~ (bfd_vma) 1);
if (! elf_hash_table (info)->dynamic_sections_created
- || (info->shared
+ || (bfd_link_pic (info)
&& (SYMBOLIC_BIND (info, h) || h->dynindx == -1)
&& h->def_regular))
{
@@ -2380,7 +2380,7 @@ elf_cris_finish_dynamic_sections (bfd *output_bfd,
{
if (bfd_get_mach (output_bfd) == bfd_mach_cris_v32)
{
- if (info->shared)
+ if (bfd_link_pic (info))
memcpy (splt->contents, elf_cris_pic_plt0_entry_v32,
PLT_ENTRY_SIZE_V32);
else
@@ -2398,7 +2398,7 @@ elf_cris_finish_dynamic_sections (bfd *output_bfd,
}
else
{
- if (info->shared)
+ if (bfd_link_pic (info))
memcpy (splt->contents, elf_cris_pic_plt0_entry,
PLT_ENTRY_SIZE);
else
@@ -2481,7 +2481,7 @@ cris_elf_gc_sweep_hook (bfd *abfd,
asection *sgot;
asection *srelgot;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
dynobj = elf_hash_table (info)->dynobj;
@@ -2592,7 +2592,7 @@ cris_elf_gc_sweep_hook (bfd *abfd,
{
/* We don't need the .got entry any more. */
sgot->size -= got_element_size;
- if (info->shared)
+ if (bfd_link_pic (info))
srelgot->size -= sizeof (Elf32_External_Rela);
}
}
@@ -2886,7 +2886,7 @@ elf_cris_adjust_dynamic_symbol (struct bfd_link_info *info,
result as one built without -fpic, specifically considering weak
symbols.
FIXME: m68k and i386 differ here, for unclear reasons. */
- if (! info->shared
+ if (! bfd_link_pic (info)
&& !h->def_dynamic)
{
/* This case can occur if we saw a PLT reloc in an input file,
@@ -2908,7 +2908,7 @@ elf_cris_adjust_dynamic_symbol (struct bfd_link_info *info,
like R_CRIS_JUMP_SLOT after symbol evaluation) we could get rid
of the PLT. We can't for the executable, because the GOT
entries will point to the PLT there (and be constant). */
- if (info->shared
+ if (bfd_link_pic (info)
&& !elf_cris_try_fold_plt_to_got ((struct elf_cris_link_hash_entry*)
h, info))
return FALSE;
@@ -2939,7 +2939,7 @@ elf_cris_adjust_dynamic_symbol (struct bfd_link_info *info,
/* If this symbol is not defined in a regular file, and we are
not generating a shared library, then set the symbol to this
location in the .plt. */
- if (!info->shared
+ if (!bfd_link_pic (info)
&& !h->def_regular)
{
h->root.u.def.section = s;
@@ -2952,7 +2952,7 @@ elf_cris_adjust_dynamic_symbol (struct bfd_link_info *info,
executable, because then the reloc associated with the PLT
would get a non-PLT reloc pointing to the PLT. FIXME: Move
this to elf_cris_try_fold_plt_to_got. */
- if (info->shared && h->got.refcount > 0)
+ if (bfd_link_pic (info) && h->got.refcount > 0)
{
h->got.refcount += h->plt.refcount;
@@ -3023,7 +3023,7 @@ elf_cris_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
@@ -3143,7 +3143,7 @@ cris_elf_check_relocs (bfd *abfd,
asection *srelgot;
asection *sreloc;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
htab = elf_cris_hash_table (info);
@@ -3286,7 +3286,7 @@ cris_elf_check_relocs (bfd *abfd,
of the first entry is constant there. For a shared
library, we need .got.rela for the R_CRIS_DTPMOD
relocation at index 3. */
- if (!info->shared)
+ if (!bfd_link_pic (info))
break;
/* Fall through. */
@@ -3310,7 +3310,7 @@ cris_elf_check_relocs (bfd *abfd,
case R_CRIS_16_GOT:
case R_CRIS_32_GOT:
if (srelgot == NULL
- && (h != NULL || info->shared))
+ && (h != NULL || bfd_link_pic (info)))
{
srelgot = bfd_get_linker_section (dynobj, ".rela.got");
if (srelgot == NULL)
@@ -3339,7 +3339,7 @@ cris_elf_check_relocs (bfd *abfd,
case R_CRIS_32_TPREL:
case R_CRIS_16_TPREL:
case R_CRIS_32_GD:
- if (info->shared)
+ if (bfd_link_pic (info))
{
(*_bfd_error_handler)
(_("%B, section %A:\n relocation %s not valid"
@@ -3381,7 +3381,7 @@ cris_elf_check_relocs (bfd *abfd,
/* Those relocs also require that a DSO is of type
Initial Exec. Like other targets, we don't reset this
flag even if the relocs are GC:ed away. */
- if (info->shared)
+ if (bfd_link_pic (info))
info->flags |= DF_STATIC_TLS;
break;
@@ -3484,7 +3484,7 @@ cris_elf_check_relocs (bfd *abfd,
if (local_got_refcounts[r_symndx_lgot] == 0)
{
sgot->size += got_element_size;
- if (info->shared)
+ if (bfd_link_pic (info))
{
/* If we are generating a shared object, we need
to output a R_CRIS_RELATIVE reloc so that the
@@ -3550,7 +3550,7 @@ cris_elf_check_relocs (bfd *abfd,
can't help tables of (global) function pointers, for
example, though they must be emitted in a (writable) data
section to avoid having impure text sections. */
- if (info->shared
+ if (bfd_link_pic (info)
&& (sec->flags & SEC_ALLOC) != 0
&& (sec->flags & SEC_READONLY) != 0)
{
@@ -3594,7 +3594,7 @@ cris_elf_check_relocs (bfd *abfd,
render the symbol local. */
/* No need to do anything if we're not creating a shared object. */
- if (! info->shared)
+ if (! bfd_link_pic (info))
break;
/* We may need to create a reloc section in the dynobj and made room
@@ -3643,7 +3643,7 @@ cris_elf_check_relocs (bfd *abfd,
render the symbol local. */
/* No need to do anything if we're not creating a shared object. */
- if (! info->shared)
+ if (! bfd_link_pic (info))
break;
/* We don't need to handle relocs into sections not going into
@@ -3764,7 +3764,7 @@ elf_cris_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (elf_hash_table (info)->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");
BFD_ASSERT (s != NULL);
@@ -3795,7 +3795,7 @@ elf_cris_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
for relocs that have become for local symbols due to symbol
visibility changes. For programs, we discard space for relocs for
symbols not referenced by any dynamic object. */
- if (info->shared)
+ if (bfd_link_pic (info))
elf_cris_link_hash_traverse (htab,
elf_cris_discard_excess_dso_dynamics,
info);
@@ -3837,7 +3837,7 @@ elf_cris_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
{
if (strcmp (name, ".rela.got") == 0
&& htab->dtpmod_refcount != 0
- && info->shared)
+ && bfd_link_pic (info))
s->size += sizeof (Elf32_External_Rela);
if (s->size != 0)
@@ -3897,7 +3897,7 @@ elf_cris_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
#define add_dynamic_entry(TAG, VAL) \
_bfd_elf_add_dynamic_entry (info, TAG, VAL)
- if (!info->shared)
+ if (!bfd_link_pic (info))
{
if (!add_dynamic_entry (DT_DEBUG, 0))
return FALSE;