summaryrefslogtreecommitdiff
path: root/gcc/coverage.c
diff options
context:
space:
mode:
authormarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2016-11-25 14:23:25 +0000
committermarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2016-11-25 14:23:25 +0000
commit2d799bac340201721d62f4bbf5e54195ec2bf144 (patch)
treeb8258052adb5bdf2b8dba387b6948962aa3effe0 /gcc/coverage.c
parentd48f0d355c68153ea4af57cace7f548a59e7e42d (diff)
downloadgcc-2d799bac340201721d62f4bbf5e54195ec2bf144.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242877 138bc75d-0d04-0410-961f-82ee72b054a4
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