aboutsummaryrefslogtreecommitdiff
path: root/gold/ehframe.cc
AgeCommit message (Collapse)AuthorFilesLines
2021-01-01Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2020-01-01Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2019-07-13[GOLD] PowerPC notoc eh_frameAlan Modra1-33/+14
When generating notoc call and branch stubs without the benefit of pc-relative insns, the stubs need to use LR to access the run time PC. All LR changes must be described in .eh_frame if we're to support unwinding through asynchronous exceptions. That's what this patch does. The patch has gone through way too many iterations. At first I attempted to add multiple FDEs, one for each stub. That ran into difficulties with do_plt_fde_location which is only capable of setting the address of a single FDE per Output_data section, and with removing any FDEs added on a previous do_relax pass. Removing FDEs (git commit be897fb774) went overboard in matching the FDE contents. That means either stashing the contents created for add_eh_frame_for_plt to use when calling remove_eh_frame_for_plt, or recreating contents on the fly (*) just to remove FDEs. In fact, FDE content matching is quite unnecesary. FDEs added by a previous do_relax pass are those with u_.from_linker.post_map set. So they can easily be recognised just by looking at that flag. This patch keeps that part of the multiple FDE changes. In the end I went for just one FDE per stub group to describe the call stubs. That's reasonably efficient for the common case of only needing to describe the __tls_get_addr_opt call stub. We don't expect to be making many calls using notoc stubs without pc-relative insns. *) Which has it's own set of problems. The contents must be recreated using the old stub layout, but .eh_frame size can affect stub requirements so you need to temporarily keep the old .eh_frame size when creating new stubs, then reset .eh_frame size before adding new FDEs. * ehframe.cc (Fde::operator==): Delete. (Cie::remove_fde): Delete. (Eh_frame::remove_ehframe_for_plt): Delete fde_data and fde_length parameters. Remove all post-map plt FDEs. * ehframe.h (Fde:post_map): Make const, add variant to compare plt. (Fde::operator==): Delete. (Cie::remove_fde): Implement here. (Cie::last_fde): New accessor. (Eh_frame::remove_ehframe_for_plt): Update prototype. * layout.cc (Layout::remove_eh_frame_for_plt): Delete fde_data and fde_length parameters. * layout.h (Layout::remove_eh_frame_for_plt): Update prototype. * powerpc.cc (Stub_table::tls_get_addr_opt_bctrl_): Delete. (Stub_table::plt_fde_len_, plt_fde_, init_plt_fde): Delete. (Stub_table::add_plt_call_entry): Don't set tls_get_addr_opt_bctrl_. (eh_advance): New function. (stub_sort): New function. (Stub_table::add_eh_frame): Emit eh_frame for notoc plt calls and branches as well as __tls_get_addr_opt plt call stub. (Stub_table::remove_eh_frame): Update to suit.
2019-01-01Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2018-01-03Update year range in copyright notice of binutils filesAlan Modra1-1/+1
2017-08-01[GOLD] PowerPC recreate eh_frame for stubs on each relax passAlan Modra1-0/+46
There is a very small but non-zero probability that a stub group contains stubs on one relax pass, but does not on the next. In that case we would get an FDE covering a zero length address range. (Actually, it's even worse. Alignment padding for stubs can mean the address for the non-existent stubs is past the end of the original section to which stubs are attached, and due to the way do_plt_fde_location calculates the length we can get a negative length.) Fixing this properly requires removing the FDE. Also, I have been implementing the __tls_get_addr_opt support for gold, and that stub needs something other than the default FDE. The necessary FDE will depend on the offset to the __tls_get_addr_opt stub, which of course can change during relaxation. That means at the very least, rewriting the FDE on each pass, possibly changing the FDE size. I think that is better done by completely recreating PLT eh_frame FDEs. * ehframe.cc (Fde::operator==): New. (Cie::remove_fde, Eh_frame::remove_ehframe_for_plt): New. * ehframe.h (Fde::operator==): Declare. (Cie::remove_fde, Eh_frame::remove_ehframe_for_plt): Likewise. * layout.cc (Layout::remove_eh_frame_for_plt): New. * layout.h (Layout::remove_eh_frame_for_plt): Declare. * powerpc.cc (Target_powerpc::do_relax): Remove old eh_frame FDEs. (Stub_table::add_eh_frame): Delete eh_frame_added_ condition. Don't add eh_frame for empty stub section. (Stub_table::remove_eh_frame): New.
2017-01-02Update year range in copyright notice of all files.Alan Modra1-1/+1
2016-03-20Fix problem where gold cannot build .eh_frame_hdr from ld -r output.Cary Coutant1-10/+60
When running ld -r on objects that have comdat groups, when gold deduplicates a function in a comdat group, it removes the relocations from the EH information that referred to the dropped copy of the function. When running a final link using the result of the -r link, the missing relocation cause it to fail to recognize the FDE for the dropped function. This patch improves gold's FDE scanning to take into account the possibility that an FDE corresponds to a dropped function, and drops that FDE as well. Gnu ld, on the other hand, leaves the relocations in the ld -r output, but makes them R_NONE with an r_sym field of 0. This was sufficient to let both linkers recognize the FDE properly. With this fix, if you do an ld -r with gold, then do the final link with Gnu ld, the .eh_frame_hdr section will not be generated. To make it work with Gnu ld, we would have to leave the R_NONE relocations in, but I think it's better to drop the relocations entirely. I'd hope that if you're doing a -r link with gold, you'll also do the final link with gold. gold/ PR gold/19002 * ehframe.cc (Eh_frame::read_fde): Check for dropped functions. * testsuite/Makefile.am (eh_test_2): New test. * testsuite/Makefile.in: Regenerate. * testsuite/eh_test_2.sh: New test script. * testsuite/eh_test_a.cc (bar): Make it comdat. * testsuite/eh_test_b.cc (bar): Add a duplicate copy.
2016-02-26Discard FDEs for zero-length address ranges.Cary Coutant1-5/+34
2016-02-26 Egor Kochetov <egor.kochetov@intel.com> Cary Coutant <ccoutant@gmail.com> gold/ PR gold/19735 * ehframe.h (Cie::fde_encoding): New method. * ehframe.cc (Eh_frame::read_fde): Discard FDEs for zero-length address ranges.
2016-01-01Copyright update for binutilsAlan Modra1-1/+1
2015-03-09Fix failure in exception_static_test.Cary Coutant1-9/+9
Because the __EH_FRAME_BEGIN__ symbol is provided in an empty .eh_frame section in crtbeginT.o, if crt1.o has a non-empty .eh_frame section, we place all optimized .eh_frame sections into the output section ahead of the __EH_FRAME_BEGIN__ symbol, which breaks EH for statically-linked binaries. This patch fixes the problem by delaying the attachment of the optimized .eh_frame sections to the output section until we see the end marker section (or to the end of pass 1 if we never see an end marker). gold/ PR gold/14675 * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type; return enum indicating whether .eh_frame section is empty, optimizable, unrecognized, or an end marker. Adjust explicit instantiations. * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type. (Eh_frame::add_ehframe_input_section): Change return type. * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section. * layout.cc (Layout::layout_eh_frame): Don't add optimized sections to the .eh_frame output section until we see the end marker. (Layout::finalize_eh_frame_section): New. * layout.h: (Layout::finalize_eh_frame_section): New.
2015-03-04Remove empty class Merge_map.Rafael Ávila de Espíndola1-21/+12
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.
2015-01-02ChangeLog rotatation and copyright year updateAlan Modra1-1/+1
2014-09-02Fix problem with optimization of .eh_frame section and --sort-section option.Cary Coutant1-23/+32
When --sort-section=name is used, gold will sort the linker-generated contents of .eh_frame (after optimization) after the endcap provided by crtendS.o. This causes two problems: the .eh_frame_hdr section is generated assuming that the optimized .eh_frame contents will be placed at the very beginning of the section, and the endcap no longer appears at the end of the section. This patch fixes the first problem by adjusting FDE offsets to take into account the actual starting offset within the output section, and fixes the second problem by sorting linker-generated (Output_section_data) sections based on the name of the output section. gold/ PR gold/17005 * ehframe.cc (Fde::write): Add output_offset parameter. (Cie::write): Likewise. (Eh_frame::set_final_data_size): Account for offset within output section. (Eh_frame::do_sized_write): Likewise. * ehframe.h (Fde::write): Add output_offset parameter. (Cie::write): Likewise. * output.cc (Output_section::Input_section_sort_entry): Remove section_has_name_; add output_section_name parameter. Use output section name for non-input sections. (Output_section::Input_section_sort_entry::section_has_name): Remove. (Output_section::Input_section_sort_entry::section_has_name_): Remove. (Output_section::Input_section_sort_compare): Remove logic for sections without names. (Output_section::Input_section_sort_init_fini_compare): Likewise. (Output_section::Input_section_sort_section_prefix_special_ordering_compare): Likewise. (Output_section::Input_section_sort_section_name_compare): Likewise.
2014-03-05Update copyright yearsAlan Modra1-1/+1
2013-11-14Revert "Fix race condition while building EH frame header."Cary Coutant1-5/+1
This reverts commit 7cdd7d57e6fa3932eb63aa785ae0e3fa837aab20.
2013-11-14Fix race condition while building EH frame header.Cary Coutant1-1/+5
gold/ PR gold/14860 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_. (Ehframe_hdr::set_final_data_size): Allocate a Lock. * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while updating fde_offsets_. (Eh_frame_hdr::lock_): New data member.
2013-03-07 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather thanAlan Modra1-21/+5
pointer to Post_fde. (struct Post_fde): Move definition to here.. * ehframe.cc (struct Post_fde): ..from here. (Cie::write): Don't alloc Post_fde. (Eh_frame::do_sized_write): Update. Don't free Post_fde.
2013-02-27 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.Alan Modra1-13/+51
* target.cc (Target::do_plt_fde_location): New function. * ehframe.h (class FDE): Add post_map field to u_.from_linker, accessor function, and constructor param. (struct Post_fde, Post_fdes): Declare. (Cie::write): Add post_fdes param. * ehframe.cc (Fde::write): Use plt_fde_location. (struct Post_fde): Define. (Cie::write): Stash FDEs added post merge mapping. (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping. Adjust Fde constructor call. Bump final_data_size_ for post map FDEs. (Eh_frame::do_sized_write): Arrange to write post map FDES after other FDEs. * powerpc.cc (Target_powerpc::do_plt_fde_location): New function. (Target_powerpc::has_glink): New function. (Target_powerpc::do_relax): Add eh_frame info for stubs. (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64, glink_eh_frame_fde_32, default_fde): New data. (Stub_table::eh_frame_added_): New var. (Stub_table::find_long_branch_entry, stub_address, stub_offset): Make const. (Stub_table::add_eh_frame): New function. (Output_data_glink::add_eh_frame): New function. (Target_powerpc::make_glink_section): Call add_eh_frame.
2012-07-11 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.Ian Lance Taylor1-2/+1
(Arm_exidx_cantunwind::do_fixed_endian_write): Likewise. (Target_arm::scan_reloc_for_stub): Likewise. * common.cc (Symbol_table::do_allocate_commons_list): Likewise. * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise. * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise. * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise. * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2011-07-02 PR gold/12525Ian Lance Taylor1-1/+7
* ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel. Assert if we see DW_EH_PE_indirect. * target.h (Target::ehframe_datarel_base): New function. (Target::do_ehframe_datarel_base): New target function. * i386.cc (Target_i386::do_ehframe_datarel_base): New function. * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New function.
2011-07-01 PR gold/12571Ian Lance Taylor1-11/+60
* 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.
2011-05-24 * incremental-dump.cc (dump_incremental_inputs): Print dynamic relocCary Coutant1-8/+8
info; adjust display of GOT entries. * incremental.cc (Sized_incremental_binary::setup_readers): Allocate vector of input objects; remove file_status_. (Sized_incremental_binary::do_reserve_layout): Remove file_status_. (Sized_incremental_binary::do_process_got_plt): Adjust calls to got_plt reader; call target hooks to reserve GOT entries. (Output_section_incremental_inputs::set_final_data_size): Adjust size of input file info header and GOT info entry. (Output_section_incremental_inputs::write_info_blocks): Write dynamic relocation info. (Got_plt_view_info::got_descriptor): Remove. (Got_plt_view_info::sym_index): New data member. (Got_plt_view_info::input_index): New data member. (Local_got_offset_visitor::visit): Write input file index. (Global_got_offset_visitor::visit): Write 0 for input file index. (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor with sym_index and input_index. (Output_section_incremental_inputs::write_got_plt): Adjust size of incremental info GOT entry; replace got_descriptor with input_index. (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record map from input file index to object. (Sized_relobj_incr::do_layout): Replace direct data member reference with accessor function. (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class. * incremental.h (Incremental_input_entry_reader::get_symbol_offset): Adjust size of input file info header. (Incremental_input_entry_reader::get_first_dyn_reloc): New function. (Incremental_input_entry_reader::get_dyn_reloc_count): New function. (Incremental_input_entry_reader::get_input_section): Adjust size of input file info header. (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size of incremental info GOT entry. (Incremental_got_plt_reader::get_got_desc): Remove. (Incremental_got_plt_reader::get_got_symndx): New function. (Incremental_got_plt_reader::get_got_input_index): New function. (Sized_incremental_binary::Sized_incremental_binary): Remove file_status_; add input_objects_. (Sized_incremental_binary::~Sized_incremental_binary): Remove. (Sized_incremental_binary::set_file_is_unchanged): Remove. (Sized_incremental_binary::file_is_unchanged): Remove. (Sized_incremental_binary::set_input_object): New function. (Sized_incremental_binary::input_object): New function. (Sized_incremental_binary::file_status_): Remove. (Sized_incremental_binary::input_objects_): New data member. (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all references. (Sized_relobj_incr::invalid_address): Move to base class. (Sized_relobj_incr::is_output_section_offset_invalid): Move to base class. (Sized_relobj_incr::do_output_section_offset): Likewise. (Sized_relobj_incr::do_for_all_local_got_entries): Likewise. (Sized_relobj_incr::section_offsets_): Likewise. * object.cc (Sized_relobj::do_for_all_local_got_entries): New function. (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_. (Sized_relobj_file::layout_section): Replace refs to section_offsets_ with accessor function. (Sized_relobj_file::do_layout): Likewise. (Sized_relobj_file::do_layout_deferred_sections): Likewise. (Sized_relobj_file::do_for_all_local_got_entries): Move to base class. (Sized_relobj_file::compute_final_local_value): Replace refs to section_offsets_ with accessor function. (Sized_relobj_file::do_finalize_local_symbols): Likewise. * object.h (Relobj::Relobj): Initialize new data members. (Relobj::add_dyn_reloc): New function. (Relobj::first_dyn_reloc): New function. (Relobj::dyn_reloc_count): New function. (Relobj::first_dyn_reloc_): New data member. (Relobj::dyn_reloc_count_): New data member. (Sized_relobj): Rename Sized_relobj_base to this; adjust all references. (Sized_relobj::Address): New typedef. (Sized_relobj::invalid_address): Move here from child class. (Sized_relobj::Sized_relobj): Initialize new data members. (Sized_relobj::sized_relobj): New function. (Sized_relobj::is_output_section_offset_invalid): Move here from child class. (Sized_relobj::get_output_section_offset): Likewise. (Sized_relobj::local_has_got_offset): Likewise. (Sized_relobj::local_got_offset): Likewise. (Sized_relobj::set_local_got_offset): Likewise. (Sized_relobj::do_for_all_local_got_entries): Likewise. (Sized_relobj::clear_got_offsets): New function. (Sized_relobj::section_offsets): Move here from child class. (Sized_relobj::do_output_section_offset): Likewise. (Sized_relobj::do_set_section_offset): Likewise. (Sized_relobj::Local_got_offsets): Likewise. (Sized_relobj::local_got_offsets_): Likewise. (Sized_relobj::section_offsets_): Likewise. (Sized_relobj_file): Rename Sized_relobj to this; adjust all references. (Sized_relobj_file::is_output_section_offset_invalid): Move to base class. (Sized_relobj_file::sized_relobj): New function (Sized_relobj_file::local_has_got_offset): Move to base class. (Sized_relobj_file::local_got_offset): Likewise. (Sized_relobj_file::set_local_got_offset): Likewise. (Sized_relobj_file::get_output_section_offset): Likewise. (Sized_relobj_file::do_for_all_local_got_entries): Likewise. (Sized_relobj_file::do_output_section_offset): Likewise. (Sized_relobj_file::do_set_section_offset): Likewise. (Sized_relobj_file::Local_got_offsets): Likewise. (Sized_relobj_file::local_got_offsets_): Likewise. (Sized_relobj_file::section_offsets_): Likewise. * output.cc (Output_reloc::Output_reloc): Adjust type of relobj (all constructors). (set_needs_dynsym_index): Convert relobj to derived class pointer. (Output_reloc::get_symbol_index): Likewise. (Output_reloc::local_section_offset): Likewise. (Output_reloc::get_address): Likewise. (Output_reloc::symbol_value): Likewise. (Output_data_got::reserve_slot): Move to class definition. (Output_data_got::reserve_local): New function. (Output_data_got::reserve_slot_for_global): Remove. (Output_data_got::reserve_global): New function. * output.h (Output_reloc::Output_reloc): Adjust type of relobj (all constructors, two instantiations). (Output_reloc::get_relobj): New function (two instantiations). (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type. (Output_data_reloc_base::add): Convert relobj to derived class pointer. (Output_data_reloc::add_global): Adjust type of relobj. (Output_data_reloc::add_global_relative): Likewise. (Output_data_reloc::add_symbolless_global_addend): Likewise. (Output_data_reloc::add_local): Likewise. (Output_data_reloc::add_local_relative): Likewise. (Output_data_reloc::add_symbolless_local_addend): Likewise. (Output_data_reloc::add_local_section): Likewise. (Output_data_reloc::add_output_section): Likewise. (Output_data_reloc::add_absolute): Likewise. (Output_data_reloc::add_target_specific): Likewise. (Output_data_got::reserve_slot): Move definition here. (Output_data_got::reserve_local): New function. (Output_data_got::reserve_global): New function. * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to section_offsets_ with accessor function. (Sized_relobj_file::write_sections): Likewise. (Sized_relobj_file::do_relocate_sections): Likewise. * target.h (Sized_target::reserve_local_got_entry): New function. (Sized_target::reserve_global_got_entry): New function. * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function. (Target_x86_64::reserve_global_got_entry): New function. (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2010-12-14Fix typos in gold.Ralf Wildenhues1-2/+2
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-08-25 * archive.cc: Formatting fixes: Remove whitespace betweenNick Clifton1-2/+2
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.
2009-12-14 Revert -Wshadow changes, all changes from:Ian Lance Taylor1-29/+29
2009-12-11 Doug Kwan <dougkwan@google.com> 2009-12-11 Nick Clifton <nickc@redhat.com> * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
2009-12-11Add -Wshadow to the gcc command line options used when compiling the binutils.Nick Clifton1-29/+29
Fix up all warnings generated by the addition of this switch.
2008-07-24 PR 6048Ian Lance Taylor1-1/+2
* ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether this->eh_frame_hdr_ is NULL before using it.
2008-04-19 * object.cc (Xindex::initialize_symtab_xindex): New function.Ian Lance Taylor1-2/+5
(Xindex::read_symtab_xindex): New function. (Xindex::sym_xindex_to_shndx): New function. (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if available. (Sized_relobj::do_initialize_xindex): New function. (Sized_relobj::do_read_symbols): Adjust section links. (Sized_relobj::symbol_section_and_value): Add is_ordinary parameter. Change all callers. (Sized_relobj::include_section_group): Adjust section links and symbol section indexes. (Sized_relobj::do_layout): Adjust section links. (Sized_relobj::do_count_local_symbols): Adjust section links and symbol section indexes. (Sized_relobj::do_finalize_local_symbols): Distinguish between ordinary and special symbols. (Sized_relobj::write_local_symbols): Add symtab_xindex and dynsym_xindex parameters. Change all callers. Adjust section links. Use SHN_XINDEX when needed. (Sized_relobj::get_symbol_location_info): Adjust section links. Don't get fooled by special symbols. * object.h (class Xindex): Define. (class Object): Add xindex_ parameter. Declare virtual functoin do_initialize_xindex. (Object::adjust_sym_shndx): New function. (Object::set_xindex): New protected function. (class Symbol_value): Add is_ordinary_shndx_ field. (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_. (Symbol_value::value): Assert ordinary section. (Symbol_value::initialize_input_to_output_map): Likewise. (Symbol_value::set_input_shndx): Add is_ordinary parameter. Change all callers. (Symbol_value::input_shndx): Add is_ordinary parameter. Change all callers. (class Sized_relobj): Update declarations. (Sized_relobj::local_symbol_input_shndx): Add is_ordinary parameter. Change all callers. (Sized_relobj::adjust_shndx): New function. * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_ field. (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section for SHT_DYNSYM section if available. Set dynsym_shndx_ field. (Sized_dynobj::read_dynsym_section): Adjust section links. (Sized_dynobj::read_dynamic): Likewise. (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust section links. (Sized_dynobj::do_initialize_xindex): New function. * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare do_initialize_xindex. (Sized_dynobj::adjust_shndx): New function. * layout.cc (Layout::Layout): Initialize symtab_xindex_ and dynsym_xindex_ fields. (Layout::finalize): Add a call to set_section_indexes before creating the symtab sections. (Layout::set_section_indexes): Don't do anything if the section already has a section index. (Layout::create_symtab_sections): Add shnum parameter. Change caller. Create .symtab_shndx section if needed. (Layout::create_shdrs): Add shstrtab_section parameter. Change caller. (Layout::allocated_output_section_count): New function. (Layout::create_dynamic_symtab): Create .dynsym_shndx section if needed. * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_ fields. Update declarations. (Layout::symtab_xindex): New function. (Layout::dynsym_xindex): New function. (class Write_symbols_task): Add layout_ field. (Write_symbols_task::Write_symbols_task): Add layout parameter. Change caller. * output.cc (Output_section_headers::Output_section_headers): Add shstrtab_section parameter. Change all callers. (Output_section_headers::do_sized_write): Store overflow values for section count and section string table section index in section header zero. (Output_file_header::do_sized_write): Check for overflow of section count and section string table section index. (Output_symtab_xindex::do_write): New function. (Output_symtab_xindex::endian_do_write): New function. * output.h (class Output_section_headers): Add shstrtab_section_. Update declarations. (class Output_symtab_xindex): Define. (Output_section::has_out_shndx): New function. * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_ field. (Symbol::init_base): Add st_shndx and is_ordinary parameters. Change all callers. (Sized_symbol::init): Likewise. (Symbol::output_section): Check for ordinary symbol. (Symbol_table::add_from_object): Remove orig_sym parameter. Add st_shndx, is_ordinary, and orig_st_shndx parameters. Change all callers. (Symbol_table::add_from_relobj): Add symndx_offset parameter. Change all callers. Simplify handling of symbols from sections not included in the link. (Symbol_table::add_from_dynobj): Handle ordinary symbol distinction. (Weak_alias_sorter::operator()): Assert that symbols are ordinary. (Symbol_table::sized_finalize_symbol): Handle ordinary symbol distinction. (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex parameters. Change all callers. (Symbol_table::sized_write_globals): Likewise. Handle ordinary symbol distinction. Use SHN_XINDEX when needed. (Symbol_table::write_section_symbol): Add symtab_xindex parameter. Change all callers. (Symbol_table::sized_write_section_symbol): Likewise. Use SHN_XINDEX when needed. * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update declarations. (Symbol::shndx): Add is_ordinary parameter. Change all callers. (Symbol::is_defined): Check is_ordinary. (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise. (Symbol::is_absolute, Symbol::is_common): Likewise. (class Sized_symbol): Update declarations. (class Symbol_table): Update declarations. * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary parameters. Change all callers. (Sized_symbol::override): Likewise. (Symbol_table::override): Likewise. (symbol_to_bits): Add is_ordinary parameter. Change all callers. (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx, is_ordinary, and orig_st_shndx parameters. Change all callers. * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol to be in an ordinary section. * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add object and is_ordinary parameters. Change all callers. (Sized_dwarf_line_info::read_relocs): Add object parameter. Change all callers. Don't add undefined or non-ordinary symbols to reloc_map_. (Sized_dwarf_line_info::read_line_mappings): Add object parameter. Change all callers. * dwarf_reader.h (class Sized_dwarf_line_info): Update declarations. * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol. * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links. (Sized_relobj::relocate_sections): Likewise. * target-reloc.h (scan_relocs): Adjust section symbol index. (scan_relocatable_relocs): Likewise. * i386.cc (Scan::local): Check for ordinary symbols. * sparc.cc (Scan::local): Likewise. * x86_64.cc (Scan::local): Likewise. * testsuite/binary_unittest.cc (Sized_binary_test): Update calls to symbol_section_and_value. * testsuite/many_sections_test.cc: New file. * testsuite/Makefile.am (BUILT_SOURCES): Define. (check_PROGRAMS): Add many_sections_test. (many_sections_test_SOURCES): Define. (many_sections_test_DEPENDENCIES): Define. (many_sections_test_LDFLAGS): Define. (BUILT_SOURCES): Add many_sections_define.h. (many_sections_define.h): New target. (BUILT_SOURCES): Add many_sections_check.h. (many_sections_check.h): New target. (check_PROGRAMS): Add many_sections_r_test. (many_sections_r_test_SOURCES): Define. (many_sections_r_test_DEPENDENCIES): Define. (many_sections_r_test_LDFLAGS): Define. (many_sections_r_test_LDADD): Define. (many_sections_r_test.o): New target. * testsuite/Makefile.in: Rebuild.
2008-03-13Update copyright years. Update language files.Ian Lance Taylor1-1/+1
2008-03-13Don't crash if we change the address of the .eh_frame section after weIan Lance Taylor1-1/+15
find its size.
2008-02-28From Craig Silverstein: Have Parameters point to General_options.Ian Lance Taylor1-60/+30
2008-02-14Align FDE and CIE lengths as needed.Ian Lance Taylor1-15/+43
2008-02-02Don't record file offset for CIEs.Ian Lance Taylor1-22/+13
2007-12-21Speed up relocations against local symbols in merged sections.Ian Lance Taylor1-0/+9
2007-12-18Add section_size_type and section_offset_type, use them to replace aIan Lance Taylor1-29/+33
lot of instances of off_t.
2007-12-07Fix ehframe header handling for shared libraries.Ian Lance Taylor1-3/+25
2007-11-29Clean up setting address and section offset.Ian Lance Taylor1-3/+4
2007-11-09Generate a complete exception frame header. Discard duplicateIan Lance Taylor1-14/+1033
exception frame information.
2007-09-26Put size and endianness in parameters.Ian Lance Taylor1-4/+3
2007-09-26Add basic exception frame header, plus test.Ian Lance Taylor1-0/+126