This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Do not declare artificial variables in tree-profile.c to have a definition (PR lto/69188).
- From: Kyrill Tkachov <kyrylo dot tkachov at foss dot arm dot com>
- To: Christophe Lyon <christophe dot lyon at linaro dot org>, Jeff Law <law at redhat dot com>
- Cc: Martin Liška <mliska at suse dot cz>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Jan Hubicka <hubicka at ucw dot cz>
- Date: Mon, 23 Jan 2017 10:05:41 +0000
- Subject: Re: [PATCH] Do not declare artificial variables in tree-profile.c to have a definition (PR lto/69188).
- Authentication-results: sourceware.org; auth=none
- References: <3f5ec8b3-3704-32a9-4db9-6aff7e246c8c@suse.cz> <72377e85-f866-6482-5f08-e2f2311ebc2f@redhat.com> <CAKdteObWB=8anGZk8B1bH1+QhNwbc3W3aJQD-ryiJ2YBaWJ4UA@mail.gmail.com>
On 23/01/17 09:58, Christophe Lyon wrote:
On 13 January 2017 at 18:21, Jeff Law <law@redhat.com> wrote:
On 01/13/2017 08:08 AM, Martin Liška wrote:
Hello.
Nice example provided in the PR causes ICE as we have an artificial symbol
created in tree-profile.c once being removed by remove unreachable nodes
(-O0)
and once not (-O1). Well, difference is in process_references where
following hunk
prevent removal:
|| (((before_inlining_p
&& ((TREE_CODE (node->decl) != FUNCTION_DECL
&& optimize)
Anyway, these artificial symbols really should be just declarations as
they are defined
in libgcov library.
Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
Ready to be installed?
Martin
0001-Do-not-declare-artificial-variables-in-tree-profile..patch
From 87262b1b60009381fd943fb433bc38f5d5685ac9 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Fri, 13 Jan 2017 13:12:57 +0100
Subject: [PATCH] Do not declare artificial variables in tree-profile.c to
have
a definition (PR lto/69188).
gcc/testsuite/ChangeLog:
2017-01-13 Martin Liska <mliska@suse.cz>
PR lto/69188
* gcc.dg/lto/pr69188_0.c: New test.
* gcc.dg/lto/pr69188_1.c: New test.
gcc/ChangeLog:
2017-01-13 Martin Liska <mliska@suse.cz>
PR lto/69188
* tree-profile.c (init_ic_make_global_vars): Do not call
finalize_decl.
(gimple_init_gcov_profiler): Likewise.
OK.
jeff
Hi,
The new test fails on arm-none-eabi:
/cc6RcpEu.ltrans0.ltrans.o: In function `fn1':
<artificial>:(.text+0x18): undefined reference to
`__gcov_indirect_call_profiler_v2'
<artificial>:(.text+0x1c): undefined reference to `__gcov_indirect_call_callee'
<artificial>:(.text+0x20): undefined reference to `__gcov_indirect_call_callee'
<artificial>:(.text+0x60): undefined reference to `__gcov_time_profiler_counter'
<artificial>:(.text+0x64): undefined reference to `__gcov_time_profiler_counter'
<artificial>:(.text+0x80): undefined reference to `__gcov_time_profiler_counter'
<artificial>:(.text+0x84): undefined reference to `__gcov_time_profiler_counter'
/cc6RcpEu.ltrans0.ltrans.o: In function `_GLOBAL__sub_D_00100_1_fn1':
<artificial>:(.text+0xb8): undefined reference to `__gcov_exit'
/cc6RcpEu.ltrans0.ltrans.o: In function `main':
<artificial>:(.text+0xd4): undefined reference to
`__gcov_indirect_call_profiler_v2'
<artificial>:(.text+0xd8): undefined reference to `__gcov_indirect_call_callee'
<artificial>:(.text+0xdc): undefined reference to `__gcov_indirect_call_callee'
<artificial>:(.text+0x10c): undefined reference to
`__gcov_time_profiler_counter'
<artificial>:(.text+0x110): undefined reference to
`__gcov_time_profiler_counter'
/cc6RcpEu.ltrans0.ltrans.o: In function `_GLOBAL__sub_D_00100_1_main':
<artificial>:(.text+0x180): undefined reference to `__gcov_exit'
/cc6RcpEu.ltrans0.ltrans.o:(.data+0x4c): undefined reference to
`__gcov_merge_time_profile'
/cc6RcpEu.ltrans0.ltrans.o:(.data+0xac): undefined reference to
`__gcov_merge_time_profile'
collect2: error: ld returned 1 exit status
FAIL: gcc.dg/lto/pr69188 c_lto_pr69188_0.o-c_lto_pr69188_1.o link,
-flto -O0 -fprofile-generate
It works on arm-linux*.
Hi,
The testcase fails on bare-metal targets that don't support profiling.
I believe it needs to be guarded with dg-require-profiling (I grepped around the testsuite for similar directives).
With this patch the testcase appears unsupported on aarch64-none-elf where I observed the failure.
Ok to commit?
Thanks,
Kyrill
2016-01-23 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* gcc.dg/lto/pr69188_0.c: Require profiling support for testcase.
Christophe
diff --git a/gcc/testsuite/gcc.dg/lto/pr69188_0.c b/gcc/testsuite/gcc.dg/lto/pr69188_0.c
index 8bee874..a0b6ad9 100644
--- a/gcc/testsuite/gcc.dg/lto/pr69188_0.c
+++ b/gcc/testsuite/gcc.dg/lto/pr69188_0.c
@@ -1,6 +1,7 @@
/* PR ipa/69188 */
/* { dg-lto-do link } */
/* { dg-lto-options { { -flto -O0 -fprofile-generate } } } */
+/* { dg-require-profiling "-fprofile-generate" } */
void fn1(void)
{