Commit Graph

1029 Commits

Author SHA1 Message Date
Ian Lance Taylor 339d40a3d9 * object.cc (Sized_relobj::do_layout): Don't get confused if
layout_eh_frame returns NULL.
2010-01-08 22:34:34 +00:00
Ian Lance Taylor abecea76bc PR 11084
* dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
	dynamic symbol table, use the normal symbol table.
	(Sized_dynobj::do_read_symbols): Remove assertion about type of
	symbol table.
2010-01-08 21:24:44 +00:00
Ian Lance Taylor 6b7dd3f3b1 PR 11072
* layout.cc (Layout::include_section): Remove .gnu_debuglink
	sections.
2010-01-08 21:07:34 +00:00
H.J. Lu 36c50e63be Change to "Copyright 2010" 2010-01-08 19:48:09 +00:00
Ian Lance Taylor e291e7b9c9 PR 10287
PR 11063
	* i386.cc (class Target_i386): Change return type of plt_section
	to be non-const.
	(class Output_data_plt_i386): Add tls_desc_rel_ field.
	(Output_data_plt_i386::Output_data_plt_i386): Initialize
	tls_desc_rel_ field.
	(Output_data_plt_i386::rel_tls_desc): New function.
	(Target_i386::rel_tls_desc_section): New function.
	(Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
	(Target_i386::Scan::global): For R_386_TLS_GOTDESC put
	R_386_TLS_DESC reloc in rel_tls_desc_section.
	* x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
	Define struct Tlsdesc_info.
	(Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
	(Target_x86_64::do_reloc_symbol_index): New function.
	(Target_x86_64::add_tlsdesc_info): New function.
	(class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
	(Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
	tlsdesc_rel_ field.
	(Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
	all callers.
	(Output_data_plt_x86_64::rela_tlsdesc): New function.
	(Target_x86_64::rela_tlsdesc_section): New function.
	(Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
	handling.
	(Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
	(Target_x86_64::do_reloc_addend): New function.
	R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
	* output.h (class Output_reloc) [SHT_REL]: Add new constructor
	declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
	(Output_reloc::type): New function.
	(Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
	(Output_reloc::is_target_specific): New function.
	(Output_reloc::target_arg): New function.
	(class Output_reloc) [SHT_RELA]: Add four new constructors for
	absolute relocs and target specific relocs.
	(class Output_data_reloc) [SHT_REL]: Add add_absolute and
	add_target_specific.
	(class Output_data_reloc) [SHT_RELA]: Likewise.
	* output.cc (Output_reloc::Output_reloc): Add four new versions
	for absolute relocs and target specific relocs.
	(Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
	(Output_reloc::get_symbol_index): Likewise.
	(Output_reloc::local_section_offset): Check that local_sym_index_
	is not TARGET_CODE or 0.
	(Output_reloc::symbol_value): Likewise.
	(Output_reloc::write) [SHT_RELA]: Call target for target specific
	reloc.
	* target.h (class Target): Add reloc_symbol_index and reloc_addend
	functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
	functions.
	* layout.cc (add_target_dynamic_tags): Use output section for
	DT_PLTRELSZ and DT_JMPREL.
2010-01-08 19:33:18 +00:00
Ian Lance Taylor 3a44184e64 PR 11061
* output.h (class Output_reloc) [SHT_RELA]: Add is_relative
	function.
	(class Output_data_reloc_generic): Define.
	(class Output_data_reloc_base): Change base class to
	Output_data_reloc_generic.  Change add() method to call
	bump_relative_reloc_count for a relative reloc.  Remove
	sort_relocs_ field.
	* output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
	to sort_relocs().
	* layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
	Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
	appropriate.
	* layout.h (class Layout): Update declaration.
2010-01-07 21:09:31 +00:00
Ian Lance Taylor ea715a34a7 * output.h (class Output_data): Add const version of
output_section and do_output_section.
	(class Output_section_data): Add const version of
	do_output_section.
	(class Output_section): Likewise.
	* layout.cc (Layout::add_target_dynamic_tags): New function.
	* layout.h (class Layout): Update declarations.
	* arm.cc (Target_arm::do_finalize_sections): Use
	add_target_dynamic_tags.
	* i386.cc (Target_i386::do_finalize_sections): Likewise.
	* powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
	* sparc.cc (Target_sparc::do_finalize_sections): Likewise.
	* x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2010-01-07 20:43:35 +00:00
Ian Lance Taylor 659948a498 PR 11042
* copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
	object as needed.
2010-01-07 19:32:59 +00:00
Ian Lance Taylor 9d3b86f6f9 PR 11019
* object.cc: Instantiate Xindex::initialize_symtab_xindex and
	Xindex::read_symtab_xindex.
2010-01-07 18:42:03 +00:00
Doug Kwan bb0d3eb035 2010-01-07 Doug Kwan <dougkwan@google.com>
* arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
	(Insn_template::thumb16_bcond_insn): New method declaration.
	(Insn_template): Fix spelling.
	(Stub::thumb16_special): New method declaration.
	(Stub::do_write): Define virtual method which was previously pure
	virtual.
	(Stub::do_thumb16_special): New method declaration.
	(Stub::do_fixed_endian_write): New template member.
	(Reloc_stub::do_write): Remove.
	(Reloc_stub::do_fixed_endian_write): Remove.
	(Cortex_a8_stub): New class definition.
	(Stub_factory::make_cortex_a8_stub): New method definition.
	(Stub_factory::Stub_factory): Add missing static storage class
	qualifier for elf32_arm_stub_a8_veneer_blx.
2010-01-07 18:38:43 +00:00
Ian Lance Taylor dc3f80feec PR 10980
* options.h (class General_options): Add --warn-unresolved-symbols
	and --error-unresolved-symbols.
	* errors.cc (Errors::undefined_symbol): Implement
	--warn-unresolved-symbols.
2010-01-07 18:31:30 +00:00
Ian Lance Taylor ffeef7dfa5 * options.h (class General_options): Add -z text and -z textoff.
* layout.cc (Layout::finish_dynamic_section): Implement -z text.
2010-01-07 18:16:24 +00:00
Sriraman Tallam f1ec9ded5c * gc.h (Garbage_collection::Cident_section_map): New typedef.
(Garbage_collection::cident_sections): New function.
	(Garbage_collection::add_cident_section): New function.
	(Garbage_collection::cident_sections_): New member.
	(gc_process_relocs): Add references to sections whose names are C
	identifiers.
	* gold.h (cident_section_start_prefix): New constant.
	(cident_section_stop_prefix): New constant.
	(is_cident): New function.
	* layout.cc (Layout::define_section_symbols): Replace string constants
	with the newly defined constants.
	* object.cc (Sized_relobj::do_layout): Track sections whose names are
	C identifiers.
	* testsuite/Makefile.am: Add gc_orphan_section_test.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/gc_orphan_section_test.cc: New file.
	* testsuite/gc_orphan_section_test.sh: New file.
2010-01-07 07:14:30 +00:00
Ian Lance Taylor b9674e179b PR 10980
* options.h (class General_options): Add --warn-shared-textrel.
	* layout.cc (Layout::finish_dynamic_section): Implement
	--warn-shared-textrel.
2010-01-07 06:05:23 +00:00
Ian Lance Taylor 6eda8c29b8 PR 10980
* options.h (class General_options): Add --warn-multiple-gp.
2010-01-07 05:57:25 +00:00
Ian Lance Taylor 32dcd44e18 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
$(THREADSLIB) and $(LIBDL).
	* Makefile.in: Rebuild.
2010-01-07 05:51:58 +00:00
Ian Lance Taylor a192ba0508 PR 10980
* options.cc (General_options::parse_section_start): New function.
	(General_options::section_start): New function.
	(General_options::General_options): Initialize all members.
	* options.h: Include <map>
	(class General_options): Add --section-start.  Add section_starts_
	member.
	* layout.cc (Layout::attach_allocated_section_to_segment): If
	--section-start was used, set the address of the segment.  Remove
	local sort_sections.
	(Layout::relaxation_loop_body): If the address of the load segment
	has been set by --section-start, don't use it.
	* output.h (Output_segment::update_flags_for_output_section): New
	function.
	* output.cc (Output_segment::add_output_section): Call
	update_flags_for_output_section.
2010-01-06 22:37:18 +00:00
Ian Lance Taylor 62dfdd4d1c PR 10980
* options.h (class General_options): Add --undefined-version.
	* script.cc (struct Version_expression): Add was_matched_by_symbol
	field.
	(Version_script_info::matched_symbol): New function.
	(Version_script_info::get_symbol_version_helper): Call
	matched_symbol.
	(Version_script_info::check_unmatched_names): New function.
	* script.h (class Version_script_info): Update declarations.
	* gold.cc (queue_middle_tasks): Handle --no-undefined-version.
2010-01-06 05:30:24 +00:00
Ian Lance Taylor 9c4ae15620 * options.h (class General_options): Use DEFINE_bool_alias for
allow_multiple_definition.
	* resolve.cc (Symbol_table::should_override): Don't test
	allow_multiple_definition.
2010-01-05 22:55:08 +00:00
Ian Lance Taylor dde3f402cf PR 10980
* options.h (class General_options): Add --cref.
	* main.cc (main): Print cref table if --cref.  Don't close mapfile
	until after printing cref table.
	* cref.cc: Include "symtab.h".
	(class Cref_inputs): Define Cref_table_compare and Cref_table.
	(Cref_table_compare::operator()): New function.
	(Cref_inputs::gather_cref): New function.
	(filecol): New static const.
	(Cref_inputs::print_cref): New function.
	(Cref::print_cref): New function.
	* cref.h: Include <cstdio>.
	(class Cref): Update declarations.
	* mapfile.h (Mapfile::file): New function.
	* object.h (class Object): Define Symbols.  Declare virtual
	do_get_global_symbols.
	(Object::get_global_symbols): New function.
	* object.cc (Input_objects::add_object): Pass object to cref_ if
	--cref.
	(Input_objects::archive_start): Likewise.
	(Input_objects::archive_stop): Likewise.
	(Input_objects::print_cref): New function.
	* dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
	* dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
	--cref.
	* plugin.cc (Sized_pluginobj::do_get_global_symbols): New
	function.
	* plugin.h (class Sized_pluginobj): Update declarations.
2010-01-05 21:52:51 +00:00
Ian Lance Taylor 8781f70964 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
to is_default_version.  Rename insdef to insdefault.
	(Symbol_table::add_from_relobj): Rename def to is_default_version
	and local to is_forced_local.
	(Symbol_table::add_from_pluginobj): Likewise.
	(Symbol_table::add_from_dynobj): Likewise.
	(Symbol_table::define_special_symbol): Rename insdef to
	insdefault.
2010-01-05 19:29:15 +00:00
Ian Lance Taylor 30bc8c4670 PR 10980
* options.h (class General_options): Add
	--allow-multiple-definition and -z muldefs.
	* resolve.cc (Symbol_table::should_override): Don't warn about a
	multiple symbol definition if --allow-multiple-definition or -z
	muldefs.
2010-01-05 05:56:28 +00:00
Ian Lance Taylor 7eaea5495a PR 10980
* options.h (class General_options): Add --add-needed and
	--copy-dt-needed-entries.  Tweak --as-needed help entry.
	* object.cc (Input_objects::check_dynamic_dependencies): Give an
	error if --copy-dt-needed-entries aka --add-needed is used and
	would cause a change in behaviour.
2010-01-05 00:32:22 +00:00
Ian Lance Taylor fe35d28dd3 PR 10980
* options.h (class General_options): Add -G as a short version of
	--shared.  Add no-op options -assert, -g, and -i.
2010-01-04 23:59:13 +00:00
Sriraman Tallam 55a2bb3546 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
check for .text or .gnu.linkonce.t sections.
	* icf.cc (Icf::find_identical_sections): Ditto.
	Change the detection for mangled function name within the section
	name.
	* icf.h (is_section_foldable_candidate): New function.
2010-01-04 19:08:39 +00:00
Ian Lance Taylor 719328e148 PR 10980
* options.h (class General_options): Permit two dashes with
	--retain-symbols-file.
2009-12-31 06:05:49 +00:00
Ian Lance Taylor 403a15dd3b PR 10979
* layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
	don't put the file header and segment headers in the text
	segment.
2009-12-31 05:43:29 +00:00
Ian Lance Taylor eda294df6d PR 10979
* common.cc (Sort_commons::operator()): Stabilize sort when both
	entries are NULL.
	(Symbol_table::do_allocate_commons_list): When allocating common
	symbols, skip a symbol which is no longer common.
	* symtab.h (Symbol::is_common): Test whether the symbol comes from
	an object before checking its type.
	* testsuite/common_test_2.c: New file.
	* testsuite/common_test_3.c: New file.
	* testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
	(common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
	(common_test_2_LDFLAGS, common_test_2_LDADD): Define.
	(common_test_2_pic.o, common_test_2.so): New targets.
	(common_test_3_pic.o, common_test_3.so): New targets.
	* testsuite/Makefile.in: Rebuild.
2009-12-31 05:07:22 +00:00
Ian Lance Taylor d7bb574500 PR 10979
* script.cc (read_input_script): If we see a new SECTIONS clause,
	and we have added an input section, give an error.
	* layout.h (class Layout): Add have_added_input_section function.
	Add have_added_input_section_ field.
	* layout.cc (Layout::Layout): Initialize
	have_added_input_section_.
	(Layout::layout): Set have_added_input_section_.
	(Layout::layout_eh_frame): Likewise.
2009-12-31 03:48:46 +00:00
Ian Lance Taylor fc59c57250 PR 10931
* options.h (class General_options): Add --sort-common option.
	* symtab.h (class Symbol_table): Define Sort_commons_order enum.
	* common.cc (Sort_common): Add sort_order parameter to
	constructor.  Add sort_order_ field.
	(Sort_commons::operator): Check sort_order_.
	(Symbol_table::allocate_commons): Determine the sort order.
	(Symbol_table::do_allocate_commons): Add sort_order parameter.
	Change all callers.
	(Symbol_table::do_allocate_commons_list): Likewise.
2009-12-31 01:57:55 +00:00
Ian Lance Taylor 1c74fab0d1 PR 10916
* symtab.cc (Symbol_table::add_from_relobj): When not exporting
	symbols from this object, don't change the visibility of an
	undefined symbol.
	* testsuite/exclude_libs_test_1.c (lib1_ref): New function.
2009-12-31 01:14:34 +00:00
Ian Lance Taylor 6affe781e4 PR 10861
* script.h (class Version_script_info): Define Language enum.
	Update declarations.  Define Glob, Exact, and Lookup types.  Add
	new fields globals_, locals_, and is_finalized_.
	* script.cc: Various formatting fixes.
	(class Parser_closure): Change language_stack_ from a vector of
	std::string to one of Version_script_info::Language.  Adjust all
	uses accordingly.
	(class Lazy_demangler): Remove.
	(struct Version_expression): Change language from std::string to
	Version_script_info::Language.
	(Version_script_info::Version_script_info): New function.
	(Version_script_info::~Version_script_info): Don't call clear.
	(Version_script_info::finalize): New function.
	(Version_script_info::build_lookup_tables): New function.
	(Version_script_info::build_expression_list_lookup): New
	function.
	(Version_script_info::get_symbol_version_helper): Rewrite to use
	lookup tables.
	(Version_script_info::print_expression_list): Adjust to use
	Version_script_info::Language.
	(script_push_lex_into_version_mode): Check that the version script
	has not been finalized.
	(version_script_push_lang): Change language string to
	Version_script_info::Language.
	* options.cc (Command_line::version_script): New function.
	* options.h (class General_options): Add finalize_dynamic_list
	function.  Change version_script from declaration to definition.
	* testsuite/ver_test_4.script: Remove duplicate def of t2_2.
	* testsuite/version_script.map: Remove duplicate def of foo.
	* testsuite/Makefile.am (ver_matching_def.so): Depend upon
	version_script.map.
	* testsuite/Makefile.in: Rebuild.
2009-12-30 22:35:49 +00:00
Ian Lance Taylor 818bf354a7 PR 10843
* target-reloc.h (relocate_for_relocatable): When copying a reloc,
	if the input symbol index is 0, make the output symbol index 0.
2009-12-30 20:35:52 +00:00
Ian Lance Taylor ebcc83046f PR 10670
* options.h (class General_options): Add -x/--discard-all.
	* object.cc (Sized_relobj::do_count_local_symbols): Handle
	--discard-all.  If the local symbol needs a dynamic entry, check
	that before handling --discard-locals.
2009-12-30 20:23:29 +00:00
Ian Lance Taylor bb321bb1c4 PR 10450
* output.cc (Output_segment::Output_segment): If PT_TLS, set the
	flags to PF_R.
	(Output_segment::add_output_section): Don't change the flags if
	the type is PT_TLS.
2009-12-30 19:29:20 +00:00
Ian Lance Taylor 176fe33f0d PR 10450
* dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
	GNU hash table if they need a dynamic value.  Otherwise, don't add
	them if they are defined in a dynamic object or are forced local.
2009-12-30 08:29:37 +00:00
Ian Lance Taylor 1b81fb710f PR 10450
* layout.cc (Layout::create_dynamic_symtab): Only set entsize of
	.gnu.hash table for a 32-bit target.
2009-12-30 07:45:32 +00:00
Ian Lance Taylor 8d6d383d7c PR 10450
* symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
	regular and a dynamic object only needs a dynamic symbol table
	entry if it is externally visible.
2009-12-30 07:40:01 +00:00
Ian Lance Taylor e785ec03fb PR 10450
* i386.cc (class Target_i386): Initialize global_offset_table_ in
	constructor.  Add global_offset_table_ field.
	(Target_i386::got_section): Set global_offset_table_.
	(Target_i386::do_finalize_sections): Set global_offset_table_
	size.
	* x86_64.cc (class Target_x86_64): Initialize global_offset_table_
	in constructor.  Add global_offset_table_ field.
	(Target_x86_64::got_section): Set global_offset_table_.
	(Target_x86_64::do_finalize_sections): Set global_offset_table_
	size.
2009-12-30 07:22:06 +00:00
Ian Lance Taylor 1a2dff539b * layout.cc (Layout::Layout): Initialize increase_relro_.
(Layout::get_output_section): Add is_relro, is_last_relro, and
	is_first_non_relro parameters.  Change all callers.
	(Layout::choose_output_section): Likewise.
	(Layout::add_output_section_data): Likewise.
	(Layout::make_output_section): Likewise.
	(Layout::set_segment_offsets): Clear increase_relro when using a
	linker script.
	* layout.h (class Layout): Add increase_relro method.  Add
	increase_relro_ field.  Update declarations.
	* output.cc (Output_section::Output_section): Initialize
	is_last_relro_ and is_first_non_relro_.
	(Output_segment::add_output_section): Group relro sections is
	do_sort is true.  Handle is_last_relro and is_first_non_relro.
	(Output_segment::maximum_alignment): Remove relro handling.
	(Output_segment::set_section_addresses): Add increase_relro
	parameter.  Change all callers.  Add initial alignment to align
	relro sections on separate page.  Remove old relro handling.
	(Output_segment::set_section_list_addresses): Remove in_relro
	parameter.  Change all callers.
	(Output_segment::set_offset): Add increase parameter.  Change all
	callers.  Remove old relro handling.
	* output.h (class Output_section): Add new methods: is_last_relro,
	set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
	Add is_last_relro_ and is_first_non_relro_ fields.
	* i386.cc (Target_i386::got_section): Don't call set_is_relro.
	Create separate .got.plt section.  Call increase_relro.
	* x86_64.cc (Target_x86_64::got_section): Likewise.
	* testsuite/relro_script_test.t: Add .got.plt.
2009-12-30 06:57:17 +00:00
Ian Lance Taylor f0ba79e29c PR 10450
* layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
	(Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
	(Layout::finalize): Call set_dynamic_symbol_size.
	(Layout::set_dynamic_symbol_size): New function.
	* layout.h (class Layout): Add dynamic_symbol_ field.  Declare
	set_dynamic_symbol_size.
2009-12-30 04:16:50 +00:00
Ian Lance Taylor e8cd95c71e PR 10450
* output.h (class Output_section): Add is_entsize_zero_ field.
	* output.cc (Output_section::Output_section): Initialize
	is_entsize_zero_.
	(Output_section::set_entsize): If two different entsizes are
	requested, force it to zero.
	(Output_section::add_input_section): Set flags for .debug_str
	before updating section flags.  Set entsize.
	(Output_section::update_flags_for_input_section): Set SHF_MERGE
	and SHF_STRING if all input sections have those flags.
2009-12-30 04:00:21 +00:00
Rafael Ávila de Espíndola 3e1b9a8a68 2009-12-29 Rafael Espindola <espindola@google.com>
* main.cc (main): Fix the sys time reporting.
	* workqueue.cc (Workqueue::find_and_run_task): Fix the sys time reporting.
2009-12-29 23:45:10 +00:00
Sriraman Tallam 3dcad3765d * options.cc (General_options::parse_version): Allow -v to exit
without an error if there is nothing to link.
2009-12-29 23:12:15 +00:00
Ian Lance Taylor 084e2665e2 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
using a version of gcc before 4.1.
	* configure: Rebuild.
2009-12-29 22:49:13 +00:00
Chris Demetriou 250acde31a 2009-12-28 Chris Demetriou <cgd@google.com>
* attributes.cc (Output_attributes_section_data::do_write): Use
        std::vector::front rather than std::vector::data.
2009-12-29 06:09:03 +00:00
Ian Lance Taylor 99fff23b2e * symtab.h (class Symbol_table): Add enum Defined.
* resolve.cc (Symbol_table::should_override): Add defined
	parameter.  Change all callers.  Test whether object is NULL
	before calling a method on it.
	(Symbol_table::report_resolve_problem): Add defined parameter.
	Change all callers.
	(Symbol_table::should_override_with_special): Likewise.
	* symtab.cc (Symbol_table::define_in_output_data): Add defined
	parameter.  Change all callers.
	(Symbol_table::do_define_in_output_data): Likewise.
	(Symbol_table::define_in_output_segment): Likewise.
	(Symbol_table::do_define_in_output_segment): Likewise.
	(Symbol_table::define_as_constant): Likewise.
	(Symbol_table::do_define_as_constant): Likewise.
	* script.h (class Symbol_assignment): Add is_defsym parameter to
	constructor; change all callers.
	* script.cc (Script_options::add_symbol_assignment): Add is_defsym
	parameter.  Change all callers.  Add is_defsym_ field.
	(class Parser_closure): Add parsing_defsym parameter to
	constructor; change all callers.  Add parsing_defsym accessor
	function.  Add parsing_defsym_ field.
2009-12-29 00:31:48 +00:00
Ian Lance Taylor fa618ee47d * object.cc (Relobj::is_section_name_included): Fix formatting. 2009-12-29 00:24:31 +00:00
Ian Lance Taylor 556bd68386 * gold.cc (queue_middle_tasks): Fix formatting. 2009-12-29 00:22:43 +00:00
Ian Lance Taylor cbc999b90f * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
-fsplit-stack prologue when using %r11.
2009-12-24 07:48:14 +00:00
Ian Lance Taylor 1782c879ce * i386.cc (Target_i386::do_calls_non_split): Recognize
-fsplit-stack prologue for a function with a static chain.
2009-12-23 23:53:43 +00:00
Sriraman Tallam 329ca2b10f 2009-12-21 Sriraman Tallam <tmsriram@google.com>
* options.cc (General_options::parse_version): Make -v continue and do
	the link like GNU ld does.
2009-12-22 01:33:43 +00:00
Rafael Ávila de Espíndola d675ff4684 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
* Makefile.am (CCFILES): Add timer.cc.
	(HFILES): Add timer.h.
	* configure.ac: Check for sysconf and times.
	* main.cc: include timer.h.
	(main): Use Timer instead of get_run_time.
	* timer.cc: New.
	* timer.h: New.
	* workqueue.cc: include timer.h.
	(Workqueue::find_and_run_task):
	Report user, sys and wall time.
	* Makefile.in: Regenerate.
	* config.in: Regenerate.
	* configure: Regenerate.
2009-12-17 16:02:03 +00:00
Doug Kwan d6344fb5ba 2009-12-16 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
	sections.
	* object.cc (Sized_relobj::do_finalize_local_symbols): Handle
	relaxed input sections.
	* output.cc (Output_section::find_relaxed_input_section): Change
	return type to Output_relaxed_input_section pointer.  Adjust code
	for new type of relaxed_input_section_map_.
	* output.h (Output_section::find_relaxed_input_section): Change
	return type to Output_relaxed_input_section pointer.
	(Output_section::Output_relaxed_input_section_by_input_section_map):
	New type.
	(Output_section::relaxed_input_section_map_): Change type to
	Output_section::Output_relaxed_input_section_by_input_section_map.
	* symtab.cc (Symbol_table::compute_final_value): Handle relaxed
	input section.
2009-12-17 00:00:26 +00:00
Ian Lance Taylor 0e0d5469b8 * layout.cc (Layout::create_shstrtab): Only write out after input
sections if we are compressing debug sections.
2009-12-15 22:20:25 +00:00
Ian Lance Taylor 0649a88912 * archive.cc (Archive::add_symbols): Only look up a symbol without
a version if there is, in fact, a version.
2009-12-15 22:05:22 +00:00
Ian Lance Taylor 2ea9794110 Revert -Wshadow changes, all changes from:
2009-12-11  Doug Kwan  <dougkwan@google.com>
	2009-12-11  Nick Clifton  <nickc@redhat.com>
	* configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
2009-12-14 19:53:05 +00:00
Doug Kwan b0eec2ccda 2009-12-11 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::do_finalize_sections): Fix build breakage
	due to -Wshadow.
	* attributes.cc (Object_attribute::size): Ditto.
	(Attributes_section_data::size): Ditto.
	(Attributes_section_data::Attributes_section_data): Ditto.
	(Output_attributes_section_data::do_write): Ditto.
	* attributes.h (Object_attribute::set_type): Ditto.
	* testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
2009-12-12 01:26:12 +00:00
Nick Clifton 91d6fa6a03 Add -Wshadow to the gcc command line options used when compiling the binutils.
Fix up all warnings generated by the addition of this switch.
2009-12-11 13:42:17 +00:00
Doug Kwan a0351a698b 2009-12-10 Doug Kwan <dougkwan@google.com>
elfcpp/ChangeLog
	* arm.h: New enums for EABI object attribute tags and values.

gold/ChangeLog
	* arm.cc (attributes.h): New include.
	(Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
	(Arm_relobj::~Arm_relobj): Delete object pointed by
	attributes_section_data_.
	(Arm_relobj::attributes_section_data): New method definition.
	(Arm_relobj::attributes_section_data_): New data member declaration.
	(Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
	(Arm_dynobj::~Arm_dynobj): Delete object pointed by
	attributes_section_data_.
	(Arm_dynobj::attributes_section_data): New method definition.
	(Arm_dynobj::attributes_section_data_): New data member declaration.
	(Target_arm::Target_arm): Initialize attributes_section_data_.  Change
	initialization value of may_use_blx_ to false.
   	(Target_arm::using_thumb2, Target_arm::using_thumb_only,
	Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
	object attributes to compute results instead of hard-coding.
	(Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
	Target_arm::get_secondary_compatible_arch,
	Target_arm::set_secondary_compatible_arch
	Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
	Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
	New method declarations.
	(Target_arm::get_aeabi_object_attribute): New method definition.
	(Target_arm::attributes_section_data_): New data member declaration.
	(read_arm_attributes_section): New template definition.
	(Arm_relobj::do_read_symbols): Read attributes section if it exists.
	(Arm_dynobj::do_read_symbols): Ditto.
	(Target_arm::do_finalize_sections): Merge attributes sections from
	input.  Check for BLX use after attributes section merging.
	Fix __exidx_start and __exidx_end visibility.  Create an
	.ARM.attributes section if necessary.
	(Target_arm::get_secondary_compatible_arch,
	Target_arm::set_secondary_compatible_arch,
	Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
	Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
	Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
	New method definitions.
2009-12-10 20:55:33 +00:00
Ian Lance Taylor b59befec8e * plugin.cc (Plugin::load): Don't cast from void* to a function
pointer.
2009-12-10 07:44:28 +00:00
Ian Lance Taylor 1276bc895a * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
information fields.
2009-12-10 01:10:09 +00:00
H.J. Lu 2f2de24889 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
* testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
	Replace two_file_shared_1.so with two_file_shared_2.so.
	* testsuite/Makefile.in: Regenerated.
2009-12-09 16:26:36 +00:00
Doug Kwan 4f7872716e 2009-12-08 Doug Kwan <dougkwan@google.com>
* Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
	(HFILES): Add attributes.h and int_encoding.h.
	* Makefile.in: Regenerate.
	* dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
	function definitions to int_encoding.cc
	* dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
	prototypes to int_encoding.h
	* reduced_debug_output.cc (int_encoding.h): New include.
	(write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
	function definitions to int_encoding.cc
	(insert_into_vector, read_from_pointer): Move template definitions to
	int_encoding.h
	* attributes.cc: New file.
	* attributes.h: New file.
	* int_encoding.cc: New file.
	* int_encoding.h: New file.
2009-12-09 03:02:28 +00:00
Rafael Ávila de Espíndola 20b52f1af3 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
PR gold/11055
	* incremental-dump.cc (dump_incremental_inputs): New.
	(main): Use dump_incremental_inputs.
2009-12-07 21:36:52 +00:00
H.J. Lu 53d7974cd8 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
PR gold/10893
	* i386.cc (Target_i386::Scan::globa): Use is_func instead of
	checking elfcpp::STT_FUNC.
	(Target_i386::Relocate::relocate): Likewise.
	* x86_64.cc (Target_x86_64::Scan::global): Likewise.

	* symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
	symbols from shared libraries into normal FUNC symbols.

	* symtab.h (Symbol): Add is_func and use it.
2009-12-07 17:14:55 +00:00
Doug Kwan 05a352e6a7 2009-12-05 Doug Kwan <dougkwan@google.com>
elfcpp/ChangeLog:

	* arm.h: Define enums for Tag_CPU_arch EABI attribute.

gold/ChangeLog:
	* arm.cc (Target_arm::arm_info): Initialize new fields
	attributes_section and attributes_vendor.
	* i386.cc (Target_i386::i386_info): Same.
	* object.cc (Sized_relobj::do_layout): Skip attribute section.
	* gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
	fields attributes_section and attributes_vendor.
 	* sparc.cc (Target_sparc::sparc_info): Same.
	* target.h (Target::attributes_section, Target::attributes_vendor,
	Target::is_attributes_section, Target::attribute_arg_type,
	Target::attributes_order): New method definitions.
	(Target::Target_info::attributes_section,
	Target::Target_info::attributes_vendor): New fields.
	(Target::do_attribute_arg_type, Target::do_attributes_order): New
	virtual method definitions.
	* x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
	attributes_section and attributes_vendor.
	* testsuite/testfile.cc (Target_test::test_target_info): Same.
2009-12-06 02:49:46 +00:00
Doug Kwan f4e5969cc0 2009-12-05 Doug Kwan <dougkwan@google.com>
* arm.cc: Update comments about interworking and stub generation.
	(Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
	considered as non-PIC.
	(Arm_relocate_functions::base_abs): Fix formatting.
	(Arm_relocate_functions::got_prel): Fix comment.  Change interface
	of function to use GOT entry address instead of offset.
	(Target_arm::Scan::global): Issue an error if a symbol would need a
	PLT does not get one because it is untyped.  Remove code to create
	dynamic symbols for relative branches.
	(Target_arm::Relocate::relocate: Use 0 instead of false since function
	takes unsigned integer instead of boolean.
2009-12-06 02:20:53 +00:00
H.J. Lu 1abce4a658 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
* testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
	(two_file_test_LDADD): Likewise.
	(common_test_1_LDADD): Likewise.
	(exception_test_LDADD) Likewise.
	(weak_test_LDADD): Likewise.
	(many_sections_test_LDADD): Likewise.
	(initpri1_LDADD): Likewise.
	(script_test_1_LDADD): Likewise.
	(script_test_2_LDADD): Likewise.
	(justsyms_LDADD): Likewise.
	(binary_test_LDADD): Likewise.
	(large_LDADD): Likewise.
	* testsuite/Makefile.in: Regenerated.
2009-12-05 23:22:54 +00:00
H.J. Lu adcf2816e2 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
* resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
	(Symbol_table::override_with_special): Likewise.
	(Symbol_table::add_from_object): Likewise.
2009-12-05 07:28:45 +00:00
Rafael Ávila de Espíndola 28e67f5d75 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
* incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
	Don't set the data_offset twice.
2009-12-04 18:18:18 +00:00
Rafael Ávila de Espíndola ae10a10115 pda 2009-12-04 15:47:49 +00:00
Doug Kwan f59f41f3e6 2009-12-03 Doug Kwan <dougkwan@google.com>
* arm.cc: Remove comment about missing .ARM.exidx section symbols.
	(Target_arm::do_finalize_sections): Add parameter for symbol table
	pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
	* i386.cc (Target_i386::do_finalize_sections): Add an additional
	parameter for symbol table pointer.
	* layout.cc (Layout::finalize): Call Target::finalize_sections with
	an additional parameter for a pointer to symbol table.
	* powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
	parameter for a symbol table pointer.
	* sparc.cc (Target_sparc::do_finalize_sections): Ditto.
	* target.h (Target::finalize_sections, Target::do_finalize_sections):
	Ditto.
	* x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
	parameter for a symbol table pointer.
2009-12-03 23:13:55 +00:00
Rafael Ávila de Espíndola ca55d848d8 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
* incremental.cc (Incremental_inputs_header)
	(Incremental_inputs_header_write, Incremental_inputs_entry)
	(Incremental_inputs_entry_write): Move ...
	* incremental.h (Incremental_inputs_header)
	(Incremental_inputs_header_write, Incremental_inputs_entry)
	(Incremental_inputs_entry_write): here.
2009-12-03 15:43:01 +00:00
Rafael Ávila de Espíndola 3aec4f9c2f 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
* incremental.cc (make_sized_incremental_binary): Set the target.
	Error if it is incompatible.
	* output.h (Output_file): Add filename method.
2009-12-03 04:26:01 +00:00
Rafael Ávila de Espíndola 9c0ae74d4f 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
* incremental.cc (Incremental_inputs_entry): Remove unused argument
       from the get_* methods.
2009-12-02 18:14:22 +00:00
Rafael Ávila de Espíndola a45500ae37 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
* incremental-dump.cc (main): Check that the offeset of a script is 0.
	* incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
	Write 0 for the data_offset of scripts.
2009-12-02 16:27:15 +00:00
Rafael Ávila de Espíndola 325e6408a8 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
* testsuite/Makefile.am: Add the incremental_test.sh test.
	* testsuite/incremental_test.sh: New.
	* testsuite/incremental_test_1.c: New.
	* testsuite/incremental_test_2.c: New.
2009-12-02 14:51:22 +00:00
Rafael Ávila de Espíndola 954c3e2ed1 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
* incremental-dump.cc (main): Fix typos.
2009-12-01 21:15:06 +00:00
Rafael Ávila de Espíndola f80866232e 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
PR gold/11025
	* incremental-dump.cc (main): Use llu to print 64 bit values.
2009-11-27 16:15:26 +00:00
H.J. Lu 3b0dd6acb3 Add $(THREADSLIB) $(LIBDL) to incremental-dump.
2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
	    H.J. Lu  <hongjiu.lu@intel.com>

	* Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
	$(LIBDL).
	(incremental_dump_LDADD): Likewise.
	* Makefile.in: Regenerated.
2009-11-27 02:05:34 +00:00
Doug Kwan a6d1ef576a 2009-11-25 Doug Kwan <dougkwan@google.com>
Revert:

	2009-11-25  Doug Kwan  <dougkwan@google.com>

		* arm.cc (Target_arm::Target_arm): Move method definition
		outside of class definition.  Add code to handle
		--target1-rel, --target1-abs and --target2= options.
		(Target_arm::get_reloc_reloc_type): Change method to be
		non-static and const.
		(Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
		New data member declaration.
		(Target_arm::Scan::local, Target_arm::Scan::global,
		Target_arm::Relocate::relocate,
		Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
		Adjust call to Target_arm::get_real_reloc_type.
		(Target_arm::get_real_reloc_type): Use command line options
		to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
		* options.h (--target1-rel, --target1-abs, --target2): New
		ARM-only options.
2009-11-25 08:08:45 +00:00
Doug Kwan 50aeb7d431 2009-11-25 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::Target_arm): Move method definition outside of
	class definition.  Add code to handle --target1-rel, --target1-abs
	and --target2= options.
	(Target_arm::get_reloc_reloc_type): Change method to be non-static
	and const.
	(Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
	member declaration.
	(Target_arm::Scan::local, Target_arm::Scan::global,
	Target_arm::Relocate::relocate,
	Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
	call to Target_arm::get_real_reloc_type.
	(Target_arm::get_real_reloc_type): Use command line options to
	determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
	* options.h (--target1-rel, --target1-abs, --target2): New ARM-only
	options.
2009-11-25 04:32:36 +00:00
Doug Kwan 5193828376 2009-11-25 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::Target_arm): Move method definition outside of
	class definition.  Add code to handle --target1-rel, --target1-abs
	and --target2= options.
	(Target_arm::get_reloc_reloc_type): Change method to be non-static
	and const.
	(Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
	member declaration.
	(Target_arm::Scan::local, Target_arm::Scan::global,
	Target_arm::Relocate::relocate,
	Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
	call to Target_arm::get_real_reloc_type.
	(Target_arm::get_real_reloc_type): Use command line options to
	determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
	* options.h (--target1-rel, --target1-abs, --target2): New ARM-only
	options.
2009-11-25 04:11:56 +00:00
Rafael Ávila de Espíndola e2b8f3c401 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
* Makefile.am: Build incremental-dump
	* Makefile.in: Regenerate.
	* incremental-dump.cc: New.
	* incremental.cc (Incremental_inputs_header_data,
	Incremental_inputs_entry_data): Move to incremental.h
	* incremental.h: (Incremental_inputs_header_data,
	Incremental_inputs_entry_data): Move from incremental.cc

2009-11-24  Rafael Avila de Espindola  <espindola@google.com>

	* elfcpp_file.h: Include elfcpp.h.
2009-11-25 00:10:05 +00:00
Rafael Ávila de Espíndola bcba9aec3f 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
* incremental.cc (Incremental_inputs_header,
	Incremental_inputs_header_write, Incremental_inputs_entry,
	Incremental_inputs_entry_write): Add a typedef with the data type.
2009-11-24 22:50:44 +00:00
Rafael Ávila de Espíndola 7c3afe08c7 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
* incremental.cc (Incremental_inputs_header,
	Incremental_inputs_header_write, Incremental_inputs_entry,
	Incremental_inputs_entry_write): Update comment about which
	type has the filed descriptions.
2009-11-24 20:18:17 +00:00
Doug Kwan d204b6e935 2009-11-15 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::may_use_arm_nop): New method definition.
	(Arm_relocate_functions::arm_branch_common): Change method defintion
	in class definition to a method declaration and update list of formal
	parameters.
	(Arm_relocate_functions::plt32, Arm_relocate_functions::call,
	Arm_relocation_functions::jump24): Adjust call to
	Arm_relocate_functions::arm_branch_common.  Update list of formal
	parameters.
	(Arm_relocate_functions::xpc25): New method definition.
	(Arm_relocate_functions::arm_branch_common): Move method defintion
	out from class definition.  Use stubs for mode-switching and extending
	branch ranges.
	(Target_arm::Relocate::relocate): Handle weakly-undefined symbols
	specially.  Change code to enable use of stubs in ARM branches.
2009-11-16 03:39:11 +00:00
Doug Kwan 43d12afeb9 2009-11-10 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
	in method declaration.
	(Target_arm::relocate_stub): New method declaration.
	(Target_arm::default_target): Change to return a pointer instead of
	a const reference.
	(Reloc_stub::stub_type_for_reloc): Adjust for the change in
	Target_arm::default_target.
	(Arm_Relobj::do_relocate_sections): Remove options paramater in
	method definition.
	(Target_arm::relocate_section): Adjust view.
	(Target_arm::relocate_stub): New method definition.
2009-11-09 23:16:55 +00:00
Doug Kwan ac33a407ac 2009-11-10 Doug Kwan <dougkwan@google.com>
* i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
	a format warning.
	* incremental.cc (open_incremental_binary): Initialized local
	variables to avoid warnings.
	* object.cc (make_elf_object): Ditto.
	* x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
	a format warning.
2009-11-09 23:07:30 +00:00
H.J. Lu 88ee28e9fa Include "config.h".
009-11-09  H.J. Lu  <hongjiu.lu@intel.com>

	PR gold/10930
	* testsuite/plugin_test.c: Include "config.h".
2009-11-09 16:11:34 +00:00
Doug Kwan 2daedcd627 2009-11-09 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
	(arm_symbol_value): Remove.
	(Arm_relocate_functions::arm_branch_common,
	Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
	Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
	Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
	Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
	Arm_relocate_functions::call, Arm_relocate_functions::jump24,
	Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
	Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
	Arm_relocate_functions::thm_mobw_abs_nc,
	Arm_relocate_functions::thm_mov_abs,
	Arm_relocate_functions::movw_prel_nc,
	Arm_relocate_functions::thm_movt_abs,
	Arm_relocate_functions::movt_prel,
	Arm_relocate_functions::thm_movw_prel_nc,
	Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
	(Target_arm::Relocate::relocate): Only decompose address into two
	parts if relocation type uses the thumb-bit and pass the actual
	bit instead of a flag indicating that the thumb-bit is used.  Adjust
	calls to methods in Arm_relocate_functions for this change.
2009-11-09 16:03:45 +00:00
Ian Lance Taylor 3e4afc80cd PR 10925
* reloc.cc: Instantiate
	Sized_relobj::initialize_input_to_output_maps and
	Sized_relobj:free_input_to_output_maps.
2009-11-09 02:02:01 +00:00
Ian Lance Taylor e53ad1b5b5 PR 10876
* defstd.cc (in_segment): Set only_if_ref true for "end".
2009-11-07 02:02:29 +00:00
Doug Kwan eb44217c8b 2009-11-06 Doug Kwan <dougkwan@google.com>
* arm.cc (class Reloc_stub): Correct a comment.
	(Target_arm::Target_arm): Initialize arm_input_section_map_.
	(Target_arm::scan_section_for_stubs): New method declaration.
	(Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
	Change methods from private to protected.
	(Target_arm::do_may_relax): New method definition.
	(Target_arm::do_relax, Target_arm::group_sections,
	Target_arm::scan_reloc_for_stub,
	Target_arm::scan_reloc_section_for_stubs): New method declarations.
	(Target_arm::arm_input_section_map_): New data member declaration.
	(Target_arm::scan_reloc_for_stub,
	Target_arm::scan_reloc_section_for_stubs,
	Target_arm::scan_section_for_stubs, Target_arm::group_sections,
	Target_arm::do_relax): New method definitions.
2009-11-07 01:58:06 +00:00
Ian Lance Taylor 5d329b7db9 * configure.ac: Check for (struct stat)::st_mtim
* fileread.cc (File_read::get_mtime): Use st_mtim if available.
	* config.in: Regenerate.
	* configure: Regenerate.
2009-11-06 15:47:06 +00:00
Ian Lance Taylor 12af2ab656 Remove debugging code accidentally included in last commit. 2009-11-05 19:56:41 +00:00
Ian Lance Taylor 96a0d71b76 PR 10910
* output.cc (Output_segment::add_output_section): Add missing
	return statement.
2009-11-05 19:54:30 +00:00
Ian Lance Taylor 594c8e5ede PR 10880
* object.h (class Object): Add is_needed and set_is_needed
	methods.  Add is_needed_ field.  Make bool fields into bitfields.
	* symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
	defined in a dynamic object and referenced by a regular object,
	set is_needed for the dynamic object.
	* layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
	if the file is marked with as_needed and it is not needed.
2009-11-05 06:24:39 +00:00
Ian Lance Taylor 22b127cceb PR 10887
* arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
	tags if data is discarded by linker script.
	* i386.cc (Target_i386::do_finalize_sections): Likewise.
	* powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
	* sparc.cc (Target_sparc::do_finalize_sections): Likewise.
	* x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2009-11-04 16:35:51 +00:00
Ian Lance Taylor f5c870d25d * layout.cc (Layout::get_output_section): Add is_interp and
is_dynamic_linker_section parameters.  Change all callers.
	(Layout::choose_output_section): Likewise.
	(Layout::make_output_section): Likewise.
	(Layout::add_output_section_data): Add is_dynamic_linker_section
	parameter.  Change all callers.
	* layout.h (class Layout): Update declarations.
	* output.h (class Output_section): Add is_interp, set_is_interp,
	is_dynamic_linker_section, set_is_dynamic_linker_section methods.
	Add is_interp_, is_dynamic_linker_section_ fields.  Change
	generate_code_fills_at_write_ to a bitfield.
	* output.cc (Output_section::Output_sections): Initialize new
	fields.
	(Output_segment::add_output_section): Add do_sort parameter.
	Change all callers.
2009-11-04 15:56:03 +00:00
Ian Lance Taylor 1ae4d23b73 PR 10860
* options.h (class General_options): Add --warn-common.
	* resolve.cc (Symbol_table::resolve): Handle --warn-common when
	merging two common symbols.
	(Symbol_table::should_override): Handle --warn-common when merging
	a common symbol with a defined symbol.  Use report_resolve_problem
	for multiple definitions.
	(Symbol_table::report_resolve_problem): New function.
	* symtab.h (class Symbol_table): Declare report_resolve_problem.
2009-11-04 01:24:41 +00:00
Doug Kwan 55da957988 2009-11-03 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
	stub_factory_.
	(Target_arm::stub_factory): New method definition.
	(Target_arm::new_arm_input_section,
	Target_arm::find_arm_input_section, Target_arm::new_stub_table,
	Target_arm::reloc_uses_thumb_bit): New method declarations.
	(Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
	New type definitions.
	(Target_arm::stub_tables_, Target_arm::stub_factory_): New data
	member declarations.
	(Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
	Target_arm::find_arm_input_section, Target_arm::new_stub_table):
	New method definitions.
2009-11-03 21:18:13 +00:00
Ian Lance Taylor 37a9ac43fb * options.h (class General_options): Add --warn_constructors. 2009-11-03 15:57:02 +00:00
Ian Lance Taylor b3d6a3d42f PR 10893
* defstd.cc (in_section): Add entries for __rel_iplt_start,
	__rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
2009-11-03 15:41:50 +00:00
Ian Lance Taylor 934b01dddc PR 10895
* po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
	--msgid-bugs-address.
	(install-pdf): New target.
	(install-data_yes): Look up one directory to find mkinstalldirs.
2009-11-03 15:20:30 +00:00
H.J. Lu 03c1939be4 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
* po/Make-in (.po.gmo): Don't generate .gmo files in source
	tree.
2009-11-03 14:43:10 +00:00
Doug Kwan ebd95253ac 2009-10-30 Doug Kwan <dougkwan@google.com>
* arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
2009-10-31 03:06:59 +00:00
Doug Kwan e9bbb53879 2009-10-30 Doug Kwan <dougkwan@google.com>
* arm.cc (Stub_addend_reader): New struct template definition
	and partial specializations.
	(Stub_addend_reader::operator()): New method definition for a
	partially specialized template.
2009-10-31 02:59:36 +00:00
Doug Kwan d5b40221bc 2009-10-30 Doug Kwan <dougkwan@google.com>
elfcpp/ChangeLog:
	* arm.h (EF_ARM_BE8, EF_ARM_EABIMASK, EF_ARM_EABI_UNKNOWN,
	EF_ARM_EABI_VER1, EF_ARM_EABI_VER2, EF_ARM_EABI_VER3,
	EF_ARM_EABI_VER4, EF_ARM_EABI_VER5): New enums for processor-specific
	flags.
	(arm_eabi_version): New inline function.
	* elfcpp.h: Add a comment about DT_ENCODING.

gold/ChangeLog:
	* arm.cc (Arm_relobj::processor_specific_flags): New method
	definition.
	(Arm_relobj::do_read_symbols): New method declaration.
	(Arm_relobj::processor_specific_flags_): New data member declaration.
	(Arm_dynobj): New class definition.
	(Target_arm::do_finalize_sections): Add input_objects parameter.
	(Target_arm::do_adjust_elf_header): New method declaration.
	(Target_arm::are_eabi_versions_compatible,
	(Target_arm::merge_processor_specific_flags): New method declaration.
	(Target_arm::do_make_elf_object): New overloaded method definitions
	and declaration.
	(Arm_relobj::do_read_symbols): New method definition.
	(Arm_dynobj::do_read_symbols): Ditto.
	(Target_arm::do_finalize_sections): Add input_objects parameters.
	Merge processor-specific flags from all input objects.
	(Target_arm::are_eabi_versions_compatible,
	Target_arm::merge_processor_specific_flags,
	Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
	New method definitions.
	* i386.cc (Target_i386::do_finalize_sections): Add unnamed
	Input_objects pointer type parameter.
	* layout.cc (Layout::finalize): Pass input objects to target's.
	finalize_sections function.
	* output.cc (Output_file_header::do_sized_write): Set ELF file
	header's processor-specific flags.
	* powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
	Input_objects pointer type parameter.
	* sparc.cc (Target_sparc::do_finalize_sections): Same.
	* target.h (Input_objects): New forward class declaration.
	(Target::processor_specific_flags,
	Target::are_processor_specific_flags_sect): New method definitions.
	(Target::finalize_sections): Add input_objects parameter.
	(Target::Target): Initialize processor_specific_flags_ and
	are_processor_specific_flags_set_.
	(Target::do_finalize_sections): Add unnamed Input_objects pointer type
	parameter.
	(Target::set_processor_specific_flags): New method definition.
	(Target::processor_specific_flags_,
	Target::are_processor_specific_flags_set_): New data member
	declarations.
	* x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
	Input_objects pointer type parameter.
2009-10-30 18:49:59 +00:00
Doug Kwan ebabffbd89 2009-10-30 Doug Kwan <dougkwan@google.com>
* arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
2009-10-30 18:00:55 +00:00
Ian Lance Taylor ad0f2072a6 * object.h (class Relobj): Drop options parameter from
gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
	do_scan_relocs, do_relocate.  Change all callers.
	(class Sized_relobj): Drop options parameters from
	do_gc_process_relocs, do_scan_relocs, do_relocate,
	do_relocate_sections, relocate_sections, emit_relocs_scan,
	emit_relocs_scan_reltype.  Change all callers.
	(struct Relocate_info): Remove options field and all references to
	it.
	* reloc.h (class Read_relocs): Remove options constructor
	parameter and options_ field.  Change all callers.
	(class Gc_process_relocs, class Scan_relocs): Likewise.
	(class Relocate_task): Likewise.
	* target-reloc.h (scan_relocs): Remove options parameter.  Change
	all callers.
	(scan_relocatable_relocs): Likewise.
	* target.h (class Sized_target): Remove options parameter from
	gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
	all callers.
	* gc.h (gc_process_relocs): Remove options parameter.  Change all
	callers.
	* arm.cc: Update functions to remove options parameters.
	* i386.cc: Likewise.
	* powerpc.cc: Likewise.
	* sparc.cc: Likewise.
	* x86_64.cc: Likewise.
	* testsuite/testfile.cc: Likewise.
2009-10-29 05:16:23 +00:00
Doug Kwan 8ffa366761 2009-10-28 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_relobj): New class definition.
	(Arm_relobj::scan_sections_for_stubs,
	Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
	New method definitions.
2009-10-29 01:53:35 +00:00
Cary Coutant 40f36857fe * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
(Plugin::cleanup_done_): New member.
	(Plugin_manager::Plugin_manager): Remove cleanup_done_.
	(Plugin_manager::cleanup_done_): Remove.
	(Plugin_manager::add_input_file): Edit error message.
	* plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
	(Plugin_manager::cleanup): Remove use of cleanup_done_.
2009-10-28 18:07:25 +00:00
Ian Lance Taylor 2c84949387 * fileread.cc: (File_read::View::~View): Use the new
data_ownership_ filed.
	(File_read::~File_read): Dispose the new whole_file_view_.
	(File_read::open): Mmap the whole file if needed.
	(File_read::open): Use whole_file_view_ instead of contents_.
	(File_read::find_view): Use whole_file_view_ if applicable.
	(File_read::do_read): Use whole_file_view_ instead of contents_.
	(File_read::make_view): Use whole_file_view_ instead of contents_,
	update File_read::View::View call.
	(File_read::find_or_make_view): Update File_read::View::View
	call.
	* fileread.h: (File_read::File_read): Initialize whole_file_view_,
	remove contents_
	(File_read::View::Data_ownership): New enum.
	(File_read::View::View): Replace bool mapped_ with Data_ownership
	argument.
	(File_read::View::mapped_): Remove (replaced by data_ownership_).
	(File_read::View::data_ownership_): New field.
	(File_read::contents_): Remove (replaced by whole_file_view_).
	(File_read::whole_file_view_): New field.
	* options.h (class General_options): Add --keep-files-mapped.
2009-10-28 00:42:34 +00:00
Cary Coutant 2499805399 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
* testsuite/Makefile.am (plugin_test_5): New test case.
	* testsuite/Makefile.in: Regenerate.
2009-10-28 00:32:12 +00:00
Doug Kwan 72adc4fad7 2009-10-25 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
	(Arm_input_section::as_arm_input_section): New method.
	(Arm_output_section): New class definition.
	(Arm_output_section::create_stub_group,
	Arm_output_section::group_sections): New method definitions.
2009-10-25 16:57:32 +00:00
Doug Kwan 07f508a253 2009-10-24 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
	(Arm_input_section::as_arm_input_section): New method.
	(Arm_output_section): New class definition.
	(Arm_output_section::create_stub_group,
	Arm_output_section::group_sections): New method definitions.
2009-10-24 09:36:15 +00:00
Doug Kwan 10ad9fe591 2009-10-22 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_input_section): New class definition.
	(Arm_input_section::init, Arm_input_section:do_write,
	Arm_input_section::set_final_data_size,
	Arm_input_section::do_reset_address_and_file_offset): New method
	definitions.
2009-10-22 18:58:02 +00:00
Doug Kwan 56ee5e00a8 2009-10-21 Doug Kwan <dougkwan@google.com>
* arm.cc (Stub_table, Arm_input_section): New forward class
	declarations.
	(Stub_table): New class defintion.
	(Stub_table::add_reloc_stub, Stub_table::relocate_stubs
	Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
	New method definition.
2009-10-21 18:33:18 +00:00
Doug Kwan b569affa94 2009-10-21 Doug Kwan <dougkwan@google.com>
* arm.cc: Update copyright comments.
	(Target_arm): New forward class template declaration.
	(Arm_address): New type.
	(ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
	THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
	THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
	constants.
	(Insn_template): Same.
	(DEF_STUBS): New macro.
	(Stub_type): New enum type.
	(Stub_template): New class definition.
	(Stub): Same.
	(Reloc_stub): Same.
	(Stub_factory): Same.
	(Target_arm::Target_arm): Initialize may_use_blx_ and
	should_force_pic_veneer_.
	(Target_arm::may_use_blx, Target_arm::set_may_use_blx,
	Target_arm::should_force_pic_veneer,
	Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
	Target_arm::using_thumb_only, Target_arm:;default_target): New
	method defintions.
	(Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
	New data member declarations.
	(Insn_template::size, Insn_template::alignment): New method defintions.
	(Stub_template::Stub_template): New method definition.
	(Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
	Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
	(Stub_factory::Stub_factory): New method definition.
	* gold.h (string_hash): New template.
	* output.h (Input_section_specifier::hash_value): Use
	gold::string_hash.
	(Input_section_specifier::string_hash): Remove.
	* stringpool.cc (Stringpool_template::string_hash): Use
	gold::string_hash.
2009-10-21 08:08:41 +00:00
Doug Kwan 6c17254915 2009-10-20 Doug Kwan <dougkwan@google.com>
* object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
	symbols of relaxed input sections.
	* output.h (Output_section::find_relaxed_input_section): Make
	method public.
2009-10-21 00:45:52 +00:00
Doug Kwan c5617f2fb6 2009-10-16 Doug Kwan <dougkwan@google.com>
* dynobj.cc (Versions::Versions): Initialize version_script_.
	Only insert base version symbol definition for a shared object
	if version script defines any version versions.
	(Versions::define_base_version): New method definition.
	(Versions::add_def): Check that base version is not needed.
	(Versions::add_need): Define base version lazily.
	* dynobj.h (Versions::define_base_version): New method declaration.
	(Versions::needs_base_version_): New data member declaration.
	* testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
	(check_DATA): Add no_version_test.stdout.
	(libno_version_test.so, no_version_test.o no_version_test.stdout):
	New make rules.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/no_version_test.c: New file.
	* testsuite/no_version_test.sh: Ditto.
2009-10-16 19:11:32 +00:00
Doug Kwan 3c12dcdba0 2009-10-16 Doug Kwan <dougkwan@google.com>
* expression.cc (class Segment_start_expression): New class definition.
	(Segment_start_expression::value): New method definition.
	(script_exp_function_segment_start): Return a new
	Segment_start_expression.
	* gold/script-c.h (script_saw_segment_start_expression): New function
	prototype.
	* script-sections.cc (Script_sections::Script_sections): Initialize
	SAW_SEGMENT_START_EXPRESSION_ to false.
	(Script_sections::set_section_addresses): Use -Ttext, -Tdata
	and -Tbbs options to specify section addresses if given in
	command line and no SEGMENT_START expression is seen in a script.
	* script-sections.h (Script_sections::saw_segment_start_expression,
	Script_sections::set_saw_segment_start_expression): New method
	definition.
	(Script_sections::saw_segment_start_expression_): New data member
	declaration.
	* script.cc (script_saw_segment_start_expression): New function.
	* yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
	* testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
	script_test_7.sh and script_test_8.sh.
	(check_DATA): Add script_test_6.stdout, script_test_7.stdout and
	script_test_8.stdout.
	(MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
	(script_test_6, script_test_6.stdout, script_test_7,
	script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
	* Makefile.in: Regenerate.
	* testsuite/script_test_6.sh: New file.
	* testsuite/script_test_6.t: Same.
	* testsuite/script_test_7.sh: Same.
	* testsuite/script_test_7.t: Same.
	* testsuite/script_test_8.sh: Same.
2009-10-16 18:56:07 +00:00
Doug Kwan 64b1ae3731 2009-10-16 Doug Kwan <dougkwan@google.com>
* output.cc (Output_segment::set_section_list_address): Cast
	expressions to unsigned long long type to avoid format warnings.
2009-10-16 18:34:53 +00:00
Ian Lance Taylor 12edd763cc * script.cc (Script_options::add_symbol_assignment): Always add a
dot assginment to script_sections_.
	* script-sections.cc (Script_sections::add_dot_assignment):
	Initialize if necessary.
2009-10-16 05:19:07 +00:00
Ian Lance Taylor 68b6574b4d * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
program headers with no load segment if there is a linker script.
2009-10-16 05:16:09 +00:00
Ian Lance Taylor 661be1e21e * layout.cc (Layout::set_segment_offsets): Align the file offset
to the segment aligment for -N or -n with no load segment.
	* output.cc (Output_segment::add_output_section): Don't crash if
	the first section is a TLS section.
	(Output_segment::set_section_list_addresses): Print an error
	message if the address moves backward in a linker script.
	* script-sections.cc
	(Output_section_element_input::set_section_addresses): Don't
	increase *dot_value for a SHF_TLS/SHT_NOBITS section.
	(Orphan_output_section::set_section_addresses): Likewise.
2009-10-16 05:00:29 +00:00
Doug Kwan f15f61a7f3 2009-10-15 Doug Kwan <dougkwan@google.com>
* layout.cc (Layout::finish_dynamic_section): Generate tags
	DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
	DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
	used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
2009-10-15 18:17:48 +00:00
Ian Lance Taylor 82bb573a56 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
fields.
	* object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
	data_shdr fields of relinfo.
	* i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
	(Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
	R_386_TLS_LDO_32, adjust based on section flags.
	(Target_i386::Relocate::fix_up_ldo): Remove.
2009-10-15 00:33:18 +00:00
Ian Lance Taylor 374ad2854b Add support for -pie.
* options.h (class General_options): Add -pie and
	--pic-executable.
	(General_options::output_is_position_independent): Test -pie.
	(General_options::output_is_executable): Return true if not shared
	and not relocatable.
	(General_options::output_is_pie): Remove.
	* options.cc (General_options::finalize): Reject incompatible uses
	of -pie.
	* gold.cc (queue_middle_tasks): A -pie link is not static.
	* symtab.h (Symbol::needs_plt_entry): Return false if -pie.
	* symtab.cc (Symbol::final_value_is_known): Return false if
	output_is_position_independent.
	* layout.cc (Layout::set_segment_offsets): Start at address 0 if
	output_is_position_independent.
	* output.cc (Output_file_header::do_sized_write): Use ET_DYN if
	output_is_position_independent.
	* i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
	output_is_position_independent.
	* testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
	two_file_pie_test.
	(basic_pie_test.o, basic_pie_test): New targets.
	(two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
	(two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
	(two_file_pie_test): New target.
	* testsuite/Makefile.in: Rebuild.
	* README: Remove note saying that -pie is not supported.
2009-10-14 05:25:02 +00:00
Ian Lance Taylor c658516291 * options.h (class General_options): Add -init and -fini.
* layout.cc (Layout::finish_dynamic_section): Emit
	given init and fini functions.
2009-10-13 21:23:00 +00:00
Sriraman Tallam 032ce4e9e3 * gc.h (gc_process_relocs): Check if icf is enabled using new
function.
	* gold.cc (queue_initial_tasks): Likewise.
	(queue_middle_tasks): Likewise.
	* object.cc (do_layout): Likewise.
	* symtab.cc (is_section_folded): Likewise.
	* main.cc (main): Likewise.
	* reloc.cc (Read_relocs::run): Likewise.
	(Sized_relobj::do_scan_relocs): Likewise.
	* icf.cc (is_function_ctor_or_dtor): New function.
	(Icf::find_identical_sections): Check if function is ctor or dtor when
	safe icf is chosen.
	* options.h (General_options::icf): Change option to be an enum.
	(Icf_status): New enum.
	(icf_enabled): New method.
	(icf_safe_folding): New method.
	(set_icf_status): New method.
	(icf_status_): New variable.
	* (options.cc) (General_options::finalize): Set icf_status_.
	* testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
	icf_test and icf_keep_unique_test to use the --icf enum flag.
	* testsuite/icf_safe_test.sh: New file.
	* testsuite/icf_safe_test.cc: New file.
2009-10-13 21:17:43 +00:00
Sriraman Tallam f345227a0c * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
includes to gc.h and icf.h.
	* arm.cc: Include gc.h.
	* gold.cc: Likewise.
	* i386.cc: Likewise.
	* powerpc.cc: Likewise.
	* sparc.cc: Likewise.
	* x86_64.cc: Likewise.
	* gc.h: Include icf.h.
2009-10-13 00:39:31 +00:00
Ian Lance Taylor 1c7814eddb * plugin.cc: Include "gold.h" before other header files. 2009-10-12 06:02:06 +00:00
Chris Demetriou ae3b518947 2009-10-10 Chris Demetriou <cgd@google.com>
* options.h (Input_file_argument::Input_file_type): New enum.
	(Input_file_argument::is_lib_): Replace with...
	(Input_file_argument::type_): New member.
	(Input_file_argument::Input_file_argument): Take Input_file_type
	'type' rather than boolean 'is_lib' as second argument.
	(Input_file_argument::is_lib): Use type_.
	(Input_file_argument::is_searched_file): New function.
	(Input_file_argument::may_need_search): Handle is_searched_file.
	* options.cc (General_options::parse_library): Support -l:filename.
	(General_options::parse_just_symbols): Update for Input_file_argument
	changes.
	(Command_line::process): Likewise.
	* archive.cc (Archive::get_file_and_offset): Likewise.
	* plugin.cc (Plugin_manager::release_input_file): Likewise.
	* script.cc (read_script_file, script_add_file): Likewise.
	* fileread.cc (Input_file::Input_file): Likewise.
	(Input_file::will_search_for): Handle is_searched_file.
	(Input_file::open): Likewise.
	* readsyms.cc (Read_symbols::get_name): Likewise.
	* testsuite/Makefile.am (searched_file_test): New test.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/searched_file_test.cc: New file.
	* testsuite/searched_file_test_lib.cc: New file.
2009-10-10 07:39:04 +00:00
Ian Lance Taylor f3048a1d47 * descriptor.cc: Include <cstdio> and "binary-io.h".
(Descriptors::open): Open the files in binary mode always.
	* script.cc (Lex::get_token): Treat \r as whitespace.
2009-10-10 04:56:43 +00:00
Ian Lance Taylor d4780e57f5 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0. 2009-10-10 01:24:57 +00:00
Ian Lance Taylor d9a893b837 * configure.ac: Check for readv function also.
* fileread.cc (readv): Define if not HAVE_READV.
	* fileread.h (File_read:: max_readv_entries): Set to 1 if readv
	does not exist.
	* config.in: Regenerate.
	* configure: Regenerate.
2009-10-09 23:20:44 +00:00
Doug Kwan c0a6286595 2009-10-09 Doug Kwan <dougkwan@google.com>
* layout.cc (Layout::make_output_section): Call target hook to make
	ordinary output section.
	(Layout::finalize): Adjust parameter list of call the
	Target::may_relax().
	* layout.h (class Layout::section_list): New method.
	* merge.h (Output_merge_base::entsize): Change visibility to public.
	(Output_merge_base::is_string, Output_merge_base::do_is_string):
	New methods.
	(Output_merge_string::do_is_string): New method.
	* object.cc (Sized_relobj::do_setup): renamed from
	Sized_relobj::set_up.
	* object.h (Sized_relobj::adjust_shndx,
	Sized_relobj::initializ_input_to_output_maps,
	Sized_relobj::free_input_to_output_maps): Change visibilities to
	protected.
	(Sized_relobj::setup): Virtualize.
	(Sized_relobj::do_setup): New method declaration.
	(Sized_relobj::invalidate_section_offset,
	Sized_relobj::do_invalidate_section_offset): New method decfinitions.
	(Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
	* options.cc (parse_int): New function.
	* options.h (parse_int): New declaration.
	(DEFINE_int): New macro.
	(stub_group_size): New option.
	* output.cc (Output_section::Output_section): Initialize memebers
	merge_section_map_, merge_section_by_properties_map_,
	relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
	(Output_section::add_input_section): Handled deferred code-fill
	generation and remove an old comment.
	(Output_section::add_relaxed_input_section): New method definition.
	(Output_section::add_merge_input_section): Use merge section by
	properties map to speed to search.  Update merge section maps
	as appropriate.
	(Output_section::build_relaxation_map): New method definition.
	(Output_section::convert_input_sections_in_list_to_relaxed_sections):
	Same.
	(Output_section::relax_input_section): Renamed to
	Output_section::convert_input_sections_to_relaxed_sections and change
	interface to take a vector of pointers to relaxed sections.
	(Output_section::find_merge_section,
	Output_section::find_relaxed_input_section): New method definitions.
	(Output_section::is_input_address_mapped,
	Output_section::output_offset, Output_section::output_address):
	Use output section data maps to speed up searching.
	(Output_section::find_starting_output_address): Add comments.
	(Output_section::do_write,
	Output_section::write_to_postprocessing_buffer): Do code-fill
	generation as appropriate.
	(Output_section::get_input_sections): Invalidate relaxed input section
	map.
	(Output_section::restore_states): Adjust type of checkpoint .
	Invalidate relaxed input section map.
	* output.h (Output_merge_base): New class declaration.
	(Input_section_specifier): New class defintion.
	(class Output_relaxed_input_section) Change base class to
	Output_section_data_build.
	(Output_relaxed_input_section::Output_relaxed_input_section): Adjust
	base class initializer.
	(Output_section::add_relaxed_input_section): New method declaration.
	(Output_section::Input_section): Change visibility to protected.
     	(Output_section::Input_section::relobj,
	Output_section::Input_section::shndx): Handle relaxed input sections.
	Output_section::input_sections) Change visibility to protected.  Also
	define overload to return a non-const pointer.
	(Output_section::Merge_section_properties): New class defintion.
	(Output_section::Merge_section_by_properties_map,
	Output_section::Output_section_data_by_input_section_map,
	Output_section::Relaxation_map): New types.
	(Output_section::relax_input_section): Rename method to
	Output_section::convert_input_sections_to_relaxed_sections and change
	interface to take a vector of relaxed section pointers.
	(Output_section::find_merge_section,
	Output_section::find_relaxed_input_section,
	Output_section::build_relaxation_map,
	Output_section::convert_input_sections_in_list_to_relaxed_sections):
	New method declarations.
	(Output_section::merge_section_map_
	Output_section::merge_section_by_properties_map_,
	Output_section::relaxed_input_section_map_,
	Output_section::is_relaxed_input_section_map_valid_,
	Output_section::generate_code_fills_at_write_): New data members.
	* script-sections.cc
	(Output_section_element_input::set_section_addresses): Call
	current_data_size and addralign methods of relaxed input sections.
	(Orphan_output_section::set_section_addresses): Call current_data_size
	and addralign methods of relaxed input sections.
	* symtab.cc (Symbol_table::compute_final_value): Extract template
	from the body of Symbol_table::sized_finalize_symbol.
	(Symbol_table::sized_finalized_symbol): Call
	Symbol_table::compute_final_value.
	* symtab.h (Symbol_table::Compute_final_value_status): New enum type.
	(Symbol_table::compute_final_value): New templated method declaration.
	* target.cc (Target::do_make_output_section): New method defintion.
	* target.h (Target::make_output_section): New method declaration.
	(Target::relax): Add more parameters for input objects, symbol table
	and layout.  Adjust call to do_relax.
	(Target::do_make_output_section): New method declaration.
	(Target::do_relax): Add parameters for input objects, symbol table
	and layout.
2009-10-09 23:18:19 +00:00
Ian Lance Taylor d446d6c4f7 * pread.c: Include stdio.h. 2009-10-09 23:10:15 +00:00
Ian Lance Taylor bc06c745d9 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
defined.
2009-10-09 23:07:30 +00:00
Ian Lance Taylor 75aea3d03d * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
Change read_shndx type to unsigned int.
	(Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
	int.
	(Sized_dwarf_line_info::read_line_mappings): Likewise.
	* dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
	Change read_shndx type to unsigned int.
	(Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
	int.
	(Sized_dwarf_line_info::read_line_mappings): Likewise.
	* layout.cc (Layout::create_symtab_sections): Cast the result of
	local_symcount * symsize to off_t in the gold_assert.
2009-10-09 23:05:21 +00:00
Ian Lance Taylor be8fcb7563 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
	R_ARM_BASE_ABS.
	(Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
	(Arm_relocate_functions::thm_abs5): New function.
	(Arm_relocate_functions::abs12): New function.
	(Arm_relocate_functions::abs16): New function.
	(Arm_relocate_functions::base_abs): New function.
	(Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
	(Scan::local): Remove special handling of R_ARM_ABS8.  Handle
	R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
	R_ARM_BASE_ABS.
	(Scan::global): Likewise.
	(Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
	R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
	(Relocatable_size_for_reloc::get_size_for_reloc): Handle
	R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
	R_ARM_BASE_ABS.
2009-10-09 22:56:41 +00:00
Ian Lance Taylor c2a122b635 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
(Arm_relocate_functions::movt_prel): New function.
	(Arm_relocate_functions::thm_movw_prel_nc): New function.
	(Arm_relocate_functions::thm_movt_prel): New function.
	(Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
	R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
	(Scan::global, Relocate::relocate): Likewise.
	(Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2009-10-09 22:45:13 +00:00
Ian Lance Taylor c4aa1e2d74 elfcpp/:
* elf_file.h: (class Elf_strtab): New class.
gold/:
	* gold.cc: (queue_initial_tasks): Pass incremental_inputs to
	Incremental_checker.
	* incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
	unsigned int.
	(class Incremental_inputs_header): New class.
	(Incremental_inputs_header_writer): Edit comment.
	(Incremental_inputs_entry): New class.
	(Incremental_inputs_entry_writer): Edit comment.
	(Sized_incremental_binary::do_find_incremental_inputs_section):
	Add *strtab_shndx parameter, fill it.
	(Sized_incremental_binary::do_check_inputs): New method.
	(Incremental_checker::can_incrementally_link_output_file): Use
	Sized_incremental_binary::check_inputs.
	(Incremental_inputs::report_command_line): Save command line in
	command_line_.
	* incremental.h:
	(Incremental_binary::find_incremental_inputs_section): New
	method.
	(Incremental_binary::do_find_incremental_inputs_section): Add
	strtab_shndx parameter.
	(Incremental_binary::do_check_inputs): New pure virtual method.
	(Sized_incremental_binary::do_check_inputs): Declare.
	(Incremental_checker::Incremental_checker): Add incremental_inputs
	parameter, use it to initialize incremental_inputs_.
	(Incremental_checker::incremental_inputs_): New field.
	(Incremental_checker::command_line): New method.
	(Incremental_checker::inputs): New method.
	(Incremental_checker::command_line_): New field.
2009-10-09 22:38:07 +00:00
Ian Lance Taylor c549a6949c elfcpp/:
* elfcpp_file.h: Fix header guard.  Include <cstdio>.
	(class Elf_recognizer): New class, code from gold/object.cc.
	(Elf_file::find_section_by_type): New method.
gold/:
	* incremental.cc: Include <cstdarg> and "target-select.h".
	(vexplain_no_incremental): New function.
	(explain_no_incremental): New function.
	(Incremental_binary::error): New method.
	(Sized_incremental_binary::do_find_incremental_inputs_section): New
	method.
	(make_sized_incremental_binary): New function.
	(open_incremental_binary): New function.
	(can_incrementally_link_file): Add checks if output is ELF and has
	inputs section.
	* incremental.h: Include "elfcpp_file.h" and "output.h".
	(Incremental_binary): New class.
	(Sized_incremental_binary): New class.
	(open_incremental_binary): Declare.
	* object.cc (is_elf_object): Use
	elfcpp::Elf_recognizer::is_elf_file.
	(make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
	* output.h (Output_file::filesize): New method.
2009-10-09 16:40:51 +00:00
Ian Lance Taylor fd3c5f0b49 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
New function.
	(Arm_relocate_functions::insert_val_arm_movw_movt): New function.
	(Arm_relocate_functions::extract_thumb_movw_movt_addend): New
	function.
	(Arm_relocate_functions::insert_val_thumb_movw_movt): New
	function.
	(Arm_relocate_functions::movw_abs_nc): New function.
	(Arm_relocate_functions::movt_abs): New function.
	(Arm_relocate_functions::thm_movw_abs_nc): New function.
	(Arm_relocate_functions::thm_movt_abs): New function.
	(Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
	R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
	(Scan::global): Likewise.
	(Relocate::relocate): Likewise.
	(Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2009-10-07 15:41:50 +00:00
Ian Lance Taylor 7f5309a5cc * arm.cc (Arm_relocate_functions::got_prel) New function.
(Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
	(Relocate::relocate): Likewise.
	(Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
2009-10-07 15:30:40 +00:00
Ian Lance Taylor 364c7fa5c9 * options.h (class General_options): Define
split_stack_adjust_size parameter.
	* object.h (class Object): Add uses_split_stack_ and
	has_no_split_stack_ fields.  Add uses_split_stack and
	has_no_split_stack accessor functions.  Declare
	handle_split_stack_section.
	(class Reloc_symbol_changes): Define.
	(class Sized_relobj): Define Function_offsets.  Declare
	split_stack_adjust, split_stack_adjust_reltype, and
	find_functions.
	* object.cc (Object::handle_split_stack_section): New function.
	(Sized_relobj::do_layout): Call handle_split_stack_section.
	* dynobj.cc (Sized_dynobj::do_layout): Call
	handle_split_stack_section.
	* reloc.cc (Sized_relobj::relocate_sections): Call
	split_stack_adjust for executable sections in split_stack
	objects.  Pass reloc_map to relocate_section.
	(Sized_relobj::split_stack_adjust): New function.
	(Sized_relobj::split_stack_adjust_reltype): New function.
	(Sized_relobj::find_functions): New function.
	* target-reloc.h: Include "object.h".
	(relocate_section): Add reloc_symbol_changes parameter.  Change
	all callers.
	* target.h (class Target): Add calls_non_split method.  Declare
	do_calls_non_split virtual method.  Declare match_view and
	set_view_to_nop.
	* target.cc: Include "elfcpp.h".
	(Target::do_calls_non_split): New function.
	(Target::match_view): New function.
	(Target::set_view_to_nop): New function.
	* gold.cc (queue_middle_tasks): Give an error if mixing
	split-stack and non-split-stack objects with -r.
	* i386.cc (Target_i386::relocate_section): Add
	reloc_symbol_changes parameter.
	(Target_i386::do_calls_non_split): New function.
	* x86_64.cc (Target_x86_64::relocate_section): Add
	reloc_symbol_changes parameter.
	(Target_x86_64::do_calls_non_split): New function.
	* arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
	parameter.
	* powerpc.cc (Target_powerpc::relocate_section): Add
	reloc_symbol_changes parameter.
	* sparc.cc (Target_sparc::relocate_section): Add
	reloc_symbol_changes parameter.
	* configure.ac: Call AM_CONDITIONAL for the default target.
	* configure: Rebuild.
	* testsuite/Makefile.am (TEST_AS): New variable.
	(check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
	(check_DATA): Add split_i386 and split_x86_64 files.
	(SPLIT_DEFSYMS): Define.
	(split_i386_[1234n].o): New targets.
	(split_i386_[124]): New targets.
	(split_i386_[1234r].stdout): New targets.
	(split_x86_64_[1234n].o): New targets.
	(split_x86_64_[124]): New targets.
	(split_x86_64_[1234r].stdout): New targets.
	(MOSTLYCLEANFILES): Add new executables.
	* testsuite/split_i386.sh: New file.
	* testsuite/split_x86_64.sh: New file.
	* testsuite/split_i386_1.s: New file.
	* testsuite/split_i386_2.s: New file.
	* testsuite/split_i386_3.s: New file.
	* testsuite/split_i386_4.s: New file.
	* testsuite/split_i386_n.s: New file.
	* testsuite/split_x86_64_1.s: New file.
	* testsuite/split_x86_64_2.s: New file.
	* testsuite/split_x86_64_3.s: New file.
	* testsuite/split_x86_64_4.s: New file.
	* testsuite/split_x86_64_n.s: New file.
	* testsuite/testfile.cc (Target_test): Update relocation_section
	function.
	* testsuite/Makefile.in: Rebuild.
2009-10-06 22:58:27 +00:00
Ian Lance Taylor d6f22b9890 Tweak last patch. 2009-10-06 21:44:11 +00:00
Ian Lance Taylor e8a9fcdace * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
(Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
	changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
	handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
	the address on ldo_addrs_.
	(Target_i386::Relocate::fix_up_ldo): New function.
2009-10-06 21:36:00 +00:00
Ian Lance Taylor e99daf92c2 * plugin.cc (add_input_library): New.
(Plugin::load): Add add_input_library to tv.
	(Plugin_manager::add_input_file): Add the is_lib argument.
	(add_input_file): Update call to Plugin_manager::add_input_file.
	(add_input_library): New.
	* plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
2009-10-06 20:15:09 +00:00
Doug Kwan 966d409744 2009-09-30 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
	symbol and call Symbol::may_need_copy_reloc to determine if
	a copy reloc is needed.
	* copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
	nocopyreloc is given in command line.
	(Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
	given in command line.
	* i386.cc (Target_i386::may_need_copy_reloc): Remove.
	(Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
	of the removed Target_i386::may_need_copy_reloc.
	* options.h (copyreloc): New option with default value false.
	* powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
	(Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
	instead of the removed Target_powerpc::may_need_copy_reloc.
	* sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
	(Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
	instead of the removed Target_sparc::may_need_copy_reloc.
	* symtab.h (Symbol::may_need_copy_reloc): New method definition.
	* x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
	(Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
	instead of the removed Target_x86_64::may_need_copy_reloc.
2009-10-01 00:58:38 +00:00
Ian Lance Taylor 029ba97335 * object.h (class Object): Remove target_ field, and target,
sized_target, and set_target methods.
	(Object::sized_target): Remove.
	(class Sized_relobj): Update declarations.  Remove sized_target.
	* object.cc (Sized_relobj::setup): Remove target parameter.
	Change all callers.
	(Input_objects::add_object): Don't do anything with the target.
	(make_elf_sized_object): Add punconfigured parameter.  Change all
	callers.  Set or test parameter target.
	* dynobj.cc (Sized_dynobj::target): Remove target parameter.
	Change all callers.
	* parameters.cc (Parameters::set_target): Change parameter type to
	be non-const.
	(Parameters::default_target): Remove.
	(set_parameters_target): Change parameter type to be non-const.
	(parameters_force_valid_target): New function.
	(parameters_clear_target): New function.
	* parameters.h (class Parameters): Update declarations.  Remove
	default_target method.  Add sized_target and clear_target
	methods.  Change target_ to be non-const.
	(set_parameters_target): Update declaration.
	(parameters_force_valid_target): Declare.
	(parameters_clear_target): Declare.
	* readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
	as NULL if we aren't searching.
	(Add_symbols::run): Don't check for compatible target.
	* fileread.cc (Input_file::open_binary): Call
	parameters_force_valid_target.
	* gold.cc (queue_middle_tasks): Likewise.
	* plugin.cc (make_sized_plugin_object): Likewise.  Don't call
	set_target on object.
	* dynobj.h (class Sized_dynobj): Update declarations.
	* archive.cc (Archive::get_elf_object_for_member): Return NULL if
	make_elf_object returns NULL.
	(Archive::include_member): Don't check whether object target is
	compatible.
	* output.cc (Output_section::add_input_section): Get target from
	parameters.
	(Output_section::relax_input_section): Likewise.
	* reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
	parameters.
	(Sized_relobj::do_scan_relocs): Likewise.
	(Sized_relobj::relocate_sections): Likewise.
	* resolve.cc (Symbol_table::resolve): Likewise.
	* symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
	parameter.  Change all callers.
	(Symbol_table::add_from_object): Get target from parameters.
	(Symbol_table::add_from_relobj): Don't check object target.
	(Symbol_table::add_from_dynobj): Likewise.
	(Symbol_table::define_special_symbol): Get target from
	parameters.
	* symtab.h (class Symbol_table): Update declaration.
	* testsuite/binary_unittest.cc (gold_testsuite): Remove target
	parameter.  Change all callers.  Clear parameter target.
	(Binary_test): Test target here.
	* testsuite/object_unittest.cc (gold_testsuite): Remove
	target_test_pointer parameter.  Change all callers.
	(Object_test): Test target here.
2009-09-30 22:21:13 +00:00
Ian Lance Taylor a6a22b839b * testsuite/initpri1.c: Don't try to use constructor priorities if
compiling with gcc before 4.3.
2009-09-27 05:20:03 +00:00
Ian Lance Taylor 6a8f49fe0a * testsuite/retain_symbols_file_test.sh (check_present): Change
output file name to retain_symbols_file_test.stdout.
	(check_absent): Likewise.
2009-09-22 19:54:46 +00:00
Craig Silverstein 8c60465154 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
* options.cc: Include <cerrno> and <fstream>.
	(General_options::finalize): Parse -retain-symbols-file tag.
	* options.h: New flag.
	(General_options): New method should_retain_symbol, new
	variable symbols_to_retain.
	* symtab.cc (Symbol_table::sized_finalize_symbol): Test
	should_retain_symbol map.
	* testsuite/Makefile.am (retain_symbols_file_test): New test.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/retain_symbols_file_test.sh: New file.
2009-09-18 20:03:22 +00:00
Nick Clifton ca58b19f00 Updated Spanish and Vietnamese translations 2009-09-18 07:54:47 +00:00
Doug Kwan 20e6d0d602 2009-09-17 Doug Kwan <dougkwan@google.com>
* debug.h (DEBUG_RELAXATION): New constant.
	(DEBUG_ALL): Add DEBUG_RELAXATION.
	(debug_string_to_enum): Add relaxation debug option.
	* layout.cc
	(Layout::Relaxation_debug_check::check_output_data_for_reset_values,
	Layout::Relaxation_debug_check::read_sections,
	Layout::Relaxation_debug_check::read_sections): New method definitions.
	(Layout::Layout): Initialize data members
	record_output_section_data_from_scrips_,
	script_output_section_data_list_ and relaxation_debug_check_.
	(Layout::save_segments, Layout::restore_segments,
	Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
	Layout::relaxation_loop_body): New method definitions.
	(Layout::finalize): Support relaxation.  Move section layout code to
	Layout::relaxation_loop_body.
	(Layout::set_asection_address_from_script): Move code for orphan
	section placement out.
	(Layout::place_orphan_sections_in_script): New method definition.
	* layout.h (Output_segment_headers, Output_file_header):
	New forward class declarations.
	(Layout::~Layout): Define.
	(Layout::new_output_section_data_from_script): New method definition.
	(Layout::place_orphan_sections_in_script): New method declaration.
	(Layout::Segment_states): New type declaration.
	(Layout::save_segments, Layout::restore_segments,
	Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
	Layout::relaxation_loop_body): New method declarations.
	(Layout::Output_section_data_list): New type declaration.
	(Layout::Relaxation_debug_check): New class definition.
	(Layout::record_output_section_data_from_script_,
	Layout::script_output_section_data_list_, Layout::segment_states_,
	Layout::relaxation_debug_check_): New data members.
	* output.cc: (Output_section_headers::do_size): New method definition.
	(Output_section_headers::Output_section_headers): Move size
	computation to Output_section_headers::do_size.
	(Output_segment_headers::do_size): New method definition.
	(Output_file_header::Output_file_header): Move size computation to
	Output_file_header::do_size and call it.
	(Output_file_header::do_size): New method definition.
	(Output_data_group::Output_data_group): Adjust call to
	Output_section_data.
	(Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
	(Output_symtab_xindex::do_write): Add array bound check.
 	(Output_section::Input_section::print_to_mapfile): Handle
	RELAXED_INPUT_SECTION_CODE.
	(Output_section::Output_section): Initialize data member checkpoint_.
	(Output_section::~Output_section): Delete checkpoint object pointed
	by checkpoint_.
	(Output_section::add_input_section): Always add an Input_section if
	relaxing.
	(Output_section::add_merge_input_section): Add assert.
	(Output_section::relax_input_section): New method definition.
	(Output_section::set_final_data_size): Set load address to zero for
	an unallocated section.
	(Output_section::do_address_and_file_offset_have_reset_values):
	New method definition.
	(Output_section::Input_section_sort_enty::Input_section_sort_enty):
	Handle relaxed input section.
	(Output_section::sort_attached_input_sections): Checkpoint input
	section list lazily.
	(Output_section::get_input_sections): Change type of input_sections to
	list of Simple_input_section pointers.  Checkpoint input section list
	lazily.  Also handle relaxed input sections.
	(Output_section::add_input_section_for_script): Take a reference to
	a Simple_input_section object instead of Relobj pointer and section
	index as parameter.  Handle relaxed input sections.
	(Output_section::save_states, Output_section::restore_states): New
	method definitions.
	* output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
	(Output_data::is_data_size_fixed): New method definition.
	(Output_data::reset_addresss_and_file_offset): Do not reset data size
	if it is fixed.
	(Output_data::address_and_file_offset_have_reset_values): New method
	definition.
	(Output_data::do_address_and_file_offset_have_reset_values): New method
	definition.
	(Output_data::set_data_size): Check that data size is not fixed.
	(Output_data::fix_data_size): New method definition.
	(Output_data::is_data_size_fixed_): New data member.
	(Output_section_headers::set_final_data_size): New method definition.
	(Output_section_headers::do_size): New method declaration.
	(Output_segment_headers::set_final_data_size): New method definition.
	(Output_segment_headers::do_size): New method declaration.
	(Output_file_header::set_final_data_size)::New method definition.
	(Output_file_header::do_size)::New method declaration.
	(Output_section_data::Output_section_data): Add new parameter
	is_data_size_fixed and use it to fix data size.
	(Output_data_const::Output_data_const): Adjust call to base class
	constructor and fix data size.
	(Output_data_const_buffer::Output_data_const_buffer): Adjust call to
	base class constructor and fix data size.
	(Output_data_fixed_space::Output_data_fixed_space): Adjust call to
	base class constructor and fix data size.
	(Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
	class constructor and fix data size.
	(Output_data_group::set_final_data_size): New method definition.
	(Output_data_dynamic::Dynamic_entry::tag): New method definition.
	(Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
	class constructor and fix data size.
	(Output_relaxed_input_section): New class definition.
	(Output_section::Simple_input_section): New class definition.
	(Output_section::get_input_sections): Adjust parameter list.
	(Output_section::add_input_section_for_script): Same.
	(Output_section::save_states, Output_section::restore_states,
	Output_section::do_address_and_file_offset_have_reset_values,
	(Output_section::Input_section::Input_section): Handle
	RELAXED_INPUT_SECTION_CODE.  Add new overload for
	Output_relaxed_input_section.
	(Output_section::Input_section::is_input_section,
	Output_section::Input_section::set_output_section): Handle relaxed
	input section.
	(Output_section::Input_section::is_relaxed_input_section,
	Output_section::Input_section::output_section_data,
	Output_section::Input_section::relaxed_input_section): New method
	definitions.
	(Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
	value.
	(Output_section::Input_section::u1_): Update comments.
	(Output_section::Input_section::u2_): Add new union member poris.
	(Output_section::Checkpoint_output_section): New classs definition.
	(Output_section::relax_input_section): New method declaration.
	(Output_section::checkpoint_): New data member.
	(Output_segment): Update comments.
	(Output_segment::Output_segment): Un-privatize copy constructor.
	(Output_segment::operator=): Un-privatize.
	* script-sections.cc (Output_section_element::Input_section_list):
	Change element type to Output_section::Simple_input_section.
	(Output_section_element_dot_assignment::set_section_addresses):
	Register output section data for relaxation clean up.
	(Output_data_exression::Output_data_expression): Adjust call to base
	constructor to fix data size.
	(Output_section_element_data::set_section_addresses): Register
	Output_data_expression object for relaxation clean up.
	(struct Input_section_info): Replace Relobj pointer and section index
	pair with Output_section::Simple_input_section and Convert struct to a
	class.
	(Input_section_sorter::operator()): Adjust access to
	Input_section_info data member to use accessors.
	(Output_section_element_input::set_section_addresses): Use layout
	parameter.  Adjust code to use Output_section::Simple_input_section
	and Input_secction_info classes.  Register filler for relaxation
	clean up.
	(Orphan_output_section::set_section_addresses): Replace Relobj pointer
	and section index pair with Output_section::Simple_input_section
	class.  Adjust code accordingly.
	(Phdrs_element::release_segment): New method definition.
	(Script_sections::attach_sections_using_phdrs_clause): Do not modify
	segment list.
	(Script_sections::release_segments): New method definition.
	* gold/script-sections.h (Script_sections::release_segments): New
	method declaration.
	* gold/target.h (Target::may_relax, Target::relax,
	Target::do_may_relax, Target::do_relax): New method definitions.
2009-09-18 01:10:38 +00:00
Ian Lance Taylor 5e445df679 * arm.cc (has_signed_unsigned_overflow): New function.
(Arm_relocate_functions::abs8): New function.
	(Target_arm::Scan::local): Handle R_ARM_ABS8.
	(Target_arm::Scan::global): Likewise.
	(Target_arm::relocate::relocate): Likewise.
	(Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
	Likewise.
2009-09-18 00:45:53 +00:00
Cary Coutant 72fef11a67 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
* testsuite/Makefile.in: Regenerate.
2009-09-16 20:57:27 +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
Cary Coutant 6a89f575aa * output.cc (Output_file::open): Add execute permission to empty file.
* testsuite/Makefile.am (permission_test): New test.
	* testsuite/Makefile.in: Regenerate.
2009-09-08 22:32:51 +00:00
Ian Lance Taylor fdcac5af29 * output.cc (Output_file::resize): Call map_no_anonymous rather
than map.
2009-09-02 16:39:06 +00:00
Ian Lance Taylor 44453f85d9 * gold.cc: Include "incremental.h".
(queue_initial_tasks): Call Incremental_checker methods.
	* incremental.cc: Include "output.h".
	(Incremental_checker::can_incrementally_link_output_file): New
	method.
	* incremental.h (Incremental_checker): New class.
2009-09-01 17:32:35 +00:00
Ian Lance Taylor 404c2abb01 * output.cc (Output_file::open_for_modification): New method.
(Output_file::map_anonymous): Changed return type to bool.  Record
	map in base_ field.
	(Output_file::map_no_anonymous): New method, broken out of map.
	(Output_file::map): Use map_no_anonymous and map_anonymous.
	* output.h (class Output_file): Update declarations.
2009-09-01 17:32:20 +00:00
Cary Coutant 293c13867a * options.h (Command_line::Pre_options): New class.
(Command_line::pre_options): New member.
	* options.cc (gold::options::ready_to_register): New variable.
	(One_option::register_option): Do nothing if not registering options.
	Assert if same short option registered twice.
	(General_options::General_options): Turn off option registration when
	done constructing.
	(Command_line::Pre_options::Pre_options): New constructor.
2009-08-25 01:10:48 +00:00
Cary Coutant 06a73cfe76 Fixed typo in ChangeLog. 2009-08-24 23:33:33 +00:00
Cary Coutant f773f3d2dc (General_options::no_keep_memory): Remove incorrect short option. 2009-08-24 23:31:45 +00:00
Ralf Wildenhues a15af8e2a7 Fix yacc and lex reruns with maintainer-mode off.
gas/:
	* Makefile.am (am__skiplex, am__skipyacc): New.
	* Makefile.in: Regenerate.

ld/:
	* Makefile.am (am__skiplex, am__skipyacc): New.
	* Makefile.in: Regenerate.

binutils/:
	* Makefile.am (am__skiplex, am__skipyacc): New.
	* Makefile.in: Regenerate.

gold/:
	* Makefile.am (am__skiplex, am__skipyacc): New.
	* Makefile.in: Regenerate.
2009-08-24 05:55:55 +00:00
Ralf Wildenhues 14ec8efdb1 Cleanups in binutils makefiles.
ld/:
	* Makefile.am (bin_PROGRAMS): Renamed from ...
	(noinst_PROGRAMS): ... this.
	(transform): Override, including the renaming of ld-new to ld.
	(install-exec-local): Installation of ld in $(bindir) not needed
	here any more.
	(AM_CPPFLAGS): Renamed from ...
	(INCLUDES): ... this.
	(MAINTAINERCLEANFILES): Add ld.1.
	* Makefile.in: Regenerate.

gold/:
	* Makefile.am (AM_CPPFLAGS): Renamed from ...
	(INCLUDES): ... this.
	* testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
	(AM_CPPFLAGS): Renamed from ...
	(INCLUDE): ... this.
	* Makefile.in, testsuite/Makefile.in: Regenerate.

bfd/:
	* Makefile.am (libbfd_la_LDFLAGS): Initialize early, to allow
	appending.
	[INSTALL_LIBBFD] (bfdlib_LTLIBRARIES, bfdinclude_HEADERS): Set
	only in this condition.
	[!INSTALL_LIBBFD] (noinst_LTLIBRARIES, libbfd_la_LDFLAGS): New,
	to build but not install libbfd.la in this condition.
	(install-bfdlibLTLIBRARIES, uninstall-bfdlibLTLIBRARIES)
	(install_libbfd, install_libbfd): Remove.
	* Makefile.in: Regenerate.

binutils/:
	* Makefile.am (AM_CPPFLAGS): Renamed from ...
	(INCLUDES): ... this.
	(bin2c$(EXEEXT_FOR_BUILD): Adjust rule.
	(installcheck-local): Renamed from ...
	(installcheck): ... this.
	* Makefile.in: Regenerate.

gas/:
	* Makefile.am (YFLAGS): Remove, not needed any more.
	(AM_CPPFLAGS): Renamed from ...
	(INCLUDES): ... this.
	* Makefile.in: Regenerate.

gprof/:
	* Makefile.am (AM_CPPFLAGS): Renamed from ...
	(INCLUDES): ... this.
	* Makefile.in: Regenerate.

opcodes/:
	* Makefile.am (libopcodes_la_LDFLAGS): Initialize early.
	[INSTALL_LIBBFD] (bfdlib_LTLIBRARIES): Set only in this condition.
	[INSTALL_LIBBFD] (bfdinclude_DATA): New.
	[!INSTALL_LIBBFD] (noinst_LTLIBRARIES): New.
	[!INSTALL_LIBBFD] (libopcodes_la_LDFLAGS): Ensure libopcodes.la
	is built shared even if it is not to be installed.
	(install-bfdlibLTLIBRARIES,uninstall-bfdlibLTLIBRARIES)
	(install_libopcodes, uninstall_libopcodes): Remove.
	(AM_CPPFLAGS): Renamed from ...
	(INCLUDES): ... this.
	* Makefile.in: Regenerate.
2009-08-22 19:02:57 +00:00
Ralf Wildenhues 81ecdfbb4d Regenerate tree using Autoconf 2.64 and Automake 1.11.
config/:
	* override.m4 (_GCC_AUTOCONF_VERSION): Bump to 2.64.

/:
	* configure: Regenerate.

etc/:
	* configure: Regenerate.

sim/common/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/iq2000/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/d10v/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/igen/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/m32r/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/frv/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/:
	* avr/config.in: Regenerate.
	* avr/configure: Likewise.
	* configure: Likewise.
	* cris/config.in: Likewise.
	* cris/configure: Likewise.

sim/h8300/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/mn10300/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/ppc/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/erc32/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/arm/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/m68hc11/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/lm32/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/sh64/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/v850/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/cr16/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/moxie/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/m32c/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/mips/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/mcore/:
	* config.in: Regenerate.
	* configure: Likewise.

sim/testsuite/d10v-elf/:
	* configure: Regenerate.

sim/testsuite/:
	* configure: Regenerate.

sim/testsuite/frv-elf/:
	* configure: Regenerate.

sim/testsuite/m32r-elf/:
	* configure: Regenerate.

sim/testsuite/mips64el-elf/:
	* configure: Regenerate.

sim/sh/:
	* config.in: Regenerate.
	* configure: Likewise.

gold/:
	* Makefile.in: Regenerate.
	* aclocal.m4: Likewise.
	* config.in: Likewise.
	* configure: Likewise.
	* testsuite/Makefile.in: Likewise.

gprof/:
	* Makefile.in: Regenerate.
	* aclocal.m4: Likewise.
	* configure: Likewise.
	* gconfig.in: Likewise.

opcodes/:
	* Makefile.in: Regenerate.
	* aclocal.m4: Likewise.
	* config.in: Likewise.
	* configure: Likewise.

gas/:
	* Makefile.in: Regenerate.
	* aclocal.m4: Likewise.
	* config.in: Likewise.
	* configure: Likewise.
	* doc/Makefile.in: Likewise.

ld/:
	* Makefile.in: Regenerate.
	* aclocal.m4: Likewise.
	* config.in: Likewise.
	* configure: Likewise.

gdb/:
	* aclocal.m4: Regenerate.
	* config.in: Likewise.
	* configure: Likewise.
	* gnulib/Makefile.in: Likewise.

gdb/doc/:
	* configure: Regenerate.

gdb/gdbserver/:
	* aclocal.m4: Regenerate.
	* config.in: Likewise.
	* configure: Likewise.

gdb/testsuite/:
	* configure: Regenerate.
	* gdb.hp/configure: Likewise.
	* gdb.hp/gdb.aCC/configure: Likewise.
	* gdb.hp/gdb.base-hp/configure: Likewise.
	* gdb.hp/gdb.compat/configure: Likewise.
	* gdb.hp/gdb.defects/configure: Likewise.
	* gdb.hp/gdb.objdbg/configure: Likewise.
	* gdb.stabs/configure: Likewise.

binutils/:
	* Makefile.in: Regenerate.
	* aclocal.m4: Likewise.
	* config.in: Likewise.
	* configure: Likewise.
	* doc/Makefile.in: Likewise.

bfd/:
	* Makefile.in: Regenerate.
	* aclocal.m4: Likewise.
	* config.in: Likewise.
	* configure: Likewise.

bfd/doc/:
	* Makefile.in: Regenerate.

readline/:
	* configure: Regenerate.

readline/examples/rlfe/:
	* configure: Regenerate.
2009-08-22 16:56:56 +00:00
Ralf Wildenhues c462b41bcd Minor fixes in sim, gold, gdb for Autoconf 2.64, Automake 1.11.
gold/:
	* Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
	* testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
	* Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.

gdb/:
	* configure.ac: Use AC_USE_SYSTEM_EXTENSIONS instead of
	AC_GNU_SOURCE, AC_AIX, AC_ISC_POSIX.

sim/common/:
	* aclocal.m4 (SIM_CHECK_MEMBER): Replace definition with
	definition of AC_CHECK_MEMBER.
2009-08-22 15:59:24 +00:00
Cary Coutant 2da73f13b5 * resolve.cc (Symbol_table::resolve): Don't complain about defined
symbols in shared libraries overridden by hidden or internal symbols
	in the main program.
2009-08-19 17:53:50 +00:00
Chris Demetriou 2db7050185 2009-08-19 Chris Demetriou <cgd@google.com>
* testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
        checking source file names in error messages.
2009-08-19 17:41:44 +00:00
Doug Kwan f733487b04 2009-08-18 Doug Kwan <dougkwan@google.com>
* dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
	an elcpp::Ehdr as parameter.  Adjust call to set_target.
	* dynobj.h (Sized_dynobj::setup): Take a Target object instead of
	an elfcpp::Ehdr as parameter.
	* object.cc (Object::set_target): Remove the version that looks up
	a target and sets it.
	(Sized_relobj::setup): Take a Target object instead of
	an elfcpp::Ehdr as parameter.  Adjust call to set_target.
	(make_elf_sized_object): Find target and ask target to
	make an ELF object.
	* object.h: (Object::set_target): Remove the version that looks up
	a target and sets it.
	(Sized_relobj::setup): Take a Target object instead of
	an elfcpp:Ehdr as parameter.
	* target.cc: Include dynobj.h.
	(Target::do_make_elf_object_implementation): New.
 	(Target::do_make_elf_object): New.
	* target.h (Target::make_elf_object): New template declaration.
	(Target::do_make_elf_object): New method declarations.
	(Target::do_make_elf_object_implementation): New template declaration.
2009-08-18 23:49:29 +00:00
Ian Lance Taylor cc70f101e2 * gold.h (FUNCTION_NAME): Define.
(gold_unreachable): Use FUNCTION_NAME.
2009-08-14 09:35:38 +00:00
Sriraman Tallam ef5e0cb158 2009-08-12 Sriraman Tallam <tmsriram@google.com>
* icf.cc (Icf::find_identical_sections): Issue a warning when a
	symbol in the --keep-unique list is not found.
2009-08-13 00:03:43 +00:00
Sriraman Tallam 48c187ced8 Sriraman Tallam <tmsriram@google.com>
* icf.cc (Icf::find_identical_sections): Unfold symbols that have
	been maked as --keep-unique.
	(Icf::unfold_section): New function.
	* icf.h (Icf::unfold_section): New function.
	* options.h (General_options::keep_unique): New option.
	* testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/icf_keep_unique_test.sh: New file.
	* testsuite/icf_keep_unique_test.cc: New file.
2009-08-12 19:03:16 +00:00
Cary Coutant 645afe0c5b PR 10471
* resolve.cc (Symbol_table::resolve): Check for references from
	dynamic objects to hidden and internal symbols.
	* testsuite/Makefile.am (hidden_test.sh): New test.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/hidden_test.sh: New script.
	* testsuite/hidden_test_1.c: New test source.
	* testsuite/hidden_test_main.c: New test source.
2009-08-12 18:30:39 +00:00
Doug Kwan 11af873fca 2009-08-11 Doug Kwan <dougkwan@google.com>
* arm.cc: Update comments.
	(Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
	segment to locate the .ARM.exidx section if present.
2009-08-11 17:09:14 +00:00
Doug Kwan b9f7d72d24 Revert the previous change.
http://sourceware.org/ml/binutils-cvs/2009-08/msg00043.html
2009-08-10 02:29:30 +00:00
Sriraman Tallam ddd3c53c3d *** empty log message *** 2009-08-07 18:48:44 +00:00
Sriraman Tallam 2772106215 *** empty log message *** 2009-08-07 18:29:54 +00:00
Sriraman Tallam ef15dade89 *** empty log message *** 2009-08-05 20:51:56 +00:00
Chris Demetriou c3b65ac4d0 2009-07-24 Chris Demetriou <cgd@google.com>
* layout.cc (is_compressible_debug_section): Fix incorrect
        comment about compressed section names.
2009-07-24 23:13:51 +00:00
Ian Lance Taylor 1caf2c519a PR 10419
* x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
2009-07-21 05:22:54 +00:00
Ian Lance Taylor 1ef4d87fe8 PR 10400
* layout.h: #include <map>.
	(class Kept_section): Change from struct to class.  Add accessors
	and setters.  Add section size to Comdat_group mapping.  Change
	Comdat_group to std::map.  Add is_comdat_ field.  Add
	linkonce_size field in union.
	(class Layout): Update declaration of find_or_add_kept_section.
	Don't declare find_kept_object.
	* layout.cc (Layout::find_or_add_kept_section): Remove candidate
	parameter.  Add object, shndx, is_comdat, and is_group_name
	parameters.  Change all callers.  Adjust for new Kept_section.
	(Layout::find_kept_object): Remove.
	* object.cc (Sized_relobj::include_section_group): Update use of
	Kept_section.  Rename secnum to shndx.  Only record
	Kept_comdat_section if sections are the same size.
	(Sized_relobj::include_linkonce_section): Update use of
	Kept_section.  Only record Kept_comdat_section if sections are the
	same size.  Set size of linkonce section.
	(Sized_relobj::map_to_kept_section): Update call to
	get_kept_comdat_section.
	* object.h (class Sized_relobj): Rename fields in
	Kept_comdat_section to drop trailing underscores; change object
	field to Relobj*.  Change Kept_comdat_section_table to store
	struct rather than pointer.
	(Sized_relobj::set_kept_comdat_section): Remove kept parameter.
	Add kept_object and kept_shndx parameters.  Change all callers.
	(Sized_relobj::get_kept_comdat_section): Change return type to
	bool.  Add kept_object and kept_shndx parameters.  Change all
	callers.
	* plugin.cc (Pluginobj::include_comdat_group): Update call to
	Layout::find_or_add_kept_section.
2009-07-17 01:07:33 +00:00
Ian Lance Taylor 37c3b7b014 * merge.cc (Object_merge_map::initialize_input_to_output_map):
Reserve space in the hash table.
2009-07-09 23:29:55 +00:00
Ian Lance Taylor 98fa85cb42 * fileread.cc (File_read::get_mtime): New method.
* fileread.h (Timespec): New structure.
	(File_read::get_mtime): New method.
	* incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
	Renamed from timestamp_nsec.
	(Incremental_inputs_entry_write::timestamp_sec): Fix argument to
	Elf_Xword.
	(Incremental_inputs_entry_write::timestamp_usec): Renamed from
	timestamp_nsec.
	(Incremental_inputs::report_archive): Save mtime; style fix.
	(Incremental_inputs::report_obejct): Save mtime; style fix.
	(Incremental_inputs::report_script): Save mtime; style fix.
	(Incremental_inputs::finalize_inputs): Style fix.
	(Incremental_inputs::finalize): Style fix.
	(Incremental_inputs::create_input_section_data): Store inputs
	mtime.
	* incremental.h (Incremental_inputs::report_script): Add mtime
	argument.
	(Incremental_inputs::Input_info::Input_info): Intialize only one
	union member.
	(Incremental_inputs::Input_info::archive): Move to nameless
	union.
	(Incremental_inputs::Input_info::obejct): Move to nameless union.
	(Incremental_inputs::Input_info::script): Move to nameless union.
	(Incremental_inputs::mtime): New field.
	* script.cc (read_input_script): Pass file mtime to
	Incremental_input.
	* script.h (Script_info::inputs): Style fix.
2009-07-06 23:11:21 +00:00
Ian Lance Taylor c9d707578e * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
instead of 32.
2009-07-01 16:21:36 +00:00
Ian Lance Taylor 9c547ec3ac PR 10156
* layout.cc (Layout::choose_output_section): If we find an
	existing section, update the flags.
	(Layout::create_notes): New function, broken out of
	Layout::finalize.
	(Layout::finalize): Don't create note sections.
	(Layout::create_note): Don't crash if linker script discards
	section.
	(Layout::create_gold_note): Likewise.
	(Layout::create_build_id): Likewise.  Don't set
	after_input_sections on the section.
	(Layout::create_executable_stack_info): Remove target parameter.
	Change caller.
	* layout.h (class Layout): Declare create_notes.  Update
	declaration of create_executable_stack_info.
	* gold.cc (queue_middle_tasks): Call create_notes.
	* output.cc (Output_section::update_flags_for_input_section): Move
	here from output.h.  If SHF_ALLOC flag is newly set, mark address
	invalid.
	* output.h (Output_data::mark_address_invalid): New function.
	(class Output_section): Only declare, not define,
	update_flags_for_input_section.  Remove set_flags.
2009-06-24 19:48:51 +00:00
Ian Lance Taylor 554585003d * script-sections.cc (Output_section_definition::
set_section_addresses): Rename shadowing local load_address to
	laddr.
2009-06-24 19:00:15 +00:00
Ian Lance Taylor 1307d6cd4a PR 10244
* reloc.cc (relocate_sections): Skip empty relocation sections.
2009-06-24 14:36:14 +00:00
Ian Lance Taylor ec3f783efd PR 10156
* layout.cc (Layout::create_note): Use choose_output_section
	rather than make_output_section.
2009-06-24 05:09:11 +00:00
Ian Lance Taylor 459c9f1c5f PR 10237
* options.cc (General_options::parse_V): Set printed_version_.
	(General_options::General_options): Initialize printed_version_.
	* options.h (class General_options): Add printed_version_ field.
	* gold.cc (queue_initial_tasks): If there are no input files,
	don't give a fatal error if we printed the version information.
	(queue_middle_tasks): If using -r with a shared object, give a
	fatal error rather than an ordinary error.
2009-06-24 05:01:17 +00:00
Ian Lance Taylor 1518dc8f89 PR 10219
* layout.cc (Layout::Layout): Initialize have_stabstr_section_.
	(Layout::make_output_section): Set have_stabstr_section_ if we see
	a .stab*str section.
	(Layout::finalize): Call link_stabs_sections.
	(Layout::link_stabs_sections): New file.
	* layout.h (class Layout): Add have_stabstr_section_ field.
	Declare link_stabs_sections.
2009-06-24 00:38:00 +00:00
Doug Kwan 3d857b98f5 2009-06-23 Doug Kwan <dougkwan@google.com>
* Makefile.am (libgold_a_LIBADD): New.
	(ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
 	* Makefile.in: Regenerate.
	* config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
	* configure: Regenerate.
	* configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
	* fileread.cc: Include sys/state.h
	* gold.h: Declare memmem and strndup if found missing.
	* gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
2009-06-23 18:10:42 +00:00
Ian Lance Taylor 0639a6f662 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
* configure: Rebuild.
2009-06-23 14:37:24 +00:00
Ian Lance Taylor 8d63875c54 PR 10147
* object.cc (Object::section_contents): Don't try to get a view if
	the section has length zero.
	(Object::handle_gnu_warning_section): If the section is empty, use
	the name of the section as the warning.
2009-06-23 07:19:35 +00:00
Ian Lance Taylor f7c8a183e8 PR 10133
* stringpool.h (class Stringpool_template): Add optimize_ field.
	(Stringpool_template::set_optimize): New function.
	* stringpool.cc (Stringpool_template::Stringpool_template):
	Initialize optimize_ field.
	(Stringpool_template::set_string_offsets): Test local optimize
	fild rather than parameter.
	* layout.cc (Layout::Layout): Call set_optimize on the section
	name stringpool.
2009-06-23 07:04:10 +00:00
Ian Lance Taylor e6a307bae3 PR 10030
* yyscript.y: Parse TARGET.
	* script.cc (script_set_target): New function.
	* script-c.h (script_set_target): Declare.
	* options.cc (General_options::string_to_object_format): Rename
	from string_to_object_format in anonymous namespace.  Change
	callers.
	* options.h (class General_options): Declare
	string_to_object_format.
2009-06-23 06:39:47 +00:00
Ian Lance Taylor 3ee173de46 * script-sections.cc (Script_sections::create_segments): Don't put
program headers in a PT_LOAD segment if -n or -N.
2009-06-23 06:07:50 +00:00
Ian Lance Taylor e1c74d6051 PR 10141
* options.h (class General_options): Add -z lazy and -z now.  Sort
	-z options into alphabetical order.
	* layout.cc (Layout::finish_dynamic_section): Handle -z now.
2009-06-22 20:23:21 +00:00
Ian Lance Taylor cd6739a176 Fix ChangeLog e-mail address. 2009-06-22 06:52:11 +00:00
Ian Lance Taylor 8a5e3e08a6 * layout.cc (Layout::make_output_section): Call
Target::new_output_section.
	(Layout::attach_allocated_section_to_segment): Put large section
	sections in a separate load segment with the large segment flag
	set.
	(Layout::segment_precedes): Sort large data segments after other
	load segments.
	(align_file_offset): New static function.
	(Layout::set_segment_offsets): Use align_file_offset.
	* output.h (class Output_section): Add is_small_section_ and
	is_large_section_ fields.
	(Output_section::is_small_section): New function.
	(Output_section::set_is_small_section):  New function.
	(Output_section::is_large_section): New function.
	(Output_section::set_is_large_section): New function.
	(Output_section::is_large_data_section): New function.
	(class Output_segment): Add is_large_data_segment_ field.
	(Output_segment::is_large_data_segment): New function.
	(Output_segment::set_is_large_data_segment): New function.
	* output.cc (Output_section::Output_section): Initialize new
	fields.
	(Output_segment::Output_segment): Likewise.
	(Output_segment::add_output_section): Add assertion that large
	data sections always go in large data segments.  Force small data
	sections to the end of the list of data sections.  Force small BSS
	sections to the start of the list of BSS sections.  For large BSS
	sections to the end of the list of BSS sections.
	* symtab.h (class Symbol): Declare is_common_shndx.
	(Symbol::is_defined): Check Symbol::is_common_shndx.
	(Symbol::is_common): Likewise.
	(class Symbol_table): Define enum Commons_section_type.  Update
	declarations.  Add small_commons_ and large_commons_ fields.
	* symtab.cc (Symbol::is_common_shndx): New function.
	(Symbol_table::Symbol_table): Initialize new fields.
	(Symbol_table::add_from_object): Put small and large common
	symbols in the right list.
	(Symbol_table::sized_finalized_symbol): Check
	Symbol::is_common_shndx.
	(Symbol_table::sized_write_globals): Likewise.
	* common.cc (Symbol_table::do_allocate_commons): Allocate new
	common symbol lists.  Don't call do_allocate_commons_list if the
	list is empty.
	(Symbol_table::do_allocate_commons_list): Remove is_tls
	parameter.  Add comons_section_type parameter.  Change all
	callers.  Handle small and large common symbols.
	* object.cc (Sized_relobj::do_finalize_local_symbols): Check
	Symbol::is_common_shndx.
	* resolve.cc (symbol_to_bits): Likewise.
	* target.h (Target::small_common_shndx): New function.
	(Target::small_common_section_flags): New function.
	(Target::large_common_shndx): New function.
	(Target::large_common_section_flags): New function.
	(Target::new_output_section): New function.
	(Target::Target_info): Add small_common_shndx, large_common_shndx,
	small_common_section_flags, and large_common_section_flags
	fields.
	(Target::do_new_output_section): New virtual function.
	* arm.cc (Target_arm::arm_info): Initialize new fields.
	* i386.cc (Target_i386::i386_info): Likewise.
	* powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
	Likewise.
	* sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
	* x86_64.cc (Target_x86_64::x86_64_info): Likewise.
	(Target_x86_64::do_new_output_section): New function.
	* configure.ac: Define conditional MCMODEL_MEDIUM.
	* testsuite/Makefile.am (check_PROGRAMS): Add large.
	(large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
	(large_LDFLAGS): Define.
	* testsuite/large.c: New file.
	* testsuite/testfile.cc (Target_test::test_target_info):
	Initialize new fields.
	* configure, testsuite/Makefile.in: Rebuild.
2009-06-22 06:51:53 +00:00
Doug Kwan bb04269c74 2009-06-05 Doug Kwan <dougkwan@google.com>
* Makefile.am (CCFILES): Add target.cc.
	* Makefile.in: Regenerate.
	* i386.cc (class Target_i386): Define new virtual method to
	override do_is_local_label_name in parent.
	* object.cc (Sized_relobj::do_count_local_symbols): Discard
	local symbols if --discard-locals or -X is given.
	* options.h (class General_options): Declare new options
	'--discard-locals' and '-X' for discarding locals.
	* target.h (class Target): Define new methods is_local_label_name.
	Declare new virtual method do_is_local_label_name.
	* target.cc: New file.
	* testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
	(check_SCRIPTS): Add discard_locals_test.sh.
	(check_DATA): Add discard_local_tests.syms.
	(discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
	(discard_local_tests.syms, discard_locals_test.o): New make rules.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/discard_locals_test.c: New file.
	* testsuite/discard_locals_test.sh: Same.
2009-06-05 21:32:57 +00:00
Doug Kwan 805bb01c4b 2009-06-05 Doug Kwan <dougkwan@google.com>
* object.cc (Sized_relobj::Sized_relobj): Initialize
	discarded_eh_frame_shndx_ to -1U.
	(Sized_relobj::do_layout): Record index of a discard .eh_frame
	section.
	(Sized_relobj::do_count_local_symbols): Skip local symbols in
	a discarded .eh_frame section.
	(Sized_relobj::do_finalize_local_symbols): Ditto.
	* object.h (class Sized_relobj): Declare new member
	discarded_eh_frame_shndx_.
	* testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
	(local_labels_test.o, local_labels_test): New rules.
	* testsuite/Makefile.in: Regenerate.
2009-06-05 18:16:31 +00:00
Doug Kwan 1dcd334d34 2009-06-04 Doug Kwan <dougkwan@google.com>
* layout.cc (Layout::section_name_mapping): Add mapping for
	special ARM sections.
2009-06-04 21:14:11 +00:00
Doug Kwan 96d493066d 2009-06-03 Doug Kwan <dougkwan@google.com>
* arm.cc (utils::sign_extend): Reverse test in gold_assert.
	(utils::has_overflow): Same.
2009-06-04 01:31:01 +00:00
Ian Lance Taylor dff1629750 * layout.cc (Layout::section_name_mapping): New array, replacing
Layout::linkonce_mapping.
	(Layout::section_name_mapping_count): New variable, replacing
	Layout::linkonce_mapping_count.
	(Layout::linkonce_output_name): Remove.
	(Layout::output_section_name): Rewrite.
	* layout.h (class Layout): Rename Linkonce_mapping to
	Section_name_mapping, linkonce_mapping to section_name_mapping,
	linkonce_mapping_count to section_name_mapping_count.  Don't
	declare linkonce_output_name.
2009-06-04 00:43:11 +00:00
Doug Kwan c121c67179 2009-06-03 Doug Kwan <dougkwan@google.com>
* gold/arm.cc (namespace utils): New.
	(Target_arm::reloc_is_non_pic): Define new method.
	(class Arm_relocate_functions): New.
	(Target_arm::Relocate::relocate): Handle relocation types used by
	Android.
2009-06-03 19:33:05 +00:00
Ian Lance Taylor 07800fab6e * arm.cc (Target_arm::scan::global): Use || instead of |. 2009-06-03 14:05:07 +00:00
Doug Kwan bec53400ce 2009-06-02 Doug Kwan <dougkwan@google.com>
* gold/arm.cc (Target_arm::Scan::Scan):  Initialize
	issued_non_pic_error_.
	(class Target_arm::Scan): Declare new method check_non_pic.
	Define new method symbol_needs_plt_entry.
	Declare new data member issued_non_pic_error_.
	(class Target_arm::Relocate): Declare new method
	should_apply_static_reloc.
	(Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
	(Target_arm::Scan::check_non_pic): Define new method.
	(Target_arm::Scan::local): Handle a small subset of reloc types used
	by Android.
	(Target_arm::Scan::local): Same.
	(Target_arm::Relocate::should_apply_statci_reloc): Define new method.
2009-06-03 00:06:15 +00:00
Ian Lance Taylor b19b0c6d0f * incremental.cc (Incremental_inputs::report_command_line): Filter
out --incremental-* options.
2009-05-31 23:07:26 +00:00
Doug Kwan 94cdfcffc3 2009-05-29 Doug Kwan <dougkwan@google.com>
* gold/arm.cc (Output_data_plt_arm): Forward declaration for new
	template class.
	(class Target_arm): Update comment.
	(Target_arm::Target_arm): Initialize new data members GOT_,
	PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
	Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
	and Target_arm::rel_dyn_section.
	Declare new_enum Target_arm::Got_type.
	Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
	and DYNBSS_.
	Update commments for member do_dynsym_value.
	(Target_arm::got_size, Target_arm::plt_section,
	Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
	new methods inside class defintion.
	(Target_arm::got_section): Define new method.
	(Target_arm::rel_dyn_section): Same.
	(Output_data_plt_arm): New template class.
	(Output_data_plt_arm::Output_data_plt_arm): Define constructor.
	(Output_data_plt_arm:do_adjust_output_section): Define new method.
	(Output_data_plt_arm::add_entry): Same.
	(Output_data_plt_arm::first_plt_entry): Define new
	static data member for PLT instruction template.
	(Output_data_plt_arm::plt_entry): Same.
	(Output_data_plt_arm::do_write): Define new method.
	(Target_arm::make_plt_entry): Same.
	(Target_arm::do_finalize_sections): Same.
	(Target_arm::do_dynsym_value): Same.
2009-05-30 00:55:42 +00:00
Doug Kwan 4a657b0d92 2009-05-28 Doug Kwan <dougkwan@google.com>
* configure.ac: Support gold for target arm*-*-*.
        * configure: Regenerate.
        * gold/Makefile.am (TARGETSOURCES): Add arm.cc.
        (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
        * gold/Makefile.in: Regenerate.
        * gold/arm.cc: New file.
        * gold/configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
2009-05-29 00:15:12 +00:00
Doug Kwan e7ae8c368d Add missing ChangeLog entry in previous check-in 2009-05-26 23:05:00 +00:00
Doug Kwan 2fdd743f6d 2009-05-26 Doug Kwan <dougkwan@google.com>
* options.cc (General_options::parse_exclude_libs).  Fix a comment.
        (General_options::check_excluded_libs): Strip off directories in
        archive name before matching like GNU ld does.
        * testsuite/Makefile.am (MOSTLYCLEANFILES,
        exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
        (exclude_libs_test_LDFLAGS): Add linker option
        -Wl,--exclude-libs,libexclude_libs_test_3
        (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
        an explicit archive without using -l.
        (alt/libexclude_libs_test_3.a): New make rule.
        * testsuite/Makefile.in: Regenerate.
        * testsuite/exclude_libs_test.c : Declare lib3_default().
        (main): Call it.
        * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
        * exclude_libs_test_3.c: New file.
2009-05-26 22:52:56 +00:00
Nick Clifton f12e7348b2 Update Indonesian translations.
Update translation templates.
2009-05-26 16:49:41 +00:00
Sriraman Tallam 4daadc0d02 * testsuite/Makefile.am: Add -ffunction-sections to compile
gc_comdat_test files.  Add -Wl,--gc-sections to build
	gc_comdat_test.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/gc_comdat_test.sh: Fix the condition around grep.
2009-05-22 20:27:52 +00:00
Sriraman Tallam 531813adfc * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
kept comdat section was garbage collected.
	* testsuite/Makefile.am: Add test gc_comdat_test.sh.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/gc_comdat_test.sh: New file.
	* testsuite/gc_comdat_test_1.cc: New file.
	* testsuite/gc_comdat_test_2.cc: New file.
2009-05-22 18:31:22 +00:00
Cary Coutant 6551490093 2009-05-19 Doug Kwan <dougkwan@google.com>
* archive.cc (Archive::Archive): Move constructor from archive.h
	to here.  Initialize no_export_.
	(Archive::get_elf_object_for_member): Set no_export flag of object.
	* archive.h (Archive::Archive): Move constructor body to
	archive.cc.
	(Archive::no_export): New method.
	(Archive::no_export_): New field.
	* object.h (Object::Object): Initialize no_export_ to false.
	(Object::no_export, Object::set_no_export): New methods.
	(Object::no_export_): New field.
	* options.cc (General_options::parse_exclude_libs): New method.
	(General_options::check_excluded_libs) Same.
	* options.h (exclude_libs): New option.
	(General_options::check_excluded_libs): New method declaration.
	(General_options::excluded_libs_): New field.
	* symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
	default or protected visibility if an object has no-export flag set.
	testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
	(check_SCRIPTS): Add exclude_libs_test.sh.
	(check_DATA): Add exclude_libs_test.syms.
	(MOSTLYCLEANFILES): Add exclude_libs_test.syms,
	libexclude_libs_test_1.a and libexclude_libs_test_2.a.
	(exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
	exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
	(exclude_libs_test.syms, libexclude_libs_test_1.a,
	libexclude_libs_test_2.a): New rules.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/exclude_libs_test.c: New file.
	* testsuite/exclude_libs_test.sh: Ditto.
	* testsuite/exclude_libs_test_1.c: Ditto.
	* testsuite/exclude_libs_test_2.c: Ditto.
2009-05-19 22:14:17 +00:00
Ian Lance Taylor 1b77ea505f * configure.ac: Check for declarations for cases where libiberty.h
checks HAVE_DECL_xxx.
	* configure, config.in: Rebuild.
2009-05-15 18:32:13 +00:00
Ian Lance Taylor 072fe7ce7a * gold.h (Incremental_argument_list): Remove (invalid) forward
declaration.
	* incremental.cc (Incremental_inputs::report_achive): New method.
	(Incremental_inputs::report_object): New method.
	(Incremental_inputs::report_script): New method.
	(Incremental_inputs::finalize_inputs): New method.
	(Incremental_inputs::finalize): Call finalize_inputs().
	(Incremental_inputs::sized_create_incremental_inputs_section_data):
	Create inputs entries.
	* incremental.h (Incremental_input_type): New enum.
	(Incremental_inputs::Incremental_input): Initialize new fields.
	(Incremental_inputs::report_inputs): New method.
	(Incremental_inputs::report_achive): New method.
	(Incremental_inputs::report_object): New method.
	(Incremental_inputs::report_script): New method.
	(Incremental_inputs::finalize_inputs): New method.
	(Incremental_inputs::Input_info): New struct.
	(Incremental_inputs::Input_info_map): New typedef.
	(Incremental_inputs::lock_): New field.
	(Incremental_inputs::Inputs_): New field.
	(Incremental_inputs::Inputs_map): New field.
	* main.cc (main): Call Incremental_input::report_inputs.
	* options.h (Input_argument_list): Typedef moved from
	Input_arguments.
	(Input_file_group::Files): Remove, use ::Input_argument_list.
	(Input_file_group::Input_argument_list): Remove, use
	::Input_argument_list.
	* plugin.cc (Plugin_manager::add_input_file): Add error in
	incremental build.
	* read_syms.cc (do_read_syms): Call Incremental_input::report_*
	functions.
	* script.cc (read_input_script): Call
	Incremental_input::report_script.
	* script.h (Script_info): New class.
2009-05-15 17:01:04 +00:00
Chris Demetriou b22a5a4185 Fix date in revision 1.220. (Was 2008-04-23, should have been 2009-04-23). 2009-04-30 06:02:09 +00:00
Ian Lance Taylor b0481b0b2c * x86_64.cc (do_adjust_output_section): Set entsize to
plt_entry_size.
2009-04-27 16:23:57 +00:00
Chris Demetriou 6d1e3092b4 2008-04-23 Elliott Hughes <enh@google.com>
* output.cc (Output_file::close): After short writes, continue
        writing from the correct offset in the buffer being written.
2009-04-24 19:48:21 +00:00
Chris Demetriou 40fde48809 2009-04-23 Chris Demetriou <cgd@google.com>
* configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
        * configure: Regenerate.
        * config.in: Regenerate.
        * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
        if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
2009-04-24 19:33:42 +00:00
Ian Lance Taylor 3ce2c28e3f * incremental.cc (Incremental_inputs_header_data): Renamed from
Incremental_input_header_data.
	(Incremental_inputs_header_data::data_size): New field.
	(Incremental_inputs_header_data::put_input_file_count): Renamed
	from input_file_count.
	(Incremental_inputs_header_data::put_command_line_offset): Renamed
	from command_line_offset.
	(Incremental_inputs_header_data::put_reserved): Renamed from
	put_reserved.
	(Incremental_inputs_entry_data): Renamed from
	Incremental_input_entry_data.
	(Incremental_inputs_entry_data::data_size): New field.
	(Incremental_inputs::report_command_line): New method.
	(Incremental_inputs::finalize): New method.
	(Incremental_inputs::create_incremental_inputs_data): New method.
	(Incremental_inputs::sized_create_incremental_inputs_data): New method.
	* incremental.h: New file.
	* layout.cc (Layout::Layout): Handle new incremental_inputs_.
       (Layout::finalize): Create incremental inputs section in
	incremental builds.
       (Layout::create_incremental_info_sections): New method.
	* layout.h (Layout::incremental_inputs): New method.
       (Layout::create_incremental_info_sections): New method.
       (Layout::incremental_inputs_): New field.
	* main.cc (main): Notify Incremental_input of the command line.
2009-04-24 15:44:02 +00:00
Ian Lance Taylor e55bde5eb0 * gold.h (reserve_unordered_map): Define, three versions, one for
each version of Unordered_map.
	* layout.cc (Layout::Layout): Remove options parameter.  Add
	number_of_input_files parameter.  Don't initialize options_.
	Initialize number_of_input_files_ and resized_signatures_.  Move
	sections_are_attached_.
	(Layout::layout_group): Reserve space for group_signatures_.
	(Layout::find_or_add_kept_section): Change name parameter to be a
	reference.  Resize signatures_ map when it gets large enough.
	(Layout::layout_eh_frame): Use parameters->options() instead of
	this->options_.
	(Layout::make_output_section): Likewise.
	(Layout::attach_allocated_section_to_segment): Likewise.
	(Layout::finalize, Layout::create_executable_stack): Likewise.
	(Layout::set_segment_offsets, Layout::create_interp): Likewise.
	(Layout::finish_dynamic_section, Layout::write_binary): Likewise.
	* layout.h (class Layout): Update declarations.  Remove options_
	field.  Add number_of_input_files_ and resized_signatures_
	fields.  Move sections_are_attached_ field.
	* main.cc (main): Pass number of input files to Layout
	constructor.  Don't pass options.
2009-04-02 04:19:03 +00:00
Ian Lance Taylor 154b857c95 * ffsll.c (ffsll): Correct implementation. 2009-03-30 23:17:11 +00:00
Ian Lance Taylor fd03461a93 * ffsll.c: New file.
* configure.ac: Call AC_REPLACE_FUNCS on ffsll.
	* gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
	* ftruncate.c (ftruncate): Declare before definition.
	* mremap.c (mremap): Likewise.
	* pread.c (pread): Likewise.
	* configure, Makefile.in, config.in: Rebuild.
2009-03-28 05:22:30 +00:00
Ian Lance Taylor 2f35ab9b82 * mremap.c: New file.
* configure.ac: Call AC_REPLACE_FUNCS on mremap.
	* gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
	(mremap): Declare if HAVE_MREMAP is not defined.
	* configure, Makefile.in, config.in: Rebuild.
2009-03-27 23:21:09 +00:00
Cary Coutant 33aea2fd65 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
position independent.
	* sparc.cc (Target_sparc::check_non_pic): Likewise.
	* x86_64.cc (Target_x86_64::check_non_pic): Likewise.
2009-03-27 18:19:09 +00:00
Cary Coutant 6d4796192d * symtab.h (needs_plt_entry): Check for unsatisfied reference from
an executable.
	(needs_dynamic_reloc): Likewise.
2009-03-25 01:34:25 +00:00
Ian Lance Taylor afc06bb828 * yyscript.y (file_cmd): Recognize EXTERN.
(extern_name_list, extern_name_list_body): New nonterminals.
	* script.cc (script_add_extern): Define.
	* script-c.h (script_add_extern): Declare.
2009-03-24 19:08:37 +00:00
Ian Lance Taylor f6060a4d43 * object.cc (is_elf_object): Define.
* object.h (is_elf_object): Declare.
	* archive.cc (Archive::get_elf_object_for_member): Call
	is_elf_object.
	* readsymc.cc (Read_symbols::do_read_symbols): Likewise.
2009-03-24 18:42:10 +00:00
Ian Lance Taylor 26736d8ec1 * output.cc (Output_file::map_anonymous): Define.
(Output_file::map): Use map_anonymous.  If the regular mmap fails,
	try an anonymous one.  Report the size if the mmap fails.
	* output.h (class Output_file): Declare map_anonymous.
2009-03-24 18:04:26 +00:00
Ian Lance Taylor 22fd9730a0 * target-select.cc (instantiate_target): Don't acquire the lock if
the instantiated_target_ field has already been set.
2009-03-24 17:32:43 +00:00
Ian Lance Taylor 7f055c204a 2009-03-23 Ian Lance Taylor <iant@google.com>
* gold-threads.h (class Initialize_lock): Define.
	* gold-threads.cc (class Initialize_lock_once): Define.
	(initialize_lock_control): New static variable.
	(initialize_lock_pointer): New static variable.
	(initialize_lock_once): New static function.
	(Initialize_lock::Initialize_lock): Define.
	(Initialize_lock::initialize): Define.
	* target-select.h: Include "gold-threads.h".
	(class Target_selector): Add lock_ and initialize_lock_ fields.
	Don't define instantiate_target, just declare it.
	* target-select.cc (Target_selector::Target_selector): Initialize
	new fields.
	(Target_selector::instantiate_target): Define.
	* descriptors.h: Include "gold-threads.h".
	(class Descriptors): Add initialize_lock_ field.
	* descriptors.cc (Descriptors::Descriptors): Initialize new
	field.
	(Descriptors::open): Use initialize_lock_ field
	* errors.h (class Errors): Add initialize_lock_ field.
	* errors.cc (Errors::Errors): Initialize new field.
	(Errors::initialize_lock): Use initialize_lock_ field.
	* powerpc.cc (class Target_selector_powerpc): Remove
	instantiated_target_ field.  In do_recognize call
	instantiate_target rather than do_instantiate_target.  In
	do_instantiate_target just allocate a new target.
	* sparc.cc (class Target_selector_sparc): Likewise.
2009-03-24 04:50:32 +00:00
Ian Lance Taylor 3695968186 2009-03-23 Ian Lance Taylor <iant@google.com>
* freebsd.h: New file.
	* i386.cc: Include "freebsd.h".
	(Target_i386): Derive from Target_freebsd rather than
	Sized_target.
	(Target_selector_i386): Derive from Target_selector_freebsd rather
	than Target_selector.
	* x86_64.cc: Include "freebsd.h".
	(Target_x86_64): Derive from Target_freebsd rather than
	Sized_target.
	(Target_selector_x86_64): Derive from Target_selector_freebsd
	rather than Target_selector.
	* target.h (class Target): Add adjust_elf_header and
	do_adjust_elf_header.
	* output.cc (Output_file_header:: do_sized_write): Call target
	adjust_elf_header routine.
	* configure.tgt: Set targ_osabi.
	* configure.ac: Define GOLD_DEFAULT_OSABI.
	* parameters.cc (Parameters::default_target): Pass
	GOLD_DEFAULT_OSABI to select_target.
	* target-select.h (class Target_selector): Make instantiate_target
	protected rather than private.
	* Makefile.am (HFILES): Add freebsd.h.
	* configure, Makefile.in, config.in: Rebuild.
2009-03-24 00:31:29 +00:00
Ian Lance Taylor cb010894ee * merge.cc (do_add_input_section): Correct pend value. Change
message about last entry not being null terminated from error to
	warning.
2009-03-23 21:15:08 +00:00
Ian Lance Taylor 0e87992779 include/elf:
* common.h (SHT_GNU_INCREMENTAL_INPUTS): Define.
elfcpp:
	* elfcpp.h (SHT_GNU_INCREMENTAL_INPUTS): Define.
gold:
	* incremental.cc: New file.
	* Makefile.am (CCFILES): Add incremental.cc.
	* Makefile.in: Rebuild.
2009-03-20 23:37:51 +00:00
Paul Pluzhnikov 4110593748 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
* layout.cc (Layout::output_section_name): Preserve names
	of '.note.' sections.
2009-03-19 19:39:32 +00:00
Ian Lance Taylor 604399204f * descriptors.cc (Descriptors::open): Check that the options are
valid before using them.
2009-03-19 19:02:53 +00:00
Ian Lance Taylor 0d371ad356 * script-sections.h: Include <list>.
(class Script_sections): Change Sections_elements from std::vector
	to std::list.  Typedef public Elements_iterator.  Add
	orphan_section_placement_, data_segment_align_start_, and
	saw_data_segment_align_ fields.  Remove data_segment_align_index_
	field.
	* script-sections.cc (class Orphan_section_placement): New class.
	(class Sections_element): Add virtual functions is_relro and
	orphan_section_init.  Remove virtual function place_orphan_here.
	(class Output_section_definition): Add is_relro and
	orphan_section_init.  Remove place_orphan_here.
	(class Orphan_output_section): Likewise.
	(Script_sections::Script_sections): Update for field changes.
	(Script_sections::data_segment_align): Set saw_data_segment_align_
	and data_segment_align_start_, not data_segment_align_index.
	(Script_sections::data_segment_relro_end): Check
	saw_data_segment_align_.  Use data_segment_align_start_ rather
	than data_segment_align_index_.
	(Script_sections::place_orphan): Rewrite to use
	Orphan_section_placement.
2009-03-19 05:51:49 +00:00
Ian Lance Taylor 9c5b8369ab * archive.cc (Archive::add_symbols): Check for a version attached
to the symbol name in the archive map.
	* testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
	(ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
	(ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
	(ver_test_11.a): New target.
	* testsuite/Makefile.in: Rebuild.
2009-03-18 05:09:52 +00:00
Ian Lance Taylor 9201d89491 * configure.ac: Check for chsize and posix_fallocate. Replace
ftruncate.
	* ftruncate.c: New file, from gnulib.
	* output.cc (posix_fallocate): Define dummy version if not
	HAVE_POSIX_FALLOCATE.
	(Output_file::map): Call posix_fallocate rather than lseek and
	write.
	* gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
	* configure, Makefile.in, config.in: Rebuild.
2009-03-17 22:25:30 +00:00