i had the same problem and produced a similar patch as part of my port.  i intend to merge to two ports.




Jörn Engel <joern@wohnheim.fh-wedel.de>
Sent by: ltp-coverage-admin@lists.sourceforge.net

04/17/2003 08:31 AM

       
        To:        Paul Larson <plars@linuxtestproject.org>
        cc:        ltp-coverage@lists.sourceforge.net, lse-tech <lse-tech@lists.sourceforge.net>, lkml <linux-kernel@vger.kernel.org>, Paul Mackerras <paulus@samba.org>, Benjamin Herrenschmidt <benh@kernel.crashing.org>
        Subject:        Re: [Ltp-coverage] 2.5.67-gcov and 2.4.20-gcov



On Wed, 16 April 2003 11:51:09 -0500, Paul Larson wrote:
> On Wed, 2003-04-16 at 11:44, Jörn Engel wrote:
> > Excuse me for being lazy. Does this already cover ppc? I submitted a
> > patch over some other channels some time ago.
> No, not yet.  And I havn't seen that patch, could you send it to me, or
> to the ltp-coverage mailing list?

Attached.

Most of it is trivial - identical to arch/*.

The bit in arch/ppc/kernel/entry.S was necessary for me to compile
this for a ppc 405gp based system, gcov would grow the kernel beyond
the relative jump distance for "bnel syscall_trace".

Paulus, Ben, is the relative jump a wanted optimization or unclean
code that went unnoticed so far? IOW should this go into mainline or
remain part of the gcov patch?

Jörn

--
Optimizations always bust things, because all optimizations are, in
the long haul, a form of cheating, and cheaters eventually get caught.
-- Larry Wall

Index: arch/ppc/config.in
===================================================================
RCS file: /home/linux/arch/ppc/config.in,v
retrieving revision 1.11
diff -u -r1.11 config.in
--- arch/ppc/config.in                 19 Feb 2003 21:41:13 -0000                 1.11
+++ arch/ppc/config.in                 28 Mar 2003 12:37:57 -0000
@@ -714,3 +714,13 @@
  bool 'Support for early boot texts over serial port' CONFIG_SERIAL_TEXT_DEBUG
fi
endmenu
+
+mainmenu_option next_comment
+comment 'GCOV coverage profiling'
+
+bool 'GCOV kernel' CONFIG_GCOV_PROFILE
+if [ "$CONFIG_GCOV_PROFILE" != "n" ]; then
+   bool '  GCOV kernel profiler' CONFIG_GCOV_ALL
+fi
+
+endmenu
Index: arch/ppc/kernel/entry.S
===================================================================
RCS file: /home/linux/arch/ppc/kernel/entry.S,v
retrieving revision 1.2
diff -u -r1.2 entry.S
--- entry.S                 14 Feb 2003 21:40:50 -0000                 1.2
+++ entry.S                 28 Mar 2003 12:59:06 -0000
@@ -314,9 +314,19 @@
                 .globl                 ret_from_fork
ret_from_fork:
                 bl                 schedule_tail
+#ifdef CONFIG_GCOV_ALL
+                 lis                 r0,syscall_trace@ha
+                 addi                 r0,r0,syscall_trace@l
+                 mtlr                 r0
+#endif
                 lwz                 r0,TASK_PTRACE(r2)
                 andi.                 r0,r0,PT_TRACESYS
+#ifdef CONFIG_GCOV_ALL
+                 beq                 ret_from_except
+                 blrl
+#else
                 bnel-                 syscall_trace
+#endif
                 b                 ret_from_except

                 .globl                 ret_from_intercept
Index: arch/ppc/kernel/head.S
===================================================================
RCS file: /home/linux/arch/ppc/kernel/head.S,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 head.S
--- arch/ppc/kernel/head.S                 5 Nov 2002 16:24:13 -0000                 1.1.1.1
+++ arch/ppc/kernel/head.S                 28 Mar 2003 12:37:57 -0000
@@ -1755,3 +1755,24 @@
 */
abatron_pteptrs:
                 .space                 8
+
+#ifdef CONFIG_GCOV_PROFILE
+/*
+ * The .ctors-section contains a list of pointers to constructor
+ * functions which are used to initialize gcov structures.
+ *
+ * Because there is no NULL at the end of the constructor list
+ * in the kernel we need the addresses of both the constructor
+ * as well as the destructor list which are supposed to be
+ * adjacent.
+ */
+
+.section ".ctors","aw"
+.globl  __CTOR_LIST__
+.type   __CTOR_LIST__,@object
+__CTOR_LIST__:
+.section ".dtors","aw"
+.globl  __DTOR_LIST__
+.type   __DTOR_LIST__,@object
+__DTOR_LIST__:
+#endif
Index: arch/ppc/kernel/head_4xx.S
===================================================================
RCS file: /home/linux/arch/ppc/kernel/head_4xx.S,v
retrieving revision 1.8
diff -u -r1.8 head_4xx.S
--- arch/ppc/kernel/head_4xx.S                 17 Feb 2003 20:06:16 -0000                 1.8
+++ arch/ppc/kernel/head_4xx.S                 28 Mar 2003 12:37:57 -0000
@@ -1271,3 +1271,24 @@
                 mtdcr 0x022, r3
                 blr
#endif
+
+#ifdef CONFIG_GCOV_PROFILE
+/*
+ * The .ctors-section contains a list of pointers to constructor
+ * functions which are used to initialize gcov structures.
+ *
+ * Because there is no NULL at the end of the constructor list
+ * in the kernel we need the addresses of both the constructor
+ * as well as the destructor list which are supposed to be
+ * adjacent.
+ */
+
+.section ".ctors","aw"
+.globl  __CTOR_LIST__
+.type   __CTOR_LIST__,@object
+__CTOR_LIST__:
+.section ".dtors","aw"
+.globl  __DTOR_LIST__
+.type   __DTOR_LIST__,@object
+__DTOR_LIST__:
+#endif
Index: arch/ppc/kernel/head_8xx.S
===================================================================
RCS file: /home/linux/arch/ppc/kernel/head_8xx.S,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 head_8xx.S
--- arch/ppc/kernel/head_8xx.S                 5 Nov 2002 16:24:13 -0000                 1.1.1.1
+++ arch/ppc/kernel/head_8xx.S                 28 Mar 2003 12:37:58 -0000
@@ -997,3 +997,23 @@
                 .space                 16
#endif

+#ifdef CONFIG_GCOV_PROFILE
+/*
+ * The .ctors-section contains a list of pointers to constructor
+ * functions which are used to initialize gcov structures.
+ *
+ * Because there is no NULL at the end of the constructor list
+ * in the kernel we need the addresses of both the constructor
+ * as well as the destructor list which are supposed to be
+ * adjacent.
+ */
+
+.section ".ctors","aw"
+.globl  __CTOR_LIST__
+.type   __CTOR_LIST__,@object
+__CTOR_LIST__:
+.section ".dtors","aw"
+.globl  __DTOR_LIST__
+.type   __DTOR_LIST__,@object
+__DTOR_LIST__:
+#endif


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Ltp-coverage mailing list
Ltp-coverage@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-coverage