aboutsummaryrefslogtreecommitdiff
path: root/gold/options.cc
AgeCommit message (Collapse)AuthorFilesLines
2021-01-01Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2020-07-27[GOLD] Power10 stub selectionAlan Modra1-0/+29
gold version of commit e10a07b32dc1. * options.h (DEFINE_enum): Add optional_arg__ param, adjust all uses. (General_options): Add --power10-stubs and --no-power10-stubs. * options.cc (General_options::finalize): Handle --power10-stubs. * powerpc.cc (set_power10_stubs): Don't set when --power10-stubs=no. (power10_stubs_auto): New. (struct Plt_stub_ent): Add toc_ and tocoff_. Don't use a bitfield for indx_. (struct Branch_stub_ent): Add toc_and tocoff_. Use bitfields for iter_, notoc_ and save_res_. (add_plt_call_entry): Set toc_. Adjust resizing conditions for --power10-stubs=auto. (add_long_branch_entry): Set toc_. (add_eh_frame, define_stub_syms): No longer use const_iterators for plt and long branch stub iteration. (build_tls_opt_head, build_tls_opt_tail): Change parameters and return value. Move tests for __tls_get_addr to callers. (plt_call_size): Handle --power10-stubs=auto. (branch_stub_size): Likewise. (Stub_table::do_write): Likewise. (relocate): Likewise.
2020-06-15gold, ld: Implement -z start-stop-visibility=... option.Roland McGrath1-1/+15
gold/ Implement -z start-stop-visibility=... option. * options.h (class General_options): Handle -z start-stop-visibility=. (General_options::start_stop_visibility_enum): New public method. (General_options::set_start_stop_visibility_enum): New private method. (General_options::start_stop_visibility_enum_): New private member. * options.cc (General_options::General_options): Add initializer. (General_options::finalize): Set this->start_stop_visibility_enum_ from string value. * layout.cc (Layout::define_section_symbols): Use option setting. bfd/ * elflink.c (bfd_elf_define_start_stop): Use start_stop_visibility field of bfd_link_info. include/ * bfdlink.h (struct bfd_link_info): New field start_stop_visibility. ld/ * NEWS: Mention -z start-stop-visibility=... option for ELF. * ld.texi (Options): Document -z start-stop-visibility=... option. * ldmain.c (main): Initialize link_info.start_stop_visibility. * emultempl/elf.em (gld${EMULATION_NAME}_handle_option): Parse -z start-stop-visibility=... option.
2020-01-01Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2019-01-01Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2018-03-28Use top-level config support for enabling plugins.Cary Coutant1-2/+7
Also recognizes --plugin options when plugins are disabled. 2018-03-28 Cary Coutant <ccoutant@gmail.com> gold/ PR gold/21423 PR gold/22500 * configure.ac: Call AC_USE_SYSTEM_EXTENSIONS. Replace check for --enable-plugins with AC_PLUGINS. * options.cc (parse_plugin, parse_plugin_opt): Remove #ifdef. (General_options::finalize): Check if plugins enabled. * options.h (--plugin, --plugin-opt): Define even if plugins not enabled. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. * testsuite/Makefile.in: Regenerate.
2018-01-03Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2017-12-01Disallow --incremental with -pie and force -no-pie for incremental tests.Cary Coutant1-0/+2
This is a partial fix for the gold testsuite failures documented in PR 21090. The use of -fpie triggers some mov-to-lea optimizations that are not compatible with incremental linking, so those optimizations need to be disabled. We also diagnose the attempt to use -pie with incremental linking, and force -no-pie for the incremental tests in case the build has been configured to have GCC pass -pie all the time. We still have a problem where compiling with -fpie results in some GOT entries even when linking with -no-pie. This combination still causes test failures because we are not updating the GOT entries in an incremental update link. gold/ PR gold/21090 * incremental.cc (Sized_relobj_incr::do_relocate): Fix comment. * options.cc (General_options::finalize): Disallow -pie with incremental linking. * x86_64.cc (Target_x86_64::Scan::local): Don't do mov-to-lea or callq-to-direct optimizations for incremental links. (Target_x86_64::Scan::global): Likewise. (Target_x86_64::Relocate::relocate): Likewise. * testsuite/Makefile.am (incremental_test): Force -no-pie. (incremental_test_2): Likewise. (incremental_test_3): Likewise. (incremental_test_4): Likewise. (incremental_test_5): Likewise. (incremental_test_6): Likewise. (incremental_copy_test): Likewise. (incremental_common_test_1): Likewise. (incremental_comdat_test_1): Likewise. * testsuite/Makefile.in: Regenerate.
2017-12-01Fix internal error from command line with unbalanced --start-lib/--end-lib.Benjamin Peterson1-0/+6
The problem is that while the command line isn't trivially empty, it contains no input files. As gold tries to configure the number of threads to use based on the number of input files, this causes the assertion failure above. Fix this problem by making the logic in gold.cc more robust and also adding a better error message about --start-lib to options.cc. gold/ PR gold/22406 * gold.cc (queue_initial_tasks) Check for number of real input files. * options.cc (Command_line::process) Check for unterminated --start-lib options. * testsuite/Makefile.am: Add new test script. * testsuite/Makefile.in: Regenerate. * testsuite/check_empty_command_lines.sh: New test script.
2017-01-02Update year range in copyright notice of all files.Alan Modra1-1/+1
2016-12-13Add --orphan-handling option.Cary Coutant1-1/+15
gold/ PR gold/20749 * options.h (--orphan-handling): New option. (General_options::Orphan_handling): New enum. (General_options::orphan_handling_enum): New method. (General_options::set_orphan_handling_enum): New method. (General_options::orphan_handling_enum_): New data member. * options.cc (General_options::General_options): Initialize new member. (General_options::finalize): Convert --orphan-handling argument to enum. * script-sections.cc (Script_sections::output_section_name): Check it.
2016-12-01Implement --push-state/--pop-state.Cary Coutant1-0/+47
gold/ PR gold/18989 * options.cc (General_options::object_format_to_string): New function. (General_options::copy_from_posdep_options): New function. (General_options::parse_push_state): New function. (General_options::parse_pop_state): New function. * options.h (--push-state, --pop-state): New options. (General_options::object_format_to_string): New method. (General_options::set_incremental_disposition): New method. (General_options::copy_from_posdep_options): New method. (General_options::options_stack_): New data member.
2016-11-22Print the default for all binary options; clean up --help output.Cary Coutant1-3/+5
gold/ PR gold/20346 * options.cc (One_option::print): Print "(default)" when appropriate. * options.h: Clean up and re-sort options. (One_option::is_default): New data member. (One_option::One_option): Add is_default parameter; adjust all calls. (DEFINE_var): Add is_default__ parameter; adjust all calls. (DEFINE_bool): Set is_default based on default_value__. (DEFINE_bool_ignore): New macro. (--no-eh-frame-hdr): New option. (--enable-new-dtags): Remove mention of DT_FLAGS.
2016-01-01Copyright update for binutilsAlan Modra1-1/+1
2015-06-04Change default to discard temporary local symbols in merge sections.Cary Coutant1-1/+23
Add --discard-none to keep all local symbols. gold/ PR gold/17498 * object.cc (Sized_relobj_file::do_count_local_symbols): Discard temporary locals in merge sections. * options.cc (General_options::parse_discard_all): New method. (General_options::parse_discard_locals): New method. (General_options::parse_discard_none): New method. (General_options::General_options): Initialize discard_locals_. * options.h (--discard-all): Convert to special option. (--discard-locals): Likewise. (--discard-none): New option. (General_options::discard_all): New method. (General_options::discard_locals): New method. (General_options::discard_sec_merge): New method. (General_options::Discard_locals): New enum. (General_options::discard_locals_): New data member.
2015-03-11Fix gold incremental test failures.Cary Coutant1-0/+2
Newer version of GCC pass -z relro to the linker, but incremental linking does not support relro. This patch adds a check to complain about the conflict, and changes the testsuite to pass -z norelro to the incremental tests. 2015-03-11 Cary Coutant <ccoutant@google.com> gold/ * options.cc (General_options::finalize): Don't allow -z relro with incremental linking. * testsuite/Makefile.am (incremental_test): Add -z norelro. (incremental_test_2): Likewise. (incremental_test_3): Likewise. (incremental_test_4): Likewise. (incremental_test_5): Likewise. (incremental_test_6): Likewise. (incremental_copy_test): Likewise. (incremental_common_test_1): Likewise. (incremental_comdat_test_1): Likewise. * testsuite/Makefile.in: Regenerate.
2015-02-16Fix --dynamic-list so that symbols not in the list are still exported.Cary Coutant1-7/+0
In PR 13577, the complaint was that -Bsymbolic was overriding the binding behavior for symbols listed in the --dynamic-list by setting the DT_SYMBOLIC tag in the dynamic table. In reading the Gnu ld manual, I decided that --dynamic-list should be mutually exclusive of -Bsymbolic, and modified gold so that --dynamic-list would treat symbols listed as preemptible, and all other symbols as internally bound. I was wrong. PR 16992 shows that with --dynamic-list (and not -Bsymbolic), a symbol not listed in the dynamic list is being internally bound within the shared library, but because it's still in the dynamic symbol table, we expose it to a COPY relocation, and things go really bad from there. (I can reproduce the same failure, simply by turning on -Bsymbolic-functions with the Gnu linker. Even though the symbol is bound internally, it's still exported to the dynamic symbol table, and is exposed to a COPY relocation.) I've backed out part of the fix for PR 13577, and -Bsymbolic (or -Bsymbolic-functions) can now be used with --dynamic-list, but if the two are used together, we do not set DT_SYMBOLIC or DF_SYMBOLIC (this matches Gnu ld behavior). We now treat symbols listed in the dynamic list as premptible, but we do not automatically treat symbols not listed there as non-premptible. gold/ PR gold/13577 PR gold/16992 * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or DF_SYMBOLIC if --dynamic-list option is used. * options.cc (General_options::finalize): --dynamic-list is not mutually exclusive with -Bsymbolic. * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not listed in --dynamic-list. * testsuite/Makefile.am (dynamic_list_lib2.so): Add -Bsymbolic-functions. * testsuite/Makefile.in: Regenerate.
2015-01-02ChangeLog rotatation and copyright year updateAlan Modra1-1/+1
2014-03-05Update copyright yearsAlan Modra1-2/+1
2014-02-05Fix problems with the --dynamic-list option.Cary Coutant1-0/+9
PR gold/13577 complains that even though symbols listed in the --dynamic-list script are exported, they are still bound symbolically if -Bsymbolic is also used. There are two underlying problems here. First, -Bsymbolic should be overridden by --dynamic-list, since the dynamic list provides an explicit list of symbols that are not bound within the library, and if we go ahead and set DT_SYMBOLIC, then the dynamic loader will bind it within the library anyway. Second, gold did not properly identify the symbols listed in the file as preemptible. PR gold/16530 complains that symbols listed in the --dynamic-list script can still be garbage collected. I've fixed this by checking the symbols as they're added to the symbol table. (Unlike the --export-dynamic-symbol option, we can't iterate over the list, because the --dynamic-list script can have wildcards in it.) gold/ 2014-02-05 Cary Coutant <ccoutant@google.com> PR gold/13577 * options.cc (General_options::parse_dynamic_list): Set have_dynamic_list_. (General_options::General_options): Initialize have_dynamic_list_. (General_options::finalize): Turn off -Bsymbolic and -Bsymbolic-functions if --dynamic-list provided. * options.h (General_options::have_dynamic_list): New function. (General_options::have_dynamic_list_): New data member. * symtab.h (Symbol::is_preemptible): Handle --dynamic-list correctly. PR gold/16530 * symtab.cc (Symbol_table::add_from_relobj): If symbol is named in --dynamic-list, mark it. * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case. (dynamic_list_2): New test case. * testsuite/Makefile.in: Regenerate. * testsuite/dynamic_list_2.cc: New file. * testsuite/dynamic_list_2.t: New file. * testsuite/dynamic_list_lib1.cc: New file. * testsuite/dynamic_list_lib2.cc: New file. * testsuite/gc_dynamic_list_test.c: New file. * testsuite/gc_dynamic_list_test.sh: New file. * testsuite/gc_dynamic_list_test.t: New file.
2013-05-10gold/Roland McGrath1-114/+119
* options.h (General_options): Add --rosegment-gap option. * options.cc (finalize): --rosegment-gap implies --rosegment. * layout.cc (set_segment_offsets): Let user option override target->rosegment_gap().
2013-03-08 * options.cc (General_options::string_to_object_format): AcceptIan Lance Taylor1-1/+1
"default".
2012-02-15 * options.cc (General_options::finalize): Disallow -pie and -static.Cary Coutant1-0/+2
2011-11-03 * configure.ac: Add --with-lib-path option. Define LIB_PATH andIan Lance Taylor1-12/+27
NATIVE_LINKER. * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR. * options.cc (General_options::finalize): Use library search path from configure script if specified. If not native and no sysroot, only search TOOLLIBDIR. * options.h (Search_directory::Search_directory): Change name to const std::string&. (General_options::add_to_library_path_with_sysroot): Change arg to const std::string&. * configure, Makefile.in, config.in: Rebuild.
2011-10-03 * options.cc (parse_uint): Fix dereference of RETVAL.Diego Novillo1-1/+1
2011-09-26 * gold/gold.cc (queue_initial_tasks): Move option checks ...Cary Coutant1-0/+31
* gold/options.cc (General_options::finalize): ... to here. Disable some options; make others fatal.
2011-07-11 PR gold/12979Ian Lance Taylor1-0/+8
* options.h (class General_options): Add -Bgroup. * options.cc (General_options::finalize): If -Bgroup is set, default to --unresolved-symbols=report-all. * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup. * target-reloc.h (issue_undefined_symbol_error): Handle --unresolved-symbols=report-all.
2011-07-06 * incremental.cc (Sized_incremental_binary::do_file_has_changed):Cary Coutant1-1/+10
Check disposition for startup file. (Incremental_inputs::report_command_line): Ignore --incremental-startup-unchanged option. * options.cc (General_options::parse_incremental_startup_unchanged): New function. (General_options::General_options): Initialize new data member. * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP. (General_options): Add --incremental-startup-unchanged option. (General_options::incremental_startup_disposition): New function. (General_options::incremental_startup_disposition_): New data member.
2011-07-06 * incremental.cc (Incremental_inputs::report_command_line): IgnoreCary Coutant1-0/+11
--incremental-patch option. * layout.cc (Free_list::allocate): Extend allocation beyond original end if enabled. (Layout::make_output_section): Mark sections that should get patch space. * options.cc (parse_percent): New function. * options.h (parse_percent): New function. (DEFINE_percent): New macro. (General_options): Add --incremental-patch option. * output.cc (Output_section::Output_section): Initialize new data members. (Output_section::add_input_section): Print section name when out of patch space. (Output_section::add_output_section_data): Likewise. (Output_section::set_final_data_size): Add patch space when doing --incremental-full. (Output_section::do_reset_address_and_file_offset): Remove patch space. (Output_segment::set_section_list_addresses): Print debug output only if --incremental-update. * output.h (Output_section::set_is_patch_space_allowed): New function. (Output_section::is_patch_space_allowed_): New data member. (Output_section::patch_space_): New data member. * parameters.cc (Parameters::incremental_full): New function. * parameters.h (Parameters::incremental_full): New function * testsuite/Makefile.am (incremental_test_2): Add test for --incremental-patch option. * testsuite/Makefile.in: Regenerate. * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments. (t18): Remove function body.
2011-07-03 PR gold/12957Ian Lance Taylor1-0/+8
* options.h (class General_options): Add -f and -F. * options.cc (General_options::finalize): Fatal error if -f/-F are used without -shared. * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2011-06-28 PR gold/12934Ian Lance Taylor1-1/+19
* 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.
2011-04-12 * archive.cc (Archive::include_member): Adjust call toCary Coutant1-1/+2
report_object. (Add_archive_symbols::run): Track argument serial numbers. (Lib_group::include_member): Likewise. (Add_lib_group_symbols::run): Adjust call to report_archive_begin. * archive.h (Incremental_archive_entry::Archive_member): Initialize arg_serial_. (Archive_member::arg_serial_): New data member. * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL. (Sized_dynobj::do_add_symbols): Track symbols when doing an incremental link. (Sized_dynobj::do_for_all_local_got_entries): New function. * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New function. * fileread.cc (get_mtime): New function. * fileread.h (get_mtime): New function. * gold.cc (queue_initial_tasks): Check for incremental update. (process_incremental_input): New function. (queue_middle_tasks): Don't force valid target for incremental update. * incremental-dump.cc (find_input_containing_global): Adjust size of symbol info entry. (dump_incremental_inputs): Dump argument serial number and in_system_directory flag; bias shndx by 1; print symbol names when dumping per-file symbol lists; use new symbol info readers. * incremental.cc (Output_section_incremental_inputs:update_data_size): New function. (Sized_incremental_binary::setup_readers): Setup input readers for each input file; build maps for files added from libraries and scripts. (Sized_incremental_binary::check_input_args): New function. (Sized_incremental_binary::do_check_inputs): Build map of argument serial numbers to input arguments. (Sized_incremental_binary::do_file_has_changed): Rename do_file_is_unchanged to this; compare file modification times. (Sized_incremental_binary::do_init_layout): New function. (Sized_incremental_binary::do_reserve_layout): New function. (Sized_incremental_binary::do_get_input_reader): Remove. (Sized_incremental_binary::get_symtab_view): New function. (Incremental_checker::can_incrementally_link_output_file): Remove. (Incremental_inputs::report_command_line): Exclude --debug options. (Incremental_inputs::report_archive_begin): Add parameter; track argument serial numbers; don't put input file entry for archive before archive members. (Incremental_inputs::report_archive_end): Put input file entry for archive after archive members. (Incremental_inputs::report_object): Add parameter; track argument serial numbers and in_system_directory flag. (Incremental_inputs::report_script): Add parameter; track argument serial numbers. (Output_section_incremental_inputs::set_final_data_size): Adjust size of symbol info entry; check for forwarding symbols. (Output_section_incremental_inputs::write_input_files): Write in_system_directory flag and argument serial number. (Output_section_incremental_inputs::write_info_blocks): Map section indices between incremental info and original input file; store input section index for each symbol. (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor; change operator() to visit(). (class Global_got_offset_visitor): Likewise. (class Global_symbol_visitor_got_plt): (Output_section_incremental_inputs::write_got_plt): Use new visitor classes. (Sized_incr_relobj::Sized_incr_relobj): New constructor. (Sized_incr_relobj::do_read_symbols): New function. (Sized_incr_relobj::do_layout): New function. (Sized_incr_relobj::do_layout_deferred_sections): New function. (Sized_incr_relobj::do_add_symbols): New function. (Sized_incr_relobj::do_should_include_member): New function. (Sized_incr_relobj::do_for_all_global_symbols): New function. (Sized_incr_relobj::do_for_all_local_got_entries): New function. (Sized_incr_relobj::do_section_size): New function. (Sized_incr_relobj::do_section_name): New function. (Sized_incr_relobj::do_section_contents): New function. (Sized_incr_relobj::do_section_flags): New function. (Sized_incr_relobj::do_section_entsize): New function. (Sized_incr_relobj::do_section_address): New function. (Sized_incr_relobj::do_section_type): New function. (Sized_incr_relobj::do_section_link): New function. (Sized_incr_relobj::do_section_info): New function. (Sized_incr_relobj::do_section_addralign): New function. (Sized_incr_relobj::do_initialize_xindex): New function. (Sized_incr_relobj::do_get_global_symbol_counts): New function. (Sized_incr_relobj::do_read_relocs): New function. (Sized_incr_relobj::do_gc_process_relocs): New function. (Sized_incr_relobj::do_scan_relocs): New function. (Sized_incr_relobj::do_count_local_symbols): New function. (Sized_incr_relobj::do_finalize_local_symbols): New function. (Sized_incr_relobj::do_set_local_dynsym_indexes): New function. (Sized_incr_relobj::do_set_local_dynsym_offset): New function. (Sized_incr_relobj::do_relocate): New function. (Sized_incr_relobj::do_set_section_offset): New function. (Sized_incr_dynobj::Sized_incr_dynobj): New function. (Sized_incr_dynobj::do_read_symbols): New function. (Sized_incr_dynobj::do_layout): New function. (Sized_incr_dynobj::do_add_symbols): New function. (Sized_incr_dynobj::do_should_include_member): New function. (Sized_incr_dynobj::do_for_all_global_symbols): New function. (Sized_incr_dynobj::do_for_all_local_got_entries): New function. (Sized_incr_dynobj::do_section_size): New function. (Sized_incr_dynobj::do_section_name): New function. (Sized_incr_dynobj::do_section_contents): New function. (Sized_incr_dynobj::do_section_flags): New function. (Sized_incr_dynobj::do_section_entsize): New function. (Sized_incr_dynobj::do_section_address): New function. (Sized_incr_dynobj::do_section_type): New function. (Sized_incr_dynobj::do_section_link): New function. (Sized_incr_dynobj::do_section_info): New function. (Sized_incr_dynobj::do_section_addralign): New function. (Sized_incr_dynobj::do_initialize_xindex): New function. (Sized_incr_dynobj::do_get_global_symbol_counts): New function. (make_sized_incremental_object): New function. (Incremental_library::copy_unused_symbols): New function. (Incremental_library::do_for_all_unused_symbols): New function. * incremental.h (enum Incremental_input_flags): New type. (class Incremental_checker): Remove. (Incremental_input_entry::Incremental_input_entry): Add argument serial number. (Incremental_input_entry::arg_serial): New function. (Incremental_input_entry::set_is_in_system_directory): New function. (Incremental_input_entry::is_in_system_directory): New function. (Incremental_input_entry::arg_serial_): New data member. (Incremental_input_entry::is_in_system_directory_): New data member. (class Script_info): Move here from script.h. (Script_info::Script_info): Add filename parameter. (Script_info::filename): New function. (Script_info::filename_): New data member. (Incremental_script_entry::Incremental_script_entry): Add argument serial number. (Incremental_object_entry::Incremental_object_entry): Likewise. (Incremental_object_entry::add_input_section): Build list of input sections with map to original shndx. (Incremental_object_entry::get_input_section_index): New function. (Incremental_object_entry::shndx_): New data member. (Incremental_object_entry::name_key_): Rename; adjust all refs. (Incremental_object_entry::sh_size_): Rename; adjust all refs. (Incremental_archive_entry::Incremental_archive_entry): Add argument serial number. (Incremental_inputs::report_archive_begin): Likewise. (Incremental_inputs::report_object): Likewise. (Incremental_inputs::report_script): Likewise. (class Incremental_global_symbol_reader): New class. (Incremental_input_entry_reader::Incremental_input_entry_reader): Read and store flags and input file type. (Incremental_input_entry_reader::arg_serial): New function. (Incremental_input_entry_reader::type): Extract type from flags. (Incremental_input_entry_reader::is_in_system_directory): New function. (Incremental_input_entry_reader::get_input_section_count): Call accessor function for type. (Incremental_input_entry_reader::get_symbol_offset): Call accessor function for type; adjust size of global symbol entry. (Incremental_input_entry_reader::get_global_symbol_count): Call accessor function for type. (Incremental_input_entry_reader::get_object_count): Likewise. (Incremental_input_entry_reader::get_object_offset): Likewise. (Incremental_input_entry_reader::get_member_count): Likewise. (Incremental_input_entry_reader::get_unused_symbol_count): Likewise. (Incremental_input_entry_reader::get_member_offset): Likewise. (Incremental_input_entry_reader::get_unused_symbol): Likewise. (Incremental_input_entry_reader::Global_symbol_info): Remove. (Incremental_input_entry_reader::get_global_symbol_info): Remove. (Incremental_input_entry_reader::get_global_symbol_reader): New function. (Incremental_input_entry_reader::get_output_symbol_index): New function. (Incremental_input_entry_reader::type_): Remove. (Incremental_input_entry_reader::flags_): New data member. (Incremental_inputs_reader::input_file_offset): New function. (Incremental_inputs_reader::input_file_index): New function. (Incremental_inputs_reader::input_file): Call input_file_offset. (Incremental_inputs_reader::input_file_at_offset): New function. (Incremental_relocs_reader::get_r_type): Reformat. (Incremental_relocs_reader::get_r_shndx): Reformat. (Incremental_relocs_reader::get_r_offset): Reformat. (Incremental_relocs_reader::data): New function. (Incremental_binary::Incremental_binary): Initialize new data members. (Incremental_binary::check_inputs): Add cmdline parameter. (Incremental_binary::file_is_unchanged): Remove. (Input_reader::arg_serial): New function. (Input_reader::get_unused_symbol_count): New function. (Input_reader::get_unused_symbol): New function. (Input_reader::do_arg_serial): New function. (Input_reader::do_get_unused_symbol_count): New function. (Input_reader::do_get_unused_symbol): New function. (Incremental_binary::input_file_count): New function. (Incremental_binary::get_input_reader): Change signature to use index instead of filename. (Incremental_binary::file_has_changed): New function. (Incremental_binary::get_input_argument): New function. (Incremental_binary::get_library): New function. (Incremental_binary::get_script_info): New function. (Incremental_binary::init_layout): New function. (Incremental_binary::reserve_layout): New function. (Incremental_binary::output_file): New function. (Incremental_binary::do_check_inputs): New function. (Incremental_binary::do_file_is_unchanged): Remove. (Incremental_binary::do_file_has_changed): New function. (Incremental_binary::do_init_layout): New function. (Incremental_binary::do_reserve_layout): New function. (Incremental_binary::do_input_file_count): New function. (Incremental_binary::do_get_input_reader): Change signature. (Incremental_binary::input_args_map_): New data member. (Incremental_binary::library_map_): New data member. (Incremental_binary::script_map_): New data member. (Sized_incremental_binary::Sized_incremental_binary): Initialize new data members. (Sized_incremental_binary::output_section): New function. (Sized_incremental_binary::inputs_reader): Add const. (Sized_incremental_binary::symtab_reader): Add const. (Sized_incremental_binary::relocs_reader): Add const. (Sized_incremental_binary::got_plt_reader): Add const. (Sized_incremental_binary::get_symtab_view): New function. (Sized_incremental_binary::Inputs_reader): New typedef. (Sized_incremental_binary::Input_entry_reader): New typedef. (Sized_incremental_binary::do_check_inputs): Add cmdline parameter. (Sized_incremental_binary::do_file_is_unchanged): Remove. (Sized_incremental_binary::do_file_has_changed): New function. (Sized_incremental_binary::do_init_layout): New function. (Sized_incremental_binary::do_reserve_layout): New function. (Sized_input_reader::Inputs_reader): Remove. (Sized_input_reader::Input_entry_reader): Remove. (Sized_input_reader::do_arg_serial): New function. (Sized_input_reader::do_get_unused_symbol_count): New function. (Sized_input_reader::do_get_unused_symbol): New function. (Sized_incremental_binary::do_input_file_count): New function. (Sized_incremental_binary::do_get_input_reader): Change signature; use index instead of filename. (Sized_incremental_binary::section_map_): New data member. (Sized_incremental_binary::input_entry_readers_): New data member. (class Sized_incr_relobj): New class. (class Sized_incr_dynobj): New class. (make_sized_incremental_object): New function. (class Incremental_library): New class. * layout.cc (Free_list::num_lists): New static data member. (Free_list::num_nodes): New static data member. (Free_list::num_removes): New static data member. (Free_list::num_remove_visits): New static data member. (Free_list::num_allocates): New static data member. (Free_list::num_allocate_visits): New static data member. (Free_list::init): New function. (Free_list::remove): New function. (Free_list::allocate): New function. (Free_list::dump): New function. (Free_list::print_stats): New function. (Layout_task_runner::run): Resize output file for incremental updates. (Layout::Layout): Initialize new data members. (Layout::set_incremental_base): New function. (Layout::init_fixed_output_section): New function. (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for incremental updates. (Layout::create_gold_note): Do not create gold note section for incremental updates. (Layout::set_segment_offsets): Do not recalculate RELRO alignment for incremental updates. (Layout::set_section_offsets): For incremental updates, allocate space from free list. (Layout::create_symtab_sections): Layout with offsets relative to start of section; for incremental updates, allocate space from free list. (Layout::create_shdrs): For incremental updates, allocate space from free list. (Layout::finish_dynamic_section): For incremental updates, do not check --as-needed (fixed in subsequent patch). * layout.h (class Free_list): New class. (Layout::set_incremental_base): New function. (Layout::incremental_base): New function. (Layout::init_fixed_output_section): New function. (Layout::allocate): New function. (Layout::incremental_base_): New data member. (Layout::free_list_): New data member. * main.cc (main): Print Free_list statistics. * object.cc (Relobj::finalize_incremental_relocs): Add clear_counts parameter; clear counts only when clear_counts is set. (Sized_relobj::Sized_relobj): Initialize new base class. (Sized_relobj::do_layout): Don't report special sections. (Sized_relobj::do_for_all_local_got_entries): New function. (Sized_relobj::write_local_symbols): Add symtab_off parameter; add symtab_off to all symbol table offsets. (Sized_relobj::do_get_global_symbol_counts): Add typename keyword. * object.h (class Got_offset_list): Move to top of file. (Object::Object): Allow case where input_file == NULL. (Object::~Object): Likewise. (Object::input_file): Assert that input_file != NULL. (Object::lock): Allow case where input_file == NULL. (Object::unlock): Likewise. (Object::is_locked): Likewise. (Object::token): Likewise. (Object::release): Likewise. (Object::is_incremental): New function. (Object::get_mtime): New function. (Object::for_all_local_got_entries): New function. (Object::clear_view_cache_marks): Allow case where input_file == NULL. (Object::set_is_in_system_directory): New function. (Object::is_in_system_directory): New function. (Object::do_is_incremental): New function. (Object::do_get_mtime): New function. (Object::do_for_all_local_got_entries): New function. (Object::is_in_system_directory_): New data member. (Relobj::finalize_incremental_relocs): Add clear_counts parameter. (class Sized_relobj_base): New class. (class Sized_relobj): Derive from Sized_relobj_base. (class Sized_relobj::Symbols): Redeclare from base class. (class Sized_relobj::local_got_offset_list): Remove. (class Sized_relobj::Output_sections): Redeclare from base class. (class Sized_relobj::do_for_all_local_got_entries): New function. (class Sized_relobj::write_local_symbols): Add offset parameter. (class Sized_relobj::local_symbol_offset_): Update comment. (class Sized_relobj::local_dynsym_offset_): Update comment. * options.cc (Input_arguments::add_file): Remove const. * options.h (Input_file_argument::Input_file_argument): Initialize arg_serial_ (all constructors). (Input_file_argument::set_arg_serial): New function. (Input_file_argument::arg_serial): New function. (Input_file_argument::arg_serial_): New data member. (Input_arguments::Input_arguments): Initialize file_count_. (Input_arguments::add_file): Remove const. (Input_arguments::number_of_input_files): New function. (Input_arguments::file_count_): New data member. (Command_line::number_of_input_files): Call Input_arguments::number_of_input_files. * output.cc (Output_segment_headers::Output_segment_headers): Set current size. (Output_section::Input_section::current_data_size): New function. (Output_section::Output_section): Initialize new data members. (Output_section::add_input_section): Don't do merge sections for an incremental link; allocate space from free list for an incremental update. (Output_section::add_output_section_data): Allocate space from free list for an incremental update. (Output_section::update_data_size): New function. (Output_section::set_fixed_layout): New function. (Output_section::reserve): New function. (Output_segment::set_section_addresses): Remove const. (Output_segment::set_section_list_addresses): Remove const; allocate space from free list for an incremental update. (Output_segment::set_offset): Adjust size of RELRO segment for an incremental update. * output.h (Output_data::current_data_size): Move here from child classes. (Output_data::pre_finalize_data_size): New function. (Output_data::update_data_size): New function. (Output_section_headers::update_data_size): new function. (Output_section_data_build::current_data_size): Move to Output_data. (Output_data_strtab::update_data_size): New function. (Output_section::current_data_size): Move to Output_data. (Output_section::set_fixed_layout): New function. (Output_section::has_fixed_layout): New function. (Output_section::reserve): New function. (Output_section::update_data_size): New function. (Output_section::has_fixed_layout_): New data member. (Output_section::free_list_): New data member. (Output_segment::set_section_addresses): Remove const. (Output_segment::set_section_list_addresses): Remove const. * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries): New function. * plugin.h (Sized_pluginobj::do_for_all_local_got_entries): New function. * readsyms.cc (Read_symbols::do_read_symbols): Add library parameter when calling Add_symbols constructor; store argument serial number for members of a lib group. (Add_symbols::locks): Allow case where token == NULL. (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib. (Read_member::~Read_member): New function. (Read_member::is_runnable): New function. (Read_member::locks): New function. (Read_member::run): New function. (Check_script::~Check_script): New function. (Check_script::is_runnable): New function. (Check_script::locks): New function. (Check_script::run): New function. (Check_library::~Check_library): New function. (Check_library::is_runnable): New function. (Check_library::locks): New function. (Check_library::run): New function. * readsyms.h (Add_symbols::Add_symbols): Add library parameter. (Add_symbols::library_): New data member. (class Read_member): New class. (class Check_script): New class. (class Check_library): New class. * reloc.cc (Read_relocs::is_runnable): Allow case where token == NULL. (Read_relocs::locks): Likewise. (Scan_relocs::locks): Likewise. (Relocate_task::locks): Likewise. (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs to clear counters. (Sized_relobj::incremental_relocs_scan): Fix comment. (Sized_relobj::do_relocate): Pass output file offset to write_local_symbols. (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size from class declaration. * script.cc (read_input_script): Allocate Script_info; pass argument serial number to report_script. * script.h (class Script_info): Move to incremental.h. * symtab.cc (Symbol_table::add_from_incrobj): New function. * symtab.h (Symbol_table::add_from_incrobj): New function. (Symbol_table::set_file_offset): New function.
2011-03-30 * archive.cc (Archive::include_member): Adjust call to report_object.Cary Coutant1-6/+6
(Add_archive_symbols::run): Add script_info to call to report_archive_begin. (Lib_group::include_member): Adjust call to report_object. (Add_lib_group_symbols::run): Adjust call to report_object. * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary blocks. Add object count for script input files. * incremental.cc (Incremental_inputs::report_archive_begin): Add script_info parameter; change all callers. (Incremental_inputs::report_object): Add script_info parameter; change all callers. (Incremental_inputs::report_script): Store backpointer to incremental info entry. (Output_section_incremental_inputs::set_final_data_size): Record additional information for scripts. (Output_section_incremental_inputs::write_info_blocks): Likewise. * incremental.h (Incremental_script_entry::add_object): New function. (Incremental_script_entry::get_object_count): New function. (Incremental_script_entry::get_object): New function. (Incremental_script_entry::objects_): New data member; adjust constructor. (Incremental_inputs::report_archive_begin): Add script_info parameter. (Incremental_inputs::report_object): Add script_info parameter. (Incremental_inputs_reader::get_object_count): New function. (Incremental_inputs_reader::get_object_offset): New function. * options.cc (Input_arguments::add_file): Return reference to new input argument. * options.h (Input_argument::set_script_info): New function. (Input_argument::script_info): New function. (Input_argument::script_info_): New data member; adjust all constructors. (Input_file_group::add_file): Return reference to new input argument. (Input_file_lib::add_file): Likewise. (Input_arguments::add_file): Likewise. * readsyms.cc (Add_symbols::run): Adjust call to report_object. * script.cc (Parser_closure::Parser_closure): Add script_info parameter; adjust all callers. (Parser_closure::script_info): New function. (Parser_closure::script_info_): New data member. (read_input_script): Report scripts earlier to incremental info. (script_add_file): Set script_info in Input_argument. (script_add_library): Likewise. * script.h (Script_options::Script_info): Rewrite class.
2010-12-14Fix typos in gold.Ralf Wildenhues1-4/+4
gold/: * dwarf_reader.cc: Remove outdated comment. * gold-threads.cc: Fix typo in error message. * archive.cc: Fix typos in comments. * archive.h: Likewise. * arm-reloc-property.cc: Likewise. * arm-reloc-property.h: Likewise. * arm-reloc.def: Likewise. * arm.cc: Likewise. * attributes.h: Likewise. * cref.cc: Likewise. * ehframe.cc: Likewise. * fileread.h: Likewise. * gold.h: Likewise. * i386.cc: Likewise. * icf.cc: Likewise. * incremental.h: Likewise. * int_encoding.cc: Likewise. * layout.h: Likewise. * main.cc: Likewise. * merge.h: Likewise. * object.cc: Likewise. * object.h: Likewise. * options.cc: Likewise. * readsyms.cc: Likewise. * reduced_debug_output.cc: Likewise. * reloc.cc: Likewise. * script-sections.cc: Likewise. * sparc.cc: Likewise. * symtab.h: Likewise. * target-reloc.h: Likewise. * target.cc: Likewise. * target.h: Likewise. * timer.cc: Likewise. * timer.h: Likewise. * x86_64.cc: Likewise.
2010-10-14 * debug.h (DEBUG_INCREMENTAL): New flag.Cary Coutant1-1/+30
(debug_string_to_enum): Add DEBUG_INCREMENTAL). * gold.cc (queue_initial_tasks): Check parameters for incremental link mode. * incremental.cc (report_command_line): Ignore all forms of --incremental. * layout.cc (Layout::Layout): Check parameters for incremental link mode. * options.cc (General_options::parse_incremental): New function. (General_options::parse_no_incremental): New function. (General_options::parse_incremental_full): New function. (General_options::parse_incremental_update): New function. (General_options::incremental_mode_): New data member. (General_options::finalize): Check incremental_mode_. * options.h (General_options): Update help text for --incremental. Add --no-incremental, --incremental-full, --incremental-update. (General_options::Incremental_mode): New enum type. (General_options::incremental_mode): New function. (General_options::incremental_mode_): New data member. * parameters.cc (Parameters::incremental_mode_): New data member. (Parameters::set_options): Set incremental_mode_. (Parameters::set_incremental_full): New function. (Parameters::incremental): New function. (Parameters::incremental_update): New function. (set_parameters_incremental_full): New function. * parameters.h (Parameters::set_incremental_full): New function. (Parameters::incremental): New function. (Parameters::incremental_update): New function. (Parameters::incremental_mode_): New data member. (set_parameters_incremental_full): New function. * plugin.cc (Plugin_manager::add_input_file): Check parameters for incremental link mode. * reloc.cc (Sized_relobj::do_read_relocs): Likewise. (Sized_relobj::do_relocate_sections): Likewise. * testsuite/Makefile.am (incremental_test): Use --incremental-full option. * testsuite/Makefile.in: Regenerate. * testsuite/incremental_test.sh: Filter all forms of --incremental.
2010-08-27 * options.cc (version_script): Fix small typo in previousNick Clifton1-1/+1
whitespace tidyup.
2010-08-25 * archive.cc: Formatting fixes: Remove whitespace betweenNick Clifton1-7/+7
typename and following asterisk. Remove whitespace between function name and opening parenthesis. * archive.h: Likewise. * arm.cc: Likewise. * attributes.cc: Likewise. * attributes.h: Likewise. * common.cc: Likewise. * copy-relocs.cc: Likewise. * dirsearch.h: Likewise. * dynobj.cc: Likewise. * ehframe.cc: Likewise. * ehframe.h: Likewise. * expression.cc: Likewise. * fileread.cc: Likewise. * fileread.h: Likewise. * gc.h: Likewise. * gold-threads.cc: Likewise. * gold.cc: Likewise. * i386.cc: Likewise. * icf.h: Likewise. * incremental-dump.cc: Likewise. * incremental.cc: Likewise. * layout.cc: Likewise. * layout.h: Likewise. * main.cc: Likewise. * merge.cc: Likewise. * merge.h: Likewise. * object.cc: Likewise. * object.h: Likewise. * options.cc: Likewise. * options.h: Likewise. * output.cc: Likewise. * output.h: Likewise. * plugin.cc: Likewise. * plugin.h: Likewise. * powerpc.cc: Likewise. * reloc.cc: Likewise. * script-c.h: Likewise. * script-sections.cc: Likewise. * script.cc: Likewise. * stringpool.cc: Likewise. * symtab.cc: Likewise. * symtab.h: Likewise. * target.cc: Likewise. * timer.cc: Likewise. * timer.h: Likewise. * version.cc: Likewise. * x86_64.cc: Likewise.
2010-05-182010-05-18 Rafael Espindola <espindola@google.com>Rafael Ávila de Espíndola1-1/+1
* options.cc (General_options::finalize): Handle -nostdlib. * options.h (nostdlib): New option. * script.cc (script_add_search_dir): Handle -nostdlib.
2010-04-072010-04-07 Doug Kwan <dougkwan@google.com>Doug Kwan1-1/+14
* arm.cc: Replace "endianity" with "endianness" in comments. (Arm_exidx_cantunwind): Ditto. (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures. (Arm_relobj::merge_flags_and_attributes): New method. (Arm_relobj::merge_flags_and_attributes_): New data member. (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting. (Arm_relobj::scan_sections_for_stubs): Ditto. (Arm_relobj::do_read_symbols): Check to see if we really want to merge processor-specific flags and attributes. Exit early if an object is empty except for section names and the undefined symbol. (Target_arm::do_finalize_sections): Move check for ELF format to Arm_relobj::do_read_symbols. Merge processor specific flags and attributes from a regular object only when we have determined that it is aapropriate. Do not create an .ARM.attributes section in output if there is no regular input object. (Target_arm::merge_processor_specific_flags): Check --warn-mismatch before printing any error. (Target_arm::merge_object_attributes): Ditto. * gold.cc (queue_middle_tasks): Handle the case in which there is no regular object in input. * options.cc (General_options::parse_EB): New method. (General_options::parse_EL): Same. (General_options::General_options): Initialize endianness_. * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch): New options. (General_options::Endianness): New enum. (General_options::endianness): New method. (General_options::endianness_): New data member. * parameters.cc (Parameters::set_options): Check target endianness. (Parameters::set_target_once): Ditto. (Parameters::check_target_endianness): New method. (parameters_force_valid_target): If either -EL or -EB is specified, use it to define endianness of default target. * parameters.h (Parameters::check_target_endianness): New method declaration. * target.h (class Target): Change "endianity" to "endianness" in comments.
2010-03-222010-03-22 Rafael Espindola <espindola@google.com>Rafael Ávila de Espíndola1-3/+49
* 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-02-272010-02-26 Doug Kwan <dougkwan@google.com>Doug Kwan1-1/+2
* arm.cc (Target_arm::scan_reloc_for_stub): Move code handling R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs. (Target_arm::scan_reloc_section_for_stubs): Instead of calling scan_reloc_for_stub, do all processing of R_ARM_V4BX here. * options.cc (General_options::General_options): Initialize member fix_v4bx_. * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout and rm_no_fix_v4bx.stdout (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o, arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking, arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules. (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking and arm_no_fix_v4bx. * Makefile.in: Regenerate. * testsuite/arm_fix_v4bx.s: New file. * testsuite/arm_fix_v4bx.sh: Ditto.
2010-01-222010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>Doug Kwan1-0/+14
* gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of Fix_v4bx enum values . * gold/options.h (General_options): New option definitions. (General_options::fix_v4bx): New method. (General_options::Fix_v4bx): New enum. * gold/options.cc (General_options::parse_fix_v4bx): New method. (General_options::parse_fix_v4bx_interworking): New method.
2010-01-06 PR 10980Ian Lance Taylor1-3/+68
* options.cc (General_options::parse_section_start): New function. (General_options::section_start): New function. (General_options::General_options): Initialize all members. * options.h: Include <map> (class General_options): Add --section-start. Add section_starts_ member. * layout.cc (Layout::attach_allocated_section_to_segment): If --section-start was used, set the address of the segment. Remove local sort_sections. (Layout::relaxation_loop_body): If the address of the load segment has been set by --section-start, don't use it. * output.h (Output_segment::update_flags_for_output_section): New function. * output.cc (Output_segment::add_output_section): Call update_flags_for_output_section.
2009-12-30 PR 10861Ian Lance Taylor1-0/+11
* script.h (class Version_script_info): Define Language enum. Update declarations. Define Glob, Exact, and Lookup types. Add new fields globals_, locals_, and is_finalized_. * script.cc: Various formatting fixes. (class Parser_closure): Change language_stack_ from a vector of std::string to one of Version_script_info::Language. Adjust all uses accordingly. (class Lazy_demangler): Remove. (struct Version_expression): Change language from std::string to Version_script_info::Language. (Version_script_info::Version_script_info): New function. (Version_script_info::~Version_script_info): Don't call clear. (Version_script_info::finalize): New function. (Version_script_info::build_lookup_tables): New function. (Version_script_info::build_expression_list_lookup): New function. (Version_script_info::get_symbol_version_helper): Rewrite to use lookup tables. (Version_script_info::print_expression_list): Adjust to use Version_script_info::Language. (script_push_lex_into_version_mode): Check that the version script has not been finalized. (version_script_push_lang): Change language string to Version_script_info::Language. * options.cc (Command_line::version_script): New function. * options.h (class General_options): Add finalize_dynamic_list function. Change version_script from declaration to definition. * testsuite/ver_test_4.script: Remove duplicate def of t2_2. * testsuite/version_script.map: Remove duplicate def of foo. * testsuite/Makefile.am (ver_matching_def.so): Depend upon version_script.map. * testsuite/Makefile.in: Rebuild.
2009-12-29* options.cc (General_options::parse_version): Allow -v to exitSriraman Tallam1-0/+1
without an error if there is nothing to link.
2009-12-222009-12-21 Sriraman Tallam <tmsriram@google.com>Sriraman Tallam1-2/+4
* options.cc (General_options::parse_version): Make -v continue and do the link like GNU ld does.
2009-10-14 Add support for -pie.Ian Lance Taylor1-2/+9
* options.h (class General_options): Add -pie and --pic-executable. (General_options::output_is_position_independent): Test -pie. (General_options::output_is_executable): Return true if not shared and not relocatable. (General_options::output_is_pie): Remove. * options.cc (General_options::finalize): Reject incompatible uses of -pie. * gold.cc (queue_middle_tasks): A -pie link is not static. * symtab.h (Symbol::needs_plt_entry): Return false if -pie. * symtab.cc (Symbol::final_value_is_known): Return false if output_is_position_independent. * layout.cc (Layout::set_segment_offsets): Start at address 0 if output_is_position_independent. * output.cc (Output_file_header::do_sized_write): Use ET_DYN if output_is_position_independent. * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if output_is_position_independent. * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and two_file_pie_test. (basic_pie_test.o, basic_pie_test): New targets. (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets. (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets. (two_file_pie_test): New target. * testsuite/Makefile.in: Rebuild. * README: Remove note saying that -pie is not supported.
2009-10-13 * gc.h (gc_process_relocs): Check if icf is enabled using newSriraman Tallam1-0/+9
function. * gold.cc (queue_initial_tasks): Likewise. (queue_middle_tasks): Likewise. * object.cc (do_layout): Likewise. * symtab.cc (is_section_folded): Likewise. * main.cc (main): Likewise. * reloc.cc (Read_relocs::run): Likewise. (Sized_relobj::do_scan_relocs): Likewise. * icf.cc (is_function_ctor_or_dtor): New function. (Icf::find_identical_sections): Check if function is ctor or dtor when safe icf is chosen. * options.h (General_options::icf): Change option to be an enum. (Icf_status): New enum. (icf_enabled): New method. (icf_safe_folding): New method. (set_icf_status): New method. (icf_status_): New variable. * (options.cc) (General_options::finalize): Set icf_status_. * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify icf_test and icf_keep_unique_test to use the --icf enum flag. * testsuite/icf_safe_test.sh: New file. * testsuite/icf_safe_test.cc: New file.
2009-10-102009-10-10 Chris Demetriou <cgd@google.com>Chris Demetriou1-4/+18
* options.h (Input_file_argument::Input_file_type): New enum. (Input_file_argument::is_lib_): Replace with... (Input_file_argument::type_): New member. (Input_file_argument::Input_file_argument): Take Input_file_type 'type' rather than boolean 'is_lib' as second argument. (Input_file_argument::is_lib): Use type_. (Input_file_argument::is_searched_file): New function. (Input_file_argument::may_need_search): Handle is_searched_file. * options.cc (General_options::parse_library): Support -l:filename. (General_options::parse_just_symbols): Update for Input_file_argument changes. (Command_line::process): Likewise. * archive.cc (Archive::get_file_and_offset): Likewise. * plugin.cc (Plugin_manager::release_input_file): Likewise. * script.cc (read_script_file, script_add_file): Likewise. * fileread.cc (Input_file::Input_file): Likewise. (Input_file::will_search_for): Handle is_searched_file. (Input_file::open): Likewise. * readsyms.cc (Read_symbols::get_name): Likewise. * testsuite/Makefile.am (searched_file_test): New test. * testsuite/Makefile.in: Regenerate. * testsuite/searched_file_test.cc: New file. * testsuite/searched_file_test_lib.cc: New file.
2009-10-092009-10-09 Doug Kwan <dougkwan@google.com>Doug Kwan1-0/+10
* layout.cc (Layout::make_output_section): Call target hook to make ordinary output section. (Layout::finalize): Adjust parameter list of call the Target::may_relax(). * layout.h (class Layout::section_list): New method. * merge.h (Output_merge_base::entsize): Change visibility to public. (Output_merge_base::is_string, Output_merge_base::do_is_string): New methods. (Output_merge_string::do_is_string): New method. * object.cc (Sized_relobj::do_setup): renamed from Sized_relobj::set_up. * object.h (Sized_relobj::adjust_shndx, Sized_relobj::initializ_input_to_output_maps, Sized_relobj::free_input_to_output_maps): Change visibilities to protected. (Sized_relobj::setup): Virtualize. (Sized_relobj::do_setup): New method declaration. (Sized_relobj::invalidate_section_offset, Sized_relobj::do_invalidate_section_offset): New method decfinitions. (Sized_relobj::elf_file, Sized_relobj::local_values): New methods. * options.cc (parse_int): New function. * options.h (parse_int): New declaration. (DEFINE_int): New macro. (stub_group_size): New option. * output.cc (Output_section::Output_section): Initialize memebers merge_section_map_, merge_section_by_properties_map_, relaxed_input_section_map_, is_relaxed_input_section_map_valid_. (Output_section::add_input_section): Handled deferred code-fill generation and remove an old comment. (Output_section::add_relaxed_input_section): New method definition. (Output_section::add_merge_input_section): Use merge section by properties map to speed to search. Update merge section maps as appropriate. (Output_section::build_relaxation_map): New method definition. (Output_section::convert_input_sections_in_list_to_relaxed_sections): Same. (Output_section::relax_input_section): Renamed to Output_section::convert_input_sections_to_relaxed_sections and change interface to take a vector of pointers to relaxed sections. (Output_section::find_merge_section, Output_section::find_relaxed_input_section): New method definitions. (Output_section::is_input_address_mapped, Output_section::output_offset, Output_section::output_address): Use output section data maps to speed up searching. (Output_section::find_starting_output_address): Add comments. (Output_section::do_write, Output_section::write_to_postprocessing_buffer): Do code-fill generation as appropriate. (Output_section::get_input_sections): Invalidate relaxed input section map. (Output_section::restore_states): Adjust type of checkpoint . Invalidate relaxed input section map. * output.h (Output_merge_base): New class declaration. (Input_section_specifier): New class defintion. (class Output_relaxed_input_section) Change base class to Output_section_data_build. (Output_relaxed_input_section::Output_relaxed_input_section): Adjust base class initializer. (Output_section::add_relaxed_input_section): New method declaration. (Output_section::Input_section): Change visibility to protected. (Output_section::Input_section::relobj, Output_section::Input_section::shndx): Handle relaxed input sections. Output_section::input_sections) Change visibility to protected. Also define overload to return a non-const pointer. (Output_section::Merge_section_properties): New class defintion. (Output_section::Merge_section_by_properties_map, Output_section::Output_section_data_by_input_section_map, Output_section::Relaxation_map): New types. (Output_section::relax_input_section): Rename method to Output_section::convert_input_sections_to_relaxed_sections and change interface to take a vector of relaxed section pointers. (Output_section::find_merge_section, Output_section::find_relaxed_input_section, Output_section::build_relaxation_map, Output_section::convert_input_sections_in_list_to_relaxed_sections): New method declarations. (Output_section::merge_section_map_ Output_section::merge_section_by_properties_map_, Output_section::relaxed_input_section_map_, Output_section::is_relaxed_input_section_map_valid_, Output_section::generate_code_fills_at_write_): New data members. * script-sections.cc (Output_section_element_input::set_section_addresses): Call current_data_size and addralign methods of relaxed input sections. (Orphan_output_section::set_section_addresses): Call current_data_size and addralign methods of relaxed input sections. * symtab.cc (Symbol_table::compute_final_value): Extract template from the body of Symbol_table::sized_finalize_symbol. (Symbol_table::sized_finalized_symbol): Call Symbol_table::compute_final_value. * symtab.h (Symbol_table::Compute_final_value_status): New enum type. (Symbol_table::compute_final_value): New templated method declaration. * target.cc (Target::do_make_output_section): New method defintion. * target.h (Target::make_output_section): New method declaration. (Target::relax): Add more parameters for input objects, symbol table and layout. Adjust call to do_relax. (Target::do_make_output_section): New method declaration. (Target::do_relax): Add parameters for input objects, symbol table and layout.