(ppc_elf_check_relocs): Separate dynrel counts for local syms
into ifunc and non-ifunc.
(allocate_dynrelocs): Always put ifunc relocs into reliplt.
(ppc_elf_size_dynamic_sections): Likewise.
(ppc_elf_relocate_section): Likewise.
masks for all local ifunc syms.
(allocate_dynrelocs): Don't use htab->relgot for ifunc.
(ppc_elf_size_dynamic_sections): Likewise.
(ppc_elf_relocate_section): Likewise.
2013-03-20 Will Newton <will.newton@linaro.org>
* elf32-arm.c (elf32_arm_final_link_relocate): Avoid emitting a
dynamic reloc for symbols with dynindx == -1.
(allocate_dynrelocs_for_symbol): Avoid allocating space for a
dynamic reloc for symbols with dynindx == -1.
2013-03-20 Will Newton <will.newton@linaro.org>
* elf32-arm.c (elf32_arm_final_link_relocate): Avoid emitting a
dynamic reloc for symbols with dynindx == -1.
(allocate_dynrelocs_for_symbol): Avoid allocating space for a
dynamic reloc for symbols with dynindx == -1.
usual common symbols as well as for dynamic. Add poldbfd param.
Save old bfd. Adjust callers.
(_bfd_elf_add_default_symbol): Add poldbfd param. Pass "section"
and "value" by value, not pointer. Adjust caller.
(elf_link_add_object_symbols): Combine undef_bfd and old_bfd vars.
Delete code to set same. Use old_bfd and old_alignment from
_bfd_elf_merge_symbol instead. Add default symbol before
alignment and size checks. Wrap overlong lines.
(_bfd_elf_init_reloc_shdr): Delete.
* elf.c (_bfd_elf_init_reloc_shdr): Make static.
* elf64-x86-64.c (elf_x86_64_merge_symbol): Trim parameters to
just what is needed.
* elflink.c (_bfd_elf_merge_symbol): Update bed->merge_symbol call.
* elflink.c (elf_link_add_object_symbols): Don't set def_regular
or ref_regular for BFD_PLUGIN owned syms, or have them affect
def_dynamic/ref_dynamic.
(_bfd_elf_fix_symbol_flags): Don't set def_regular for BFD_PLUGIN
owned syms.
* peicode.h (coff_real_object_p): Add prototype.
(FILHDR): Defined for COFF_IMAGE_WITH_PE as
external_PEI_IMAGE_hdr structure.
(coff_swap_filehdr_in): Handle variable header-size.
* peXXigen.c (_bfd_XXi_swap_aouthdr_in): Just handle amount
of directory-entiries as specified in pe-header.
* elflink.c (_bfd_elf_make_dynamic_reloc_section): Override
sh_type according to is_rela.
ld/testsuite/
* ld-elf/rel.c, ld-elf/relmain.c, ld-elf/relmain.out: New test.
* ld-elf/shared.exp: Build and run it.
gc-section support.
(elf64_aarch64_gc_sweep_hook): Handle GOT, TLS and PLT related relocs.
* lib/ld-lib.exp (check_gc_sections_available): Remove aarch64
from list of
targets that don't support gc-section.
* elf.c (elfcore_write_s390_tdb): New function.
(elfcore_write_register_note): Call it.
(elfcore_grok_s390_tdb): New function.
(elfcore_grok_note): Call it.
* readelf.c (get_note_type): Add NT_S390_TDB.
bfd/
PR ld/15167
* elf64-ia64-vms.c (elf64_vms_link_add_object_symbols): Set
unique_global only for definition.
* elflink.c (_bfd_elf_merge_symbol): Don't set unique_global
here.
(elf_link_add_object_symbols): Set unique_global only
for definition.
ld/testsuite/
PR ld/15167
* ld-unique/unique.exp: Add a test for shared library with
reference.
PR binutils/15151
* archive.c (_bfd_find_nested_archive): Don't allow a nested
archive pointing to itself.
(_bfd_get_elt_at_filepos): Revert the last 2 changes.
* elfxx-mips.c (mips_got_page_ref): New structure.
(mips_got_page_entry): Use a section rather than a (bfd, symndx)
pair to represent the anchor point.
(mips_got_info): Add a got_page_refs field.
(mips_elf_link_hash_table): Add a sym_cache field.
(mips_got_page_ref_hash, mips_got_page_ref_eq): New functions.
(mips_got_page_entry_hash, mips_got_page_entry_eq): Update for
new anchor representation.
(mips_elf_create_got_info): Create got_page_refs rather than
got_page_entries.
(mips_elf_record_got_page_ref): New function.
(mips_elf_pages_for_range): Move further down file.
(mips_elf_record_got_page_entry): Likewise. Take a got as argument.
Use a section rather than a (bfd, symndx) pair to represent the
anchor point.
(mips_elf_resolve_got_page_ref): New function.
(mips_elf_resolve_final_got_entries): Use it to populate
got_page_entries.
(_bfd_mips_elf_check_relocs): Call mips_elf_record_got_page_ref
rather than mips_elf_record_got_page_entry. Only nullify h
afterwards.
(mips_elf_lay_out_got): Call mips_elf_resolve_final_got_entries
earlier.
ld/testsuite/
* ld-mips-elf/mips16-pic-2.dd,
ld-mips-elf/mips16-pic-2.gd: Remove 3 unused local GOT entries.
* ld-mips-elf/got-page-4a.s, ld-mips-elf/got-page-4b.s,
ld-mips-elf/got-page-4a.d, ld-mips-elf/got-page-4a.got,
ld-mips-elf/got-page-4b.d, ld-mips-elf/got-page-4b.got,
ld-mips-elf/got-page-5.s, ld-mips-elf/got-page-5.d,
ld-mips-elf/got-page-5.got, ld-mips-elf/got-page-6.s,
ld-mips-elf/got-page-6.d, ld-mips-elf/got-page-6.got,
ld-mips-elf/got-page-7a.s, ld-mips-elf/got-page-7b.s,
ld-mips-elf/got-page-7c.s, ld-mips-elf/got-page-7d.s,
ld-mips-elf/got-page-7e.s, ld-mips-elf/got-page-7.d,
ld-mips-elf/got-page-7.got: New tests.
* ld-mips-elf/mips-elf.exp: Run them.
* elfxx-mips.c (mips_elf_count_got_entries): Delete.
(mips_elf_check_recreate_got, mips_elf_recreate_got): Take a
mips_elf_traverse_got_arg. Count GOT entries.
(mips_elf_resolve_final_got_entries): Take the bfd_link_info
as argument. Update after above changes.
(mips_elf_merge_got, mips_elf_lay_out_got): Don't call
mips_elf_count_got_entries. Update the calls to
mips_elf_resolve_final_got_entries.
* elfxx-mips.c (mips_got_tls_type): New enum.
(mips_got_entry): Add tls_initialized.
(mips_elf_got_entry_hash, mips_elf_got_entry_eq, mips_tls_got_relocs)
(mips_elf_count_got_entry, mips_elf_initialize_tls_index): Remove
GOT_TLS_TYPE masks.
(mips_elf_reloc_tls_type, mips_tls_got_entries)
(mips_elf_record_global_got_symbol, mips_elf_initialize_tls_index)
(_bfd_mips_elf_finish_dynamic_symbol): Use GOT_TLS_NONE rather
than GOT_NORMAL.
(mips_elf_initialize_tls_slots): Replace got_offset and tls_type_p
arguments with a GOT entry. Remove GOT_TLS_TYPE masks. Use
tls_initialized rather than GOT_TLS_DONE.
(mips_tls_got_index): Delete.
(mips_elf_local_got_index, mips_elf_global_got_index): Use
mips_elf_initialize_tls_slots rather than mips_tls_got_index.
(mips_elf_record_got_entry): Initialize tls_initialized.
* elfxx-mips.c (mips_got_entry): Remove tls_ldm_offset.
(mips_elf_link_hash_entry): Remove tls_ie_type, tls_gd_type,
tls_ie_got_offset and tls_gd_got_offset.
(mips_elf_link_hash_newfunc): Remove initialization.
(mips_elf_create_got_info): Likewise.
(mips_elf_count_local_got_entries, mips_elf_count_global_tls_entries)
(mips_tls_single_got_index): Delete.
(mips_elf_local_got_index): Always use the GOT entry to track
GOT indices.
(mips_elf_global_got_index): Likewise.
(mips_elf_create_local_got_entry): Assert that TLS entries have
already been allocated.
(mips_elf_record_global_got_symbol): Don't initialize
tls_ie_type or tls_gd_type.
(mips_elf_count_got_symbols): Only count reloc-only GOT entries here.
(mips_elf_initialize_tls_index): Allocate a GOT index for every TLS
entry.
(mips_elf_lay_out_got): Use mips_elf_count_got_entries to count
the GOT entries.
(_bfd_mips_elf_finish_dynamic_symbol): Assert that TLS GOT offsets
have been allocated.
(_bfd_mips_elf_copy_indirect_symbol): Remove handling of
tls_ie_type and tls_gd_type.
* elfxx-mips.c (mips_elf_primary_global_got_index): New function,
split out from...
(mips_elf_global_got_index): ...here. Reorder arguments so that
the output bfd and info come first.
(mips_elf_calculate_relocation): Update the call to
mips_elf_global_got_index accordingly.
(_bfd_mips_elf_finish_dynamic_symbol): Use
mips_elf_primary_global_got_index rather than
mips_elf_global_got_index.
(_bfd_mips_vxworks_finish_dynamic_symbol): Likewise.
* elfxx-mips.c (mips_got_info): Remove bfd2got.
(mips_elf_bfd2got_hash): Delete.
(mips_elf_got_per_bfd_arg): Remove bfd2got.
(mips_elf_replace_bfd_got, mips_elf_count_got_entries): New functions.
(mips_elf_global_got_index, mips_elf_create_local_got_entry): Use
g->next to test for the multigot case. Use mips_elf_bfd_got rather
than mips_elf_got_for_ibfd.
(mips_elf_bfd2got_entry_hash, mips_elf_bfd2got_entry_eq)
(mips_elf_got_for_ibfd, mips_elf_get_got_for_bfd): Delete.
(mips_elf_make_got_per_bfd): Replace with...
(mips_elf_add_got_entry): ...this new function.
(mips_elf_make_got_pages_per_bfd): Replace with...
(mips_elf_add_got_page_entry): ...this new function.
(mips_elf_merge_got_with): Replace bfd2got argument with separate
bfd and GOT arguments. Use mips_elf_add_got_entry and
mips_elf_add_got_page_entry instead of mips_elf_make_got_per_bfd
and mips_elf_make_got_pages_per_bfd. Use mips_elf_replace_bfd_got
to set the BFD's GOT and free the old table.
(mips_elf_merge_got): Replace bfd2got argument with separate
bfd and GOT arguments. Apply mips_elf_resolve_final_got_entries.
Use mips_elf_count_got_entries to count the number of entries in
each GOT. Update the calls to mips_elf_merge_got_with.
(mips_elf_adjust_gp): Use g->next to test for the multigot case.
Use mips_elf_bfd_got rather than mips_elf_got_for_ibfd.
(mips_elf_multi_got): Don't create the bfd2got hash table.
Replace hash table traversal with a walk over the input bfds,
updating the call to mips_elf_merge_got. Use mips_elf_replace_bfd_got
to set the output bfd's GOT.
(mips_elf_lay_out_got): Rename "sub" to "ibfd". Record that all
bfds use the master GOT in the single-GOT case.
(_bfd_mips_elf_finish_dynamic_sections): Use mips_elf_bfd_got
rather than mips_elf_got_for_ibfd.
ld/testsuite/
* ld-mips-elf/tls-hidden4.got, ld-mips-elf/tls-multi-got-1.d,
ld-mips-elf/tls-multi-got-1.got: Update for changes in the order
that symbols are added to per-bfd GOTs.
* elfxx-mips.c (mips_elf_obj_tdata): Add a got field.
(mips_elf_bfd_got, mips_elf_record_got_entry): New functions.
(mips_elf_record_global_got_symbol): Update the hash entry before
adding the mips_got_entry. Use mips_elf_record_got_entry to do
the latter.
(mips_elf_record_local_got_symbol): Use mips_elf_record_got_entry.
(mips_elf_record_got_page_entry): Record the entry in both the
master and bfd GOTs.
* elfxx-mips.c (mips_elf_recreate_got): Don't change the entry;
create another one if necessary.
(mips_elf_set_gotidx): New function.
(mips_elf_set_global_gotidx): Use it.
(mips_elf_initialize_tls_index): Likewise. Take a
mips_elf_traverse_got_arg as argument.
(mips_elf_lay_out_got): Update use of mips_elf_initialize_tls_index.
(mips_elf_multi_got): Likewise. Cope with error returns from
mips_elf_set_global_gotidx.
* elfxx-mips.c (mips_got_info): Add relocs field.
(mips_elf_set_global_got_offset_arg, mips_elf_count_tls_arg): Replace
with...
(mips_elf_traverse_got_arg): ...this new structure.
(mips_elf_count_local_tls_relocs): Delete.
(mips_elf_count_global_tls_relocs): Likewise.
(mips_elf_count_got_entry): New function.
(mips_elf_count_local_got_entries): Likewise.
(mips_elf_count_global_tls_entries): Take a mips_elf_traverse_got_arg
rather than a mips_elf_count_tls_arg. Count both relocs and entries.
(mips_elf_record_local_got_symbol): Don't count got entries here.
(mips_elf_make_got_per_bfd): Use mips_elf_count_got_entry.
(mips_elf_set_global_got_offset): Split into...
(mips_elf_set_global_got_area, mips_elf_set_global_gotidx): ...these
new functions. Take a mips_elf_traverse_got_arg rather than a
mips_elf_set_global_got_offset_arg. Don't count TLS relocs here.
Use g->relocs to record the number of relocs needed for global GOT
entries.
(mips_elf_multi_got): Use mips_elf_traverse_got_arg rather than
mips_elf_set_global_got_offset_arg. Use the relocs field to count
relocations. Update for above function split.
(mips_elf_lay_out_got): Use mips_elf_count_local_got_entries
to count both the number of GOT entries and the number of TLS
relocs required by local entries. Likewise
mips_elf_count_global_tls_entries and global entries.
Remove uses of mips_elf_count_local_tls_relocs and
mips_elf_count_global_tls_relocs.
* elfxx-mips.c (mips_got_entry): Update comment above tls_type entry
to say that each structure represents only one type of TLS reference.
(GOT_TLS_TYPE): New define.
(mips_elf_link_hash_entry): Temporarily split tls_type and
tls_got_offset into two variables each.
(mips_elf_link_hash_newfunc): Update accordingly.
(mips_elf_got_entry_eq, mips_elf_got_entry_hash)
(mips_elf_multi_got_entry_eq): Require the tls_type to be the same.
(mips_elf_reloc_tls_type, mips_tls_got_entries): New functions.
(mips_tls_got_relocs): Use a switch statement.
(mips_elf_count_global_tls_entries): Handle the new hash entry fields.
(mips_elf_initialize_tls_slots): Use a switch statement. Avoid
local "offset" variable.
(mips_tls_got_index): Remove r_type argument and assert. Remove
code that handled entries with two TLS types; always use the
original got_index instead.
(mips_tls_single_got_index): New function.
(mips_elf_local_got_index): Use entry->tls_type to check for
TLS entries. Use mips_tls_single_got_index. Update call to
mips_tls_got_index.
(mips_elf_global_got_index): Use mips_elf_reloc_tls_type.
Use p->tls_type to check for TLS entries. Update call to
mips_tls_got_index. Use mips_tls_single_got_index.
(mips_elf_create_local_got_entry): Use mips_elf_reloc_tls_type.
Use entry.tls_type to check for TLS entries.
(mips_elf_record_global_got_symbol): Replace tls_flag argument
with r_type argument. Use mips_elf_reloc_tls_type.
Set up the new hash entry fields.
(mips_elf_record_local_got_symbol): Replace tls_flag argument
with r_type argument. Use mips_elf_reloc_tls_type and
mips_tls_got_entries. Remove code that handled entries
with multiple TLS types.
(mips_elf_make_got_per_bfd): Use mips_tls_got_entries.
(mips_elf_initialize_tls_index): Handle new hash entry fields.
Use equality rather than masks when checking for specific TLS types.
Use mips_tls_got_entries. Remove code that handled entries
with multiple TLS types.
(mips_elf_calculate_relocation): Use TLS_RELOC_P instead of
testing the hash table entry.
(_bfd_mips_elf_check_relocs): Update calls to
mips_elf_record_global_got_symbol and mips_elf_record_local_got_symbol.
(_bfd_mips_elf_finish_dynamic_symbol): Don't check h->type.
(_bfd_mips_elf_copy_indirect_symbol): Handle new hash entry fields.
* elfxx-mips.c (mips_elf_create_got_info): New function.
(mips_elf_get_got_for_bfd, mips_elf_multi_got): Use it.
(mips_elf_create_got_section): Likewise.
* elfxx-mips.c (mips_elf_count_global_tls_entries)
(mips_elf_count_global_tls_relocs): Don't count indirect or
warning symbols.
(mips_elf_multi_got, mips_elf_lay_out_got): Assert that the right
number of TLS entries were allocated.
ld/testsuite/
* ld-mips-elf/tlsdyn-o32-2.got, ld-mips-elf/tlsdyn-o32-3.got: Remove
unused GOT entries.
* elf-bfd.h (struct elf_obj_tdata): Add elf_find_function_cache.
* elf.c (elf_find_function): Revert last change. Use new
tdata field rather than static vars for cache.
bfd/
PR ld/15107
* elflink.c (elf_link_output_extsym): Set STB_GNU_UNIQUE only if
symbol is defined in regular object.
ld/testsuite/
PR ld/15107
* ld-unique/unique_empty.s: Add reference to "b".
Pedro Alves <palves@redhat.com>
* Makefile.in (SOURCE_HFILES): Add `elf-linux-psinfo.h'.
* elf-bfd.h (elf_internal_linux_prpsinfo): New structure
declaration.
(elfcore_write_linux_prpsinfo32, elfcore_write_linux_prpsinfo64)
(elfcore_write_ppc32_linux_prpsinfo32): New declarations.
* elf-linux-psinfo.h: New file.
* elf.c: Include elf-linux-psinfo.h.
(elfcore_write_linux_prpsinfo32, elfcore_write_linux_prpsinfo64):
New functions.
* elf32-ppc.c: Include `elf-linux-psinfo.h'.
(elf_external_ppc_linux_prpsinfo32): New structure declaration.
(PPC_LINUX_PRPSINFO32_SWAP_FIELDS): New macro.
(elfcore_write_ppc_linux_prpsinfo32): New function.
"relocation" in error messages throughout file.
(ppc64_elf_relocate_section): Remove sibling call error message,
replace with "call lacks nop". Specially report errors for
branches to function entry points via OPD lookup and branches
to stubs. Remove NULL symbol handling now done by %T.
The "new" dtags options have been around for 14+ years, so there
shouldn't be a need to generate both new & old tags anymore.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* metag.h: New file.
* dis-asm.h (print_insn_metag): New declaration.
* metag.h: New file.
* Makefile.am: Add Meta.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.in: Add Meta.
* disassemble.c: Add Meta support.
* metag-dis.c: New file.
* Makefile.am: Add Meta.
* Makefile.in: Regenerate.
* archures.c (bfd_mach_metag): New.
* bfd-in2.h: Regenerate.
* config.bfd: Add Meta.
* configure: Regenerate.
* configure.in: Add Meta.
* cpu-metag.c: New file.
* elf-bfd.h: Add Meta.
* elf32-metag.c: New file.
* elf32-metag.h: New file.
* libbfd.h: Regenerate.
* reloc.c: Add Meta relocations.
* targets.c: Add Meta.
* Makefile.am: Add Meta.
* Makefile.in: Regenerate.
* config/tc-metag.c: New file.
* config/tc-metag.h: New file.
* configure.tgt: Add Meta.
* doc/Makefile.am: Add Meta.
* doc/Makefile.in: Regenerate.
* doc/all.texi: Add Meta.
* doc/as.texiinfo: Document Meta options.
* doc/c-metag.texi: New file.
* gas/metag/labelarithmetic.d: New file.
* gas/metag/labelarithmetic.s: New file.
* gas/metag/metacore12.d: New file.
* gas/metag/metacore12.s: New file.
* gas/metag/metacore21-invalid.l: New file.
* gas/metag/metacore21-invalid.s: New file.
* gas/metag/metacore21.d: New file.
* gas/metag/metacore21.s: New file.
* gas/metag/metacore21ext.d: New file.
* gas/metag/metacore21ext.s: New file.
* gas/metag/metadsp21-invalid.l: New file.
* gas/metag/metadsp21-invalid.s: New file.
* gas/metag/metadsp21.d: New file.
* gas/metag/metadsp21.s: New file.
* gas/metag/metadsp21ext.d: New file.
* gas/metag/metadsp21ext.s: New file.
* gas/metag/metafpu21.d: New file.
* gas/metag/metafpu21.s: New file.
* gas/metag/metafpu21ext.d: New file.
* gas/metag/metafpu21ext.s: New file.
* gas/metag/metag.exp: New file.
* gas/metag/tls.d: New file.
* gas/metag/tls.s: New file.
* Makefile.am: Add Meta.
* Makefile.in: Regenerate.
* configure.tgt: Add Meta.
* emulparams/elf32metag.sh: New file.
* emultempl/metagelf.em: New file.
* ld-elf/merge.d: Mark Meta as xfail.
* ld-gc/start.d: Skip this test on Meta.
* ld-gc/personality.d: Skip this test on Meta.
* ld-metag/external.s: New file.
* ld-metag/metag.exp: New file.
* ld-metag/pcrel.d: New file.
* ld-metag/pcrel.s: New file.
* ld-metag/shared.d: New file.
* ld-metag/shared.r: New file.
* ld-metag/shared.s: New file.
* ld-metag/stub.d: New file.
* ld-metag/stub.s: New file.
* ld-metag/stub_pic_app.d: New file.
* ld-metag/stub_pic_app.r: New file.
* ld-metag/stub_pic_app.s: New file.
* ld-metag/stub_pic_shared.d: New file.
* ld-metag/stub_pic_shared.s: New file.
* ld-metag/stub_shared.d: New file.
* ld-metag/stub_shared.r: New file.
* ld-metag/stub_shared.s: New file.
* binutils/readelf.c: (guess_is_rela): Add EM_METAG.
(dump_relocations): Add EM_METAG.
(get_machine_name): Correct case for Meta.
(is_32bit_abs_reloc): Add support for Meta ADDR32 reloc.
(is_none_reloc): Add support for Meta NONE reloc.