Commit Graph

309 Commits

Author SHA1 Message Date
Nathan Sidwell ec6d26bed6 * ldlang.c (lang_check_section_addresses): Ignore non-loadable
sections when checking for overlap.  Clarify error message
	concerns load address.

	testsuite/
	* ld-scripts/rgn-at4.t: New.
	* ld-scripts/rgn-at4.d: New.
2009-05-22 11:27:44 +00:00
Alan Modra d127ecce68 ld/
* ldlang.c (lang_output_section_statement_lookup): Add function
	comment.  Make "name" non-const.  Ensure duplicate entries use
	the same string, allowing simple comparison in hash bucket loop.
	Tweak constraint check.
	(next_matching_output_section_statement): New function.
	* ldlang.h (lang_output_section_statement_lookup): Update.
	(next_matching_output_section_statement): Declare.
	* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Don't
	combine orphan sections when input sections flags differ in
	alloc or load.
	* emultempl/pe.em: Formatting throughout.
	(gld${EMULATION_NAME}_place_orphan): As for elf32.em.
	* emultempl/pep.em: Formatting throughout.
	(gld${EMULATION_NAME}_place_orphan): As for elf32.em.
ld/testsuite/
	* ld-elf/orphan3.d, * ld-elf/orphan3a.s, * ld-elf/orphan3b.s,
	* ld-elf/orphan3c.s, * ld-elf/orphan3d.s, * ld-elf/orphan3e.s,
	* ld-elf/orphan3f.s: New test.
	* ld-pe/orphan.d, * ld-pe/orphana.s, * ld-pe/orphanb.s,
	* ld-pe/orphand.s, * ld-pe/orphane.s: New test.
	* ld-pe/direct.exp: Use is_pecoff_format.
	* ld-pe/longsecn.exp: Delete.
	* ld-pe/pe.exp: Run new test and longsecn tests.
2009-05-15 14:22:36 +00:00
Alan Modra 011aa75f62 * ldlang.c (lang_insert_orphan): Add __start_<section> symbol
assignment inside output section statement.  Ensure only one
	set of symbols per output section.
	* emultempl/pe.em (gld_${EMULATION_NAME}_place_orphan): Add non-
	dollar sections before dollar sections.  Correct add_child
	list insertion.
	* emultempl/pep.em (gld_${EMULATION_NAME}_place_orphan): Likewise.
2009-05-14 02:21:45 +00:00
Richard Sandiford 3023e3f66a bfd/
* aout-adobe.c (aout_32_bfd_define_common_symbol): Define.
	* aout-target.h (MY_bfd_define_common_symbol): Likewise.
	* aout-tic30.c (MY_bfd_define_common_symbol): Likewise.
	* binary.c (binary_bfd_define_common_symbol): Likewise.
	* bout.c (b_out_bfd_define_common_symbol): Likewise.
	* coff-alpha.c (_bfd_ecoff_bfd_define_common_symbol): Likewise.
	* coff-mips.c (_bfd_ecoff_bfd_define_common_symbol): Likewise.
	* coffcode.h (coff_bfd_define_common_symbol): Likewise.
	* elfxx-target.h (bfd_elfNN_bfd_define_common_symbol): Likewise.
	* i386msdos.c (msdos_bfd_define_common_symbol): Likewise.
	* i386os9k.c (os9k_bfd_define_common_symbol): Likewise.
	* ieee.c (ieee_bfd_define_common_symbol): Likewise.
	* ihex.c (ihex_bfd_define_common_symbol): Likewise.
	* libbfd-in.h (_bfd_nolink_bfd_define_common_symbol): Likewise.
	* mach-o.c (bfd_mach_o_bfd_define_common_symbol): Likewise.
	* mmo.c (mmo_bfd_define_common_symbol): Likewise.
	* nlm-target.h (nlm_bfd_define_common_symbol): Likewise.
	* oasys.c (oasys_bfd_define_common_symbol): Likewise.
	* pef.c (bfd_pef_bfd_define_common_symbol): Likewise.
	* ppcboot.c (ppcboot_bfd_define_common_symbol): Likewise.
	* som.c (som_bfd_define_common_symbol): Likewise.
	* srec.c (srec_bfd_define_common_symbol): Likewise.
	* tekhex.c (tekhex_bfd_define_common_symbol): Likewise.
	* versados.c (versados_bfd_define_common_symbol): Likewise.
	* vms.c (vms_bfd_define_common_symbol): Likewise.
	* xcoff-target.h (_bfd_xcoff_bfd_define_common_symbol): Likewise.
	* xsym.c (bfd_sym_bfd_define_common_symbol): Likewise.
	* coff-rs6000.c (rs6000coff_vec): Add _bfd_xcoff_define_common_symbol.
	(pmac_xcoff_vec): Likewise.
	* coff64-rs6000.c (rs6000coff64_vec): Likewise.
	(aix5coff64_vec): Likewise.
	* linker.c (bfd_generic_define_common_symbol): New function.
	* targets.c (BFD_JUMP_TABLE_LINK): Add NAME##_bfd_define_common_symbol.
	(_bfd_define_common_symbol): New field.
	* libcoff-in.h (_bfd_xcoff_define_common_symbol): Declare.
	* xcofflink.c (_bfd_xcoff_define_common_symbol): New function.
	(xcoff_build_ldsyms): Don't set XCOFF_DEF_REGULAR for common
	symbols here.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Likewise.
	* libcoff.h: Likewise.

