From 98b273dc13b1e45db8c66821efc9e514884f3c25 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 6 Oct 2017 15:25:07 -0700 Subject: x86: Use zero_undefweak in elf_x86_link_hash_entry Replace has_got_reloc and has_non_got_reloc in elf_x86_link_hash_entry with zero_undefweak: 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. * 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. --- bfd/elf64-x86-64.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'bfd/elf64-x86-64.c') diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index c4cf7ae..0b0aa6c 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -1958,7 +1958,7 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, 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: @@ -2066,7 +2066,7 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, 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: @@ -2083,7 +2083,7 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, if (h == NULL) continue; - eh->has_got_reloc = 1; + eh->zero_undefweak &= 0x2; h->needs_plt = 1; h->plt.refcount += 1; break; @@ -2134,7 +2134,7 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, 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. */ -- cgit v1.1