Add ELFv2 .localentry support.
authorAlan Modra <amodra@gmail.com>
Tue, 29 Oct 2013 05:07:43 +0000 (15:37 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 30 Oct 2013 03:10:21 +0000 (13:40 +1030)
commit6911b7dcb8ea17f8b811578dd4ac1ab7bb675e7b
tree0181671770254c68868ad161b4f207805969ef25
parentee67d69a3ff0eed25d98c5e97ed6c3ede8069edc
Add ELFv2 .localentry support.

This defines the ELF symbol st_other field used to encode the number
of instructions between a function "global entry" and its "local entry",
and adds support related to the local entry offset.

include/elf/
* ppc64.h (STO_PPC64_LOCAL_BIT, STO_PPC64_LOCAL_MASK): Define.
(ppc64_decode_local_entry, ppc64_encode_local_entry): New functions.
(PPC64_LOCAL_ENTRY_OFFSET, PPC64_SET_LOCAL_ENTRY_OFFSET): Define.
bfd/
* elf64-ppc.c (struct ppc_stub_hash_entry): Add "other".
(stub_hash_newfunc): Init new ppc_stub_hash_entry field, and one
we forgot, "plt_ent".
(ppc64_elf_add_symbol_hook): Check ELFv1 objects don't have
st_other bits only valid in ELFv2.
(ppc64_elf_merge_symbol_attribute): New function.
(ppc_type_of_stub): Add local_off param to test branch range.
(ppc_build_one_stub): Adjust destinations for ELFv2 locals.
(ppc_size_one_stub, toc_adjusting_stub_needed): Similarly.
(ppc64_elf_size_stubs): Pass local_off to ppc_type_of_stub.
Set "other" field.
(ppc64_elf_relocate_section): Adjust destination for ELFv2 local
calls.
gas/
* config/tc-ppc.c (md_pseudo_table): Add .localentry.
(ppc_elf_localentry): New function.
(ppc_force_relocation): Force relocs on all branches to localenty
symbols.
(ppc_fix_adjustable): Don't reduce such symbols to section+offset.
binutils/
* readelf.c (get_ppc64_symbol_other): New function.
(get_symbol_other): Use it for EM_PPC64.
bfd/ChangeLog
bfd/elf64-ppc.c
binutils/ChangeLog
binutils/readelf.c
gas/ChangeLog
gas/config/tc-ppc.c
include/elf/ChangeLog
include/elf/ppc64.h