aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
2014-02-11daily updateAlan Modra1-1/+1
2014-02-10Mark symbol in executables if it matches dynamic_listH.J. Lu2-1/+11
bfd/ PR gold/16530 * elflink.c (bfd_elf_gc_mark_dynamic_ref_symbol): Mark symbol in executables if it matches dynamic_list. ld/testsuite/ PR gold/16530 * ld-elf/dynamic-1.c: New file. * ld-elf/dynamic-1.rd: Likewise. * ld-elf/dynamic-1.syms: Likewise. * ld-elf/shared.exp (build_tests): Add dynamic-1.
2014-02-10Add PR reference.Rainer Orth1-0/+1
2014-02-10binutils potfiles regenAlan Modra3-1507/+1925
Adds nds32 files to POTFILES.in
2014-02-10daily updateAlan Modra1-1/+1
2014-02-09powerpc relax_section and section contents cacheAlan Modra5-108/+100
This patch provides a means for backend relax_section support to increase the size of a section without needing to reallocate section contents. This helps reduce memory usage when the added space does not need to be written in relax_section, as is the case for powerpc. Writing the stubs later means a few tweaks are needed in the powerpc relocate_section function, but also removes some code duplication since the extra ld -r relocs can be written there too. * elf-bfd.h (struct elf_backend_data): Add caches_rawsize. * elfxx-target.h (elf_backend_caches_rawsize): Define. (elfNN_bed): Init new field. * elflink.c (elf_link_input_bfd): Handle caches_rawsize. * elf32-ppc.c (shared_stub_entry): Zero addi offset. (ppc_elf_relax_section): Don't reallocate section here, write stubs, or write out relocs for ld -r here.. (ppc_elf_relocate_section): ..instead write stubs here, and use existing code to write out relocs for ld -r. Fix offset adjustment on reloc for little-endian. (elf_backend_caches_rawsize): Define.
2014-02-09daily updateAlan Modra1-1/+1
2014-02-08daily updateAlan Modra1-1/+1
2014-02-07 * cache.c (bfd_cache_max_open): Cast RLIM_INFINITY to rlim_t.Rainer Orth2-1/+5
2014-02-07daily updateAlan Modra1-1/+1
2014-02-06daily updateAlan Modra1-1/+1
2014-02-05daily updateAlan Modra1-1/+1
2014-02-04Fix PowerPC targets minor memory leaks found by CoverityJan Kratochvil3-8/+44
bfd/ 2014-02-04 Jan Kratochvil <jan.kratochvil@redhat.com> * coff-rs6000.c (xcoff_write_archive_contents_big): Free OFFSETS in return paths. Three times. * elf64-ppc.c (ppc64_elf_link_hash_table_create): Free HTAB in all return paths. (ppc64_elf_tls_optimize): Free TOC_REF in return path. (ppc64_elf_edit_toc): Free USED in return path.
2014-02-04daily updateAlan Modra1-1/+1
2014-02-03Nios II large-GOT relocationsSandra Loosemore5-13/+143
2014-02-03 Sandra Loosemore <sandra@codesourcery.com> include/elf/ * nios2.h (R_NIOS2_GOT_LO, R_NIOS2_GOT_HA): New. (R_NIOS2_CALL_LO, R_NIOS2_CALL_HA): New. (R_NIOS2_ILLEGAL): Adjust. gas/ * config/tc-nios2.c (md_apply_fix): Test for new relocs. (nios2_special_reloc): Add %call_lo, %call_hiadj, %got_lo, %got_hiadj relocation operators. Sort table and add comment to explain ordering. (nios2_fix_adjustable): Test for new relocs. * doc/c-nios2.texi (Nios II Relocations): Document new relocation operators. bfd/ * reloc.c (BFD_RELOC_NIOS2_GOT_LO, BFD_RELOC_NIOS2_GOT_HA): New. (BFD_RELOC_NIOS2_CALL_LO, BFD_RELOC_NIOS2_CALL_HA): New. * libbfd.h: Regenerated. * bfd-in2.h: Regenerated. * elf32-nios2.c (elf_nios2_howto_table_rel): Add new relocations. (nios2_reloc_map): Likewise. (GOT_USED, CALL_USED): Renamed from GOT16_USED and CALL16_USED. Fixed all references. (nios2_elf32_relocate_section): Add new relocations. (nios2_elf32_check_relocs): Likewise. (nios2_elf32_gc_sweep_hook): Likewise.
2014-02-03ppc476 icache bug workaroundAlan Modra5-327/+611
This implements a work-around for an icache bug on 476 that can cause execution of stale instructions when control falls through from one page to the next. The idea is to prevent such fall-through by replacing the last instruction on a page with a branch to a patch area containing the instruction, then branch to the next page. The patch also fixes a number of bugs in the existing support for long branch trampolines. bfd/ * elf32-ppc.c (struct ppc_elf_link_hash_table): Add params. Delete emit_stub_syms, no_tls_get_addr_opt. Update all uses. (ppc_elf_link_params): New function. (ppc_elf_create_glink): Align .glink to 64 bytes for ppc476 workaround. (ppc_elf_select_plt_layout): Remove plt_style and emit_stub_syms parameters. Use htab->params instead. (ppc_elf_tls_setup): Remove no_tls_get_addr_opt parameter. (ppc_elf_size_dynamic_sections): Align __glink_PLTresolve to 64 bytes for ppc476 workaround. (struct ppc_elf_relax_info): New. (ppc_elf_relax_section): Exclude linker created sections and those too small to hold one instruction. Don't add another branch around trampolines on later relax passes. Don't generate trampolines for undefined symbols when !relocatable, nor for plugin symbols. Allocate space for ppc476 workaround patch area. Free fixups on error return path. (ppc_elf_relocate_section): Handle ppc476 workaround patching. * elf32-ppc.h (struct ppc_elf_params): New. (ppc_elf_select_plt_layout, ppc_elf_tls_setup): Update prototype. (ppc_elf_link_params): Declare. * section.c (SEC_INFO_TYPE_TARGET): Define. * bfd-in2.h: Regenerate. ld/ * emultempl/ppc32elf.em (no_tls_get_addr_opt, emit_stub_syms) plt_style): Delete. Adjust all refs to instead use.. (params): ..this. New variable. (ppc_after_open_output): New function. Tweak params and pass to ppc_elf_link_params. (ppc_after_open): Adjust ppc_elf_select_plt_layout call. (ppc_before_allocation): Adjust ppc_elf_tls_setup call. Enable relaxation for ppc476 workaround. (PARSE_AND_LIST_*): Add --{no-,}ppc476-workaround support. (LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS): Define.
2014-02-03daily updateAlan Modra1-1/+1
2014-02-02Correct Nios II GOT pointer initialization.Sandra Loosemore2-14/+53
2014-02-02 Sandra Loosemore <sandra@codesourcery.com> bfd/ * elf32-nios2.c (struct elf32_nios2_link_hash_table): Add h_gp_got field. (nios2_elf32_relocate_section): Use got_base to adjust GOT-pointer-relative relocations relative to _gp_got. (create_got_section): Create _gp_got symbol. (nios2_elf32_finish_dynamic_symbol): Make _gp_got absolute. (nios2_elf32_size_dynamic_sections): Set _gp_got offset.
2014-02-02daily updateAlan Modra1-1/+1
2014-02-01daily updateAlan Modra1-1/+1
2014-01-30Nios II CALL26 linker relaxationSandra Loosemore6-41/+1165
2014-01-30 Sandra Loosemore <sandra@codesourcery.com> bfd/ * bfd-in2.h: Update from reloc.c. * elf32-nios2.c: Include elf32-nios2.h. (elf_nios2_howto_table_rel): Add entry for R_NIOS2_CALL26_NOAT. (nios2_reloc_map): Likewise. (enum elf32_nios2_stub_type): Declare. (struct elf32_nios2_stub_hash_entry): Declare. (nios2_stub_hash_entry, nios2_stub_hash_lookup): New macros. (struct elf32_nios2_link_hash_entry): Add hsh_cache field. (struct elf32_nios2_link_hash_table): Add new fields bstab, stub_bfd, add_stub_section, layout_sections_again, stub_group, bfd_count, top_index, input_list, all_local_syms. (nios2_call26_stub_entry): New. (nios2_elf32_install_imm16): Move up in file. (nios2_elf32_install_data): Move up in file. (hiadj): Move up in file. (stub_hash_newfunc): New. (link_hash_newfunc): Initialize hsh_cache field. (STUB_SUFFIX): New. (nios2_stub_name): New. (nios2_get_stub_entry): New. (nios2_add_stub): New. (nios2_elf32_setup_section_lists): New. (nios2_elf32_next_input_section): New. (CALL26_SEGMENT): New. (MAX_STUB_SECTION_SIZE): New. (group_sections): New. (nios2_type_of_stub): New. (nios2_build_one_stub): New. (nios2_size_one_stub): New. (get_local_syms): New. (nios2_elf32_size_stubs): New. (nios2_elf32_build_stubs): New. (nios2_elf32_do_call26_relocate): Correct CALL26 overflow test. (nios2_elf32_relocate_section): Handle R_NIOS2_CALL26_NOAT. Add trampolines for R_NIOS2_CALL26 stubs. (nios2_elf32_check_relocs): Handle R_NIOS2_CALL26_NOAT. (nios2_elf32_gc_sweep_hook): Likewise. (nios2_elf32_link_hash_table_create): Initialize the stub hash table. (nios2_elf32_link_hash_table_free): New. (bfd_elf32_bfd_link_hash_table_free): Define. * elf32-nios2.h: New file. * libbfd.h: Update from reloc.c. * reloc.c (BFD_RELOC_NIOS2_CALL26_NOAT): New. gas/ * config/tc-nios2.c (md_apply_fix): Handle BFD_RELOC_NIOS2_CALL26_NOAT. (nios2_assemble_args_m): Likewise. (md_assemble): Likewise. gas/testsuite/ * gas/nios2/call26_noat.d: New. * gas/nios2/call26_noat.s: New. * gas/nios2/call_noat.d: New. * gas/nios2/call_noat.s: New. include/elf/ * nios2.h (elf_nios2_reloc_type): Add R_NIOS2_CALL26_NOAT. ld/ * Makefile.am (enios2elf.c, enios2linux.c): Update dependencies. * Makefile.in: Regenerated. * emulparams/nios2elf.sh (EXTRA_EM_FILE): Set. * emulparams/nios2linux.sh (EXTRA_EM_FILE): Set. * emultempl/nios2elf.em: New file. * gen-doc.texi (NIOSII): Set. * ld.texinfo (NIOSII): Set. ld/testsuite/ * ld-nios2/relax_call26.s: New. * ld-nios2/relax_call26_boundary.ld: New. * ld-nios2/relax_call26_boundary.s: New. * ld-nios2/relax_call26_boundary_c8.d: New. * ld-nios2/relax_call26_boundary_cc.d: New. * ld-nios2/relax_call26_boundary_d0.d: New. * ld-nios2/relax_call26_boundary_d4.d: New. * ld-nios2/relax_call26_boundary_d8.d: New. * ld-nios2/relax_call26_boundary_dc.d: New. * ld-nios2/relax_call26_boundary_f0.d: New. * ld-nios2/relax_call26_boundary_f4.d: New. * ld-nios2/relax_call26_boundary_f8.d: New. * ld-nios2/relax_call26_boundary_fc.d: New. * ld-nios2/relax_call26_cache.d: New. * ld-nios2/relax_call26_cache.ld: New. * ld-nios2/relax_call26_cache.s: New. * ld-nios2/relax_call26_multi.d: New. * ld-nios2/relax_call26_multi.ld: New. * ld-nios2/relax_call26_norelax.d: New. * ld-nios2/relax_call26_shared.d: New. * ld-nios2/relax_call26_shared.ld: New.
2014-01-31daily updateAlan Modra1-1/+1
2014-01-30daily updateAlan Modra1-1/+1
2014-01-29My patch to the binutils strip-10.d test was wrong. The osabi field should ↵Nick Clifton4-4/+15
always be set to ELFOSABI_GNU for binaries containing unique symbols. So I am reverting that patch and instead applying the patch below to fix up the targets that were triggering the test failure. bfd/ChangeLog 2014-01-29 Nick Clifton <nickc@redhat.com> * elf32-metag.c (elf_metag_post_process_headers): Call _bfd_elf_post_process_headers. * elf32-sh64.c (sh64_elf_copy_private_data): Call _bfd_elf_copy_private_data. * elf64-sh64.c (sh_elf64_copy_private_data_internal): Likewise. binutils/testsuite/ChangeLog 2014-01-29 Nick Clifton <nickc@redhat.com> * binutils-all/strip-10.d: Revert previous delta.
2014-01-29Following up on Tom's suggestion I am checking in a patch to replace the variousNick Clifton5-11/+81
bfd_xxx_set macros with static inline functions, so that we can avoid compile time warnings about comma expressions with unused values. * bfd-in.h (bfd_set_section_vma): Delete. (bfd_set_section_alignment): Delete. (bfd_set_section_userdata): Delete. (bfd_set_cacheable): Delete. * bfd.c (bfd_set_cacheable): New static inline function. * section.c (bfd_set_section_userdata): Likewise. (bfd_set_section_vma): Likewise. (bfd_set_section_alignment): Likewise. * bfd-in2.h: Regenerate.
2014-01-28When parsing a DW_FORM_ref_addr attribute the CU containing theNick Clifton2-0/+30
abbreviation may not be the current CU. Thus we need to make sure that when we read the abbreviation we use the correct CU. * dwarf2.c (find_abstract_instance_name): For DW_FORM_ref_addr attributes select the CU containing the abbreviation, which may not be the current CU.
2014-01-28daily updateAlan Modra1-1/+1
2014-01-27daily updateAlan Modra1-1/+1
2014-01-26daily updateAlan Modra1-1/+1
2014-01-25daily updateAlan Modra1-1/+1
2014-01-24Fixes powerpc64le ld segfaults when --emit-relocs is used.Alan Modra2-5/+11
ELFv2 needs fewer relocs to annotate plt call stubs. I correctly allocated a smaller buffer and wrote the proper relocs, but stupidly bumped the reloc count as for ELFv1. * elf64-ppc.c (ppc_build_one_stub): Correct reloc count passed to get_relocs for ELFv2.
2014-01-24daily updateAlan Modra1-1/+1
2014-01-23Issue a linker error if TLS sections are not adjacentH.J. Lu2-3/+29
Bad linker script may lead to TLS sections separated by non-TLS sections in output. This patch changes linker assert to a linker error to provide better linker diagnosis. PR ld/16498 * elf.c (_bfd_elf_map_sections_to_segments): Issue a linker error if TLS sections are not adjacent.
2014-01-23daily updateAlan Modra1-1/+1
2014-01-22Display the reference causing a shared library to be neededAlan Modra2-0/+7
Adds a section for --as-needed libraries to a linker map file, similar to what we do for archive libraries. bfd/ * elflink.c (elf_link_add_object_symbols): Call minfo for --as-needed. ld/ * ldlang.c (asneeded_list_head, asneeded_list_tail): New vars. (lang_init): Initialise them. (lang_print_asneeded): New function. (lang_process): Call lang_print_asneeded. * ldlang.h (struct asneeded_minfo): New. (asneeded_list_tail): Declare. * ldmain.c (add_archive_element): Improve archive map heading. * ldmisc.c (minfo): Stash --as-needed info.
2014-01-22Comment typoAlan Modra2-1/+5
* elf64-ppc.c (STK_LINKER): Comment typo fix.
2014-01-21Check incompatible existing default symbol definitionH.J. Lu2-5/+16
After resolving a versioned reference, foo@VER1, to a default versioned definition, foo@@VER1, from a shared object, we also merge it with the existing regular default symbol definition, foo. When foo is IFUNC and foo@@VER1 aren't, we will merge 2 incompatible definitions. This patch avoids merging foo@@VER1 definition with foo definition if one is IFUNC and the other isn't.
2014-01-22daily updateAlan Modra1-1/+1
2014-01-21Update comments for the last commitH.J. Lu1-2/+1
2014-01-21Don't check shared/export_dynamic/ref_dynamic for type mismatchH.J. Lu2-3/+7
There is nothing linker can do when a type mismatched default definition are made dynamic by info->shared, info->export_dynamic or h->ref_dynamic. But we do want to avoid exporting it when building PIE. Let's remove those checks. bfd/ PR ld/2404 * elflink.c (_bfd_elf_merge_symbol): Don't check info->shared, info->export_dynamic, nor !h->ref_dynamic for type mismatch when adding the default version. ld/testsuite/ PR ld/2404 * ld-elf/shared.exp: Add a PIE test for PR ld/2404.
2014-01-21daily updateAlan Modra1-1/+1
2014-01-20daily updateAlan Modra1-1/+1
2014-01-18daily updateAlan Modra1-1/+1
2014-01-17daily updateAlan Modra1-1/+1
2014-01-16Fix mips segfault on GOT access of absolute symbolAlan Modra2-4/+12
When a symbol is absolute, this code in mips_elf_record_got_page_entry entry = bfd_zalloc (sec->owner, sizeof (*entry)); segfaults. sec == bfd_abs_section_ptr and sec->owner == NULL. * elfxx-mips.c (mips_elf_record_got_page_entry): Pass in a mips_elf_traverse_got_arg* rather than mips_got_info*. Adjust caller. Alloc on output_bfd rather than symbol section owner.
2014-01-16daily updateAlan Modra1-1/+1
2014-01-15Revert the last changeH.J. Lu3-10/+10
It has been fixed by commit 4199e3b8669d0a36448687850374fdc2ad7240b6 Author: Alan Modra <amodra@gmail.com> Date: Wed Jan 15 21:50:55 2014 +1030 non-PIC references to __ehdr_start in pie and shared Rather than hacking every backend to not discard dynamic relocations against an undefined hidden __ehdr_start, make it appear to be defined early. We want __ehdr_start hidden before size_dynamic_sections so that it isn't put in .dynsym, but we do need the dynamic relocations for a PIE or shared library with a non-PIC reference. Defining it early is wrong if we don't actually define the symbol later to its proper value. (In some cases we want to leave the symbol undefined, for example, when the ELF header isn't loaded, and we don't have this infomation available in before_allocation.) * elf32-i386.c (elf_i386_allocate_dynrelocs): Revert the last change. * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewise.
2014-01-14Don't discard relocs against __ehdr_startH.J. Lu3-4/+17
__ehdr_start will be defined by assign_file_positions_for_non_load_sections later. PR ld/16428 * elf32-i386.c (elf_i386_allocate_dynrelocs): Don't discard relocs against __ehdr_start. * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewise.
2014-01-14Revert the last changeH.J. Lu3-14/+10
* elf32-i386.c (elf_i386_allocate_dynrelocs): Revert the last change. * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewise.
2014-01-15daily updateAlan Modra1-1/+1