Commit Graph

6661 Commits

Author SHA1 Message Date
Alan Modra 707cd11562 daily update 2008-03-12 23:00:05 +00:00
Bernd Schmidt 2774f1a679 From Jie Zhang <jie.zhang@analog.com>
* elf32-bfin.c (struct bfinfdpic_relocs_info): Make got17m4,
	gothilo, fd, fdgot17m4, fdgothilo, fdgoff17m4, fdgoffhilo,
	gotoff, call and sym not bitfields.
	(bfinfdpic_gc_sweep_hook): New function; update the relocation
	information for the relocations of the section being removed.
	(bfinfdpic_check_relocs): Accumulate the number of relocations
	which set got17m4, gothilo, fd, fdgot17m4, fdgothilo, fdgoff17m4,
	fdgoffhilo, gotoff, call and sym fields.
	(elf_backend_gc_sweep_hook): Redefine for FD-PIC.
2008-03-12 14:01:28 +00:00
Alan Modra 4fbb74a605 include/elf/
PR 5900
	* common.h (SHN_BAD): Delete.
	(SHN_LORESERVE .. SHN_HIRESERVE): Move to..
	* external.h: ..here.
	* internal.h (SHN_LORESERVE, SHN_HIRESERVE): Define.
	(SHN_LOPROC, SHN_HIPROC, SHN_LOOS, SHN_HIOS): Define.
	(SHN_ABS, SHN_COMMON, SHN_XINDEX, SHN_BAD): Define.
bfd/
	PR 5900
	* elf-bfd.h: Include elf/internal.h after elf/external.h.
	* elfcode.h (elf_swap_symbol_in): Map reserved shndx range.
	(elf_swap_symbol_out): Adjust SHN_XINDEX test.
	(elf_swap_ehdr_out): Mask SHN_LORESERVE and SHN_XINDEX to values
	seen in external structs.
	(valid_section_index_p): Delete.
	(elf_object_p): Don't increment section numbers over reserved range.
	Simplify test for valid sh_link, sh_info and e_shstrndx fields.
	(elf_write_shdrs_and_ehdr): Mask SHN_LORESERVE and SHN_XINDEX to values
	seen in external structs.  Don't increment section numbers over
	reserved range.
	* elf.c (bfd_elf_sym_name): Remove redundant tests on st_shndx.
	(bfd_section_from_shdr): Likewise.
	(group_signature): Range check before accessing elf_elfsections.
	(_bfd_elf_setup_sections): Likewise.
	(bfd_section_from_shdr): Likewise.
	(bfd_section_from_shdr): Don't increment section number over
	reserved sections.
	(assign_file_positions_for_non_load_sections): Likewise.
	(assign_file_positions_except_relocs): Likewise.
	(_bfd_elf_write_object_contents): Likewise.
	(assign_section_numbers): Likewise.  Adjust for changed SHN_*.
	(prep_headers): Delete unused variable.
	* elflink.c (bfd_elf_link_record_local_dynamic_symbol): Adjust
	for changed SHN_* values.
	(check_dynsym, elf_link_input_bfd): Likewise.
	(bfd_elf_final_link): Likewise.  Don't skip over reserved section
	range.
	(elf_fixup_link_order): Check that sh_link field is valid.
	* elf-hppa.h (elf_hppa_add_symbol_hook): Make "index" unsigned.
	* elf32-arm.c (elf32_arm_gc_mark_extra_sections): Range check before
	accesssing elf_elfsections.
	* elf32-avr.c (elf32_avr_size_stubs): Likewise.
	* elf32-hppa.c (elf32_hppa_size_stubs): Likewise.
	* elf32-m68hc1x.c (elf32_m68hc11_size_stubs): Likewise.
	* elf64-hppa.c (elf64_hppa_check_relocs): Adjust for changed
	SHN_* defines.  Test for SHN_BAD return from
	_bfd_elf_section_from_bfd_section
binutils/
	PR 5900
	* readelf.c (SECTION_HEADER_INDEX, SECTION_HEADER_NUM): Delete.
	Remove use throughout file.
	(SECTION_HEADER): Likewise.
	(dump_relocations): Don't adjust st_shndx for reserved range.
	(process_file_header): Mask SHN_XINDEX to values seen in external
	elf structs.  Simplify valid section index tests.
	(get_32bit_elf_symbols, get_64bit_elf_symbols): Mask SHN_XINDEX.
	Map reserved st_shndx to internal form.
	(process_section_groups): Test that group symbol st_shndx is in
	range, not just non-zero.  Delete reserved range check.
	(get_symbol_index_type): Mask "type" to 16 bits when printing PRC,
	OS or RSV.
