aboutsummaryrefslogtreecommitdiff
path: root/gcc/coverage.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2016-11-25 15:23:25 +0100
committerMartin Liska <marxin@gcc.gnu.org>2016-11-25 14:23:25 +0000
commit78681a7b92549b1daa579aeeb78bb498aa167040 (patch)
treeb8258052adb5bdf2b8dba387b6948962aa3effe0 /gcc/coverage.c
parenta77af1829fd2dc976599383d01ab4467c05eba5b (diff)
Don't use priority {cd}tors if not supported by a target (PR
PR gcov-profile/78086 * g++.dg/gcov/pr16855.C: Clean up the test case. * g++.dg/gcov/pr16855-priority.C: New test. * coverage.c (build_init_ctor): Don't use priority {cd}tors if not supported by a target. Set priority to 100 if possible. (build_gcov_exit_decl): Likewise. From-SVN: r242877
Diffstat (limited to 'gcc/coverage.c')
-rw-r--r--gcc/coverage.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/coverage.c b/gcc/coverage.c
index 8810710be4f..4167e26b208 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -1056,8 +1056,10 @@ build_init_ctor (tree gcov_info_type)
stmt = build_call_expr (init_fn, 1, stmt);
append_to_statement_list (stmt, &ctor);
- /* Generate a constructor to run it (with priority 99). */
- cgraph_build_static_cdtor ('I', ctor, DEFAULT_INIT_PRIORITY - 1);
+ /* Generate a constructor to run it. */
+ int priority = SUPPORTS_INIT_PRIORITY
+ ? MAX_RESERVED_INIT_PRIORITY: DEFAULT_INIT_PRIORITY;
+ cgraph_build_static_cdtor ('I', ctor, priority);
}
/* Generate the destructor function to call __gcov_exit. */
@@ -1078,8 +1080,11 @@ build_gcov_exit_decl (void)
tree stmt = build_call_expr (init_fn, 0);
append_to_statement_list (stmt, &dtor);
- /* Generate a destructor to run it (with priority 99). */
- cgraph_build_static_cdtor ('D', dtor, MAX_RESERVED_INIT_PRIORITY - 1);
+ /* Generate a destructor to run it. */
+ int priority = SUPPORTS_INIT_PRIORITY
+ ? MAX_RESERVED_INIT_PRIORITY: DEFAULT_INIT_PRIORITY;
+
+ cgraph_build_static_cdtor ('D', dtor, priority);
}
/* Create the gcov_info types and object. Generate the constructor