https://sourceware.org/bugzilla/show_bug.cgi?id=17005

--- Comment #3 from Alexander Ivchenko <aivchenk at gmail dot com> ---
If we assume that we applied patch from Comment 2, the resulting binary would
still fails, because the .eh_frame_hdr offset table is calculated incorrectly.

In Fde::write:

  // Tell the exception frame header about this FDE.
  if (eh_frame_hdr != NULL)
    eh_frame_hdr->record_fde(offset, fde_encoding);

Here offset for all fde's is recorder from the beginning of the oview. However,
oview address could be different from the beginning of the output section (like
in our case).

I would just simply disable sorting eh_frame sections with something like:

diff --git a/gold/output.cc b/gold/output.cc
index c078fbb..5a9d591 100644
--- a/gold/output.cc
+++ b/gold/output.cc
@@ -3626,7 +3626,8 @@ Output_section::sort_attached_input_sections()
          || this->type() == elfcpp::SHT_FINI_ARRAY)
        std::sort(sort_list.begin(), sort_list.end(),
                  Input_section_sort_init_fini_compare());
-      else if (strcmp(parameters->options().sort_section(), "name") == 0)
+      else if (strcmp(parameters->options().sort_section(), "name") == 0
+              && strcmp(this->name(), ".eh_frame") != 0)
        std::sort(sort_list.begin(), sort_list.end(),
                  Input_section_sort_section_name_compare());
       else if (strcmp(this->name(), ".text") == 0)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to