Commit Graph

104 Commits

Author SHA1 Message Date
Alan Modra dbaa201145 PR ld/13991
bfd/
	* bfd/elf-bfd.h (_bfd_elf_link_just_syms): Define as
	_bfd_generic_link_just_syms.
	* bfd/elflink.c (_bfd_elf_link_just_syms): Delete.
	* bfd/linker.c (_bfd_generic_link_just_syms): Set sec_info_type.

	* bfd/bfd-in.h (discarded_section): Renamed from elf_discarded_section.
	* bfd/section.c (SEC_INFO_TYPE_NONE, SEC_INFO_TYPE_STABS,
	SEC_INFO_TYPE_MERGE, SEC_INFO_TYPE_EH_FRAME,
	SEC_INFO_TYPE_JUST_SYMS): Renamed from corresponding ELF_INFO_TYPE.
	* bfd/elf-eh-frame.c, * bfd/elf-m10200.c, * bfd/elf-m10300.c,
	* bfd/elf.c, * bfd/elf32-arm.c, * bfd/elf32-avr.c, * bfd/elf32-bfin.c,
	* bfd/elf32-cr16.c, * bfd/elf32-cr16c.c, * bfd/elf32-cris.c,
	* bfd/elf32-crx.c, * bfd/elf32-d10v.c, * bfd/elf32-epiphany.c,
	* bfd/elf32-fr30.c, * bfd/elf32-frv.c, * bfd/elf32-h8300.c,
	* bfd/elf32-hppa.c, * bfd/elf32-i370.c, * bfd/elf32-i386.c,
	* bfd/elf32-i860.c, * bfd/elf32-ip2k.c, * bfd/elf32-iq2000.c,
	* bfd/elf32-lm32.c, * bfd/elf32-m32c.c, * bfd/elf32-m32r.c,
	* bfd/elf32-m68hc1x.c, * bfd/elf32-m68k.c, * bfd/elf32-mcore.c,
	* bfd/elf32-mep.c, * bfd/elf32-moxie.c, * bfd/elf32-msp430.c,
	* bfd/elf32-mt.c, * bfd/elf32-openrisc.c, * bfd/elf32-ppc.c,
	* bfd/elf32-rl78.c, * bfd/elf32-rx.c, * bfd/elf32-s390.c,
	* bfd/elf32-score.c, * bfd/elf32-score7.c, * bfd/elf32-sh.c,
	* bfd/elf32-spu.c, * bfd/elf32-tic6x.c, * bfd/elf32-tilepro.c,
	* bfd/elf32-v850.c, * bfd/elf32-vax.c, * bfd/elf32-xc16x.c,
	* bfd/elf32-xstormy16.c, * bfd/elf32-xtensa.c, * bfd/elf64-alpha.c,
	* bfd/elf64-hppa.c, * bfd/elf64-ia64-vms.c, * bfd/elf64-mmix.c,
	* bfd/elf64-ppc.c, * bfd/elf64-s390.c, * bfd/elf64-sh64.c,
	* bfd/elf64-x86-64.c, * bfd/elflink.c, * bfd/elfnn-ia64.c,
	* bfd/elfxx-mips.c, * bfd/elfxx-sparc.c, * bfd/elfxx-tilegx.c,
	* bfd/reloc.c: Update all references.
	* bfd/bfd-in2.h: Regenerate.
ld/
	* ld/ldlang.c (size_input_section): Use sec_info_type rather than
	usrdata->flags.just_syms.
	* ld/ldwrite.c (build_link_order): Likewise.
	* ld/emultempl/hppaelf.em (build_section_lists): Likewise.
	* ld/emultempl/ppc64elf.em (build_toc_list): Likewise.
	* ld/emultempl/armelf.em (build_section_lists): Likewise.
	(after_allocation): Update for renamed sec_info_type value.
	* ld/emultempl/tic6xdsbt.em: Likewise.
