summaryrefslogtreecommitdiff
path: root/gold/target-select.cc
AgeCommit message (Collapse)Author
2018-01-03Update year range in copyright notice of binutils filesAlan Modra
2017-01-02Update year range in copyright notice of all files.Alan Modra
2016-01-01Copyright update for binutilsAlan Modra
2015-01-02ChangeLog rotatation and copyright year updateAlan Modra
2014-03-05Update copyright yearsAlan Modra
2012-05-02 * configure.ac (ENABLE_GOLD): Consider *-*-nacl* targets ELF.Roland McGrath
* configure: Regenerate. gold/ * nacl.cc: New file. * nacl.h: New file. * Makefile.am (CCFILES, HFILES): Add them. * Makefile.in: Regenerate. * i386.cc (Output_data_plt_i386_nacl): New class. (Output_data_plt_i386_nacl_exec): New class. (Output_data_plt_i386_nacl_dyn): New class. (Target_i386_nacl): New class. (Target_selector_i386_nacl): New class. (target_selector_i386): Use it instead of Target_selector_i386. * x86_64.cc (Output_data_plt_x86_64_nacl): New class. (Target_x86_64_nacl): New class. (Target_selector_x86_64_nacl): New class. (target_selector_x86_64, target_selector_x32): Use it instead of Target_selector_x86_64. * arm.cc (Output_data_plt_arm_nacl): New class. (Target_arm_nacl): New class. (Target_selector_arm_nacl): New class. (target_selector_arm, target_selector_armbe): Use it instead of Target_selector_arm. * target-select.cc (select_target): Take new Input_file* and off_t arguments, pass them on to recognize method of selector. * object.cc (make_elf_sized_object): Update caller. * parameters.cc (parameters_force_valid_target): Likewise. * incremental.cc (make_sized_incremental_binary): Likewise. * target-select.h: Update decl. (Target_selector::recognize): Take new Input_file* argument, pass it on to do_recognize. (Target_selector::do_recognize): Take new Input_file* argument. * freebsd.h (Target_selector_freebsd::do_recognize): Likewise. * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise. * sparc.cc (Target_selector_sparc::do_recognize): Likewise. * testsuite/testfile.cc (Target_selector::do_recognize): Likewise. * target.h (Target::Target_info): New members isolate_execinstr and rosegment_gap. (Target::isolate_execinstr, Target::rosegment_gap): New methods. * arm.cc (Target_arm::arm_info): Update initializer. * i386.cc (Target_i386::i386_info): Likewise. * powerpc.cc (Target_powerpc::powerpc_info): Likewise. * sparc.cc (Target_sparc::sparc_info): Likewise. * x86_64.cc (Target_x86_64::x86_64_info): Likewise. * testsuite/testfile.cc (Target_test::test_target_info): Likewise. * layout.cc (Layout::attach_allocated_section_to_segment): Take new const Target* argument. If target->isolate_execinstr(), act like --rosegment. (Layout::find_first_load_seg): Take new const Target* argument; if target->isolate_execinstr(), reject PF_X segments. (Layout::relaxation_loop_body): Update caller. (Layout::set_segment_offsets): If target->isolate_execinstr(), reset file offset to zero when we hit LOAD_SEG, and then do a second loop over the segments before LOAD_SEG to reassign offsets after addresses have been determined. Handle target->rosegment_gap(). (Layout::attach_section_to_segment): Take new const Target* argument; pass it to attach_allocated_section_to_segment. (Layout::make_output_section): Update caller. (Layout::attach_sections_to_segments): Take new const Target* argument; pass it to attach_section_to_segment. * gold.cc (queue_middle_tasks): Update caller. * layout.h (Layout): Update method decls with new arguments. * arm.cc (Target_arm::Target_arm): Take optional argument for the Target_info pointer to use. (Target_arm::do_make_data_plt): New virtual method. (Target_arm::make_data_plt): New method that calls it. (Target_arm::make_plt_entry): Use it. (Output_data_plt_arm::Output_data_plt_arm): Take additional argument for the section alignment. (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual method. (Output_data_plt_arm::first_plt_entry_offset): Call it. (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual method. (Output_data_plt_arm::get_plt_entry_size): Call it. (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method. (Output_data_plt_arm::fill_plt_entry): New method that calls it. (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual method. (Output_data_plt_arm::fill_first_plt_entry): New method that calls it. (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size method instead of sizeof(plt_entry). (Output_data_plt_arm::add_entry): Likewise. Use first_plt_entry_offset method instead of sizeof(first_plt_entry). (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather than static method. (Target_arm::plt_entry_size): Likewise. (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry): Move to ... (Output_data_plt_arm_standard): ... here, new class. (Output_data_plt_arm::do_write): Move guts of PLT filling to... (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ... (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here. * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64): Take additional argument for the PLT entry size. (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Use get_plt_entry_size method rather than plt_entry_size variable. (Output_data_plt_x86_64::reserve_slot): Likewise. (Output_data_plt_x86_64::do_adjust_output_section): Likewise. (Output_data_plt_x86_64::add_entry): Likewise. (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise. (Output_data_plt_x86_64::address_for_global): Likewise. (Output_data_plt_x86_64::address_for_local): Likewise. (Output_data_plt_x86_64::set_final_data_size): Likewise. (Output_data_plt_x86_64::first_plt_entry_offset): Likewise. Make method non-static. (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual method. (Output_data_plt_x86_64::get_plt_entry_size): Just call that. (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method. (Output_data_plt_x86_64::add_eh_frame): New method to call it. (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract virtual method. (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it. (Output_data_plt_x86_64::do_fill_plt_entry): New abstract virtual method. (Output_data_plt_x86_64::fill_plt_entry): New method to call it. (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract virtual method. (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it. (Output_data_plt_x86_64::plt_entry_size) (Output_data_plt_x86_64::first_plt_entry) (Output_data_plt_x86_64::plt_entry) (Output_data_plt_x86_64::tlsdesc_plt_entry) (Output_data_plt_x86_64::plt_eh_frame_fde_size) (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ... (Output_data_plt_x86_64_standard): ... here, new class. (Target_x86_64::Target_x86_64): Take optional argument for the Target_info pointer to use. (Target_x86_64::do_make_data_plt): New virtual method. (Target_x86_64::make_data_plt): New method to call it. (Target_x86_64::init_got_plt_for_update): Use that. Call this->plt_->add_eh_frame method here. (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here. (Target_x86_64::first_plt_entry_offset): Call method on this->plt_ rather than static method. (Target_x86_64::plt_entry_size): Likewise. (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method rather than plt_entry_size variable. Move guts of PLT filling to... (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ... (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ... (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here. * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take additional argument for the section alignment. Don't do add_eh_frame_for_plt here. (Output_data_plt_i386::first_plt_entry_offset): Make the method non-static. Use get_plt_entry_size method rather than plt_entry_size variable. (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual method. (Output_data_plt_i386::get_plt_entry_size): Call it. (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method. (Output_data_plt_i386::add_eh_frame): New method to call it. (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual method. (Output_data_plt_i386::fill_first_plt_entry): New method to call it. (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual method. (Output_data_plt_i386::fill_plt_entry): New method to call it. (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size method instead of plt_entry_size. (Output_data_plt_i386::plt_entry_size) (Output_data_plt_i386::plt_eh_frame_fde_size) (Output_data_plt_i386::plt_eh_frame_fde): Move to ... (Output_data_plt_i386_standard): ... here, new class. (Output_data_plt_i386_exec): New class. (Output_data_plt_i386::exec_first_plt_entry): Move to ... (Output_data_plt_i386_exec::first_plt_entry): ... here. (Output_data_plt_i386::exec_plt_entry): Move to ... (Output_data_plt_i386_exec::plt_entry): ... here. (Output_data_plt_i386_dyn): New class. (Output_data_plt_i386::first_plt_entry): Move to ... (Output_data_plt_i386_dyn::first_plt_entry): ... here. (Output_data_plt_i386::dyn_plt_entry): Move to ... (Output_data_plt_i386_dyn::plt_entry): ... here. (Target_i386::Target_i386): Take optional argument for the Target_info pointer to use. (Target_i386::do_make_data_plt): New virtual method. (Target_i386::make_data_plt): New method to call it. (Target_i386::make_plt_section): Use that. Call this->plt_->add_eh_frame method here. (Output_data_plt_i386::add_entry): Use get_plt_entry_size method rather than plt_entry_size variable. (Output_data_plt_i386::add_local_ifunc_entry): Likewise. (Output_data_plt_i386::address_for_local): Likewise. (Output_data_plt_i386::do_write): Likewise. Move guts of PLT filling to... (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ... (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ... (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ... (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here. Change-Id: Id24b95600489835ff5e860a39c147203d4380c2b
2011-07-15 * options.h (class General_options): Add --print-output-format.Ian Lance Taylor
Move -EL next to -EB, for better --help output. * target-select.cc: Include <cstdio>, "options.h", and "parameters.h". (Target_selector::do_target_bfd_name): New function. (print_output_format): New function. * target-select.h (class Target_selector): Update declarations. (Target_selector::target_bfd_name): New function. (print_output_format): Declare. * main.cc: Include "target-select.h". (main): Handle --print-output-format. * gold.cc: Include "target-select.h". (queue_initial_tasks): Handle --print-output-format when there are no input files. * parameters.cc (parameters_force_valid_target): Give a better error message if -EB/-EL does not match target. * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New function.
2011-06-28 PR gold/12934Ian Lance Taylor
* target-select.cc (Target_selector::Target_selector): Add emulation parameter. Change all callers. (select_target_by_bfd_name): Rename from select_target_by_name. Change all callers. (select_target_by_emulation): New function. (supported_emulation_names): New function. * target-select.h (class Target_selector): Add emulation_ field. Update declarations. (Target_selector::recognize_by_bfd_name): Rename from recognize_by_name. Change all callers. (Target_selector::supported_bfd_names): Rename from supported_names. Change all callers. (Target_selector::recognize_by_emulation): New function. (Target_selector::supported_emulations): New function. (Target_selector::emulation): New function. (Target_selector::do_recognize_by_bfd_name): Rename from do_recognize_by_name. Change all callers. (Target_selector::do_supported_bfd_names): Rename from do_supported_names. Change all callers. (Target_selector::do_recognize_by_emulation): New function. (Target_selector::do_supported_emulations): New function. (select_target_by_bfd_name): Change name in declaration. (select_target_by_emulation): Declare. (supported_emulation_names): Declare. * parameters.cc (parameters_force_valid_target): Try to find target based on emulation from -m option. * options.h (class General_options): Change doc string for -m. * options.cc (help): Print emulations. (General_options::parse_V): Likewise. * freebsd.h (Target_selector_freebsd::Target_selector_freebsd): Add emulation parameter. Change all callers.
2010-02-12 * gold-threads.h (class Once): Define.Ian Lance Taylor
(class Initialize_lock): Rewrite as child of Once. * gold-threads.cc (class Once_initialize): Define. (once_pointer_control): New static variable. (once_pointer, once_arg): New static variables. (c_run_once): New static function. (Once::Once, Once::run_once, Once::internal_run): New functions. (class Initialize_lock_once): Remove. (initialize_lock_control): Remove. (initialize_lock_pointer): Remove. (initialize_lock_once): Remove. (Initialize_lock::Initialize_lock): Move to gold-threads.h. (Initialize_lock::initialize): Rewrite. (Initialize_lock::do_run_once): New function. * archive.cc (Archive::interpret_header): Only clear name if it is not already empty. * fileread.cc: Include "gold-threads.h" (file_counts_lock): New static variable. (file_counts_initialize_lock): Likewise. (File_read::release): Only increment counts when using --stats. Use a lock around the increment. * parameters.cc (class Set_parameters_target_once): Define. (set_parameters_target_once): New static variable. (Parameters::Parameters): Move here from parameters.h. (Parameters::set_target): Rewrite. (Parameters::set_target_once): New function. (Parameters::clear_target): Move here and rewrite. * parameters.h (class Parameters): Update declarations. Add set_parameters_target_once_ field. (Parameters::Parameters): Move to parameters.cc. (Parameters::clear_target): Likewise. * readsyms.cc (Read_symbols::do_group): Create a Start_group task. (Start_group::~Start_group): New function. (Start_group::is_runnable): New function. (Start_group::locks, Start_group::run): New functions. (Finish_group::run): Change saw_undefined to size_t. * readsyms.h (class Start_group): Define. (class Finish_group): Change saw_undefined_ field to size_t. (Finish_group::Finish_group): Remove saw_undefined and this_blocker parameters. Change all callers. (Finish_group::set_saw_undefined): New function. (Finish_group::set_blocker): New function. * symtab.h (class Symbol_table): Change saw_undefined to return size_t. Change saw_undefined_ field to size_t. * target-select.cc (Set_target_once::do_run_once): New function. (Target_selector::Target_selector): Initialize set_target_once_ field. Don't initialize lock_ and initialize_lock_ fields. (Target_selector::instantiate_target): Rewrite. (Target_selector::set_target): New function. * target-select.h (class Set_target_once): Define. (class Target_selector): Update declarations. Make Set_target_once a friend. Remove lock_ and initialize_lock_ fields. Add set_target_once_ field.
2009-12-14 Revert -Wshadow changes, all changes from:Ian Lance Taylor
2009-12-11 Doug Kwan <dougkwan@google.com> 2009-12-11 Nick Clifton <nickc@redhat.com> * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
2009-12-11Add -Wshadow to the gcc command line options used when compiling the binutils.Nick Clifton
Fix up all warnings generated by the addition of this switch.
2009-03-24 * target-select.cc (instantiate_target): Don't acquire the lock ifIan Lance Taylor
the instantiated_target_ field has already been set.
2009-03-242009-03-23 Ian Lance Taylor <iant@google.com>Ian Lance Taylor
* gold-threads.h (class Initialize_lock): Define. * gold-threads.cc (class Initialize_lock_once): Define. (initialize_lock_control): New static variable. (initialize_lock_pointer): New static variable. (initialize_lock_once): New static function. (Initialize_lock::Initialize_lock): Define. (Initialize_lock::initialize): Define. * target-select.h: Include "gold-threads.h". (class Target_selector): Add lock_ and initialize_lock_ fields. Don't define instantiate_target, just declare it. * target-select.cc (Target_selector::Target_selector): Initialize new fields. (Target_selector::instantiate_target): Define. * descriptors.h: Include "gold-threads.h". (class Descriptors): Add initialize_lock_ field. * descriptors.cc (Descriptors::Descriptors): Initialize new field. (Descriptors::open): Use initialize_lock_ field * errors.h (class Errors): Add initialize_lock_ field. * errors.cc (Errors::Errors): Initialize new field. (Errors::initialize_lock): Use initialize_lock_ field. * powerpc.cc (class Target_selector_powerpc): Remove instantiated_target_ field. In do_recognize call instantiate_target rather than do_instantiate_target. In do_instantiate_target just allocate a new target. * sparc.cc (class Target_selector_sparc): Likewise.
2008-03-26 PR gold/5986Ian Lance Taylor
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-25 * options.cc (options::help): Print list of supported targets.Ian Lance Taylor
* 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-13Update copyright years. Update language files.Ian Lance Taylor
2008-02-13Support selecting target by name.Ian Lance Taylor
2007-10-03Parameterize object_unittest to work for whatever target types areIan Lance Taylor
supported.
2007-09-22Add licensing text to every source file.Ian Lance Taylor
2006-11-03Can now do a full static link of hello, world in C or C++Ian Lance Taylor
2006-08-18Another snapshot of the current state of the sources. Gets to theIan Lance Taylor
point of symbol resolution and can now issue a multiple definition error. Also added target selection infrastructure.