summaryrefslogtreecommitdiff
path: root/rtems-coverage/rtems-47-20090910.diff
blob: 907694e16425327cb7f1f8a5f25202e403f0ca2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
? cpukit/wrapup-coverage/.Makefile.am.swp
Index: configure.ac
===================================================================
RCS file: /usr1/CVS/rtems/configure.ac,v
retrieving revision 1.24.2.2
diff -u -r1.24.2.2 configure.ac
--- configure.ac	8 Jan 2007 16:51:11 -0000	1.24.2.2
+++ configure.ac	10 Sep 2009 14:34:12 -0000
@@ -28,6 +28,7 @@
 RTEMS_ENABLE_RDBG
 RTEMS_ENABLE_INLINES
 RTEMS_ENABLE_CXX
+RTEMS_ENABLE_COVERAGE
 RTEMS_ENABLE_TESTS  
 RTEMS_ENABLE_RTEMS_DEBUG
 RTEMS_ENABLE_RTEMSBSP
Index: aclocal/enable-coverage.m4
===================================================================
RCS file: aclocal/enable-coverage.m4
diff -N aclocal/enable-coverage.m4
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ aclocal/enable-coverage.m4	10 Sep 2009 14:34:12 -0000
@@ -0,0 +1,15 @@
+dnl $Id$
+
+AC_DEFUN([RTEMS_ENABLE_COVERAGE],
+[
+AC_ARG_ENABLE(coverage,
+[AS_HELP_STRING([--enable-coverage],
+[enable building for coverage testing])],
+[case "${enable_coverage}" in
+  yes) RTEMS_HAS_COVERAGE=yes ;;
+  exp*) RTEMS_HAS_COVERAGE=yes ; RTEMS_HAS_EXPERIMENTAL_COVERAGE=yes ;;
+  no) RTEMS_HAS_COVERAGE=no   ;;
+  *)  AC_MSG_ERROR(bad value ${enableval} for enable-coverage option) ;;
+esac], [RTEMS_HAS_COVERAGE=no])
+AC_SUBST(RTEMS_HAS_COVERAGE)
+])
Index: c/src/make/Makefile.inc.in
===================================================================
RCS file: /usr1/CVS/rtems/c/src/make/Makefile.inc.in,v
retrieving revision 1.10
diff -u -r1.10 Makefile.inc.in
--- c/src/make/Makefile.inc.in	24 Nov 2003 10:34:05 -0000	1.10
+++ c/src/make/Makefile.inc.in	10 Sep 2009 14:34:13 -0000
@@ -37,6 +37,7 @@
 RTEMS_HAS_POSIX_API = @RTEMS_HAS_POSIX_API@
 RTEMS_HAS_ITRON_API = @RTEMS_HAS_ITRON_API@
 RTEMS_HAS_CPLUSPLUS = @RTEMS_HAS_CPLUSPLUS@
+RTEMS_HAS_COVERAGE = @RTEMS_HAS_COVERAGE@
 
 export RTEMS_BSP
 export RTEMS_CUSTOM
Index: c/src/make/bsp.cfg.in
===================================================================
RCS file: /usr1/CVS/rtems/c/src/make/bsp.cfg.in,v
retrieving revision 1.4
diff -u -r1.4 bsp.cfg.in
--- c/src/make/bsp.cfg.in	16 Nov 1999 15:48:10 -0000	1.4
+++ c/src/make/bsp.cfg.in	10 Sep 2009 14:34:13 -0000
@@ -26,6 +26,11 @@
 HAS_CPLUSPLUS = @HAS_CPLUSPLUS@
 
 ##
+## Is this BSP being built to do coverage testing?
+##
+RTEMS_HAS_COVERAGE = @RTEMS_HAS_COVERAGE@
+
+##
 ## Does this BSP support RTEMS's networking ?
 ##
 HAS_NETWORKING = @HAS_NETWORKING@
