+2017-10-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/22263
+ * elfxx-sparc.c (sparc_elf_tls_transition): Replace
+ bfd_link_pic with !bfd_link_executable, !bfd_link_pic with
+ bfd_link_executable for TLS check.
+ (_bfd_sparc_elf_check_relocs): Likewise.
+ (allocate_dynrelocs): Likewise.
+ (_bfd_sparc_elf_relocate_section): Likewise.
+
2017-10-18 H.J. Lu <hongjiu.lu@intel.com>
* elf32-tilepro.c (tilepro_elf_gc_mark_hook): Call
&& ! _bfd_sparc_elf_tdata (abfd)->has_tlsgd)
r_type = R_SPARC_REV32;
- if (bfd_link_pic (info))
+ if (!bfd_link_executable (info))
return r_type;
switch (r_type)
case R_SPARC_TLS_LE_HIX22:
case R_SPARC_TLS_LE_LOX10:
- if (bfd_link_pic (info))
+ if (!bfd_link_executable (info))
goto r_sparc_plt32;
break;
case R_SPARC_TLS_IE_HI22:
case R_SPARC_TLS_IE_LO10:
- if (bfd_link_pic (info))
+ if (!bfd_link_executable (info))
info->flags |= DF_STATIC_TLS;
/* Fall through */
case R_SPARC_TLS_GD_CALL:
case R_SPARC_TLS_LDM_CALL:
- if (bfd_link_pic (info))
+ if (!bfd_link_executable (info))
{
/* These are basically R_SPARC_TLS_WPLT30 relocs against
__tls_get_addr. */
/* If R_SPARC_TLS_IE_{HI22,LO10} symbol is now local to the binary,
make it a R_SPARC_TLS_LE_{HI22,LO10} requiring no TLS entry. */
if (h->got.refcount > 0
- && !bfd_link_pic (info)
+ && bfd_link_executable (info)
&& h->dynindx == -1
&& _bfd_sparc_elf_hash_entry(h)->tls_type == GOT_TLS_IE)
h->got.offset = (bfd_vma) -1;
else if (h != NULL)
{
tls_type = _bfd_sparc_elf_hash_entry(h)->tls_type;
- if (!bfd_link_pic (info)
+ if (bfd_link_executable (info)
&& h->dynindx == -1
&& tls_type == GOT_TLS_IE)
switch (SPARC_ELF_R_TYPE (rel->r_info))
case R_SPARC_TLS_LE_HIX22:
case R_SPARC_TLS_LE_LOX10:
- if (bfd_link_pic (info))
+ if (!bfd_link_executable (info))
{
Elf_Internal_Rela outrel;
bfd_boolean skip;
break;
case R_SPARC_TLS_LDM_CALL:
- if (! bfd_link_pic (info))
+ if (bfd_link_executable (info))
{
/* mov %g0, %o0 */
bfd_put_32 (output_bfd, 0x90100000, contents + rel->r_offset);
tls_type = _bfd_sparc_elf_local_got_tls_type (input_bfd) [r_symndx];
else if (h != NULL)
tls_type = _bfd_sparc_elf_hash_entry(h)->tls_type;
- if (! bfd_link_pic (info)
+ if (bfd_link_executable (info)
|| (r_type == R_SPARC_TLS_GD_CALL && tls_type == GOT_TLS_IE))
{
Elf_Internal_Rela *rel2;
case R_SPARC_TLS_IE_LD:
case R_SPARC_TLS_IE_LDX:
- if (! bfd_link_pic (info) && (h == NULL || h->dynindx == -1))
+ if (bfd_link_executable (info) && (h == NULL || h->dynindx == -1))
{
bfd_vma insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
int rs2 = insn & 0x1f;