Commit Graph

366 Commits

Author SHA1 Message Date
Nick Clifton d3ce72d070 Updated sources to avoid using the identifier name "new", which is a
keyword in c++.

        * bfd/aoutx.h (NAME (aout, make_empty_symbol)): Rename variable
        new to new_symbol.
        * bfd/coffgen.c (coff_make_empty_symbol)
        (coff_bfd_make_debug_symbol): Rename variable new to new_symbol.
        * bfd/cpu-ia64-opc.c (ext_reg, ins_imms_scaled): Rename variable
        new to new_insn.
        * bfd/doc/chew.c (newentry, add_intrinsic): Rename variable new to
        new_d.
        * bfd/ecoff.c (_bfd_ecoff_make_empty_symbol): Rename variable new
        to new_symbol.
        * bfd/elf32-m68k.c (elf_m68k_get_got_entry_type): Rename argument
        new to new_reloc.
        * bfd/hash.c (bfd_hash_lookup): Rename variable new to new_string.
        * bfd/ieee.c (ieee_make_empty_symbol): Rename variable new to
        new_symbol.
        * bfd/linker.c (bfd_new_link_order): Rename variable new to
        new_lo.
        * bfd/mach-o.c (bfd_mach_o_sizeof_headers): Rename variable new to
        symbol.
        * bfd/oasys.c (oasys_make_empty_symbol): Rename variable new to
        new_symbol_type.
        * bfd/pdp11.c (NAME (aout, make_empty_symbol)): Rename variable
        new to new_symbol_type.
        * bfd/plugin.c (bfd_plugin_make_empty_symbol): Rename variable new
        to new_symbol.
        * bfd/rs6000-core.c (CoreHdr, VmInfo): Rename union member new to
        new_dump.
        (read_hdr, rs6000coff_core_p)
        (rs6000coff_core_file_matches_executable_p)
        (rs6000coff_core_file_failing_command)
        (rs6000coff_core_file_failing_signal): Updated function to use new
        union member name.
        * bfd/som.c (som_make_empty_symbol): Rename variable new to
        new_symbol_type.
        * bfd/syms.c (_bfd_generic_make_empty_symbol): Rename variable new
        to new_symbol.
        * bfd/tekhex.c (first_phase, tekhex_make_empty_symbol): Rename
        variable new to new_symbol.
        * binutils/nlmconv.c (main): Rename variable new to new_name.
        * gas/config/tc-arm.c (insert_reg_alias): Rename variable new to
        new_reg.
        * gas/config/tc-dlx.c (parse_operand): Rename variable new to
        new_pos.
        * gas/config/tc-ia64.c (ia64_gen_real_reloc_type): Rename variable
        new to newr.
        * gas/config/tc-mcore.c (parse_exp, parse_imm): Rename variable
        new to new_pointer.
        * gas/config/tc-microblaze.c (parse_exp, parse_imm, check_got):
        Change name from new to new_pointer.
        * gas/config/tc-or32.c (parse_operand): Rename variable new to
        new_pointer.
        * gas/config/tc-pdp11.c (md_assemble): Rename variable new to
        new_pointer.
        * gas/config/tc-pj.c (alias): Change argument new to new_name.
        * gas/config/tc-score.c (s3_build_score_ops_hsh): Rename variable
        new to new_opcode. (s3_build_dependency_insn_hsh) Rename variable
        new to new_i2n. (s3_convert): Rename variables old and new to
        r_old and r_new.
        * gas/config/tc-score7.c (s7_build_score_ops_hsh): Rename variable
        new to new_opcode. (s7_build_dependency_insn_hsh): Rename variable
        new to new_i2d. (s7_b32_relax_to_b16, s7_convert_frag): Rename
        variables old and new to r_old and r_new.
        * gas/config/tc-sh.c (parse_exp): Rename variable new to
        new_pointer.
        * gas/config/tc-sh64.c (shmedia_parse_exp): Rename variable new to
        new_pointer.
        * gas/config/tc-tic4x.c (tic4x_operand_parse): Rename variable new
        to new_pointer.
        * gas/config/tc-z8k.c (parse_exp): Rename variable new to
        new_pointer.
        * gas/listing.c (listing_newline): Rename variable new to new_i.
        * ld/ldexp.c (exp_intop, exp_bigintop, exp_relop, exp_binop)
        (exp_trinop, exp_unop, exp_nameop, exp_assop): Rename variable new
        to new_e.
        * ld/ldfile.c (ldfile_add_library_path): Rename variable new to
        new_dirs. (ldfile_add_arch): Rename variable new to new_arch.
        * ld/ldlang.c (new_statement, lang_final, lang_add_wild)
        (lang_target, lang_add_fill, lang_add_data, lang_add_assignment)
        (lang_add_insert): Rename variable new to new_stmt. (new_afile):
        Added missing cast. (lang_memory_region_lookup): Rename variable
        new to new_region. (init_os): Rename variable new to
        new_userdata. (lang_add_section): Rename variable new to
        new_section. (ldlang_add_undef): Rename variable new to
        new_undef. (realsymbol): Rename variable new to new_name.
        * opcodes/z8kgen.c (internal, gas): Rename variable new to new_op.

        Updated sources to avoid using the identifier name "template",
        which is a keyword in c++.

        * bfd/elf32-arm.c (struct stub_def): Rename member template to
        template_sequence. (arm_build_one_stub,
        find_stub_size_and_template, arm_size_one_stub, arm_map_one_stub):
        Rename variable template to template_sequence.
        * bfd/elfxx-ia64.c (elfNN_ia64_relax_br, elfNN_ia64_relax_brl):
        Rename variable template to template_val.
        * gas/config/tc-arm.c (struct asm_cond, struct asm_psr, struct
        asm_barrier_opt): Change member template to
        template_name. (md_begin): Update code to reflect new member
        names.
        * gas/config/tc-i386.c (struct templates, struct _i386_insn)
        (match_template, cpu_flags_match, match_reg_size, match_mem_size)
        (operand_size_match, md_begin, i386_print_statistics, pi)
        (build_vex_prefix, md_assemble, parse_insn, optimize_imm)
        (optimize_disp): Updated code to use new names. (parse_insn):
        Added casts.
        * gas/config/tc-ia64.c (dot_template, emit_one_bundle): Updated
        code to use new names.
        * gas/config/tc-score.c (struct s3_asm_opcode): Renamed member
        template to template_name. (s3_parse_16_32_inst, s3_parse_48_inst,
        s3_do_macro_ldst_label, s3_build_score_ops_hsh): Update code to
        use new names.
        * gas/config/tc-score7.c (struct s7_asm_opcode): Renamed member
        template to template_name. (s7_parse_16_32_inst,
        s7_do_macro_ldst_label, s7_build_score_ops_hsh): Update code to
        use new names.
        * gas/config/tc-tic30.c (md_begin, struct tic30_insn)
        (md_assemble): Update code to use new names.
        * gas/config/tc-tic54x.c (struct _tic54x_insn, md_begin)
        (optimize_insn, tic54x_parse_insn, next_line_shows_parallel):
        Update code to use new names.
        * include/opcode/tic30.h (template): Rename type template to
        insn_template. Updated code to use new name.
        * include/opcode/tic54x.h (template): Rename type template to
        insn_template.
        * opcodes/cris-dis.c (bytes_to_skip): Update code to use new name.
        * opcodes/i386-dis.c (putop): Update code to use new name.
        * opcodes/i386-gen.c (process_i386_opcodes): Update code to use
        new name.
        * opcodes/i386-opc.h (struct template): Rename struct template to
        insn_template. Update code accordingly.
        * opcodes/i386-tbl.h (i386_optab): Update type to use new name.
        * opcodes/ia64-dis.c (print_insn_ia64): Rename variable template
        to template_val.
        * opcodes/tic30-dis.c (struct instruction, get_tic30_instruction):
        Update code to use new name.
        * opcodes/tic54x-dis.c (has_lkaddr, get_insn_size)
        (print_parallel_instruction, print_insn_tic54x, tic54x_get_insn):
        Update code to use new name.
        * opcodes/tic54x-opc.c (tic54x_unknown_opcode, tic54x_optab):
        Update type to new name.