Index: c/src/make/configure.ac
===================================================================
RCS file: /usr1/CVS/rtems/c/src/make/configure.ac,v
retrieving revision 1.24.2.2
diff -u -r1.24.2.2 configure.ac
--- c/src/make/configure.ac	2 Dec 2006 06:08:40 -0000	1.24.2.2
+++ c/src/make/configure.ac	10 Sep 2009 14:34:13 -0000
@@ -24,6 +24,7 @@
 RTEMS_ENABLE_RDBG
 RTEMS_ENABLE_CXX
 RTEMS_ENABLE_BARE
+RTEMS_ENABLE_COVERAGE
 
 RTEMS_ENV_RTEMSBSP
 
@@ -71,6 +72,7 @@
 
 AC_SUBST(rtems_cv_prog_cc_cross)
 AC_SUBST(RTEMS_HAS_CPLUSPLUS)
+AC_SUBST(RTEMS_HAS_COVERAGE)
 AC_SUBST(BARE_CPU_CFLAGS)
 AC_SUBST(BARE_CPU_MODEL)
 AC_SUBST(program_prefix)
Index: c/src/make/leaf.cfg
===================================================================
RCS file: /usr1/CVS/rtems/c/src/make/leaf.cfg,v
retrieving revision 1.4
diff -u -r1.4 leaf.cfg
--- c/src/make/leaf.cfg	13 Sep 2000 13:08:36 -0000	1.4
+++ c/src/make/leaf.cfg	10 Sep 2009 14:34:13 -0000
@@ -44,8 +44,10 @@
 # Create a RTEMS executable based on MANAGERS which was set in
 #  app's Makefile
 
-MANAGERS_NOT_WANTED=$(filter-out $(MANAGERS) \
-	$(MANAGERS_REQUIRED), $(MANAGER_LIST))
+ifneq ($(RTEMS_HAS_COVERAGE),yes)
+  MANAGERS_NOT_WANTED=$(filter-out $(MANAGERS) \
+ 	$(MANAGERS_REQUIRED), $(MANAGER_LIST))
+endif
 
 # Start file must be one of
 #    $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).o
@@ -61,3 +63,7 @@
 ifndef LINKCMDS
 LINKCMDS=$(PROJECT_RELEASE)/lib/linkcmds
 endif
+
+ifeq ($(RTEMS_HAS_COVERAGE),yes)
+  COV_ARGS=$(PROJECT_RELEASE)/lib/rtems_coverage.o
+endif
Index: c/src/make/target.cfg.in
===================================================================
RCS file: /usr1/CVS/rtems/c/src/make/target.cfg.in,v
retrieving revision 1.5
diff -u -r1.5 target.cfg.in
--- c/src/make/target.cfg.in	24 Nov 2003 10:34:05 -0000	1.5
+++ c/src/make/target.cfg.in	10 Sep 2009 14:34:13 -0000
@@ -37,6 +37,7 @@
 RTEMS_HAS_NETWORKING = @RTEMS_HAS_NETWORKING@
 RTEMS_HAS_RDBG = @RTEMS_HAS_RDBG@
 RTEMS_HAS_CPLUSPLUS = @RTEMS_HAS_CPLUSPLUS@
+RTEMS_HAS_COVERAGE = @RTEMS_HAS_COVERAGE@
 RTEMS_CPU = @RTEMS_CPU@
 
 XCFLAGS=$(CFLAGS_FOR_TARGET)
@@ -55,6 +56,7 @@
 # Create a RTEMS executable based on MANAGERS which was set in
 #  app's Makefile
 