ld/
	* ldlang.c (lang_one_common): Use bfd_define_common_symbol.

ld/testsuite/
	* ld-powerpc/aix-export-2.s, ld-powerpc/aix-export-2.nd: New test.
	* ld-powerpc/aix52.exp: Run it.
2009-04-16 23:07:00 +00:00
Kazu Hirata 39e65143d2 gprof/
* gprof.h: Include gconfig.h.  #undef PACKAGE.

ld/
	* ldlang.c: Do not include limits.h.
2009-04-15 03:22:42 +00:00
Nathan Sidwell 113e68452e * ldlang.c (lang_leave_output_section_statement): Set lma_region
if it is not overridden and section is for the same vma region as
	the previous section.

	* ld-scripts/rgn-at.exp: New.
	* ld-scripts/rgn-at.s: New.
	* ld-scripts/rgn-at1.d: New.
	* ld-scripts/rgn-at1.t: New.
	* ld-scripts/rgn-at2.d: New.
	* ld-scripts/rgn-at2.t: New.
	* ld-scripts/rgn-at3.d: New.
	* ld-scripts/rgn-at3.t: New.
2009-04-03 07:45:28 +00:00
H.J. Lu 4bf27aa9ba ld/
2009-03-20  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/9970
	* ldlang.c (lang_end): Warn missing entry symbol for -pie.

ld/testsuite/

2009-03-20  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/9970
	* ld-pie/pie.exp: Use -fpie to compile.  Run *.d tests.

	* ld-pie/start.d: New.
	* ld-pie/start.s: Likewise.
2009-03-20 17:39:04 +00:00
Nick Clifton 4a93e18003 * ldgram.y: Add support for REGION_ALIAS operator.
* ldlang.c: Likewise.
        * ldlang.h: Likewise.
        * ldlex.l: Likewise.
        * NEWS: Mention the new feature.
        * ld.texinfo: Document the new feature.
        * ld-scripts/regions-alias-1.t: New file.
        * ld-scripts/regions-alias-2.t: New file.
        * ld-scripts/regions-alias-3.t: New file.
        * ld-scripts/regions-alias-4.t: New file.
        * ld-scripts/script.exp: Run region alias tests.
2009-03-02 17:27:36 +00:00
Alan Modra d2ae7be0b2 * ldlang.c (process_insert_statements): ASSERT that output section
statements are in order.
2009-02-16 08:02:29 +00:00
Alan Modra bde18da45e * ldlang.c (push_stat_ptr, pop_stat_ptr): New functions.
(stat_save, stat_save_ptr): New variables.
	(lang_insert_orphan): Use push_stat_ptr and pop_stat_ptr.
	(load_symbols): Likewise.  Delete dead "bad_load" code.
	(open_input_bfds): Warn on script containing output sections.
	(lang_enter_output_section_statement): Use push_stat_ptr.
	(lang_enter_group): Likewise.
	(lang_leave_output_section_statement): Use pop_stat_ptr.
	(lang_leave_group): Likewise.
	* ldlang.h (push_stat_ptr, pop_stat_ptr): Declare.
	* ldctor.c (ldctor_build_sets): Use push_stat_ptr and pop_stat_ptr.
	* emultempl/beos.em (gld_${EMULATION_NAME}_set_symbols): Likewise.
	* emultempl/pe.em (gld_${EMULATION_NAME}_set_symbols): Likewise.
	* emultempl/pep.em (gld_${EMULATION_NAME}_set_symbols): Likewise.
	* emultempl/spuelf.em (spu_place_special_section): Likewise.
	* emultempl/xtensaelf.em (ld_xtensa_insert_page_offsets): Likewise.
2009-02-16 07:25:52 +00:00
Nathan Sidwell 662ef24b70 Missing piece of 2009-01-26 commit
* ldlang.c (lang_process): Don't consider relocatable flag when
	checking for overlap.
2009-02-09 14:46:40 +00:00
Alan Modra ae5a359786 include/
PR 7047
	* bfdlink.h (struct bfd_elf_version_expr): Delete "symbol".
	Add "literal".
bfd/
	PR 7047
	* configure.in: Bump version.
	* configure: Regenerate.
	* elflink.c (_bfd_elf_link_assign_sym_version): Continue matching
	against version nodes when a global match is a wildcard.  Similarly
	continue matching on local wildcard matches, rather than only
	continuing for "*".  Have any global wildcard match override a
	local wildcard match.  Correct logic hiding unversioned symbol.
	(bfd_elf_size_dynamic_sections): Update for changes to struct
	bfd_elf_version_expr.