gdb/
	PR 5900
	* elfread.c (elf_symtab_read): Make shndx an unsigned int.
	* mipsread.c: Include elf/internal.h.
	(read_alphacoff_dynamic_symtab): Map external reserved sym_shndx
	to internal range.
ld/testsuite/
	PR 5900
	* ld-elf/sec64k.exp: Update.
2008-03-12 08:37:09 +00:00
Alan Modra cb33740c88 * elf-bfd.h (_bfd_elf_section_from_bfd_section): Update prototype.
* elf.c (_bfd_elf_section_from_bfd_section): Return unsigned int,
	SHN_BAD on error.
	(_bfd_elf_print_private_bfd_data): Test for SHN_BAD result from
	_bfd_elf_section_from_bfd_section, not -1.
	(swap_out_syms): Likewise.
	* elflink.c (elf_link_add_object_symbols): Likewise.
	(bfd_elf_get_bfd_needed_list): Likewise.
	(bfd_elf_match_symbols_in_sections): Likewise.
	(elf_link_add_object_symbols): Don't bother testing for symbols
	using normal sections before calling bfd_section_from_elf_index.
	(elf_link_input_bfd, bfd_elf_final_link): Likewise.
	(bfd_elf_reloc_symbol_deleted_p): Likewise.
	* elfcode.h (elf_slurp_symbol_table): Likewise.
	* elf32-spu.c (get_sym_h): Likewise.
	* elf32-xtensa.c (get_elf_r_symndx_section): Likewise.
	* elf64-ppc.c (opd_entry_value, get_sym_h, ppc64_elf_edit_toc): Ditto.
	* elf64-sh64.c (sh_elf64_get_relocated_section_contents): Likewise.
2008-03-11 23:23:23 +00:00
Alan Modra 48a4134bfd daily update 2008-03-11 23:00:05 +00:00
Alan Modra 5f5fb9ec64 * elf32-spu.c (spu_elf_relocate_section): Test identical conditions
to those in process_stubs for overlay symbols.
2008-03-11 09:30:50 +00:00
Alan Modra 42e344a77c daily update 2008-03-10 23:00:05 +00:00
Alan Modra f3fe5a3827 daily update 2008-03-09 23:00:06 +00:00
Paul Brook b1cc4aeb65 2008-03-09 Paul Brook <paul@codesourcery.com>
bfd/
	* elf32-arm.c (elf32_arm_merge_eabi_attributes): Handle new
	Tag_VFP_arch values.

	binutils/
	* readelf.c (arm_attr_tag_VFP_arch): Add "VFPv3-D16".

	gas/
	* config/tc-arm.c (fpu_vfp_ext_d32): New vairable.
	(parse_vfp_reg_list, encode_arm_vfp_reg): Use it.
	(arm_option_cpu_value): Add vfpv3-d16, vfpv2 and vfpv3.
	(aeabi_set_public_attributes): Handle Tag_VFP_arch=VFPV3-D16.
	* doc/c-arm.texi: Document new ARM FPU variants.

	gas/testsuite/
	* gas/arm/vfpv3-d16-bad.d: New test.
	* gas/arm/vfpv3-d16-bad.l: New test.

	include/opcode/
	* arm.h (FPU_VFP_EXT_D32, FPU_VFP_V3D16, FPU_ARCH_VFP_V3D16): Define.
2008-03-09 13:23:29 +00:00
Alan Modra 1f5a32bac5 daily update 2008-03-08 23:00:05 +00:00
Paul Brook 12a0a0fd88 2008-03-08 Paul Brook <paul@codesourcery.com>
bfd/
	* elf32-arm.c (insert_thumb_branch): Rewrite.
	(elf32_thumb_to_arm_stub): Use new insert_thumb_branch.

	ld/testsuite/
	* ld-arm/arm-elf.exp (armeabitests): Add thumb2-b-interwork.
	* ld-arm/thumb2-b-interwork.d: New test.
	* ld-arm/thumb2-b-interwork.s: New test.
