aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog17
-rw-r--r--bfd/elf-s390-common.c5
-rw-r--r--bfd/elf32-arm.c2
-rw-r--r--bfd/elf32-bfin.c22
-rw-r--r--bfd/elf32-frv.c24
-rw-r--r--bfd/elf32-m68k.c2
-rw-r--r--bfd/elf32-nios2.c2
-rw-r--r--bfd/elf32-ppc.c3
-rw-r--r--bfd/elf32-s390.c2
-rw-r--r--bfd/elf32-sh.c4
-rw-r--r--bfd/elf64-alpha.c14
-rw-r--r--bfd/elf64-ppc.c2
-rw-r--r--bfd/elf64-s390.c2
-rw-r--r--bfd/elflink.c2
14 files changed, 57 insertions, 46 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index c0fbbe9..bcbf7f9 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,20 @@
+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.
diff --git a/bfd/elf-s390-common.c b/bfd/elf-s390-common.c
index 5c36ec8..6b5b17b 100644
--- a/bfd/elf-s390-common.c
+++ b/bfd/elf-s390-common.c
@@ -151,8 +151,7 @@ keep:
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)
{
@@ -187,7 +186,7 @@ keep:
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. */
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index bd4b576..2e7d26d 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -9881,7 +9881,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
}
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"),
diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c
index 49ef360..152134e 100644
--- a/bfd/elf32-bfin.c
+++ b/bfd/elf32-bfin.c
@@ -2215,7 +2215,7 @@ _bfinfdpic_emit_got_relocs_plt_entries (struct bfinfdpic_relocs_info *entry,
/* 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)))
{
@@ -2270,7 +2270,7 @@ _bfinfdpic_emit_got_relocs_plt_entries (struct bfinfdpic_relocs_info *entry,
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
@@ -2306,7 +2306,7 @@ _bfinfdpic_emit_got_relocs_plt_entries (struct bfinfdpic_relocs_info *entry,
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)))
{
@@ -2369,7 +2369,7 @@ _bfinfdpic_emit_got_relocs_plt_entries (struct bfinfdpic_relocs_info *entry,
/* 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)
@@ -2417,8 +2417,7 @@ _bfinfdpic_emit_got_relocs_plt_entries (struct bfinfdpic_relocs_info *entry,
/* 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)
{
@@ -2834,8 +2833,7 @@ bfinfdpic_relocate_section (bfd * output_bfd,
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;
@@ -2872,7 +2870,7 @@ bfinfdpic_relocate_section (bfd * output_bfd,
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;
@@ -2995,7 +2993,7 @@ bfinfdpic_relocate_section (bfd * output_bfd,
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)
@@ -3075,7 +3073,7 @@ bfinfdpic_relocate_section (bfd * output_bfd,
/* 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
@@ -3655,7 +3653,7 @@ _bfinfdpic_count_relocs_fixups (struct bfinfdpic_relocs_info *entry,
{
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
{
diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c
index b55a7ab..fa12528 100644
--- a/bfd/elf32-frv.c
+++ b/bfd/elf32-frv.c
@@ -1384,7 +1384,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry,
/* 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)))
{
@@ -1439,7 +1439,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry,
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
@@ -1482,7 +1482,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry,
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)))
{
@@ -1545,7 +1545,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry,
/* 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)
@@ -1593,8 +1593,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry,
/* 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)
{
@@ -1847,7 +1846,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry,
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)))
@@ -3523,8 +3522,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
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;
@@ -3562,7 +3560,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
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;
@@ -3684,7 +3682,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
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)
@@ -3773,7 +3771,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
/* 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
@@ -4512,7 +4510,7 @@ _frvfdpic_count_relocs_fixups (struct frvfdpic_relocs_info *entry,
{
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;
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index 10d2fcb..f807e03 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -3916,7 +3916,7 @@ elf_m68k_relocate_section (bfd *output_bfd,
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 "
diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c
index fd70007..6a72f71 100644
--- a/bfd/elf32-nios2.c
+++ b/bfd/elf32-nios2.c
@@ -4352,7 +4352,7 @@ nios2_elf32_relocate_section (bfd *output_bfd,
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 "
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 8415f1e..3f708cb 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -5204,7 +5204,7 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED,
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);
@@ -6947,7 +6947,6 @@ ppc_elf_relax_section (bfd *abfd,
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)
{
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index de37ca4..96c1531 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -3116,7 +3116,7 @@ elf_s390_relocate_section (bfd *output_bfd,
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. */
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index 012ee4e..7b8d763 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -5440,7 +5440,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
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;
@@ -6542,7 +6542,7 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
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"),
diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
index f67b0af..df19da7 100644
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -1896,7 +1896,7 @@ elf64_alpha_check_relocs (bfd *abfd, struct bfd_link_info *info,
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;
@@ -2742,7 +2742,8 @@ elf64_alpha_calc_dynrel_sizes (struct alpha_elf_link_hash_entry *h,
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 +=
@@ -3071,8 +3072,7 @@ elf64_alpha_relax_got_load (struct alpha_relax_info *info, bfd_vma symval,
/* 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)
@@ -4586,7 +4586,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
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;
@@ -4636,7 +4636,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
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)
@@ -4718,7 +4718,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
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"),
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 8cff990..3e8bd33 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -8184,7 +8184,7 @@ ppc64_elf_tls_optimize (struct bfd_link_info *info)
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);
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index 2e505f3..0264236 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -3082,7 +3082,7 @@ elf_s390_relocate_section (bfd *output_bfd,
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. */
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 7f04271..76f6493 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -633,7 +633,7 @@ bfd_elf_record_link_assignment (bfd *output_bfd,
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)
{