2009-08-29 22:11:02 +00:00
Tristan Gingold 02688209cd 2009-08-12 Tristan Gingold <gingold@adacore.com>
* ld.h (fat_user_section_struct): Add map_symbol_def_count field.
	* ldlang.c (hash_entry_addr_cmp): New function.
	(print_all_symbols): Sort the symbols by address before printing them.
2009-08-12 12:40:55 +00:00
Alan Modra eaeb0a9d5c PR 10474
* ldemul.c (after_allocation_default): Run lang_relax_sections.
	* ldlang.h (lang_relax_sections): Declare.
	* ldlang.c (relax_sections): Delete.
	(lang_relax_sections): New function.
	(lang_process): Don't relax directly from here.
	* emultempl/alphaelf.em (alpha_finish): Call finish_default.
	* emultempl/armelf.em (arm_elf_after_allocation): Delete.  Move body..
	(gld${EMULATION_NAME}_finish): ..to here.  Move existing code..
	(gld${EMULATION_NAME}_after_allocation): ..to here.  New function.
	(LDEMUL_AFTER_ALLOCATION): Update.
	* emultempl/avrelf.em (avr_elf_finish, LDEMUL_FINISH): Delete.
	(avr_elf_after_allocation): New function.
	(LDEMUL_AFTER_ALLOCATION): Define.
	* emultempl/elf-generic.em (gld${EMULATION_NAME}_map_segments): Call
	lang_relax_sections.
	* emultempl/elf32.em (gld${EMULATION_NAME}_finish): Delete.  Move..
	(gld${EMULATION_NAME}_after_allocation): ..code to here.  New function.
	(LDEMUL_AFTER_ALLOCATION, LDEMUL_FINISH): Update.
	* emultempl/genelf.em (gld${EMULATION_NAME}_finish): Delete.  Move..
	(gld${EMULATION_NAME}_after_allocation): ..code to here.  New function.
	(LDEMUL_FINISH): Delete.
	(LDEMUL_AFTER_ALLOCATION): Define.
	* emultempl/hppaelf.em (gld${EMULATION_NAME}_finish): Delete.  Move..
	(gld${EMULATION_NAME}_after_allocation): ..to here.  New function.
	(LDEMUL_FINISH): Delete.
	(LDEMUL_AFTER_ALLOCATION): Define.
	* emultempl/m68hc1xelf.em (m68hc11elf_finish): Delete.  Move..
	(m68hc11elf_after_allocation): ..to here.  New function.
	(LDEMUL_FINISH): Delete.
	(LDEMUL_AFTER_ALLOCATION): Define.
	* emultempl/m68kelf.em (m68k_elf_after_allocation): Call
	gld${EMULATION_NAME}_after_allocation.
	* emultempl/mmix-elfnmmo.em (mmix_after_allocation): Call
	gld${EMULATION_NAME}_after_allocation.
	* emultempl/mmo.em (mmo_finish): Delete.  Move body..
	(gld${EMULATION_NAME}_after_allocation): ..to here.  New function.
	(LDEMUL_FINISH): Define.
	* emultempl/ppc64elf.em (ppc_layout_sections_again): Set elf_gp.
	(gld${EMULATION_NAME}_finish): Move code sizing sections..
	(gld${EMULATION_NAME}_after_allocation): ..to here.
	* emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_after_allocation):
	Call gld${EMULATION_NAME}_after_allocation.
	* emultempl/spuelf.em (gld${EMULATION_NAME}_finish): Delete
	bfd_elf_discard_info and map_segments call.
