summaryrefslogtreecommitdiff
path: root/bfd/elf32-cris.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-08-18 05:51:03 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-08-18 05:51:19 -0700
commit0e1862bb401f47716446aef143b2bf7a4563f541 (patch)
tree8410cdece79e8df2f1394b53d1e992736323baac /bfd/elf32-cris.c
parentb2a33439909493f5bf93ada871bd588f365d61f4 (diff)
downloadbinutils-gdb-0e1862bb401f47716446aef143b2bf7a4563f541.tar.gz
Add output_type to bfd_link_info
The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
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 439ce1157e8..303117393fc 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;