|
|
8101c5 |
#commit 1d946cb356d22867128b40b9560857f930b2b0b0
|
|
|
8101c5 |
#Author: Cary Coutant <ccoutant@google.com>
|
|
|
8101c5 |
#Date: Wed Nov 6 10:34:26 2013 -0800
|
|
|
8101c5 |
#
|
|
|
8101c5 |
# Fix assert failure with --emit-relocs and .eh_frame sections.
|
|
|
8101c5 |
#
|
|
|
8101c5 |
# gold/
|
|
|
8101c5 |
# PR gold/15758
|
|
|
8101c5 |
# * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
|
|
|
8101c5 |
# before reloc sections.
|
|
|
8101c5 |
#
|
|
|
8101c5 |
diff -Nrup a/gold/object.cc b/gold/object.cc
|
|
|
8101c5 |
--- a/gold/object.cc 2013-02-27 13:28:03.000000000 -0700
|
|
|
8101c5 |
+++ b/gold/object.cc 2013-11-07 09:37:25.263426357 -0700
|
|
|
8101c5 |
@@ -1685,6 +1685,28 @@ Sized_relobj_file<size, big_endian>::do_
|
|
|
8101c5 |
if (!is_pass_two)
|
|
|
8101c5 |
layout->layout_gnu_stack(seen_gnu_stack, gnu_stack_flags, this);
|
|
|
8101c5 |
|
|
|
8101c5 |
+ // Handle the .eh_frame sections after the other sections.
|
|
|
8101c5 |
+ gold_assert(!is_pass_one || eh_frame_sections.empty());
|
|
|
8101c5 |
+ for (std::vector<unsigned int>::const_iterator p = eh_frame_sections.begin();
|
|
|
8101c5 |
+ p != eh_frame_sections.end();
|
|
|
8101c5 |
+ ++p)
|
|
|
8101c5 |
+ {
|
|
|
8101c5 |
+ unsigned int i = *p;
|
|
|
8101c5 |
+ const unsigned char* pshdr;
|
|
|
8101c5 |
+ pshdr = section_headers_data + i * This::shdr_size;
|
|
|
8101c5 |
+ typename This::Shdr shdr(pshdr);
|
|
|
8101c5 |
+
|
|
|
8101c5 |
+ this->layout_eh_frame_section(layout,
|
|
|
8101c5 |
+ symbols_data,
|
|
|
8101c5 |
+ symbols_size,
|
|
|
8101c5 |
+ symbol_names_data,
|
|
|
8101c5 |
+ symbol_names_size,
|
|
|
8101c5 |
+ i,
|
|
|
8101c5 |
+ shdr,
|
|
|
8101c5 |
+ reloc_shndx[i],
|
|
|
8101c5 |
+ reloc_type[i]);
|
|
|
8101c5 |
+ }
|
|
|
8101c5 |
+
|
|
|
8101c5 |
// When doing a relocatable link handle the reloc sections at the
|
|
|
8101c5 |
// end. Garbage collection and Identical Code Folding is not
|
|
|
8101c5 |
// turned on for relocatable code.
|
|
|
8101c5 |
@@ -1737,28 +1759,6 @@ Sized_relobj_file<size, big_endian>::do_
|
|
|
8101c5 |
out_section_offsets[i] = invalid_address;
|
|
|
8101c5 |
}
|
|
|
8101c5 |
|
|
|
8101c5 |
- // Handle the .eh_frame sections at the end.
|
|
|
8101c5 |
- gold_assert(!is_pass_one || eh_frame_sections.empty());
|
|
|
8101c5 |
- for (std::vector<unsigned int>::const_iterator p = eh_frame_sections.begin();
|
|
|
8101c5 |
- p != eh_frame_sections.end();
|
|
|
8101c5 |
- ++p)
|
|
|
8101c5 |
- {
|
|
|
8101c5 |
- unsigned int i = *p;
|
|
|
8101c5 |
- const unsigned char* pshdr;
|
|
|
8101c5 |
- pshdr = section_headers_data + i * This::shdr_size;
|
|
|
8101c5 |
- typename This::Shdr shdr(pshdr);
|
|
|
8101c5 |
-
|
|
|
8101c5 |
- this->layout_eh_frame_section(layout,
|
|
|
8101c5 |
- symbols_data,
|
|
|
8101c5 |
- symbols_size,
|
|
|
8101c5 |
- symbol_names_data,
|
|
|
8101c5 |
- symbol_names_size,
|
|
|
8101c5 |
- i,
|
|
|
8101c5 |
- shdr,
|
|
|
8101c5 |
- reloc_shndx[i],
|
|
|
8101c5 |
- reloc_type[i]);
|
|
|
8101c5 |
- }
|
|
|
8101c5 |
-
|
|
|
8101c5 |
// When building a .gdb_index section, scan the .debug_info and
|
|
|
8101c5 |
// .debug_types sections.
|
|
|
8101c5 |
gold_assert(!is_pass_one
|