2012-04-24 05:12:40 +00:00
Alan Modra cb83c803b7 * elf32-spu.c (build_stub): Fix malloc under-allocation. 2012-02-26 23:12:16 +00:00
Alan Modra 1d5316ab67 PR ld/13177
bfd/
	* elflink.c (_bfd_elf_gc_mark_rsec): Set symbol "mark".
	(elf_gc_sweep_symbol): Don't test plt/got refcounts, instead test
	"mark".  Hide undefweak too.  Clear def_regular and ref_regular.
	* elf-m10300.c (mn10300_elf_relocate_section): Ignore unresolved
	reloc errors from garbage-collected code.
	* elf32-arm.c (elf32_arm_relocate_section): Likewise.
	* elf32-bfin.c (bfin_relocate_section): Likewise.
	(bfinfdpic_relocate_section): Likewise.
	* elf32-cris.c (cris_elf_relocate_section): Likewise.
	* elf32-frv.c (elf32_frv_relocate_section): Likewise.
	* elf32-i386.c (elf_i386_relocate_section): Likewise.
	* elf32-m32r.c (m32r_elf_relocate_section): Likewise.
	* elf32-m68k.c (elf_m68k_relocate_section): Likewise.
	* elf32-ppc.c (ppc_elf_relocate_section): Likewise.
	* elf32-s390.c (elf_s390_relocate_section): Likewise.
	* elf32-sh.c (sh_elf_relocate_section): Likewise.
	* elf32-spu.c (spu_elf_relocate_section): Likewise.
	* elf32-tilepro.c (tilepro_elf_relocate_section): Likewise.
	* elf32-xtensa.c (elf_xtensa_relocate_section): Likewise.
	* elf64-alpha.c (elf64_alpha_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 (elf_x86_64_relocate_section): Likewise.
	* elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise.
	* elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise.
ld/testsuite/
	* ld-elf/elf.exp: Move test for shared lib support..
	* lib/ld-lib.exp (check_shared_lib_support): ..to here. Add m68hc1*,
	and s/ms1/mt/.
	(check_gc_sections_available): Match hppa*64 not hppa64.  Comment.
	* ld-gc/libpersonality.s: New.
	* ld-gc/personality.s, * ld-gc/personality.d: New.
	* ld-gc/gc.exp: Run personality test.
2011-10-19 07:17:21 +00:00
Kai Tietz 007d618909 ChangeLog libiberty/
2011-02-28  Kai Tietz  <kai.tietz@onevision.com>

	* filename_cmp.c (filename_ncmp): New function.
	* functions.texi: Regenerated.

ChangeLog include/
2011-02-28  Kai Tietz  <kai.tietz@onevision.com>

	* filenames.h (filename_ncmp): New prototype.

ChangeLog bfd/
2011-02-28  Kai Tietz  <kai.tietz@onevision.com>

	* archive.c (_bfd_find_nested_archive): Use filename_(n)cmp.
	(adjust_relative_path): Likewise.
	(_bfd_construct_extended_name_table): Likewise.
	* corefile.c (generic_core_file_matches_executable_p): Likewise.
	* elf32-bfin.c (bfinfdpic_relocate_section): Likewise.
	* elf32-frv.c (elf32_frv_relocate_section): Likewise.
	* elf32-spu.c (sort_bfds): Likewise.
	(spu_elf_auto_overlay): Likewise.
	* syms.c (_bfd_stab_section_find_nearest_line): Likewise.
	* xcofflink.c (xcoff_set_import_path): Likewise.
	* xtensa-isa.c (xtensa_regfile_lookup): Likewise.
	(xtensa_regfile_lookup_shortname): Likewise.
2011-02-28 18:30:16 +00:00
Daniel Jacobowitz e4067dbb2a bfd/
* elf-bfd.h (RELOC_AGAINST_DISCARDED_SECTION): Always call
	_bfd_clear_contents.  Pass it the input section.
	* libbfd-in.h (_bfd_clear_contents): Add input_section argument.
	* libbfd.h: Regenerate.
	* reloc.c (_bfd_clear_contents): Take input_section argument.
	Use non-zero for .debug_ranges.
	(bfd_generic_get_relocated_section_conten): Update _bfd_clear_contents
	call.

	* elf32-arm.c (elf32_arm_relocate_section): Use
	RELOC_AGAINST_DISCARDED_SECTION.
	* 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 (bfin_relocate_section): Likewise.
	(bfinfdpic_relocate_section): Likewise.
	* elf32-cr16.c (elf32_cr16_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-i860.c (elf32_i860_relocate_section): Likewise.
	* elf32-ip2k.c (ip2k_elf_relocate_section): Likewise.
	* elf32-iq2000.c (iq2000_elf_relocate_section): Likewise.
	* elf32-lm32.c (lm32_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_relocate_section): 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-moxie.c (moxie_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-rx.c (rx_elf_relocate_section): Likewise.
	* elf32-s390.c (elf_s390_relocate_section): Likewise.
	* elf32-score.c (s3_bfd_score_elf_relocate_section): Likewise.
	* elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise.
	* elf32-sh.c (sh_elf_relocate_section): Likewise.
	* elf32-spu.c (spu_elf_relocate_section): Likewise.
	* elf32-tic6x.c (elf32_tic6x_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-hppa.c (elf64_hppa_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.
	* 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.

	ld/testsuite/
	* ld-discard/zero-range.d, ld-discard/zero-range.s: New files.
2010-10-25 15:54:16 +00:00
Bernd Schmidt d4730f921a bfd/
* elf-bfd.h (struct bfd_elf_section_reloc_data): New structure.
	(struct bfd_elf_section_data): New members REL and RELA; delete
	members REL_HDR, REL_HDR2, REL_COUNT, REL_COUNT2, REL_IDX,
	REL_IDX2, REL_HASHES.
	(_bfd_elf_init_reloc_shdr): Adjust declaration.
	(_bfd_elf_single_rel_hdr): Declare.
	(RELOC_AGAINST_DISCARDED_SECTION): Use it.
	* elf.c (bfd_section_from_shdr): Adjusted to match changes in
	data structures.
	(_bfd_elf_init_reloc_shdr): New arg RELDATA.  Remove arg REL_HDR.
	All callers changed.  Allocate memory for the Elf_Internal_Shdr
	structure.
	(_bfd_elf_single_rel_hdr): New function.
	(struct fake_section_arg): New structure.
	(elf_fake_section): Expect to see a pointer to it in the third
	argument.  If doing a relocatable link, allocate both REL and RELA
	sections as needed.
	(assign_section_numbers): Adjusted to match changes in
	data structures.
	(_bfd_elf_compute_section_file_positions): Call elf_fake_sections
	with a struct fake_section_args argument.
	* elfcode.h (elf_write_relocs): Adjusted to match changes in
	data structures.
	(elf_slurp_reloc_table): Likewise.
	* elflink.c (_bfd_elf_link_read_relocs): Likewise.
	(_bfd_elf_link_size_reloc_section): Remove arg REL_HDR, replace with
	RELDATA.  Remove argument O.  All callers changed.  Remove code to
	discover the right rel_hdr and count.
	(_bfd_elf_link_output_relocs): Adjusted to match changes in
	data structures.
	(elf_link_adjust_relocs): Remove args REL_HDR, COUNT and REL_HASH;
	replace with RELDATA.  All callers changed.
	(elf_link_input_bfd): Correctly generate rel_hash data when both
	REL and RELA sections are present.
	(elf_reloc_link_order): Adjusted to match changes in
	data structures.
	(bfd_elf_final_link): Simplify code to count relocs.  Free the
	hashes array for both REL and RELA.
	(get_dynamic_reloc_section_name): Use _bfd_elf_single_reloc_hdr
	* elf32-m32r.c (m32r_elf_fake_sections, elf_backend_fake_sections):
	Delete.
	* elf32-tic6x.c (elf32_tic6x_fake_sections, elf_backend_fake_sections):
	Delete.
	(elf32_tic6x_rel_relocation_p): Adjusted to match changes in
	data structures.
 	* elf32-microblaze.c (microblaze_elf_check_relocs): Use
	_bfd_elf_single_rel_hdr.
	* elf32-ppc.c (ppc_elf_relax_section): Likewise.
	* elf32-spu.c (spu_elf_relocate_section): Likewise.
	* elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
	* elf64-hppa.c (get_reloc_section): Likewise.
	* elf64-mips.c (mips_elf64_slurp_reloc_table): Adjusted to match
	changes in data structures.
	(mips_elf64_write_relocs): Use _bfd_elf_single_rel_hdr.
	* elf64-ppc.c (ppc64_elf_edit_opd): Likewise.
	(ppc64_elf_edit_toc): Likewise.
	(get_relocs): Adjusted to match changes in data structures.
	Allocate an Elf_Internal_Shdr structure if necessary.
	(ppc64_elf_finish_dynamic_sections): Use _bfd_elf_single_rel_hdr.
	* elf64-sparc.c (elf64_sparc_slurp_reloc_table): Adjusted to match
	changes in data structures.
	* elfxx-ia64.c (get_reloc_section): Use _bfd_elf_single_rel_hdr.
	* elfxx-mips.c (MIPS_RELOC_RELA_P): Remove macro.
	(mips_elf_rel_relocation_p): Adjusted to match changes in data
	structures.
	(_bfd_mips_elf_relocate_section): Use mips_elf_rel_relocation_p rather
	than MIPS_RELOC_RELOCA_P.
	* elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Use
	_bfd_elf_single_rel_hdr.
	(_bfd_sparc_elf_relocate_section): Likewise.

ld/
	* emultempl/xtensaelf.em (replace_insn_sec_with_prop_sec): Use
	_bfd_elf_single_rel_hdr.
2010-10-04 14:13:10 +00:00
Alan Modra 29c702418f * elf32-spu.c (spu_elf_size_sections): Omit fixups for non-alloc
sections.
	(spu_elf_create_sections): Mark .fixup with SEC_LINKER_CREATED and
	set dynobj.
	(spu_elf_finish_dynamic_sections): New function.
	(elf_backend_finish_dynamic_sections): Define.
2010-09-16 10:36:00 +00:00
H.J. Lu ae95ffa628 Add target_id to elf_backend_data.
2010-08-25  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/11944
	* elf-bfd.h (elf_backend_data): Add target_id.
	(bfd_elf_make_generic_object): Renamed to ...
	(bfd_elf_make_object): This.

	* elf.c (bfd_elf_make_generic_object): Removed.
	(bfd_elf_make_object): New.
	(bfd_elf_mkcorefile): Really treat it as an object file.

	* elf-m10300.c (ELF_TARGET_ID): New.
	* elf32-arm.c (ELF_TARGET_ID): Likewise.
	* elf32-bfin.c (ELF_TARGET_ID): Likewise.
	* elf32-cris.c (ELF_TARGET_ID): Likewise.
	* elf32-frv.c (ELF_TARGET_ID): Likewise.
	* elf32-i386.c (ELF_TARGET_ID): Likewise.
	* elf32-lm32.c (ELF_TARGET_ID): Likewise.
	* elf32-m32r.c (ELF_TARGET_ID): Likewise.
	* elf32-m68hc11.c (ELF_TARGET_ID): Likewise.
	* elf32-m68hc12.c (ELF_TARGET_ID): Likewise.
	* elf32-m68k.c (ELF_TARGET_ID): Likewise.
	* elf32-microblaze.c (ELF_TARGET_ID): Likewise.
	* elf32-ppc.c (ELF_TARGET_ID): Likewise.
	* elf32-s390.c (ELF_TARGET_ID): Likewise.
	* elf32-sh.c (ELF_TARGET_ID): Likewise.
	* elf32-sparc.c (ELF_TARGET_ID): Likewise.
	* elf32-spu.c (ELF_TARGET_ID): Likewise.
	* elf32-tic6x.c (ELF_TARGET_ID): Likewise.
	* elf32-xtensa.c (ELF_TARGET_ID): Likewise.
	* elf64-alpha.c (ELF_TARGET_ID): Likewise.
	* elf64-hppa.c (ELF_TARGET_ID): Likewise.
	* elf64-ppc.c (ELF_TARGET_ID): Likewise.
	* elf64-s390.c (ELF_TARGET_ID): Likewise.
	* elf64-x86-64.c (ELF_TARGET_ID): Likewise.
	* elfxx-ia64.c (ELF_TARGET_ID): Likewise.

	* elf32-hppa.c (elf32_hppa_mkobject): Removed.
	(bfd_elf32_mkobject): Likewise.
	(ELF_TARGET_ID): New.

	* elf32-mips.c (ELF_TARGET_ID): New.
	(bfd_elf32_mkobject): Removed.

	* elf64-mips.c (ELF_TARGET_ID): New.
	(bfd_elf64_mkobject): Removed.

	* elfn32-mips.c (ELF_TARGET_ID): New.
	(bfd_elf32_mkobject): Removed.

	* elfxx-mips.c (_bfd_mips_elf_mkobject): Removed.
	* elfxx-mips.h (_bfd_mips_elf_mkobject): Likewise.

	* elfxx-target.h (bfd_elfNN_mkobject): Default to
	bfd_elf_make_object.
	(ELF_TARGET_ID): New.  Default to GENERIC_ELF_DATA.
	(elfNN_bed): Initialize target_id.
2010-08-25 14:53:45 +00:00
Alan Modra c7e2358a88 fix set but unused variable warnings 2010-06-27 04:07:55 +00:00
Alan Modra 9a83a5533e include/elf/
* internal.h (ELF_SECTION_SIZE): Protect macro args with parentheses.
	Invert logic to clarify test for .tbss.
	(ELF_IS_SECTION_IN_SEGMENT): Rename to..
	(ELF_SECTION_IN_SEGMENT_1): ..this.  Add check_vma param.  Protect
	macro args with parentheses.
	(ELF_SECTION_IN_SEGMENT): Define.
	(ELF_IS_SECTION_IN_SEGMENT_FILE): Delete.
	(ELF_IS_SECTION_IN_SEGMENT_MEMORY): Delete.
bfd/
	* elf.c: Replace use of ELF_IS_SECTION_IN_SEGMENT and
	ELF_IS_SECTION_IN_SEGMENT_FILE with ELF_SECTION_IN_SEGMENT
	throughout file.
	(assign_file_positions_for_load_sections): Modify section in
	segment warning to ignore overlay vmas.
	* elf32-spu.c (spu_elf_object_p): Replace use of
	ELF_IS_SECTION_IN_SEGMENT_MEMORY with ELF_SECTION_IN_SEGMENT.
binutils/
	* readelf.c (process_program_headers): Replace use of
	ELF_IS_SECTION_IN_SEGMENT_MEMORY with ELF_SECTION_IN_SEGMENT.
2010-04-24 01:05:25 +00:00
Nick Clifton 4dfe6ac6fe * elf-bfd.h (emum elf_object_id): Rename to elf_target_id. Add
entries for other architectures.
        (struct elf_link_hash_table): Add hash_table_id field.
        (elf_hash_table_id): New accessor macro.
        * elflink.c (_bfd_elf_link_hash_table_init): Add target_id
        parameter.
        * elf-m10300.c (elf32_mn10300_hash_table): Check table id before
        returning cast pointer.
        (elf32_mn10300_link_hash_table_create): Identify new table as
        containing MN10300 extensions.
        (mn10300_elf_relax_section): Check pointer returned by
        elf32_mn10300_hash_table.
        * elf32-arm.c: Likewise, except using ARM extensions.
        * elf32-avr.c: Likewise, except using AVR extensions.
        * elf32-bfin.c: Likewise, except using BFIN extensions.
        * elf32-cris.c: Likewise, except using CRIS extensions.
        * elf32-frv.c: Likewise, except using FRV extensions.
        * elf32-hppa.c: Likewise, except using HPPA32 extensions.
        * elf32-i386.c: Likewise, except using I386 extensions.
        * elf32-lm32.c: Likewise, except using LM32 extensions.
        * elf32-m32r.c: Likewise, except using M32RM extensions.
        * elf32-m68hc11.c: Likewise, except using M68HC11 extensions.
        * elf32-m68hc1x.c: Likewise, except using M68HC11 extensions.
        * elf32-m68hc1x.h: Likewise, except using M68HC11 extensions.
        * elf32-m68k.c: Likewise, except using M68K extensions.
        * elf32-microblaze.c: Likewise, except using MICROBLAZE extensions.
        * elf32-ppc.c: Likewise, except using PPC32 extensions.
        * elf32-s390.c: Likewise, except using S390 extensions.
        * elf32-sh.c: Likewise, except using SH extensions.
        * elf32-spu.c: Likewise, except using SPU extensions.
        * elf32-xtensa.c: Likewise, except using XTENSA extensions.
        * elf64-alpha.c: Likewise, except using ALPHA extensions.
        * elf64-hppa.c: Likewise, except using HPPA64 extensions.
        * elf64-ppc.c: Likewise, except using PPC64 extensions.
        * elf64-s390.c: Likewise, except using S390 extensions.
        * elf64-x86-64.c: Likewise, except using X86_64 extensions.
        * elfxx-ia64.c: Likewise, except using IA64 extensions.
        * elfxx-mips.c: Likewise, except using MIPS extensions.
        * elfxx-sparc.c: Likewise, except using SPARC extensions.
        * elfxx-sparc.h: Likewise, except using SPARC extensions.
        * elf32-cr16.c (struct elf32_cr16_link_hash_table): Delete
        redundant structure.
        (elf32_cr16_hash_table): Delete unused macro.
        (elf32_cr16_link_hash_traverse): Delete unused macro.
        * elf32-score.c: Likewise.
        * elf32-score7.c: Likewise.
        * elf32-vax.c: Likewise.
        * elf64-sh64.c: Likewise.

        * emultempl/alphaelf.em: Update value expected from elf_object_id.
        * emultempl/hppaelf.em: Likewise.
        * emultempl/mipself.em: Likewise.
        * emultempl/ppc32elf.em: Likewise.
        * emultempl/ppc64elf.em: Likewise.
2010-02-04 09:16:43 +00:00
Nick Clifton 91d6fa6a03 Add -Wshadow to the gcc command line options used when compiling the binutils.
Fix up all warnings generated by the addition of this switch.
2009-12-11 13:42:17 +00:00
Ulrich Weigand 2a516af65e * elf32-spu.c (struct spu_link_hash_table): Remove overlay_fixed,
reserved, and extra_stack_space members.
	(spu_elf_auto_overlay): Use auto_overlay_fixed, auto_overlay_reserved,
	and extra_stack_space members of htab->params instead.
2009-11-17 13:37:01 +00:00
Ulrich Weigand 6567fa84dc 2009-11-03 Alan Modra <amodra@bigpond.net.au>
Ulrich Weigand  <uweigand@de.ibm.com>

	* elf32-spu.c (mark_functions_via_relocs): Handle non-branch relocs
	(jump tables or other references to code labels) as well.
2009-11-03 13:58:49 +00:00
Ulrich Weigand 64028ad7de bfd/
* elf32-spu.c (spu_elf_auto_overlay): Insert icache linker script
	after .toe instead of before .text section.  Set the LMA of all
	overlay sections to their icache IA address.
	(spu_elf_find_overlays): Determine icache set id without reference
	to the LMA.

ld/testsuite/
	* ld-spu/icache1.d: Update to new section layout.
2009-10-01 13:09:56 +00:00
Alan Modra 57e96a0861 * elf32-spu.c (spu_elf_relocate_section): Correct 2009-07-24 logic. 2009-09-04 06:54:12 +00:00
Trevor Smigiel 9cc305ec20 bfd/
* elf32-spu.h (spu_elf_params): Add member emit_fixups.
	(spu_elf_size_sections): Declare prototype.
	* elf32-spu.c (spu_link_hash_table): Add member sfixup.
	(FIXUP_RECORD_SIZE, FIXUP_GET, FIXUP_PUT): New macros.
	(spu_elf_emit_fixup): New function.
	(spu_elf_relocate_section): Emit fixup for each SPU_ADDR32.
	(spu_elf_size_sections): New function.
ld/
	* emulparams/elf32_spu.sh (OTHER_READONLY_SECTIONS): Add .fixup
	section and __fixup_start symbol.
	* emultempl/spuelf.em (params): Initialize emit_fixups member.
	(spu_before_allocation): Call spu_elf_size_sections.
	(OPTION_SPU_EMIT_FIXUPS): Define.
	(PARSE_AND_LIST_LONGOPTS): Add --emit-fixups.
	(PARSE_AND_LIST_ARGS_CASES): Handle --emit-fixups.
	* ld.texinfo (--emit-fixups): Document.
ld/testsuite/
	* ld-spu/fixup.d: New.
	* ld-spu/fixup.s: New.
2009-08-05 20:40:34 +00:00
Trevor Smigiel 8fdcc58daa include/elf/
* spu.h (R_SPU_ADD_PIC): New.
bfd/
        * reloc.c (BFD_RELOC_SPU_ADD_PIC): Define.
        * bfd-in2.h: Regenerate.
        * libbfd.h: Regenerate.
        * elf32-spu.c (elf_howto_table): Add entries SPU_ADD_PIC.
        (spu_elf_bfd_to_reloc_type): Handle SPU_ADD_PIC.
        (spu_elf_relocate_section): Patch instructions marked by SPU_ADD_PIC.
gas/
        * config/tc-spu.c (md_apply_fix): Handle SPU_ADD_PIC.
        * config/tc-spu.h (tc_fix_adjustable): Don't adjust for SPU_ADD_PIC.
        (TC_FORCE_RELOCATION): Emit relocs for SPU_ADD_PIC.
ld/testsuite/
        * ld-spu/pic.d: New.
        * ld-spu/pic.s: New.
        * ld-spu/picdef.s: New.
2009-07-24 19:51:27 +00:00
Alan Modra 52cfded73c * elf32-spu.c (spu_elf_size_stubs): Do set up soft-icache manager
data even when no stubs.
	(spu_elf_place_overlay_data, spu_elf_build_stubs): Adjust.
2009-07-10 14:00:38 +00:00
Alan Modra 9c4d0c1fb8 * elf32-spu.c (mark_functions_via_relocs): Init broken_cycle field
of malloc'd struct call_info.
	(pasted_function): Likewise, priority too.
2009-07-09 10:58:06 +00:00
Alan Modra 2fc6d3b012 * elf32-spu.c (spu_elf_auto_overlay): Take into account section
alignment when packing sections into overlays.
2009-07-07 03:26:47 +00:00
Ulrich Weigand be3e406de8 * elf32-spu.c (needs_ovl_stub): Respect .brinfo lrlive bits
also for calls.
2009-06-16 13:44:00 +00:00
Alan Modra 74681fc450 * elf32-spu.c (spu_elf_relocate_section): Match overlay number
when looking for soft-icache stubs.
2009-06-06 06:36:52 +00:00
Ulrich Weigand 5ebe285860 * elf32-spu.c (struct call_info): New member broken_cycle.
(remove_cycle): Instead of physically removing call_info structures
	to break call graph cycles, mark them using the broken_cycle flag.
	(mark_overlay_section): Respect broken_cycle flag.
	(unmark_overlay_section): Likewise.
	(collect_lib_sections): Likewise.
	(collect_overlays): Likewise.
	(sum_stack): Likewise.
2009-05-28 10:47:44 +00:00
Ulrich Weigand 34ad4cb0b5 * elf32-spu.c (insert_callee): Accumulate incoming callee->count.
(mark_functions_via_relocs): Initialize callee->count to 1.
	(pasted_function): Likewise.
	(spu_elf_auto_overlay): Honor call counts when determining number
	of stubs required in software i-cache mode.
2009-05-28 10:42:47 +00:00
Alan Modra 6e0b88f1b8 * elf-bfd.h (struct elf_backend_data
<elf_backend_link_output_symbol_hook>): Return an int.
	* elf64-ppc.c (ppc64_elf_output_symbol_hook): Return 2 to drop
	symbols on deleted .opd entries.
	* elflink.c (elf_link_output_sym): Return without outputting sym
	if output_symbol_hook returns 2.
	(elf_link_output_extsym): Don't assign h->indx when symbol discarded.
	Abort if we must not discard sym.
	(elf_link_input_bfd): Similarly, don't set finfo->indices for
	local syms.
	(bfd_elf_final_link): Adjust elf_link_output_sym calls.
	* elf-vxworks.c (elf_vxworks_link_output_symbol_hook): Adjust for
	elf_backend_link_output_symbol_hook return type change.
	* elf32-arm.c (output_arch_syminfo): Likewise.
	(elf32_arm_output_map_sym, elf32_arm_output_stub_sym): Likewise.
	(elf32_arm_output_arch_local_syms): Likewise.
	* elf32-cr16c.c (elf32_cr16c_link_output_symbol_hook): Likewise.
	* elf32-score.c (s3_bfd_score_elf_link_output_symbol_hook): Likewise.
	(bfd_score_elf_link_output_symbol_hook): Likewise.
	* elf32-score.h (s7_bfd_score_elf_link_output_symbol_hook): Likewise.
	* elf32-score7.c (s7_bfd_score_elf_link_output_symbol_hook): Likewise.
	* elf32-sh64.c (sh64_elf_link_output_symbol_hook): Likewise.
	* elf32-spu.c (spu_elf_output_symbol_hook): Likewise.
	* elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise.
	* elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise.
	* elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise.
	* elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise.
	* elf64-sparc.c (elf64_sparc_output_arch_syms): Likewise.
	* elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise.
	* elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
2009-05-21 14:15:50 +00:00
Ulrich Weigand 335bd8f205 * elf32-spu.c (mark_overlay_section): Move .init and .fini
sections into the software icache.
2009-05-14 17:56:56 +00:00
Ulrich Weigand cdc83fba73 bfd/
* elf32-spu.c (build_stub): Always build "compact" sofware
	i-cache stubs.

ld/
	* emultempl/spuelf.em (PARSE_AND_LIST_ARGS_CASES): Always use
	compact stubs with software i-cache.

ld/testsuite/
	* ld-spu/icache1.d: Update for compact stubs.
2009-05-14 16:56:09 +00:00
Ulrich Weigand 97fc8d845e bfd/
* elf32-spu.c (struct spu_link_hash_table): Add fromelem_size_log2.
	(spu_elf_setup): Initialize it.
	(spu_elf_size_stubs): Move .ovtab into .bss for software i-cache.
	Update to new-sytle cache manager data structures.
	(spu_elf_build_stubs): Generate new-style cache manager data
	structures and symbols.
	(spu_elf_auto_overlay): Update size computation.

ld/testsuite/
	* ld-spu/icache1.d: Update all addresses to accomodate icache
	buffer shifted down 0x800 bytes.
2009-05-14 16:04:02 +00:00
Ulrich Weigand 452de53c12 bfd/
* elf32-spu.c (spu_elf_modify_segment_map): Move all PF_OVERLAY
	segments first amongst the program headers.

ld/testsuite/
	* ld-spu/icache.d: Update file offsets.
	* ld-spu/ovl.d: Likewise.
	* ld-spu/ovl1.d: Likewise.
2009-05-14 15:26:36 +00:00
Ulrich Weigand d342a8b157 * elf32-spu.c (spu_elf_relocate_section): Only encode overlay index
into addresses for relocation types that look at high bits.  Remove
	special handling of relocation overflow warnings.
2009-05-14 14:42:36 +00:00
Ulrich Weigand cc210763ce * elf32-spu.c (mark_functions_via_relocs): Handle cycles in the
control flow graph between fragments of a function.
2009-05-14 14:40:57 +00:00
Ulrich Weigand c1ea05bbe8 * elf32-spu.c (spu_elf_size_stubs): Even in software i-cache mode,
generate only a 16-byte .toe section.
	(spu_elf_build_stubs, spu_elf_auto_overlay): Likewise.
2009-05-14 14:39:04 +00:00
Alan Modra bbb0fc04cc bfd/
* elf32-spu.c (spu_elf_size_stubs): Split out section placement to..
	(spu_elf_place_overlay_data): ..here.  New function.
	* elf32-spu.h (spu_elf_place_overlay_data): Declare.
ld/
	* emultempl/spuelf.em (spu_before_allocation): Call
	spu_elf_place_overlay_data.
ld/testsuite/
	* ld-spu/icache1.d: Update for changed overlay manager placement.
	* ld-spu/ovl.d: Likewise.
	* ld-spu/ovl2.d: Likewise.
2009-05-14 04:30:03 +00:00
Alan Modra 77ae44b0d3 * elf32-spu.c (spu_elf_find_overlays): Don't use .ovl.init lma as
start of overlays.
	(spu_elf_build_stubs): Don't define __icache_tagbase.  Define
	__icache_tag_array and __icache_tag_array_size.
2009-05-11 09:40:52 +00:00
Alan Modra ad2adbc8be bfd/
* elf32-spu.c (spu_elf_find_overlays): Separate error return from
	"no overlays" return.  If there are overlays, create overlay
	manager entry symbols here, so that..
	(spu_elf_build_stubs): ..we don't need to set them up here.
	Simplify entry symbol tests.
	* elf32-spu.h (spu_elf_find_overlays): Update prototype.
ld/
	* emultempl/spuelf.em (spu_before_allocation): Report errors from
	spu_elf_find_overlays.
2009-03-19 07:04:12 +00:00
Alan Modra a7e11ee1d2 bfd/
* elf32-spu.h (struct spu_elf_params): ovly_flavour now only 1 bit.
	Add compact_stub.
	(emum _ovly_flavour): Delete ovly_compact, ovly_none.
	* elf32-spu.c (struct spu_link_hash_table): Replace ovly_load and
	ovly_return fields with ovly_entry[2].  Adjust all users.
	(spu_elf_find_overlays): Set ovly_entry[1] from __icache_call_handler
	when soft-icache.
	(spu_elf_build_stubs): Likewise.
	(ovl_stub_size): Change arg to spu_elf_params pointer.  Adjust for
	ovly_flavour changes.  Update all callers.
	(ovl_stub_size_log2): New function.
	(build_stub): Handle compact icache stubs.  Use different manager
	entry point for stubs in non-icache area.
	(spu_elf_size_stubs): Don't allocate space for indirect branch
	descriptors.
	(spu_elf_build_stubs): And don't built them.
ld/
	* emultempl/spu_icache.S: Add new entry to dummy handler.
	* emultempl/spu_icache.o_c: Regenerate.
	* emultempl/spuelf.em (params): Init new field.
	(no_overlays): New static var.
	(spu_before_allocation): Use it.
	(OPTION_SPU_COMPACT_STUBS): Define.
	(PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Add compact-stubs.
	(PARSE_AND_LIST_ARGS_CASES): Handle compact-stubs.  Adjust no-overlays
	handling.
ld/testsuite/
	* ld-spu/icache1.d: Update for fixed set_id, new manager entry, and
	reduced data.
2009-03-17 12:46:19 +00:00
Ulrich Weigand a14c90c1e7 * elf32-spu.c (spu_elf_check_vma): Do not reset auto_overlay
parameter just because fixed sections fit into local store.
	(spu_elf_auto_overlay): Do not declare as "noreturn".  Skip
	generating overlays if fixed sections plus reserved stack
	and heap space fit into local store.
2009-03-15 15:15:29 +00:00
Alan Modra 30c665df3f * elf32-spu.c (build_stub): Correct icache set_id.
(spu_elf_relocate_section): Likewise.
2009-03-15 03:28:51 +00:00
Ulrich Weigand 9b175a76d1 * elf32-spu.c (find_function_stack_adjust): Handle sf instruction
used to update stack pointer.
2009-03-11 00:18:02 +00:00
Alan Modra 3209bffac6 * elf32-spu.c (spu_elf_find_overlays): Call bfd_set_error on errors.
(find_function): Likewise.
	(pasted_function): Don't error if no prior function found.
	(discover_functions): Revert 2008-12-10 change.  Extend first
	function range to start of section.
2009-02-09 14:24:41 +00:00
Alan Modra 50e009621f * elf32-spu.c (spu_elf_build_stubs): Define __icache_neg_log2_linesize.
Define __icache_ptr_handler*, not __icache_ptr___icache_bi_handler*.
2009-02-04 02:42:57 +00:00
Alan Modra fb266b8bce bfd/
* elf32-spu.h (struct spu_elf_params): Add non_ia_text.
	* elf32-spu.c (mark_overlay_section): Only include .text.ia.*
	sections in soft-icache lines unless non_ia_text.  Don't add
	rodata if doing so would exceed line size.
ld/
	* emultempl/spuelf.em (params): Init new field.
	(OPTION_SPU_NON_IA_TEXT): Define.
	(PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Add --non-ia-text.
	(PARSE_AND_LIST_ARGS_CASES): Handle OPTION_SPU_NON_IA_TEXT.
2009-01-21 02:27:13 +00:00
Alan Modra 460e679b12 * elf32-spu.c (spu_elf_build_stubs): Make __icache_base absolute. 2009-01-12 14:13:03 +00:00
Alan Modra 25076afa95 * elf32-spu.c (remove_cycles): Always set call->max_depth. 2009-01-12 13:56:03 +00:00
Alan Modra 37107878d3 * elf32-spu.c (spu_elf_auto_overlay): Correct vma mask. 2009-01-12 04:09:43 +00:00
Alan Modra cd4a7468c9 bfd/
* elf32-spu.c (struct spu_link_hash_table): Add init, line_size_log2,
	num_lines_log2.
	(struct got_entry): Add br_addr.
	(struct call_info): Add priority.
	(struct function_info): Add lr_store and sp_adjust.
	(spu_elf_setup): Init line_size_log2 and num_lines_log2.
	(spu_elf_find_overlays): For soft-icache, mark any section within cache
	area as an overlay, and check that no other overlays exist.  Look up
	icache overlay manager entry sym.
	(BRA_STUBS, BRA, BRASL): Define.
	(enum _stub_type): Replace ovl_stub with call_ovl_stub and br*_ovl_stub.
	(needs_ovl_stub): Adjust for soft-icache.  Return priority encoded
	in branch insn.
	(count_stub, build_stub): Support soft-icache.
	(build_spuear_stubs, process_stubs): Adjust build_stub call.
	(spu_elf_size_stubs): Size soft-icache stubs.
	(overlay_index): New function.
	(spu_elf_build_stubs): Make static.  Support soft-icache.
	(spu_elf_check_vma): Don't turn off auto_overlay if soft-icache.
	(find_function_stack_adjust): Save lr store and stack adjust insn
	offsets.
	(maybe_insert_function): Adjust find_function_stack_adjust call.
	(mark_functions_via_relocs): Retrieve priority.
	(remove_cycles): Only warn about pruned arcs when stack_analysis.
	(sort_calls): Sort by priority first.
	(mark_overlay_section): Ignore .ovl.init.
	(sum_stack): Only print when stack_analysis.
	(print_one_overlay_section): New function, extracted from..
	(spu_elf_auto_overlay): ..here.  Support soft-icache overlays.
	(spu_elf_stack_analysis): Only print when htab->stack_analysis.
	(spu_elf_final_link): Call spu_elf_stack_analysis for lrlive
	analysis.  Call spu_elf_build_stubs.
	(spu_elf_relocate_section): For soft-icache encode overlay index
	into addresses.
	(spu_elf_output_symbol_hook): Support soft-icache.
	(spu_elf_modify_program_headers: Likewise.
	* elf32-spu.h (struct spu_elf_params): Add lrlive_analysis.  Rename
	num_regions to num_lines.  Add line_size and max_branch.
	(enum _ovly_flavour): Add ovly_soft_icache.
	(spu_elf_build_stubs): Delete.
gas/
	* config/tc-spu.c (md_pseudo_table): Add "brinfo".
	(brinfo): New var.
	(md_assemble): Poke brinfo into branch instructions.
	(spu_brinfo): New function.
	(md_apply_fix): Don't assume insn fields start off at zero, mask
	them to remove possible brinfo.
ld/
	* emultempl/spuelf.em (params): Init new fields.
	(num_lines_set, line_size_set, icache_mgr, icache_mgr_stream): New vars.
	(spu_place_special_section): Adjust placement for soft-icache.  Pad
	soft-icache section to a fixed size.  Clear addr_tree.
	(spu_elf_load_ovl_mgr): Support soft-icache.  Map overlay manager
	sections a little more intelligently.
	(gld${EMULATION_NAME}_finish): Don't call spu_elf_build_stubs.
	(OPTION_SPU_NUM_LINES): Rename from OPTION_SPU_NUM_REGIONS.
	(OPTION_SPU_SOFT_ICACHE, OPTION_SPU_LINE_SIZE): Define.
	(OPTION_SPU_LRLIVE): Define.
	(PARSE_AND_LIST_LONGOPTS): Add new soft-icache options.
	(PARSE_AND_LIST_OPTIONS): Likewise.
	(PARSE_AND_LIST_ARGS_CASES): Handle them.
	* emultempl/spu_icache.S: Dummy file.
	* emultempl/spu_icache.o_c: Regenerate.
	* Makefile.am (eelf32_spu.c): Depend on spu_icache.o_c.
	(spu_icache.o_c): Add rule to build.
	(CLEANFILES): Zap temp files.
	(EXTRA_DIST): Add spu_icache.o_c.
	* Makefile.in: Regenerate.
ld/testsuite/
	* ld-spu/ovl.d: Allow for absolute branches in stubs.
	* ld-spu/ovl2.d: Likewise.
2009-01-12 00:23:58 +00:00
Alan Modra a3a219a90a bfd/
* elf32-spu.h (struct spu_elf_params): Add num_regions.
	* elf32-spu.c (spu_elf_auto_overlay): Handle multiple overlay regions.
ld/
	* emultempl/spuelf.em (params): Init new field.
	(OPTION_SPU_NUM_REGIONS): Define.
	(PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Add --num-regions.
	(PARSE_AND_LIST_ARGS_CASES): Handle --num-regions.
2008-12-10 13:36:41 +00:00
Alan Modra 64615358cc bfd/
* elf32-spu.g (struct spu_elf_params, enum _ovly_flavour): New.
	(spu_elf_setup): Declare.
	(spu_elf_create_sections, spu_elf_size_stubs): Update prototype.
	(spu_elf_build_stubs, spu_elf_check_vma): Likewise.
	* elf32-spu.c (struct spu_link_hash_table): Add "params". Remove
	various other fields now in "params".  Adjust code throughout.
	(struct call_info, struct function_info): Move earlier in file.
	(struct spu_elf_stack_info): Likewise.
	(spu_elf_setup): New function.
	(spu_elf_create_sections): Remove args other than "info".
	(spu_elf_size_stubs, spu_elf_build_stubs, spu_elf_check_vma): Likewise.
	(maybe_needs_stubs): Remove "output_bfd" arg.  Adjust all calls.
	(interesting_section): Similarly with "obfd" arg.
	(needs_ovl_stub): Adjust output_section test.
	(allocate_spuear_stubs): Likewise.
	(OVL_STUB_SIZE): Don't define.
	(ovl_stub_size): New function, use in place of OVL_STUB_SIZE.
	(build_stub): Test params->ovly_flavour rather than OVL_STUB_SIZE.
	(spu_elf_auto_overlay): Remove args other than "info".  Make use
	of size returned from spu_elf_load_ovl_mgr.
	(spu_elf_stack_analysis): Remove args other than "info".
	(spu_elf_relocate_section): Tidy setting of "ea".
ld/
	* emultempl/spuelf.em (params): New var, used instead of various others.
	Adjust use throughout file.
	(spu_after_open): Call spu_elf_setup.
	(spu_place_special_section): Tidy.
	(spu_elf_load_ovl_mgr): Return total size of sections loaded.  Move
	code setting overlay section alignment to..
	(spu_before_allocation): ..here.
2008-12-10 06:32:52 +00:00
Alan Modra b0c4170911 * elf32-spu.c (define_ovtab_symbol): Don't abort on symbols
defined in linker scripts.
	(discover_functions): Consider STT_SECTION symbols too.
	(collect_lib_sections): Don't cut short call tree traversal
	when function size is too large.
2008-12-10 03:49:02 +00:00