diff options
author | Cary Coutant <ccoutant@google.com> | 2014-07-02 09:39:41 -0700 |
---|---|---|
committer | Cary Coutant <ccoutant@google.com> | 2014-09-02 14:49:18 -0700 |
commit | 9860cbcfb60bdae2f9800e6a6ea5f21ef1507d08 (patch) | |
tree | da0a996a6e7e26eec815fc647283fe878fe23e7a /gold/ehframe.h | |
parent | df7e526582809b829ee8651a1315a17627cfea4d (diff) | |
download | gdb-9860cbcfb60bdae2f9800e6a6ea5f21ef1507d08.zip gdb-9860cbcfb60bdae2f9800e6a6ea5f21ef1507d08.tar.gz gdb-9860cbcfb60bdae2f9800e6a6ea5f21ef1507d08.tar.bz2 |
Fix problem with optimization of .eh_frame section and --sort-section option.
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.
Diffstat (limited to 'gold/ehframe.h')
-rw-r--r-- | gold/ehframe.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gold/ehframe.h b/gold/ehframe.h index 42ed7f6..2ae12e0 100644 --- a/gold/ehframe.h +++ b/gold/ehframe.h @@ -211,8 +211,8 @@ class Fde // FDE in EH_FRAME_HDR. Return the new offset. template<int size, bool big_endian> section_offset_type - write(unsigned char* oview, section_offset_type offset, - uint64_t address, unsigned int addralign, + write(unsigned char* oview, section_offset_type output_section_offset, + section_offset_type offset, uint64_t address, unsigned int addralign, section_offset_type cie_offset, unsigned char fde_encoding, Eh_frame_hdr* eh_frame_hdr); @@ -317,7 +317,8 @@ class Cie // writing. Return the new offset. template<int size, bool big_endian> section_offset_type - write(unsigned char* oview, section_offset_type offset, uint64_t address, + write(unsigned char* oview, section_offset_type output_section_offset, + section_offset_type offset, uint64_t address, unsigned int addralign, Eh_frame_hdr* eh_frame_hdr, Post_fdes* post_fdes); |