Commit Graph

95 Commits

Author SHA1 Message Date
Ian Lance Taylor fd9d194f04 PR 6811
* options.h (class Search_directory): Add is_system_directory.
	(class General_options): Declare is_in_system_directory.
	* options.cc (get_relative_sysroot): Make static.
	(get_default_sysroot): Make static.
	(General_optoins::is_in_system_directory): New function.
	* fileread.cc (Input_file::is_in_system_directory): New function.
	* fileread.h (class Input_file): Declare is_in_system_directory.
	* object.h (class Object): Add is_in_system_directory.
	(class Input_objects): Remove system_library_directory_ field.
	* object.cc (Input_objects::add_object): Don't set
	system_library_directory_.
	(input_objects::found_in_system_library_directory): Remove.
	* symtab.cc (Symbol_table::write_globals): Remove input_objects
	parameter.  Change all callers.
	(Symbol_table::sized_write_globals): Likewise.
	(Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
	Call Object::is_in_system_directory.
	* symtab.h (class Symbol_table): Update declarations.
2009-02-28 04:39:57 +00:00
Ian Lance Taylor 266d0a7434 * options.h (enum Incremental_disposition): Define.
(class General_options): Add new options: --incremental,
	--incremental_changed, --incremental_unchanged,
	--incremental_unknown.  Add incremental_disposition_ and
	implicit_incremental_ fields.
	(General_options::incremental_disposition): New function.
	(class Position_dependent_options): Add incremental_disposition
	option.
	(Position_dependent_options::copy_from_options): Set incremental
	dispositions.
	* options.cc (General_options::parse_incremental_changed): New
	function.
        (General_options::parse_incremental_unchanged): New function.
        (General_options::parse_incremental_unknown): New function.
        (General_options::General_options): Initialize new fields
	incremental_disposition_ and implicit_incremental_.
        (General_options::finalize): Check for uasge of --incremental-*
	without --incremental.
2009-02-06 23:49:43 +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
Christopher Faylor 3b2935444f * options.h (General_options::gc_sections): Define as a no-op for now.
(General_options::no_keep_memory): Ditto.
(General_options::Bshareable): Define.
* options.cc (General_options::finalize): Honor -Bshareable.
2009-01-23 17:05:16 +00:00
Ian Lance Taylor ee769c8852 * options.h (class General_options): Add --no case for
--export-dynamic.
2008-12-18 01:53:38 +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
Cary Coutant fd06b4aa51 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
Handle --strip-lto-sections option.
	* options.h (strip_lto_sections): New option.
2008-12-05 21:13:35 +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
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
Alexandre Oliva 183fd0e3ed * options.h (General_options::output_is_executable): New.
(General_options::output_is_pie): New.
* i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
for shared libraries.
* x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
2008-09-16 04:23:29 +00:00
Chris Demetriou 7be8330a59 2008-09-11 Chris Demetriou <cgd@google.com>
* options.h (origin): New -z option.
        * layout.cc (Layout:finish_dynamic_section): If "-z origin"
        is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
        in DT_FLAGS_1.
2008-09-12 05:42:29 +00:00
Cary Coutant ac45a351cf 2008-08-06 Cary Coutant <ccoutant@google.com>
* archive.cc (Archive::total_archives, Archive::total_members)
	(Archive::total_members_loaded): New variables.
	(Archive::setup): Add parameter.  Add option to preread
	archive symbols.
	(Archive::read_armap): Add counter.
	(Archive::get_file_and_offset): New function.
	(Archive::get_elf_object_for_member): New function.
	(Archive::read_all_symbols): New function.
	(Archive::read_symbols): New function.
	(Archive::add_symbols): Add counters.
	(Archive::include_all_members): Use armap to find members if it's
	already built.
	(Archive::include_member): Skip reading symbols if already read.
	Factored code into Archive::get_file_and_offset and
	Archive::get_elf_object_for_member.  Changed call to
	Mapfile::report_include_archive_member.
	(Archive::print_stats): New function.
	* archive.h: Declare Object and Read_symbols_data classes.
	(Archive::Archive): Add initializers for new members.
	(Archive::setup): Add parameter.
	(Archive::print_stats): New function.
	(Archive::total_archives, Archive::total_members)
	(Archive::total_members_loaded): New variables.
	(Archive::get_file_and_offset): New function.
	(Archive::get_elf_object_for_member): New function.
	(Archive::read_all_symbols): New function.
	(Archive::read_symbols): New function.
	(Archive::Archive_member): New class.
	(Archive::members_): New member.
	(Archive::num_members_): New member.
	* main.cc: Include archive.h.
	(main): Call Archive::print_stats.
	* mapfile.cc (Mapfile::report_include_archive_member): Delete
	archive parameter; member_name is now the fully-decorated name.
	* mapfile.h (Mapfile::report_include_archive_member): Likewise.
	* options.h: (General_options): Add --preread-archive-symbols option.
	* readsyms.cc (Read_symbols::do_read_symbols): Change call to
	Archive::setup.
2008-08-07 17:02:11 +00:00
Ian Lance Taylor 3481085102 * options.h (class General_options): Define --check-sections.
* layout.cc (Layout::set_segment_offsets): Handle
	--check-sections.
2008-07-22 23:55:24 +00:00
Ian Lance Taylor af6156ef8d * options.h (class General_options): Define -n/--nmagic and
-N/--omagic.
	* options.cc (General_options::finalize): For -n/--nmagic or
	-N/--omagic, set -static.
	* layout.cc (Layout::attach_allocated_section_to_segment): If
	-N/--omagic, don't put read-only and read-write sections in
	different segments.
	(Layout::find_first_load_seg): If -N/--omagic, don't insist on
	finding a read-only segment.
	(Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
	don't set the minimum segment alignment to the common page size,
	and don't set the file offset to the address modulo the page size.
	* script-sections.cc (Script_sections::create_segments): If
	-n/--omagic, don't put read-only and read-write sections in
	different segments.
2008-07-22 23:01:20 +00:00
Ian Lance Taylor 92de84a60c * cref.cc: New file.
* cref.h: New file.
	* options.h (class General_options): Add --print-symbol-counts.
	* main.cc (main): Issue defined symbol report if requested.
	* archive.cc (Archive::interpret_header): Make into a const member
	function.
	(Archive::add_symbols): Call Input_objects::archive_start and
	archive_stop.
	(Archive::const_iterator): Define new class.
	(Archive::begin, Archive::end): New functions.
	(Archive::include_all_members): Rewrite to use iterator.
	(Archive::count_members): New function.
	* archive.h (class Archive): Update declarations.
	(Archive::filename): New function.
	* object.cc: Include "cref.h".
	(Sized_relobj::Sized_relobj): Initialize defined_count_.
	(Sized_relobj::do_get_global_symbol_counts): New function.
	(Input_objects::add_object): Add object to cross-referencer.
	(Input_objects::archive_start): New function.
	(Input_objects::archive_stop): New function.
	(Input_objects::print_symbol_counts): New function.
	* object.h: Declare Cref and Archive.
	(Object::get_global_symbol_counts): New function.
	(Object::do_get_global_symbol_counts): New pure virtual function.
	(class Sized_relobj): Add defined_count_ field.  Update
	declarations.
	(class Input_objects): Add cref_ field.  Update constructor.
	Update declarations.
	* dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
	defined_count_.
	(Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
	symbol counts.
	(Sized_dynobj::do_get_global_symbol_counts): New function.
	* dynobj.h (class Sized_dynobj): Add fields symbols_ and
	defined_count_.  Update declarations.  Define Symbols typedef.
	* symtab.cc (Symbol_table::add_from_relobj): Add defined
	parameter.  Change all callers.
	(Symbol_table::add_from_dynobj): Add sympointers and defined
	parameters.  Change all callers.
	* symtab.h (class Symbol_table): Update declarations.
	* Makefile.am (CCFILES): Add cref.cc.
	(HFILES): Add cref.h.
	* Makefile.in: Rebuild.
2008-07-22 22:08:43 +00:00
Ian Lance Taylor 62b01cb503 elfcpp/:
* dwarf.h (enum DW_FORM): Define.
gold/:
	* reduced_debug_output.cc: New file.
	* reduced_debug_output.h: New file.
	* options.h (class General_optoins): Add --strip-debug-non-line.
	* options.cc (General_options::finalize): Add strip_debug_non_line
	to the strip heirarchy.
	* layout.h (class Layout): Add debug_abbrev_ and debug_info_
	fields.
	* layout.cc: Include "reduced_debug_output.h".
	(Layout::Layout): Initialize new fields.
	(line_only_debug_sections): New static array.
	(is_lines_only_debug_sections): New static inline function.
	(Layout::include_section): Handle --strip-debug-non-line.
	(Layout::make_output_section): If --strip-debug-non-line, build
	new output sections for .debug_abbrev and .debug_info.
	* dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
	gold.  Warn about possible overflow.
	(read_signed_LEB_128): Likewise.
	* dwarf_reader.h: (read_unsigned_LEB_128): Declare.
	(read_signed_LEB_128): Declare.
	* Makefile.am (CCFILES): Add reduced_debug_output.cc.
	(HFILES): Add reduced_debug_output.h.
	* Makefile.in: Rebuild.
2008-05-28 20:48:16 +00:00
Ian Lance Taylor 7d9e3d9854 * mapfile.cc: New file.
* mapfile.h: New file.
	* options.h (class General_options): Add -M/--print-map and -Map.
	* options.cc (General_options::finalize): Make -M equivalent to
	-Map -.
	* main.cc: Include <cstdio> and "mapfile.h".
	(main): Open mapfile if requested.
	* gold.cc (class Middle_runner): Add mapfile_ field.  Update
	constructor.  Change caller.
	(queue_initial_tasks): Add mapfile parameter.  Change caller.
	(queue_middle_tasks): Likewise.
	* gold.h (queue_initial_tasks, queue_middle_tasks): Update
	declarations.
	* archive.cc: Include "mapfile.h".
	(Archive::add_symbols): Add mapfile parameter.  Change all
	callers.  Pass mapfile, symbol, and reason to include_member.
	(Archive::include_all_members): Add mapfile parameter.  Change all
	callers.
	(Archive::include_member): Add mapfile, sym, and why parameters.
	Change all callers.  Report inclusion to map file.
	* archive.h: Include "fileread.h".
	(class Archive): Update declarations.
	(Archive::file): New const method.
	(class Add_archive_symbols): Add mapfile_ field.  Update
	constructor.  Change all callers.
	* readsyms.h (class Read_symbols): Likewise.
	(class Finish_group): Likewise.
	(class Read_script): Likewise.
	* common.cc: Include "mapfile.h".
	(Symbol_table::allocate_commons): Add mapfile parameter.  Change
	all callers.
	(Symbol_table::do_allocate_commons): Likewise.
	(Symbol_table::do_allocate_commons_list): Likewise.  Report common
	symbol allocation to mapfile.
	* common.h (class Allocate_commons_task): Add mapfile_ field.
	Update constructor.  Change all callers.
	* symtab.h (class Symbol_table): Update declarations.
	* layout.cc: Include "mapfile.h".
	(Layout_task_runner::run): Print information to mapfile.
	(Layout::create_gold_note): Change Output_data_fixed_space to
	Output_data_zero_fill.
	(Layout::create_build_id): Likewise.
	(Layout::print_to_mapfile): New function.
	* layout.h (class Layout_task_runner): Add mapfile_ field.  Update
	constructor.  Change caller.
	(class Layout): Declare print_to_mapfile.
	* output.cc (Output_section::Input_section::print_to_mapfile): New
	function.
	(Output_section::add_input_section): If producing a map, always
	add to input_sections_ list.
	(Output_section::do_print_to_mapfile): New function.
	(Output_segment::print_sections_to_mapfile): New function.
	(Output_segment::print_section_list_to_mapfile): New function.
	* output.h: Include "mapfile.h".
	(Output_data::print_to_mapfile): New function.
	(Output_data::do_print_to_mapfile): New virtual function.
	(Output_segment_headers::do_print_to_mapfile): New function.
	(Output_file_header::do_print_to_mapfile): New function.
	(Output_data_const::do_print_to_mapfile): New function.
	(class Output_data_const_buffer): Add map_name_ field.  Update
	constructor.  Change all callers.  Add do_print_to_mapfile
	function.
	(class Output_data_fixed_space): Likewise.
	(class Output_data_space): Likewise.
	(class Output_data_zero_fill): New class.
	(Output_data_strtab::do_print_to_mapfile): New function.
	(Output_data_reloc_base::do_print_to_mapfile): New function.
	(Output_relocatable_relocs::do_print_to_mapfile): New function.
	(Output_data_group::do_print_to_mapfile): New function.
	(Output_data_got::do_print_to_mapfile): New function.
	(Output_data_dynamic::do_print_to_mapfile): New function.
	(Output_symtab_xindex::do_print_to_mapfile): New function.
	(class Output_section): Declare do_print_to_mapflie.  Declare
	print_to_mapfile in Input_section.
	(class Output_segment): Declare new functions.
	* object.h (Sized_relobj::symbol_count): New function.
	* script-sections.cc
	(Output_section_element_dot_assignment::set_section_addresses):
	Change Output_data_fixed_space to Output_data_zero_fill.
	(Output_data_expression::do_print_to_mapfile): New function.
	* script.cc (read_input_script): Add mapfile parameter.  Change
	all callers.
	* script.h (read_input_script): Update declaration.
	* ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
	(Eh_frame::do_print_to_mapfile): New function.
	* merge.h (Output_merge_data::do_print_to_mapfile): New function.
	(Output_merge_string::do_print_to_mapfile): New function.
	* i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
	function.
	* sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
	function.
	* x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
	function.
	* Makefile.am (CCFILES): Add mapfile.cc.
	(HFILES): Add mapfile.h.
	* Makefile.in: Rebuild.
2008-05-21 21:37:44 +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 f3e9c5c517 PR 6049
* options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
	functions.
	(class General_options): Remove existing --undefined, and add
	--no-undefined instead.  Add new --undefined as synonym for -u.
	* archive.cc (Archive::add_symbols): Check whether symbol was
	named with -u.
	* gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
	* symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
	all uses.  Add IS_UNDEFINED.  Update declarations to split
	different versions of init_base.  Declare init_base_undefined.
	(Symbol::is_defined): Handle IS_UNDEFINED.
	(Symbol::is_undefined): Likewise.
	(Symbol::is_weak_undefined): Call is_undefined.
	(Symbol::is_absolute): Handle IS_CONSTANT.
	(class Sized_symbol): Update declarations to split different
	versions of init.  Declare init_undefined.
	(class Symbol_table): Declare new functions.
	* symtab.cc (Symbol::init_base_object): Rename from init_base.
	Change all callers.
	(Symbol::init_base_output_data): Likewise.
	(Symbol::init_base_output_segment): Likewise.
	(Symbol::init_base_constant): Likewise.
	(Symbol::init_base_undefined): New function.
	(Sized_symbol::init_object): Rename from init.  Change all
	callers.
	(Sized_symbol::init_output_data): Likewise.
	(Sized_symbol::init_output_segment): Likewise.
	(Sized_symbol::init_constant): Likewise.
	(Sized_symbol::init_undefined): New function.
	(Symbol_table::add_undefined_symbols_from_command_line): New
	function.
	(Symbol_table::do_add_undefined_symbols_from_command_line): New
	function.
	(Symbol::final_value_is_known): Handle IS_UNDEFINED.
	(Symbol::output_section): Likewise.
	(Symbol::set_output_section): Likewise.
	(Symbol_table::sized_finalize_symbol): Likewise.
	(Symbol_table::sized_write_globals): Likewise.
	* resolve.cc (Symbol_table::should_override): Likewise.
	(Symbol::override_base_with_special): Likewise.
2008-05-07 06:08:01 +00:00
Ian Lance Taylor 2b706932ee * options.h (DEFINE_var): Add set_user_set_##varname__.
(DEFINE_bool_alias): New macro.
	(class General_options): Define -Bstatic using DEFINE_bool_alias
	rather than DEFINE_special.  Add --undefined as an alias for -z
	defs.
	* options.cc (General_options::parse_Bstatic): Remove.
2008-05-06 20:40:33 +00:00
Ian Lance Taylor d82a5bcc85 * options.h (class General_options): Add --fatal-warnings.
* main.cc (main): Implement --fatal-warnings.
	* errors.h (Errors::warning_count): New function.
2008-05-06 18:32:38 +00:00
Ian Lance Taylor f1f70eae28 * options.h (class General_options): Add -Bsymbolic-functions.
* symtab.h (Symbol::is_preemptible): Check for
	-Bsymbolic-functions.
2008-05-06 17:46:31 +00:00
Ian Lance Taylor d98bc257cf 2008-05-05 Ian Lance Taylor <iant@google.com>
* options.h (DEFINE_bool): For DASH_Z, create the negative option
	as noVARNAME rather than no-VARNAME.
	(class General_options): Add option -z combreloc.
	* output.h (class Output_reloc) [SHT_REL]: Declare compare and
	get_address.
	(Output_reloc::sort_before) [SHT_REL]: New function.
	(Output_reloc::sort_before) [SHT_RELA]: New function.
	(class Output_data_reloc_base): Add sort_relocs_ field.  Define
	Sort_relocs_comparison.
	(Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
	parameter.  Change all callers.
	(Output_data_reloc::Output_data_reloc) [both versions]: Add
	sort_relocs parameter.  Change all callers.
	* output.cc (Output_reloc::get_address): New function, broken out
	of write_rel.
	(Output_reloc::write_rel): Call it.
	(Output_reloc::compare): New function.
	(Output_data_reloc_base::do_write): Optionally sort relocs.
2008-05-06 05:03:15 +00:00
Cary Coutant c5818ff112 * errors.cc (Errors::info): New function.
(gold_info): New function.
	* errors.h (Errors::info): New function.
	* gold.h (gold_info): New function.
	* object.cc (Input_objects::add_object): Print trace output.
	* options.cc (options::parse_set): New function.
	(General_options::parse_wrap): Deleted.
	(General_options::General_options): Deleted initializer.
	* options.h (options::String_set): New typedef.
	(options::parse_set): New function.
	(DEFINE_set): New macro.
	(General_options::wrap): Changed to use DEFINE_set. Changed
	callers of any_wrap_symbols and is_wrap_symbol.
	(General_options::trace, General_options::trace_symbol):
	New options.
	(General_options::any_wrap_symbols, General_options::is_wrap_symbol)
	(General_options::wrap_symbols_): Deleted.
	* symtab.cc (Symbol_table::add_from_object): Print trace output.
2008-04-17 22:45:47 +00:00
David S. Miller b5be4a7c8c * options.cc (General_options::parse_V): New function.
* options.h: Add entries for -V and -Qy.
2008-04-17 20:23:59 +00:00
David S. Miller 7c41443585 elfcpp/
* elfcpp.h (DF_1_NOW, DF_1_GLOBAL, DF_1_GROUP,
	DF_1_NODELETE, DF_1_LOADFLTR, DF_1_INITFIRST,
	DF_1_NOOPEN, DF_1_ORIGIN, DF_1_DIRECT, DF_1_TRANS,
	DF_1_INTERPOSE, DF_1_NODEFLIB, DF_1_NODUMP,
	DF_1_CONLFAT): New enum constants.

gold/

	* options.h (DEFINE_enable): New macro.
	(new_dtags): New enable option.
	(initfirst, interpose, loadfltr, nodefaultlib,
	nodelete, nodlopen, nodump): New -z options.
	* layout.cc (Layout:finish_dynamic_section): If new
	dtags enabled, emit DT_RUNPATH.  Also, emit a
	DT_FLAGS_1 containing any specified -z flags.
2008-04-16 23:21:01 +00:00
Ian Lance Taylor 706e1f5e80 * options.h (General_options): Add entries for '-Y' and
'-relax'.
	* options.cc (General_options:finalize): If -Y was used, add those
	entries to the library path instead of the default "/lib" and
	"/usr/lib".
2008-04-11 20:28:34 +00:00
Ian Lance Taylor cdb0b8f565 * options.h (class General_options): Add --noinhibit-exec option.
* main.cc (main): Check --noinhibit-exec.
2008-04-09 01:19:09 +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 8ed814a99c * options.h (class General_options): Define build_id option.
* layout.h (class Layout): Declare write_build_id, create_note,
	create_build_id.  Add build_id_note_ member.
	* layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
	"libiberty.h", "md5.h", "sha1.h".
	(Layout::Layout): Initialize eh_frame_data_,
	eh_frame_hdr_section_, and build_id_note_.
	(Layout::finalize): Call create_build_id.
	(Layout::create_note): New function, broken out of
	Layout::create_gold_note.
	(Layout::create_gold_note): Call create_note.
	(Layout::create_build_id): New function.
	(Layout::write_build_id): New function.
	(Close_task_runner::run): Call write_build_id.
2008-03-25 05:11:41 +00:00
Ian Lance Taylor 086a18414a * options.cc: Include "demangle.h".
(parse_optional_string): New function.
	(parse_long_option): Handle takes_optional_argument.
	(parse_short_option): Update dash_z initializer.  Handle
	takes_optional_argument.
	(General_options::General_options): Initialize do_demangle_.
	(General_options::finalize): Set do_demangle_.  Handle demangling
	style.
	* options.h (parse_optional_string): Declare.
	(struct One_option): Add optional_arg field.  Update constructor.
	Update call constructor calls.  Add takes_optional_argument
	function.
	(DEFINE_var): Add optional_arg__ parameter.  Change all callers.
	(DEFINE_optional_string): Define.
	(General_options::demangle): Change from DEFINE_bool to
	DEFINE_optional_string.
	(General_options::no_demangle): New function.
	(General_options::do_demangle): New function.
	(General_options::set_do_demangle): New function.
	(General_options::execstack_status_): Move definition to end of
	class definition.
	(General_options::static_): Likewise.
	(General_options::do_demangle_): New field.
	* object.cc (big_endian>::get_symbol_location_info): Call
	Options::do_demangle, not Options::demangle.
	* symtab.cc (demangle): Likewise.
2008-03-24 03:48:29 +00:00
Ian Lance Taylor cbb93e6310 * gold.h: Include <cstddef> and <sys/types.h>
* options.h: Include <cstring>.
2008-03-22 18:51:35 +00:00
Ian Lance Taylor eb42429a93 From Craig Silverstein: implement -z defs. 2008-03-20 05:22:37 +00:00
Ian Lance Taylor 2285a61069 From Craig Silverstein: Implement --debug=files to track file opens,
and implement --verbose as a synonym.
2008-03-13 01:46:17 +00:00
Ian Lance Taylor fee2edb1e4 From Craig Silverstein: sort options into alphabetical order. 2008-03-07 18:50:04 +00:00
Ian Lance Taylor c18476e7f1 Recognize --hash-bucket-empty-fraction. 2008-03-07 07:00:48 +00:00
Ian Lance Taylor a4d4b13f68 Use N_ for option help strings, and call gettext when printing them. 2008-03-06 05:51:42 +00:00
Ian Lance Taylor 09ffbbe0d4 From Craig Silverstein: accept any string for input format, warn if
thread options when not supported.
2008-03-06 00:53:37 +00:00
Ian Lance Taylor 13670ee669 Support --hash-style=gnu. 2008-03-06 00:15:04 +00:00
Ian Lance Taylor ee1fe73e11 From Craig Silverstein: rework option handling to make it easier to
add a new option.
2008-03-04 23:10:38 +00:00
Ian Lance Taylor 7cc619c3b1 From Craig Silverstein: rename some option functions in preparation
for reworking option handling.
2008-03-04 18:21:43 +00:00
Ian Lance Taylor 0dfbdef4c4 Support -d/--define-common. 2008-02-28 20:35:39 +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 7019cd2565 Implement -q/--emit-relocs. 2008-02-27 22:38:18 +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 cd72c29180 From Craig Silverstein: implement -z max-page-size and -z
common-page-size.
2008-02-26 22:10:32 +00:00
Ian Lance Taylor 45aa233bdc From Craig Silverstein: rename option functions for future option
handling rewrite.
2008-02-26 21:45:30 +00:00
Ian Lance Taylor 756ac4a80d Implement -Tdata and -Tbss. 2008-02-13 22:47:28 +00:00
Ian Lance Taylor 0daa6f62c8 Support selecting target by name. 2008-02-13 02:44:50 +00:00
Ian Lance Taylor bc644c6cfc Add support for --format binary for input files. 2008-02-08 07:06:58 +00:00