[GOLD] powerpc64 ODR violation check

Alan Modra amodra@gmail.com
Thu Mar 7 01:28:00 GMT 2013


On Wed, Mar 06, 2013 at 06:33:18AM -0800, Ian Lance Taylor wrote:
> Also I don't see a need for allocation here.

In the same vein.

	* ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
	pointer to Post_fde.
	(struct Post_fde): Move definition to here..
	* ehframe.cc (struct Post_fde): ..from here.
	(Cie::write): Don't alloc Post_fde.
	(Eh_frame::do_sized_write): Update.  Don't free Post_fde.

Index: gold/ehframe.h
===================================================================
RCS file: /cvs/src/src/gold/ehframe.h,v
retrieving revision 1.18
diff -u -p -r1.18 ehframe.h
--- gold/ehframe.h	27 Feb 2013 23:11:56 -0000	1.18
+++ gold/ehframe.h	6 Mar 2013 09:51:11 -0000
@@ -246,10 +246,20 @@ class Fde
   std::string contents_;
 };
 
-// FDEs stashed for later processing.
+// A FDE plus some info from a CIE to allow later writing of the FDE.
 
-struct Post_fde;
-typedef std::vector<Post_fde*> Post_fdes;
+struct Post_fde
+{
+  Post_fde(Fde* f, section_offset_type cie_off, unsigned char encoding)
+    : fde(f), cie_offset(cie_off), fde_encoding(encoding)
+  { }
+
+  Fde* fde;
+  section_offset_type cie_offset;
+  unsigned char fde_encoding;
+};
+
+typedef std::vector<Post_fde> Post_fdes;
 
 // This class holds a CIE.
 
Index: gold/ehframe.cc
===================================================================
RCS file: /cvs/src/src/gold/ehframe.cc,v
retrieving revision 1.23
diff -u -p -r1.23 ehframe.cc
--- gold/ehframe.cc	27 Feb 2013 23:11:56 -0000	1.23
+++ gold/ehframe.cc	6 Mar 2013 09:51:11 -0000
@@ -441,19 +441,6 @@ Cie::set_output_offset(section_offset_ty
   return output_offset + length;
 }
 
-// A FDE plus some info from a CIE to allow later writing of the FDE.
-
-struct Post_fde
-{
-  Post_fde(Fde* f, section_offset_type cie_off, unsigned char encoding)
-    : fde(f), cie_offset(cie_off), fde_encoding(encoding)
-  { }
-
-  Fde* fde;
-  section_offset_type cie_offset;
-  unsigned char fde_encoding;
-};
-
 // Write the CIE to OVIEW starting at OFFSET.  Round up the bytes to
 // ADDRALIGN.  ADDRESS is the virtual address of OVIEW.
 // EH_FRAME_HDR is the exception frame header for FDE recording.
@@ -499,7 +486,7 @@ Cie::write(unsigned char* oview, section
        ++p)
     {
       if ((*p)->post_map())
-	post_fdes->push_back(new Post_fde(*p, cie_offset, fde_encoding));
+	post_fdes->push_back(Post_fde(*p, cie_offset, fde_encoding));
       else
 	offset = (*p)->write<size, big_endian>(oview, offset, address,
 					       addralign, cie_offset,
@@ -1211,13 +1198,10 @@ Eh_frame::do_sized_write(unsigned char* 
   for (Post_fdes::iterator p = post_fdes.begin();
        p != post_fdes.end();
        ++p)
-    {
-      o = (*p)->fde->write<size, big_endian>(oview, o, address, addralign,
-					     (*p)->cie_offset,
-					     (*p)->fde_encoding,
-					     this->eh_frame_hdr_);
-      delete *p;
-    }
+    o = (*p).fde->write<size, big_endian>(oview, o, address, addralign,
+					  (*p).cie_offset,
+					  (*p).fde_encoding,
+					  this->eh_frame_hdr_);
 }
 
 #ifdef HAVE_TARGET_32_LITTLE


-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list