diff options
author | Alan Modra <amodra@gmail.com> | 2015-09-18 16:17:49 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2015-09-18 16:38:03 +0930 |
commit | 7c9cf4158452094f4c463676e5122c5c4ce64de8 (patch) | |
tree | 0ffa90631c601f42f7c88145c3faef48e8d6fdab /bfd | |
parent | 975f8a9e3144e4d3d3f391e907c8bf94b23dc8b6 (diff) | |
download | gdb-7c9cf4158452094f4c463676e5122c5c4ce64de8.zip gdb-7c9cf4158452094f4c463676e5122c5c4ce64de8.tar.gz gdb-7c9cf4158452094f4c463676e5122c5c4ce64de8.tar.bz2 |
Add PowerPC64 ld --tls-get-addr-optimize.
Sometimes it may be of benefit to force use of the __tls_get_addr_opt
call stub even when the glibc being used during linking does not
advertise __tls_get_addr_opt.
bfd/
* elf64-ppc.h (struct ppc64_elf_params <tls_get_addr_opt>): Rename
from no_tls_get_addr_opt.
* elf64-ppc.c: Update for rename and inversion of tls_get_addr_opt.
(ppc64_elf_tls_setup): Set tls_get_addr_opt to 0 only when at
default of -1.
ld/
* emultempl/ppc64elf.em (params): Init tls_get_addr_opt field to -1.
(OPTION_TLS_GET_ADDR_OPT): Define.
(PARSE_AND_LIST_LONGOPTS): Handle --tls-get-addr-opt.
(PARSE_AND_LIST_OPTIONS, PARSE_AND_LIST_ARGS_CASES): Likewise.
* ld.texinfo: Document --tls-get-addr-optimize and
--no-tls-get-addr-optimize.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 8 | ||||
-rw-r--r-- | bfd/elf64-ppc.c | 16 | ||||
-rw-r--r-- | bfd/elf64-ppc.h | 2 |
3 files changed, 17 insertions, 9 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 26a0537..3e0c7b8 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +2015-09-18 Alan Modra <amodra@gmail.com> + + * elf64-ppc.h (struct ppc64_elf_params <tls_get_addr_opt>): Rename + from no_tls_get_addr_opt. + * elf64-ppc.c: Update for rename and inversion of tls_get_addr_opt. + (ppc64_elf_tls_setup): Set tls_get_addr_opt to 0 only when at + default of -1. + 2015-09-17 Alan Modra <amodra@gmail.com> PR 18867 diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index f179f6d..5ad5f48 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -8136,7 +8136,7 @@ ppc64_elf_tls_setup (struct bfd_link_info *info) htab->tls_get_addr_fd = ((struct ppc_link_hash_entry *) elf_link_hash_lookup (&htab->elf, "__tls_get_addr", FALSE, FALSE, TRUE)); - if (!htab->params->no_tls_get_addr_opt) + if (htab->params->tls_get_addr_opt) { struct elf_link_hash_entry *opt, *opt_fd, *tga, *tga_fd; @@ -8203,8 +8203,8 @@ ppc64_elf_tls_setup (struct bfd_link_info *info) } } } - else - htab->params->no_tls_get_addr_opt = TRUE; + else if (htab->params->tls_get_addr_opt < 0) + htab->params->tls_get_addr_opt = 0; } return _bfd_elf_tls_setup (info->output_bfd, info); } @@ -10125,7 +10125,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd, return FALSE; } - tls_opt = (!htab->params->no_tls_get_addr_opt + tls_opt = (htab->params->tls_get_addr_opt && htab->tls_get_addr_fd != NULL && htab->tls_get_addr_fd->elf.plt.plist != NULL); if (tls_opt || !htab->opd_abi) @@ -10310,7 +10310,7 @@ plt_stub_size (struct ppc_link_hash_table *htab, if (stub_entry->h != NULL && (stub_entry->h == htab->tls_get_addr_fd || stub_entry->h == htab->tls_get_addr) - && !htab->params->no_tls_get_addr_opt) + && htab->params->tls_get_addr_opt) size += 13 * 4; return size; } @@ -10354,7 +10354,7 @@ build_plt_stub (struct ppc_link_hash_table *htab, && plt_thread_safe && !((stub_entry->h == htab->tls_get_addr_fd || stub_entry->h == htab->tls_get_addr) - && !htab->params->no_tls_get_addr_opt)) + && htab->params->tls_get_addr_opt)) { bfd_vma pltoff = stub_entry->plt_ent->plt.offset & ~1; bfd_vma pltindex = ((pltoff - PLT_INITIAL_ENTRY_SIZE (htab)) @@ -11005,7 +11005,7 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) if (stub_entry->h != NULL && (stub_entry->h == htab->tls_get_addr_fd || stub_entry->h == htab->tls_get_addr) - && !htab->params->no_tls_get_addr_opt) + && htab->params->tls_get_addr_opt) p = build_tls_get_addr_stub (htab, stub_entry, loc, off, r); else p = build_plt_stub (htab, stub_entry, loc, off, r); @@ -13911,7 +13911,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, if (h != NULL && (h == htab->tls_get_addr_fd || h == htab->tls_get_addr) - && !htab->params->no_tls_get_addr_opt) + && htab->params->tls_get_addr_opt) { /* Special stub used, leave nop alone. */ } diff --git a/bfd/elf64-ppc.h b/bfd/elf64-ppc.h index 19f72b5..d035ffc 100644 --- a/bfd/elf64-ppc.h +++ b/bfd/elf64-ppc.h @@ -34,7 +34,7 @@ struct ppc64_elf_params bfd_signed_vma group_size; /* Whether to use a special call stub for __tls_get_addr. */ - int no_tls_get_addr_opt; + int tls_get_addr_opt; /* Whether to allow multiple toc sections. */ int no_multi_toc; |