gcc.c (option_map): Add --coverage.

* gcc.c (option_map): Add --coverage.
	(LINK_COMMAND_SPEC): Pass -lgcov for `coverage'.
	(cc1_options): Pass -fprofile-arcs -ftest-coverage for `coverage'.
	* config/darwin.h: Pass -lgcov for `coverage'.
	* doc/invoke.texi (Debugging Options): Document --coverage.

From-SVN: r95878
This commit is contained in:
Ben Elliston 2005-03-04 04:43:03 +00:00 committed by Ben Elliston
parent c7d1b44986
commit ee4c708e37
4 changed files with 22 additions and 3 deletions

View File

@ -1,3 +1,11 @@
2005-03-04 Ben Elliston <bje@au.ibm.com>
* gcc.c (option_map): Add --coverage.
(LINK_COMMAND_SPEC): Pass -lgcov for `coverage'.
(cc1_options): Pass -fprofile-arcs -ftest-coverage for `coverage'.
* config/darwin.h: Pass -lgcov for `coverage'.
* doc/invoke.texi (Debugging Options): Document --coverage.
2005-03-04 Kazu Hirata <kazu@cs.umass.edu>
* gcse.c (bypass_block): Use find_edge wherever possible.

View File

@ -226,7 +226,7 @@ extern const char *darwin_fix_and_continue_switch;
%{!Zdynamiclib:%{A} %{e*} %{m} %{N} %{n} %{r} %{u*} %{x} %{z}} \
%{@:-o %f%u.out}%{!@:%{o*}%{!o:-o a.out}} \
%{!Zdynamiclib:%{!A:%{!nostdlib:%{!nostartfiles:%S}}}} \
%{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate:-lgcov} \
%{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate|coverage:-lgcov} \
%{!nostdlib:%{!nodefaultlibs:%G %L}} \
%{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} %{F*} }}}}}}}}"

View File

@ -3345,6 +3345,15 @@ the basename of the source file. In both cases any suffix is removed
(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
@cindex @command{gcov}
@item --coverage
@opindex coverage
This option is used to compile and link code instrumented for coverage
analysis. The option is a synonym for @option{-fprofile-arcs}
@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
linking). See the documentation for those options for more details.
@itemize
@item

View File

@ -700,7 +700,7 @@ proper position among the other output files. */
%(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
%{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
%{static:} %{L*} %(mfwrap) %(link_libgcc) %o %(mflib)\
%{fprofile-arcs|fprofile-generate:-lgcov}\
%{fprofile-arcs|fprofile-generate|coverage:-lgcov}\
%{!nostdlib:%{!nodefaultlibs:%(link_gcc_c_sequence)}}\
%{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}"
#endif
@ -796,7 +796,8 @@ static const char *cc1_options =
%{--target-help:--target-help}\
%{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}}\
%{fsyntax-only:-o %j} %{-param*}\
%{fmudflap|fmudflapth:-fno-builtin -fno-merge-constants}";
%{fmudflap|fmudflapth:-fno-builtin -fno-merge-constants}\
%{coverage:-fprofile-arcs -ftest-coverage}";
static const char *asm_options =
"%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}";
@ -1065,6 +1066,7 @@ static const struct option_map option_map[] =
{"--for-assembler", "-Wa", "a"},
{"--for-linker", "-Xlinker", "a"},
{"--force-link", "-u", "a"},
{"--coverage", "-coverage", 0},
{"--imacros", "-imacros", "a"},
{"--include", "-include", "a"},
{"--include-barrier", "-I-", 0},