Fix assert failure with --emit-relocs and .eh_frame sections.
authorCary Coutant <ccoutant@google.com>
Wed, 6 Nov 2013 18:34:26 +0000 (10:34 -0800)
committerCary Coutant <ccoutant@google.com>
Wed, 6 Nov 2013 18:37:45 +0000 (10:37 -0800)
gold/
PR gold/15758
* object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
before reloc sections.

gold/ChangeLog
gold/object.cc

index 4ba00a32999752ac26c0a49cb951588ce12885ad..e6910f0a235391cf52c042affd57c9be909378f0 100644 (file)
@@ -1,3 +1,9 @@
+2013-11-06  Cary Coutant  <ccoutant@google.com>
+
+       PR gold/15758
+       * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
+       before reloc sections.
+
 2013-10-31  Cary Coutant  <ccoutant@google.com>
 
        Restore support for dwp v2 DWARF package file format.
index c98b3c5a7731abf3e204933169886017ded0bfd8..b1feacc537cf84568cfe6f4e2e7566b33542f7f6 100644 (file)
@@ -1704,6 +1704,28 @@ Sized_relobj_file<size, big_endian>::do_layout(Symbol_table* symtab,
   if (!is_pass_two)
     layout->layout_gnu_stack(seen_gnu_stack, gnu_stack_flags, this);
 
+  // Handle the .eh_frame sections after the other sections.
+  gold_assert(!is_pass_one || eh_frame_sections.empty());
+  for (std::vector<unsigned int>::const_iterator p = eh_frame_sections.begin();
+       p != eh_frame_sections.end();
+       ++p)
+    {
+      unsigned int i = *p;
+      const unsigned char* pshdr;
+      pshdr = section_headers_data + i * This::shdr_size;
+      typename This::Shdr shdr(pshdr);
+
+      this->layout_eh_frame_section(layout,
+                                   symbols_data,
+                                   symbols_size,
+                                   symbol_names_data,
+                                   symbol_names_size,
+                                   i,
+                                   shdr,
+                                   reloc_shndx[i],
+                                   reloc_type[i]);
+    }
+
   // When doing a relocatable link handle the reloc sections at the
   // end.  Garbage collection  and Identical Code Folding is not
   // turned on for relocatable code.
@@ -1756,28 +1778,6 @@ Sized_relobj_file<size, big_endian>::do_layout(Symbol_table* symtab,
       out_section_offsets[i] = invalid_address;
     }
 
-  // Handle the .eh_frame sections at the end.
-  gold_assert(!is_pass_one || eh_frame_sections.empty());
-  for (std::vector<unsigned int>::const_iterator p = eh_frame_sections.begin();
-       p != eh_frame_sections.end();
-       ++p)
-    {
-      unsigned int i = *p;
-      const unsigned char* pshdr;
-      pshdr = section_headers_data + i * This::shdr_size;
-      typename This::Shdr shdr(pshdr);
-
-      this->layout_eh_frame_section(layout,
-                                   symbols_data,
-                                   symbols_size,
-                                   symbol_names_data,
-                                   symbol_names_size,
-                                   i,
-                                   shdr,
-                                   reloc_shndx[i],
-                                   reloc_type[i]);
-    }
-
   // When building a .gdb_index section, scan the .debug_info and
   // .debug_types sections.
   gold_assert(!is_pass_one
This page took 0.032939 seconds and 4 git commands to generate.