Commit Graph

339 Commits

Author SHA1 Message Date
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 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 15f8229bbf * readsyms.cc (Read_symbols::incompatible_warning): New function.
(Read_symbols::requeue): New function.
	(Read_symbols::do_read_symbols): If make_elf_object fails because
	the target type is not configured, and the file was searched for,
	issue a warning and retry with the next directory.
	(Add_symbols::run): If the file has an incompatible format, and
	it was searched for, requeue the Read_symbols task.  On error,
	release the object.
	* readsyms.h (class Read_symbols): Add dirindex_ field.  Add
	dirindex parameter to constructor.  Change all callers.  Declare
	incompatible_warning and requeue.
	(class Add_symbols): Add dirpath_, dirindex_, mapfile_,
	input_argument_ and input_group_ fields.  Add them to
	constructor.  Change all callers.
	(class Read_script): Add dirindex_ field.  Add it to constructor.
	Change all callers.
	* archive.cc (Archive::setup): Remove input_objects parameter.
	Change all callers.
	(Archive::get_file_and_offset): Likewise.
	(Archive::read_all_symbols): Likewise.
	(Archive::read_symbols): Likewise.
	(Archive::get_elf_object_for_member): Remove input_objects
	parameter.  Add punconfigured parameter.  Change all callers.
	(Archive::add_symbols): Change return type to bool.  Check return
	value of include_member.
	(Archive::include_all_members): Likewise.
	(Archive::include_member): Change return type to bool.  Return
	false if first included object has incompatible target.  Set
	included_member_ field.
	(Add_archive_symbols::run): If add_symbols returns false, requeue
	Read_symbols task.
	* archive.h (class Archive): Add included_member_ field.
	Initialize it in constructor.  Add input_file and searched_for
	methods.  Update declarations.
	(class Add_archive_symbols): Add dirpath_, dirindex_, and
	input_argument_ fields.  Add them to constructor.  Change all
	callers.
	* script.cc: Include "target-select.h".
	(class Parser_closure): Add skip_on_incompatible_target_ and
	found_incompatible_target_ fields.  Add
	skip_on_incompatible_target parameter to constructor.  Change all
	callers.  Add methods skip_on_incompatible_target,
	clear_skip_on_incompatible_target, found_incompatible_target, and
	set_found_incompatible_target.
	(read_input_script): Add dirindex parameter.  Change all callers.
	If parser finds an incompatible target, requeue Read_symbols
	task.
	(script_set_symbol): Clear skip_on_incompatible_target in
	closure.
	(script_add_assertion, script_parse_option): Likewise.
	(script_start_sections, script_add_phdr): Likewise.
	(script_check_output_format): New function.
	* script.h (read_input_script): Update declaration.
	* script-c.h (script_check_output_format): Declare.
	* yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
	(ignore_cmd): Remove OUTPUT_FORMAT.
	* fileread.cc (Input_file::Input_file): Add explicit this.
	(Input_file::will_search_for): New function.
	(Input_file::open): Add pindex parameter.  Change all callers.
	* fileread.h (class Input_file): Add input_file_argument method.
	Declare will_search_for.  Update declarations.
	* object.cc (make_elf_object): Add punconfigured parameter.
	Change all callers.
	* object.h (class Object): Make input_file public.  Add
	searched_for method.
	(make_elf_object): Update declaration.
	* dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
	restart search.
	* dirsearch.h (class Dirsearch): Update declaration.
	* options.h (class General_options): Add --warn-search-mismatch.
	* parameters.cc (Parameters::is_compatible_target): New function.
	* parameters.h (class Parameters): Declare is_compatible_target.
	* workqueue.cc (Workqueue::add_blocker): New function.
	* workqueue.h (class Workqueue): Declare add_blocker.
2009-03-14 05:56:46 +00:00
Ian Lance Taylor 031cdbed18 PR 9918
* target-reloc.h (relocate_section): Pass output_section to
	relocate.
	* i386.cc (Target_i386::should_apply_static_reloc): Add
	output_section parameter.  Change all callers.
	(Target_i386::Relocate::relocate): Add output_section parameter.
	* x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
	* sparc.cc (Target_sparc::Relocate::relocate): Likewise.
	* powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
	* testsuite/two_file_shared.sh: New script.
	* testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
	(check_DATA): Add two_file_shared.dbg.
	(two_file_shared.dbg): New target.
	* testsuite/Makefile.in: Rebuild.
2009-03-04 06:46:27 +00:00
Ian Lance Taylor 0602e05a84 PR 9836
* symtab.cc (Symbol_table::add_from_object): If the visibility is
	hidden or internal, force the symbol to be local.
	* resolve.cc (Symbol::override_visibility): Define.
	(Symbol::override_base): Use override_visibility.
	(Symbol_table::resolve): Likewise.
	(Symbol::override_base_with_special): Likewise.
	(Symbol_table::override_with_special): If the visibility is hidden
	or internal, force the symbol to be local.
	* symtab.h (class Symbol): Add set_visibility and
	override_visibility.
	* testsuite/ver_test_1.sh: New file.
	* testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
	(check_DATA): Add ver_test_1.syms.
	(ver_test_1.syms): New target.
	* testsuite/Makefile.in: Rebuild.
2009-02-27 19:57:46 +00:00
Cary Coutant 401a9a7392 * layout.cc (Layout::choose_output_section): Don't rename sections
when using a linker script that has a SECTIONS clause.
	* Makefile.in: Regenerate.

	* testsuite/Makefile.am (script_test_5.sh): New test case.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/script_test_5.cc: New file.
	* testsuite/script_test_5.sh: New file.
	* testsuite/script_test_5.t: New file.
2009-02-25 19:05:21 +00:00
Chris Demetriou f073bbf7e0 2009-02-06 Chris Demetriou <cgd@google.com>
* gold.h (gold_undefined_symbol): Change to take only a Symbol
	pointer and to report location as the file name associated with
	the symbol.
	(gold_undefined_symbol_at_location): New function to replace the
	old gold_undefined_symbol functionality.
	* target-reloc.h (relocate_section): Update to use
	gold_undefined_symbol_at_location.
	* symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
	Call gold_undefined_symbol function rather than gold_error.
	* errors.h (Errors::undefined_symbol): Take location as a
	string, rather than calculating it from a relocation.
	* errors.cc (Errors::fatal): Print "fatal error:" before the
	formatted message.
	(Errors::error, Errors::error_at_location): Print "error: "
	before the formatted message.
	(Errors::undefined_symbol): Take location as a string, rather
	than calculating it from a relocation.
	(gold_undefined_symbol_at_location): New function akin to
	old gold_undefined_symbol, calculates location from relocation.
	(gold_undefined_symbol): Change to take only a Symbol pointer
	and to report location as the file name associated with the symbol.
	* testsuite/debug_msg.sh: Update for changed error messages.
	* testsuite/undef_symbol.sh: Likewise.
