aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-x86-64.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-06-22 12:53:39 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-06-22 12:53:39 -0700
commit84da4cf89efed1df483914d06210daae79ce3eb8 (patch)
tree2f9ca1adae5db759df8a4d2c854a8febe9756708 /bfd/elf64-x86-64.c
parentd4c6ce5b011b03c7e4a84b530cba1f9b56441131 (diff)
downloadgdb-84da4cf89efed1df483914d06210daae79ce3eb8.zip
gdb-84da4cf89efed1df483914d06210daae79ce3eb8.tar.gz
gdb-84da4cf89efed1df483914d06210daae79ce3eb8.tar.bz2
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.
Diffstat (limited to 'bfd/elf64-x86-64.c')
-rw-r--r--bfd/elf64-x86-64.c12
1 files changed, 7 insertions, 5 deletions
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. */