2008-03-08 14:58:14 +00:00
Paul Brook 39623e120c 2008-03-07 Paul Brook <paul@codesourcery.com>
bfd/
	* elf32-arm.c (elf32_arm_howto_table_1): Fix bitmasks for MOVW and
	MOVT relocations.
	(elf32_arm_final_link_relocate): Fix off by one MOVW/MOVT sign
	extension.
	(elf32_arm_relocate_section): Handle MOVW and MOVT
	relocations.  Improve safety check for other weird relocations.
	(elf32_arm_check_relocs): Only set h->needs_plt for branch/call
	relocations.

	gas/
	* config/tc-arm.c (md_apply_fix): Use correct offset range.

	ld/testsuite/
	* ld-arm/arm-elf.exp (armelftests): Add movw-merge and arm-app-movw.
	* ld-arm/arm-app-movw.s: New test.
	* ld-arm/arm-app.r: Update expected output.
	* ld-arm/movw-merge.d: New test.
	* ld-arm/movw-merge.s: New test.
2008-03-08 01:20:39 +00:00
Alan Modra 3105dc38bc daily update 2008-03-07 23:00:07 +00:00
Alan Modra 34dcdc15f3 daily update 2008-03-06 23:00:04 +00:00
Alan Modra a1ef897c9e daily update 2008-03-05 23:00:05 +00:00
Alan Modra 3954eb47e1 daily update 2008-03-04 23:00:05 +00:00
Bob Wilson 77cba8a32b bfd/
* xtensa-isa.c (xtensa_isa_num_pipe_stages): Make max_stage static and
	only compute its value once.
gas/
	* config/tc-xtensa.c (xtensa_num_pipe_stages): New.
	(md_begin): Initialize it.
	(resources_conflict): Use it.
2008-03-03 23:23:41 +00:00
Alan Modra 332fbd6f66 daily update 2008-03-03 23:00:05 +00:00
Alan Modra 4a628337a0 * elf32-spu.c (struct got_entry): Add "addend" field.
(count_stub, build_stub): Use a new stub if relocation addend
	differs from existing stubs for this symbol.
	(process_stubs): Deal with addends.
	(spu_elf_relocate_section, spu_elf_output_symbol_hook): Likewise.
2008-03-03 10:03:40 +00:00
Alan Modra 5e6d36ba3c daily update 2008-03-02 23:00:04 +00:00
H.J. Lu d95edcac72 2008-03-02 H.J. Lu <hongjiu.lu@intel.com>
PR ld/5789
	* elflink.c (_bfd_elf_symbol_refs_local_p): Always return true
	for hidden and local symbols.
2008-03-02 22:26:09 +00:00
Alan Modra 89200bf844 * elf32-ppc.c (allocate_dynrelocs): Discard relocs on
undefined symbols with internal or hidden visibility.
	(ppc_elf_relocate_section): Likewise.  Use SYMBOL_CALLS_LOCAL
	rather than SYMBOL_REFERENCES_LOCAL on branches.  Don't
	return immediately on dynamic reloc error.
2008-03-02 22:15:39 +00:00
Alan Modra f22390e572 daily update 2008-03-01 23:00:05 +00:00
Alan Modra 176a0d42d0 bfd/
* elf64-ppc.c (build_plt_stub): Add relocs on plt call stubs
	if emitrelocations.
	(get_relocs): New function, split out from..
	(ppc_build_one_stub): ..here.  Add relocs on plt_branch stubs if
	emitrelocations.  Remove indx temp.
	(ppc_size_one_stub): Count new stub relocs.
	(ppc64_elf_size_stubs): Count new glink reloc.
	(ppc64_elf_build_stubs): Emit glink reloc if emitrelocations.
	(ppc64_elf_finish_dynamic_sections): Output glink relocs.
	* elf32-ppc.c (ppc_elf_finish_dynamic_sections): Describe non-pic
	glink code.
ld/testsuite/
	* ld-powerpc/relbrlt.d: Update.  Also check .branch_lt section.
2008-03-01 06:52:52 +00:00
Alan Modra 32f420ee5a daily update 2008-02-29 23:00:05 +00:00
Alan Modra b6d8e665bc daily update 2008-02-28 23:00:05 +00:00
Alan Modra 911f096e1a * elf32-spu.c (mark_functions_via_relocs): Don't assume that
the "->start" pointer reaches to function origin, so that we
	can handle functions split over more than two sections.
	(build_call_tree): Likewise.
	(pasted_function): Don't attempt to set fun->start back to the
	function origin, just go back one section.