-MANAGERS_NOT_WANTED=$(filter-out $(MANAGERS) \
+ifneq ($(RTEMS_HAS_COVERAGE),yes)
+  MANAGERS_NOT_WANTED=$(filter-out $(MANAGERS) \
 	$(MANAGERS_REQUIRED), $(MANAGER_LIST))
-
+endif
Index: c/src/make/aclocal/enable-coverage.m4
===================================================================
RCS file: c/src/make/aclocal/enable-coverage.m4
diff -N c/src/make/aclocal/enable-coverage.m4
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ c/src/make/aclocal/enable-coverage.m4	10 Sep 2009 14:34:13 -0000
@@ -0,0 +1,15 @@
+dnl $Id$
+
+AC_DEFUN([RTEMS_ENABLE_COVERAGE],
+[
+AC_ARG_ENABLE(coverage,
+[AS_HELP_STRING([--enable-coverage],
+[enable building for coverage testing])],
+[case "${enable_coverage}" in
+  yes) RTEMS_HAS_COVERAGE=yes ;;
+  exp*) RTEMS_HAS_COVERAGE=yes ; RTEMS_HAS_EXPERIMENTAL_COVERAGE=yes ;;
+  no) RTEMS_HAS_COVERAGE=no   ;;
+  *)  AC_MSG_ERROR(bad value ${enableval} for enable-coverage option) ;;
+esac], [RTEMS_HAS_COVERAGE=no])
+AC_SUBST(RTEMS_HAS_COVERAGE)
+])
Index: cpukit/Makefile.am
===================================================================
RCS file: /usr1/CVS/rtems/cpukit/Makefile.am,v
retrieving revision 1.59.2.2
diff -u -r1.59.2.2 Makefile.am
--- cpukit/Makefile.am	20 Nov 2006 05:58:10 -0000	1.59.2.2
+++ cpukit/Makefile.am	10 Sep 2009 14:34:13 -0000
@@ -14,6 +14,9 @@
 SUBDIRS += libi2c
 SUBDIRS += libmisc
 SUBDIRS += wrapup
+if ENABLE_COVERAGE
+SUBDIRS += wrapup-coverage
+endif
 
 SUBDIRS += zlib
 
Index: cpukit/configure.ac
===================================================================
RCS file: /usr1/CVS/rtems/cpukit/configure.ac,v
retrieving revision 1.98.2.9
diff -u -r1.98.2.9 configure.ac
--- cpukit/configure.ac	27 Jan 2007 07:27:41 -0000	1.98.2.9
+++ cpukit/configure.ac	10 Sep 2009 14:34:13 -0000
@@ -19,6 +19,7 @@
 RTEMS_ENABLE_INLINES
 RTEMS_ENABLE_RTEMS_DEBUG
 RTEMS_ENABLE_NETWORKING
+RTEMS_ENABLE_COVERAGE
 
 RTEMS_ENV_RTEMSCPU
 RTEMS_CHECK_RTEMS_DEBUG
@@ -171,6 +172,11 @@
   [1],
   [if networking is enabled])
 