2009-08-10 07:50:56 +00:00
H.J. Lu 249b2a84f4 2009-07-22 H.J. Lu <hongjiu.lu@intel.com>
PR ld/10429
	* ldlang.c (insert_os_after): Tie assignments to non-alloc
	output sections if there is no-input section.
2009-07-23 00:08:22 +00:00
Alan Modra 0fa4d7cf2d * ldlang.c (insert_os_after): Don't tie assignments to non-alloc
output sections.
2009-07-11 00:10:29 +00:00
Tristan Gingold d64703c6e8 2009-06-25 Tristan Gingold <gingold@adacore.com>
* ldlang.c (print_input_section): Add is_discarded parameter.  Adjust
	prototype.
	(lang_map): Print the size of discarded sections.
	(print_statement): Adjust call to print_input_section.
2009-06-25 13:18:46 +00:00
Alan Modra e50d6125d6 * ldlang.c (lang_check_section_addresses): Ignore non-alloc sections. 2009-05-26 01:20:39 +00:00
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
Alan Modra 73705ac309 * ldcref.c (cref_fill_array): Call bfd_demangle rather than demangle.
* ldlang.c (lang_one_common): Likewise.
	* ldmisc.c (vfinfo): Likewise.
	(demangle): Delete.
	* ldmisc.h (demangle): Delete.
	* Makefile.am: Run "make dep-am".
	* Makefile.in: Regenerate.
2007-04-19 10:45:59 +00:00
Alan Modra 152d792f47 ld/
* ldlang.h (enum section_type): Add overlay_section.
	* ldlang.c (lang_add_section): Handle flags for overlay_section
	as per normal_section.
	(lang_size_sections_1): When setting lma, detect overlays by
	os->sectype rather than by looking for overlapping vmas.
	(lang_enter_overlay_section): Use overlay_section type.
	(lang_leave_overlay): Set first overlay section to normal.
ld/testsuite/
	* ld-spu/ovl.lnk: Use OVERLAY keyword.
2007-04-18 03:55:10 +00:00
Richard Henderson 4a828aab99 bfd/
* elf64-alpha.c (struct alpha_elf_link_hash_table): Add relax_trip.
        (elf64_alpha_size_got_sections): Remove unused something_changed local.
        (elf64_alpha_size_plt_section): Return void.
        (elf64_alpha_size_rela_got_section): Likewise.
        (elf64_alpha_relax_section): Only regenerate got+plt if the
        relax_trip counter has changed.
include/
        * bfdlink.h (struct bfd_link_info): Add relax_trip.
ld/
        * ldlang.c (relax_sections): Initialize and increment
        link_info.relax_trip.
2007-04-10 18:00:26 +00:00
Richard Sandiford bcb674cff7 ld/
200x-xx-xx  Richard Sandiford  <richard@codesourcery.com>
	    Daniel Jacobowitz  <dan@codesourcery.com>

	* NEWS: Mention -l:foo.
	* ld.texinfo: Document it.
	* ldlang.c (new_afile): If a lang_input_file_is_l_enum
	entry as a name beginning with a coloh, convert it to a
	lang_input_file_is_search_file_enum entry without the colon.

ld/testsuite/
	* ld-libs/lib-1.s, ld-libs/lib-2.s, ld-libs/lib-2.d,
	* ld-libs/libs.exp: New files.
2007-03-29 17:16:05 +00:00
Alan Modra dc27aea4b8 * Makefile.am: Add dependency on ldemul-list.h for powerpc and
spu target emul files.
	* configure.in: Check for mkstemp and waitpid.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* config.in: Regenerate.
	* ldlang.c (input_file_chain): Make global.
	(lang_add_input_file): Don't set lang_has_input_file here.
	* ldlang.h (input_file_chain): Declare.
	* emultempl/ppc32elf.em (ppc_recognized_file): New function.
	(LDEMUL_RECOGNIZED_FILE): Define.
	* emultempl/ppc64elf.em (ppc64_recognized_file): New function.
	(LDEMUL_RECOGNIZED_FILE): Define.
	* emultempl/spuelf.em (struct tflist): New.
	(tmp_file_list): New var.
2007-03-26 11:10:44 +00:00
Alan Modra 34711ca3dd ld/
* ldlang.c (lang_insert_orphan): Provide start/stop loadaddr syms
	rather than defining unconditionally.
	(lang_leave_overlay_section): Likewise.
	* ld.texinfo (Overlay Description): Update description and examples
	for start/stop syms.
ld/testsuite/
	* ld-elf/overlay.d: -u symbols we want to see in the output.
2007-03-24 06:49:03 +00:00
Nick Clifton 591a748af9 Use pc-relative relocation instead of an absolute relocation for x86_64-pc-mingw32 target. 2007-03-16 15:13:21 +00:00
Alan Modra 91eb6c46de * ldlang.c (lang_size_sections_1): Correct backwards dot move
test to not trigger on overlays.  Only warn on backwards move
	if non-default lma.