2008-02-28 09:30:27 +00:00
Alan Modra ac9d8ffe1a daily update 2008-02-27 23:00:05 +00:00
Catherine Moore ad9563d653 * elf.c ( _bfd_elf_print_private_bfd_data): Call
elf_backend_get_target_dtag if defined.
        * elf32-mips.c (elf_backend_get_target_dtag): Define.
        * elf64-mips.c: Likewise.
        * elfn32-mips.c: Likewise.
        * elfxx-mips.c (_bfd_mips_elf_get_target_dtag): New.
        * elfxx-mips.h (_bfd_mips_elf_get_target_dtag): Declare.
        * elf-bfd.h (elf_backend_get_target_dtag): Add prototype.
        * elfxx-target.h (elf_backend_get_target_dtag): Add default.
        (elf_backend_data): Add elf_backend_get_target_dtag.
2008-02-27 17:06:06 +00:00
Alan Modra 4bde7761b6 daily update 2008-02-26 23:00:05 +00:00
Alan Modra 625af618e7 * elf32-ppc.c (ppc_elf_check_relocs): Set pointer_equality_needed
for R_PPC_REL32 syms.  Don't set non_got_ref on branch reloc syms,
	and assume branch relocs are not dynamic when non-shared.
	(readonly_dynrelocs): New function, split out from..
	(maybe_set_textrel): ..here, renamed from old readonly_dynrelocs.
	(ppc_elf_adjust_dynamic_symbol): For symbols generating plt entries,
	clear non_got_ref..
	(allocate_dynrelocs): ..and don't set u.def for undefined weak.
	Do allow dynamic relocs on undefined symbols.
	(ppc_elf_adjust_dynamic_symbol): Use readonly_dynrelocs.
	(ppc_elf_relocate_section): Mirror dynamic reloc changes in
	check_relocs.
	(ppc_elf_finish_dynamic_symbol): Don't give a warning on weak
	plt symbols needing pointer_equality_needed.
2008-02-26 08:36:03 +00:00
Alan Modra a576afd1e2 daily update 2008-02-25 23:00:06 +00:00
Alan Modra afec01b810 daily update 2008-02-24 23:00:05 +00:00
Alan Modra cec08f203f daily update 2008-02-23 23:00:06 +00:00
Alan Modra 1cd81501f4 * elf32-ppc.c (ppc_elf_check_relocs): Revert non_got_ref change. 2008-02-23 05:50:28 +00:00
Alan Modra 0eb4a168d4 * elf32-ppc.c (ppc_elf_copy_indirect_symbol): Copy
pointer_equality_needed.
	(ppc_elf_check_relocs): Split out non-branch relocs from others
	that might emit dynamic relocs.  Set pointer_equality_needed
	for their symbols.  Don't set non_got_ref on branch reloc symbols.
	(ppc_elf_hash_symbol): New function.
	(elf_backend_hash_symbol): Define.
	(ppc_elf_finish_dynamic_symbol): Handle pointer_equality_needed.
	Error if pointer_equality_needed on weak plt symbol.
2008-02-23 01:56:21 +00:00
H.J. Lu 3ae181ee89 2008-02-22 H.J. Lu <hongjiu.lu@intel.com>
PR ld/5788
	* elflink.c (elf_create_symbuf): Correct buffer size and
	position.
2008-02-23 00:02:05 +00:00
Alan Modra e3c8734940 daily update 2008-02-22 23:00:06 +00:00
Nick Clifton 34b5e0b205 PR 868
*dwarf2.c: Revert previous patch.  All of the allocate memory is
        on an obstack which will be freed at some other time.
2008-02-22 15:27:38 +00:00
Alan Modra 52ff5d4e81 daily update 2008-02-21 23:00:06 +00:00
Alan Modra 5e59258c30 daily update 2008-02-20 23:00:06 +00:00
Nick Clifton 515ef31dec PR 868
* 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-20 17:42:36 +00:00
Nick Clifton b42bf1e0f9 PR 868
* dwarf2.c (read_abbrevs): Free the abbreviation table if we run
   out of memory.
   (decode_line_info): Free the line_info_table before returning a
   failure result.
   (_bfd_dwarf2_cleanup_debug_info): Free the abbreviation table.
   Free the line table.  Free the function table.  Free the variable
   table.
