From: H.J. Lu Date: Thu, 22 Jun 2017 19:53:39 +0000 (-0700) Subject: x86: Resolve local undefined weak symbol to 0 X-Git-Tag: binutils-2_29~163 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=84da4cf89efed1df483914d06210daae79ce3eb8;p=platform%2Fupstream%2Fbinutils.git x86: Resolve local undefined weak symbol to 0 Local undefined weak symbol should always be resolved to 0. * elf32-i386.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Resolve local undefined weak symbol to 0. * elf64-x86-64.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Likewise. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index cdd6c35..8fa42f7 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -5,6 +5,12 @@ 2017-06-22 H.J. Lu + * elf32-i386.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Resolve + local undefined weak symbol to 0. + * elf64-x86-64.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Likewise. + +2017-06-22 H.J. Lu + * elf32-i386.c (elf_i386_merge_gnu_properties): If info->shstk is set, turn on GNU_PROPERTY_X86_FEATURE_1_SHSTK. (elf_i386_link_setup_gnu_properties): If info->shstk is set, diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index ee8219c..df16775 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -945,14 +945,16 @@ static const struct elf_i386_backend_data elf_i386_arch_bed = it isn't dynamic and 1. Has non-GOT/non-PLT relocations in text section. Or 2. Has no GOT/PLT relocation. + Local undefined weak symbol is always resolved to 0. */ #define UNDEFINED_WEAK_RESOLVED_TO_ZERO(INFO, GOT_RELOC, EH) \ ((EH)->elf.root.type == bfd_link_hash_undefweak \ - && bfd_link_executable (INFO) \ - && (elf_i386_hash_table (INFO)->interp == NULL \ - || !(GOT_RELOC) \ - || (EH)->has_non_got_reloc \ - || !(INFO)->dynamic_undefined_weak)) + && ((EH)->elf.forced_local \ + || (bfd_link_executable (INFO) \ + && (elf_i386_hash_table (INFO)->interp == NULL \ + || !(GOT_RELOC) \ + || (EH)->has_non_got_reloc \ + || !(INFO)->dynamic_undefined_weak)))) /* i386 ELF linker hash entry. */ diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 1a9bebe..957dcd9 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -1050,14 +1050,16 @@ static const struct elf_x86_64_backend_data elf_x86_64_arch_bed = it isn't dynamic and 1. Has non-GOT/non-PLT relocations in text section. Or 2. Has no GOT/PLT relocation. + Local undefined weak symbol is always resolved to 0. */ #define UNDEFINED_WEAK_RESOLVED_TO_ZERO(INFO, GOT_RELOC, EH) \ ((EH)->elf.root.type == bfd_link_hash_undefweak \ - && bfd_link_executable (INFO) \ - && (elf_x86_64_hash_table (INFO)->interp == NULL \ - || !(GOT_RELOC) \ - || (EH)->has_non_got_reloc \ - || !(INFO)->dynamic_undefined_weak)) + && ((EH)->elf.forced_local \ + || (bfd_link_executable (INFO) \ + && (elf_x86_64_hash_table (INFO)->interp == NULL \ + || !(GOT_RELOC) \ + || (EH)->has_non_got_reloc \ + || !(INFO)->dynamic_undefined_weak)))) /* x86-64 ELF linker hash entry. */