Commit Graph

65 Commits

Author SHA1 Message Date
Alan Modra 6f2750feaf Copyright update for binutils 2016-01-01 23:00:01 +10:30
Andrew Burgess c005eb9e34 ld: Extend options for altering orphan handling behaviour.
Replace the options --warn-orphan and --no-warn-orphan with a single
option --orphan-handling=MODE, where mode can be place, warn, error, and
discard.

Mode 'place' is the default, and is the current behaviour, placing the
orphan section into a suitable output section.

Mode 'warn' is the same as '--warn-orphan'.  The orphan is also placed
using the same algorithm as for 'place'.

Mode 'error' is the same as '--warn-orphan' and '--fatal-warnings'.

Mode 'discard' assigns all output sections to the /DISCARD/ section.

ld/ChangeLog:

	* ld.h (enum orphan_handling_enum): New.
	(ld_config_type): Remove warn_orphan, add orphan_handling.
	* ldemul.c (ldemul_place_orphan): Remove warning about orphan
	sections.
	* ldlang.c (ldlang_place_orphan): New function.
	(lang_place_orphans): Call ldlang_place_orphan.
	* ldlex.h (enum option_values): Remove OPTION_WARN_ORPHAN and
	OPTION_NO_WARN_ORPHAN, add OPTION_ORPHAN_HANDLING.
	* lexsup.c (ld_options): Remove 'warn-orphan' and
	'no-warn-orphan', add 'orphan-handling'.
	(parse_args): Remove handling for OPTION_WARN_ORPHAN and
	OPTION_NO_WARN_ORPHAN, add handling for OPTION_ORPHAN_HANDLING.
	* NEWS: Replace text about --warn-orphan with --orphan-handling.
	* ld.texinfo (Options): Remove --warn-orphan entry and add
	entry on --orphan-handling.
	(Orphan Sections): Add reference to relevant command line options.

ld/testsuite/ChangeLog:

	* ld-elf/elf.exp: Switch to rely on run_dump_test.
	* ld-elf/orphan-5.l: Update expected output.
	* ld-elf/orphan-5.d: New file.
	* ld-elf/orphan-6.d: New file.
	* ld-elf/orphan-6.l: New file.
	* ld-elf/orphan-7.d: New file.
	* ld-elf/orphan-7.map: New file.
	* ld-elf/orphan-8.d: New file.
	* ld-elf/orphan-8.map: New file.
2015-09-04 22:30:55 +01:00
Tristan Gingold 3604cb1f8c Add new ld option: --print-memory-usage
ld/
	* NEWS: Mention new option.
	* lexsup.c (parse_args): Handle --print-memory-usage.
	(ld_options): Add --print-memory-usage.
	* ldmain.c (main): Call lang_print_memory_usage.
	* ldlex.h (enum option_values): Add OPTION_PRINT_MEMORY_USAGE.
	* ldlang.h: Add prototype of lang_print_memory_usage.
	* ldlang.c (lang_print_memory_size, lang_print_memory_usage): New
	functions.
	* ld.texinfo (Options): Document --print-memory-usage.
	* ld.h (args_type): Add print_memory_usage field.

ld/testsuite/
	* ld-scripts/print-memory-usage-1.t,
	* ld-scripts/print-memory-usage-1.s,
	* ld-scripts/print-memory-usage-1.l,
	* ld-scripts/print-memory-usage-2.t,
	* ld-scripts/print-memory-usage-2.l,
	* ld-scripts/print-memory-usage-3.s,
	* ld-scripts/print-memory-usage-3.t,
	* ld-scripts/print-memory-usage-3.l,
	* ld-scripts/print-memory-usage.t: New tests.
	* ld-scripts/print-memory-usage.exp: Run them.
2015-06-12 11:24:36 +02:00
Nick Clifton 3ea6077552 Add new linker option: --warn-orphan which generates warning messages when orphan sections are detected.
ld	* ld.h (struct ld_config_type): Add new field: warn_orphan.
	* ldlex.h (enum option_values): Add OPTION_WARN_ORPHAN and
	OPTION_NO_WARN_ORPHAN.
	* lexsup.c (ld_options): Add --warn-orphan and --no-warn-orphan.
	(parse_args): Handle the new options.
	* ldemul.c (ldemul_place_orphan): If requested, generate a warning
	message when an orphan section is placed in the output file.
	* ld.texinfo: Document the new option.
	* NEWS: Mention the new feature.

tests	* ld-elf/orphan-5.l: New test - checks the linker's output with
	--warn-orphan enabled.
	* ld-elf/elf.exp: Run the new test.
2015-04-07 16:29:41 +01:00
Alan Modra b90efa5b79 ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
Alan Modra 4b95cf5c0c Update copyright years 2014-03-05 22:16:15 +10:30
Alan Modra 7dd9c6eb05 Miscellaneous ld tidies
Localise a struct, prevent an unneeded symbol lookup, and fix a
testcase.

ld/
	* ld.h (struct map_symbol_def): Move to..
	* ldlang.h: ..here.
	* ldlang.c (print_assignment): Don't set expld.assign_name to dot.
ld/testsuite/
	* ld-scripts/pr14962-2.d: Correct target triple.
2014-01-22 12:51:19 +10:30
Alan Modra 6fcc66ab70 Tidy ld use of bfd_section userdata.
A long time ago ld made use of userdata to tie an output section to
its lang_input_statement_struct object file.  Some time later Joern
made map file printing of symbols at lot faster, using userdata on
input sections.  That complicated allocation of userdata, and when the
output section use disappeared a year later, the code wasn't properly
cleaned up.  This patch does that cleanup, and also tidies the symbol
printing code to not allocate userdata where it won't be needed.  We
don't print symbols defined in the absolute section or in output
sections.

	* ld.h (fat_section_userdata_type, get_userdata): Move to..
	* ldlang.h (input_section_userdata_type, get_userdata): ..here.
	* ldlang.c (init_map_userdata): Delete.  Fold into..
	(sort_def_symbol): ..here.  Don't attach input section userdata
	to output sections or global bfd sections.
	(lang_map): Don't pre-allocate input section userdata.
	(init_os): Don't allocate userdata for output sections.
	(print_all_symbols): Update.
2014-01-16 11:56:51 +10:30
Roland McGrath 4724d37ec2 ld/
* ld.h (ld_config_type): New flag member separate_code.
	* emultempl/elf32.em
	(gld${EMULATION_NAME}_before_parse): Set it based on $SEPARATE_CODE.
	* ldlang.c (ldlang_override_segment_assignment): If it's set, then
	always return TRUE when SEC_CODE differs between the sections.
2012-11-21 19:56:38 +00:00
H.J. Lu 4f9d22a0b1 Move disable_target_specific_optimizations to bfd_link_info
include/

	* bfdlink.h (bfd_link_info): Add
	disable_target_specific_optimizations.

ld/

	* ld.h (command_line): Remove
	disable_target_specific_optimizations.
	(RELAXATION_DISABLED_BY_DEFAULT): Removed.
	(RELAXATION_DISABLED_BY_USER): Likewise.
	(RELAXATION_ENABLED): Likewise.
	(DISABLE_RELAXATION): Likewise.
	(ENABLE_RELAXATION): Likewise.

	* ldmain.c (main): Updated.

	* ldmain.h (RELAXATION_DISABLED_BY_DEFAULT): New macro.
	(RELAXATION_DISABLED_BY_USER): Likewise.
	(RELAXATION_ENABLED): Likewise.
	(DISABLE_RELAXATION): Likewise.
	(ENABLE_RELAXATION): Likewise.
2012-10-24 11:09:28 +00:00
H.J. Lu eda680f805 Add SORT_NONE and don't sort sort .init/.fini sections
ld/

	PR ld/14156
	* NEWS: Mention SORT_NONE.

	* ld.h (sort_type): Add by_none.

	* ld.texinfo: Document SORT_NONE.

	* ldgram.y: Handle SORT_NONE.

	* ldlang.c (update_wild_statements): Handle by_none.  Don't
	sort .init/.fini sections.

	* ldlex.l: Add SORT_NONE.

