aboutsummaryrefslogtreecommitdiff
path: root/gcc/opts.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-11-13 17:47:40 +0100
committerMartin Liska <mliska@suse.cz>2020-11-16 12:52:14 +0100
commit27f7fb79d27bd4a4a7f04d4970c06e9050a6564e (patch)
tree4af8d2df27787d146b742cc8cde93ea3e668c084 /gcc/opts.c
parentd0a206abc6cbf0e992bf82bbb3584686eae05d34 (diff)
downloadgcc-27f7fb79d27bd4a4a7f04d4970c06e9050a6564e.zip
gcc-27f7fb79d27bd4a4a7f04d4970c06e9050a6564e.tar.gz
gcc-27f7fb79d27bd4a4a7f04d4970c06e9050a6564e.tar.bz2
gcov: Add -fprofile-info-section support
Register the profile information in the specified section instead of using a constructor/destructor. A pointer to the profile information generated by -fprofile-arcs or -ftest-coverage is placed in the specified section for each translation unit. This option disables the profile information registration through a constructor and it disables the profile information processing through a destructor. I am not sure how I can test this option. One approach would be to assemble a test file, then scan it and check that a .gcov_info section is present and no __gcov_init() and __gcov_exit() calls are present. Is there an example for this in the test suite? gcc/ * common.opt (fprofile-info-section): New. * coverage.c (build_gcov_info_var_registration): New. (coverage_obj_init): Evaluate profile_info_section and use build_gcov_info_var_registration(). * doc/invoke.texi (fprofile-info-section): Document. * opts.c (common_handle_option): Process fprofile-info-section option. gcc/testsuite/ChangeLog: * gcc.dg/profile-info-section.c: New test.
Diffstat (limited to 'gcc/opts.c')
-rw-r--r--gcc/opts.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/opts.c b/gcc/opts.c
index ac9972d..5777491 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -2596,6 +2596,10 @@ common_handle_option (struct gcc_options *opts,
SET_OPTION_IF_UNSET (opts, opts_set, flag_ipa_bit_cp, value);
break;
+ case OPT_fprofile_info_section:
+ opts->x_profile_info_section = ".gcov_info";
+ break;
+
case OPT_fpatchable_function_entry_:
{
char *patch_area_arg = xstrdup (arg);