+RTEMS_CPUOPT([RTEMS_COVERAGE],
+  [test x"$RTEMS_HAS_COVERAGE" = xyes],
+  [1],
+  [to indicate this is a coverage build])
+
 RTEMS_CPUOPT([RTEMS_UNIX],
   [test x"$RTEMS_CPU" = xunix],
   [1],
@@ -288,6 +294,10 @@
 AM_CONDITIONAL([LIBSHELL],[test x"$HAVE_ASSIGNABLE_STDIO" = x"yes"])
 AM_CONDITIONAL([LIBSERDBG],[test x"$rtems_cv_cc_attribute_weak" = x"yes"])
 
+AM_CONDITIONAL(ENABLE_COVERAGE,test x"$RTEMS_HAS_COVERAGE" = x"yes")
+AM_CONDITIONAL(ENABLE_EXPERIMENTAL_COVERAGE, \
+   test x"$RTEMS_HAS_EXPERIMENTAL_COVERAGE" = x"yes")
+
 AC_CONFIG_HEADER(config.h)
 
 RTEMS_AMPOLISH3
@@ -324,7 +334,9 @@
 ftpd/Makefile
 telnetd/Makefile
 pppd/Makefile
-wrapup/Makefile])
+wrapup/Makefile
+wrapup-coverage/Makefile
+])
 
 AC_CONFIG_COMMANDS([preinstall-stamp],
 [test -z "$with_multisubdir" && ${MAKE} preinstall-stamp],
Index: cpukit/aclocal/enable-coverage.m4
===================================================================
RCS file: cpukit/aclocal/enable-coverage.m4
diff -N cpukit/aclocal/enable-coverage.m4
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ cpukit/aclocal/enable-coverage.m4	10 Sep 2009 14:34:13 -0000
@@ -0,0 +1,15 @@
+dnl $Id$
+
+AC_DEFUN([RTEMS_ENABLE_COVERAGE],
+[
+AC_ARG_ENABLE(coverage,
+[AS_HELP_STRING([--enable-coverage],
+[enable building for coverage testing])],
+[case "${enable_coverage}" in
+  yes) RTEMS_HAS_COVERAGE=yes ;;
+  exp*) RTEMS_HAS_COVERAGE=yes ; RTEMS_HAS_EXPERIMENTAL_COVERAGE=yes ;;
+  no) RTEMS_HAS_COVERAGE=no   ;;
+  *)  AC_MSG_ERROR(bad value ${enableval} for enable-coverage option) ;;
+esac], [RTEMS_HAS_COVERAGE=no])
+AC_SUBST(RTEMS_HAS_COVERAGE)
+])
Index: cpukit/wrapup-coverage/.cvsignore
===================================================================
RCS file: cpukit/wrapup-coverage/.cvsignore
diff -N cpukit/wrapup-coverage/.cvsignore
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ cpukit/wrapup-coverage/.cvsignore	10 Sep 2009 14:34:13 -0000
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
Index: cpukit/wrapup-coverage/Makefile.am
===================================================================
RCS file: cpukit/wrapup-coverage/Makefile.am
diff -N cpukit/wrapup-coverage/Makefile.am
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ cpukit/wrapup-coverage/Makefile.am	10 Sep 2009 14:34:13 -0000
@@ -0,0 +1,131 @@
+##
+## $Id$
+##
+
+include $(top_srcdir)/automake/multilib.am
+include $(top_srcdir)/automake/compile.am
+
+## Setup the variant build subdirectory
+ARCH = o-optimize
+
+noinst_LIBRARIES = libcoverage.a
+project_lib_DATA = rtems_coverage.o
+libcoverage_a_SOURCES =
+
+noinst_LIBRARIES += libsupp.a
+libsupp_a_SOURCES = start_coverage.c end_coverage.c
+
+TMP_LIBS =
+# Only do coverage on portable code at this point
+#TMP_LIBS += ../score/cpu/@RTEMS_CPU@/libscorecpu.a
+TMP_LIBS += ../score/libscore.a
+TMP_LIBS += ../sapi/libsapi.a
+TMP_LIBS += ../rtems/librtems.a
+
+if HAS_POSIX
+TMP_LIBS += ../posix/libposix.a
+endif
+
+if HAS_ITRON
+## Deprecated do not do coverage on ITRON
+#TMP_LIBS += ../itron/libitron.a
+endif
+
+if ENABLE_EXPERIMENTAL_COVERAGE
+TMP_LIBS += ../libcsupport/libcsupport.a
+endif
+
+#if !UNIX
+#TMP_LIBS += ../libblock/libblock.a
+#endif
+#if LIBDOSFS
+#TMP_LIBS += ../libfs/libdosfs.a
+#endif
+if ENABLE_EXPERIMENTAL_COVERAGE
+TMP_LIBS += ../libfs/libimfs.a
+endif
+
+#TMP_LIBS += ../libmisc/libmonitor.a
+## TODO: Coverage test libuntar
+#TMP_LIBS += ../libmisc/libuntar.a
+if ENABLE_EXPERIMENTAL_COVERAGE
+TMP_LIBS += ../libmisc/libstackchk.a
+TMP_LIBS += ../libmisc/libcpuuse.a
+endif
+
+#if LIBSHELL
+#TMP_LIBS += ../libmisc/libshell.a
+#endif
+
+if ENABLE_EXPERIMENTAL_COVERAGE
+TMP_LIBS += ../libmisc/libbspcmdline.a
+endif
+#TMP_LIBS += ../libmisc/libcapture.a
+if ENABLE_EXPERIMENTAL_COVERAGE
+TMP_LIBS += ../libmisc/libdumpbuf.a
+TMP_LIBS += ../libmisc/libdevnull.a
+endif
+
+## Dummy is dummy configuration -- DO NOT INCLUDE IT IN COVERAGE
+#TMP_LIBS += ../libmisc/libdummy.a
+
+#TMP_LIBS += ../libmisc/libfsmount.a
+#TMP_LIBS += ../libmisc/libmw-fb.a
+#TMP_LIBS += ../libmisc/libstringto.a
+#TMP_LIBS += ../libmisc/libuuid.a
+
+#TMP_LIBS += ../libi2c/libi2c.a
+
+## Do not coverage test networking code
+#if LIBNETWORKING
+#TMP_LIBS += ../libnetworking/libnetworking.a
+#TMP_LIBS += ../libnetworking/libc.a
+#TMP_LIBS += ../libnetworking/lib.a
+#endif
+
+#if LIBRPC
+#TMP_LIBS += ../librpc/librpc.a
+#TMP_LIBS += ../librpc/libxdr.a
+#endif
+
+## TODO: Coverage test libmd
+#if NEWLIB
+#TMP_LIBS += ../libmd/libmd.a
+#endif
+
+rtems_coverage.o: start_coverage.o end_coverage.o $(TMP_LIBS)
+	rm -f $@
+	$(MKDIR_P) $(ARCH)
+	rm -rf $(ARCH)/*.$(OBJEXT) $(ARCH)/*.rel
+	for f in $(TMP_LIBS); do \
+	  case $$f in \
+	  *.$(OBJEXT) | *.rel) \
+	    if test -f $(ARCH)/`basename $$f`; then \
+	      if cmp $$f $(ARCH)/`basename $$f`; then \
+		true; \
+	      else \
+		echo 1>&2 "ERROR -- `basename $$f` in multiple files"; \
+		exit 1; \
+	      fi; \
+	    else \
+	      cp $$f $(ARCH)/; \
+	      chmod a-w $(ARCH)/`basename $$f`; \
+	    fi; \
+	    ;; \
+	  *.a) \
+	    cd $(ARCH); \
+	      $(AR) xv ../$$f || exit 1; \
+	      chmod a-w * ; \
+            cd ..; \
+	    ;; \
+	  esac; \
+	done
+	ls $(ARCH)/* > $@-list
+	$(AR:ar=ld) -r -o $@ start_coverage.o @$@-list end_coverage.o
+	rm -f $@-list $(1)/*.$(OBJEXT) $(1)/*.rel
+	rm -rf $(1)
+
+all-local: $(TMPINSTALL_FILES)
+
+include $(srcdir)/preinstall.am
+include $(top_srcdir)/automake/local.am
Index: cpukit/wrapup-coverage/end_coverage.c
===================================================================
RCS file: cpukit/wrapup-coverage/end_coverage.c
diff -N cpukit/wrapup-coverage/end_coverage.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ cpukit/wrapup-coverage/end_coverage.c	10 Sep 2009 14:34:13 -0000
@@ -0,0 +1,2 @@
+void end_coverage(void){}
+
Index: cpukit/wrapup-coverage/preinstall.am
===================================================================
RCS file: cpukit/wrapup-coverage/preinstall.am
diff -N cpukit/wrapup-coverage/preinstall.am
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ cpukit/wrapup-coverage/preinstall.am	10 Sep 2009 14:34:13 -0000
@@ -0,0 +1,24 @@
+## Automatically generated by ampolish3 - Do not edit
+
+if AMPOLISH3
+$(srcdir)/preinstall.am: Makefile.am
+	$(AMPOLISH3) $(srcdir)/Makefile.am > $(srcdir)/preinstall.am
+endif
+
+PREINSTALL_DIRS =
+DISTCLEANFILES = $(PREINSTALL_DIRS)
+
+all-local: $(TMPINSTALL_FILES)
+
+TMPINSTALL_FILES =
+CLEANFILES = $(TMPINSTALL_FILES)
+
+$(PROJECT_LIB)/$(dirstamp):
+	@$(MKDIR_P) $(PROJECT_LIB)
+	@: > $(PROJECT_LIB)/$(dirstamp)
+PREINSTALL_DIRS += $(PROJECT_LIB)/$(dirstamp)
+
+$(PROJECT_LIB)/rtems_coverage.o: rtems_coverage.o $(PROJECT_LIB)/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_LIB)/rtems_coverage.o
+TMPINSTALL_FILES += $(PROJECT_LIB)/rtems_coverage.o
+
Index: cpukit/wrapup-coverage/start_coverage.c
===================================================================
RCS file: cpukit/wrapup-coverage/start_coverage.c
diff -N cpukit/wrapup-coverage/start_coverage.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ cpukit/wrapup-coverage/start_coverage.c	10 Sep 2009 14:34:13 -0000
@@ -0,0 +1 @@
+void start_coverage(void){}
Index: make/leaf.cfg
===================================================================
RCS file: /usr1/CVS/rtems/make/leaf.cfg,v
retrieving revision 1.19
diff -u -r1.19 leaf.cfg
--- make/leaf.cfg	6 Jun 2003 04:39:43 -0000	1.19
+++ make/leaf.cfg	10 Sep 2009 14:34:13 -0000
@@ -108,3 +108,7 @@
 .PHONY: distclean distclean-am
 .PHONY: clean clean-am
 endif
+
+ifeq ($(RTEMS_HAS_COVERAGE),yes)
+  COV_ARGS=$(PROJECT_RELEASE)/lib/rtems_coverage.o
+endif
Index: make/compilers/gcc-no_bsp.cfg
===================================================================
RCS file: /usr1/CVS/rtems/make/compilers/gcc-no_bsp.cfg,v
retrieving revision 1.11
diff -u -r1.11 gcc-no_bsp.cfg
--- make/compilers/gcc-no_bsp.cfg	6 Jun 2003 04:39:43 -0000	1.11
+++ make/compilers/gcc-no_bsp.cfg	10 Sep 2009 14:34:13 -0000
@@ -236,8 +236,10 @@
 # Create a RTEMS executable based on MANAGERS which was set in
 #  app's Makefile
 
+ifneq ($(RTEMS_HAS_COVERAGE),yes)
 MANAGERS_NOT_WANTED=$(filter-out $(MANAGERS), $(MANAGER_LIST))
 MANAGERS_NOT_WANTED:=$(filter-out $(MANAGERS_REQUIRED), $(MANAGERS_NOT_WANTED))
+endif
 
 # spell out all the LINK_FILE's, rather than using -lbsp, so
 #  that $(LINK_FILES) can be a dependency
Index: make/compilers/gcc-target-default.cfg
===================================================================
RCS file: /usr1/CVS/rtems/make/compilers/gcc-target-default.cfg,v
retrieving revision 1.38
diff -u -r1.38 gcc-target-default.cfg
--- make/compilers/gcc-target-default.cfg	6 Jun 2003 04:39:43 -0000	1.38
+++ make/compilers/gcc-target-default.cfg	10 Sep 2009 14:34:13 -0000
@@ -221,3 +221,9 @@
 	$(LINK.c) $(CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) \
 	  -qnolinkcmds -nostdlib -Wl,-r $(XLDFLAGS) -o $@ $^
 endef
+
+ifeq ($(RTEMS_HAS_COVERAGE),yes)
+  CFLAGS_OPTIMIZE_V = -Os -g
+else
+  CFLAGS_OPTIMIZE_V = -O2 -g
+endif
Index: make/custom/erc32.cfg
===================================================================
RCS file: /usr1/CVS/rtems/make/custom/erc32.cfg,v
retrieving revision 1.27.6.3
diff -u -r1.27.6.3 erc32.cfg
--- make/custom/erc32.cfg	18 Jan 2007 11:27:07 -0000	1.27.6.3
+++ make/custom/erc32.cfg	10 Sep 2009 14:34:13 -0000
@@ -24,7 +24,7 @@
 # is currently required.
 
 define make-exe
-	$(LINK.c) $(AM_CFLAGS) $(AM_LDFLAGS) -o $(basename $@).exe \
+	$(LINK.c) $(AM_CFLAGS) $(COV_ARGS) $(AM_LDFLAGS) -o $(basename $@).exe \
 	    $(LINK_OBJS) $(LINK_LIBS)
 	$(NM) -g -n $(basename $@).exe > $(basename $@).num
 	$(SIZE) $(basename $@).exe
Index: testsuites/aclocal/enable-coverage.m4
===================================================================
RCS file: testsuites/aclocal/enable-coverage.m4
diff -N testsuites/aclocal/enable-coverage.m4
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuites/aclocal/enable-coverage.m4	10 Sep 2009 14:34:13 -0000
@@ -0,0 +1,15 @@
+dnl $Id$
+
+AC_DEFUN([RTEMS_ENABLE_COVERAGE],
+[
+AC_ARG_ENABLE(coverage,
+[AS_HELP_STRING([--enable-coverage],
+[enable building for coverage testing])],
+[case "${enable_coverage}" in
+  yes) RTEMS_HAS_COVERAGE=yes ;;
+  exp*) RTEMS_HAS_COVERAGE=yes ; RTEMS_HAS_EXPERIMENTAL_COVERAGE=yes ;;
+  no) RTEMS_HAS_COVERAGE=no   ;;
+  *)  AC_MSG_ERROR(bad value ${enableval} for enable-coverage option) ;;
+esac], [RTEMS_HAS_COVERAGE=no])
+AC_SUBST(RTEMS_HAS_COVERAGE)
+])
Index: testsuites/itrontests/configure.ac
===================================================================
RCS file: /usr1/CVS/rtems/testsuites/itrontests/configure.ac,v
retrieving revision 1.17.2.2
diff -u -r1.17.2.2 configure.ac
--- testsuites/itrontests/configure.ac	2 Dec 2006 06:09:33 -0000	1.17.2.2
+++ testsuites/itrontests/configure.ac	10 Sep 2009 14:34:13 -0000
@@ -12,7 +12,6 @@
 AM_INIT_AUTOMAKE([no-define foreign 1.10])
 AM_MAINTAINER_MODE
 
-
 RTEMS_ENV_RTEMSBSP
 
 RTEMS_PROJECT_ROOT
@@ -23,6 +22,8 @@
 
 RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
 
+RTEMS_ENABLE_COVERAGE
+AM_CONDITIONAL([HAS_COVERAGE],[test $RTEMS_HAS_COVERAGE = "yes"])
 
 # Explicitly list all Makefiles here
 AC_CONFIG_FILES([Makefile
Index: testsuites/libtests/configure.ac
===================================================================
RCS file: /usr1/CVS/rtems/testsuites/libtests/configure.ac,v
retrieving revision 1.16.2.2
diff -u -r1.16.2.2 configure.ac
--- testsuites/libtests/configure.ac	2 Dec 2006 06:09:36 -0000	1.16.2.2
+++ testsuites/libtests/configure.ac	10 Sep 2009 14:34:13 -0000
@@ -28,9 +28,11 @@
 RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
 RTEMS_CHECK_CXX(RTEMS_BSP)
 
-
 AM_CONDITIONAL(HAS_CXX,test "$rtems_cv_HAS_CPLUSPLUS" = "yes")
 
+RTEMS_ENABLE_COVERAGE
+AM_CONDITIONAL([HAS_COVERAGE],[test $RTEMS_HAS_COVERAGE = "yes"])
+
 # Explicitly list all Makefiles here
 AC_CONFIG_FILES([Makefile
 cpuuse/Makefile
Index: testsuites/mptests/configure.ac
===================================================================
RCS file: /usr1/CVS/rtems/testsuites/mptests/configure.ac,v
retrieving revision 1.19.2.2
diff -u -r1.19.2.2 configure.ac
--- testsuites/mptests/configure.ac	2 Dec 2006 06:09:41 -0000	1.19.2.2
+++ testsuites/mptests/configure.ac	10 Sep 2009 14:34:13 -0000
@@ -31,6 +31,9 @@
 AC_ARG_VAR([MAX_LONG_TEST_DURATION],
 [The longest length of time a "long running" test should run])
 
+RTEMS_ENABLE_COVERAGE
+AM_CONDITIONAL([HAS_COVERAGE],[test $RTEMS_HAS_COVERAGE = "yes"])
+
 # Explicitly list all Makefiles here
 AC_CONFIG_FILES([Makefile
 mp01/Makefile
Index: testsuites/psxtests/configure.ac
===================================================================
RCS file: /usr1/CVS/rtems/testsuites/psxtests/configure.ac,v
retrieving revision 1.18.2.2
diff -u -r1.18.2.2 configure.ac
--- testsuites/psxtests/configure.ac	2 Dec 2006 06:09:45 -0000	1.18.2.2
+++ testsuites/psxtests/configure.ac	10 Sep 2009 14:34:13 -0000
@@ -24,6 +24,9 @@
 RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
 
 
+RTEMS_ENABLE_COVERAGE
+AM_CONDITIONAL([HAS_COVERAGE],[test $RTEMS_HAS_COVERAGE = "yes"])
+
 # Explicitly list all Makefiles here
 AC_CONFIG_FILES([Makefile
 psx01/Makefile
Index: testsuites/samples/configure.ac
===================================================================
RCS file: /usr1/CVS/rtems/testsuites/samples/configure.ac,v
retrieving revision 1.25.2.2
diff -u -r1.25.2.2 configure.ac
--- testsuites/samples/configure.ac	2 Dec 2006 06:09:50 -0000	1.25.2.2
+++ testsuites/samples/configure.ac	10 Sep 2009 14:34:13 -0000
@@ -58,6 +58,9 @@
 #FIXME: We should use a feature based check
 AM_CONDITIONAL(LIBCHIP,[test "$RTEMS_BSP_FAMILY" != "posix"])
 
+RTEMS_ENABLE_COVERAGE
+AM_CONDITIONAL([HAS_COVERAGE],[test $RTEMS_HAS_COVERAGE = "yes"])
+
 # Explicitly list all Makefiles here
 AC_CONFIG_FILES([Makefile
 base_sp/Makefile
Index: testsuites/sptests/configure.ac
===================================================================
RCS file: /usr1/CVS/rtems/testsuites/sptests/configure.ac,v
retrieving revision 1.21.2.4
diff -u -r1.21.2.4 configure.ac
--- testsuites/sptests/configure.ac	21 Jan 2009 20:48:28 -0000	1.21.2.4
+++ testsuites/sptests/configure.ac	10 Sep 2009 14:34:13 -0000
@@ -25,6 +25,9 @@
 RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
 
 
+RTEMS_ENABLE_COVERAGE
+AM_CONDITIONAL([HAS_COVERAGE],[test $RTEMS_HAS_COVERAGE = "yes"])
+
 # Explicitly list all Makefiles here
 AC_CONFIG_FILES([Makefile
 sp01/Makefile
Index: testsuites/tmitrontests/configure.ac
===================================================================
RCS file: /usr1/CVS/rtems/testsuites/tmitrontests/configure.ac,v
retrieving revision 1.18.2.2
diff -u -r1.18.2.2 configure.ac
--- testsuites/tmitrontests/configure.ac	2 Dec 2006 06:09:58 -0000	1.18.2.2
+++ testsuites/tmitrontests/configure.ac	10 Sep 2009 14:34:13 -0000
@@ -23,6 +23,9 @@
 
 RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
 
+RTEMS_ENABLE_COVERAGE
+AM_CONDITIONAL([HAS_COVERAGE],[test $RTEMS_HAS_COVERAGE = "yes"])
+
 
 OPERATION_COUNT=${OPERATION_COUNT-100}
 AC_SUBST(OPERATION_COUNT)
Index: testsuites/tmtests/configure.ac
===================================================================
RCS file: /usr1/CVS/rtems/testsuites/tmtests/configure.ac,v
retrieving revision 1.18.2.2
diff -u -r1.18.2.2 configure.ac
--- testsuites/tmtests/configure.ac	2 Dec 2006 06:10:03 -0000	1.18.2.2
+++ testsuites/tmtests/configure.ac	10 Sep 2009 14:34:13 -0000
@@ -24,6 +24,9 @@
 
 RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
 
+RTEMS_ENABLE_COVERAGE
+AM_CONDITIONAL([HAS_COVERAGE],[test $RTEMS_HAS_COVERAGE = "yes"])
+
 
 OPERATION_COUNT=${OPERATION_COUNT-100}
 AC_SUBST(OPERATION_COUNT)