ld/
	PR 7047
	* emultempl/ppc64elf.em (gld${EMULATION_NAME}_new_vers_pattern): Update
	for changes to struct bfd_elf_version_expr.
	* ldlang.c (lang_vers_match, version_expr_head_hash): Likewise.
	(version_expr_head_eq, lang_finalize_version_expr_head): Likewise.
	(lang_register_vers_node): Likewise.
	(lang_new_vers_pattern): Likewise.  Ensure "literal" is set when
	no glob chars found in "pattern".
	(realsymbol): Correct backslash quote logic.
	* ld.texinfo (VERSION): Warn about global wildcards.
2008-11-26 01:04:17 +00:00
Alan Modra 7512c3973e * ldlang.c (lang_record_phdrs): Don't add orphans to PT_INTERP header. 2008-11-24 07:54:34 +00:00
Nick Clifton fb6cee9639 PR 6945
* ldlang.c (lang_size_sections_1): Do not update the VMAs of
        output sections when performing a relocatable link on COFF
        objects.
2008-10-25 09:54:01 +00:00
Alan Modra 07890c0736 * ldlang.c (lang_output_section_find_by_flags): Handle non-alloc
sections.
	* emultempl/elf32.em (enum orphan_save_index): Add orphan_nonalloc.
	(hold): Likewise.
	(gld${EMULATION_NAME}_place_orphan): Handle non-alloc orphans.
2008-10-21 22:55:04 +00:00
Alan Modra 8a99a385a7 * ldemul.c (ldemul_place_orphan): Add "constraint" param.
* ldemul.h (ldemul_place_orphan): Update prototype.
	(struct ld_emulation_xfer_struct <place_orphan>): Likewise add param.
	* ldlang.c (unique_section_p): Make static.
	(lang_output_section_statement_lookup): Optimise creation of SPECIAL
	sections.
	(lang_insert_orphan): Add "constraint" param.  Pass to
	lang_enter_output_section_statement.
	(init_os): Don't use an existing bfd section for SPECIAL sections.
	(lang_place_orphans): Don't rename unique output sections, instead
	mark their output section statements SPECIAL.
	* ldlang.h (lang_insert_orphan): Update prototype.
	(unique_section_p): Delete.
	* emultempl/beos.em (place_orphan): Add "constraint" param.
	* emultempl/elf32.em (place_orphan): Likewise.  Don't match existing
	output sections if set.
	* emultempl/pe.em (place_orphan): Likewise.
	* emultempl/pep.em (place_orphan): Likewise.
	* emultempl/mmo.em (mmo_place_orphan): Update.
	* emultempl/spuelf.em (spu_place_special_section): Update.
2008-10-04 06:08:59 +00:00
Alan Modra bcacc0f587 bfd/
* elf.c (bfd_elf_set_group_contents): Assign sh_info for ld -r when
	the signature symbol is global.
	* elflink.c (elf_link_input_bfd): Ensure group signature symbol
	is output when ld -r.  Set group sh_info when local.
	* linker.c (default_indirect_link_order): Handle group sections
	specially.
ld/
	* ldemul.c (ldemul_place_orphan): Add "name" param.
	* ldemul.h (ldemul_place_orphan): Update prototype.
	(struct ld_emulation_xfer_struct <place_orphan>): Likewise.
	* ldlang.c (lang_place_orphans): Generate unique section names here..
	* emultempl/elf32.em (place_orphan): ..rather than here.  Don't
	directly use an existing output section statement that has no
	bfd section.
	* emultempl/pe.em (place_orphan): Likewise.
	* emultempl/pep.em (place_orphan): Likewise.
	* emultempl/beos.em (place_orphan): Adjust.
	* emultempl/spuelf.em (spu_place_special_section): Adjust
	place_orphan call.
	* emultempl/genelf.em (gld${EMULATION_NAME}_after_open): New function.
	(LDEMUL_AFTER_OPEN): Define.
2008-10-03 09:40:49 +00:00
Alan Modra 66c103b772 * ldlang.h (lang_output_section_find): Define.
(lang_output_section_statement_lookup): Update prototype.
	* ldlang.c (lang_output_section_find,
	lang_output_section_statement_lookup_1): Merge into..
	(lang_output_section_statement_lookup): ..here.  Update all callers.
	(process_insert_statements): Set constraint negative
	for output section statements we might be inserting.  Make error
	fatal on not finding insertion section.
	(lang_output_section_find): Rather than comparing
	output_section_statement.constraint against -1, test whether
	it is postive.
	(lang_output_section_statement_lookup_1): Likewise.
	(output_prev_sec_find, strip_excluded_output_sections): Likewise.
	(lang_record_phdrs): Likewise.
	* emultempl/elf32.em (output_rel_find): Likewise.
	* NEWS: Mention INSERT.
