This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gold patch to discard .note.callgraph sections in the final link.


Hi,

  I am working on a project to global function layout in the linker
where the linker reads the callgraph edge profile information,
generated by FDO, and uses that to find a ordering of functions that
will place functions calling each other frequently closer.  To do
this, I create special .note sections, called .note.callgraph which
records the callgraph edge profile info. Please see :
http://gcc.gnu.org/ml/gcc-patches/2011-06/msg00602.html

  This patch is to make gold omit these sections in the final link
except when generating relocatable objects. Is this ok to submit?



        * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
	Omit .note.callgraph sections in the final link.


Index: object.cc
===================================================================
RCS file: /cvs/src/src/gold/object.cc,v
retrieving revision 1.150
diff -u -u -p -r1.150 object.cc
--- object.cc	18 Sep 2011 15:06:28 -0000	1.150
+++ object.cc	22 Sep 2011 17:33:52 -0000
@@ -1315,6 +1315,14 @@ Sized_relobj_file<size, big_endian>::do_
 		omit[i] = true;
 	    }

+	  // This section is special.  It records the callgraph edge profile
+	  // information.  It should be omitted after its contents are read.
+	  if (is_prefix_of(".note.callgraph.text", name))
+	    {
+	      if (!relocatable)
+	        omit[i] = true;
+	    }
+


Thanks,
-Sri.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]