ld/testsuite/

	PR ld/14156
	* ld-elf/fini0.s: New file.
	* ld-elf/fini1.s: Likewise.
	* ld-elf/fini2.s: Likewise.
	* ld-elf/fini3.s: Likewise.
	* ld-elf/finin.s: Likewise.
	* ld-elf/foo0.s: Likewise.
	* ld-elf/foo1.s: Likewise.
	* ld-elf/foo2.s: Likewise.
	* ld-elf/foo3.s: Likewise.
	* ld-elf/foon.s: Likewise.
	* ld-elf/init0.s: Likewise.
	* ld-elf/init1.s: Likewise.
	* ld-elf/init2.s: Likewise.
	* ld-elf/init3.s: Likewise.
	* ld-elf/initn.s: Likewise.
	* ld-elf/pr14156a.d: Likewise.
	* ld-elf/pr14156b.d: Likewise.
	* ld-elf/pr14156c.d: Likewise.
	* ld-elf/pr14156c.t: Likewise.
2012-07-10 06:50:57 +00:00
Alan Modra 66be105571 * ldlang.h (struct lang_input_statement_flags): New, extract from..
(lang_input_statement_type): ..here.  New field "flags".
	(input_flags): Declare.
	(missing_file): Delete.
	* ldmain.h (whole_archive): Delete.
	(add_DT_NEEDED_for_regular, add_DT_NEEDED_for_dynamic): Delete.
	* ld.h (ld_config_type <dynamic_link>): Delete.
	* ldmain.c (whole_archive): Delete.
	(add_DT_NEEDED_for_regular, add_DT_NEEDED_for_dynamic): Delete.
	* ldlang.c (missing_file, ldlang_sysrooted_script): Delete.
	(input_flags): New variable.  Replace all uses of config.dynamic_link,
	missing_file, ldlang_sysrooted_script, whole_archive,
	add_DT_NEEDED_for_regular and add_DT_NEEDED_for_dynamic with fields
	from here.
	* ldfile.c: Likewise.
	* ldgram.y: Likewise.
	* ldmain.c: Likewise.
	* ldwrite.c: Likewise.
	* lexsup.c: Likewise.
	* plugin.c: Likewise.
	* emultempl/aix.em: Likewise.
	* emultempl/armelf.em: Likewise.
	* emultempl/elf32.em: Likewise.
	* emultempl/hppaelf.em: Likewise.
	* emultempl/linux.em: Likewise.
	* emultempl/pe.em: Likewise.
	* emultempl/pep.em: Likewise.
	* emultempl/ppc64elf.em: Likewise.
	* emultempl/scoreelf.em: Likewise.
	* emultempl/spuelf.em: Likewise.
	* emultempl/sunos.em: Likewise.
	* emultempl/vms.em: Likewise.
	* ldlang.c (new_afile): Use memset to init zero fields.
	(load_symbols): Simplify save and restore of flags around command
	file processing.
	* ldfile.c (is_sysrooted_pathname): Tidy.
2012-03-05 22:43:40 +00:00
Alan Modra dab69f680b PR ld/13343
* ld.h (parsing_defsym): Delete.
	* ldexp.c (exp_intop, exp_bigintop, exp_relop): Set type.filename.
	(fold_binary, fold_name, exp_fold_tree_1, exp_get_vma, exp_get_fill,
	exp_get_abs_int): Add tree arg for %S in error messages.  Don't
	fudge lineno.
	(exp_binop, exp_unop, exp_nameop, exp_assop, exp_assert): Copy
	type.filename from sub-tree.
	(exp_trinop): Likewise, and use "cond" rather than "lhs".
	* ldexp.h (node_type): Add filename field to struct.
	* ldfile.c (ldfile_input_filename): Delete.  Remove all refs.
	* ldfile.h (ldfile_input_filename): Delete.
	* ldgram.y (phdr_type, phdr_qualifiers, yyerror): Add NULL arg for
	%S in error messages.
	* ldemul.c (syslib_default, hll_default): Likewise.
	* ldlang.c (lang_memory_region_lookup, lang_memory_region_alias,
	lang_get_regions, lang_new_phdr): Likewise.
	(lang_size_sections_1): Pass addr_tree for %S.
	* ldlex.h (lex_redirect): Update prototype.
	(ldlex_filename): Declare.
	* ldlex.l (<EOF>): Don't set ldfile_input_filename.
	(lex_redirect): Add fake_filename and count params.  Push
	fake_filename to file_name_stack and init lineno from count.
	(ldlex_filename): New function.
	(lex_warn_invalid): Use above.
	* ldmain.c (main): Update lex_redirect call.
	* ldmisc.c (vfinfo <%S>): Take file name and line number from
	etree_type arg, or use current if arg is NULL.
	* lexsup.c (parsing_defsym): Delete.
	(parse_args <OPTION_DEFSYM>): Update lex_redirect call.
2012-02-17 14:09:57 +00:00
Roland McGrath 30824704e9 Implement ld --print-output-format. 2011-07-16 07:58:40 +00:00
Catherine Moore ae17ab41b7 include/ChangeLog
2011-07-11  Catherine Moore  <clm@codesourcery.com>

	* bfdlink.h (flag_type): New enumeration.
	(flag_info_list): New structure.
	(flag_info): New structure.

