https://sourceware.org/bugzilla/show_bug.cgi?id=17005
--- Comment #2 from Alexander Ivchenko <aivchenk at gmail dot com> ---
Looks like in Eh_frame::set_final_data_size() output_offset is calculated
incorrectly:
it is always assumed that it is zero in the beginning. The following patch
helped to place relocations
correctly, but the binary still fails :/.
@@ -1093,7 +1093,13 @@ Eh_frame::set_final_data_size()
return;
}
+ // If the output section has file offset, we need to subtract it at this
+ // point from the offset of currect input section.
+
section_offset_type output_offset = 0;
+ if (this->output_section()->is_offset_valid()
+ && this->is_offset_valid())
+ output_offset = this->offset() - this->output_section()->offset();
for (Unmergeable_cie_offsets::iterator p =
this->unmergeable_cie_offsets_.begin();
@@ -1112,6 +1118,10 @@ Eh_frame::set_final_data_size()
this->mappings_are_done_ = true;
this->final_data_size_ = output_offset;
+ if (this->output_section()->is_offset_valid()
+ && this->is_offset_valid())
+ this->final_data_size_ -= this->output_section()->offset();
+
gold_assert((output_offset & (this->addralign() - 1)) == 0);
this->set_data_size(output_offset);
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-binutils