gold/
* object.cc (Sized_relobj_file::Sized_relobj_file): Initialize
output_views_.
* object.h (Object::get_output_view): New function.
(Object::do_get_output_view): New function.
(Sized_relobj_file::do_get_output_view): New function.
(Sized_relobj_file::output_views_): New data member.
* reloc.cc: (Sized_relobj_file::do_relocate): Store pointer to
output views in class object.
(Sized_relobj_file::do_get_output_view): New function.
gold/
* object.cc (Sized_relobj::do_for_all_local_got_entries): Use
Local_got_entry_key for searching in local_got_offsets_.
* object.h (class Local_got_entry_key): New class.
(Relobj::local_has_got_offset): New overloaded method.
(Relobj::local_got_offset): Likewise.
(Relobj::set_local_got_offset): Likewise.
(Relobj::do_local_has_got_offset): Add addend argument.
(Relobj::do_local_got_offset): Likewise.
(Relobj::do_set_local_got_offset): Likewise.
(Sized_relobj::do_local_has_got_offset): Add addend argument, and use
Local_got_entry_key for searching through local_got_offsets_.
(Sized_relobj::do_local_got_offset): Likewise.
(Sized_relobj::do_set_local_got_offset): Likewise.
(Sized_relobj::Local_got_offsets): Change type of the key from
unsigned int to Local_got_entry_key, and add hash and equal_to.
* output.cc (Got_entry::write): Take addend into account for
calculating value of the local symbol for GOT.
(Output_data_got::add_local): New definition of overloaded method.
(Output_data_got::add_local_with_rel): Likewise.
(Output_data_got::add_local_pair_with_rel): Likewise.
* output.h (Output_data_got::add_local): New declaration of overloaded
method.
When a shared library is listed twice on the command line, the linker
ignores the second mention. If the first mention is in the scope of
an --as-needed option, and the second one is under the scope of a
--no-as-needed option, the --no-as-needed should take effect, but
doesn't. This patch keeps track of the objects we've already seen,
and updates the --as-needed flag so that if a shared object is ever
seen with --no-as-needed, it will be marked as such.
gold/
PR gold/18859
* object.cc (Input_objects::add_object): Store objects in a map,
indexed by soname; update as-needed flag when necessary.
* object.h (Object::clear_as_needed): New method.
(Input_objects::so_names_): Change from set to map.
This patch adds SHF_COMPRESSED section decompression to gold.
PR gold/18321
* compressed_output.h (decompress_input_section): Add arguments
for ELF class, big endian and sh_flags.
* compressed_output.cc (decompress_input_section): Likewise.
Support the SHF_COMPRESSED section.
* dynobj.h (Dynobj): Add elfsize and is_big_endian member
functions.
* plugin.h (Pluginobj): Likewise.
* layout.cc (Layout::get_output_section_flags): Also clear the
SHF_COMPRESSED bit.
* object.h (Compressed_section_info): Add flag to store sh_flags.
(Object): Add pure virtual elfsize and is_big_endian member
functions.
* object.cc (need_decompressed_section): Don't skip the ".zdebug"
prefix here.
(build_compressed_section_map): Check SHF_COMPRESSED for
uncompressed size. Store sh_flags in Compressed_section_info.
Pass size, big_endian and sh_flags to decompress_input_section.
Skip the ".debug"/".zdebug" prefix when passing section name to
need_decompressed_section.
(Sized_relobj_file<size, big_endian>::do_find_special_section):
Don't check ".zdebug_*" sections.
(Object::decompressed_section_contents): Pass ELF class, big
endian and sh_flags to decompress_input_section.
* reloc.cc (Sized_relobj_file<size, big_endian>::write_sections):
Likewise.
* testsuite/Makefile.am (check_DATA): Add
debug_msg_cdebug_gabi.err and gdb_index_test_2_gabi.stdout.
(MOSTLYCLEANFILES): Add debug_msg_cdebug_gabi.err and
gdb_index_test_2_gabi.stdout.
(debug_msg_cdebug_gabi.o): New.
(odr_violation1_cdebug_gabi.o): Likewise.
(odr_violation2_cdebug_gabi.o): Likewise.
(debug_msg_cdebug_gabi.err): Likewise.
(check_SCRIPTS): Add gdb_index_test_2_gabi.sh.
(gdb_index_test_cdebug_gabi.o): Likewise.
(gdb_index_test_2_gabi): Likewise.
(gdb_index_test_2_gabi.stdout): Likewise.
* testsuite/gdb_index_test_2_gabi.sh: New file.
* testsuite/Makefile.in: Regenerated.
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.
Now that Input_merge_map has an Output_section_data, we can use it in
implementing find_merge_section and replace the only use of is_merge_section_for
with it.
This patch adds support for reading compressed debug info in
shared objects. It actually simplifies things, by moving the
support for compressed sections all the way up to the top-level
Object class, eliminating the need for several virtual methods.
gold/
* dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
(Sized_relobj_dwo::setup): Build compressed section map.
(Sized_relobj_dwo::do_decompressed_section_contents): Delete.
* dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
section map.
* object.cc (Sized_relobj_file::Sized_relobj_file): Remove
compressed_sections_ field.
(build_compressed_section_map): Take Object instead of
Sized_relobj_file parameter; add decompress_if_needed parameter.
(Sized_relobj_file::do_find_special_sections): Store compressed
section map in parent Object.
(Sized_relobj_file::do_decompressed_section_contents): Move
implementation to Object::decompressed_section_contents.
(Sized_relobj_file::do_discard_decompressed_sections): Move
implementation to Object::discard_decompressed_sections.
* object.h (build_compressed_section_map): Declare.
(Object::Object): Add compressed_sections_ field.
(Object::section_is_compressed): Move implementation here.
(Object::decompressed_section_contents): De-virtualize.
(Object::discard_decompressed_sections): De-virtualize.
(Object::do_section_is_compressed): Delete.
(Object::do_decompressed_section_contents): Delete.
(Object::set_compressed_sections): New method.
(Object::compressed_sections): New method.
(Object::compressed_sections_): New data member.
(Compressed_section_info, Compressed_section_map): Move to top of file.
(Sized_relobj_file::do_section_is_compressed): Delete.
(Sized_relobj_file::do_decompressed_section_contents): Delete.
(Sized_relobj_file::do_discard_decompressed_sections): Delete.
(Sized_relobj_file::compressed_sections_): Move to Object class.
GCC 4.2 complains:
binutils/gold/object.cc:3261: error: using ‘typename’ outside of template
This patch removes typename. It works with both GCC 4.2 and 4.8.
* output.cc (Relobj::initialize_input_to_output_map<size>):
Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
2015-03-02 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
* ehframe.cc (Cie::set_output_offset): Pass in and use a
Output_section_data instead of a Merge_map.
(Eh_frame::Eh_frame): Don't initialize merge_map_.
(Eh_frame::read_cie): Use add_merge_mapping instead of
Merge_map::add_mapping.
(Eh_frame::read_fde): Ditto.
(Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
(Eh_frame::do_output_offset): Use merge_output_offset istead of
merge_map_->get_output_offset.
(Eh_frame::do_is_merge_section_for): Delete.
* ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
instead of a Merge_map.
(Cie::set_output_offset): Pass in a Output_section_data instead of a
Merge_map.
(Eh_frame::do_is_merge_section_for): Delete.
(Eh_frame::merge_map_): Delete.
* merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
and use a Output_section_data instead of a Merge_map.
(Object_merge_map::add_mapping): Ditto.
(Object_merge_map::get_output_offset): Remove the merge_map argument.
(Object_merge_map::is_merge_section_for): Pass in and use a
Output_section_data instead of a Merge_map.
(Merge_map): Delete.
(Output_merge_base::do_output_offset): Use merge_output_offset instead
of merge_map_.get_output_offset.
(Output_merge_base::do_is_merge_section_for): Delete.
(Output_merge_data::do_add_input_section): Use
object->add_merge_mapping instead of add_mapping.
(Output_merge_string<Char_type>::finalize_merged_data): Ditto.
* merge.h (Merge_map): Delete forward declaration.
(Object_merge_map::add_mapping): Pass in and use a Output_section_data
instead of a Merge_map.
(Object_merge_map::get_output_offset): Remove the merge_map argument.
(Object_merge_map::is_merge_section_for): Pass in and use a
Output_section_data instead of a Merge_map.
(Input_merge_map::Object_merge_map::merge_map): Replace with
output_data.
(Object_merge_map::get_or_make_input_merge_map): Pass in and use a
Output_section_data instead of a Merge_map.
(Merge_map): Delete.
(Output_merge_base::Output_merge_base): Don't initialize merge_map_.
(Output_merge_base::do_is_merge_section_for): Delete.
(Output_merge_base::add_mapping): Delete.
(Output_merge_base::merge_map_): Delete.
* object.cc (Relobj::initialize_input_to_output_map): New.
(Relobj::initialize_input_to_output_map): New.
(Relobj::merge_output_offset): New.
(Relobj::is_merge_section_for): New.
(Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
bits.
* object.h (Relobj::merge_map): Delete.
(initialize_input_to_output_map): New.
(set_merge_map): Delete.
(add_merge_mapping): New.
(merge_output_offset): New.
(is_merge_section_for): New.
* output.cc (Output_section::Input_section::is_merge_section_for):
Use object->is_merge_section_for.
* output.h (Output_section_data::is_merge_section_for): Delete.
(Output_section_data::do_is_merge_section_for): Delete.
* reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
Use object->initialize_input_to_output_map.
(Merged_symbol_value<size>::value_from_output_section): Use
object->merge_output_offset.
When --gc-sections is turned on during an LTO link, the .eh_frame sections
from deferred files are processed before those from the replacement files.
As a result, the section end-cap from crtendS.o is placed ahead of
the .eh_frame data from the replacement files. This patch fixes the bug
by skipping the layout of the deferred sections during GC pass 2.
gold/
PR gold/17639
* object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
(Sized_relobj_file::do_layout): Handle deferred sections properly
during GC pass 1. Don't add reloc sections to deferred list twice.
* object.h (Sized_relobj_file::is_deferred_layout): New function.
(Sized_relobj_file::is_deferred_layout_): New data member.
Gold doesn't handle relocations against the section symbol for a TLS
section correctly. Instead of using the offset of the section relative
to the TLS segment, it uses the address of the actual section. This
patch checks for section symbols for TLS sections, and treats them
the same as TLS symbols.
gold/
PR gold/16773
* object.cc (Sized_relobj_file): Compute value of section symbols
for TLS sections the same as TLS symbols.
* object.cc (Sized_relobj::do_output_section_address): New function.
(Sized_relobj): Instantiate explicitly.
* object.h (Object::output_section_address): New function.
(Object::do_output_section_address): New function.
(Sized_relobj::do_output_section_address): New function.
* powerpc.cc (Target_powerpc::symval_for_branch): Use it.
* object.cc (Sized_relobj_file::get_symbol_location_info): Set
type of enclosing symbol.
(Relocate_info::location): Check symbol type when describing symbol.
* object.h (Symbol_location_info): Remove unused line_number;
add enclosing_symbol_type.
* testsuite/debug_msg.sh: Adjust expected output.
do_adjust_local_symbol): New functions.
* object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
* powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
(Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
and irregular opd entry spacing.
(Powerpc_relobj::do_read_relocs): Add opd size checks.
(Global_symbol_visitor_opd): New functor.
(Target_powerpc::do_finalize_sections): Omit global symbols defined
on deleted opd entries.
segments.
2012-08-24 Sriraman Tallam <tmsriram@google.com>
* gold.cc (queue_middle_tasks): Call layout again when unique
segments for sections is desired.
* layout.cc (Layout::Layout): Initialize new members.
(Layout::get_output_section_flags): New function.
(Layout::choose_output_section): Call get_output_section_flags.
(Layout::layout): Make output section for mapping to a unique segment.
(Layout::insert_section_segment_map): New function.
(Layout::attach_allocated_section_to_segment): Make unique segment for
output sections marked so.
(Layout::segment_precedes): Check for unique segments when sorting.
* layout.h (Layout::Unique_segment_info): New struct.
(Layout::Section_segment_map): New typedef.
(Layout::insert_section_segment_map): New function.
(Layout::get_output_section_flags): New function.
(Layout::is_unique_segment_for_sections_specified): New function.
(Layout::set_unique_segment_for_sections_specified): New function.
(Layout::unique_segment_for_sections_specified_): New member.
(Layout::section_segment_map_): New member.
* object.cc (Sized_relobj_file<size, big_endian>::do_layout):
Rename is_gc_pass_one to is_pass_one.
Rename is_gc_pass_two to is_pass_two.
Rename is_gc_or_icf to is_two_pass.
Check for which pass based on whether symbols data is present.
Make it two pass when unique segments for sections is desired.
* output.cc (Output_section::Output_section): Initialize new
members.
* output.h (Output_section::is_unique_segment): New function.
(Output_section::set_is_unique_segment): New function.
(Output_section::is_unique_segment_): New member.
(Output_section::extra_segment_flags): New function.
(Output_section::set_extra_segment_flags): New function.
(Output_section::extra_segment_flags_): New member.
(Output_section::segment_alignment): New function.
(Output_section::set_segment_alignment): New function.
(Output_section::segment_alignment_): New member.
(Output_segment::Output_segment): Initialize is_unique_segment_.
(Output_segment::is_unique_segment): New function.
(Output_segment::set_is_unique_segment): New function.
(Output_segment::is_unique_segment_): New member.
* plugin.cc (allow_unique_segment_for_sections): New function.
(unique_segment_for_sections): New function.
(Plugin::load): Add new functions to transfer vector.
* Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
* Makefile.in: Regenerate.
* testsuite/plugin_final_layout.sh: Check if unique segment
functionality works.
* testsuite/plugin_section_order.c (onload): Check if new interfaces
are available.
(allow_unique_segment_for_sections): New global.
(unique_segment_for_sections): New global.
(claim_file_hook): Call allow_unique_segment_for_sections.
(all_symbols_read_hook): Call unique_segment_for_sections.
2012-08-24 Sriraman Tallam <tmsriram@google.com>
* plugin-api.h (ld_plugin_allow_unique_segment_for_sections):
New interface.
(ld_plugin_unique_segment_for_sections): New interface.
(LDPT_ALLOW_UNIQUE_SEGMENT_FOR_SECTIONS): New enum val.
(LDPT_UNIQUE_SEGMENT_FOR_SECTIONS): New enum val.
(tv_allow_unique_segment_for_sections): New member.
(tv_unique_segment_for_sections): New member.
* script-sections.cc (Sections_element::output_section_name): Add
keep return parameter.
(Output_section_element::match_name): Add keep return parameter.
Return the value of the keep_ member.
* script-sections.h (class Output_section): Update
output_section_name prototype.
* layout.cc (Layout::keep_input_section): New public member
function.
(Layout::choose_output_section): Pass keep parameter to
output_section_name.
* layout.h (class Layout): Add keep_input_section.
* object.cc (Sized_relobj_file::do_layout): Check for kept input
sections.
* testsuite/Makefile.am: Add a test.
* testsuite/Makefile.in: Regenerate.
* testsuite/pr14265.c: Source file for the test.
* testsuite/pr14265.t: Linker script for the test.
* testsuite/pr14265.sh: Shell script for the test.
* ld-gc/gc.exp: Add a new test.
* ld-gc/pr14265.c: Source file for the new test.
* ld-gc/pr14265.t: Linker script for the new test.
* ld-gc/pr14265.d: Expected symbol dump.
(Sized_relobj_file::find_special_sections): New function.
* object.cc (Sized_relobj_file::find_shdr): New function.
(Sized_relobj_file::find_eh_frame): Use find_shdr.
(Sized_relobj_file::find_special_sections): New function, split out..
(Sized_relobj_file::do_read_symbols): ..from here.
* output.h (Output_data_got::replace_constant): New function.
(Output_data_got::num_entries): New function.
(Output_data_got::last_got_offset,set_got_size): Use num_entries.
(Output_data_got::got_offset): Protected rather than private.
(Output_data_got::replace_got_entry): New function.
* output.cc (Output_data_got::replace_got_entry): New function.
* powerpc.cc (class Powerpc_relobj): New.
(class Powerpc_relocate_functions): Delete all psymval variants or
convert to value,addend type. Delete pcrela, pcrela_unaligned.
Implement _ha functions using corresponding _hi function.
(Powerpc_relobj::find_special_sections): New function.
(Target_powerpc::do_make_elf_object): New function.
(class Output_data_got_powerpc): New.
(class Output_data_glink): New.
(class Powerpc_scan_relocatable_reloc): New.
Many more changes througout file.
* configure: Regenerate.
gold/
* nacl.cc: New file.
* nacl.h: New file.
* Makefile.am (CCFILES, HFILES): Add them.
* Makefile.in: Regenerate.
* i386.cc (Output_data_plt_i386_nacl): New class.
(Output_data_plt_i386_nacl_exec): New class.
(Output_data_plt_i386_nacl_dyn): New class.
(Target_i386_nacl): New class.
(Target_selector_i386_nacl): New class.
(target_selector_i386): Use it instead of Target_selector_i386.
* x86_64.cc (Output_data_plt_x86_64_nacl): New class.
(Target_x86_64_nacl): New class.
(Target_selector_x86_64_nacl): New class.
(target_selector_x86_64, target_selector_x32): Use it instead of
Target_selector_x86_64.
* arm.cc (Output_data_plt_arm_nacl): New class.
(Target_arm_nacl): New class.
(Target_selector_arm_nacl): New class.
(target_selector_arm, target_selector_armbe): Use it instead of
Target_selector_arm.
* target-select.cc (select_target): Take new Input_file* and off_t
arguments, pass them on to recognize method of selector.
* object.cc (make_elf_sized_object): Update caller.
* parameters.cc (parameters_force_valid_target): Likewise.
* incremental.cc (make_sized_incremental_binary): Likewise.
* target-select.h: Update decl.
(Target_selector::recognize): Take new Input_file* argument,
pass it on to do_recognize.
(Target_selector::do_recognize): Take new Input_file* argument.
* freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
* powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
* sparc.cc (Target_selector_sparc::do_recognize): Likewise.
* testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
* target.h (Target::Target_info): New members isolate_execinstr
and rosegment_gap.
(Target::isolate_execinstr, Target::rosegment_gap): New methods.
* arm.cc (Target_arm::arm_info): Update initializer.
* i386.cc (Target_i386::i386_info): Likewise.
* powerpc.cc (Target_powerpc::powerpc_info): Likewise.
* sparc.cc (Target_sparc::sparc_info): Likewise.
* x86_64.cc (Target_x86_64::x86_64_info): Likewise.
* testsuite/testfile.cc (Target_test::test_target_info): Likewise.
* layout.cc (Layout::attach_allocated_section_to_segment):
Take new const Target* argument. If target->isolate_execinstr(), act
like --rosegment.
(Layout::find_first_load_seg): Take new const Target* argument;
if target->isolate_execinstr(), reject PF_X segments.
(Layout::relaxation_loop_body): Update caller.
(Layout::set_segment_offsets): If target->isolate_execinstr(),
reset file offset to zero when we hit LOAD_SEG, and then do a second
loop over the segments before LOAD_SEG to reassign offsets after
addresses have been determined. Handle target->rosegment_gap().
(Layout::attach_section_to_segment): Take new const Target* argument;
pass it to attach_allocated_section_to_segment.
(Layout::make_output_section): Update caller.
(Layout::attach_sections_to_segments): Take new const Target* argument;
pass it to attach_section_to_segment.
* gold.cc (queue_middle_tasks): Update caller.
* layout.h (Layout): Update method decls with new arguments.
* arm.cc (Target_arm::Target_arm): Take optional argument for the
Target_info pointer to use.
(Target_arm::do_make_data_plt): New virtual method.
(Target_arm::make_data_plt): New method that calls it.
(Target_arm::make_plt_entry): Use it.
(Output_data_plt_arm::Output_data_plt_arm): Take additional argument
for the section alignment.
(Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
method.
(Output_data_plt_arm::first_plt_entry_offset): Call it.
(Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
method.
(Output_data_plt_arm::get_plt_entry_size): Call it.
(Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
(Output_data_plt_arm::fill_plt_entry): New method that calls it.
(Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
method.
(Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
(Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
method instead of sizeof(plt_entry).
(Output_data_plt_arm::add_entry): Likewise.
Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
(Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
than static method.
(Target_arm::plt_entry_size): Likewise.
(Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
Move to ...
(Output_data_plt_arm_standard): ... here, new class.
(Output_data_plt_arm::do_write): Move guts of PLT filling to...
(Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
(Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
* x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
Take additional argument for the PLT entry size.
(Output_data_plt_x86_64::get_tlsdesc_plt_offset):
Use get_plt_entry_size method rather than plt_entry_size variable.
(Output_data_plt_x86_64::reserve_slot): Likewise.
(Output_data_plt_x86_64::do_adjust_output_section): Likewise.
(Output_data_plt_x86_64::add_entry): Likewise.
(Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
(Output_data_plt_x86_64::address_for_global): Likewise.
(Output_data_plt_x86_64::address_for_local): Likewise.
(Output_data_plt_x86_64::set_final_data_size): Likewise.
(Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
Make method non-static.
(Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
method.
(Output_data_plt_x86_64::get_plt_entry_size): Just call that.
(Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
(Output_data_plt_x86_64::add_eh_frame): New method to call it.
(Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
virtual method.
(Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
(Output_data_plt_x86_64::do_fill_plt_entry): New abstract
virtual method.
(Output_data_plt_x86_64::fill_plt_entry): New method to call it.
(Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
virtual method.
(Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
(Output_data_plt_x86_64::plt_entry_size)
(Output_data_plt_x86_64::first_plt_entry)
(Output_data_plt_x86_64::plt_entry)
(Output_data_plt_x86_64::tlsdesc_plt_entry)
(Output_data_plt_x86_64::plt_eh_frame_fde_size)
(Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
(Output_data_plt_x86_64_standard): ... here, new class.
(Target_x86_64::Target_x86_64): Take optional argument for the
Target_info pointer to use.
(Target_x86_64::do_make_data_plt): New virtual method.
(Target_x86_64::make_data_plt): New method to call it.
(Target_x86_64::init_got_plt_for_update): Use that.
Call this->plt_->add_eh_frame method here.
(Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
(Target_x86_64::first_plt_entry_offset): Call method on this->plt_
rather than static method.
(Target_x86_64::plt_entry_size): Likewise.
(Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
rather than plt_entry_size variable. Move guts of PLT filling to...
(Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
(Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
(Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
* i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
additional argument for the section alignment.
Don't do add_eh_frame_for_plt here.
(Output_data_plt_i386::first_plt_entry_offset): Make the method
non-static. Use get_plt_entry_size method rather than plt_entry_size
variable.
(Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
method.
(Output_data_plt_i386::get_plt_entry_size): Call it.
(Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
(Output_data_plt_i386::add_eh_frame): New method to call it.
(Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
method.
(Output_data_plt_i386::fill_first_plt_entry): New method to call it.
(Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
method.
(Output_data_plt_i386::fill_plt_entry): New method to call it.
(Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
method instead of plt_entry_size.
(Output_data_plt_i386::plt_entry_size)
(Output_data_plt_i386::plt_eh_frame_fde_size)
(Output_data_plt_i386::plt_eh_frame_fde): Move to ...
(Output_data_plt_i386_standard): ... here, new class.
(Output_data_plt_i386_exec): New class.
(Output_data_plt_i386::exec_first_plt_entry): Move to ...
(Output_data_plt_i386_exec::first_plt_entry): ... here.
(Output_data_plt_i386::exec_plt_entry): Move to ...
(Output_data_plt_i386_exec::plt_entry): ... here.
(Output_data_plt_i386_dyn): New class.
(Output_data_plt_i386::first_plt_entry): Move to ...
(Output_data_plt_i386_dyn::first_plt_entry): ... here.
(Output_data_plt_i386::dyn_plt_entry): Move to ...
(Output_data_plt_i386_dyn::plt_entry): ... here.
(Target_i386::Target_i386): Take optional argument for the Target_info
pointer to use.
(Target_i386::do_make_data_plt): New virtual method.
(Target_i386::make_data_plt): New method to call it.
(Target_i386::make_plt_section): Use that.
Call this->plt_->add_eh_frame method here.
(Output_data_plt_i386::add_entry): Use get_plt_entry_size method
rather than plt_entry_size variable.
(Output_data_plt_i386::add_local_ifunc_entry): Likewise.
(Output_data_plt_i386::address_for_local): Likewise.
(Output_data_plt_i386::do_write): Likewise.
Move guts of PLT filling to...
(Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
(Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
(Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
(Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
Change-Id: Id24b95600489835ff5e860a39c147203d4380c2b
* 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.
Call Object::decompressed_section_contents.
* dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
New dtor.
(Sized_dwarf_line_info::buffer_start_): New data member.
* merge.cc (Output_merge_data::do_add_input_section): Call
Object::decompressed_section_contents.
(Output_merge_string::do_add_input_section): Likewise.
* object.cc (need_decompressed_section): New function.
(build_compressed_section_map): Decompress sections needed later.
(Sized_relobj_file::do_decompressed_section_contents): New function.
(Sized_relobj_file::do_discard_decompressed_sections): New function.
* object.h (Object::decompressed_section_contents): New function.
(Object::discard_decompressed_sections): New function.
(Object::do_decompressed_section_contents): New function.
(Object::do_discard_decompressed_sections): New function.
(Compressed_section_info): New type.
(Compressed_section_map): Include decompressed section contents.
(Sized_relobj_file::do_decompressed_section_contents): New function.
(Sized_relobj_file::do_discard_decompressed_sections): New function.
(Relobj::local_plt_offset): New function.
(Relobj::local_has_got_offset): New function.
(Relobj::local_got_offset): New function.
(Relobj::set_local_got_offset): New function.
(Relobj::do_local_symbol_value): New pure virtual function.
(Relobj::do_local_plt_offset): Likewise.
(Relobj::do_local_has_got_offset): Likewise.
(Relobj::do_local_got_offset): Likewise.
(Relobj::do_set_local_got_offset): Likewise.
(Sized_relobj::do_local_has_got_offset): Rename from
local_has_got_offset.
(Sized_relobj::do_local_got_offset): Rename from local_got_offset.
(Sized_relobj::do_set_local_got_offset): Rename from
set_local_got_offset.
(Sized_relobj_file::do_local_plt_offset): Rename from
local_plt_offset.
(Sized_relobj_file::do_local_symbol_value): New function.
* object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
local_plt_offset.
* output.cc (Output_data_got::Got_entry::write): Change object to
Relobj. Use local_symbol_value.
(Output_data_got::add_global_with_rel): Change rel_dyn to
Output_data_reloc_generic*. Use add_global_generic.
(Output_data_got::add_global_with_rela): Remove. Change all
callers to use add_global_with_rel.
(Output_data_got::add_global_pair_with_rel): Change rel_dyn to
Output_data_reloc_generic*. Use add_global_generic.
(Output_data_got::add_global_pair_with_rela): Remove. Change all
callers to use add_global_pair_with_rel.
(Output_data_got::add_local): Change object to Relobj*.
(Output_data_got::add_local_plt): Likewise.
(Output_data_got::add_local_with_rel): Change object to Relobj*,
change rel_dyn to Output_data_reloc_generic*. Use
add_local_generic.
(Output_data_got::add_local_with_rela): Remove. Change all
callers to use all_local_with_rel.
(Output_data_got::add_local_pair_with_rel): Change object to
Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
add_output_section_generic.
(Output_data_got::add_local_pair_with_rela): Remove. Change all
callers to use add_local_pair_with_rel.
(Output_data_got::reserve_local): Change object to Relobj*.
* output.h: (class Output_data_reloc_generic): Add pure virtual
declarations for add_global_generic, add_local_generic,
add_output_section_generic.
(class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
functions for Output_data_reloc_generic. Update declarations for
changes listed in output.cc.
(class Output_data_got): Change template parameter to got_size.
Don't define Rel_dyn or Rela_dyn. Update declarations per above.
* incremental.h (Sized_relobj_incr::do_local_symbol_value): New
function.
(Sized_relobj_incr::do_local_plt_offset): New function.
* copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
add_global_generic.
segment if -Ttext was specified.
* object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
file type.
* object.h (Sized_relobj_file::e_type): New function.
(Sized_relobj_file::e_type_): New data member.
* symtab.cc (Symbol_table::add_from_relobj): Don't add section
base address for ET_EXEC files.
* target.cc (Target::do_make_elf_object_implementation): Allow
ET_EXEC files with --just-symbols option.
* gold/gold.cc (queue_initial_tasks): Warn if --incremental is
used with --compress-debug-sections.
* gold/object.cc (Sized_relobj_file::do_layout): Report
uncompressed size of compressed input sections.
* incremental.cc (Incremental_inputs::report_input_section): Fix
comment, indentation.
(Incremental_inputs::report_comdat_group): New function.
(Output_section_incremental_inputs::set_final_data_size): Adjust size
of data for incremental input file entry.
(Output_section_incremental_inputs::write_info_blocks): Write COMDAT
group count, COMDAT group signatures.
(Sized_incr_relobj::do_layout): Record kept COMDAT group info from
an unchanged input file.
* incremental.h (Incremental_object_entry::Incremental_object_entry):
Initialize new data member.
(Incremental_object_entry::add_comdat_group): New function.
(Incremental_object_entry::get_comdat_group_count): New function.
(Incremental_object_entry::get_comdat_signature_key): New function.
(Incremental_object_entry::groups_): New data member.
(Incremental_inputs::report_comdat_group): New function.
(Incremental_input_entry_reader::get_symbol_offset): Adjust size of
data for incremental input file entry.
(Incremental_input_entry_reader::get_comdat_group_count): New function.
(Incremental_input_entry_reader::get_input_section): Adjust size of
data for incremental input file entry.
(Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
(Incremental_input_entry_reader::get_comdat_group_signature): New
function.
* object.cc (Sized_relobj::include_section_group): Report kept
COMDAT groups for incremental links.