2008-09-07 04:02:31 +00:00
Jan Kratochvil 2b60860a4c PR ld/6833
* ldexp.c (fold_binary <DATA_SEGMENT_ALIGN>): Do not align
	EXPLD.DATASEG.MIN_BASE.
	* ldlang.c (lang_size_sections): New variable OLD_BASE.  Rename
	OLD_MIN_BASE to MIN_BASE with the former alignment from `ldexp.c'.
	Use OLD_BASE now for the minimal base check after the base decrease by
	the maximum alignment found.
2008-08-21 13:10:54 +00:00
Alan Modra 5c1d2f5f4c bfd/
* bfd.c (struct _bfd): Correct outsymbols comment.
	* bfd-in2.h: Regenerate.
	* linker.c (bfd_generic_link_read_symbols): Renamed from..
	(generic_link_read_symbols): ..this, and made global.

include/
	* bfdlink.h (bfd_generic_link_read_symbols): Declare.
ld/
	PR 6478
	* ldcref.c (check_local_sym_xref): Use bfd_generic_link_read_symbols.
	Don't free symbol pointer array.
	(check_refs): Likewise.
	* ldmain.c (warning_callback): Likewise.
	* ldmisc.c (vfinfo): Likewise.
	* pe-dll.c (process_def_file): Likewise.
	(pe_walk_relocs_of_symbol, generate_reloc): Likewise.
	* emultempl/pe.em (pe_find_data_imports): Likewise.
	(gld_${EMULATION_NAME}_after_open): Likewise.
	* emultempl/pep.em (pep_find_data_imports): Likewise.
	(gld_${EMULATION_NAME}_after_open): Likewise.
	* ldlang.h (lang_input_statement_type): Delete asymbols, symbol_count,
	passive_position, closed.
	* ldlang.c (new_afile): Don't set asymbols and symbol_count.
	* ldmain.c (add_archive_element): xcalloc lang_input_statement_type.
2008-08-17 03:12:50 +00:00
Nick Clifton 5590fba953 * ldlang.c (print_output_section_statement): If the output section
statement has an update_dot_tree expression, apply it to
        print_dot.
        (print_input_section): Do not update print_dot if it would move
        print_dot backwards.
        (lang_do_assignments_1): If the output section statement has an
        update_dot_tree expression apply it to dot.

  * ld-scripts/overlay-size.t (end_of_bss_overlays): Define.
  (end_of_text_overlays): Define.
  (end_of_data_overlays): Define.
  * ld-scripts/overlay-size-map.d: Add expected values for
  end_of_bss_overlays, end_of_text_overlays and
  end_of_data_overlays.
2008-06-12 11:27:38 +00:00
Alan Modra 967928e916 * NEWS: Mention archive:path patterns.
* ld.texinfo: Likewise.
	* ldlang.c: Formatting throughout.
	(archive_path): Only assume "[A-Za-z]:" is a dos drive.
	(input_statement_is_archive_path): New function, extracted from..
	(walk_wild): ..here.
	(walk_wild_consider_section): Match archive:path here too.
	(init_map_userdata, sort_def_symbol): Convert to ISO C.
	* ldmain.c (main): Set link_info.path_separator.
	* emultempl/spuelf.em (choose_target): Don't set it here.
2008-06-07 11:35:46 +00:00
Alan Modra 97407faf3d include/
* bfdlink.h (struct bfd_link_info): Add "path_separator".
bfd/
	* elf32-spu.c (spu_elf_auto_overlay): Relax requirement that
	file names be unique.  Specify archive:path in overlay script.
ld/
	* ldlang.c (name_match): New function.
	(unique_section_p, walk_wild_consider_section): Use it here.
	(walk_wild_section_general): And here.
	(archive_path): New function.
	(walk_wild): Match archive:path filespecs.
	(open_input_bfds): Don't load archive:path files.
	* emultempl/spuelf.em (choose_target): Set path_separator.
	* emulparams/elf32_spu.sh: Add ._ea.* sections to ._ea output.
2008-06-06 06:02:00 +00:00
Nick Clifton de7dd2bdee PR ld/6430
* testsuite/ld-elfcomm/elfcomm.exp (test_sort_common): Test the
            ascending/descending argument to the --sort-common command line
            option.
            * testsuite/ld-elfcomm/sort-common.s: New file.
            * ld.h (enum sort_order): New.
            * ldlang.c (lang_check: Fix comment.
            (lang_common): Sort commons in ascending or descending order.
            (lang_one_common): Likewise.
            * lexsup.c (ld_options): Have --sort-common take an option
            argument.
            (parse_args): Handle argument to --sort-common.
            * ld.texinfo (--sort-common): Document new optional argument.
            * NEWS: Mention new feature.
2008-05-31 16:35:56 +00:00
Nick Clifton 906e58cab5 bfd/
* elf32-arm.c (THM2_MAX_FWD_BRANCH_OFFSET): Define.
        (THM2_MAX_BWD_BRANCH_OFFSET): Define.
        (ARM_MAX_FWD_BRANCH_OFFSET): Define.
        (ARM_MAX_BWD_BRANCH_OFFSET): Define.
        (THM_MAX_FWD_BRANCH_OFFSET): Define.
        (THM_MAX_BWD_BRANCH_OFFSET): Define.
        (arm_long_branch_stub): Define.
        (arm_pic_long_branch_stub): Define.
        (arm_thumb_v4t_long_branch_stub): Define.
        (arm_thumb_thumb_long_branch_stub): Define.
        (arm_thumb_arm_v4t_long_branch_stub): Define.
        (STUB_SUFFIX): Define.
        (elf32_arm_stub_type): Define.
        (elf32_arm_stub_hash_entry): Define.
        (elf32_arm_link_hash_entry): Add stub_cache field.
        (arm_stub_hash_lookup): Define.
        (elf32_arm_link_hash_table): Add stub_hash_table, stub_bfd,
        add_stub_section, layout_sections_again, stub_group, bfd_count,
        top_index, input_list fields.
        (elf32_arm_link_hash_newfunc): Init new field.
        (stub_hash_newfunc): New function.
        (elf32_arm_link_hash_table_create): Init stub_hash_table.
        (elf32_arm_hash_table_free): New function.
        (arm_type_of_stub): New function.
        (elf32_arm_stub_name): New function.
        (elf32_arm_get_stub_entry): New function.
        (elf32_arm_stub_add_mapping_symbol): New function.
        (elf32_arm_add_stub): New function.
        (arm_build_one_stub): New function.
        (arm_size_one_stub): New function.
        (elf32_arm_setup_section_lists): New function.
        (elf32_arm_next_input_section): New function.
        (group_sections): New function.
        (elf32_arm_size_stubs): New function.
        (elf32_arm_build_stubs): New function.
        (bfd_elf32_arm_add_glue_sections_to_bfd): Skip stub sections.
        (bfd_elf32_arm_process_before_allocation): No longer handle
        R_ARM_CALL and R_ARM_THM_CALL.
        (using_thumb_only): New function.
        (elf32_arm_final_link_relocate): Redirect calls to stub if range
        exceeds encoding capabilities.
        (bfd_elf32_bfd_link_hash_table_free): Define.
        * bfd-in.h (R_ARM_max): Fix value to 130.
        (elf32_arm_setup_section_lists): Protype.
        (elf32_arm_next_input_section): Protype.
        (elf32_arm_size_stubs): Protype.
        (elf32_arm_build_stubs): Protype.

        ld/
        * emultempl/armelf.em (build_section_lists): New function.
        (stub_file): Define.
        (need_laying_out): Define.
        (group_size): Define.
        (hook_stub_info): Define.
        (hook_in_stub): New function.
        (elf32_arm_add_stub_section): New function.
        (gldarm_layout_sections_again): New function.
        (gld${EMULATION_NAME}_finish): Replace arm_elf_finish(). Generate
        stubs for long calls if needed.
        (arm_elf_create_output_section_statements): create stub_file bfd.
        (arm_for_each_input_file_wrapper): New function.
        (arm_lang_for_each_input_file): New function.
        (lang_for_each_input_file): Define.
        (PARSE_AND_LIST_PROLOGUE): Add option token OPTION_STUBGROUP_SIZE.
        (PARSE_AND_LIST_LONGOPTS): Add option stub-group-size.
        (PARSE_AND_LIST_OPTIONS): Add option stub-group-size.
        (PARSE_AND_LIST_ARGS_CASES): Add OPTION_STUBGROUP_SIZE case.
        (LDEMUL_FINISH): Update to gld${EMULATION_NAME}_finish.
        * ld/lang.c (print_input_statement): Skip if bfd has
        BFD_LINKER_CREATED.

        ld/testsuite
        * ld-arm/arm-elf.exp (armelftests): Add farcall-arm-arm,
        farcall-arm-arm-pic-veneer, farcall-arm-arm-be8 farcall-arm-thumb,
        farcall-arm-thumb-blx, farcall-arm-thumb-pic-veneer,
        farcall-arm-thumb-blx-pic-veneer, farcall-thumb-thumb,
        farcall-thumb-thumb-pic-veneer, farcall-thumb-thumb-blx,
        farcall-thumb-thumb-m, farcall-thumb-thumb-m-pic-veneer,
        farcall-thumb-thumb-blx-pic-veneer, farcall-thumb-arm,
        farcall-thumb-arm-pic-veneer, farcall-thumb-arm-blx,
        farcall-thumb-arm-blx-pic-veneer.
        Change thumb2-bl-as-thumb1-bad, thumb2-bl-bad.
        * ld-arm/thumb2-bl-as-thumb1-bad.d: Reflects farcall stub
        generation.
        * ld-arm/thumb2-bl-bad.d: Likewise.
        * ld-arm/thumb2-bl-as-thumb1-bad.s: Update comments.
        * ld-arm/thumb2-bl-bad.s: Likewise.
2008-05-15 17:00:15 +00:00
Nathan Sidwell a2cab75396 ld/
* ldlang.c (lang_size_sections_1): Don't check LMA overflow on
	non-load sections.
ld/testsuite/
	* ld-scripts/rgn-over.exp: Allow -ok file names to pass.
	* ld-scripts/rgn-over8.s: New.
	* ld-scripts/rgn-over8.t: New.
	* ld-scripts/rgn-over8-ok.d: New.
2008-04-28 12:45:34 +00:00
Nick Clifton 07dfcf3884 PR ld/5785
* ldlang.c (lang_size_sections_1): Honour the setting of an
        lma_region even if there is no vma region set, or the vma region
        is the same as the lma region.
2008-02-22 14:19:43 +00:00
Alan Modra f13a99db51 include/
* 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-15 03:35:53 +00:00
Alan Modra ff7a0acf26 * ldlang.c (new_afile): Don't pass unadorned NULL to concat.
* ldfile.c (ldfile_add_library_path): Likewise.
	* emultempl/elf32.em (check_ld_elf_hints, check_ld_so_conf): Likewise.
	* emultempl/lnk960.em (lnk960_before_parse): Likewise.
	* emultempl/spuelf.em (embedded_spu_file): Likewise.
2008-02-07 08:41:10 +00:00
H.J. Lu 29183214f7 2008-01-25 H.J. Lu <hongjiu.lu@intel.com>
PR ld/5670
	* ldlang.c (process_insert_statements): Silence gcc 4.1 alias
	warning.
2008-01-25 17:34:29 +00:00
Alan Modra 53d25da64b ld/
* ld.texinfo (INSERT): Describe.
	* ldgram.y (ldgram_in_script, ldgram_had_equals): Delete.
	(INSERT_K, AFTER, BEFORE): Add as tokens.
	(ifile_p1): Handle INSERT statements.
	(saved_script_handle, force_make_executable): Move to..
	* ldmain.c: ..here.
	(previous_script_handle): New global var.
	* ldmain.h (saved_script_handle, force_make_executable): Declare.
	(previous_script_handle): Likewise.
	* ldlex.l (INSERT_K, AFTER, BEFORE): Add tokens.
	* lexsup.c (parge_args <-T>): Set previous_script_handle.
	* ldlang.c (lang_for_each_statement_worker): Handle insert statement.
	(map_input_to_output_sections, print_statement): Likewise.
	(lang_size_sections_1, lang_do_assignments_1): Likewise.
	(insert_os_after): New function, extracted from..
	(lang_insert_orphan): ..here.
	(process_insert_statements): New function.
	(lang_process): Call it.
	(lang_add_insert): New function.
	* ldlang.h (lang_insert_statement_enum): New.
	(lang_insert_statement_type): New.
	(lang_statement_union_type): Add insert_statement.
	(lang_add_insert): Declare.
ld/testsuite/
	* ld-spu/ovl.lnk: Delete overlay.
	* ld-spu/ovl1.lnk: New file.
	* ld-spu/ovl2.lnk: New file.
	* ld-spu/ovl.d: Update.
	* ld-spu/ovl2.d: Update.
2008-01-25 12:03:37 +00:00
Alan Modra 14ac84b444 * ldlang.c (lang_size_sections_1): Simplify SEC_NEVER_LOAD test. 2008-01-16 01:28:21 +00:00
Alan Modra 3d00b095cc * ldlang.h (lang_afile_asection_pair_statement_enum): Delete.
(lang_afile_asection_pair_statement_type): Delete.
	(lang_statement_union_type): Delete afile_asection_pair_statement.
	* ldlang.c (lang_insert_orphan): Delete case handling the above.
	(map_input_to_output_sections, print_statement): Likewise.
2008-01-16 00:31:18 +00:00
Alan Modra 74f0fb5065 bfd/
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-15 07:25:49 +00:00
Tristan Gingold ac69cbc672 ld:
2008-01-11  Tristan Gingold  <gingold@adacore.com>
	    Eric Botcazou  <ebotcazou@adacore.com>

	* ldlang.c (lang_end): Warns if the entry point is not found when
	--gc-sections.
	Emit an error if no root is specified when --gc-sections -r.
	* ld.texinfo (Options): Document that --gc-sections is compatible
	with -r and -q.
	* ldmain.c (main): Do not error out if -r and --gc-sections.
	* scripttempl/elf.sc: Emit ENTRY command only if relocating.

ld/testsuite:
2008-01-11  Tristan Gingold  <gingold@adacore.com>

	* lib/ld-lib.exp (check_gc_sections_available): Now available on
	VxWorks.
	* ld-gc: New directory for testing --gc-sections.
	* ld-gc/gc.c: New file.
	* ld-gc/gc.exp: New file.
	* ld-gc/noent.s: New file.
	* ld-gc/noent.d: New file.
2008-01-11 09:11:18 +00:00
Nick Clifton 71934f948a PR ld/5533
* ldlang.c (lang_end): Issue a warning for a missing start symbol
        of a shared library if the symbol was specified on the command
        line.
2008-01-10 14:28:49 +00:00
Daniel Jacobowitz 20e5635130 2007-10-17 Zack Weinberg <zack@codesourcery.com>
* ldlang.c (lang_check_section_addresses): Also report size of
	overflow for any overflowed memory regions.
	(os_region_check): Diagnose an overflowed region only once per
	region.  Do not reset region->current on overflow.

2007-10-17  Zack Weinberg  <zack@codesourcery.com>
	    Daniel Jacobowitz  <dan@codesourcery.com>
	    Mark Shinwell  <shinwell@codesourcery.com>
	    Joseph Myers  <joseph@codesourcery.com>

	* ld-scripts/rgn-over.exp: New driver.
	* ld-scripts/rgn-over.s: New file.
	* ld-scripts/rgn-over1.d, ld-scripts/rgn-over1.t,
	ld-scripts/rgn-over2.d, ld-scripts/rgn-over2.t,
	ld-scripts/rgn-over3.d, ld-scripts/rgn-over3.t,
	ld-scripts/rgn-over4.d, ld-scripts/rgn-over4.t,
	ld-scripts/rgn-over5.d, ld-scripts/rgn-over5.t,
	ld-scripts/rgn-over6.d, ld-scripts/rgn-over6.t,
	ld-scripts/rgn-over7.d, ld-scripts/rgn-over7.t:
	New test cases.
2007-10-17 19:26:10 +00:00
H.J. Lu b10a8ae01c bfd/
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-09-18 00:25:07 +00:00
Nick Clifton a1438fce30 * ldlang.c (lang_map): Increment lang_statement_iteration so that DEFINED() expressions are correctly computed.
* testsuite/ld-script/map-address.d,
* testsuite/ld-script/map-address.t: Add a test for testing DEFINED in map output.
2007-08-31 14:46:55 +00:00
Alan Modra e94425729c * ldlang.c (lang_record_phdrs): Give a fatal error if no sections
assigned to phdrs.  Avoid multiple forward scans for a section
	with phdr assignment.
2007-08-31 00:39:53 +00:00
Joseph Myers 7f6a71ffb6 bfd:
2007-08-28  Mark Shinwell  <shinwell@codesourcery.com>
            Joseph Myers  <joseph@codesourcery.com>

	* elf32-arm.c (elf32_arm_compare_mapping): Compare first on vma,
	then on type.

binutils/testsuite:
2007-08-28  Mark Shinwell  <shinwell@codesourcery.com>
            Joseph Myers  <joseph@codesourcery.com>

	* binutils-all/ar.exp (long_filenames): Delete temporary files on
	the host.
	* binutils-all/arm/objdump.exp: Only check "which $OBJDUMP" if
	host is local.
	* binutils-all/objcopy.exp: Use ${srecfile} to get the name of the
	srec file to be passed to binutils_run.
	(objcopy_test_readelf): Use remote_exec.
	* binutils-all/readelf.exp (readelf_find_size): Use remote_exec.
	(readelf_test): Likewise.
	(readelf_wi_test): Likewise.
	* lib/utils-lib.exp (run_dump_test): Only check "which $binary" if
	host is local.  Use remote_exec.  Use $tempfile not
	tmpdir/bintest.o.

gas:
2007-08-28  Mark Shinwell  <shinwell@codesourcery.com>
            Joseph Myers  <joseph@codesourcery.com>

	* as.c (main): Flush stderr before printing listings to ensure
	consistent output order across platforms.

gas/testsuite:
2007-08-28  Mark Shinwell  <shinwell@codesourcery.com>
            Joseph Myers  <joseph@codesourcery.com>

	* lib/gas-defs.exp (gas_version): Use remote_* functions instead
	of exec.
	(gas_host_run): New.
	(gas_run): Use gas_host_run.
	(gas_start): Likewise.
	(run_dump_test): Likewise.
	(objdump): Use gas_host_run.
	(objdump_start_no_subdir): Likewise.
	* lib/gas-dg.exp (gas-dg-test): Use "remote_file host delete".
	* lib/run: Remove.
	* gas/macros/macros.exp: Download app4b.s to host.
	* gas/i386/i386.exp (gas_64_check): Use gas_host_run.
	(gas_32_check): Likewise.
	* gas/maxq10/maxq10.exp (gas_64_check): Likewise
	(gas_32_check): Likewise.
	* gas/maxq20/maxq20.exp (gas_64_check): Likewise
	(gas_32_check): Likewise.
	* gas/sparc/sparc.exp (gas_64_check): Likewise.
	* gas/cfi/cfi.exp: Likewise.
	* gas/elf/elf.exp (run_list_test): Likewise.  Use temporary file
	for readelf output in place of pipe.
	* gas/all/gas.exp: Download incbin.dat to host.
	(do_comment): Allow \r\r\n.

ld:
2007-08-28  Mark Shinwell  <shinwell@codesourcery.com>
            Joseph Myers  <joseph@codesourcery.com>

	* ldlang.c (sort_sections_by_lma): Sort by internal id after lma
	for stable sort.

ld/testsuite:
2007-08-28  Mark Shinwell  <shinwell@codesourcery.com>
            Joseph Myers  <joseph@codesourcery.com>

	* ld-elfcomm/elfcomm.exp: Use run_host_cmd.  Only check "which
	$CC" if host is local.
	* ld-checks/checks.exp: Use run_host_cmd.
	* ld-elf/exclude.exp: Likewise.
	* ld-elf/elf.exp: Download merge.ld if host is remote.
	* ld-elf/binutils.exp (binutils_test): Use remote_exec.
	* ld-elf/tls_common.exp: Use run_host_cmd.
	* lib/ld-lib.exp (ld_version): Only check "which $ld" if host is
	local.  Use remote_exec.
	(run_host_cmd): New.
	(run_host_cmd_yesno): New.
	(default_ld_relocate): Use run_host_cmd_yesno.
	(default_ld_link): Likewise.
	(default_ld_simple_link): Use run_host_cmd.
	(default_ld_compile): Only check "which $ccprog" if host is local.
	Use remote_file and remote_exec.
	(default_ld_assemble): Only check "which $as" if host is local.
	Use run_host_cmd.
	(default_ld_nm): Use remote_exec, remote_upload and remote_file.
	(run_dump_test): Use remote_exec, remote_upload and remote_file.
	Only check "which $binary" if host is local.
	(run_ld_link_tests): Use remote_exec, remote_upload and
	remote_file.
	* ld-selective/selective.exp: Only check "which $CXX" if host is
	local.  Use remote_exec.
	* ld-scripts/phdrs.exp: Only check "which $objdump" if host is
	local.  Use run_host_cmd.
	* ld-scripts/phdrs2.exp: Likewise.
	* ld-scripts/weak.exp: Likewise.
	* ld-undefined/weak-undef.exp: Likewise.
	* ld-scripts/crossref.exp: Only check "which $CC" if host is local.
	Use run_host_cmd.
	* ld-scripts/map-address.exp: Upload map_address.map if host is
	remote.
	* ld-srec/srec.exp (run_srec_tests): Use run_host_cmd.  Only check
	"which $CC" and "which $CXX" if host is local.
	* ld-undefined/undefined.exp: Only check "which $CC" if host is
	local.  Use remote_file and run_host_cmd.
	* config/default.exp: Use remote_exec to create tmpdir.
2007-08-28 13:21:58 +00:00
Alan Modra 48f2ff543d ld/
* ldlang.c (lang_insert_orphan): When searching through linker
	script to place an orphan, don't stop on statements that appear
	outside of SECTIONS.
	* emultempl/elf32.em (output_rel_find): Prefer read-only alloc
	sections over read/write alloc sections.
ld/testsuite/
	* ld-elf/weak-dyn-1.rd: Adjust.
2007-07-29 12:33:38 +00:00
Alan Modra 3d263d86a5 * ldlang.c (strip_excluded_output_sections): Don't ignore sections
with update_dot_tree.
2007-07-13 07:34:25 +00:00
Alan Modra 3bf9618b71 PR 4782
* ldlang.c (lang_size_sections_1 <output_section_statement>): Only
	use expld.result when valid.
2007-07-12 01:40:25 +00:00
Nick Clifton f96b4a7b0f Update sources to GPLv3 2007-07-06 14:09:45 +00:00
Alan Modra a9a4c53ecc include/
* bfdlink.h (struct bfd_link_info): Add input_bfds_tail.
bfd/
	* simple.c (bfd_simple_get_relocated_section_content): Init
	input_bfds_tail.
ld/
	* ldlang.c (ldlang_add_file): Use input_bfds_tail.
	* ldmain.c (main): Init input_bfds_tail.  Sort link_info
	initialization.
2007-05-31 15:04:52 +00:00
Alan Modra 9e7750f2ab commit the Robert's removal of "warning:" 2007-05-02 01:22:40 +00:00
Alan Modra 79ac49f00d * ldlang.c (lang_check): Error on architecture mismatch. 2007-05-01 13:35:34 +00:00
Alan Modra d7d4c8debe * ldcref.c (struct cref_hash_entry): Make "demangled" const.
(cref_fill_array): Adjust for changed demangler.
	* ldlang.c (lang_one_common): Likewise.
2007-04-28 06:04:28 +00:00
Alan Modra 3db64b0092 bfd/
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-26 14:47:00 +00:00