diff mbox

Do not declare artificial variables in tree-profile.c to have a definition (PR lto/69188).

Message ID 3f5ec8b3-3704-32a9-4db9-6aff7e246c8c@suse.cz
State New
Headers show

Commit Message

Martin Liška Jan. 13, 2017, 3:08 p.m. UTC
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

Comments

Jeff Law Jan. 13, 2017, 5:21 p.m. UTC | #1
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
Martin Liška Jan. 20, 2017, 9:46 a.m. UTC | #2
On 01/13/2017 06:21 PM, Jeff Law 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

> 


May I install the same patch to both active branches after it survives regression tests?

Thanks,
Martin
Jeff Law Jan. 20, 2017, 7:14 p.m. UTC | #3
On 01/20/2017 02:46 AM, Martin Liška wrote:
> On 01/13/2017 06:21 PM, Jeff Law 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

>>

>

> May I install the same patch to both active branches after it survives regression tests?

Yes.

jeff
Christophe Lyon Jan. 23, 2017, 9:58 a.m. UTC | #4
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*.

Christophe
Kyrill Tkachov Jan. 23, 2017, 10:05 a.m. UTC | #5
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.


> Christophediff --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) 
 { 

Martin Liška Jan. 23, 2017, 10:07 a.m. UTC | #6
On 01/23/2017 11:05 AM, Kyrill Tkachov wrote:
> 

> 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


Hi Kyrill.

Thanks for the patch.

Martin

> 

> 2016-01-23  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

> 

>     * gcc.dg/lto/pr69188_0.c: Require profiling support for testcase.

> 

> 

>> Christophe

>
Jeff Law Jan. 23, 2017, 4:16 p.m. UTC | #7
On 01/23/2017 03:05 AM, Kyrill Tkachov wrote:
>

> 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.

OK.
jeff
diff mbox

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.
---
 gcc/testsuite/gcc.dg/lto/pr69188_0.c |  7 +++++++
 gcc/testsuite/gcc.dg/lto/pr69188_1.c | 10 ++++++++++
 gcc/tree-profile.c                   |  6 ------
 3 files changed, 17 insertions(+), 6 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/lto/pr69188_0.c
 create mode 100644 gcc/testsuite/gcc.dg/lto/pr69188_1.c

diff --git a/gcc/testsuite/gcc.dg/lto/pr69188_0.c b/gcc/testsuite/gcc.dg/lto/pr69188_0.c
new file mode 100644
index 00000000000..8bee874a65b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr69188_0.c
@@ -0,0 +1,7 @@ 
+/* PR ipa/69188 */
+/* { dg-lto-do link } */
+/* { dg-lto-options { { -flto -O0 -fprofile-generate } } } */
+
+void fn1(void) 
+{ 
+}
diff --git a/gcc/testsuite/gcc.dg/lto/pr69188_1.c b/gcc/testsuite/gcc.dg/lto/pr69188_1.c
new file mode 100644
index 00000000000..3ed9d5560c6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr69188_1.c
@@ -0,0 +1,10 @@ 
+/* PR ipa/69188 */
+/* { dg-options "-flto -O1 -fprofile-generate" } */
+
+extern void fn1(void);
+
+int main() {
+  fn1();
+  return 0;
+}
+
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
index 186cfdf7929..a49ec37f8bb 100644
--- a/gcc/tree-profile.c
+++ b/gcc/tree-profile.c
@@ -94,8 +94,6 @@  init_ic_make_global_vars (void)
   if (targetm.have_tls)
     set_decl_tls_model (ic_void_ptr_var, decl_default_tls_model (ic_void_ptr_var));
 
-  varpool_node::finalize_decl (ic_void_ptr_var);
-
   gcov_type_ptr = build_pointer_type (get_gcov_type ());
 
   ic_gcov_type_ptr_var
@@ -112,8 +110,6 @@  init_ic_make_global_vars (void)
   DECL_INITIAL (ic_gcov_type_ptr_var) = NULL;
   if (targetm.have_tls)
     set_decl_tls_model (ic_gcov_type_ptr_var, decl_default_tls_model (ic_gcov_type_ptr_var));
-
-  varpool_node::finalize_decl (ic_gcov_type_ptr_var);
 }
 
 /* Create the type and function decls for the interface with gcov.  */
@@ -210,8 +206,6 @@  gimple_init_gcov_profiler (void)
       DECL_ARTIFICIAL (tree_time_profiler_counter) = 1;
       DECL_INITIAL (tree_time_profiler_counter) = NULL;
 
-      varpool_node::finalize_decl (tree_time_profiler_counter);
-
       /* void (*) (gcov_type *, gcov_type)  */
       average_profiler_fn_type
 	      = build_function_type_list (void_type_node,
-- 
2.11.0