bfd/ChangeLog
2011-07-11  Catherine Moore  <clm@codesourcery.com>

	* aout-adobe.c (aout_32_bfd_lookup_section_flags): New definition.
	* aout-target.h (MY_bfd_lookup_section_flags): New definition.
	* aout-tic30.c (MY_bfd_lookup_section_flags): New definition.
        * bfd-in2.h: Regenerated.
	* bfd.c (bfd_lookup_section_flags): New definition.
	* binary.c (binary_bfd_lookup_section_flags): New definition.
	* bout.c (b_out_bfd_lookup_section_flags): New definition.
	* coff-alpha.c (_bfd_ecoff_bfd_lookup_section_flags): New definition.
	* coff-mips.c (_bfd_ecoff_bfd_lookup_section_flags): New definition.
	* coff-rs6000.c (rs6000coff_vec): Include
	bfd_generic_lookup_section_flags.
	(pmac_xcoff_vec): Likewise.
	* coffcode.h (coff_bfd_lookup_section_flags): New definition.
	* coff64-rs6000.c (rs6000coff64_vec): Include
	bfd_generic_lookup_section_flags.
	(aix5coff64_vec): Likewise.
	* ecoff.c (bfd_debug_section): Initialize flag_info field.
	* elf-bfd.h (elf_backend_lookup_section_flags_hook): Declare.
	(bfd_elf_lookup_section_flags): Declare.
	* elflink.c (bfd_elf_lookup_section_flags): New function.
	* elfxx-target.h (bfd_elfNN_bfd_lookup_section_flags): Define.
	(elf_backend_lookup_section_flags_hook): Define.
	(elf_backend_data): Add elf_backend_lookup_section_flags_hook.
	* i386msdos.c (msdos_bfd_lookup_section_flags): New define.
	* i386os9k.c (os9k_bfd_lookup_section_flags): New define.
	* ieee.c (ieee_bfd_lookup_section_flags): New define.
	* ihex.c (ihex_bfd_lookup_section_flags): New define.
	* libbfd-in.h (_bfd_nolink_bfd_lookup_section_flags): Declare.
	(bfd_generic_lookup_section_flags): Declare.
	* libbfd.h: Regenerated.
	* mach-o-target.c (bfd_mach_o_bfd_lookup_section_flags): New.
	* mmo.c (mmo_bfd_lookup_section_flags): New definition.
	* nlm-target.h (nlm_bfd_lookup_section_flags): New definition.
	* oasys.c (oasys_bfd_lookup_section_flags): New definition.
	* pef.c (bfd_pef_bfd_lookup_section_flags): New definition.
	* plugin.c (bfd_plugin_bfd_lookup_section_flags): New definition.
	* ppcboot.c (ppcboot_bfd_lookup_section_flags): New definition.
	* reloc.c (bfd_generic_lookup_section_flags): New function.
	* som.c (som_bfd_lookup_section_flags): New definition.
	* srec.c (srec_bfd_lookup_section_flags): New definition.
	* targets.c (flag_info): Declare.
	(NAME##_bfd_lookup_section_flags): Add to LINK jump table.
	(_bfd_lookup_section_flags): New.
	* tekhex.c (tekhex_bfd_lookup_section_flags): New definition.
	* versados.c (versados_bfd_lookup_section_flags): New definition.
	* vms-alpha.c (alpha_vms_bfd_lookup_section_flag): New definition.
	* xsym.c (bfd_sym_bfd_lookup_section_flags): New definition.

ld/ChangeLog
2011-07-11  Catherine Moore  <clm@codesourcery.com>

	* ld.h (section_flag_list): Add field to struct wildcard_spec.
	* ld.texinfo (INPUT_SECTION_FLAGS): Document.
	* ldgram.y (flag_info_list, flag_info): Add to union.
	(INPUT_SECTION_FLAGS): New token.
	(wildcard_spec): Initialize section_flag_list to NULL for
	each alternative.
	(sect_flag_list, sect_flags): New rules.
	(input_section_spec_no_keep): Add alternatives to recognize
	sect_flags.
	* ldlang.c (walk_wild_consider_section): Initialize
	section_flag_info field of the section struct.
	(lang_add_section): Check input section flags.
	(lang_add_wild): Initialize section_flag_list field of
	the statement struct.
	* ldlang.h (lang_input_statement_struct): Add section_flag_list field.
	(lang_wild_statement_struct): Likewise.
	* ldlex.l (INPUT_SECTION_FLAGS): New token.
	* mri.c (mri_draw_tree): Initialize section_flag_list to NULL.
	* NEWS: Announce INPUT_SECTION_FLAGS enhancement.

ld/testsuite/ChangeLog
2011-07-11 Catherine Moore  <clm@cm00re.com>

	* ld-scripts/section-flags-1.s: New.
	* ld-scripts/section-flags-1.t: New.
	* ld-scripts/section-flags-2.s: New.
	* ld-scripts/section-flags-2.t: New.
	* ld-scripts/section-flags.exp: New.
2011-07-11 15:03:09 +00:00
Alan Modra 8ad17b3a2c bfd/
* hash.c (bfd_default_hash_table_size): Make it an unsigned long.
	(bfd_hash_table_init_n): Overflow checking.
	(bfd_hash_set_default_size): Return current size.  Take unsigned long
	arg.  Add 65537 to hash_size primes.
	* bfd-in.h (bfd_hash_set_default_size): Update prototype.
	* bfd-in2.h: Regenerate.
gas/
	* hash.c (set_gas_hash_table_size): Use bfd_hash_set_default_size.
	(hash_new_sized): New function, split out from..
	(hash_new): ..here.
ld/
	* ld.h (ld_config_type <hash_table_size>): Make it an unsigned long.
2011-04-20 12:52:16 +00:00
Alan Modra 729c05fc7c Update copyright dates. 2011-01-13 13:34:54 +00:00
Alan Modra 01554a74b5 PR ld/12356
* ld.texinfo (Miscellaneous Commands): Describe LD_FEATURE.
	(Expression Section): Update.
	* ld.h (ld_config_type): Add sane_expr.
	* ldgram.y (ifile_p1): Add LD_FEATURE.
	* ldlex.l (LD_FEATYRE): New.
	* ldemul.c (after_parse_default): Delete code handling ld_compatibility.
	* ldexp.h (struct ldexp_control): Delete uses_defined.
	* ldexp.c: Remove all uses of uses_defined.
	(fold_name): Test config.sane_expr rather than ld_compatibility.
	(exp_fold_tree_1): Likewise.  Adjust handling of assignments
	during first phase.
	* ldlang.h (ld_compatibility): Delete.
	(lang_ld_feature): Declare.
	* ldlang.c (ld_compatibility): Delete.
	(open_input_bfds): Only handle assignments for --defsym.
	(lang_ld_feature): New function.
2011-01-13 13:29:55 +00:00
H.J. Lu 02ecc8e968 Add SORT_BY_INIT_PRIORITY.
bfd/

2010-12-15  H.J. Lu  <hongjiu.lu@intel.com>

	* elf.c (_bfd_elf_new_section_hook): Special handling for
	.init_array/.fini_array output sections.

ld/

2010-12-15  H.J. Lu  <hongjiu.lu@intel.com>

	* Makefile.am (GENSCRIPTS): Add @enable_initfini_array@.

	* NEWS: Mention SORT_BY_INIT_PRIORITY.

	* configure.in: Add AC_CANONICAL_BUILD.
	Add --enable-initfini-array.

	* genscripts.sh (ENABLE_INITFINI_ARRAY): New.

	* ld.h (sort_type): Add by_init_priority.

	* ld.texinfo: Document SORT_BY_INIT_PRIORITY.

	* ldgram.y (SORT_BY_INIT_PRIORITY): New.
	(wildcard_spec): Handle SORT_BY_INIT_PRIORITY.

	* ldlang.c (get_init_priority): New.
	(compare_section): Use get_init_priority for by_init_priority.

	* ldlex.l (SORT_BY_INIT_PRIORITY): New.

	* scripttempl/elf.sc: Support ENABLE_INITFINI_ARRAY.

	* Makefile.in: Regenerated.
	* aclocal.m4: Regenerated.
	* config.in: Likewise.
	* configure: Likewise.

ld/testsuite/

2010-12-15  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-elf/elf.exp (array_tests): Add init-mixed.
	(array_tests_static): Likewise.
	Also delete tmpdir/init-mixed.

	* ld-elf/init-mixed.c: New.
	* ld-elf/init-mixed.out: Likewise.
2010-12-15 14:56:40 +00:00
Nick Clifton 28d5f67740 PR ld/10956
* ld.h (struct args_type): Rename 'relax' field to
        'disable_target_specific_optimizations' and turn it into a
        tri-state variable.
        (RELAXATION_DISABLED_BY_DEFAULT): New macro.
        (RELAXATION_DISABLED_BY_USER): New macro.
        (RELAXATION_ENABLED): New macro.
        (DISABLE_RELAXATION): New macro.
        (ENABLE_RELAXATION): New macro.
        * lexsup (enum option_values): Add OPTION_NO_RELAX.
        (struct ld_options): Add --no-relax.
        (parse_args): Handle OPTION_NO_RELAX.  Use DISABLE_RELAXATION and
        ENABLE_RELAXATION macros.
        * ldlang.c (lang_relax_sections): Use RELAXATION_ENABLED macro.
        (lang_process): Likewise.
        * ldmain.c (main): Initialise
        disable_target_specific_optimizations field.
        (multiple_definition): Use RELAXATION_ENABLED macro.
        * ld.texinfo: Document new command line option.
        * emultempl/alphaelf.em: Remove --no-relax option.
        (before_allocation): Test RELAXATION_DISABLED_BY_USER macro.
        Use ENABLE_RELAXATION macro.
        * emultempl/avrelf.em: (after_allocation): Test RELAXATION_ENABLED
        macro.
        * emultempl/cr16elf.em: Remove --no-relax option.
        (before_allocation): Test RELAXATION_DISABLED_BY_USER macro.
        Use ENABLE_RELAXATION macro.
        * emultempl/crxelf.em: Remove --no-relax option.
        (before_allocation): Test RELAXATION_DISABLED_BY_USER macro.
        Use ENABLE_RELAXATION macro.
        * emultempl/mmix-elfnmmo.em: (before_allocation): Use
        ENABLE_RELAXATION macro.
        * emultempl/needrelax.em: (before_allocation): Use
        ENABLE_RELAXATION macro.
        * emultempl/ppc32elf.em: (before_allocation): Test
        RELAXATION_DISABLED_BY_DEFAULT macro. Use
        ENABLE_RELAXATION macro.
        * emultempl/sh64elf.em: (before_allocation): Test
        RELAXATION_ENABLED macro. Use DISABLE_RELAXATION macro.
        * emultempl/xtensaelf.em: Remove --no-relax option.
        (before_allocation): Test RELAXATION_ENABLED macro.
        Use ENABLE_RELAXATION macro.
2009-11-26 13:45:25 +00:00
Nick Clifton 1e9cc1c27b * po/bfd.pot: Updated by the Translation project.
* po/binutils.pot: Updated by the Translation project.
        * po/gold.pot: Updated by the Translation project.
        * po/gold.pot: Updated by the Translation project.
        * po/gprof.pot: Updated by the Translation project.
        * po/sv.po: Updated Swedish translation.
        * po/ld.pot: Updated by the Translation project.
        * po/fi.po: Updated Finnish translation.
        * po/ld.pot: Updated by the Translation project.
        * po/fi.po: Updated Finnish translation.

        Updated sources to compile cleanly with -Wc++-compat:
        * basic_blocks.c: Add casts.
        * cg_dfn.c: Add cast.
        * corefile.c: Add casts.
        * gmon_io.c: Add casts.
        * hist.c: Add cast.
        * source.c: Add cast.
        * sym_ids.c (struct match): Moved to top level.

        Updated soruces in ld/* to compile cleanly with -Wc++-compat:
        * ld.h (enum endian_enum,enum symbolic_enum,enum dynamic_list_enum): Move to top level.
        * ldcref.c: Add casts.
        * ldctor.c: Add casts.
        * ldexp.c
        * ldexp.h (enum node_tree_enum,enum phase_enum): Move to top level.
        * ldlang.c: Add casts. (lang_insert_orphan): Use enum name instead of integer.
        * ldlang.h (enum statement_enum): Move to top level.
        * ldmain.c: Add casts.
        * ldwrite.c: Add casts.
        * lexsup.c: Add casts. (enum control_enum): Move to top level.
        * mri.c: Add casts. (mri_draw_tree): Use enum name instead of integer.

        Updated sources to compile cleanly with -Wc++-compat:
        * basic_blocks.c: Add casts.
        * cg_dfn.c: Add cast.
        * corefile.c: Add casts.
        * gmon_io.c: Add casts.
        * hist.c: Add cast.
        * source.c: Add cast.
        * sym_ids.c (struct match): Moved to top level.

        * as.c (main): Call dwarf2_init.
        * config/obj-elf.c (struct group_list): New field.
        (build_group_lists): Use hash lookup.
        (free_section_idx): New function.
        (elf_frob_file): Adjust.
        * dwarf2dbg.c (all_segs_hash, last_seg_ptr): New variables.
        (get_line_subseg): Adjust.
        (dwarf2_init): New function.
        * dwarf2dbg.h (dwarf2_init): New declaration.
2009-09-11 15:27:38 +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 8d25cc3de0 include/
* alloca-conf.h: Revise based on autoconf-2.61, autoconf-2.13
	documentation.
bfd/
	* elf32-m68hc1x.c: Include alloca-conf.h.
	* xsym.c: Likewise.
	* elf64-hppa.c: Likewise.  Remove existing #if's handling alloca.
	* som.c: Likewise.
	* Makefile.am: Run "make dep-am".
	* Makefile.in: Regenerate.
binutils/
	* sysdep.h: Include alloca-conf.h instead of config.h and remove
	existing #if's handling alloca.
	* Makefile.am: Run "make dep-am".
	* Makefile.in: Regenerate.
gas/
	* as.h: Include alloca-conf.h instead of config.h and remove
	existing #if's handling alloca.
	* Makefile.am: Run "make dep-am".
	* Makefile.in: Regenerate.
opcodes/
	* Makefile.am: Run "make dep-am".
	* Makefile.in: Regenerate.
	* openrisc-opc.c: Regenerate.
ld/
	* ld.h: Remove alloca handling.
2009-03-18 11:27:18 +00:00
Nathan Sidwell 02b0b1aa77 * lexsup.c (parse_args): Set check_section_addresses to 1 or 0.
* ld.h (args_type): Make check_section_addresses a char.
	ldlang.c (lang_process): Don't consider relocatable flag when
	checking for overlap.
	* ldmain.c (main): Default check_section_addresses to -1. Check it
	for relocatable links.
	* ld.texinfo (--check-sections): Update documentation.
2009-01-26 15:23:39 +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 f96b4a7b0f Update sources to GPLv3 2007-07-06 14:09:45 +00:00
Alan Modra 3b95049e0a * ld.h (args_type, ld_config_type): Reorder fields.
* ldmain.c (main): Don't initialise a bunch of vars we know are
	zero already.
2007-05-07 15:04:53 +00:00
Alan Modra fe7929ce4a * ld.texinfo (--no-warn-search-mismatch): Document.
* ldfile.c (ldfile_try_open_bfd): Don't warn about skipping
	incompatible libraries if --no-warn-search-mismatch.
	* ld.h (args_type): Add warn_search_mismatch.
	* ldmain.c (main): Init it.
	* lexsup.c (enum option_values): Add OPTION_NO_WARN_SEARCH_MISMATCH.
	(ld_options): Add entry for --no-warn-search-mismatch.
	(parse_args): Handle OPTION_NO_WARN_SEARCH_MISMATCH.
2007-05-03 09:24:16 +00:00
Richard Sandiford c76308d222 ld/
* ld.h (ld_config_type): Add rpath_separator.
	* ldmain.c (main): Initialize it.
	* lexsup.c (parse_args): Honor config.rpath_separator.
	* emultempl/elf32.em (gld${EMULATION_NAME}_search_needed): Likewise.
	(gld${EMULATION_NAME}_add_sysroot): Likewise.
	(gld${EMULATION_NAME}_parse_ld_so_conf): Use config.rpath_separator
	rather than ':' when building the path.
	* emultempl/vxworks.em (vxworks_before_parse): New function.
	Override config.rpath_separator.
	(LDEMUL_AFTER_OPEN): Do not change if EXTRA_EM_FILE has been
	set to gld${EMULATION_NAME}_after_open; #define that identifier
	to vxworks_foo instead.
	(LDEMUL_BEFORE_PARSE): Override in the same way as LDEMUL_AFTER_OPEN.

ld/testsuite/
	* ld-vxworks/rpath-1.s, ld-vxworks/rpath-1.d,
	* ld-vxworks/vxworks.exp: New files.
2007-03-28 14:42:28 +00:00
Joseph Myers 92f01d6100 top level:
2007-02-17  Mark Mitchell  <mark@codesourcery.com>
            Nathan Sidwell  <nathan@codesourcery.com>
            Vladimir Prus  <vladimir@codesourcery.com
            Joseph Myers  <joseph@codesourcery.com>

	* configure.ac (TOPLEVEL_CONFIGURE_ARGUMENTS): Fix quoting.
	* configure: Regenerate.

bfd:
2007-02-17  Mark Mitchell  <mark@codesourcery.com>
            Nathan Sidwell  <nathan@codesourcery.com>
            Vladimir Prus  <vladimir@codesourcery.com
            Joseph Myers  <joseph@codesourcery.com>

	* configure.in (--with-pkgversion): New option.
	* configure: Regenerate.
	* Makefile.am (bfdver.h): Substitute for @bfd_version_package@.
	* Makefile.in: Regenerate.
	* version.h (BFD_VERSION_STRING): Define using
	@bfd_version_package@.

bfd/doc:
2007-02-17  Mark Mitchell  <mark@codesourcery.com>
            Nathan Sidwell  <nathan@codesourcery.com>
            Vladimir Prus  <vladimir@codesourcery.com
            Joseph Myers  <joseph@codesourcery.com>

	* Makefile.in: Regenerate.

binutils:
2007-02-17  Mark Mitchell  <mark@codesourcery.com>
            Nathan Sidwell  <nathan@codesourcery.com>
            Vladimir Prus  <vladimir@codesourcery.com
            Joseph Myers  <joseph@codesourcery.com>

	* configure.in (--with-bugurl): New option.
	* configure: Regenerate.
	* Makefile.am (REPORT_BUGS_TO): Define.
	(INCLUDES): Define REPORT_BUGS_TO.
	Regenerate dependencies.
	* Makefile.in: Regenerate.
	* doc/Makefile.in: Regenerate.
	* bucomm.h: Remove include of bin-bugs.h.
	* addr2line.c (usage): Don't print empty REPORT_BUGS_TO.
	* ar.c (usage): Pass s to list_supported_targets.  Don't print
	empty REPORT_BUGS_TO.
	* coffdump.c (show_usage): Don't print empty REPORT_BUGS_TO.
	* cxxfilt.c (usage): Print bug url when giving help.
	* dlltool.c (usage): Likewise.
	* dllwrap.c (usage): Likewise.
	* nlmconv.c (show_usage): Don't print empty REPORT_BUGS_TO.
	* nm.c (usage): Likewise.
	* objcopy.c (copy_usage, strip_usage): Likewise.
	* objdump.c (usage): Likewise.
	* readelf.c ((usage): Likewise. Add STREAM argument.  Adjust
	callers.
	* size.c (usage): Don't print empty REPORT_BUGS_TO.
	* srconv.c (show_usage): Likewise.
	* strings.c (usage): Likewise.
	* sysdymp.c (show_usage): Likewise.
	* windres.c (usage): Likewise.

gas:
2007-02-17  Mark Mitchell  <mark@codesourcery.com>
            Nathan Sidwell  <nathan@codesourcery.com>
            Vladimir Prus  <vladimir@codesourcery.com
            Joseph Myers  <joseph@codesourcery.com>

	* configure.in (--with-bugurl): New option.
	* configure: Regenerate.
	* dep-in.sed: Remove bin-bugs.h.
	* Makefile.am (REPORT_BUGS_TO): Define.
	(INCLUDES): Define REPORT_BUGS_TO.
	(DEP_INCLUDES): Likewise.
	($(OBJS)): No longer depend on bin-bugs.h.
	* Makefile.in: Regenerate.
	* doc/Makefile.in: Regenerate.
	* as.c (show_usage): Don't print empty REPORT_BUGS_TO.
	* as.h: Remove include of bin-bugs.h.

gprof:
2007-02-17  Mark Mitchell  <mark@codesourcery.com>
            Nathan Sidwell  <nathan@codesourcery.com>
            Vladimir Prus  <vladimir@codesourcery.com
            Joseph Myers  <joseph@codesourcery.com>

	* configure.in (--with-pkgversion, --with-bugurl): New options.
	* configure: Regenerate.
	* Makefile.am (PKGVERSION, REPORT_BUGS_TO): Define.
	(INCLUDES): Define PKGVERSION and REPORT_BUGS_TO.
	Regenerate dependencies.
	* Makefile.in: Regenerate.
	* gprof.c (usage): Don't print empty REPORT_BUGS_TO.
	(main): Include PKGVERSION in version output.
	* gprof.h: Remove include of bin-bugs.h.

include:
2007-02-17  Mark Mitchell  <mark@codesourcery.com>
            Nathan Sidwell  <nathan@codesourcery.com>
            Vladimir Prus  <vladimir@codesourcery.com
            Joseph Myers  <joseph@codesourcery.com>

	* bin-bugs.h: Remove.

ld:
2007-02-17  Mark Mitchell  <mark@codesourcery.com>
            Nathan Sidwell  <nathan@codesourcery.com>
            Vladimir Prus  <vladimir@codesourcery.com
            Joseph Myers  <joseph@codesourcery.com>

	* configure.in (--with-bugurl): New option.
	* configure: Regenerate.
	* Makefile.am (REPORT_BUGS_TO): Define.
	(INCLUDES): Define REPORT_BUGS_TO.
	Regenerate dependencies.
	* Makefile.in: Regenerate.
	* ld.h: Remove include of bin-bugs.h.
	* lexsup.c (help): Don't print empty REPORT_BUGS_TO.
2007-02-17 13:33:57 +00:00
H.J. Lu d8cf8b5133 ld/
2007-01-19 H.J. Lu  <hongjiu.lu@intel.com>

	* ld.h (args_type): Add new symbolic and dynamic_list fields.

	* ld.texinfo: Update -Bsymbolic-functions.

	* ldmain.c (main): Initialize command_line.symbolic to
	symbolic_unset and command_line.dynamic_list to
	dynamic_list_unset.  Check -Bsymbolic, -Bsymbolic-functions and
	--dynamic-list* before setting link_info.symbolic,
	link_info.dynamic and link_info.dynamic_data.

	* lexsup.c (option_values): Add OPTION_SYMBOLIC_FUNCTIONS.
	(ld_options): Use OPTION_SYMBOLIC_FUNCTIONS with
	-Bsymbolic-functions.
	(parse_args): Handle -Bsymbolic-functions.  Don't set
	link_info.dynamic, link_info.dynamic_data and link_info.symbolic
	here.  Set command_line.symbolic for -Bsymbolic.  Set
	command_line.dynamic_list and command_line.symbolic for
	--dynamic-list-data, --dynamic-list-cpp-new,
	--dynamic-list-cpp-typeinfo and --dynamic-list.

ld/testsuite/

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

	* ld-elf/dl6.c: New file.
	* ld-elf/dl6a.out: Likewise.
	* ld-elf/dl6amain.c: Likewise.
	* ld-elf/dl6b.out: Likewise.
	* ld-elf/dl6bmain.c: Likewise.
	* ld-elf/dl6cmain.c: Likewise.
	* ld-elf/dl6dmain.c: Likewise.

	* ld-elf/shared.exp: Add new tests for -Bsymbolic,
	-Bsymbolic-functions, --dynamic-list-data and
	--dynamic-list-cpp-new.
2007-01-19 15:13:29 +00:00
H.J. Lu 14be856495 ld/
2007-01-19 H.J. Lu  <hongjiu.lu@intel.com>

	* NEWS: Mention --default-script/-dT.

	* ld.h (args_type): Add a default_script field.

	* ld.texinfo: Document --default-script/-dT.

	* ldmain.c (main): Handle command_line.default_script.

	* lexsup.c (option_values): Add OPTION_DEFAULT_SCRIPT.
	(ld_options): Add entries for --default-script and -dT.
	(parse_args): Handle --default-script/-dT.

ld/testsuite/

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

	* ld-scripts/default-script.exp: New file.
	* ld-scripts/default-script.s: Likewise.
	* ld-scripts/default-script.t: Likewise.
	* ld-scripts/default-script1.d: Likewise.
	* ld-scripts/default-script2.d: Likewise.
	* ld-scripts/default-script3.d: Likewise.
	* ld-scripts/default-script4.d: Likewise.
2007-01-19 14:51:27 +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 5061a8853b bfd/
* bfd-in.h (enum notice_asneeded_action): Define.
	* bfd-in2.h: Regenerate.
	* elflink.c (elf_link_add_object_symbols): Call linker "notice"
	function with NULL name for as-needed handling.
ld/
	* ld.h (handle_asneeded_cref): Declare.
	* ldcref.c: Include objalloc.h.
	(old_table, old_count, old_tab, alloc_mark): New variables.
	(tabsize, entsize, refsize, old_symcount): Likewise.
	(add_cref): Use bfd_hash_allocate for refs.
	(handle_asneeded_cref): New function.
	* ldmain.c (notice): Call handle_asneeded_cref for NULL name.
2006-07-19 01:50:23 +00:00
H.J. Lu 24718e3ba5 bfd/
2006-05-30  H.J. Lu  <hongjiu.lu@intel.com>

	* bfd.c (bfd_emul_get_maxpagesize): New.
	(bfd_elf_set_pagesize): Likewise.
	(bfd_emul_set_maxpagesize): Likewise.
	(bfd_emul_get_commonpagesize): Likewise.
	(bfd_emul_set_commonpagesize): Likewise.
	* bfd-in2.h: Regenerated.

	* elf-bfd.h (elf_backend_data): Add commonpagesize.
	(xvec_get_elf_backend_data): New.
	(get_elf_backend_data): Use xvec_get_elf_backend_data.

	* elf32-arm.c (elf32_arm_vxworks_bed): Remove const.
	* elfxx-target.h (elfNN_bed): Likewise.

	* elf32-arm.c (ELF_COMMONPAGESIZE): Defined.
	* elf32-mips.c (ELF_COMMONPAGESIZE): Likewise.
	* elf32-ppc.c (ELF_COMMONPAGESIZE): Likewise.
	* elf32-sh.c (ELF_COMMONPAGESIZE): Likewise.
	* elf32-sh64.c (ELF_COMMONPAGESIZE): Likewise.
	* elf32-sparc.c (ELF_COMMONPAGESIZE): Likewise.
	* elf64-alpha.c (ELF_COMMONPAGESIZE): Likewise.
	* elf64-ppc.c (ELF_COMMONPAGESIZE): Likewise.
	* elf64-sparc.c (ELF_COMMONPAGESIZE): Likewise.
	* elf64-x86-64.c (ELF_COMMONPAGESIZE): Likewise.
	* elfn32-mips.c (ELF_COMMONPAGESIZE): Likewise.
	* elfxx-ia64.c (ELF_COMMONPAGESIZE): Likewise.

	* elfxx-target.h (ELF_COMMONPAGESIZE): Define if not defined.
	(elfNN_bed): Initialize commonpagesize with ELF_COMMONPAGESIZE.

	* targets.c (bfd_find_target): Support NULL abfd.

ld/

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

	* emulparams/arcelf.sh (MAXPAGESIZE): Changed to
	"CONSTANT (MAXPAGESIZE)".
	* emulparams/armelf_nbsd.sh: Likewise.
	* emulparams/armelf_vxworks.sh: Likewise.
	* emulparams/armnto.sh: Likewise.
	* emulparams/armsymbian.sh: Likewise.
	* emulparams/crislinux.sh: Likewise.
	* emulparams/elf32_i860.sh: Likewise.
	* emulparams/elf32_i960.sh: Likewise.
	* emulparams/elf32am33lin.sh: Likewise.
	* emulparams/elf32bfinfd.sh: Likewise.
	* emulparams/elf32bmipn32-defs.sh: Likewise.
	* emulparams/elf32frvfd.sh: Likewise.
	* emulparams/elf32i370.sh: Likewise.
	* emulparams/elf32lppcnto.sh: Likewise.
	* emulparams/elf32mcore.sh: Likewise.
	* emulparams/elf32openrisc.sh: Likewise.
	* emulparams/elf32ppcnto.sh: Likewise.
	* emulparams/elf32ppcwindiss.sh: Likewise.
	* emulparams/elf32vax.sh: Likewise.
	* emulparams/elf32xc16x.sh: Likewise.
	* emulparams/elf32xc16xl.sh: Likewise.
	* emulparams/elf32xc16xs.sh: Likewise.
	* emulparams/elf64_aix.sh: Likewise.
	* emulparams/elf64hppa.sh: Likewise.
	* emulparams/elf64mmix.sh: Likewise.
	* emulparams/elf_i386_be.sh: Likewise.
	* emulparams/elf_i386_chaos.sh: Likewise.
	* emulparams/elf_i386_ldso.sh: Likewise.
	* emulparams/hppa64linux.sh: Likewise.
	* emulparams/hppalinux.sh: Likewise.
	* emulparams/hppaobsd.sh: Likewise.
	* emulparams/i386lynx.sh: Likewise.
	* emulparams/i386moss.sh: Likewise.
	* emulparams/i386nto.sh: Likewise.
	* emulparams/i386nw.sh: Likewise.
	* emulparams/m32relf_linux.sh: Likewise.
	* emulparams/m68kpsos.sh: Likewise.
	* emulparams/or32elf.sh: Likewise.
	* emulparams/pjelf.sh: Likewise.
	* emulparams/pjlelf.sh: Likewise.
	* emulparams/ppclynx.sh: Likewise.
	* emulparams/ppcnw.sh: Likewise.
	* emulparams/shelf32_nbsd.sh : Likewise.
	* emulparams/shelf_nbsd.sh: Likewise.
	* emulparams/shelf_nto.sh: Likewise.
	* emulparams/shlelf_nto.sh: Likewise.
	* emulparams/xtensa-config.sh: Likewise.

	* emulparams/armelf_linux.sh (MAXPAGESIZE): Changed to
	"CONSTANT (MAXPAGESIZE)".
	(COMMONPAGESIZE): Changed to "CONSTANT (COMMONPAGESIZE)".
	* emulparams/elf32_sparc.sh: Likewise.
	* emulparams/elf32bmip.sh: Likewise.
	* emulparams/elf32ppccommon.sh: Likewise.
	* emulparams/elf64_ia64.sh: Likewise.
	* emulparams/elf64_s390.sh: Likewise.
	* emulparams/elf64_sparc.sh: Likewise.
	* emulparams/elf64alpha.sh: Likewise.
	* emulparams/elf64ppc.sh: Likewise.
	* emulparams/elf_i386.sh: Likewise.
	* emulparams/elf_i386_vxworks.sh: Likewise.
	* emulparams/elf_s390.sh: Likewise.
	* emulparams/elf_x86_64.sh: Likewise.
	* emulparams/shlelf32_linux.sh: Likewise.
	* emulparams/shlelf_linux.sh: Likewise.

	* emulparams/elf32bmipn32.sh (COMMONPAGESIZE): Changed to
	"CONSTANT (COMMONPAGESIZE)".
	* emulparams/elf32btsmipn32.sh: Likewise.

	* emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Add
	"-z max-page-size=" and "-z common-page-size=".
	(gld${EMULATION_NAME}_list_options): Likewise.

	* ld.h (ld_config_type): Add maxpagesize and commonpagesize.

	* ld.texinfo: Document "-z max-page-size=" and
	"-z common-page-size=".

	* ldexp.c (exp_print_token): Handle CONSTANT.
	(fold_name): Likewise.
	* ldgram.y: Likewise.
	* ldlex.l: Likewise.

	* ldmain.c (main): Initiliaze config.maxpagesize and
	config.commonpagesize. Call bfd_emul_set_maxpagesize if
	config.maxpagesize isn't 0. Call bfd_emul_set_commonpagesize if
	config.commonpagesize config.maxpagesize isn't 0.
ld/testsuite/

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

	* ld-elf/binutils.exp: New file.
	* ld-elf/commonpage1.d: Likewise.
	* ld-elf/maxpage1.d: Likewise.
	* ld-elf/maxpage1.s: Likewise.
2006-05-30 16:45:32 +00:00
Nick Clifton a70c240376 asintl.h/bucomm.h/ld.h: Prevent the inclusion of <libintl.h> from the Solaris
version of <locale.h> when ENABLE_NLS is not defined.
gprof.c (main):Only invoke bindtextdomain() and textdomain() if ENABLE_NLS is
  defined.
2005-09-30 11:42:05 +00:00
Alan Modra e9ee469ad1 * ld.h (lang_phase_type): Move to..
* ldexp.h: ..here.  Add lang_mark_phase_enum.
	(node_type): Remove etree_undef and etree_unspec.
	(exp_data_seg): Delete.
	(struct ldexp_control, expld): New.
	(invalid, exp_mark_used_section): Delete.
	(exp_fold_tree, exp_get_vma, exp_get_value_int, exp_get_fill,
	exp_get_abs_int): Update prototypes.
	* ldexp.c (assigning_to_dot): Delete.
	(expld): Define.
	(make_abs): Operate directly on expld.result.  Update all callers.
	(new_abs): Likewise.  Return void.
	(new_rel_from_abs): Rename from new_rel_from_section.
	(new_rel, new_rel_from_abs): Operate on expld.result and return void.
	Update all callers.
	(fold_unary): Operate on expld.result and return void.  Remove
	"current_section", "allocation_done", "dot", "dotp" and "mark_used"
	params.  Update all callers.
	(fold_binary, fold_trinary, fold_name, exp_fold_tree_1): Likewise.
	(fold_unary <ALIGN_K>): Ensure alignment is absolute.
	(fold_unary <ABSOLUTE>): Use make_abs.
	(fold_unary <DATA_SEGMENT_END>): Evaluate mark_phase as for
	allocating_phase.
	(fold_binary <DATA_SEGMENT_ALIGN, DATA_SEGMENT_RELRO_END, >): Ditto.
	(fold_binary <'%','/'>): Don't error if marking.
	(fold_name <SIZEOF_HEADERS>): Don't call bfd_sizeof_headers when
	marking.
	(fold_name <NAME>): Remove FIXME; -R is handled correctly.  Don't
	error when marking.
	(fold_name <ADDR, LOADADDR, SIZEOF>): Don't set SEC_KEEP.
	(exp_fold_tree_1): Don't error when marking.
	(exp_fold_tree_1 <etree_rel>): Evaluate in all phases except first.
	(exp_fold_tree_1 <etree_assign to dot>): Don't check for NULL
	current section, instead check for NULL dotp.
	(exp_fold_tree_1 <etree_provide>): Don't evaluate the assignment
	source unless the symbol is referenced and undefined.
	(exp_fold_tree): Remove "allocation_done" and "dot" params.  Save
	params to expld.
	(exp_fold_tree_no_dot): Remove "current_section", "allocation_done
	and "mark_used" params.  Save params to expld.  Update all callers.
	(exp_assop): Do without temp var.
	(exp_print_tree <etree_undef>): Delete code.
	(exp_get_vma): Remove "allocation_done" param.  Correct error return.
	(exp_get_fill, exp_get_abs_int): Likewise.
	(exp_get_value_int): Remove "allocation_done" param.
	(exp_mark_used_section): Delete.
	* ldgram.y (fill_exp): Update exp_get_fill call.
	(origin_spec, length_spec): Update exp_get_vma call.
	* ldlang.c (lang_init): Don't bother clearing lang_statement_iteration.
	(lang_mark_used_section_1, lang_mark_used_section): Delete.
	(strip_excluded_output_sections): Call one_lang_size_sections_pass in
	marking mode.  Merge old lang_mark_used_section code.  Correct handling
	of output sections with excluded input sections and data statements.
	Don't drop non-zero sized sections.  Don't zap os->bfd_section.
	Do set SEC_EXCLUDE when appropriate.
	(print_output_section_statement): Update for changed ldexp.c
	interface.
	(print_assignment, lang_size_sections_1): Likewise.
	(lang_do_assignments_1, lang_enter_output_section_statement): Likewise.
	(lang_new_phdr, lang_record_phdrs): Likewise.
	(lang_size_sections): Likewise.
	(insert_pad): Use following statement if it is a pad, rather than
	creating a new one.
	(lang_size_sections_1 <lang_output_section_statement_enum>): Do
	process ignored output section to set vma and lma, but don't
	update dot for these sections.  Don't error if marking.
	(lang_size_sections_1 <lang_assignment_statement_enum>): Don't
	update dot for ignored sections.
	(lang_size_sections_1 <lang_data_statement_enum>): Don't mark absolute
	section with SEC_ALLOC.
	(one_lang_size_sections_pass): New function.
	(lang_size_sections): Remove first five params.  Set expld.phase on
	entry and exit.   Use one_lang_size_sections_pass.
	(lang_do_assignments): Remove all params.  Update all callers.
	(lang_reset_memory_regions): Clear os->processed for all output
	section statements.
	* ldlang.h (lang_do_assignments): Update prototype.
	(lang_size_sections): Likewise.
	(one_lang_size_sections_pass): Declare.
	* pe-dll.c (pe_dll_fill_sections, pe_exe_fill_sections): Update
	lang_size_sections and lang_do_assignments calls.
	* emultempl/elf32.em (layout_sections_again): Likewise.
	* emultempl/ppc64elf.em (ppc_before_allocation): Use
	one_lang_size_sections_pass.
2005-06-09 02:05:47 +00:00
Nick Clifton 75be928bd2 Update FSF addresses 2005-05-12 07:32:09 +00:00
Jakub Jelinek 7222318829 2005-04-06 Jakub Jelinek <jakub@redhat.com>
* ldlang.c: Formatting.
	(walk_wild_consider_section): Remember return value from wildcardp.
	(is_simple_wild): Use strcspn instead of 2 strpbrk calls and strlen.
	(wild_spec_can_overlap): Use strcspn instead of strpbrk and strlen.

2005-04-06  Robert O'Callahan  <rocallahan@novell.com>

	* ld.h (lean_section_userdata_type): Remove.
	(fat_section_userdata_type): Remove file field.
	(SECTION_USERDATA_SIZE): Remove.
	* ldlang.c (init_os): Eliminate initialization of unused
	lean_section_userdata_type.

	* ldlang.h (callback_t, walk_wild_section_handler_t): New
	typedefs.
	(struct lang_wild_statement_struct): Add walk_wild_section_handler
	and handler_data fields.
	* ldlang.c (callback_t): Removed.
	(walk_wild_consider_section, walk_wild_section_general,
	section_iterator_callback, find_section, is_simple_wild,
	match_simple_wild, walk_wild_section_specs1_wild0,
	walk_wild_section_specs1_wild1, walk_wild_section_specs2_wild1,
	walk_wild_section_specs3_wild2, walk_wild_section_specs4_wild2,
	wild_spec_can_overlap, analyze_walk_wild_section_handler): New
	functions.
	(lang_add_wild): Call analyze_walk_wild_section_handler.
	(walk_wild_section): Renamed to walk_wild_section_general and
	created a wrapper function.
	(section_iterator_callback_data): New typedef.
2005-04-06 15:33:03 +00:00
H.J. Lu 57316bff0a bfd/
2005-03-16  H.J. Lu  <hongjiu.lu@intel.com>

	* elflink.c (elf_mark_used_section): New.
	(bfd_elf_gc_sections): Call elf_gc_mark_section for
	non-relocatable link if we don't do GC.

include/

2005-03-16  H.J. Lu  <hongjiu.lu@intel.com>

	* bfdlink.h (bfd_link_info): Add gc_sections.

ld/

2005-03-16  H.J. Lu  <hongjiu.lu@intel.com>

	* emultempl/elf32.em (gld${EMULATION_NAME}_finish): Remove
	unused empty output sections for non-relocatable link.

	* ld.h (args_type): Remove gc_sections.

	* ldlang.c (lang_mark_used_section): New.
	(lang_gc_sections): Use link_info.gc_sections instead of
	command_line.gc_sections.
	* ldmain.c (main): Likewise.
	* lexsup.c (parse_args): Likewise.
	* ldlang.c (lang_process): Call lang_mark_used_section.

	* ldmain.c (main): Initialize link_info.gc_sections to FALSE.

ld/testsuite/

2005-03-16  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-alpha/tlsbin.rd: Updated for empty section removal.
	* ld-alpha/tlsbinr.rd: Likewise.
	* ld-alpha/tlspic.rd: Likewise.
	* ld-arm/mixed-lib.sym: Likewise.
	* ld-i386/tlsbin.rd: Likewise.
	* ld-i386/tlsnopic.rd: Likewise.
	* ld-i386/tlspic.rd: Likewise.
	* ld-ia64/tlsbin.rd: Likewise.
	* ld-ia64/tlspic.rd: Likewise.
	* ld-powerpc/apuinfo.rd: Likewise.
	* ld-powerpc/powerpc.exp: Likewise.
	* ld-powerpc/tlsexe32.r: Likewise.
	* ld-s390/tlsbin.rd: Likewise.
	* ld-s390/tlsbin_64.rd: Likewise.
	* ld-s390/tlspic.rd: Likewise.
	* ld-s390/tlspic_64.rd: Likewise.
	* ld-sh/tlsbin-2.d: Likewise.
	* ld-sh/tlspic-2.d: Likewise.
	* ld-sparc/tlssunbin32.rd: Likewise.
	* ld-sparc/tlssunnopic32.rd: Likewise.
	* ld-sparc/tlssunpic32.rd: Likewise.
	* ld-x86-64/tlsbin.rd: Likewise.
	* ld-x86-64/tlspic.rd: Likewise.
2005-03-16 21:52:48 +00:00
Alan Modra aef6203bd6 update copyright dates 2005-03-03 11:52:12 +00:00
H.J. Lu bcaa7b3eb9 ld/
2004-10-04  H.J. Lu  <hongjiu.lu@intel.com>

	* NEWS: Mention SORT_BY_NAME, SORT_BY_ALIGNMENT and
	--sort-section name|alignment.

	* ld.texinfo: Document SORT_BY_NAME, SORT_BY_ALIGNMENT and
	--sort-section name|alignment.

	* ld.h (sort_type): New enum.
	(wildcard_spec): Change the type of `sorted' to sort_type.

	* ldgram.y (SORT): Removed.
	(SORT_BY_NAME): Added.
	(SORT_BY_ALIGNMENT): Added.
	(wildcard_spec): Updated `sorted'. Handle SORT_BY_NAME and
	SORT_BY_ALIGNMENT.
	(input_section_spec_no_keep): Updated `sorted'.
	(statement): Replace SORT with SORT_BY_NAME.

	* ldlang.c (compare_section): New function to compare 2
	sections with different sorting schemes.
	(wild_sort): Updated. Use compare_section.
	(update_wild_statements): New function.
	(lang_process): Call update_wild_statements before
	map_input_to_output_sections.

	* ldlex.l (SORT_BY_NAME): New.
	(SORT_BY_ALIGNMENT): New.
	(SORT): Return SORT_BY_NAME.

	* ldmain.c (sort_section): New. Defined.
	(main): Initialize it to none.

	* lexsup.c (option_values): Add OPTION_SORT_SECTION.
	(ld_options): Add an entry for OPTION_SORT_SECTION.
	(parse_args): Handle OPTION_SORT_SECTION.

	* mri.c (mri_draw_tree): Updated `sorted'.

ld/testsuite/

2004-10-04  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-scripts/sort.exp: New file for section sorting tests.
	* ld-scripts/sort_b_a.d: Likewise
	* ld-scripts/sort_b_a.s: Likewise
	* ld-scripts/sort_b_a.t: Likewise
	* ld-scripts/sort_b_a_a-1.d: Likewise
	* ld-scripts/sort_b_a_a-2.d: Likewise
	* ld-scripts/sort_b_a_a-3.d: Likewise
	* ld-scripts/sort_b_a_a.t: Likewise
	* ld-scripts/sort_b_a_n-1.d: Likewise
	* ld-scripts/sort_b_a_n-2.d: Likewise
	* ld-scripts/sort_b_a_n-3.d: Likewise
	* ld-scripts/sort_b_a_n.t: Likewise
	* ld-scripts/sort_b_n.d: Likewise
	* ld-scripts/sort_b_n.s: Likewise
	* ld-scripts/sort_b_n.t: Likewise
	* ld-scripts/sort_b_n_a-1.d: Likewise
	* ld-scripts/sort_b_n_a-2.d: Likewise
	* ld-scripts/sort_b_n_a-3.d: Likewise
	* ld-scripts/sort_b_n_a.t: Likewise
	* ld-scripts/sort_b_n_n-1.d: Likewise
	* ld-scripts/sort_b_n_n-2.d: Likewise
	* ld-scripts/sort_b_n_n-3.d: Likewise
	* ld-scripts/sort_b_n_n.t: Likewise
	* ld-scripts/sort_n_a-a.s: Likewise
	* ld-scripts/sort_n_a-b.s: Likewise
	* ld-scripts/sort_no-1.d: Likewise
	* ld-scripts/sort_no-2.d: Likewise
	* ld-scripts/sort_no.t: Likewise
2004-10-04 16:45:51 +00:00
Nick Clifton 2d643429de Add --hash-size switch to the linker 2004-05-21 15:38:04 +00:00
Joern Rennecke 35835446e4 * NEWS: Mention new linker map file generation and the
--reduce-memory-overheads option.
	* ld.texinfo: Document --reduce-memory-overheads option.
	* ld.h (map_symbol_def): New struct.
	(struct user_section_struct, section_userdata_type): Rename to:
	(struct lean_user_section_struct, lean_section_userdata_type).
	(struct fat_user_section_struct, fat_section_userdata_type): New.
	(SECTION_USERDATA_SIZE): Define.
	(args_type): New member reduce_memory_overheads.
	* ldlang.c (map_obstack): New static variable.
	(init_map_userdata, print_all_symbols, sort_def_symbol): New functions.
	(lang_map): Unless command_line.reduce_memory_overheads is set,
	initialize lists of defined symbols for each section.
	(print_input_section): Unless command_line.reduce_memory_overheads
	is set, use print_all_symbols.
	(init_os): Use lean_section_userdata_type / SECTION_USERDATA_SIZE.
	* ldmain.c (main): Initialize command_line.reduce_memory_overheads.
	* lexsup.c (enum option_values): Add OPTION_REDUCE_MEMORY_OVERHEADS.
	(ld_options): Add entry for --reduce-memory-overheads.
	(parse_args): Handle OPTION_REDUCE_MEMORY_OVERHEADS.
2004-05-19 14:15:55 +00:00
Alan Modra 1579bae1cd Convert to C90 2003-06-28 05:28:54 +00:00
Nick Clifton 312b768e2f Change linker's default behaviour - it will now reject binary files whoes
architecture it does not recognise, unless it has explicitly told to accept
them.
2002-12-23 10:45:03 +00:00
Alan Modra b34976b65a s/boolean/bfd_boolean/ s/true/TRUE/ s/false/FALSE/. Simplify
comparisons of bfd_boolean vars with TRUE/FALSE.  Formatting.
2002-11-30 08:39:46 +00:00
Alan Modra c553bb910d * emulparams/elf32_dlx.sh (TARGET_PAGE_SIZE): Set to 1.
(MAXPAGESIZE): Set to 1.

	* ld.h (ALIGN_N): Delete.
	* ldexp.h (align_n): Declare.
	* ldexp.c (align_n): New function.
	(fold_binary): Use align_n instead of ALIGN_N.
	(exp_fold_tree): Likewise.
	* ldlang.c (lang_size_sections_1): Likewise.
	(lang_one_common): Likewise.
2002-08-13 02:08:26 +00:00
Kazu Hirata b7a26f91f4 * ld.h: Fix formatting.
* ldexp.c: Likewise.
	* ldfile.c: Likewise.
	* ldlang.c: Likewise.
	* ldmain.c: Likewise.
	* lexsup.c: Likewise.
	* pe-dll.c: Likewise.
2002-05-03 13:48:55 +00:00
Chris Demetriou 361b220ebe 2001-11-01 Chris Demetriou <cgd@broadcom.com>
* ld.texinfo (Options): Document new option, -nostdlib.
        * lexsup.c (OPTION_NOSTDLIB): New definition.
        (ld_options): Add entry for "nostdlib".
        (parse_args): Handle OPTIONS_NOSTDLIB.
        * ldfile.c (ldfile_add_library_path): Don't add directories
        to the search path if they weren't specified on the command line
        and -nostdlib was specified.
        * ld.h (ld_config_type): New member only_cmd_line_lib_dirs.
2001-11-02 01:13:09 +00:00