2007-03-08 04:38:45 +00:00
Nick Clifton 2889e75bfb Take into account MEMORY regions when creating a segment map. 2007-02-21 16:43:50 +00:00
H.J. Lu ea0c3cd5bd 2007-02-06 H.J. Lu <hongjiu.lu@intel.com>
* ldlang.c (lang_size_sections_1): Add a missing `)'.
2007-02-06 16:03:52 +00:00
Alan Modra 264b62058b * ldlang.c (lang_size_sections_1): Don't warn on backwards dot
move unless section size is non-zero.
2007-02-06 13:56:38 +00:00
H.J. Lu 40b36307e3 bfd/
2007-01-16  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/3831
	* elf-bfd.h (bfd_elf_link_mark_dynamic_symbol): Add an
	argument, Elf_Internal_Sym *.

	* elflink.c (bfd_elf_link_mark_dynamic_symbol): Mark a data
	symbol dynamic if info->dynamic_data is TRUE.
	(bfd_elf_record_link_assignment): Updated call to
	bfd_elf_record_link_assignment.
	(_bfd_elf_merge_symbol): Likewise.  Always call
	bfd_elf_link_mark_dynamic_symbol.

include/

2007-01-16  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/3831
	* bfdlink.h (bfd_link_info): Rename dynamic to dynamic_list.
	Add dynamic and dynamic_data.

ld/

2007-01-16  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/3831
	* NEWS: Mention -Bsymbolic-functions, --dynamic-list-data and
	--dynamic-list-cpp-new.

	* ld.texinfo: Document -Bsymbolic-functions, --dynamic-list-data
	and --dynamic-list-cpp-new.

	* ldlang.c (lang_append_dynamic_list_cpp_new): New.
	(lang_process): Change link_info.dynamic to
	link_info.dynamic_list.
	(lang_append_dynamic_list): Likewise.
	* ldmain.c (main): Likewise.  Initialize link_info.dynamic and
	link_info.dynamic_data to FALSE.

	* ldlang.h (lang_append_dynamic_list_cpp_new): New.

	* lexsup.c (option_values): Add OPTION_DYNAMIC_LIST_DATA and
	OPTION_DYNAMIC_LIST_CPP_NEW.
	(ld_options): Add entries for -Bsymbolic-functions,
	--dynamic-list-data and --dynamic-list-cpp-new.  Make
	-Bsymbolic-functions an alias of --dynamic-list-data.
	(parse_args): Change link_info.dynamic to link_info.dynamic_list.
	Set link_info.dynamic to TRUE for --dynamic-list and
	--dynamic-list-cpp-typeinfo.  Handle --dynamic-list-data and
	--dynamic-list-cpp-new.

ld/testsuite/

2007-01-16  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/3831
	* ld-elf/del.cc: New.
	* ld-elf/dl5.cc: Likewise.
	* ld-elf/dl5.out: Likewise.
	* ld-elf/new.cc: Likewise.

	* ld-elf/shared.exp: Add tests for --dynamic-list-data and
	 --dynamic-list-cpp-new.
2007-01-16 14:56:32 +00:00
Alan Modra 67f744f3bc * ldlang.c (print_output_section_statement): Print load address
when lma differs from vma.
testsuite/
	* ld-scripts/overlay-size-map.d: Update.
2006-12-12 08:10:40 +00:00
H.J. Lu c0f0068602 bfd/
2006-10-30  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/3111
	* elf-bfd.h (elf_obj_tdata): Add symbuf.
	(_bfd_elf_section_already_linked): Add struct bfd_link_info *.
	(_bfd_elf_check_kept_section): Likewise.
	(bfd_elf_match_symbols_in_sections): Likewise.

	* elf.c (assign_section_numbers): Updated to add
	struct bfd_link_info *.
	(bfd_elf_match_symbols_in_sections): Updated. Cache symbol
	buffer if info->reduce_memory_overheads is false.

	* elflink.c (match_group_member): Updated to add
	struct bfd_link_info *.
	(_bfd_elf_check_kept_section): Likewise.
	(elf_link_input_bfd): Likewise.
	(_bfd_elf_section_already_linked): Likewise.
	(bfd_elf_final_link): Free symbol buffer if
	info->reduce_memory_overheads is false.

	* libbfd-in.h (_bfd_nolink_section_already_linked): Add
	struct bfd_link_info *.
	(_bfd_generic_section_already_linked): Likewise.
	* libbfd.h: Regenerated.

	* linker.c (bfd_section_already_linked): Add
	struct bfd_link_info *.
	(_bfd_generic_section_already_linked): Likewise.
	* targets.c (bfd_target): Add struct bfd_link_info * to
	_section_already_linked.
	* bfd-in2.h: Regenerated.

include/

2006-10-30  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/3111
	* bfdlink.h (bfd_link_info): Add reduce_memory_overheads.

ld/

2006-10-30  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/3111
	* ld.h (args_type): Remove reduce_memory_overheads.

	* ldlang.c (lang_map): Updated.
	(section_already_linked): Likewise.
	(print_input_section): Likewise.
	* ldmain.c (main): Likewise.
	* lexsup.c (parse_args): Likewise.
2006-10-30 23:25:51 +00:00
Alan Modra a14a5de357 bfd/
* section.c (SEC_KEEP): Update comment.
	* bfd-in2.h: Regenerate.
	* elflink.c (bfd_elf_gc_sections): Ignore SEC_EXCLUDE sections.
	* merge.c (_bfd_merge_sections): Set SEC_KEEP on excluded sections.
	* stabs.c (_bfd_discard_section_stabs): Likewise.
	(_bfd_link_section_stabs): Likewise.  Simplify abs_section check.
ld/
	* ldlang.c (lang_map): Don't say SEC_LINKER_CREATED and SEC_KEEP
	sections have been discarded.
	(lang_do_version_exports_section): Set SEC_KEEP on export section.
	* emultempl/elf32.em (before_allocation): Set SEC_KEEP on warning
	sections.
2006-10-27 03:22:09 +00:00
Alan Modra e9f5312993 New Cell SPU port. 2006-10-25 06:49:21 +00:00
Alan Modra 2f4754876f bfd/
* elf32-arm.c (bfd_elf32_arm_allocate_interworking_sect): Check,
	don't set, glue section size.
	(record_arm_to_thumb_glue): Set glue section size here.
	(record_thumb_to_arm_glue): Likewise.
	(bfd_elf32_arm_add_glue_sections_to_bfd): Formatting.
	(bfd_elf32_arm_process_before_allocation): Ignore exluded sections.

ld/
	* emultempl/armelf.em (arm_elf_before_allocation): Run
	gld${EMULATION_NAME}_before_allocation later.
	* ldlang.c (lang_size_sections_1): Revert 2006-09-15 change.
2006-10-19 02:10:41 +00:00
Alan Modra 74541ad4c0 bfd/
* elf-bfd.h (struct elf_link_hash_table): Reorder.  Add
	text_index_section and data_index_section.
	(struct elf_backend_data): Add elf_backend_init_index_section.
	(_bfd_elf_init_1_index_section): Declare.
	(_bfd_elf_init_2_index_sections): Declare.
	* elfxx-target.h (elf_backend_init_index_section): Define.
	(elfNN_bed): Init new field.
	* elflink.c (_bfd_elf_link_omit_section_dynsym): Keep first tls
	section and text_index_section plus data_index_section.
	(_bfd_elf_link_renumber_dynsyms): Clear dynindx on omitted sections.
	(_bfd_elf_init_1_index_section): New function.
	(_bfd_elf_init_2_index_sections): New function.
	(bfd_elf_size_dynsym_hash_dynstr): Call elf_backend_init_index_section.
	(elf_link_input_bfd): When emitting relocs, use text_index_section
	and data_index_section for removed sections.
	* elf-m10300.c (elf_backend_omit_section_dynsym): Define.
	* elf32-i386.c: Likewise.
	* elf32-m32r.c: Likewise.
	* elf32-sh.c: Likewise.
	* elf32-xstormy16.c: Likewise.
	* elf32-xtensa.c: Likewise.
	* elf64-alpha.c: Likewise.
	* elf64-hppa.c: Likewise.
	* elf64-mmix.c: Likewise.
	* elf64-sh64.c: Likewise.
	* elfxx-ia64.c: Likewise.
	* elf32-arm.c (elf32_arm_final_link_relocate): Use text_index_section
	and data_index_section sym for relocs against sections with no dynamic
	section sym.
	(elf_backend_init_index_section): Define.
	* elf32-cris.c: Similarly.
	* elf32-hppa.c: Similarly.
	* elf32-i370.c: Similarly.
	* elf32-m68k.c: Similarly.
	* elf32-mips.c: Similarly.
	* elf32-ppc.c: Similarly.
	* elf32-s390.c: Similarly.
	* elf32-sparc.c: Similarly.
	* elf32-vax.c: Similarly.
	* elf64-mips.c: Similarly.
	* elf64-ppc.c: Similarly.
	* elf64-s390.c: Similarly.
	* elf64-sparc.c: Similarly.
	* elf64-x86-64.c: Similarly.
	* elfn32-mips.c: Similarly.
	* elfxx-mips.c: Similarly.
	* elfxx-sparc.c: Similarly.
	* linker.c (fix_syms): Base symbols in removed sections on
	previous section in preference to using absolute section.

ld/
	* ldlang.c (strip_excluded_output_sections): Do strip sections
	that define syms, but don't ignore them.
	* ld.texinfo (Output Section Discarding): Revise.
	* emultempl/armcoff.em (gld${EMULATION_NAME}_finish): Always call
	finish_default.

ld/testsuite/
	Update for section sym changes.
2006-10-17 13:41:49 +00:00
Jakub Jelinek 07806542d5 * ldlang.c (lang_append_dynamic_list): When appending, add all elements
of the dynamic list rather than just the first entry.
2006-10-11 14:58:19 +00:00
H.J. Lu 49c13adb16 bfd/
2006-09-26  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/3223
	PR ld/3267
	* elf.c (assign_file_positions_for_non_load_sections): Don't
	warn zero size allocated sections.

ld/

2006-09-26  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/3223
	PR ld/3267
	* ld.texinfo: Updated Output Section Discarding.

	* ldlang.h (lang_output_section_statement_type): Add
	section_relative_symbol.
	* ldlang.c (strip_excluded_output_sections): Don't strip a
	section with a symbol relative to it.
	(lang_size_sections_1): Mark if an output section has a symbol
	symbol relative to it.

ld/testsuite/

2006-09-26  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/3223
	PR ld/3267
	* ld-scripts/empty-address-1.d: New file.
	* ld-scripts/empty-address-1.s: Likewise.
	* ld-scripts/empty-address-1.t: Likewise.
	* ld-scripts/empty-address-2.s: Likewise.
	* ld-scripts/empty-address-2a.d: Likewise.
	* ld-scripts/empty-address-2a.t: Likewise.
	* ld-scripts/empty-address-2b.d: Likewise.
	* ld-scripts/empty-address-2b.t: Likewise.
	* ld-scripts/empty-address-3.s: Likewise.
	* ld-scripts/empty-address-3a.d: Likewise.
	* ld-scripts/empty-address-3a.t: Likewise.
	* ld-scripts/empty-address-3b.d: Likewise.
	* ld-scripts/empty-address-3b.t: Likewise.
	* ld-scripts/empty-address-3c.d: Likewise.
	* ld-scripts/empty-address-3c.t: Likewise.
	* ld-scripts/empty-address.exp: Likewise.
2006-09-27 04:18:16 +00:00
Nick Clifton 99643f697e PR ld/3107
* ldlang.c (lang_size_sections_1): Do not abort when encountering a non-empty
  section that is ignored.  Instead produce a warning message.
2006-09-15 09:48:58 +00:00
H.J. Lu 55255daec3 bfd/
2006-09-07  H.J. Lu  <hongjiu.lu@intel.com>

	* elf-bfd.h (elf_link_hash_entry): Add a dynamic field.
	(bfd_elf_link_mark_dynamic_symbol): New.
	(SYMBOLIC_BIND): New.

	* elf32-i386.c (elf_i386_check_relocs): Replace info->symbolic
	with SYMBOLIC_BIND (info, h).
	(elf_i386_relocate_section): Likewise.
	* elf64-x86-64.c (elf64_x86_64_check_relocs): Likewise.
	(elf64_x86_64_relocate_section): Likewise.
	* elfxx-ia64.c (elfNN_ia64_check_relocs): Likewise.

	* elflink.c (bfd_elf_link_mark_dynamic_symbol): New.
	(bfd_elf_record_link_assignment): Call
	bfd_elf_link_mark_dynamic_symbol on new entry.
	(_bfd_elf_merge_symbol): Likewise.
	(_bfd_elf_export_symbol): Return if the symbol isn't exported.
	(_bfd_elf_fix_symbol_flags): Replace info->symbolic with
	SYMBOLIC_BIND (info, h).
	(_bfd_elf_dynamic_symbol_p): Likewise.
	(_bfd_elf_symbol_refs_local_p): Likewise.
	(bfd_elf_size_dynamic_sections): Updated.

include/

2006-09-07  H.J. Lu  <hongjiu.lu@intel.com>

	* bfdlink.h (bfd_elf_dynamic_list): New.
	(bfd_link_info): Add a dynamic field.

ld/

2006-09-07  H.J. Lu  <hongjiu.lu@intel.com>

	* Makefile.am (CXX): Set to g++.
	(CXX_FOR_TARGET): Likewise.
	* Makefile.in: Regenerated.

	* NEWS: Mention --dynamic-list.

	* ld.texinfo: Document --dynamic-list.

	* ldgram.y: Support dynamic list.

	* ldlang.c (lang_process): Call lang_finalize_version_expr_head
	on link_info.dynamic if needed.
	(lang_append_dynamic_list): New.
	(lang_append_dynamic_list_cpp_typeinfo): New.
	* ldlang.h (lang_append_dynamic_list): Likewise.
	* ldlang.h (lang_append_dynamic_list_cpp_typeinfo): Likewise.

	* ldlex.h (input_enum): Add input_dynamic_list.
	* ldlex.l: Handle it.

	* ldmain.c (main): Initialize link_info.dynamic.

	* lexsup.c (option_values): Add OPTION_DYNAMIC_LIST and
	OPTION_DYNAMIC_LIST_CPP_TYPEINFO.
	(ld_options): Add entries for OPTION_DYNAMIC_LIST and
	OPTION_DYNAMIC_LIST_CPP_TYPEINFO.
	(parse_args): Handle OPTION_DYNAMIC_LIST and
	OPTION_DYNAMIC_LIST_CPP_TYPEINFO.

ld/testsuite/

2006-09-07  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-elf/dl1.c: New file.
	* ld-elf/dl1.list: Likewise.
	* ld-elf/dl1.out: Likewise.
	* ld-elf/dl1main.c: Likewise.
	* ld-elf/dl2.c: Likewise.
	* ld-elf/dl2.list: Likewise.
	* ld-elf/dl2a.out: Likewise.
	* ld-elf/dl2b.out: Likewise.
	* ld-elf/dl2main.c: Likewise.
	* ld-elf/dl2xxx.c: Likewise.
	* ld-elf/dl2xxx.list: Likewise.
	* ld-elf/dl3.cc: Likewise.
	* ld-elf/dl3.list: Likewise.
	* ld-elf/dl3a.out: Likewise.
	* ld-elf/dl3b.out: Likewise.
	* ld-elf/dl3header.h: Likewise.
	* ld-elf/dl3main.cc: Likewise.

	* ld-elf/shared.exp: Updated.

	* lib/ld-lib.exp (run_ld_link_exec_tests): Take an optional
	argument for source language. Use CC/CXX for link, depending
	on source language.
	(run_cc_link_tests): Likewise.
2006-09-07 17:16:34 +00:00
Nathan Sidwell 68bbb9f788 * ldlang.c (walk_wild): Allow * to glob '/' in wildcarded match. 2006-08-29 11:27:45 +00:00
Nick Clifton 85852e367c * ldlang.c (lang_size_sections_1, lang_assignment_statement_enum):
Adjust the current address of DEFAULT_MEMORY_REGION even when dot hasn't changed.
2006-08-24 14:59:24 +00:00
Alan Modra dc0b6aa05a * NEWS: Mention LMA default change.
* ld.texinfo (Output Section LMA): Update default description.
	(Location Counter): Clarify backward movement.
	* ldlang.c (lang_size_sections_1): Leave non-alloc sections with
	default lma equal to vma.  Warn on backward movement of dot.
2006-08-22 07:41:05 +00:00
Alan Modra cde9e0be8b ld/
PR 3052
	* ldlang.h (lang_output_section_statement_type): Replace
	"processed" field with "processed_vma" and "processed_lma".
	* ldlang.c (lang_do_assignments_1): Move lma setting code..
	(lang_size_sections_1): ..to here.
	(lang_reset_memory_regions): Adjust for
	lang_output_section_statement_type change.
	* ldexp.c (fold_name): Likewise.

And this is something I forgot the check in from the previous patch.
ld/testsuite/
	* ld-scripts/overlay-size-map.d: Adjust.
2006-08-16 08:31:45 +00:00
H.J. Lu e6f2cbf536 2006-08-08 H.J. Lu <hongjiu.lu@intel.com>
PR ld/3006
	* ldlang.c (lang_section_bst_type): Moved to ...
	* ldlang.h: Here.

	* ldlang.h (lang_wild_statement_struct): Add a tree field.

	* ldlang.c (wild_sort_fast): Use the tree field for BST.
	(wild): Likeise.
	(analyze_walk_wild_section_handler): Initialize the tree field.
2006-08-08 16:08:47 +00:00
H.J. Lu 0d0999db2f ld/
2006-08-08  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/3009
	* ldlang.c (update_wild_statements): Update the whole wild
	section list.

ld/testsuite/

2006-08-08  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/3009
	* ld-scripts/sort.t: New file.
	* ld-scripts/sort_b_a-1.d: Likewise.
	* ld-scripts/sort_b_a-1.s: Likewise.
	* ld-scripts/sort_b_n-1.d: Likewise.
	* ld-scripts/sort_b_n-1.s: Likewise.
2006-08-08 15:07:16 +00:00
H.J. Lu 12d814e1a0 ld/
2006-08-01  H.J. Lu  <hongjiu.lu@intel.com>

	* ldlang.c (init_os): Add flags. Replace bfd_make_section with
	bfd_make_section_with_flags.
	(exp_init_os): Updated.
	(lang_add_section): Call init_os with flags.
	(map_input_to_output_sections): Likewise.

ld/testsuite/

2006-08-01  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-elf/noload-1.d: New.
	* ld-elf/noload-1.s: Likewise.
	* ld-elf/noload-1.t: Likewise.
2006-08-01 17:50:52 +00:00
Alan Modra 66e28d60cb * ldexp.c (fold_name <LOADADDR>): Use the lma.
* ldlang.h (lang_memory_region_type): Delete old_length.  Add
	last_os.
	* ldlang.c (lang_memory_region_lookup): Init new field.
	(lang_reset_memory_regions): Reset new field.
	(lang_insert_orphan): Don't set load_base.
	(lang_leave_overlay): Likewise.
	(lang_size_sections_1): Delete unnecessary code setting lma_region
	to region.  Correct lma region check.
	(lang_do_assignments_1): Rename output_section_statement parm
	to current_os.  Set lma from previous section in region.
2006-07-26 05:05:52 +00:00
Alan Modra 329c1c8685 * ldlang.c: Formatting. 2006-07-26 00:42:33 +00:00
Alan Modra 7544697a28 * ldlang.c (analyze_walk_wild_section_handler): Init handler_data
earlier.
2006-07-25 14:45:17 +00:00
Nick Clifton 50c77e5dcb * ldlang.c (lang_section_bst): New structure for sorting sections by name.
(wild_sort_fast): New function: Insert a section into a binary search tree.
  (output_section_callback_fast): New function: Store a section in BST.
  (output_section_callback_tree_to_list): New function: Convert a BST into a list.
  (analyze_walk_wild_section_handler): Initialize handler_data elements.
  (wild): If the data is sorted by name use the BST method to sort the names.
2006-07-23 15:32:08 +00:00
Mark Shinwell 5e542ba70e Fix for segmentation fault.
* ldlang.c (lang_insert_orphan): Correctly handle the case where
	the section is to end up after the section currently at the end
	of the list in output_bfd.
2006-06-21 13:25:54 +00:00
Alan Modra f5ff60a6db * emultempl/elf-generic.em (gld${EMULATION_NAME}_map_segments): Limit
loop to ten iterations.  Throw away any previous linker generated
	segment map.
	* ldlang.c (lang_phdr_list): Make global.
	* ldlang.h (lang_phdr_list): Declare.
	* Makefile.am (ELF_GEN_DEPS): Define.  Use in emul deps.
	* Makefile.in: Regenerate.
2006-06-20 16:37:29 +00:00
Alan Modra 8ded5a0fc3 bfd/
* elf-bfd.h: Formatting.
	(_bfd_elf_map_sections_to_segments): Declare.
	* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame_hdr): Don't
	clear program_header_size.
	* elf.c (get_program_header_size): Move.  Don't use or set saved
	program_header_size here.
	(elf_modify_segment_map): New function.  Split out from..
	(assign_file_positions_for_load_sections): ..here.  Assert
	header size is correct.  Remove dead code.
	(_bfd_elf_map_sections_to_segments): Rename from
	map_sections_to_segments.  Make global.  Use get_program_header_size
	when we need estimate of header size.  Call elf_modify_segment_map.
	Set program_header_size.
	(print_segment_map): Delete.
	(_bfd_elf_sizeof_headers): If segment_map available, get the
	actual size.
	* elf32-arm.c (elf32_arm_symbian_modify_segment_map): Make safe
	for calling more than once.
	* elf32-bfin.c (elf32_bfinfdpic_modify_segment_map): Likewise.
	* elf32-frv.c (elf32_frvfdpic_modify_segment_map): Likewise.
	* elfxx-mips.c (_bfd_mips_elf_modify_segment_map): Likewise.
	* elf32-i370.c (elf_backend_add_symbol_hook): Delete.
	(elf_backend_additional_program_headers): Delete.
	(elf_backend_modify_segment_map): Delete.
	* elf64-hppa.c (elf64_hppa_modify_segment_map): Convert to ISO C.
	* elfxx-ia64.c (elfNN_ia64_modify_segment_map): Likewise.
	* doc/bfdint.texi: Delete SIZEOF_HEADERS difficulties.
ld/
	* Makefile.am (ELF_DEPS): Define.  Use in emul file deps.  Fix
	many ELF emul file deps that incorrectly said they needed elf32.em
	instead of generic.em.  Add genelf.em as required.
	* Makefile.in: Regenerate.
	* ldlang.c (lang_process): Call ldemul_finish before
	lang_check_section_addresses.
	* emulparams/arcelf.sh: Generic elf target needs genelf.
	* emulparams/d30v_e.sh: Likewise.
	* emulparams/d30v_o.sh: Likewise.
	* emulparams/d30velf.sh: Likewise.
	* emulparams/elf32_dlx.sh: Likewise.
	* emulparams/elf32_i860.sh: Likewise.
	* emulparams/elf32fr30.sh: Likewise.
	* emulparams/elf32frv.sh: Likewise.
	* emulparams/elf32iq10.sh: Likewise.
	* emulparams/elf32iq2000.sh: Likewise.
	* emulparams/elf32mt.sh: Likewise.
	* emulparams/mn10200.sh: Likewise.
	* emulparams/or32.sh: Likewise.
	* emulparams/or32elf.sh: Likewise.
	* emulparams/pjelf.sh: Likewise.
	* emulparams/msp430all.sh: Likewise.  Extract common entries.
	* emulparams/pjlelf.sh: Include pjelf.sh.
	* emulparams/elf32frvfd.sh (EXTRA_EM_FILE): Unset.
	* emulparams/mn10300.sh (EXTRA_EM_FILE): Unset.
	* emultempl/elf-generic.em: New file.
	* emultempl/genelf.em: New file.
	* emultempl/elf32.em: Include elf-generic.em.
	(gld${EMULATION_NAME}_layout_sections_again): Delete.
	(gld${EMULATION_NAME}_finish): Call gld${EMULATION_NAME}_map_segments.
	* emultempl/hppaelf.em (hppaelf_layout_sections_again): Likewise.
	(gld${EMULATION_NAME}_finish): Rename from hppaelf_finish.  Call
	gld${EMULATION_NAME}_map_segments.
	(LDEMUL_FINISH): Update.
	* emultempl/mmo.em: Correct comment.  Include elf-bfd.h and
	source elf-generic.em.
	(mmo_finish): Call gld${EMULATION_NAME}_map_segments.
	* emultempl/ppc64elf.em (ppc_layout_sections_again): Likewise.
	(gld${EMULATION_NAME}_finish): Rename from ppc_finish.  Call
	gld${EMULATION_NAME}_map_segments.
	(LDEMUL_FINISH): Update.
ld/testsuite/
	* ld-elf/eh1.d: Update for fewer program headers.
	* ld-elf/eh2.d: Likewise.
	* ld-elf/eh3.d: Likewise.
2006-06-20 02:22:16 +00:00
Alan Modra 409d7240c7 * ldlang.h (lang_input_statement_type): Use bitfields for booleans.
* ldlang.c (struct out_section_hash_entry): Rename from
	output_statement_hash_entry.  Delete output_section_statement_type
	entry.  Add statement_union_type entry.  Adjust all users.
	(output_section_statement_table): Rename from output_statement_table.
	Adjust all users.
	(output_section_statement_newfunc): Rename from
	output_statement_newfunc.  Adjust all users.
	(output_section_statement_table_init): Rename from
	output_statement_table_init.  Adjust all users.
	(output_section_statement_table_free): Rename from
	output_statement_table_free.  Adjust all users.
2006-06-09 01:13:39 +00:00
Alan Modra 02a38f9286 * ldlang.h (enum section_type): Delete dsect_section, copy_section,
info_section and overlay_section.  Add noalloc_section.
	* ldlang.c (lang_add_section): Adjust.
	* ldgram.y (type): Adjust.
2006-06-07 04:55:11 +00:00
Alan Modra e0f6802f19 * ldlang.c (init_os): Whitespace.
(map_input_to_output_sections): Don't init_os for lang_input_section.
	(print_all_symbols): Remove forward declaration.  Convert to ISO C.
2006-06-06 02:24:33 +00:00
Alan Modra 87aa7f19be * ldlang.c (lookup_name): Delete dead code. Remove FIXMEs. 2006-06-05 06:12:40 +00:00
Alan Modra f0636a4439 * ldlang.c (lang_size_sections_1): Don't check mem regions for
os->ignored sections.
2006-05-19 06:09:31 +00:00
Daniel Jacobowitz f86a87568d * ldlang.c (lang_size_sections): Call lang_reset_memory_regions
before redoing one_lang_size_sections_pass.
2006-05-17 16:46:54 +00:00
Alan Modra abe6ac950c * ldlang.c (wild): Tidy default_common_section loop.
(print_input_section): Format.
2006-04-19 02:10:43 +00:00