aboutsummaryrefslogtreecommitdiff
path: root/gold/fileread.cc
AgeCommit message (Collapse)AuthorFilesLines
2009-01-15 * archive.cc (Archive::get_elf_object_for_member): Remove callCary Coutant1-14/+1
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-09-19Add plugin functionality for link-time optimization (LTO).Cary Coutant1-0/+13
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-16 * fileread.cc (make_view): Add casts to avoid warning.Ian Lance Taylor1-1/+3
2008-09-102008-09-05 Cary Coutant <ccoutant@google.com>Cary Coutant1-0/+8
* fileread.cc (File_read::make_view): Add check for attempt to map beyond end of file.
2008-08-212008-08-20 Craig Silverstein <csilvers@google.com>Craig Silverstein1-2/+2
* fileread.cc (File_read::open): Do not lock the file unless it was successfully opened.
2008-07-25 PR 5990Ian Lance Taylor1-12/+41
* descriptors.cc: New file. * descriptors.h: New file. * gold-threads.h (class Hold_optional_lock): New class. * fileread.cc: Include "descriptors.h". (File_read::~File_read): Release descriptor rather than closing it. (File_read::open) [file]: Call open_descriptor rather than open. Set is_descriptor_opened_. (File_read::open) [memory]: Assert that descriptor is not open. (File_read::reopen_descriptor): New function. (File_read::release): Release descriptor. (File_read::do_read): Make non-const. Reopen descriptor. (File_read::read): Make non-const. (File_read::make_view): Reopen descriptor. (File_read::do_readv): Likewise. * fileread.h (class File_read): Add is_descriptor_opened_ field. Update declarations. * layout.cc: Include "descriptors.h". (Layout::create_build_id): Use open_descriptor rather than open. * output.cc: Include "descriptors.h". (Output_file::open): Use open_descriptor rather than open. * archive.cc (Archive::const_iterator): Change Archive to be non-const. (Archive::begin, Archive::end): Make non-const. (Archive::count_members): Likewise. * archive.h (class Archive): Update declarations. * object.h (Object::read): Make non-const. * Makefile.am (CCFILES): Add descriptors.cc. (HFILES): Add descriptors.h. * Makefile.in: Rebuild.
2008-06-252008-06-25 Cary Coutant <ccoutant@google.com>Cary Coutant1-0/+2
* fileread.cc (File_read::make_view): Assert on zero-length view. * object.cc (Sized_relobj::do_read_symbols): Don't try to read symbol table when there are no symbols to read.
2008-04-02 * fileread.cc (File_read::find_view): Add byteshift and vshiftedIan Lance Taylor1-58/+151
parameters. Update for new key type to views_. Change all callers. (File_read::read): Adjust for byteshift in returned view. (File_read::add_view): New function, broken out of find_and_make_view. (File_read::make_view): New function, broken out of find_and_make_view. (File_read::find_or_make_view): Add offset and aligned parameters. Rewrite accordingly. Change all callers. (File_read::get_view): Add offset and aligned parameters. Adjust for byteshift in return value. (File_read::get_lasting_view): Likewise. * fileread.h (class File_read): Update declarations. (class File_read::View): Add byteshift_ field. Add byteshift to constructor. Add byteshift method. * archive.h (Archive::clear_uncached_views): New function. (Archive::get_view): Add aligned parameter. Change all callers. * object.h (Object::get_view): Add aligned parameter. Change all callers. (Object::get_lasting_view): Likewise. * fileread.cc (File_read::release): Don't call clear_views if there are multiple objects. * fileread.h (File_read::clear_uncached_views): New function. * archive.cc (Add_archive_symbols::run): Call clear_uncached_views on the archive.
2008-03-13Update copyright years. Update language files.Ian Lance Taylor1-1/+1
2008-03-13From Craig Silverstein: Implement --debug=files to track file opens,Ian Lance Taylor1-0/+3
and implement --verbose as a synonym.
2008-03-04From Craig Silverstein: rename some option functions in preparationIan Lance Taylor1-2/+2
for reworking option handling.
2008-02-28From Craig Silverstein: Have Parameters point to General_options.Ian Lance Taylor1-5/+5
2008-02-26From Craig Silverstein: rename option functions for future optionIan Lance Taylor1-2/+2
handling rewrite.
2008-02-13Support selecting target by name.Ian Lance Taylor1-19/+12
2008-02-08Add support for --format binary for input files.Ian Lance Taylor1-2/+49
2008-02-07Implement --just-symbols, including -R FILE. Fix symbol values whenIan Lance Taylor1-2/+13
doing a relocatable link.
2008-01-18Don't include options.h in fileread.h. Remove General_optionsIan Lance Taylor1-0/+14
reference from Output_file class.
2008-01-02Add cast to avoid signed/unsigned warning.Ian Lance Taylor1-2/+5
2008-01-02Reduce the number of system calls. Use readv instead of pread. DoIan Lance Taylor1-25/+187
better handling of cached views.
2007-12-21Correct handling of non-section symbol in merged section. Avoid someIan Lance Taylor1-1/+1
64-bit signed/unsigned warnings.
2007-12-20Fix buglet in last patch.Ian Lance Taylor1-7/+7
2007-12-20Convert more instances of off_t to be 32-bit types.Ian Lance Taylor1-10/+10
2007-12-19Avoid some warnings which showed up in 64-bit mode.Ian Lance Taylor1-1/+1
2007-12-18Add section_size_type and section_offset_type, use them to replace aIan Lance Taylor1-4/+4
lot of instances of off_t.
2007-12-14Rewrite workqueue. This version eliminates the master thread, andIan Lance Taylor1-34/+53
reduces the amount of locking required to find a new thread to run.
2007-12-14Add const to Object::read and Object::sized_target.Ian Lance Taylor1-3/+1
2007-12-14Make some File_read methods const.Ian Lance Taylor1-6/+4
2007-12-10Keep views on views_ list so that they can be found again.Ian Lance Taylor1-13/+19
2007-10-22Implement -Bstatic/-Bdynamic.Ian Lance Taylor1-1/+2
2007-10-14Remove extraneous newlines.Ian Lance Taylor1-3/+3
2007-10-14Run all error handling through an Errors object. Delete output fileIan Lance Taylor1-37/+30
on error.
2007-10-12Add --stats option to print runtime and memory usage statistics.Ian Lance Taylor1-1/+29
2007-10-09Fix soname for library found in search path.Ian Lance Taylor1-3/+9
2007-10-04Full support for --sysroot.Ian Lance Taylor1-3/+4
2007-10-02From Craig Silverstein: add support for searching for input filesIan Lance Taylor1-3/+46
named in linker scripts.
2007-09-25Use mmap to read from input files.Ian Lance Taylor1-4/+33
2007-09-25Add cache parameter to get_view. Discard uncached views on unlock.Ian Lance Taylor1-48/+46
Fix bug this exposed in archive armap symbol name handling.
2007-09-25Rework File_read interface. Get file size. Use pread whenIan Lance Taylor1-69/+56
available.
2007-09-25Remove get_view_and_size.Ian Lance Taylor1-27/+5
2007-09-25Break out default pbytes argument to read and get_view routines,Ian Lance Taylor1-4/+29
adding new routines.
2007-09-22Add licensing text to every source file.Ian Lance Taylor1-0/+20
2006-11-30Added a testsuite. More support for COPY relocations.Ian Lance Taylor1-21/+60
2006-11-29Hash tables, dynamic section, i386 PLT, gold_assert.Ian Lance Taylor1-17/+16
2006-11-06Split Object into Dynobj and Relobj, incorporate elfcpp swapping changes.Ian Lance Taylor1-3/+7
2006-11-03Can now do a full static link of hello, world in C or C++Ian Lance Taylor1-24/+80
2006-09-29Snapshot. Now able to produce a minimal executable which actuallyIan Lance Taylor1-5/+5
runs.
2006-08-04Initial CVS checkin of goldIan Lance Taylor1-0/+281