aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorJiong Wang <jiong.wang@arm.com>2017-01-20 13:30:32 +0000
committerJiong Wang <jiong.wang@arm.com>2017-01-20 13:30:32 +0000
commit7f784814df7067396e9c00b5cdc0eff9cd5c68de (patch)
tree56139f5bfeca324ddefe8c90ad921cc617e8ef9c /bfd
parentadd3afb219e755e13f4ec1c91aa59223df31a965 (diff)
downloadgdb-7f784814df7067396e9c00b5cdc0eff9cd5c68de.zip
gdb-7f784814df7067396e9c00b5cdc0eff9cd5c68de.tar.gz
gdb-7f784814df7067396e9c00b5cdc0eff9cd5c68de.tar.bz2
[AArch64] Optimize .gnu.hash table size for executable
bfd/ * elfnn-aarch64.c (elf_aarch64_hash_symbol): New function. (elf_backend_hash_symbol): Define. ld/ * testsuite/ld-aarch64/aarch64-elf.exp (aarch64elflinktests): New tests. * testsuite/ld-aarch64/func-in-so.s: New test source file. * testsuite/ld-aarch64/func-sym-hash-opt.s: Likewise. * testsuite/ld-aarch64/func-sym-hash-opt.d: New expected test result.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elfnn-aarch64.c17
2 files changed, 22 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 624af08..f6841ef 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2017-01-20 Jiong Wang <jiong.wang@arm.com>
+
+ * elfnn-aarch64.c (elf_aarch64_hash_symbol): New function.
+ (elf_backend_hash_symbol): Define.
+
2017-01-18 Maciej W. Rozycki <macro@imgtec.com>
PR ld/20828
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 6ea2d35..213cf55 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -2708,6 +2708,22 @@ elfNN_aarch64_stub_name (const asection *input_section,
return stub_name;
}
+/* Return TRUE if symbol H should be hashed in the `.gnu.hash' section. For
+ executable PLT slots where the executable never takes the address of those
+ functions, the function symbols are not added to the hash table. */
+
+static bfd_boolean
+elf_aarch64_hash_symbol (struct elf_link_hash_entry *h)
+{
+ if (h->plt.offset != (bfd_vma) -1
+ && !h->def_regular
+ && !h->pointer_equality_needed)
+ return FALSE;
+
+ return _bfd_elf_hash_symbol (h);
+}
+
+
/* Look up an entry in the stub hash. Stub entries are cached because
creating the stub name takes a bit of time. */
@@ -9412,6 +9428,7 @@ const struct elf_size_info elfNN_aarch64_size_info =
#define elf_backend_got_header_size (GOT_ENTRY_SIZE * 3)
#define elf_backend_default_execstack 0
#define elf_backend_extern_protected_data 1
+#define elf_backend_hash_symbol elf_aarch64_hash_symbol
#undef elf_backend_obj_attrs_section
#define elf_backend_obj_attrs_section ".ARM.attributes"