+2015-08-19 Alan Modra <amodra@gmail.com>
+
+ * elf-s390-common.c: Simplify expressions using
+ bfd_linke_executable, bfd_link_pie and bfd_link_pic.
+ * elf32-arm.c: Likewise.
+ * elf32-bfin.c: Likewise.
+ * elf32-frv.c: Likewise.
+ * elf32-m68k.c: Likewise.
+ * elf32-nios2.c: Likewise.
+ * elf32-ppc.c: Likewise.
+ * elf32-s390.c: Likewise.
+ * elf32-sh.c: Likewise.
+ * elf64-alpha.c: Likewise.
+ * elf64-ppc.c: Likewise.
+ * elf64-s390.c: Likewise.
+ * elflink.c: Likewise.
+
2015-08-18 Jiong Wang <jiong.wang@arm.com>
* elfnn-aarch64.c (aarch64_reloc_got_type): Delete useless check.
point to the IPLT slot. That way the referencing shared lib will
always get the PLT slot address when resolving the respective
R_390_GLOB_DAT/R_390_64 relocs on that symbol. */
- if (bfd_link_executable (info)
- && !bfd_link_pic (info)
+ if (bfd_link_pde (info)
&& h->def_regular
&& h->ref_dynamic)
{
if (h->got.refcount <= 0
|| (bfd_link_pic (info)
&& (h->dynindx == -1 || h->forced_local))
- || (bfd_link_executable (info) && bfd_link_pic (info))
+ || bfd_link_pie (info)
|| htab->sgot == NULL)
{
/* Use .got.iplt. */
}
case R_ARM_TLS_LE32:
- if (bfd_link_pic (info) && !bfd_link_pie (info))
+ if (bfd_link_dll (info))
{
(*_bfd_error_handler)
(_("%B(%A+0x%lx): R_ARM_TLS_LE32 relocation not permitted in shared object"),
/* If we're linking an executable at a fixed address, we can
omit the dynamic relocation as long as the symbol is local to
this module. */
- if (bfd_link_executable (info) && !bfd_link_pic (info)
+ if (bfd_link_pde (info)
&& (entry->symndx != -1
|| BFINFDPIC_SYM_LOCAL (info, entry->d.h)))
{
if (entry->symndx == -1
&& ! BFINFDPIC_FUNCDESC_LOCAL (info, entry->d.h)
&& BFINFDPIC_SYM_LOCAL (info, entry->d.h)
- && !(bfd_link_executable (info) && !bfd_link_pic (info)))
+ && !bfd_link_pde (info))
{
reloc = R_BFIN_FUNCDESC;
idx = elf_section_data (entry->d.h->root.u.def.section
dynamic symbol entry for the got section, so idx will be
zero, which means we can and should compute the address
of the private descriptor ourselves. */
- if (bfd_link_executable (info) && !bfd_link_pic (info)
+ if (bfd_link_pde (info)
&& (entry->symndx != -1
|| BFINFDPIC_FUNCDESC_LOCAL (info, entry->d.h)))
{
/* If we're linking an executable at a fixed address, we can
omit the dynamic relocation as long as the symbol is local to
this module. */
- if (bfd_link_executable (info) && !bfd_link_pic (info)
+ if (bfd_link_pde (info)
&& (entry->symndx != -1 || BFINFDPIC_SYM_LOCAL (info, entry->d.h)))
{
if (sec)
/* If we've omitted the dynamic relocation, just emit the fixed
addresses of the symbol and of the local GOT base offset. */
- if (bfd_link_executable (info)
- && !bfd_link_pic (info)
+ if (bfd_link_pde (info)
&& sec
&& sec->output_section)
{
section+offset. */
if (h && ! BFINFDPIC_FUNCDESC_LOCAL (info, h)
&& BFINFDPIC_SYM_LOCAL (info, h)
- && !(bfd_link_executable (info)
- && !bfd_link_pic (info)))
+ && !bfd_link_pde (info))
{
dynindx = elf_section_data (h->root.u.def.section
->output_section)->dynindx;
dynamic symbol entry for the got section, so idx will
be zero, which means we can and should compute the
address of the private descriptor ourselves. */
- if (bfd_link_executable (info) && !bfd_link_pic (info)
+ if (bfd_link_pde (info)
&& (!h || BFINFDPIC_FUNCDESC_LOCAL (info, h)))
{
bfd_vma offset;
can omit the dynamic relocation as long as the symbol
is defined in the current link unit (which is implied
by its output section not being NULL). */
- if (bfd_link_executable (info) && !bfd_link_pic (info)
+ if (bfd_link_pde (info)
&& (!h || BFINFDPIC_SYM_LOCAL (info, h)))
{
if (osec)
/* If we've omitted the dynamic relocation, just emit
the fixed addresses of the symbol and of the local
GOT base offset. */
- if (bfd_link_executable (info) && !bfd_link_pic (info)
+ if (bfd_link_pde (info)
&& (!h || BFINFDPIC_SYM_LOCAL (info, h)))
bfd_put_32 (output_bfd,
bfinfdpic_got_section (info)->output_section->vma
{
bfd_vma relocs = 0, fixups = 0;
- if (!bfd_link_executable (dinfo->info) || bfd_link_pie (dinfo->info))
+ if (!bfd_link_pde (dinfo->info))
relocs = entry->relocs32 + entry->relocsfd + entry->relocsfdv;
else
{
/* If we're linking an executable at a fixed address, we can
omit the dynamic relocation as long as the symbol is local to
this module. */
- if (bfd_link_executable (info) && !bfd_link_pic (info)
+ if (bfd_link_pde (info)
&& (entry->symndx != -1
|| FRVFDPIC_SYM_LOCAL (info, entry->d.h)))
{
if (entry->symndx == -1
&& ! FRVFDPIC_FUNCDESC_LOCAL (info, entry->d.h)
&& FRVFDPIC_SYM_LOCAL (info, entry->d.h)
- && !(bfd_link_executable (info) && !bfd_link_pic (info)))
+ && !bfd_link_pde (info))
{
reloc = R_FRV_FUNCDESC;
idx = elf_section_data (entry->d.h->root.u.def.section
dynamic symbol entry for the got section, so idx will be
zero, which means we can and should compute the address
of the private descriptor ourselves. */
- if (bfd_link_executable (info) && !bfd_link_pic (info)
+ if (bfd_link_pde (info)
&& (entry->symndx != -1
|| FRVFDPIC_FUNCDESC_LOCAL (info, entry->d.h)))
{
/* If we're linking an executable at a fixed address, we can
omit the dynamic relocation as long as the symbol is local to
this module. */
- if (bfd_link_executable (info) && !bfd_link_pic (info)
+ if (bfd_link_pde (info)
&& (entry->symndx != -1 || FRVFDPIC_SYM_LOCAL (info, entry->d.h)))
{
if (sec)
/* If we've omitted the dynamic relocation, just emit the fixed
addresses of the symbol and of the local GOT base offset. */
- if (bfd_link_executable (info)
- && !bfd_link_pic (info)
+ if (bfd_link_pde (info)
&& sec
&& sec->output_section)
{
if (bfd_link_executable (info) && ! entry->tlsoff_entry)
entry->tlsoff_entry = entry->tlsdesc_entry + 4;
- if (bfd_link_executable (info) && !bfd_link_pic (info)
+ if (bfd_link_pde (info)
&& ((idx == 0
&& (bfd_is_abs_section (sec)
|| bfd_is_und_section (sec)))
section+offset. */
if (h && ! FRVFDPIC_FUNCDESC_LOCAL (info, h)
&& FRVFDPIC_SYM_LOCAL (info, h)
- && !(bfd_link_executable (info)
- && !bfd_link_pic (info)))
+ && !bfd_link_pde (info))
{
dynindx = elf_section_data (h->root.u.def.section
->output_section)->dynindx;
dynamic symbol entry for the got section, so idx will
be zero, which means we can and should compute the
address of the private descriptor ourselves. */
- if (bfd_link_executable (info) && !bfd_link_pic (info)
+ if (bfd_link_pde (info)
&& (!h || FRVFDPIC_FUNCDESC_LOCAL (info, h)))
{
addend += frvfdpic_got_section (info)->output_section->vma;
can omit the dynamic relocation as long as the symbol
is defined in the current link unit (which is implied
by its output section not being NULL). */
- if (bfd_link_executable (info) && !bfd_link_pic (info)
+ if (bfd_link_pde (info)
&& (!h || FRVFDPIC_SYM_LOCAL (info, h)))
{
if (osec)
/* If we've omitted the dynamic relocation, just emit
the fixed addresses of the symbol and of the local
GOT base offset. */
- if (bfd_link_executable (info) && !bfd_link_pic (info)
+ if (bfd_link_pde (info)
&& (!h || FRVFDPIC_SYM_LOCAL (info, h)))
bfd_put_32 (output_bfd,
frvfdpic_got_section (info)->output_section->vma
{
bfd_vma relocs = 0, fixups = 0, tlsrets = 0;
- if (!bfd_link_executable (dinfo->info) || bfd_link_pie (dinfo->info))
+ if (!bfd_link_pde (dinfo->info))
{
relocs = entry->relocs32 + entry->relocsfd + entry->relocsfdv
+ entry->relocstlsd;
case R_68K_TLS_LE32:
case R_68K_TLS_LE16:
case R_68K_TLS_LE8:
- if (bfd_link_pic (info) && !bfd_link_pie (info))
+ if (bfd_link_dll (info))
{
(*_bfd_error_handler)
(_("%B(%A+0x%lx): R_68K_TLS_LE32 relocation not permitted "
break;
case R_NIOS2_TLS_LE16:
- if (bfd_link_pic (info) && !bfd_link_pie (info))
+ if (bfd_link_dll (info))
{
(*_bfd_error_handler)
(_("%B(%A+0x%lx): R_NIOS2_TLS_LE16 relocation not "
struct ppc_elf_link_hash_table *htab;
int pass;
- if (bfd_link_relocatable (info) || !bfd_link_executable (info))
+ if (!bfd_link_executable (info))
return TRUE;
htab = ppc_elf_hash_table (info);
optimise away the call. We won't be needing a long-
branch stub in that case. */
if (bfd_link_executable (link_info)
- && !bfd_link_relocatable (link_info)
&& h == htab->tls_get_addr
&& irel != internal_relocs)
{
break;
case R_390_TLS_LE32:
- if (bfd_link_pic (info) && !bfd_link_pie (info))
+ if (bfd_link_dll (info))
{
/* Linking a shared library with non-fpic code requires
a R_390_TLS_TPOFF relocation. */
check_segment[0] = check_segment[1] = -1;
- if (! bfd_link_pic (info) || bfd_link_pie (info))
+ if (!bfd_link_dll (info))
{
relocation = tpoff (info, relocation);
addend = rel->r_addend;
break;
case R_SH_TLS_LE_32:
- if (bfd_link_pic (info) && !bfd_link_pie (info))
+ if (bfd_link_dll (info))
{
(*_bfd_error_handler)
(_("%B: TLS local exec code cannot be linked into shared objects"),
break;
case R_ALPHA_TPREL64:
- if (bfd_link_pic (info) && !bfd_link_pie (info))
+ if (bfd_link_dll (info))
{
info->flags |= DF_STATIC_TLS;
need = NEED_DYNREL;
for (relent = h->reloc_entries; relent; relent = relent->next)
{
entries = alpha_dynamic_entries_for_reloc (relent->rtype, dynamic,
- bfd_link_pic (info), bfd_link_pie (info));
+ bfd_link_pic (info),
+ bfd_link_pie (info));
if (entries)
{
relent->srel->size +=
/* Can't use local-exec relocations in shared libraries. */
if (r_type == R_ALPHA_GOTTPREL
- && (bfd_link_pic (info->link_info)
- && !bfd_link_pie (info->link_info)))
+ && bfd_link_dll (info->link_info))
return TRUE;
if (r_type == R_ALPHA_LITERAL)
else if (r_type == R_ALPHA_TPREL64)
{
BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL);
- if (!bfd_link_pic (info) || bfd_link_pie (info))
+ if (!bfd_link_dll (info))
{
value -= tp_base;
goto default_reloc;
input_bfd, h->root.root.root.string);
ret_val = FALSE;
}
- else if ((bfd_link_pic (info) || bfd_link_pie (info))
+ else if (bfd_link_pic (info)
&& undef_weak_ref)
{
(*_bfd_error_handler)
case R_ALPHA_TPRELHI:
case R_ALPHA_TPRELLO:
case R_ALPHA_TPREL16:
- if (bfd_link_pic (info) && !bfd_link_pie (info))
+ if (bfd_link_dll (info))
{
(*_bfd_error_handler)
(_("%B: TLS local exec code cannot be linked into shared objects"),
unsigned char *toc_ref;
int pass;
- if (bfd_link_relocatable (info) || !bfd_link_executable (info))
+ if (!bfd_link_executable (info))
return TRUE;
htab = ppc_hash_table (info);
break;
case R_390_TLS_LE64:
- if (bfd_link_pic (info) && !bfd_link_pie (info))
+ if (bfd_link_dll (info))
{
/* Linking a shared library with non-fpic code requires
a R_390_TLS_TPOFF relocation. */
if ((h->def_dynamic
|| h->ref_dynamic
|| bfd_link_pic (info)
- || (bfd_link_executable (info)
+ || (bfd_link_pde (info)
&& elf_hash_table (info)->is_relocatable_executable))
&& h->dynindx == -1)
{
+2015-08-19 Alan Modra <amodra@gmail.com>
+
+ * bfdlink.h (bfd_link_pde): Define.
+
2015-08-18 H.J. Lu <hongjiu.lu@intel.com>
* include/bfdlink.h (output_type): New enum.
#define bfd_link_pic(info) (info)->pic
#define bfd_link_pie(info) (bfd_link_executable (info) \
&& bfd_link_pic (info))
+#define bfd_link_pde(info) (bfd_link_executable (info) \
+ && !bfd_link_pic (info))
/* This structure holds all the information needed to communicate
between BFD and the linker when doing a link. */