2009-02-06 19:20:10 +00:00
Sriraman Tallam 6d03d481a0 2009-01-20 Sriraman Tallam <tmsriram@google.com>
* Makefile.am (CCFILES): Add gc.cc.
	(HFILES): Add gc.h.
	* Makefile.in: Regenerate.
	* gold.cc (Gc_runner): New class.
	(queue_initial_tasks): Call garbage collection related tasks
	when corresponding options are invoked.
	(queue_middle_gc_tasks): New function.
	(queue_middle_tasks): Reorder tasks to allow relocs to be read and
	processed early before laying out sections during garbage collection.
	* gold.h (queue_middle_gc_tasks): New function.
	(is_prefix_of): Move from "layout.cc".
	* i386.cc (Target_i386::gc_process_relocs): New function.
	* layout.cc (is_prefix_of): Remove. Move to "gold.h"
	* main.cc (main): Create object of class "Garbage_collection".
	* object.cc (Relobj::copy_symbols_data): New function.
	(Relobj::is_section_name_included): New function.
	(Sized_relobj::do_layout): Allow this function to be called twice
	during garbage collection and defer layout of section during the
	first call.
	* object.h (Relobj::get_symbols_data): New function.
	(Relobj::is_section_name_included): New function.
	(Relobj::copy_symbols_data): New function.
	(Relobj::set_symbols_data): New function.
	(Relobj::get_relocs_data): New function.
	(Relobj::set_relocs_data): New function.
	(Relobj::is_output_section_offset_invalid): New pure virtual function.
	(Relobj::gc_process_relocs): New function.
	(Relobj::do_gc_process_relocs): New pure virtual function.
	(Relobj::sd_): New data member.
	(Sized_relobj::is_output_section_offset_invalid): New function.
	(Sized_relobj::do_gc_process_relocs): New function.
	* options.h (General_options::gc_sections): Modify to not be a no-op.
	(General_options::print_gc_sections): New option.
	* plugin.cc (Plugin_finish::run): Remove function call to
	Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
	* powerpc.cc (Target_powerpc::gc_process_relocs): New function.
	* reloc.cc (Read_relocs::run): Add task to process relocs and
	determine unreferenced sections when doing garbage collection.
	(Gc_process_relocs): New class.
	(Sized_relobj::do_gc_process_relocs): New function.
	(Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
	sections that are garbage collected.
	* reloc.h (Gc_process_relocs): New class.
	* sparc.cc (Target_sparc::gc_process_relocs): New function.
	* symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
	symbols whose corresponding sections are garbage collected.
	(Symbol_table::Symbol_table): Add new parameter for the garbage
	collection object.
	(Symbol_table::gc_mark_undef_symbols): New function.
	(Symbol_table::gc_mark_symbol_for_shlib): New function.
	(Symbol_table::gc_mark_dyn_syms): New function.
	(Symbol_table::resolve): Do not treat symbols seen in dynamic objects
	as garbage.
	(Symbol_table::add_from_object): Likewise.
	(Symbol_table::add_from_relobj): When building shared objects, do not
	treat externally visible symbols as garbage.
	(Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
	table information for static and relocatable links.
	* symtab.h (Symbol_table::set_gc): New function.
	(Symbol_table::gc): New function.
	(Symbol_table::gc_mark_undef_symbols): New function.
	(Symbol_table::gc_mark_symbol_for_shlib): New function.
	(Symbol_table::gc_mark_dyn_syms): New function.
	(Symbol_table::gc_): New data member.
	* target.h (Sized_target::gc_process_relocs): New pure virtual
	function.
	* x86_64.cc (Target_x86_64::gc_process_relocs): New function.
	* testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
2009-01-28 02:25:33 +00:00
Cary Coutant 0f7c0701ba * archive.cc (Archive::get_elf_object_for_member): Remove call
to File_read::claim_for_plugin.
	* descriptors.cc (Descriptors::open): Remove reference to
	is_claimed.
	(Descriptors::claim_for_plugin): Remove.
	* descriptors.h (Descriptors::claim_for_plugin): Remove.
	(Descriptors::is_claimed): Remove.
	(claim_descriptor_for_plugin): Remove.
	* fileread.cc (File_read::claim_for_plugin): Remove.
	* fileread.h (File_read::claim_for_plugin): Remove.
	(File_read::descriptor): Reopen descriptor if necessary.
	* plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
	(Plugin_manager::all_symbols_read): Add task parameter. Change
	all callers.
	(Plugin_manager::get_input_file): New function.
	(Plugin_manager::release_input_file): New function.
	(Pluginobj::Pluginobj): Add filesize parameter and initialize
	corresponding data member.
	(Sized_pluginobj::Sized_pluginobj): Add filesize parameter
	and pass to base constructor. Change all callers.
	(get_input_file, release_input_file): New functions.
	(make_sized_plugin_object): Add filesize parameter. Change all callers.
	* plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
	(Plugin_manager::all_symbols_read): Add task parameter.
	(Plugin_manager::get_input_file): New function.
	(Plugin_manager::release_input_file): New function.
	(Plugin_manager::task_): New data member.
	(Pluginobj::Pluginobj): Add filesize parameter.
	(Pluginobj::filename): New function.
	(Pluginobj::descriptor): New function.
	(Pluginobj::filesize): New function.
	(Pluginobj::filesize_): New data member.
	(Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
	* readsyms.cc (Read_symbols::do_read_symbols): Remove call to
	File_read::claim_for_plugin; use Object::unlock to unlock the file.

	* testsuite/Makefile.am (plugin_test_4): New test case for plugins
	with archive libraries.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/plugin_test.c (struct sym_info): New type.
	(get_input_file, release_input_file): New static variables.
	(onload): Capture new transfer vector entries.
	(claim_file_hook): Stop reading at end of file according to filesize.
	Factor out parsing of readelf output into separate function.
	(all_symbols_read_hook): Exercise get_input_file and release_input_file
	APIs and get the source file name from the symbol table.  Convert
	source file name to corresponding object file name.  Print info
	message when adding new input files.
	(parse_readelf_line): New function.
	* testsuite/plugin_test_1.sh: Add checks for new info messages.
	* testsuite/plugin_test_2.sh: Likewise.
	* testsuite/plugin_test_3.sh: Likewise.
	* testsuite/plugin_test_4.sh: New test case.
2009-01-15 01:29:25 +00:00
Cary Coutant d66a9eb3f0 * plugin.cc (is_visible_from_outside): New function.
(Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
	so we don't return "IR only" status for exported symbols or -r links.

	* testsuite/Makefile.am (plugin_test_3): New test case.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/plugin_test_3.sh: New file.
2008-12-23 23:46:55 +00:00
Cary Coutant abc8dcbad2 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
vector.
	(Plugin_manager::claim_file): Create plugin object even if
	plugin did not call the add_symbols callback.
	(Plugin_obj::get_symbol_resolution_info): Guard against plugin
	asking for more symbols than were added.
	* testsuite/Makefile.am (plugin_test_1): Add test case with
	no global symbols.
	(empty.syms): New target.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/plugin_test.c (claim_file_hook): Add new debug
	message. Don't call add_symbols if no globals.
	(all_symbols_read_hook): Don't provide replacement for empty
	claimed file.
2008-12-16 19:19:16 +00:00
Ian Lance Taylor bb6f53d37a * testsuite/initpri1.c: Change all declarations to be full
prototypes by adding void, to avoid compiler warnings.
2008-12-09 16:03:47 +00:00
Cary Coutant 4674ecfcf4 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
* options.cc (General_options::parse_plugin_opt): New.
	(General_options::add_plugin): The argument now is just the filename.
	(General_options::add_plugin_option): New.
	* options.h (plugin_opt): New.
	(add_plugin): Change argument name.
	(add_plugin_option): New.
	* plugin.cc (Plugin::load): Don't parse the plugin option.
	* plugin.h (Plugin::Plugin): Rename argument. Init filename_.
	(Plugin::add_option): New.
	(Plugin::args_): Change type.
	(Plugin::filename_): New.
	(Plugin_manager::add_plugin_option): New.
	* testsuite/Makefile.am (plugin_test_1): Use new syntax.
	* testsuite/Makefile.in: Regenerate.
2008-12-05 21:34:54 +00:00
Craig Silverstein c82fbeee59 * options.cc (General_options::parse_dynamic_list): New function.
* options.h (General_options): New flags dynamic_list,
	dynamic_list_data, dynamic_list_cpp_new, and
	dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
	(General_options::in_dynamic_list): New function.
	* script.cc (Lex::Mode): New enum DYNAMIC_LIST.
	(Lex::can_start_name): Add support for DYNAMIC_LIST mode.
	(Lex::can_continue_name): Likewise.
	(yylex): Likewise.
	(read_script_file): New parameter script_options.
	(read_dynamic_list): New function.
	(Script_options::define_dynamic_list): New function.
	(dynamic_list_keyword_parsecodes): New variable.
	(dynamic_list_keywords): New variable.
	* script.h (Script_options::define_dynamic_list): New function
	prototype.
	(read_dynamic_list): New function prototype.
	* symtab.cc (strprefix): New macro.
	(Symbol::should_add_dynsym_entry): Support dynamic_list,
	dynamic_list_data, dynamic_list_cpp_new, and
	dynamic_list_cpp_typeinfo.
	* yyscript.y (PARSING_DYNAMIC_LIST): New token.
	(dynamic_list_expr): New rule.
	(dynamic_list_nodes): Likewise.
	(dynamic_list_node): Likewise.
	* testsuite/Makefile.am (dynamic_list): New test.
	* testsuite/Makefile.in: Regenerated.
	* testsuite/dynamic_list.t: New file.
	* testsuite/dynamic_list.sh: New file.
2008-11-06 07:23:31 +00:00
Craig Silverstein e0bb29a584 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
* testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
	(t11_last): Likewise.
	* testsuite/ver_test_6.c (main): Likewise.
2008-11-06 00:44:32 +00:00
Cary Coutant fbd8a2572e * archive.cc (Archive::get_file_and_offset): Use filename instead
of name to get library path.
	(Archive::include_member): Unlock external member of a thin archive.

	* testsuite/Makefile.am (TEST_AR): New variable.
	(thin_archive_test_1): New test.
	(thin_archive_test_2): New test.
2008-09-29 21:23:02 +00:00
Cary Coutant 89fc34211b Add plugin functionality for link-time optimization (LTO).
include/:
	* plugin-api.h: New file.

gold/:
	* configure.ac (plugins): Add --enable-plugins option.
	* configure: Regenerate.
	* config.in: Regenerate.
	* Makefile.am (LIBDL): New variable.
	(CCFILES): Add plugin.cc.
	(HFILES): Add plugin.h.
	(ldadd_var): Add LIBDL.
	* Makefile.in: Regenerate.

	* archive.cc: Include "plugin.h".
	(Archive::setup): Don't preread archive symbols when using a plugin.
	(Archive::get_file_and_offset): Add memsize parameter.  Change callers.
	(Archive::get_elf_object_for_member): Call plugin hooks for claiming
	files.
	(Archive::include_member): Add symbols from plugin objects.
	* archive.h (Archive::get_file_and_offset): Add memsize parameter.
	* descriptors.cc (Descriptors::open): Check for file descriptors
	abandoned by plugins.
	(Descriptors::claim_for_plugin): New function.
	* descriptors.h (Descriptors::claim_for_plugin): New function.
	(Open_descriptor::is_claimed): New field.
	(claim_descriptor_for_plugin): New function.
	* fileread.cc (File_read::claim_for_plugin): New function.
	* fileread.h (File_read::claim_for_plugin): New function.
	(File_read::descriptor): New function.
	* gold.cc: Include "plugin.h".
	(queue_initial_tasks): Add task to call plugin hooks for generating
	new object files.
	* main.cc: Include "plugin.h".
	(main): Load plugin libraries.
	* object.h (Pluginobj): Declare.
	(Object::pluginobj): New function.
	(Object::do_pluginobj): New function.
	(Object::set_target): New function.
	* options.cc: Include "plugin.h".
	(General_options::parse_plugin): New function.
	(General_options::General_options): Initialize plugins_ field.
	(General_options::add_plugin): New function.
	* options.h (Plugin_manager): Declare.
	(General_options): Add --plugin option.
	(General_options::has_plugins): New function.
	(General_options::plugins): New function.
	(General_options::add_plugin): New function.
	(General_options::plugins_): New field.
	* plugin.cc: New file.
	* plugin.h: New file.
	* readsyms.cc: Include "plugin.h".
	(Read_symbols::do_read_symbols): Check for archive before checking
	for ELF file.  Call plugin hooks to claim files.
	* resolve.cc (Symbol_table::resolve): Record when symbol is referenced
	from a real object file; force override when processing replacement
	files.
	* symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
	(Symbol::init_base_object): Likewise.
	(Symbol::init_base_output_data): Likewise.
	(Symbol::init_base_output_segment): Likewise.
	(Symbol::init_base_constant): Likewise.
	(Symbol::init_base_undefined): Likewise.
	(Symbol::output_section): Assert that object is not a plugin.
	(Symbol_table::add_from_pluginobj): New function.
	(Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
	undefined.
	(Symbol_table::sized_write_globals): Likewise.
	(Symbol_table::add_from_pluginobj): Instantiate template.
	* symtab.h (Sized_pluginobj): Declare.
	(Symbol::in_real_elf): New function.
	(Symbol::set_in_real_elf): New function.
	(Symbol::in_real_elf_): New field.
	(Symbol_table::add_from_pluginobj): New function.

	* testsuite/Makefile.am (AM_CFLAGS): New variable.
	(LIBDL): New variable.
	(LDADD): Add LIBDL.
	(check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
	(check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
	(check_DATA): Add plugin_test_1.err and plugin_test_2.err.
	(MOSTLYCLEANFILES): Likewise.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/plugin_test.c: New file.
	* testsuite/plugin_test_1.sh: New file.
	* testsuite/plugin_test_2.sh: New file.
2008-09-19 22:54:57 +00:00
Ian Lance Taylor 9c2d0ef98a * target-reloc.h (relocate_section): Check whether a symbol is
defined by the ABI before reporting an undefined symbol error.
	* target.h (Target::is_defined_by_abi): Make parameter const.
	(Target::do_is_defined_by_abi): Likewise.
	* i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
	* powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
	* sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
	* x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
	* testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
	* testsuite/Makefile.in: Rebuild.
2008-09-16 17:23:37 +00:00
Cary Coutant d85c80a353 2008-08-14 Cary Coutant <ccoutant@google.com>
* x86_64.cc (Target_x86_64::Relocate::relocat_tls):
	Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
	* testsuite/tls_test.cc (struct int128): 128-bit struct
	for testing TLS relocs with non-zero addend.
	(v12): New TLS variable.
	(t12): New test.
	(t_last): Add check for v12.
	* testsuite/tls_test.h (t12): New function.
	* testsuite/tls_test_main.cc (thread_routine): Call new test.
2008-08-15 04:57:46 +00:00
Ian Lance Taylor 2d924fd9eb * layout.cc (Layout::attach_allocated_section_to_segment): Don't
set tls_segment_ or relro_segment_.
	(Layout::make_output_segment): Set tls_segment_ and relro_segment_
	when appropriate.
	* output.h (Output_section::clear_is_relro): New function.
	* output.cc (Output_segment::add_output_section): Handle SHF_TLS
	sections specially even when output_data_ is empty.
	(Output_segment::maximum_alignment): When first section is relro,
	only force alignment for PT_LOAD segments.
	* script.cc (script_data_segment_align): New function.
	(script_data_segment_relro_end): New function.
	* script-c.h (script_data_segment_align): Declare.
	(script_data_segment_relro_end): Declare.
	* script-sections.h (class Script_sections): Declare
	data_segment_align and data_segment_relro_end.  Add fields
	segment_align_index_ and saw_relro_end_.
	* script-sections.cc (class Sections_element): Add set_is_relro
	virtual function.  Add new bool* parameter to place_orphan_here.
	Add get_output_section virtual function.
	(class Output_section_definition): Add set_is_relro.  Add new
	bool* parameter to place_orphan_here.  Add get_output_section.
	Add is_relro_ field.
	(Output_section_definition::Output_section_definition): Initialize
	evaluated_address_, evaluated_load_address, evaluated_addralign_,
	and is_relro_ fields.
	(Output_section_definition::place_orphan_here): Add is_relro
	parameter.
	(Output_section_definition::set_section_addresses): Set relro for
	output section.
	(Output_section_definition::alternate_constraint): Likewise.
	(class Orphan_output_section): Add new bool* parameter to
	place_orphan_here.  Add get_output_section.
	(Orphan_output_section::place_orphan_here): Add is_relro
	parameter.
	(Script_sections::Script_sections): Initialize
	data_segment_align_index_ and saw_relro_end_.
	(Script_sections::data_segment_align): New function.
	(Script_sections::data_segment_relro_end): New function.
	(Script_sections::place_orphan): Set or clear is_relro.
	(Script_sections::set_section_addresses): Force alignment of first
	TLS section.
	* yyscript.y (exp): Call script_data_segment_align and
	script_data_segment_relro_end.
	* testsuite/relro_script_test.t: New file.
	* testsuite/relro_test.cc (using_script): Declare.
	(t1, t2): Test using_script.
	* testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
	(relro_script_test_SOURCES): Define.
	(relro_script_test_DEPENDENCIES): Define.
	(relro_script_test_LDFLAGS): Define.
	(relro_script_test_LDADD): Define.
	(relro_script_test.so): New target.
	* testsuite/Makefile.in: Rebuild.
2008-08-13 07:37:46 +00:00
Ian Lance Taylor de4c45bd54 * symtab.h (Symbol::use_plt_offset): New function.
* i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
	* powerpc.cc (Relocate::relocate): Likewise.
	* sparc.cc (Relocate::relocate): Likewise.
	* x86_64.cc (Relocate::relocate): Likewise.
	* testsuite/weak_plt.sh: New test.
	* testsuite/weak_plt_main.cc: New test.
	* testsuite/weak_plt_shared.cc: New test.
	* testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
	(check_PROGRAMS): Add weak_plt.
	(check_DATA): Add weak_plt_shared.so.
	(weak_plt_main_pic.o, weak_plt): New targets.
	(weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
	* testsuite/Makefile.in: Rebuild.

	* testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
	gcctestdir/ld.
	(weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
	* testsuite/Makefile.in: Rebuild.
2008-08-04 22:22:13 +00:00
Ian Lance Taylor 7c07ececf4 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
symbols before other symbols.
	* testsuite/script_test_2.cc (test_addr): Declare.
	(test_addr_alias): Declare.
	(main): Check that test_addr and test_addr_alias have the right
	values.
	* testsuite/script_test_2.t: Define test_addr_alias and
	test_addr.
2008-07-29 22:58:03 +00:00
Ian Lance Taylor 057ead2231 PR 6647
* script.cc (Version_script_info::get_versions): Don't add empty
	version tag to return value.
	(Version_script_info::get_symbol_version_helper): Change return
	type to bool.  Add pversion parameter.  Change all callers.
	(script_register_vers_node): Don't require a non-NULL tag.
	* script.h (class Version_script_info): Update declarations.
	(Version_script_info::get_symbol_version): Change return type to
	bool.  Add version parameter.  Change all callers.
	* symtab.cc (Sized_symbol::add_from_relobj): Rework version
	handling.  Handle an empty version from a version script.
	(Symbol_table::define_special_symbol): Likewise.
	* testsuite/ver_test_10.script: New file.
	* testsuite/ver_test_10.sh: New file.
	* testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
	(check_DATA): Add ver_test_10.syms.
	(ver_test_10.syms, ver_test_10.so): New target.
	* testsuite/Makefile.in: Rebuild.
2008-07-23 23:44:02 +00:00
Ian Lance Taylor 95d14cd31e * symtab.cc (Symbol_table::resolve): Remove version parameter.
Change all callers.
	* symtab.h (class Symbol_table): Update declaration.
	* testsuite/ver_test_9.cc: New file.
	* testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
	(ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
	(ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
	(ver_test_9.so, ver_test_9.o): New targets.
	* testsuite/Makefile.in: Rebuild.
2008-07-23 14:36:09 +00:00
Chris Demetriou 1d1f116d7e 2008-07-20 Chris Demetriou <cgd@google.com>
* configure.ac (gold_cv_c_random_seed): New configured variable.
        (RANDOM_SEED_CFLAGS): New substituted variable.
        * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
        * configure: Rebuild.
        * Makefile.in: Likewise.
        * testsuite/Makefile.in: Likewise.
2008-07-21 05:55:27 +00:00
Ian Lance Taylor a18f591e92 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
where we see NAME/NULL and NAME/VERSION  as separate symbols.
	* testsuite/ver_test_main.cc (main): Call t4.
	(t4, t4_2a): Define.
	* testsuite/ver_test_2.cc (t4_2): Define.
	* testsuite/ver_test_2.script: Put t4_2a in VER2.
	* testsuite/ver_test_4.cc (t4_2a): Define.
	* testsuite/ver_test_4.script: Put t4_2a in VER2.
	* testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
2008-07-18 07:03:27 +00:00
Craig Silverstein afe4762271 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
* script.cc (Lex::can_continue_name): Make '?' allowable in
        version-script names.
        * testsuite/version_script.map: Change glob pattern to use '?'
2008-06-30 20:59:54 +00:00
Ian Lance Taylor f34787f832 * output.h (Output_section::Input_section): Initialize p2align_ to
zero for Output_section_data constructors.
	(Output_section::Input_section::addralign): If not an input
	section, return the alignment of the Output_section_data.
	* testsuite/copy_test.cc: New file.
	* testsuite/copy_test_1.cc: New file.
	* testsuite/copy_test_2.cc: New file.
	* testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
	(copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
	(copy_test_LDFLAGS, copy_test_LDADD): New variables.
	(copy_test_1_pic.o, copy_test_1.so): New targets.
	(copy_test_2_pic.o, copy_test_2.so): New targets.
	* testsuite/Makefile.in: Rebuild.
2008-06-18 04:39:41 +00:00
Ian Lance Taylor 7b3082352f * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
<exception>.
	(throwing, orig_terminate): New static variables.
	(terminate_handler): New static function.
	(t2): Set terminate handler.
2008-06-09 19:12:34 +00:00
Ian Lance Taylor 9f1d377b33 * options.h (class General_options): Add -z relro.
* layout.cc (Layout::Layout): Initialize relro_segment_.
	(Layout::add_output_section_data): Return the output section.
	(Layout::make_output_section): Rcognize relro sections and mark
	them appropriately.
	(Layout::attach_allocated_section_to_segment): Put relro sections
	in a PT_GNU_RELRO segment.
	(Layout::create_initial_dynamic_sections): Mark the .dynamic
	section as relro.
	(Layout::segment_precedes): Sort PT_GNU_RELRO segments after
	PT_TLS segments.
	(Layout::linkonce_mapping): Map d.rel.ro.local to
	.data.rel.ro.local.
	(Layout::output_section_name): Us .data.rel.ro.local for any
	section which begins with that.
	* layout.h (class Layout): Update add_output_section_data
	declaration.  Add relro_segment_ field.
	* output.cc (Output_section::Output_section): Initialize is_relro_
	and is_relro_local_ fields.
	(Output_segment::add_output_section): Group relro sections.
	(Output_segment::is_first_section_relro): New function.
	(Output_segment::maximum_alignment): If there is a relro section,
	align the segment to the common page size.
	(Output_segment::set_section_addresses): Track whether we are
	looking at relro sections.  If the last section is a relro
	section, align to the common page size.
	(Output_segment::set_section_list_addresses): Add in_relro
	parameter.  Change all callers.  Align to the page size when
	moving from relro to non-relro section.
	(Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
	segment.
	* output.h (class Output_section): Add is_relro_ and
	is_relro_local_ fields.
	(Output_section::is_relro): New function.
	(Output_section::set_is_relro): New function.
	(Output_section::is_relro_local): New function.
	(Output_section::set_is_relro_local): New function.
	(class Output_segment): Update declarations.
	* i386.cc (Target_i386::got_section): Mark .got section as relro.
	* sparc.cc (Target_sparc::got_section): Likewise.
	* x86_64.cc (Target_x86_64::got_section): Likewise.
	* testsuite/relro_test_main.cc: New file.
	* testsuite/relro_test.cc: New file.
	* testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
	(relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
	(relro_test_LDFLAGS, relro_test_LDADD): New variables.
	(relro_test.so, relro_test_pic.o): New targets.
	* testsuite/Makefile.in: Rebuild.
2008-05-20 04:00:47 +00:00
Ian Lance Taylor 75517b77b5 * symtab.c (Symbol::init_base_output_data): Add version
parameter.  Change all callers.
	(Symbol::init_base_output_segment): Likewise.
	(Symbol::init_base_constant): Likewise.
	(Symbol::init_base_undefined): Likewise.
	(Sized_symbol::init_output_data): Likewise.
	(Sized_symbol::init_output_segment): Likewise.
	(Sized_symbol::init_constant): Likewise.
	(Sized_symbol::init_undefined): Likewise.
	(Symbol_table::do_define_in_output_data): If the new symbol has a
	version, mark it as the default.
	(Symbol_table::do_define_in_output_segment): Likewise.
	(Symbol_table::do_define_as_constant): Likewise.
	* symtab.h (class Symbol): Update declarations.
	(class Sized_symbol): Likewise.
	* resolve.cc (Symbol::override_version): New function.
	(Symbol::override_base: Call override_version.
	(Symbol::override_base_with_special): Likewise.
	* testsuite/ver_script_8.script: New file.
	* testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
	(ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
	(ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
	(ver_test_8_1.so, ver_test_8_2.so): New targets.
2008-05-08 18:44:33 +00:00
Ian Lance Taylor 8bdcdf2c77 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
symbol, change it to have default visibility.
	* testsuite/protected_1.cc: New file.
	* testsuite/protected_2.cc: New file.
	* testsuite/protected_3.cc: New file.
	* testsuite/protected_main_1.cc: New file.
	* testsuite/protected_main_2.cc: New file.
	* testsuite/protected_main_3.cc: New file.
	* testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
	(protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
	(protected_1_LDFLAGS, protected_1_LDADD): Define.
	(protected_1.so): New target.
	(protected_1_pic.o, protected_2_pic.o): New targets.
	(protected_3_pic.o): New target.
	(check_PROGRAMS): Add protected_2.
	(protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
	(protected_2_LDFLAGS, protected_2_LDADD): Define.
	* testsuite/Makefile.in: Rebuild.
2008-05-06 22:24:26 +00:00
Ian Lance Taylor 8825ac63ef * object.cc (Sized_relobj::include_section_group): Adjust section
indexes read from group data.  Build vector to pass to
	layout_group.
	* layout.cc (Layout::layout_group): Add flags and shndxes
	parameters.  Remove contents parameter.  Change caller.  Update
	explicit instantiations.
	* layout.h (class Layout): Update layout_group declaration.
	* output.cc (Output_data_group::Output_data_group): Add flags and
	input_shndxes parameters.  Remove contents parameter.  Change
	caller.
	(Output_data_group::do_write): Change input_sections_ to
	input_shndxes_.
	* output.h (class Output_data_group): Update constructor
	declaration.  Rename input_sections_ to input_shndxes_.
	* testsuite/many_sections_test.cc: Add template.
2008-05-05 19:16:43 +00:00
Ian Lance Taylor 7bc3e21a1e * testsuite/Makefile.am (many_sections_r_test): New target.
(many_sections_r_test_SOURCES): Remove.
	(many_sections_r_test_DEPENDENCIES): Remove.
	(many_sections_r_test_LDFLAGS): Remove.
	(many_sections_r_test_LDADD): Remove.
2008-04-19 19:43:13 +00:00
Ian Lance Taylor 4c94d6ae7b * testsuite/Makefile.am (many_sections_check.h): Only check one in
every thousand variables.
	* testsuite/Makefile.in: Rebuild.
2008-04-19 19:15:36 +00:00
Ian Lance Taylor d491d34e93 * object.cc (Xindex::initialize_symtab_xindex): New function.
(Xindex::read_symtab_xindex): New function.
	(Xindex::sym_xindex_to_shndx): New function.
	(Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
	available.
	(Sized_relobj::do_initialize_xindex): New function.
	(Sized_relobj::do_read_symbols): Adjust section links.
	(Sized_relobj::symbol_section_and_value): Add is_ordinary
	parameter.  Change all callers.
	(Sized_relobj::include_section_group): Adjust section links and
	symbol section indexes.
	(Sized_relobj::do_layout): Adjust section links.
	(Sized_relobj::do_count_local_symbols): Adjust section links and
	symbol section indexes.
	(Sized_relobj::do_finalize_local_symbols): Distinguish between
	ordinary and special symbols.
	(Sized_relobj::write_local_symbols): Add symtab_xindex and
	dynsym_xindex parameters.  Change all callers.  Adjust section
	links.  Use SHN_XINDEX when needed.
	(Sized_relobj::get_symbol_location_info): Adjust section links.
	Don't get fooled by special symbols.
	* object.h (class Xindex): Define.
	(class Object): Add xindex_ parameter.  Declare virtual functoin
	do_initialize_xindex.
	(Object::adjust_sym_shndx): New function.
	(Object::set_xindex): New protected function.
	(class Symbol_value): Add is_ordinary_shndx_ field.
	(Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
	(Symbol_value::value): Assert ordinary section.
	(Symbol_value::initialize_input_to_output_map): Likewise.
	(Symbol_value::set_input_shndx): Add is_ordinary parameter.
	Change all callers.
	(Symbol_value::input_shndx): Add is_ordinary parameter.  Change
	all callers.
	(class Sized_relobj): Update declarations.
	(Sized_relobj::local_symbol_input_shndx): Add is_ordinary
	parameter.  Change all callers.
	(Sized_relobj::adjust_shndx): New function.
	* dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
	field.
	(Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
	parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
	for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
	(Sized_dynobj::read_dynsym_section): Adjust section links.
	(Sized_dynobj::read_dynamic): Likewise.
	(Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
	section links.
	(Sized_dynobj::do_initialize_xindex): New function.
	* dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
	do_initialize_xindex.
	(Sized_dynobj::adjust_shndx): New function.
	* layout.cc (Layout::Layout): Initialize symtab_xindex_ and
	dynsym_xindex_ fields.
	(Layout::finalize): Add a call to set_section_indexes before
	creating the symtab sections.
	(Layout::set_section_indexes): Don't do anything if the section
	already has a section index.
	(Layout::create_symtab_sections): Add shnum parameter.  Change
	caller.  Create .symtab_shndx section if needed.
	(Layout::create_shdrs): Add shstrtab_section parameter.  Change
	caller.
	(Layout::allocated_output_section_count): New function.
	(Layout::create_dynamic_symtab): Create .dynsym_shndx section if
	needed.
	* layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
	fields.  Update declarations.
	(Layout::symtab_xindex): New function.
	(Layout::dynsym_xindex): New function.
	(class Write_symbols_task): Add layout_ field.
	(Write_symbols_task::Write_symbols_task): Add layout parameter.
	Change caller.
	* output.cc (Output_section_headers::Output_section_headers): Add
	shstrtab_section parameter.  Change all callers.
	(Output_section_headers::do_sized_write): Store overflow values
	for section count and section string table section index in
	section header zero.
	(Output_file_header::do_sized_write): Check for overflow of
	section count and section string table section index.
	(Output_symtab_xindex::do_write): New function.
	(Output_symtab_xindex::endian_do_write): New function.
	* output.h (class Output_section_headers): Add shstrtab_section_.
	Update declarations.
	(class Output_symtab_xindex): Define.
	(Output_section::has_out_shndx): New function.
	* symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
	field.
	(Symbol::init_base): Add st_shndx and is_ordinary parameters.
	Change all callers.
	(Sized_symbol::init): Likewise.
	(Symbol::output_section): Check for ordinary symbol.
	(Symbol_table::add_from_object): Remove orig_sym parameter.  Add
	st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
	callers.
	(Symbol_table::add_from_relobj): Add symndx_offset parameter.
	Change all callers.  Simplify handling of symbols from sections
	not included in the link.
	(Symbol_table::add_from_dynobj): Handle ordinary symbol
	distinction.
	(Weak_alias_sorter::operator()): Assert that symbols are
	ordinary.
	(Symbol_table::sized_finalize_symbol): Handle ordinary symbol
	distinction.
	(Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
	parameters.  Change all callers.
	(Symbol_table::sized_write_globals): Likewise.  Handle ordinary
	symbol distinction.  Use SHN_XINDEX when needed.
	(Symbol_table::write_section_symbol): Add symtab_xindex
	parameter.  Change all callers.
	(Symbol_table::sized_write_section_symbol): Likewise.  Use
	SHN_XINDEX when needed.
	* symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
	declarations.
	(Symbol::shndx): Add is_ordinary parameter.  Change all callers.
	(Symbol::is_defined): Check is_ordinary.
	(Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
	(Symbol::is_absolute, Symbol::is_common): Likewise.
	(class Sized_symbol): Update declarations.
	(class Symbol_table): Update declarations.
	* resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
	parameters.  Change all callers.
	(Sized_symbol::override): Likewise.
	(Symbol_table::override): Likewise.
	(symbol_to_bits): Add is_ordinary parameter.  Change all callers.
	(Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
	is_ordinary, and orig_st_shndx parameters.  Change all callers.
	* copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
	to be in an ordinary section.
	* dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
	object and is_ordinary parameters.  Change all callers.
	(Sized_dwarf_line_info::read_relocs): Add object parameter.
	Change all callers.  Don't add undefined or non-ordinary symbols
	to reloc_map_.
	(Sized_dwarf_line_info::read_line_mappings): Add object parameter.
	Change all callers.
	* dwarf_reader.h (class Sized_dwarf_line_info): Update
	declarations.
	* ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
	* reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
	(Sized_relobj::relocate_sections): Likewise.
	* target-reloc.h (scan_relocs): Adjust section symbol index.
	(scan_relocatable_relocs): Likewise.
	* i386.cc (Scan::local): Check for ordinary symbols.
	* sparc.cc (Scan::local): Likewise.
	* x86_64.cc (Scan::local): Likewise.
	* testsuite/binary_unittest.cc (Sized_binary_test): Update calls
	to symbol_section_and_value.
	* testsuite/many_sections_test.cc: New file.
	* testsuite/Makefile.am (BUILT_SOURCES): Define.
	(check_PROGRAMS): Add many_sections_test.
	(many_sections_test_SOURCES): Define.
	(many_sections_test_DEPENDENCIES): Define.
	(many_sections_test_LDFLAGS): Define.
	(BUILT_SOURCES): Add many_sections_define.h.
	(many_sections_define.h): New target.
	(BUILT_SOURCES): Add many_sections_check.h.
	(many_sections_check.h): New target.
	(check_PROGRAMS): Add many_sections_r_test.
	(many_sections_r_test_SOURCES): Define.
	(many_sections_r_test_DEPENDENCIES): Define.
	(many_sections_r_test_LDFLAGS): Define.
	(many_sections_r_test_LDADD): Define.
	(many_sections_r_test.o): New target.
	* testsuite/Makefile.in: Rebuild.
2008-04-19 18:30:58 +00:00
Ian Lance Taylor 155a0dd763 * common.cc (Symbol_table::allocate_commons): Remove options
parameter.  Change caller.
	(Symbol_table::do_allocate_commons): Remove options parameter.
	Change caller.  Just call do_allocate_commons_list twice.
	(Symbol_table::do_allocate_commons_list): New function, broken out
	of do_allocate_commons.
	* common.h (class Allocate_commons_task): Remove options_ field.
	Update constructor.
	* symtab.cc (Symbol_table::Symbol_table): Initialize
	tls_commons_.
	(Symbol_table::add_from_object): Put TLS common symbols on
	tls_commons_ list.
	(Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
	which are IN_OUTPUT_DATA.
	* symtab.h (class Symbol_table): Add tls_commons_ field.  Update
	allocate_commons and do_allocate_commons declarations.  Declare
	do_allocate_commons_list.
	* gold.cc (queue_middle_tasks): Update creation of
	Allocate_commons_task to not pass options.
	* testsuite/Makefile.am (INCLUDES): Add -I.. .
	(TLS_TEST_C_FLAGS): New variable.
	(tls_test_c_pic.o): New target.
	(tls_test_shared.so): Link in tls_test_c_pic.o.
	(tls_test_c_pic_ie.o): New target.
	(tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
	(tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
	(tls_test_c.o): New target.
	(tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
	(tls_pic_test_LDADD): Likewise.
	(tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
	(tls_shared_gd_to_ie_test_LDADD): Likewise.
	(tls_test_c_gnu2.o): New target.
	(tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
	tls_test_c_gnu2.o.
	(tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
	(tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
	(tls_test_shared_nonpic.so): Link in tls_test_c.o.
	* testsuite/tls_test.cc: Include "config.h".
	(t_last): Call t11_last.
	* testsuite/tls_test.h (t11, t11_last): Declare.
	* testsuite/tls_test_c.c: New file.
	* testsuite/tls_test_main.cc (thread_routine): Call t11.
	* configure.ac: Check for OpenMP support.
	* configure, config.in, Makefile.in: Rebuild.
	* testsuite/Makefile.in: Rebuild.
2008-04-17 07:12:00 +00:00
Cary Coutant f3c69fcab1 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
(Symbol::needs_plt_entry): Allow weak undefined symbols.
	(Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
	building shared libraries.
	* testsuite/Makefile.am (weak_undef_nonpic_test): New target.
	(weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
	(weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
	* testsuite/Makefile.in: Rebuild.
	* testsuite/weak_undef.h: New file.
	* testsuite/weak_undef_file1.cc: Add extra test cases.
	* testsuite/weak_undef_file2.cc: Likewise.
	* testsuite/weak_undef_test.cc: Likewise.
2008-04-17 00:14:36 +00:00
Ian Lance Taylor 4f4995b628 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild. 2008-04-16 18:55:15 +00:00
Ian Lance Taylor 85c7bf8b11 * testsuite/script_test_4.sh: Permit leading zeroes. 2008-04-16 17:43:38 +00:00
Ian Lance Taylor e6188289b9 * script-sections.cc (Script_sections::create_segments): Use
header_size_adjustment even when there is enough room for the
	headers.
	* testsuite/script_test_4.sh: New file.
	* testsuite/script_test_4.t: New file.
	* testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
	(check_DATA): Add script_test_4.stdout.
	(MOSTLYCLEANFILES): Likewise.
	(script_test_4): New target.
	(script_test_4.stdout): New target.
	* testsuite/Makefile.in: Rebuild.
2008-04-15 22:50:37 +00:00
Cary Coutant c2b45e22d5 2008-04-11 Cary Coutant <ccoutant@google.com>
Add support for TLS descriptors for i386 and x86_64.
	* i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
	(Target_i386::Relocate::tls_desc_gd_to_le): New function.
	(Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
	GOT_TYPE_TLS_DESC.
	(Target_i386::got_mod_index_entry): Remove unnecessary code.
	(Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
	R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
	relocations.
	(Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
	Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
	Fix problem with initial-exec relocations.
	(Target_i386::Relocate::relocate_tls): Likewise.
	(Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
	relaxation.
	* output.cc (Output_data_dynamic::Dynamic_entry::write): Add
	support for section-plus-offset dynamic table entries.
	* output.h (Output_data_dynamic::add_section_plus_offset): New function.
	(Output_data_dynamic::Dynamic_entry): Add support for
	section-plus-offset dynamic table entries.
	(Output_data_dynamic::Classification): Likewise.
	(Output_data_dynamic::classification_): Renamed offset_.
	* x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
	(Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
	(Target_x86_64::make_plt_section): New function.
	(Target_x86_64::reserve_tlsdesc_entries): New function.
	(Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
	(Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
	(Output_data_plt_x86_64::has_tlsdesc_entry): New function.
	(Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
	(Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
	(Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
	(Output_data_plt_x86_64::set_final_data_size): Move out of line;
	add extra PLT entry for TLS descriptors.
	(Output_data_plt_x86_64::got_): New field.
	(Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
	(Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
	fields.
	(Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
	descriptors.
	(Target_x86_64::make_plt_entry): Factor out make_plt_section.
	(Target_x86_64::got_mod_index_entry): Remove unnecessary code.
	(Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
	R_386_TLS_DESC_CALL relocations.
	(Target_x86_64::Scan::global): Likewise.
	(Target_x86_64::do_finalize_sections): Add dynamic table entries
	for TLS descriptors.
	(Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
	Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
	(Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
	GD-to-IE relaxation.
	* configure.ac: Export new conditional variables TLS_GNU2_DIALECT
	and TLS_DESCRIPTORS.
	* Makefile.in: Rebuild.
	* configure: Rebuild.
	* testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
	(tls_test_shared2.so): New target.
	(tls_shared_gd_to_ie_test_SOURCES): New variable.
	(tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
	(tls_shared_gd_to_ie_test_LDFLAGS): New variable.
	(tls_shared_gd_to_ie_test_LDADD): New variable.
	(tls_shared_gnu2_gd_to_ie_test): New target.
	(tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
	New targets.
	(tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
	(ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
	(tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
	(tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
	(tls_shared_gnu2_test): New target.
	(tls_test_gnu2_shared.so): New target.
	(tls_shared_gnu2_test_SOURCES): New variable.
	(tls_shared_gnu2_test_DEPENDENCIES): New variable.
	(tls_shared_gnu2_test_LDFLAGS): New variable.
	(tls_shared_gnu2_test_LDADD): New variable.
	* testsuite/Makefile.in: Rebuild.
	* testsuite/Makefile.
2008-04-11 21:24:30 +00:00
Ian Lance Taylor 83bfb6b776 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
justsyms.t.
	* testsuite/Makefile.in: Rebuild.

	* testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
	long.
	* testsuite/script_test_2.cc (main): Adjust test.
2008-04-11 20:44:52 +00:00
David S. Miller 7c98e6bbc9 * testsuite/justsyms.t: Start at 0x100.
* testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
	* script_test_2b.cc (script_test_string_b): Make 8 bytes long.
	* script_test_2.cc: Adjust string and section length checks.
2008-04-11 18:49:40 +00:00
Ian Lance Taylor 2cefc35727 PR gold/5996
* script-sections.cc (Sections_element::allocate_to_segment): Add
	orphan parameter.
	(Output_section_definition::allocate_to_segment): Likewise.
	(Orphan_output_section::allocate_to_segment): Likewise.
	(Script_sections::attach_sections_using_phdrs_clause): Don't
	propagate non-PT_LOAD segments to orphan sections.
	* testsuite/Makefile.am (script_test_3.stdout): Generate using
	readelf rather than objdump.
	* testsuite/script_test_3.sh: Adjust accordingly.  Test that
	.interp section and PT_INTERP segment are the same size.
	* testsuite/Makefile.in: Rebuild.
2008-04-10 01:02:46 +00:00
Ian Lance Taylor 99a37bfda0 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
aliases for symbols defined in the same object.
	* testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
	(weak_alias_test_SOURCES): New variable.
	(weak_alias_test_DEPENDENCIES): New variable.
	(weak_alias_test_LDFLAGS): New variable.
	(weak_alias_test_LDADD): New variable.
	(weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
	(weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
	(weak_alias_test_3.o): New target.
	(weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
	* testsuite/weak_alias_test_main.cc: New file.
	* testsuite/weak_alias_test_1.cc: New file.
	* testsuite/weak_alias_test_2.cc: New file.
	* testsuite/weak_alias_test_3.cc: New file.
2008-04-09 22:45:08 +00:00
Ian Lance Taylor 0864d55193 * options.h (class General_options): Define --wrap as a special
option.  Add wrap_symbols_ field.
	(General_options::any_wrap_symbols): New function.
	(General_options::is_wrap_symbol): New function.
	* options.cc (General_options::parse_wrap): New function.
	(General_options::General_options): Initialize wrap_symbols_.
	* symtab.cc (Symbol_table::wrap_symbol): New function.
	(Symbol_table::add_from_object): Handle --wrap.
	* symtab.h (class Symbol_table): Declare wrap_symbol.
	* target.h (Target::wrap_char): New function.
	(Target::Target_info): Add wrap_char field.
	* i386.cc (Target_i386::i386_info): Initialize wrap_char.
	* x86_64.cc (Target_x86_64::x86_64_info): Likewise.
	* testsuite/testfile.cc (Target_test::test_target_info):
	Likewise.
2008-04-09 00:48:13 +00:00
Ian Lance Taylor 7fcd025698 * configure.ac: Export new conditional variable HAVE_ZLIB.
* testsuite/Makefile.am (flagstest_o_specialfile): Condition
	on HAVE_ZLIB.
	(flagstest_o_specialfile_and_compress_debug_sections): Likewise.
	* configure, Makefile.in, testsuite/Makefile.in: Rebuild.
2008-04-08 14:33:35 +00:00
Ian Lance Taylor 624f881062 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
addend parameter.  Change caller.  Handle merge sections.
	(Output_reloc<SHT_REL>::symbol_value): Change parameter type from
	Address to Addend.  Don't add in the result of
	local_section_offset, pass down the addend and use the returned
	value.
	* output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
	Update declarations of local_section_offset and symbol_value.
	* testsuite/two_file_test_1.cc (t18): New function.
	* testsuite/two_file_test_2.cc (f18): New function.
	* testsuite/two_file_test_main.cc (main): Call t18.
	* testsuite/two_file_test.h (t18, f18): Declare.
2008-04-07 22:46:17 +00:00
Ian Lance Taylor 6835af537e * configure.ac: Don't test for objdump, c++filt, or readelf.
* testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
	conditionals.
	(TEST_READELF): New variable.
	(TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
	(check_PROGRAMS): Add two_file_strip_test.
	(two_file_strip_test): New target.
	(check_PROGRAMS): Add two_file_same_shared_strip_test.
	(two_file_same_shared_strip_test_SOURCES): New variable.
	(two_file_same_shared_strip_test_DEPENDENCIES): New variable.
	(two_file_same_shared_strip_test_LDFLAGS): New variable.
	(two_file_same_shared_strip_test_LDADD): New variable.
	(two_file_shared_strip.so): New target.
	(ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
	(ver_test_5.syms, ver_test_7.syms): Likewise.
	(ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
	(strip_test_3.stdout): Use TEST_OBJDUMP.
	* configure, Makefile.in, testsuite/Makefile.in: Rebuild.
2008-04-07 22:16:03 +00:00
Cary Coutant 86925eef33 2008-04-04 Cary Coutant <ccoutant@google.com>
* symtab.h (Symbol::is_weak_undefined): New function.
	(Symbol::is_strong_undefined): New function.
	(Symbol::is_absolute): New function.
	(Symbol::needs_plt_entry): Exclude weak undefined symbols.
	(Symbol::needs_dynamic_reloc): Exclude weak undefined and
	absolute symbols.
	* testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
	(weak_undef_test): New target.
	* testsuite/Makefile.in: Rebuild.
	* testsuite/weak_undef_file1.cc: New file.
	* testsuite/weak_undef_file2.cc: New file.
	* testsuite/weak_undef_test.cc: New file.
2008-04-04 17:24:47 +00:00
Ian Lance Taylor 126f3ece27 * compressed_output.h (class Output_compressed_section): Use
unsigned buffer.
	* compressed_output.cc (zlib_compress): Use unsigned buffers,
	add zlib header.
	(zlib_compressed_suffix): Removed.
	(Output_compressed_section::set_final_data_size): Use unsigned
	buffers.
	* testsuite/Makefile.am (flagstest_compress_debug_sections):
	Fix linker invocation.
	(flagstest_o_specialfile_and_compress_debug_sections):
	Likewise.
	* testsuite/Makefile.in: Regenerated.
2008-04-03 14:18:37 +00:00
Ian Lance Taylor 686c8caf41 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
version symbol to be local.
	* testsuite/ver_test_4.sh: New file.
	* testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
	(check_DATA): Add ver_test_4.syms.
	(ver_test_4.syms): New target.
	* testsuite/Makefile.in: Rebuild.
2008-03-29 08:39:26 +00:00
Ian Lance Taylor ab794b6bda * output.cc
(Output_section::Input_section_sort_entry::has_priority): New
	function.
	(Output_section::Input_section_sort_entry::match_file_name): New
	function.
	(Output_section::Input_section_sort_entry::match_section_name):
	Remove.
	(Output_section::Input_section_sort_entry::match_section_name_prefix):
	Remove.
	(Output_section::Input_section_sort_entry::match_section_file):
	Remove.
	(Output_section::Input_section_sort_compare::operator()): Rewrite
	using new Input_section_sort_entry functions.  Sort crtbegin and
	crtend first.  Sort sections with no priority before sections with
	a priority.
	* testsuite/initpri1.c (d3): Check j != 4.
	(cd5): New constructor/destructor function.
	(main): Check j != 2.
2008-03-29 08:09:55 +00:00
Ian Lance Taylor 479f65031f * symtab.cc (Symbol_table::add_from_object): If we don't use the
new symbol when resolving, don't call set_is_default.
	* testsuite/ver_test_7.cc: New file.
	* testsuite/ver_test_7.sh: New file.
	* testsuite/Makefile.am (ver_test_7.so): New target.
	(ver_test_7.o): New target.
	(check_SCRIPTS): Add ver_test_7.sh.
	(check_DATA): Add ver_test_7.syms.
	(ver_test_7.syms): New target.
2008-03-29 07:19:02 +00:00
Ian Lance Taylor 2fd322316e * layout.cc (Layout::layout): If we see an input section with a
name that needs sorting, set the must_sort flag for the output
	section.
	(Layout::make_output_section): If the name of the output section
	indicates that it might	require sorting, set the may_sort flag.
	* output.h (Output_section::may_sort_attached_input_sections): New
	function.
	(Output_section::set_may_sort_attached_input_sections): New
	function.
	(Output_section::must_sort_attached_input_sections): New
	function.
	(Output_section::set_must_sort_attached_input_sections): New
	function.
	(class Output_section): Declare Input_section_sort_entry.  Define
	Input_section_sort_compare.  Declare
	sort_attached_input_sections.  Add new fields:
	may_sort_attached_input_sections_,
	must_sort_attached_input_sections_,
	attached_input_sections_are_sorted_.
	* output.cc (Output_section::Output_section): Initialize new
	fields.
	(Output_section::add_input_section): Add an entry to
	input_sections_ if may_sort or must_sort are true.
	(Output_section::set_final_data_size): Call
	sort_attached_input_sections if necessary.
	(Output_section::Input_section_sort_entry): Define new class.
	(Output_section::Input_section_sort_compare::operator()): New
	function.
	(Output_section::sort_attached_input_sections): New function.
	* configure.ac: Check whether the compiler supports constructor
	priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
	* testsuite/initpri1.c: New file.
	* testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
	CONSTRUCTOR_PRIORITY.
	(initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
	(initpri1_LDFLAGS): New variable.
	* configure, Makefile.in, testsuite/Makefile.in: Rebuild.
2008-03-28 22:42:34 +00:00
Ian Lance Taylor 49bdd526ab * common.cc (Sort_commons::operator): Correct sorting algorithm.
* testsuite/common_test_1.c: New file.
	* testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
	(common_test_1_SOURCES): New variable.
	(common_test_1_DEPENDENCIES): New variable.
	(common_test_1_LDFLAGS): New variable.
2008-03-27 19:57:41 +00:00
Ian Lance Taylor 18e6b24e63 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
and commons_ correctly when NAME/VERSION does not override
	NAME/NULL.
	* testsuite/ver_test_6.c: New file.
	* testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
	(ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
	(ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
2008-03-27 18:19:09 +00:00
Ian Lance Taylor 5871526fc2 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
of an undefined symbol from a version script.
	* testsuite/Makefile.am (ver_test_5.so): New target.
	(ver_test_5.o): New target.
	(check_SCRIPTS): Add ver_test_5.sh.
	(check_DATA): Add ver_test_5.syms.
	(ver_test_5.syms): New target.
	* testsuite/ver_test_5.cc: New file.
	* testsuite/ver_test_5.script: New file.
	* testsuite/ver_test_5.sh: New file.
	* Makefile.in, testsuite/Makefile.in: Rebuild.
2008-03-27 06:11:57 +00:00
Ian Lance Taylor 04bf70729d PR gold/5986
Fix problems building gold with gcc 4.3.0.
	* gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
	(gold_error_at_location, gold_warning_at_location): Use it.
	* configure.ac: Check whether we can compile and use a template
	function with a printf attribute.
	* x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
	when jumping over bytes.
	* object.cc: Instantiate Object::read_section_data.
	* debug.h: Include <cstring>
	* dwarf_reader.cc: Include <algorithm>
	* main.cc: Include <cstring>.
	* options.cc: Include <cstring>.
	* output.cc: Include <cstring>.
	* script.cc: Include <cstring>.
	* script.h: Include <string>.
	* symtab.cc: Include <cstring> and <algorithm>.
	* target-select.cc: Include <cstring>.
	* version.cc: Include <string>.
	* testsuite/testmain.cc: Include <cstdlib>.
	* configure, config.in: Rebuild.
2008-03-26 23:36:46 +00:00
Ian Lance Taylor e96caa7910 * options.cc (options::help): Print list of supported targets.
* target-select.h: Include <vector>.
	(class Target_selector): Make machine_, size_, and is_big_endian_
	fields const.  Add bfd_name_ and instantiated_target_ fields.
	(Target_selector::Target_selector): Add bfd_name parameter.
	(Target_selector::recognize): Make non-virtual, call
	do_recognize.
	(Target_selector::recognize_by_name): Make non-virtual, call
	do_recognize_by_name.
	(Target_selector::supported_names): New function.
	(Target_selector::bfd_name): New function.
	(Target_selector::do_instantiate_target): New pure virtual
	function.
	(Target_selector::do_recognize): New virtual function.
	(Target_selector::do_recognize_by_name): New virtual function.
	(Target_selector::instantiate_target): New private function.
	(supported_target_names): Declare.
	* target-select.cc (Target_selector::Target_selector): Update for
	new parameter and fields.
	(select_target_by_name): Check that the name matches before
	calling recognize_by_name.
	(supported_target_names): New function.
	* i386.cc (class Target_selector_i386): Update Target_selector
	constructor call.  Remove recognize and recognize_by_name.  Add
	do_instantiate_target.
	* x86_64.cc (class Target_selector_x86_64): Likewise.
	* testsuite/testfile.cc (class Target_selector_test): Update for
	changes to Target_selector.
2008-03-25 21:39:01 +00:00
Ian Lance Taylor 96a2b4e4bf Make sure the start and size of the TLS segment are aligned. 2008-03-19 21:41:38 +00:00
Ian Lance Taylor d1f003c610 Fix handling of RELA relative relocs against local symbols in merge
sections.
2008-03-16 23:51:19 +00:00
Ian Lance Taylor be3e620119 Don't get confused about whether a symbol is the default version if we
see a later reference to it.  Add tests for this case.
2008-03-14 05:57:19 +00:00
Ian Lance Taylor ebdbb4583d Update copyright years. Update language files. 2008-03-13 21:04:21 +00:00
Ian Lance Taylor 8851eccaec From Craig Silverstein: Have Parameters point to General_options. 2008-02-28 00:18:24 +00:00
Ian Lance Taylor a5dc070655 From Craig Silverstein: rework handling of Script_options. 2008-02-26 22:48:08 +00:00
Ian Lance Taylor 0daa6f62c8 Support selecting target by name. 2008-02-13 02:44:50 +00:00
Ian Lance Taylor 33a3a15316 Force different sections to different pages for better results on
x86_64 Linux.
2008-02-12 00:15:40 +00:00
Ian Lance Taylor 03df6b3280 Fix precedence error, avoid signed/unsignd warning. 2008-02-12 00:13:39 +00:00
Ian Lance Taylor bc644c6cfc Add support for --format binary for input files. 2008-02-08 07:06:58 +00:00
Ian Lance Taylor 88dd47ac00 Implement --just-symbols, including -R FILE. Fix symbol values when
doing a relocatable link.
2008-02-07 01:51:25 +00:00
Ian Lance Taylor 6a74a71947 Initial -r support. 2008-02-06 08:13:50 +00:00
Ian Lance Taylor 1c4f3631bd Implement PHDRS. 2008-02-04 22:54:31 +00:00
Ian Lance Taylor 7cc77b5a09 Fully implement SECTIONS clause. 2008-02-04 05:46:12 +00:00
Ian Lance Taylor a445fddf82 Fully implement the SECTIONS clause. 2008-02-04 05:43:05 +00:00
Ian Lance Taylor 03e8f2b225 From Cary Coutant: Fix a case in which code takes the address of a
function and also calls it directly.
2008-02-01 00:39:10 +00:00
Ian Lance Taylor 55a934330a Originally from Craig Silverstein, with changes: support using a
version script to force symbols to be local.
2008-01-24 00:15:00 +00:00
Ian Lance Taylor 0700cf329e From Cary Coutant: Fix mixing PIC and non-PIC relocs in the same
shared library.
2008-01-23 07:15:59 +00:00
Ian Lance Taylor 494e05f440 Parse a SECTIONS clause in a linker script. 2008-01-23 01:31:13 +00:00
Ian Lance Taylor 106002249a From Craig Silverstein: Handle quoted strings differently in version
scripts, and handle extern "C++" in the middle of a block.
2008-01-18 23:35:09 +00:00
Ian Lance Taylor 091244672e From Andrew Chatham and Craig Silverstein: Add support for version
scripts.
2008-01-15 23:41:28 +00:00
Ian Lance Taylor e5756efb6d Support assignments and expressions in linker scripts. 2008-01-09 19:57:45 +00:00
Ian Lance Taylor 06a9731e8a Correct contributor name on new tests, remove #if 0 code. 2007-12-22 00:50:43 +00:00
Ian Lance Taylor 99f8facac9 From Cary Coutant: Fix handling of versioned symbols, add some tests. 2007-12-21 23:31:19 +00:00
Ian Lance Taylor fe8718a463 Convert more instances of off_t to be 32-bit types. 2007-12-20 21:21:24 +00:00
Ian Lance Taylor 17a1d0a9b2 Rewrite workqueue. This version eliminates the master thread, and
reduces the amount of locking required to find a new thread to run.
2007-12-14 19:00:21 +00:00
Ian Lance Taylor 0e470e5c90 Add some missing dependencies for the new linker. 2007-12-14 05:27:45 +00:00
Ian Lance Taylor c03c769248 From Cary Coutant: Test TLS initial-exec model. 2007-12-11 23:33:11 +00:00
Ian Lance Taylor 351a80002a From Craig Silverstein: Reorganize testsuite Makefile.am. 2007-12-06 17:07:24 +00:00
Ian Lance Taylor 7bf1f8020f From Cary Coutant: More support for generating shared libraries. 2007-12-06 05:55:50 +00:00
Ian Lance Taylor 43771f7638 From Craig Silverstein: Test some flags. 2007-12-05 01:10:16 +00:00
Ian Lance Taylor be00d4e7ff More -fPIC options. 2007-12-01 06:53:32 +00:00
Ian Lance Taylor 763277c3c4 Add missing space. 2007-12-01 06:51:45 +00:00
Ian Lance Taylor c92003e082 Compile shared library code with -fPIC. Also, alphabetize. 2007-12-01 06:50:09 +00:00
Ian Lance Taylor 9a0910c33e From Craig Silverstein: Add support for compressing .debug_str section. 2007-11-30 00:35:27 +00:00
Ian Lance Taylor 79e052eafd From Craig Silverstein: Better handling of ODR violations which are
not in a function.
2007-11-28 18:01:06 +00:00
Ian Lance Taylor dd8670e56c From Craig Silverstein: Quote the symbol name in the ODR violation
message to avoid a gcc collect2 demangling bug.
2007-11-17 02:49:22 +00:00
Ian Lance Taylor 78f156961e From Craig Silverstein: Report output file name with ODR violation
warning message.
2007-11-14 18:44:58 +00:00
Ian Lance Taylor eb01e199fd If generating a .err file fails, remove it. 2007-11-14 18:37:00 +00:00
Ian Lance Taylor 9a2d698415 Add heuristics for undefined symbol warnings. 2007-11-14 16:53:25 +00:00
Ian Lance Taylor 3e6fe5ae73 Comment out undef_symbol.err for now. 2007-11-14 15:24:08 +00:00
Ian Lance Taylor 1ce71f59c7 Default to --allow-shlib-undefined for now. 2007-11-14 09:39:13 +00:00
Ian Lance Taylor e2827e5f52 Warn about undefined references in shared libraries if we have seen
all the DT_NEEDED entries for that library.
2007-11-14 07:34:53 +00:00
Ian Lance Taylor a55ce7febf From Craig Silverstein: Rework debug info code a bit, add option for
ODR violations, add test case.
2007-11-14 01:03:01 +00:00
Ian Lance Taylor 386c048c7a Correct handling of GOT references in a regular object. 2007-11-12 17:51:55 +00:00
Ian Lance Taylor d12348b848 From Craig Silverstein: Clean up make rules for debug_msg. 2007-11-09 23:35:19 +00:00
Ian Lance Taylor f0323c2f68 From Craig Silverstein: Add test for debug messages. 2007-11-09 23:19:11 +00:00
Ian Lance Taylor 730cdc88f7 Generate a complete exception frame header. Discard duplicate
exception frame information.
2007-11-09 07:00:15 +00:00
Ian Lance Taylor fa99aa0984 Use AC_GNU_SOURCE. 2007-10-24 18:11:23 +00:00
Ian Lance Taylor 35cdfc9a87 Add support for PT_GNU_STACK. 2007-10-23 05:05:48 +00:00
Ian Lance Taylor 28ef317915 Add wide string constant test. 2007-10-19 23:38:40 +00:00
Ian Lance Taylor fe9a4c1201 Add infrastructure for threading support. 2007-10-17 06:24:50 +00:00
Ian Lance Taylor a360aedd0f From Craig Silverstein: check that we get environ right. 2007-10-16 23:09:45 +00:00
Ian Lance Taylor 0c5e9c22aa From Craig Silverstein: implement -Ttext. 2007-10-16 22:38:36 +00:00
Ian Lance Taylor 097ec620e1 Only run static TLS tests on glibc 2.4 or later. 2007-10-14 03:57:22 +00:00
Ian Lance Taylor 8261e3bfa5 From Craig Silverstein: TLS test cleanups. 2007-10-14 03:23:38 +00:00
Ian Lance Taylor e03748586c From Craig Silverstein: expand the TLS test to a second file, to test
IE to LE conversion.
2007-10-12 17:32:20 +00:00
Ian Lance Taylor e982104129 Make TLS test fail more reliably. 2007-10-08 07:24:21 +00:00
Ian Lance Taylor f958d5fc53 Test merging of string constants. 2007-10-07 17:20:18 +00:00
Ian Lance Taylor 6eee141ff6 Add a TLS test case. 2007-10-07 17:10:10 +00:00
Ian Lance Taylor ad2d6943a4 Full support for --sysroot. 2007-10-04 05:49:04 +00:00
Ian Lance Taylor 6340166c8b Parameterize object_unittest to work for whatever target types are
supported.
2007-10-03 00:34:49 +00:00
Ian Lance Taylor 63402fe413 From Craig Silverstein: don't run function pointer non-PIC tests when
they won't work.
2007-10-02 22:45:07 +00:00
Ian Lance Taylor 6df6da4a61 Clean up target handling--only build required files, warn about
unsupported targets.
2007-09-30 23:41:32 +00:00
Ian Lance Taylor 3151305a47 Add basic exception frame header, plus test. 2007-09-26 05:44:38 +00:00
Ian Lance Taylor 82dcae9de0 Rework File_read interface. Get file size. Use pread when
available.
2007-09-25 06:43:17 +00:00
Ian Lance Taylor 3bd52c2885 Add two file test. 2007-09-23 05:35:51 +00:00
Ian Lance Taylor cb615bc189 Add static version of constructor test. 2007-09-23 03:25:29 +00:00
Ian Lance Taylor d50266522c Add constructor test. 2007-09-23 03:18:42 +00:00
Ian Lance Taylor d98a37563c Correct comment. 2007-09-22 23:37:35 +00:00
Ian Lance Taylor 56ba9a23db Rename t1 to basic_test, add static tests. 2007-09-22 23:36:01 +00:00
Ian Lance Taylor 22dc1b094d Add standalone test case. 2007-09-22 22:44:33 +00:00
Ian Lance Taylor 6cb15b7f89 Add licensing text to every source file. 2007-09-22 21:02:10 +00:00
Ian Lance Taylor 537b5f51e5 Add bootstrap test. 2007-09-22 20:11:12 +00:00
Ian Lance Taylor be9d5a933e Update for have_code_fill field. 2007-09-21 06:25:35 +00:00
Ian Lance Taylor 5a6f7e2db5 Added a testsuite. More support for COPY relocations. 2006-11-30 23:52:50 +00:00