* layout.cc (gdb_sections): Remove ".debug_" prefixes,
add .debug_macro.
(lines_only_debug_sections): Likewise.
(gdb_fast_lookup_sections): New static array.
(is_gdb_debug_section): Rename formal parameter.
(is_lines_only_debug_section): Likewise.
(is_gdb_fast_lookup_section): New function.
(Layout::include_section): Check for ".zdebug_" prefix; pass
section name suffix to is_gdb_debug_section, et al.; check for
fast-lookup sections when building .gdb_index.
* options.h (--strip-debug-gdb): Update GDB version number.
* Makefile.am: Add gdb-index.cc, gdb-index.h.
* Makefile.in: Regenerate.
* dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
(Sized_elf_reloc_mapper::symbol_section): New function.
(Sized_elf_reloc_mapper::do_get_reloc_target): New function.
(make_elf_reloc_mapper): New function.
(Dwarf_abbrev_table::clear_abbrev_codes): New function.
(Dwarf_abbrev_table::do_read_abbrevs): New function.
(Dwarf_abbrev_table::do_get_abbrev): New function.
(Dwarf_ranges_table::read_ranges_table): New function.
(Dwarf_ranges_table::read_range_list): New function.
(Dwarf_pubnames_table::read_section): New function.
(Dwarf_pubnames_table::read_header): New function.
(Dwarf_pubnames_table::next_name): New function.
(Dwarf_die::Dwarf_die): New function.
(Dwarf_die::read_attributes): New function.
(Dwarf_die::skip_attributes): New function.
(Dwarf_die::set_name): New function.
(Dwarf_die::set_linkage_name): New function.
(Dwarf_die::attribute): New function.
(Dwarf_die::string_attribute): New function.
(Dwarf_die::int_attribute): New function.
(Dwarf_die::uint_attribute): New function.
(Dwarf_die::ref_attribute): New function.
(Dwarf_die::child_offset): New function.
(Dwarf_die::sibling_offset): New function.
(Dwarf_info_reader::check_buffer): New function.
(Dwarf_info_reader::parse): New function.
(Dwarf_info_reader::do_parse): New function.
(Dwarf_info_reader::do_read_string_table): New function.
(Dwarf_info_reader::lookup_reloc): New function.
(Dwarf_info_reader::get_string): New function.
(Dwarf_info_reader::visit_compilation_unit): New function.
(Dwarf_info_reader::visit_type_unit): New function.
(Sized_dwarf_line_info::Sized_dwarf_line_info): Use
Sized_elf_reloc_mapper.
(Sized_dwarf_line_info::symbol_section): Remove function.
(Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
(Sized_dwarf_line_info::read_line_mappings): Remove object
parameter, adjust callers.
(Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
* dwarf_reader.h: Include <sys/types.h>.
(class Track_relocs): Remove forward declaration.
(class Elf_reloc_mapper): New class.
(class Sized_elf_reloc_mapper): New class.
(class Dwarf_abbrev_table): New class.
(class Dwarf_range_list): New class.
(class Dwarf_ranges_table): New class.
(class Dwarf_pubnames_table): New class.
(class Dwarf_die): New class.
(class Dwarf_info_reader): New class.
(Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
(Sized_dwarf_line_info::symbol_section): Remove member function.
* dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
base class.
* gdb-index.cc: New source file.
* gdb-index.h: New source file.
* incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
and .debug_types sections, call Layout::add_to_gdb_index.
(Sized_relobj_incr::do_section_name): Implement.
(Sized_relobj_incr::do_section_contents): Adjust parameter list and
return type; Implement.
(Sized_incr_dynobj::do_section_contents): Adjust parameter list and
return type.
* incremental.h (Sized_relobj_incr::do_section_contents): Adjust
parameter list and return type.
(Sized_incr_dynobj::do_section_contents): Likewise.
* layout.cc: Include gdb-index.h.
(Layout::Layout): Initialize gdb_index_data_.
(Layout::init_fixed_output_section): Check for .gdb_index section.
(Layout::add_to_gdb_index): New function. Instantiate.
* layout.h: Add forward declaration for class Gdb_index.
(Layout::add_to_gdb_index): New member function.
(Layout::gdb_index_data_): New data member.
* main.cc: Include gdb-index.h.
(main): Print statistics for gdb index.
* object.cc (Object::section_contents): Move code into
do_section_contents.
(need_decompressed_section): Check for sections needed when building
gdb index.
(build_compressed_section_map): Likewise.
(Sized_relobj_file::do_read_symbols): Need local symbols when building
gdb index.
(Sized_relobj_file::do_layout): Track .debug_info and .debug_types
sections; call Layout::add_to_gdb_index.
(Sized_relobj_file::do_decompressed_section_contents): Call
do_section_contents directly.
* object.h (Object::do_section_contents): Adjust parameter list and
return type.
(Object::do_decompressed_section_contents): Call do_section_contents
directly.
(Sized_relobj_file::do_section_contents): Adjust parameter list and
return type.
* options.h (class General_options): Add --gdb-index option.
* plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
list and return type.
* plugin.h (Sized_pluginobj::do_section_contents): Likewise.
* reloc.h (Track_relocs::checkpoint): New function.
(Track_relocs::reset): New function.
* testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
New test cases.
* testsuite/Makefile.in: Regenerate.
* testsuite/gdb_index_test.cc: New test source file.
* testsuite/gdb_index_test_1.sh: New test source file.
* testsuite/gdb_index_test_2.sh: New test source file.
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.
we are working around the ARM1176 Erratum.
* options.h (General_options::fix_arm1176): Add option.
* testsuite/Makefile.am: Add testcases, and keep current ones
working.
* testsuite/Makefile.in: Regenerate.
* testsuite/arm_fix_1176.s: New file.
* testsuite/arm_fix_1176.sh: Likewise.
* layout.cc (Layout::segment_precedes): Don't assert failure if a
--section-start option was seen.
* options.h (General_options::any_section_start): New function.
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.
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.
--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.
* 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.
* options.h (class General_options): Add
--ld-generated-unwind-info.
* ehframe.cc (Fde::write): Add address parameter. Change all
callers. If associated with PLT, fill in address and size.
(Cie::set_output_offset): Only add merge mapping if there is an
object.
(Cie::write): Add address parameter. Change all callers.
(Eh_frame::add_ehframe_for_plt): New function.
* ehframe.h (class Fde): Update declarations. Move shndx_ and
input_offset_ fields into union u_, with new plt field.
(Fde::Fde): Adjust for new union field.
(Fde::Fde) [Output_data version]: New constructor.
(Fde::add_mapping): Only add merge mapping if there is an object.
(class Cie): Update declarations.
(class Eh_frame): Declare add_ehframe_for_plt.
* layout.cc (Layout::layout_eh_frame): Break out code into
make_eh_frame_section, and call it.
(Layout::make_eh_frame_section): New function.
(Layout::add_eh_frame_for_plt): New function.
* layout.h (class Layout): Update declarations.
* merge.cc (Merge_map::add_mapping): Add assertion.
* i386.cc: Include "dwarf.h".
(class Output_data_plt_i386): Make first_plt_entry,
dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
and plt_eh_frame_fde.
(Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
boundary. Call add_eh_frame_for_plt if appropriate.
* x86_64.cc: Include "dwarf.h".
(class Output_data_plt_x86_64): Align to 16-byte boundary. Make
first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
and plt_eh_frame_fde.
(Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
appropriate.
* 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.
* options.h (class General_options): Add --ctors-in-init-array.
* layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
friends as SHT_PROGBITS for merging sections.
(Layout::layout): Remove special handling of .init_array and
friends. Don't sort if doing relocatable link. Sort for .ctors
and .dtors if ctors_in_init_array.
(Layout::make_output_section): Force correct section types for
.init_array and friends. Don't sort if doing relocatable link,
Don't sort .ctors and .dtors if ctors_in_init_array.
(Layout::section_name_mapping): Remove .ctors. and .dtorso.
(Layout::output_section_name): Add relobj parameter. Change all
callers. Handle .ctors. and .dtors. in code rather than table.
Handle .ctors and .dtors if ctors_in_init_array.
(Layout::match_file_name): New function, moved from output.cc.
* layout.h (class Layout): Update declarations.
* output.cc: Include "layout.h".
(Input_section_sort_entry::get_priority): New function.
(Input_section_sort_entry::match_file_name): Just call
Layout::match_file_name.
(Output_section::Input_section_sort_init_fini_compare::operator()):
Handle .ctors and .dtors. Sort by explicit priority rather than
by name.
* configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
* testsuite/initpri2.c: New test.
* testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
(check_PROGRAMS): Add initpri2.
(initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
(initpri2_LDFLAGS, initpri2_LDADD): New variables.
* configure, testsuite/Makefile.in: Rebuild.
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.
(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.
(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.
* layout.cc (Layout::attach_allocated_section_to_segment): Don't put
sections with different PF_X flags in the same segment.
(Layout::find_first_load_seg): Search all segments to find the first
one.
* options.h (rosegment): New.
* layout.cc (Layout::layout): Pass this pointer to add_input_section.
(Layout::layout_eh_frame): Ditto.
(Layout::find_section_order_index): New method.
(Layout::read_layout_from_file): New method.
* layout.h (Layout::find_section_order_index): New method.
(Layout::read_layout_from_file): New method.
(Layout::input_section_position_): New private member.
(Layout::input_section_glob_): New private member.
* main.cc (main): Call read_layout_from_file here.
* options.h (--section-ordering-file): New option.
* output.cc (Output_section::input_section_order_specified_): New
member.
(Output_section::Output_section): Initialize new member.
(Output_section::add_input_section): Add new parameter.
Keep input sections when --section-ordering-file is used.
(Output_section::set_final_data_size): Sort input sections when
section ordering file is specified.
(Output_section::Input_section_sort_entry): Add new parameter.
Check sorting type.
(Output_section::Input_section_sort_entry::compare_section_ordering):
New method.
(Output_section::Input_section_sort_compare::operator()): Change to
consider section_order_index.
(Output_section::Input_section_sort_init_fini_compare::operator()):
Change to consider section_order_index.
(Output_section::Input_section_sort_section_order_index_compare
::operator()): New method.
(Output_section::sort_attached_input_sections): Change to sort
according to section order when specified.
(Output_section::add_input_section<32, true>): Add new parameter.
(Output_section::add_input_section<64, true>): Add new parameter.
(Output_section::add_input_section<32, false>): Add new parameter.
(Output_section::add_input_section<64, false>): Add new parameter.
* output.h (Output_section::add_input_section): Add new parameter.
(Output_section::input_section_order_specified): New
method.
(Output_section::set_input_section_order_specified): New method.
(Input_section::Input_section): Initialize section_order_index_.
(Input_section::section_order_index): New method.
(Input_section::set_section_order_index): New method.
(Input_section::section_order_index_): New member.
(Input_section::Input_section_sort_section_order_index_compare): New
struct.
(Output_section::input_section_order_specified_): New member.
* script-sections.cc (is_wildcard_string): Delete and move modified
method to gold.h.
(Output_section_element_input::Output_section_element_input): Modify
call to is_wildcard_string.
(Output_section_element_input::Input_section_pattern
::Input_section_pattern): Ditto.
(Output_section_element_input::Output_section_element_input): Ditto.
* testsuite/Makefile.am (final_layout): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/final_layout.cc: New file.
* testsuite/final_layout.sh: New file.
* emultempl/armelf.em (merge_exidx_entries): New variable.
(OPTION_NO_MERGE_EXIDX_ENTRIES): New definition.
("no-merge-exidx-entries"): New option.
* ld.texinfo (merge-exidx-entries): Document this option.
2010-04-15 Andrew Haley <aph@redhat.com>
* bfd-in.h (elf32_arm_fix_exidx_coverage): Add new flag:
merge_exidx_entries.
* bfd-in2.h: Likewise.
* elf32-arm.c (elf32_arm_fix_exidx_coverage): Likewise. Use it to
control merging of exidx entries.
2010-04-15 Andrew Haley <aph@redhat.com>
* options.h (merge_exidx_entries): New option.
* arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
(class Arm_exidx_fixup::merge_exidx_entries_): New member.
(Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
(Target_arm::merge_exidx_entries): New function.
(process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
(Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
to Arm_exidx_fixup constructor.
Add new arg, merge_exidx_entries.
(Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
Arm_output_section::fix_exidx_coverage.
* 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.
(File_read::open[1]): Remove initial mapping of whole_file_view_.
(File_read::open[2]): Add whole_file_view_ to list of views.
(File_read::make_view): Remove test of whole_file_view_.
(File_read::find_or_make_view): Create whole_file_view_ if
necessary.
(File_read::clear_views): Replace bool parameter with enum;
adjust all callers. Don't delete views with permanent data;
do delete cached views and views from archives if
--no-keep-files-mapped is set. Set whole_file_view_ to NULL
if clearing the corresponding view.
* fileread.h (File_read::Clear_views_mode): New enum.
(File_read::View::is_permanent_view): New method.
(File_read::clear_views): Replace bool parameter
with enum; adjust all callers.
* options.h (General_options): Change keep_files_mapped option;
add map_whole_files.
* readsyms.cc (Add_symbols::run): Delete sd_ object before
releasing the file.
* reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
the file.
* arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
(Scan::global_reloc_may_be_function_pointer): New function.
* sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
(Scan::global_reloc_may_be_function_pointer): New function.
* powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
(Scan::global_reloc_may_be_function_pointer): New function.
* i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
(Scan::global_reloc_may_be_function_pointer): New function.
* x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
(Scan::global_reloc_may_be_function_pointer): New function.
(Scan::possible_function_pointer_reloc): New function.
(Target_x86_64::can_check_for_function_pointers): New function.
* gc.h (gc_process_relocs): Scan relocation types to determine if
function pointers were taken for targets that support it.
* icf.cc (Icf::find_identical_sections): Include functions for
folding in safe ICF whose pointer is not taken.
* icf.h (Secn_fptr_taken_set): New typedef.
(fptr_section_id_): New member.
(section_has_function_pointers): New function.
(set_section_has_function_pointers): New function.
(check_section_for_function_pointers): New function.
* options.h: Fix comment for safe ICF option.
* target.h (can_check_for_function_pointers): New function.
* testsuite/Makefile.am: Add icf_safe_so_test test case.
Modify icf_safe_test for X86-64.
* testsuite/Makefile.in: Regenerate.
* testsuite/icf_safe_so_test.cc: New file.
* testsuite/icf_safe_so_test.sh: New file.
* testsuite/icf_safe_test.cc (kept_func_3): New function.
(main): Change to take pointer to function kept_func_3.
* testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
folding is done correctly for X86-64.
* 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.
* arm.cc (map, utility): Include headers.
(Target_arm::apply_cortex_a8_workaround): New method.
(Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
(Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
(Target_arm::Scan::global): R_ARM_THM_JUMP19.
(Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
the --[no-]fix-cortex-a8 command line options.
(Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
(Target_arm::relocate_stub): Use addend in instruction template.
* options.h (DEFINE_bool): Set the user-set flag.
(General_options): Add --[no-]-fix-cortex options.
* output.cc (Output_section::convert_input_sections_to_relaxed_sections)
: Update fast look-up map after conversion.
* 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.
* options.h (class General_options): Add
--allow-multiple-definition and -z muldefs.
* resolve.cc (Symbol_table::should_override): Don't warn about a
multiple symbol definition if --allow-multiple-definition or -z
muldefs.