aboutsummaryrefslogtreecommitdiff
path: root/gold/plugin.h
AgeCommit message (Collapse)AuthorFilesLines
2010-03-222010-03-22 Rafael Espindola <espindola@google.com>Rafael Ávila de Espíndola1-0/+4
* archive.cc (Should_include): Move to archive.h. (should_include_member): Make it a member of Archive. (Lib_group): New. (Add_lib_group_symbols): New. * archive.h: Include options.h. (Archive_member): Moved from Archive. (Should_include): Moved from archive.cc. (Lib_group): New. (Add_lib_group_symbols): New. * dynobj.cc (do_should_include_member): New. * dynobj.h (do_should_include_member): New. * gold.cc (queue_initial_tasks): Update call to queue. * main.cc (main): Print lib group stats. * object.cc (do_should_include_member): New. * object.h: Include archive.h. (Object::should_include_member): New. (Object::do_should_include_member): New. (Sized_relobj::do_should_include_member): New. * options.cc (General_options::parse_start_lib): New. (General_options::parse_end_lib): New. (Input_arguments::add_file): Handle lib groups. (Input_arguments::start_group): Check we are not in a lib. (Input_arguments::start_lib): New. (Input_arguments::end_lib): New. * options.h (General_options): Add start_lib and end_lib. (Input_argument::lib_): New. (Input_argument::lib): New. (Input_argument::is_lib): New. (Input_file_lib): New. (Input_arguments::in_lib_): New. (Input_arguments::in_lib): New. (Input_arguments::start_lib): New. (Input_arguments::end_lib_): New. * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols in unused members as preempted. (Sized_pluginobj::do_should_include_member): New. * plugin.h (Sized_pluginobj::do_should_include_member): New. * readsyms.cc (Read_symbols::locks): If we are just reading a member, return the blocker. (Read_symbols::do_whole_lib_group): New. (Read_symbols::do_lib_group): New. (Read_symbols::do_read_symbols): Handle lib groups. (Read_symbols::get_name): Handle lib groups. * readsyms.h (Read_symbols): Add an archive member pointer. (Read_symbols::do_whole_lib_group): New. (Read_symbols::do_lib_group): New. (Read_symbols::member_): New. * script.cc (read_input_script): Update call to queue_soon.
2010-01-05 PR 10980Ian Lance Taylor1-1/+5
* options.h (class General_options): Add --cref. * main.cc (main): Print cref table if --cref. Don't close mapfile until after printing cref table. * cref.cc: Include "symtab.h". (class Cref_inputs): Define Cref_table_compare and Cref_table. (Cref_table_compare::operator()): New function. (Cref_inputs::gather_cref): New function. (filecol): New static const. (Cref_inputs::print_cref): New function. (Cref::print_cref): New function. * cref.h: Include <cstdio>. (class Cref): Update declarations. * mapfile.h (Mapfile::file): New function. * object.h (class Object): Define Symbols. Declare virtual do_get_global_symbols. (Object::get_global_symbols): New function. * object.cc (Input_objects::add_object): Pass object to cref_ if --cref. (Input_objects::archive_start): Likewise. (Input_objects::archive_stop): Likewise. (Input_objects::print_cref): New function. * dynobj.h (Sized_dynobj::do_get_global_symbols): New function. * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if --cref. * plugin.cc (Sized_pluginobj::do_get_global_symbols): New function. * plugin.h (class Sized_pluginobj): Update declarations.
2009-10-28 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.Cary Coutant1-5/+5
(Plugin::cleanup_done_): New member. (Plugin_manager::Plugin_manager): Remove cleanup_done_. (Plugin_manager::cleanup_done_): Remove. (Plugin_manager::add_input_file): Edit error message. * plugin.cc (Plugin::cleanup): Test and set cleanup_done_. (Plugin_manager::cleanup): Remove use of cleanup_done_.
2009-10-06 * plugin.cc (add_input_library): New.Ian Lance Taylor1-1/+1
(Plugin::load): Add add_input_library to tv. (Plugin_manager::add_input_file): Add the is_lib argument. (add_input_file): Update call to Plugin_manager::add_input_file. (add_input_library): New. * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
2009-08-05*** empty log message ***Sriraman Tallam1-0/+4
2009-02-13 (From Rafael Espindola)Cary Coutant1-58/+1
* archive.cc (Archive::include_member): Update calls to add_symbols. * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add the Layout argument. * dynobj.h (do_add_symbols): Add the Layout argument. * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the Layout argument. * object.h (Object::add_symbols): Add the Layout argument. (Object::do_add_symbols): Add the Layout argument. (Sized_relobj::do_add_symbols): Add the Layout argument. * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols): Unify the two versions. (Add_plugin_symbols): Remove. * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove. (Sized_pluginobj::do_add_symbols): Unify the two versions. (Add_plugin_symbols): Remove. * readsyms.cc (Read_symbols::do_read_symbols): Update call to Add_symbols. Use Add_symbols instead of Add_plugin_symbols. (Add_symbols::run): Make it work with Pulginobj.
2009-01-15 * archive.cc (Archive::get_elf_object_for_member): Remove callCary Coutant1-8/+38
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.
2008-12-24 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.Cary Coutant1-5/+12
* plugin.cc (Plugin_manager::finish): Rename as layout_deferred_objects. Move cleanup to separate function. (Plugin_manager::cleanup): New function. (Plugin_finish::run): Call layout_deferred_objects and cleanup separately. * plugin.h (Plugin_manager::finish): Rename as layout_deferred_objects. (Plugin_manager::cleanup): New function. (Plugin_manager::cleanup_done): New field.
2008-12-23 * object.cc (Sized_relobj::layout_section): New function.Cary Coutant1-7/+21
(Sized_relobj::do_layout): Defer layout of input sections until after plugin has provided replacement files. (Sized_relobj::do_layout_deferred_sections): New function. * object.h (Relobj::set_section_offset): Remove virtual keyword. (Relobj::layout_deferred_sections): New function. (Relobj::do_layout_deferred_sections): New function. (Sized_relobj::do_layout_deferred_sections): New function. (Sized_relobj::layout_section): New function. (Sized_relobj::Deferred_layout): New structure. (Sized_relobj::deferred_layout_): New field. * plugin.cc (Plugin_manager::finish): Renamed, was cleanup. Change all callers. Layout deferred sections. (class Plugin_finish): Renamed, was Plugin_cleanup. Change all references. (Plugin_hook::run): Move code from do_plugin_hook inline. (Plugin_hook::do_plugin_hook): Remove. * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers. (Plugin_manager::finish): Renamed, was cleanup. (Plugin_manager::should_defer_layout): New function. (Plugin_manager::add_deferred_layout_object): New function. (Plugin_manager::Deferred_layout_list): New type. (Plugin_manager::deferred_layout_objects_): New field. (Plugin_hook::do_plugin_hook): Remove.
2008-12-052008-12-05 Rafael Avila de Espindola <espindola@google.com>Cary Coutant1-5/+23
* 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-09-19Add plugin functionality for link-time optimization (LTO).Cary Coutant1-0/+457
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.