2008-02-20 15:56:33 +00:00
Paul Brook 845b51d665 2008-02-20 Paul Brook <paul@codesourcery.com>
ld/
	* emultempl/armelf.em (OPTION_FIX_V4BX_INTERWORKING): Define.
	(PARSE_AND_LIST_LONGOPTS): Add fix-v4bx-interworking.
	(PARSE_AND_LIST_OPTIONS): Ditto.
	(PARSE_AND_LIST_ARGS_CASES): Handle OPTION_FIX_V4BX_INTERWORKING.
	* emulparams/armelf.sh (OTHER_TEXT_SECTIONS): Add .v4_bx.
	* emulparams/armelf_linux.sh (OTHER_TEXT_SECTIONS): Ditto.
	* emulparams/armnto.sh (OTHER_TEXT_SECTIONS): Ditto.
	* ld.texinfo: Document --fix-v4bx-interworking.

	ld/testsuite/
	* ld-arm/armv4-bx.d: New test.
	* ld-arm/armv4-bx.s: New test.
	* ld-arm/arm.ld: Add .v4bx.
	* ld-arm/arm-elf.exp: Add armv4-bx.

	gas/testsuite/
	* gas/arm/thumb.d: Exclude EABI targets.
	* gas/arm/arch4t.d: Exclude EABI targts.
	* gas/arm/v4bx.d: New test.
	* gas/arm/v4bx.s: New test.
	* gas/arm/thumb-eabi.d: New test.
	* gas/arm/arch4t-eabi.d: New test.

	gas/
	* config/tc-arm.c (fix_v4bx): New variable.
	(do_bx): Generate V4BX relocations.
	(md_assemble): Allow bx on v4 codes when fix_v4bx.
	(md_apply_fix): Handle BFD_RELOC_ARM_V4BX.
	(tc_gen_reloc): Ditto.
	(OPTION_FIX_V4BX): Define.
	(md_longopts): Add fix-v4bx.
	(md_parse_option): Handle OPTION_FIX_V4BX.
	(md_show_usage): Document --fix-v4bx.
	* doc/c-arm.texi: Document --fix-v4bx.

	bfd/
	* reloc.c: Add BFD_RELOC_ARM_V4BX.
	* elf32-arm.c (elf32_arm_reloc_map): Add BFD_RELOC_ARM_V4BX.
	(ARM_BX_GLUE_SECTION_NAME, ARM_BX_GLUE_SECTION_NAME): Define.
	(elf32_arm_link_hash_table): Add bx_glue_size and bx_glue_offset.
	Update comment for fix_v4bx.
	(elf32_arm_link_hash_table_create): Zero bx_glue_size and
	bx_glue_offset.
	(ARM_BX_VENEER_SIZE, armbx1_tst_insn, armbx2_moveq_insn,
	armbx3_bx_insn): New.
	(bfd_elf32_arm_allocate_interworking_sections): Allocate BX veneer
	section.
	(bfd_elf32_arm_add_glue_sections_to_bfd): Ditto.
	(bfd_elf32_arm_process_before_allocation): Record BX veneers.
	(record_arm_bx_glue, elf32_arm_bx_glue): New functions.
	(elf32_arm_final_link_relocate): Handle BX veneers.
	(elf32_arm_output_arch_local_syms): Output mapping symbol for .v4_bx.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.
2008-02-20 15:17:56 +00:00
Alan Modra 601a6c33f2 daily update 2008-02-19 23:00:34 +00:00
Alan Modra 66719a4aaa daily update 2008-02-18 23:00:05 +00:00
Mark Kettenis 0a40daed72 * elf.c (swap_out_syms): Avoid preprocessing directive within
macro arg.
2008-02-17 23:45:23 +00:00
Alan Modra bd7b7e7ef8 daily update 2008-02-17 23:00:04 +00:00
Jan Kratochvil 3f001e8487 * elf.c (assign_file_positions_for_load_sections): Set the type of
PT_NOTE sections to SHT_NOTE.
2008-02-17 13:21:20 +00:00
Alan Modra 37da76e8a5 * simple.c (bfd_simple_get_relocated_section_contents): Set
link_info.output_bfd.
2008-02-16 23:00:12 +00:00