* elfxx-target.h (elf_backend_grok_freebsd_prstatus): Define.
(elfNN_bed): Initialize `elf_backend_grok_freebsd_prstatus'.
+2017-10-06 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf32-i386.c (elf_i386_check_relocs): Replace has_got_reloc
+ and has_non_got_reloc with zero_undefweak.
+ * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
+ * elfxx-x86.c (_bfd_x86_elf_link_hash_newfunc): Initialize
+ zero_undefweak to 1.
+ (_bfd_x86_elf_copy_indirect_symbol): Replace has_got_reloc and
+ has_non_got_reloc with zero_undefweak.
+ * elfxx-x86.h (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Replace
+ has_got_reloc and has_non_got_reloc with zero_undefweak.
+ (elf_x86_link_hash_entry): Likewise.
+
2017-10-06 H.J. Lu <hongjiu.lu@intel.com>
* elfxx-x86.h (COPY_INPUT_RELOC_P): Add "do/while(0);".
if (h == NULL)
continue;
- eh->has_got_reloc = 1;
+ eh->zero_undefweak &= 0x2;
h->needs_plt = 1;
h->plt.refcount += 1;
break;
if (r_type != R_386_TLS_IE)
{
if (eh != NULL)
- eh->has_got_reloc = 1;
+ eh->zero_undefweak &= 0x2;
break;
}
/* Fall through */
case R_386_TLS_LE_32:
case R_386_TLS_LE:
if (eh != NULL)
- eh->has_got_reloc = 1;
+ eh->zero_undefweak &= 0x2;
if (bfd_link_executable (info))
break;
info->flags |= DF_STATIC_TLS;
case R_386_32:
case R_386_PC32:
if (eh != NULL && (sec->flags & SEC_CODE) != 0)
- eh->has_non_got_reloc = 1;
+ eh->zero_undefweak |= 0x2;
do_relocation:
/* We are called after all symbols have been resolved. Only
relocation against STT_GNU_IFUNC symbol must go through
return elf_x86_64_need_pic (info, abfd, sec, h, symtab_hdr, isym,
&x86_64_elf_howto_table[r_type]);
if (eh != NULL)
- eh->has_got_reloc = 1;
+ eh->zero_undefweak &= 0x2;
break;
case R_X86_64_GOTTPOFF:
case R_X86_64_GOTPC64:
create_got:
if (eh != NULL)
- eh->has_got_reloc = 1;
+ eh->zero_undefweak &= 0x2;
break;
case R_X86_64_PLT32:
if (h == NULL)
continue;
- eh->has_got_reloc = 1;
+ eh->zero_undefweak &= 0x2;
h->needs_plt = 1;
h->plt.refcount += 1;
break;
case R_X86_64_64:
pointer:
if (eh != NULL && (sec->flags & SEC_CODE) != 0)
- eh->has_non_got_reloc = 1;
+ eh->zero_undefweak |= 0x2;
/* We are called after all symbols have been resolved. Only
relocation against STT_GNU_IFUNC symbol must go through
PLT. */
eh->plt_second.offset = (bfd_vma) -1;
eh->plt_got.offset = (bfd_vma) -1;
eh->tlsdesc_got = (bfd_vma) -1;
+ eh->zero_undefweak = 1;
}
return entry;
generate a R_386_COPY reloc. */
edir->gotoff_ref |= eind->gotoff_ref;
- edir->has_got_reloc |= eind->has_got_reloc;
- edir->has_non_got_reloc |= eind->has_non_got_reloc;
+ edir->zero_undefweak |= eind->zero_undefweak;
if (ELIMINATE_COPY_RELOCS
&& ind->root.type != bfd_link_hash_indirect
((EH)->elf.root.type == bfd_link_hash_undefweak \
&& (SYMBOL_REFERENCES_LOCAL_P ((INFO), &(EH)->elf) \
|| (bfd_link_executable (INFO) \
- && (!(EH)->has_got_reloc \
- || (EH)->has_non_got_reloc))))
+ && (EH)->zero_undefweak > 0)))
/* Should copy relocation be generated for a symbol. Don't generate
copy relocation against a protected symbol defined in a shared
unsigned char tls_type;
- /* TRUE if symbol has GOT or PLT relocations. */
- unsigned int has_got_reloc : 1;
-
- /* TRUE if symbol has non-GOT/non-PLT relocations in text sections. */
- unsigned int has_non_got_reloc : 1;
+ /* Bit 0: Symbol has no GOT nor PLT relocations.
+ Bit 1: Symbol has non-GOT/non-PLT relocations in text sections.
+ zero_undefweak is initialized to 1 and undefined weak symbol
+ should be resolved to 0 if zero_undefweak > 0. */
+ unsigned int zero_undefweak : 2;
/* Don't call finish_dynamic_symbol on this symbol. */
unsigned int no_finish_dynamic_symbol : 1;