aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.c
AgeCommit message (Collapse)AuthorFilesLines
2008-02-232008-02-22 H.J. Lu <hongjiu.lu@intel.com>H.J. Lu1-5/+8
PR ld/5788 * elflink.c (elf_create_symbuf): Correct buffer size and position.
2008-02-20PR 868Nick Clifton1-1/+2
* libbfd.c (bfd_realloc_or_free): New function. Performs like bfd_realloc, but if the (re)allocation fails, the pointer is freed. * libbfd-in.h: Prototype. * libbfd.h: Regenerate. * bfdio.c (bfd_bwrite): Use the new function. (bfd_seek): Likewise. * bfdwin.c:(bfd_get_file_window): Likewise. * elf-strtab.c (_bfd_elf_strtab_add): Likewise. * elf32-ppc.c (ppc_elf_relax_section): Likewise. * elf32-xtensa.c (vsprintf_msg): Likewise. * mach-o.c (bfd_mach_o_core_fetch_environment): Likewise. * stabs.c (_bfd_link_seciton_stabs): Likewise. * vms-misc.c (_bfd_vms_get_record): Likewise. * vms-tir.c (check_section): Likewise. * vms.c (vms_new_section_hook): Likewise. * elf32-arm.c (elf32_arm_section_map_add): Check that the allocation of sec_data->map succeeded before using it. * elflink.c (elf_link_output_sym): Do not overwrite finfo-> symshndxbuf until it is known that the reallocation succeeded.
2008-02-15include/Alan Modra1-4/+4
* bfdlink.h (struct bfd_link_hash_table): Delete creator field. (struct bfd_link_info): Add output_bfd. bfd/ * elflink.c: Replace all accesses to hash->creator field with output_bfd->xvec. * cofflink.c: Likewise. * coff-h8300.c: Likewise. * ecoff.c: Likewise. * elf32-m68hc1x.c: Likewise. * elf32-ppc.c: Likewise. * elf64-alpha.c: Likewise. * elf64-ppc.c: Likewise. * elf64-sparc.c: Likewise. * elfxx-mips.c: Likewise. * i386linux.c: Likewise. * m68klinux.c: Likewise. * sparclinux.c: Likewise. * sunos.c: Likewise. * xcofflink.c: Likewise. * linker.c: Likewise. (_bfd_link_hash_table_init): Don't store creator. ld/ * ldmain.h (output_bfd): Delete. * ldmain.c (output_bfd): Delete. Replace all occurrences of output_bfd with link_info.output_bfd. * ldcref.c: Likewise. * ldctor.c: Likewise. * ldemul.c: Likewise. * ldexp.c: Likewise. * ldfile.c: Likewise. * ldlang.c: Likewise. * ldmisc.c: Likewise. * ldwrite.c: Likewise. * pe-dll.c: Likewise. * emultempl/aix.em: Likewise. * emultempl/alphaelf.em: Likewise. * emultempl/armcoff.em: Likewise. * emultempl/armelf.em: Likewise. * emultempl/avrelf.em: Likewise. * emultempl/beos.em: Likewise. * emultempl/elf-generic.em: Likewise. * emultempl/elf32.em: Likewise. * emultempl/gld960.em: Likewise. * emultempl/hppaelf.em: Likewise. * emultempl/irix.em: Likewise. * emultempl/linux.em: Likewise. * emultempl/lnk960.em: Likewise. * emultempl/m68hc1xelf.em: Likewise. * emultempl/mmix-elfnmmo.em: Likewise. * emultempl/mmo.em: Likewise. * emultempl/pe.em: Likewise. * emultempl/pep.em: Likewise. * emultempl/ppc32elf.em: Likewise. * emultempl/ppc64elf.em: Likewise. * emultempl/scoreelf.em: Likewise. * emultempl/sh64elf.em: Likewise. * emultempl/spuelf.em: Likewise. * emultempl/sunos.em: Likewise. * emultempl/vanilla.em: Likewise. * emultempl/vxworks.em: Likewise. * emultempl/xtensaelf.em: Likewise. * emultempl/z80.em: Likewise. * ldlang.c (open_output): Don't return output, instead write link_info_output_bfd directly. * emultempl/alphaelf.em: Replace occurrences of link_info.hash->creator with link_info.output_bfd->xvec. * emultempl/hppaelf.em: Likewise. * emultempl/ppc32elf.em: Likewise. * emultempl/ppc64elf.em: Likewise. * emultempl/spuelf.em: Likewise.
2008-02-14 * elflink.c (compute_bucket_count): Warning fixes.Alan Modra1-4/+6
2008-01-21 * elflink.c (_bfd_elf_link_output_relocs): Correct error return.Alan Modra1-1/+1
2008-01-15bfd/Alan Modra1-2/+27
PR 5604 * elf-bfd.h (struct elf_backend_data): Add gc_keep. Remove param names from others. (_bfd_elf_gc_keep): Declare. * elfxx-target.h (elf_backend_gc_keep): Define. (elfNN_bed): Init new field. * elflink.c (_bfd_elf_gc_keep): New function. (bfd_elf_gc_sections): Call gc_keep. * elf64-ppc.c (elf_backend_gc_keep): Define. (struct _ppc64_elf_section_data): Move .opd related fields to a struct so they don't occupy the same storage. Adjust accesses throughout file. (ppc64_elf_gc_keep): New function, split out from.. (ppc64_elf_gc_mark_hook): ..here. Don't call _bfd_elf_gc_mark to mark .opd section, just set gc_mark. (ppc64_elf_edit_opd): Remove no_opd_opt parm. Don't set opd->adjust unless we are changing .opd. Test non-NULL opd->adjust at all accesses throughout file. * elf64-ppc.h (ppc64_elf_edit_opd): Update prototype. ld/ PR 5604 * ldlang.c (lang_gc_sections): Move code to set SEC_KEEP on entry syms to _bfd_elf_gc_keep. * emultempl/ppc64elf.em (ppc_before_allocation): Don't call ppc64_elf_edit_opd if no_opd_opt.
2008-01-112008-01-11 Tristan Gingold <gingold@adacore.com>Tristan Gingold1-2/+0
Eric Botcazou <ebotcazou@adacore.com> * elf32-ppc.c (ppc_elf_gc_sweep_hook): Exit early if generating a relocatable. * elf32-arm.c (elf32_arm_gc_sweep_hook): Likewise. * elf32-cris.c (cris_elf_gc_sweep_hook): Likewise. * elf32-hppa.c (elf32_hppa_gc_sweep_hook): Likewise. * elf32-i386.c (elf_i386_gc_sweep_hook): Likewise. * elf32-m32r.c (m32r_elf_gc_sweep_hook): Likewise. * elf32-m68k.c (elf_m68k_gc_sweep_hook): Likewise. * elf32-s390.c (elf_s390_gc_sweep_hook): Likewise. * elf32-sh.c (sh_elf_gc_sweep_hook): Likewise. * elf32-vax.c (elf_vax_gc_sweep_hook): Likewise. * elf32-xtensa.c (elf_xtensa_gc_sweep_hook): Likewise. * elf64-x86-64.c (elf64_x86_64_gc_sweep_hook): Likewise. * elf64-s390.c (elf_s390_gc_sweep_hook): Likewise. * elf64-ppc.c (ppc64_elf_gc_sweep_hook): Likewise. * elfxx-mips.c (_bfd_mips_elf_gc_sweep_hook): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_gc_sweep_hook): Likewise. * elflink.c (bfd_elf_gc_sections): Do not punt on relocatable output or executable output with relocations.
2008-01-07bfd/H.J. Lu1-0/+1
2008-01-07 H.J. Lu <hongjiu.lu@intel.com> PR ld/5522 * elflink.c (elf_link_input_bfd): Don't write out a section if its output section is marked with SEC_NEVER_LOAD. ld/testsuite/ 2008-01-07 H.J. Lu <hongjiu.lu@intel.com> PR ld/5522 * ld-elf/noload-3.d: New file. * ld-elf/noload-3.s: Likewise. * ld-elf/noload-3.t: Likewise.
2007-12-15bfd/Richard Sandiford1-74/+43
* elf-bfd.h (eh_cie_fde): Add u.fde.next_for_section and u.cie.gc_mark. (bfd_elf_section_data): Add fde_list. (elf_fde_list): New macro. (elf_obj_tdata): Add eh_frame_section. (elf_eh_frame_section): New macro. (_bfd_elf_gc_mark_reloc): Remove last parameter. (_bfd_elf_gc_mark_fdes): Declare. * elf-eh-frame.c (_bfd_elf_get_eh_frame_sec_info): Chain the FDEs for each input section. (mark_entry, _bfd_elf_gc_mark_fdes): New functions. * elflink.c (_bfd_elf_gc_mark_reloc): Remove is_eh parameter. (_bfd_elf_gc_mark): Update call accordingly. Mark the relocations againts the section's FDEs. Don't mark the bfd's elf_eh_frame_section. (bfd_elf_gc_sections): Parse each input bfd's .eh_frame before marking any input sections. Remove the current EH handling. * section.c (bfd_section): Remove gc_mark_from_eh. * ecoff.c (bfd_debug_section): Update initializer accordingly.
2007-12-15bfd/Richard Sandiford1-0/+3
* elf-bfd.h (eh_cie_fde): Add u.cie. Document how u.fde.cie_inf changes when removed == 0. (eh_frame_hdr_info): Add parsed_eh_frames. (_bfd_elf_begin_eh_frame_parsing): Declare. (_bfd_elf_parse_eh_frame): Declare. (_bfd_elf_end_eh_frame_parsing): Declare. * elf-eh-frame.c (_bfd_elf_begin_eh_frame_parsing): New function. (_bfd_elf_parse_eh_frame): New function, split out from _bfd_elf_discard_section_eh_frame. Make a first pass through the buffer to calculate the number of entries and CIEs. Allocate memory for them before the main loop. Replace current extended cie representation with a pair of pointers, one to the local eh_cie_fde and one to the full struct cie. Allocate a separate array of struct cies if not merging. Merge CIEs during the main loop and set up each u.cie.merged field. Point an FDE's cie_inf field directly at the local CIE. Initially assume that all entries should be removed. (_bfd_elf_end_eh_frame_parsing): New function. (_bfd_elf_discard_section_eh_frame): Assume that the section has already been parsed. Use a separate pass to mark entries that need to be kept. Use the u.cie.merged field to track a CIE's group representative. * elflink.c (bfd_elf_discard_info): Call _bfd_elf_parse_eh_frame before _bfd_elf_discard_section_eh_frame. Wrap loop with calls to _bfd_elf_begin_eh_frame_parsing and _bfd_elf_end_eh_frame_parsing.
2007-12-15bfd/Richard Sandiford1-168/+216
* elf-bfd.h (_bfd_elf_gc_mark_rsec, _bfd_elf_gc_mark_reloc): Declare. (_bfd_elf_gc_mark): Use elf_gc_mark_hook_fn. * elflink.c (init_reloc_cookie, fini_reloc_cookie) (init_reloc_cookie_rels, fini_reloc_cookie_rels): New functions, split out from... (bfd_elf_discard_info): ...here. (init_reloc_cookie_for_section): New function. (fini_reloc_cookie_for_section): Likewise. (_bfd_elf_gc_mark_rsec, _bfd_elf_gc_mark_reloc): New functions, split out from... (_bfd_elf_gc_mark): ...here. Use init_reloc_cookie_for_section and fini_reloc_cookie_for_section.
2007-11-20* elflink.c (elf_link_output_extsym): Weaken assertion: if --gc-section is ↵Nick Clifton1-4/+9
set, there may be no TLS segment. * lib/ld-lib.exp (check_gc_sections_available): New proc, based on the version in gcc/testsuite/lib/target-supports.exp. * ld-elf/eld.exp: Use check_gc_sections_available.
2007-11-19 * elf-bfd.h (bfd_elf_perform_complex_relocation): Update prototype.Alan Modra1-15/+11
* elflink.c (bfd_elf_perform_complex_relocation): Return status. Don't print reloc overflow message. * elf32-mep.c (mep_elf_relocate_section): Handle status from bfd_elf_perform_complex_relocation.
2007-10-31 * elf-bfd.h (bfd_elf_match_symbols_in_sections): Don't declare.Alan Modra1-17/+1
* elflink.c (bfd_elf_match_symbols_in_sections): Make static. Remove section name comparisons.
2007-10-18 PR ld/4424Alan Modra1-2/+36
* config.bfd (targ_selvecs): Add bfd_elf64_alpha_vec for alpha/FreeBSD. Add bfd_elf64_sparc_vec for sparc64/FreeBSD. Add bfd_elf32_i386_vec and bfd_efi_app_ia32_vec for i386/FreeBSD. (targ64_selvecs): Set for i386/FreeBSD. * elf-bfd.h (elf_backend_data): Add relocs_compatible. (_bfd_elf_default_relocs_compatible): Declare. (_bfd_elf_relocs_compatible): Declare. * elfxx-target.h (elf_backend_relocs_compatible): Define. (elfNN_bed): Init new relocs_compatible field. * elflink.c (_bfd_elf_default_relocs_compatible): New function. (_bfd_elf_relocs_compatible): New function. (elf_link_add_object_symbols): Call bed->relocs_compatible. * elf32-i386.c (elf_backend_relocs_compatible): Define. * elf64-alpha.c: Likewise. * elf64-sparc.c: Likewise. * elf64-x86-64.c: Likewise.
2007-10-16 * elflink.c (_bfd_elf_check_kept_section): Use the section rawsizeBob Wilson1-1/+3
values if they are set.
2007-10-12PR 5160Nick Clifton1-6/+5
* elflink.c (eval_symbol): Remove bufsz variable and use sizeof(symbuf) where necessary.
2007-09-30 * elflink.c: Formatting.Alan Modra1-120/+120
2007-09-30bfd/Alan Modra1-322/+126
* elflink.c (resolve_symbol): Handle symbols in SEC_MERGE sections. Don't test symbol st_shndx. Don't bother with bfd_link_hash_common symbols. Print longs rather than ints in debug messages. (eval_symbol): Replace "sym" and "advanced" params with "symp". Replace "addr" and "section_offset" params with "dot". Don't cast bfd_vma values to signed, cast them to bfd_signed_vma. (bfd_elf_perform_complex_relocation): Delete "output_bfd", "info", "local_syms" and "local_sections" params. Add "relocation". Delete code calculating relocation value. (evaluate_complex_relocation_symbols): Delete function. Fold into.. (elf_link_input_bfd): ..existing code examining relocs. * elf-bfd.h (bfd_elf_perform_complex_relocation): Update prototype. * elf32-mep.c (mep_elf_check_relocs): Delete function. (mep_elf_gc_sweep_hook, mep_elf_gc_mark_hook): Likewise. (mep_elf_object_p): Don't set elf_bad_symtab. (elf_backend_check_relocs): Don't define. (elf_backend_gc_mark_hook, elf_backend_gc_sweep_hook): Likewise. (elf_backend_can_gc_sections, USE_RELA): Likwise. (mep_elf_relocate_section): Move bfd_elf_perform_complex_relocation call after we have calculated reloc value. Delete local sym debug code. Use RELOC_FOR_GLOBAL_SYMBOL. Delete addend adjusting code.. (elf_backend_rela_normal): ..instead define this. ld/testsuite/ * ld-selective/sel-dump.exp: Add am33, m88k, mep to xfails. * ld-selective/selective.exp: Don't run for same target list we xfail sel-dump.
2007-09-26 * elflink.c (set_symbol_value): Add isymbuf and locsymcountAlan Modra1-57/+59
params. Change symidx to a size_t. Don't access past end of symbol buffer. (resolve_symbol): Add isymbuf param and use instead of finfo->internal_syms. (eval_symbol, evaluate_complex_relocation_symbols): Likewise. (elf_link_input_bfd): Don't read symbols specially for evaluate_complex_relocation_symbols.
2007-09-18 * elf.c (bfd_section_from_shdr): Check bfd_alloc return.Alan Modra1-10/+48
(elfcore_write_note): Check realloc return. * elflink.c (_bfd_elf_link_find_version_dependencies): Check bfd_zalloc return. (_bfd_elf_link_assign_sym_version): Check bfd_malloc return. (elf_link_add_object_symbols): Likewise. (struct hash_codes_info): New. (elf_collect_hash_codes): Return bfd_malloc error. (struct collect_gnu_hash_codes): Add "error". (elf_collect_gnu_hash_codes): Return bfd_malloc error. (bfd_elf_size_dynamic_sections): Check return status of _bfd_elf_link_find_version_dependencies. (bfd_elf_size_dynsym_hash_dynstr): Adjust for elf_collect_hash_codes and elf_collect_gnu_hash_codes changes. (elf_sym_name_compare): Formatting. (elf_fixup_link_order): Use bfd_malloc, not xmalloc.
2007-09-18bfd/H.J. Lu1-1/+0
2007-09-17 H.J. Lu <hongjiu.lu@intel.com> PR binutils/3281 PR binutils/5037 * elf-bfd.h (elf_obj_tdata): Remove relro. * elf.c (get_program_header_size): Check info->relro instead of elf_tdata (abfd)->relro. (_bfd_elf_map_sections_to_segments): Likewise. (assign_file_positions_for_load_sections): Don't set PT_GNU_RELRO segment alignment here. (assign_file_positions_for_non_load_sections): Properly set up PT_GNU_RELRO segment for copying executable/shared library. (rewrite_elf_program_header): Remove PT_GNU_RELRO segment. (copy_elf_program_header): Set p_size and p_size_valid fields for PT_GNU_RELRO segment. include/elf/ 2007-09-17 H.J. Lu <hongjiu.lu@intel.com> PR binutils/3281 PR binutils/5037 * internal.h (elf_segment_map): Add p_size and p_size_valid. (ELF_IS_SECTION_IN_SEGMENT): Allow SHF_TLS sections in PT_GNU_RELRO segments. ld/ 2007-09-17 H.J. Lu <hongjiu.lu@intel.com> PR binutils/3281 PR binutils/5037 * ldexp.h (ldexp_control): Add relro, relro_start_stat and relro_end_stat. * ldexp.c (fold_binary): Set expld.dataseg.relro to exp_dataseg_relro_start or exp_dataseg_relro_end when seeing DATA_SEGMENT_ALIGN or DATA_SEGMENT_RELRO_END, respectively. * ldlang.c (lang_size_sections_1): Properly set expld.dataseg.relro_start_stat and expld.dataseg.relro_end_stat. (find_relro_section_callback): New function. (lang_find_relro_sections_1): Likewise. (lang_find_relro_sections): Likewise. (lang_process): Call lang_find_relro_sections for non-relocatable link. ld/testsuite/ 2007-09-17 H.J. Lu <hongjiu.lu@intel.com> PR binutils/3281 PR binutils/5037 * ld-elf/binutils.exp: Update "-z relro" tests to use relro1.s. Add "-z relro" tests with relro2.s. Add "-z relro" tests with TLS for objcopy. * ld-elf/relro1.s: New file. * ld-elf/relro2.s: Likewise.
2007-08-20Revision of previous delta using bfd_vma cast instead of 1L.Nick Clifton1-1/+1
2007-08-20* elflink.c (elf_fixup_link_order): Rewrite conversion of s->alignment_powerNick Clifton1-1/+1
into an offset mask in order to avoid a gcc error message.
2007-07-272007-07-26 Michael Snyder <msnyder@svkmacdonelllnx>Michael Snyder1-1/+2
* linker.c (bfd_section_already_linked_table_insert): Change return type from void to boolean. Return FALSE on failure. (_bfd_generic_section_already_linked): Test return value of bfd_section_already_linked_table_insert, call fatal on error. * elflink.c (_bfd_elf_section_already_linked): Test return value of bfd_section_already_linked_table_insert, call fatal on error. * libbfd-in.h (bfd_section_already_linked_table_insert): Update return type to bfd_boolean. * libbfd.h: Regenerate.
2007-07-26 * elflink.c (_bfd_elf_fix_symbol_flags): Remove unnecessaryAlan Modra1-13/+6
check on dynobj. Remove bed shadow.
2007-07-242007-07-24 Michael Snyder <msnyder@access-company.com>Michael Snyder1-1/+1
* elflink.c (bfd_elf_final_link): Avoid redundant frees -- return on bfd_malloc error rather than goto error_return.
2007-07-24 * elflink.c (_bfd_elf_link_just_syms, merge_sections_remove_hook,Alan Modra1-0/+721
_bfd_elf_merge_sections, _bfd_elf_link_hash_newfunc, _bfd_elf_link_hash_copy_indirect, _bfd_elf_link_hash_hide_symbol, _bfd_elf_link_hash_table_init, _bfd_elf_link_hash_table_create, bfd_elf_set_dt_needed_name, bfd_elf_get_dyn_lib_class, bfd_elf_set_dyn_lib_class, bfd_elf_get_needed_list, bfd_elf_get_runpath_list, bfd_elf_get_dt_soname, bfd_elf_get_bfd_needed_list, struct elf_symbuf_symbol, struct elf_symbuf_head, struct elf_symbol, elf_sort_elf_symbol, elf_sym_name_compare, elf_create_symbuf, bfd_elf_match_symbols_in_sections, _bfd_elf_match_sections_by_type): Move to here.. * elf.c: ..from here.
2007-07-23bfd/Richard Sandiford1-4/+5
* elflink.c (_bfd_elf_fix_symbol_flags): Only assert the type of weakdef->root.type if weakdef has no regular definition. ld/testsuite/ * ld-elf/weak-dyn-1a.s, ld-elf/weak-dyn-1b.s, ld-elf/weak-dyn-1.ld, * ld-elf/weak-dyn-1.rd: New test. * ld-elf/elf.exp: Run it.
2007-07-102007-07-09 H.J. Lu <hongjiu.lu@intel.com>H.J. Lu1-11/+34
* elflink.c (bfd_elf_record_link_assignment): Handle indirect symbol. (_bfd_elf_merge_symbol): Properly update normal symbol when overriding the versioned symbol from a dynamic library.
2007-07-06 * elflink.c (elf_link_add_object_symbols): Return viaAlan Modra1-4/+3
error_free_vers on "notice" failure.
2007-07-03Switch sources over to use the GPL version 3Nick Clifton1-2/+3
2007-06-29bfd:Joseph Myers1-0/+47
* elf-attrs.c: New. * Makefile.am (BFD32_BACKENDS): Add elf-attrs.lo. (BFD32_BACKENDS_CFILES): Add elf-attrs.c. (elf-attrs.lo): Generate dependencies. * Makefile.in: Regenerate. * configure.in (elf): Add elf-attrs.lo. * configure: Regenerate. * elf-bfd.h (struct elf_backend_data): Add entries for object attributes. (NUM_KNOWN_OBJ_ATTRIBUTES, obj_attribute, obj_attribute_list, OBJ_ATTR_PROC, OBJ_ATTR_GNU, OBJ_ATTR_FIRST, OBJ_ATTR_LAST, Tag_NULL, Tag_File, Tag_Section, Tag_Symbol, Tag_compatibility): New. (struct elf_obj_tdata): Add entries for object attributes. (elf_known_obj_attributes, elf_other_obj_attributes, elf_known_obj_attributes_proc, elf_other_obj_attributes_proc): New. (bfd_elf_obj_attr_size, bfd_elf_set_obj_attr_contents, bfd_elf_get_obj_attr_int, bfd_elf_add_obj_attr_int, bfd_elf_add_proc_attr_int, bfd_elf_add_obj_attr_string, bfd_elf_add_proc_attr_string, bfd_elf_add_obj_attr_compat, bfd_elf_add_proc_attr_compat, _bfd_elf_attr_strdup, _bfd_elf_copy_obj_attributes, _bfd_elf_obj_attrs_arg_type, _bfd_elf_parse_attributes, _bfd_elf_merge_object_attributes): New. * elf.c (_bfd_elf_copy_private_bfd_data): Copy object attributes. (bfd_section_from_shdr): Handle attributes sections. * elflink.c (bfd_elf_final_link): Handle attributes sections. * elfxx-target.h (elf_backend_obj_attrs_vendor, elf_backend_obj_attrs_section, elf_backend_obj_attrs_arg_type, elf_backend_obj_attrs_section_type): New. (elfNN_bed): Update. * elf32-arm.c (NUM_KNOWN_ATTRIBUTES, aeabi_attribute, aeabi_attribute_list): Remove. (struct elf32_arm_obj_tdata): Remove object attributes fields. (check_use_blx, bfd_elf32_arm_set_vfp11_fix, using_thumb2, elf32_arm_copy_private_bfd_data, elf32_arm_merge_eabi_attributes): Update for new object attributes interfaces. (uleb128_size, is_default_attr, eabi_attr_size, elf32_arm_eabi_attr_size, write_uleb128, write_eabi_attribute, elf32_arm_set_eabi_attr_contents, elf32_arm_bfd_final_link, elf32_arm_new_eabi_attr, elf32_arm_get_eabi_attr_int, elf32_arm_add_eabi_attr_int, attr_strdup, elf32_arm_add_eabi_attr_string, elf32_arm_add_eabi_attr_compat, copy_eabi_attributes, elf32_arm_parse_attributes): Remove. Moved to generic code in elf-attrs.c. (elf32_arm_obj_attrs_arg_type): New. (elf32_arm_fake_sections): Do not handle .ARM.attributes. (elf32_arm_section_from_shdr): Do not handle SHT_ARM_ATTRIBUTES. (bfd_elf32_bfd_final_link): Remove. (elf_backend_obj_attrs_vendor, elf_backend_obj_attrs_section, elf_backend_obj_attrs_arg_type, elf_backend_obj_attrs_section_type): New. * elf32-bfin.c (bfin_elf_copy_private_bfd_data): Copy object attributes. * elf32-frv.c (frv_elf_copy_private_bfd_data): Likewise. * elf32-iq2000.c (iq2000_elf_copy_private_bfd_data): Likewise. * elf32-mep.c (mep_elf_copy_private_bfd_data): Likewise. * elf32-mt.c (mt_elf_copy_private_bfd_data): Likewise. * elf32-sh.c (sh_elf_copy_private_data): Likewise. * elf64-sh64.c (sh_elf64_copy_private_data_internal): Likewise. binutils: * readelf.c (display_gnu_attribute): New. (process_arm_specific): Rearrange as process_attributes. (process_arm_specific): Replace by wrapper of process_attributes. gas: * as.c (create_obj_attrs_section): New. (main): Call create_obj_attrs_section for ELF. * read.c (s_gnu_attribute, skip_whitespace, skip_past_char, skip_past_comma, s_vendor_attribute): New. (potable): Add gnu_attribute for ELF. * read.h (s_vendor_attribute): Declare. * config/tc-arm.c (s_arm_eabi_attribute): Replace by wrapper round s_vendor_attribute. (aeabi_set_public_attributes): Update for new attributes interfaces. (arm_md_end): Remove attributes contents setting now done generically. include/elf: * arm.h (elf32_arm_add_eabi_attr_int, elf32_arm_add_eabi_attr_string, elf32_arm_add_eabi_attr_compat, elf32_arm_get_eabi_attr_int, elf32_arm_set_eabi_attr_contents, elf32_arm_eabi_attr_size, Tag_NULL, Tag_File, Tag_Section, Tag_Symbol, Tag_compatibility): Remove. * common.h (SHT_GNU_ATTRIBUTES): Define. ld: * emulparams/armelf.sh (OTHER_SECTIONS): Remove .ARM.attributes. (ATTRS_SECTIONS): Define. * scripttempl/elf.sc, scripttempl/elf32sh-symbian.sc, scripttempl/elf_chaos.sc, scripttempl/elfi370.sc, scripttempl/elfxtensa.sc: Handle ATTRS_SECTIONS.
2007-06-29 * elflink.c (_bfd_elf_link_assign_sym_version): Improve errorAlan Modra1-2/+2
message for undefined version nodes. (elf_gc_sweep): Don't warn when zero size sections are removed.
2007-05-162007-05-16 H.J. Lu <hongjiu.lu@intel.com>H.J. Lu1-16/+16
Alan Modra <amodra@bigpond.net.au> * elflink.c (_bfd_elf_adjust_dynamic_copy): Align dynamic bss section to the minimum alignment.
2007-05-152007-05-15 H.J. Lu <hongjiu.lu@intel.com>H.J. Lu1-0/+46
Alan Modra <amodra@bigpond.net.au> PR ld/4504 * elf-bfd.h (_bfd_elf_adjust_dynamic_copy): New. * elflink.c (_bfd_elf_adjust_dynamic_copy): New. * elf-m10300.c (_bfd_mn10300_elf_adjust_dynamic_symbol): Call _bfd_elf_adjust_dynamic_copy to adjust for the copy in dynamic bss section. * elf32-arm.c (elf32_arm_adjust_dynamic_symbol): Likewise. * elf32-cris.c (elf_cris_adjust_dynamic_symbol): Likewise. * elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Likewise. * elf32-i370.c (i370_elf_adjust_dynamic_symbol): Likewise. * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Likewise. * elf32-m32r.c (m32r_elf_adjust_dynamic_symbol): Likewise. * elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Likewise. * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Likewise. * elf32-s390.c (elf_s390_adjust_dynamic_symbol): Likewise. * elf32-sh.c (sh_elf_adjust_dynamic_symbol): Likewise. * elf32-vax.c (elf_vax_adjust_dynamic_symbol): Likewise. * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise. * elf64-s390.c (elf_s390_adjust_dynamic_symbol): Likewise. * elf64-sh64.c (sh64_elf64_adjust_dynamic_symbol): Likewise. * elf64-x86-64.c (elf64_x86_64_adjust_dynamic_symbol): Likewise. * elfxx-mips.c (_bfd_mips_vxworks_adjust_dynamic_symbol): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_adjust_dynamic_symbol): Likewise.
2007-05-11include/elf/Alan Modra1-8/+8
* spu.h (R_SPU_PPU32, R_SPU_PPU64): Define. bfd/ * reloc.c (BFD_RELOC_SPU_PPU32, BFD_RELOC_SPU_PPU64): Define. * elf-bfd.h (struct elf_backend_data): Change return type of elf_backend_relocate_section to int. * elf32-spu.c (elf_howto_table): Add howtos for R_SPU_PPU32 and R_SPU_PPU64. (spu_elf_bfd_to_reloc_type): Convert new relocs. (spu_elf_count_relocs): New function. (elf_backend_count_relocs): Define. (spu_elf_relocate_section): Arrange to emit R_SPU_PPU32 and R_SPU_PPU64 relocs. * elflink.c (elf_link_input_bfd): Emit relocs if relocate_section returns 2. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. gas/ * config/tc-spu.c (md_pseudo_table): Add int, long, quad. Call spu_cons for word. (md_assemble): Tidy use of insn.flag. (get_imm): Likewise. Handle uppercase input too. (spu_cons): New function. * config/tc-spu.h (tc_fix_adjustable): Don't adjust SPU_PPU relocs. (TC_FORCE_RELOCATION): Don't resolve them either. binutils/ * embedspu.sh (find_prog): Prefer prog in same dir as embedspu over one found on the users path. (main): Generate .reloc for each R_SPU_PPU* reloc.
2007-05-07 * elflink.c (bfd_elf_final_link): Correct reloc handling forAlan Modra1-5/+13
elf_backend_count_relocs. (bfd_elf_discard_info): Print an error if we can't read syms.
2007-05-042007-05-04 H.J. Lu <hongjiu.lu@intel.com>H.J. Lu1-4/+6
* elflink.c (elf_link_sort_relocs): Return if both .rela.dyn and .rel.dyn aren't present.
2007-05-04* elflink.c (elf_link_sort_relocs): If both .rela.dyn and .rel.dyn sectionsNick Clifton1-19/+152
are present examine the indirect sections in an attempt to compute the correct relocation size. If there is any ambiguity, produce an error and refuse to sort.
2007-04-26bfd/Alan Modra1-1/+1
Many files: Include sysdep.h before bfd.h. * Makefile.am: Run "make dep-am". * Makefile.in: Regenerate. binutils/ * bucumm.h: Split off host dependencies to.. * sysdep.h: ..here. Many files: Include sysdep.h. Remove duplicate headers and reorder. * Makefile.am: Run "make dep-am". * Makefile.in: Regenerate. ld/ Many files: Include sysdep.h first. Remove duplicate headers. * Makefile.am: Run "make dep-am". * Makefile.in: Regenerate. opcodes/ * Makefile.am: Run "make dep-am". * Makefile.in: Regenerate. * ns32k-dis.c: Include sysdep.h first.
2007-04-172007-04-17 Paul Brook <paul@codesourcery.com>Paul Brook1-15/+41
bfd/ * elf.c (_bfd_elf_is_function_type): New function. * elflink.c (_bfd_elf_merge_symbol): Use bed->is_function_type. (_bfd_elf_dynamic_symbol_p, _bfd_elf_symbol_refs_local_p, is_global_data_symbol_definition, elf_link_add_object_symbols): Ditto. * elf-bfd.h (elf_backend_data): Add is_function_type. (_bfd_elf_is_function_type): Add prototype. * elfxx-target.h (elf_backend_is_function_type): Add default definition. (elfNN_bed): Add elf_backend_is_function_type. * elf32-arm.c (elf32_arm_is_function_type): New function. (elf_backend_is_function_type): Define. ld/testsuite/ * ld-arm/preempt-app.s: New test. * ld-arm/preempt-app.sym: New. * ld-arm/arm-elf.exp: Add preempt-app.
2007-04-14 * elflink.c (bfd_elf_final_link): Don't free symbuf forJakub Jelinek1-10/+12
non-elf input bfds. (bfd_elf_size_dynamic_sections): Don't access elf_section_data for non-elf input bfds.
2007-04-05bfd/H.J. Lu1-2/+2
2007-04-05 H.J. Lu <hongjiu.lu@intel.com> PR ld/4304 * elflink.c (bfd_elf_final_link): Call einfo callback in bfd_link_info instead of _bfd_error_handler for DT_TEXTREL warning. ld/testsuite/ 2007-04-05 H.J. Lu <hongjiu.lu@intel.com> PR ld/4304 * ld-i386/i386.exp: Run "warn1". * ld-i386/warn1.d: New file. * ld-i386/warn1.s: Likewise.
2007-03-29 PR ld/4267Alan Modra1-2/+2
* elflink.c (evaluate_complex_relocation_symbols): Use bfd_vma for rel->r_info values. (bfd_elf_perform_complex_relocation): Likewise.
2007-03-07 PR 3958Alan Modra1-12/+4
bfd/ * elf-bfd.h (RELOC_FOR_GLOBAL_SYMBOL): No error on relocatable link. (elf_discarded_section): Move.. * bfd-in.h: ..to here. * bfd-in2.h: Regenerate. * elflink.c (elf_link_input_bfd): Don't zap relocs against symbols from discarded sections before relocate_section has done its job. * reloc.c (bfd_generic_get_relocated_section_contents): Handle relocs against symbols from discarded sections. * elf-hppa.h (elf_hppa_howto_table): Set size. Set dst_mask on SECREL32. (elf_hppa_relocate_section): Handle relocatable link after setting sec, sym, h etc. for final link. Squash error messages for relocatable link. Clear section contents for relocs against symbols in discarded sections, and zero reloc. Remove existing zero r_symndx code. * elf-m10200.c (mn10200_elf_relocate_section): Likewise. * elf-m10300.c (mn10300_elf_relocate_section): Likewise. * elf32-arm.c (elf32_arm_relocate_section): Likewise. * elf32-avr.c (elf32_avr_relocate_section): Likewise. * elf32-bfin.c (bfinfdpic_relocate_section): Likewise. (bfin_relocate_section): Likewise. * elf32-cr16c.c (elf32_cr16c_relocate_section): Likewise. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-crx.c (elf32_crx_relocate_section): Likewise. * elf32-d10v.c (elf32_d10v_relocate_section): Likewise. * elf32-fr30.c (fr30_elf_relocate_section): Likewise. * elf32-frv.c (elf32_frv_relocate_section): Likewise. * elf32-h8300.c (elf32_h8_relocate_section): Likewise. * elf32-hppa.c (elf32_hppa_relocate_section): Likewise. * elf32-i370.c (i370_elf_relocate_section): Likewise. * elf32-i386.c (elf_i386_relocate_section): Likewise. * elf32-i860.c (elf32_i860_relocate_section): Likewise. * elf32-ip2k.c (ip2k_elf_relocate_section): Likewise. * elf32-iq2000.c (iq2000_elf_relocate_section): Likewise. * elf32-m32c.c (m32c_elf_relocate_section): Likewise. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. * elf32-m68hc1x.c (elf32_m68hc11_check_relocs): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-mcore.c (mcore_elf_relocate_section): Likewise. * elf32-mep.c (mep_elf_relocate_section): Likewise. * elf32-msp430.c (elf32_msp430_relocate_section): Likewise. * elf32-mt.c (mt_elf_relocate_section): Likewise. * elf32-openrisc.c (openrisc_elf_relocate_section): Likewise. * elf32-ppc.c (ppc_elf_relocate_section): Likewise. * elf32-s390.c (elf_s390_relocate_section): Likewise. * elf32-score.c (_bfd_score_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf32-v850.c (v850_elf_relocate_section): Likewise. * elf32-vax.c (elf_vax_relocate_section): Likewise. * elf32-xc16x.c (elf32_xc16x_relocate_section): Likewise. * elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise. * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise. * elf64-alpha.c (elf64_alpha_relocate_section_r): Likewise. (elf64_alpha_relocate_section): Likewise. * elf64-mmix.c (mmix_elf_relocate_section): Likewise. * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. * elf64-s390.c (elf_s390_relocate_section): Likewise. * elf64-sh64.c (sh_elf64_relocate_section): Likewise. * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise. * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise. * elfxx-mips.c (_bfd_mips_elf_relocate_section): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise. * elf32-arm.c (elf32_arm_relocate_section): Always adjust section symbols for relocatable link. Don't use always-zero st_value. (elf_backend_rela_normal): Don't define. * elf32-bfin.c (bfinfdpic_relocate_section): Use RELOC_FOR_GLOBAL_SYMBOL. * elf32-frv.c (elf32_frv_relocate_section): Likewise. * elf32-d10v.c (elf32_d10v_relocate_section): Combine SEC_MERGE section symbol adjustments with same for relocatable link. * elf32-i386.c (elf_i386_relocate_section): Likewise. * elf32-m68hc1x.c (m68hc11_get_relocation_value): Move.. (elf32_m68hc11_check_relocs): ..to here. * elf32-score.c (score_elf_final_link_relocate): Remove zero r_symndx code. * elfxx-mips.c (mips_elf_calculate_relocation): Likewise. ld/testsuite/ * ld-elf/linkonce1.d: New. * ld-elf/linkonce1a.s: New. * ld-elf/linkonce1b.s: New. * ld-elf/linkonce2.d: New. * ld-i386/pcrel16abs.d: New. * ld-i386/pcrel16abs.s: New. * ld-i386/i386.exp: Run it.
2007-02-222007-02-22 Paul Brook <paul@codesourcery.com>Paul Brook1-8/+6
bfd/ * elflink.c (gc_mark_hook_fn): Remove. (_bfd_elf_gc_mark): Rename gc_mark_hook_fn to elf_gc_mark_hook_fn. (bfd_elf_gc_sections): Ditto. Call gc_mark_extra_sections. * elf-bfd.h (elf_gc_mark_hook_fn): Define. (elf_backend_data): Add gc_mark_extra_sections. * elfxx-target.h (elf_backend_gc_mark_extra_sections): Provide default definition. (elfNN_bed): Add elf_backend_gc_mark_extra_sections. * elf32-arm.c (elf32_arm_gc_mark_extra_sections): New function. (elf_backend_gc_mark_extra_sections): Define. ld/testsuite/ * ld-arm/arm-elf.exp (armelftests): Add gc-unwind.h. * ld-arm/gc-unwind.s: New file. * ld-arm/gc-unwind.d: New file.
2007-02-19 * elf-bfd.h (struct elf_backend_data): Add default_execstack.Alan Modra1-2/+2
* elflink.c (bfd_elf_size_dynamic_sections): Heed default_execstack. * elfxx-target.h (elf_backend_default_execstack): Define to 1. (elfNN_bed): Init new field. * elf64-ppc.c (elf_backend_default_execstack): Define to 0.
2007-02-14bfd/H.J. Lu1-0/+4
2007-02-14 H.J. Lu <hongjiu.lu@intel.com> PR ld/3953 * elflink.c (_bfd_elf_add_default_symbol): Check warning symbol when adding default symbol. ld/testsuite/ 2007-02-14 H.J. Lu <hongjiu.lu@intel.com> PR ld/3953 * ld-elf/beginwarn.c: New file. * ld-elf/warn.out: Likewise. * ld-elf/shared.exp (build_tests): Add "Build warn libbar.so". (run_tests): Add "Run warn with versioned libfoo.so". * lib/ld-lib.exp (default_ld_relocate): Make exec_output global and remove target first. (default_ld_link): Likewise. (default_ld_simple_link): Likewise. (run_ld_link_exec_tests): Take an optional linker warning and check it. (default_ld_link): Check pruned linker output.
2007-02-12 * elflink.c (evaluate_complex_relocation_symbols): Ignore relocsAlan Modra1-1/+4
with a zero symbol index.