All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gcov: support GCC 7.1
@ 2016-10-31  9:35 Martin Liška
  2016-11-09  9:21 ` Peter Oberparleiter
  0 siblings, 1 reply; 5+ messages in thread
From: Martin Liška @ 2016-10-31  9:35 UTC (permalink / raw)
  To: lkml; +Cc: oberpar

[-- Attachment #1: Type: text/plain, Size: 126 bytes --]

Hello.

Starting from GCC 7.1, __gcov_exit is a new symbol expected
to be implemented in a profiling runtime.

Thanks,
Martin

[-- Attachment #2: 0001-gcov-support-GCC-7.1.patch --]
[-- Type: text/x-patch, Size: 838 bytes --]

>From 84a106c16adc9591b546da7feb0fc539314e079d Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Fri, 30 Sep 2016 14:00:20 +0200
Subject: [PATCH] gcov: support GCC 7.1

Starting from GCC 7.1, __gcov_exit is a new symbol expected
to be implemented in a profiling runtime.

Signed-off-by: Martin Liska <mliska@suse.cz>
---
 kernel/gcov/base.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/kernel/gcov/base.c b/kernel/gcov/base.c
index 2f9df37..85dca5d 100644
--- a/kernel/gcov/base.c
+++ b/kernel/gcov/base.c
@@ -98,6 +98,12 @@ void __gcov_merge_icall_topn(gcov_type *counters, unsigned int n_counters)
 }
 EXPORT_SYMBOL(__gcov_merge_icall_topn);
 
+void __gcov_exit (void)
+{
+	/* Unused. */
+}
+EXPORT_SYMBOL(__gcov_exit);
+
 /**
  * gcov_enable_events - enable event reporting through gcov_event()
  *
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] gcov: support GCC 7.1
  2016-10-31  9:35 [PATCH] gcov: support GCC 7.1 Martin Liška
@ 2016-11-09  9:21 ` Peter Oberparleiter
  2016-11-24 12:46   ` Martin Liška
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Oberparleiter @ 2016-11-09  9:21 UTC (permalink / raw)
  To: Martin Liška; +Cc: lkml

On 31.10.2016 10:35, Martin Liška wrote:
> Starting from GCC 7.1, __gcov_exit is a new symbol expected
> to be implemented in a profiling runtime.

I tested your patch with kernel 4.9-rc4 compiled with GCC 7.0.0 20161107
(experimental) and validated that it fixes the build error due to a
missing __gcov_exit symbol.

An attempt to read from one of the .gcda files generated by a kernel
compiled this way resulted in a crash though. It appears that the number
of GCOV_COUNTERS has changed again for GCC 7.x and must be adjusted in
the kernel as well. Could you add that to your patch as well?

Given that GCC 7.1 has not yet been released, I'm wondering if it is
safe to program against interfaces that have not yet been fully
finalized. Can you provide an indication on whether these gcov-related
aspects of GCC might still be changed until release?

As a side note, please post your patches inline instead of as attachment
as that helps quoting them in replies. See also
linux/Documentation/SubmittingPatches.

-- 
Peter Oberparleiter
Linux on z Systems Development - IBM Germany

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] gcov: support GCC 7.1
  2016-11-09  9:21 ` Peter Oberparleiter
@ 2016-11-24 12:46   ` Martin Liška
  2016-12-08 12:52     ` Peter Oberparleiter
  0 siblings, 1 reply; 5+ messages in thread
From: Martin Liška @ 2016-11-24 12:46 UTC (permalink / raw)
  To: Peter Oberparleiter; +Cc: lkml

On 11/09/2016 10:21 AM, Peter Oberparleiter wrote:
> On 31.10.2016 10:35, Martin Liška wrote:
>> Starting from GCC 7.1, __gcov_exit is a new symbol expected
>> to be implemented in a profiling runtime.
> 
> I tested your patch with kernel 4.9-rc4 compiled with GCC 7.0.0 20161107
> (experimental) and validated that it fixes the build error due to a
> missing __gcov_exit symbol.
> 
> An attempt to read from one of the .gcda files generated by a kernel
> compiled this way resulted in a crash though. It appears that the number
> of GCOV_COUNTERS has changed again for GCC 7.x and must be adjusted in
> the kernel as well. Could you add that to your patch as well?

Hello.

Sorry, this is fixed in second version of the patch.

> 
> Given that GCC 7.1 has not yet been released, I'm wondering if it is
> safe to program against interfaces that have not yet been fully
> finalized. Can you provide an indication on whether these gcov-related
> aspects of GCC might still be changed until release?

Well, we just flipped to stage3 which means that any new features should
be added to current master. If you prefer we can commit the patch after
a release of 7.1 will be done?

> 
> As a side note, please post your patches inline instead of as attachment
> as that helps quoting them in replies. See also
> linux/Documentation/SubmittingPatches.
> 

Sure, thanks for info. I'm attaching new version:

Starting from GCC 7.1, __gcov_exit is a new symbol expected
to be implemented in a profiling runtime. Update number of profile
counters.

Signed-off-by: Martin Liska <mliska@suse.cz>
---
 kernel/gcov/base.c    | 6 ++++++
 kernel/gcov/gcc_4_7.c | 4 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/kernel/gcov/base.c b/kernel/gcov/base.c
index 2f9df37..85dca5d 100644
--- a/kernel/gcov/base.c
+++ b/kernel/gcov/base.c
@@ -98,6 +98,12 @@ void __gcov_merge_icall_topn(gcov_type *counters, unsigned int n_counters)
 }
 EXPORT_SYMBOL(__gcov_merge_icall_topn);
 
+void __gcov_exit (void)
+{
+	/* Unused. */
+}
+EXPORT_SYMBOL(__gcov_exit);
+
 /**
  * gcov_enable_events - enable event reporting through gcov_event()
  *
diff --git a/kernel/gcov/gcc_4_7.c b/kernel/gcov/gcc_4_7.c
index 6a5c239..46a18e7 100644
--- a/kernel/gcov/gcc_4_7.c
+++ b/kernel/gcov/gcc_4_7.c
@@ -18,7 +18,9 @@
 #include <linux/vmalloc.h>
 #include "gcov.h"
 
-#if (__GNUC__ > 5) || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
+#if (__GNUC__ >= 7)
+#define GCOV_COUNTERS			9
+#elif (__GNUC__ > 5) || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
 #define GCOV_COUNTERS			10
 #elif __GNUC__ == 4 && __GNUC_MINOR__ >= 9
 #define GCOV_COUNTERS			9
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] gcov: support GCC 7.1
  2016-11-24 12:46   ` Martin Liška
@ 2016-12-08 12:52     ` Peter Oberparleiter
  2017-05-08 10:54       ` Peter Oberparleiter
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Oberparleiter @ 2016-12-08 12:52 UTC (permalink / raw)
  To: Martin Liška; +Cc: lkml, Andrew Morton

On 24.11.2016 13:46, Martin Liška wrote:
> On 11/09/2016 10:21 AM, Peter Oberparleiter wrote:
>> On 31.10.2016 10:35, Martin Liška wrote:
>>> Starting from GCC 7.1, __gcov_exit is a new symbol expected
>>> to be implemented in a profiling runtime.
>>
>> I tested your patch with kernel 4.9-rc4 compiled with GCC 7.0.0 20161107
>> (experimental) and validated that it fixes the build error due to a
>> missing __gcov_exit symbol.
>>
>> An attempt to read from one of the .gcda files generated by a kernel
>> compiled this way resulted in a crash though. It appears that the number
>> of GCOV_COUNTERS has changed again for GCC 7.x and must be adjusted in
>> the kernel as well. Could you add that to your patch as well?
> 
> Hello.
> 
> Sorry, this is fixed in second version of the patch.
> 
>> Given that GCC 7.1 has not yet been released, I'm wondering if it is
>> safe to program against interfaces that have not yet been fully
>> finalized. Can you provide an indication on whether these gcov-related
>> aspects of GCC might still be changed until release?
> 
> Well, we just flipped to stage3 which means that any new features should
> be added to current master. If you prefer we can commit the patch after
> a release of 7.1 will be done?

I've given this some more thought: if your patch is not applied, GCOV
kernel profiling will definitely not work with GCC 7.x. If it is
applied, there is a high probability that it will work, and a small
chance that additional patches will be required. Overall I would say
this justifies applying the patch now.

>> As a side note, please post your patches inline instead of as attachment
>> as that helps quoting them in replies. See also
>> linux/Documentation/SubmittingPatches.
> 
> Sure, thanks for info. I'm attaching new version:
> 
> Starting from GCC 7.1, __gcov_exit is a new symbol expected
> to be implemented in a profiling runtime. Update number of profile
> counters.
>
> Signed-off-by: Martin Liska <mliska@suse.cz>

Looks good, thanks! Tested successfully with GCC 7.0.0 20161208
(experimental) on Linux kernel 4.9-rc8 (compiles successfully and
produces valid kernel .gcda files).

Andrew, could you pick this change up via your tree?

Reviewed-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Tested-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>

> ---
>  kernel/gcov/base.c    | 6 ++++++
>  kernel/gcov/gcc_4_7.c | 4 +++-
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/gcov/base.c b/kernel/gcov/base.c
> index 2f9df37..85dca5d 100644
> --- a/kernel/gcov/base.c
> +++ b/kernel/gcov/base.c
> @@ -98,6 +98,12 @@ void __gcov_merge_icall_topn(gcov_type *counters, unsigned int n_counters)
>  }
>  EXPORT_SYMBOL(__gcov_merge_icall_topn);
> 
> +void __gcov_exit (void)
> +{
> +	/* Unused. */
> +}
> +EXPORT_SYMBOL(__gcov_exit);
> +
>  /**
>   * gcov_enable_events - enable event reporting through gcov_event()
>   *
> diff --git a/kernel/gcov/gcc_4_7.c b/kernel/gcov/gcc_4_7.c
> index 6a5c239..46a18e7 100644
> --- a/kernel/gcov/gcc_4_7.c
> +++ b/kernel/gcov/gcc_4_7.c
> @@ -18,7 +18,9 @@
>  #include <linux/vmalloc.h>
>  #include "gcov.h"
> 
> -#if (__GNUC__ > 5) || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
> +#if (__GNUC__ >= 7)
> +#define GCOV_COUNTERS			9
> +#elif (__GNUC__ > 5) || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
>  #define GCOV_COUNTERS			10
>  #elif __GNUC__ == 4 && __GNUC_MINOR__ >= 9
>  #define GCOV_COUNTERS			9
> 


-- 
Peter Oberparleiter
Linux on z Systems Development - IBM Germany

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] gcov: support GCC 7.1
  2016-12-08 12:52     ` Peter Oberparleiter
@ 2017-05-08 10:54       ` Peter Oberparleiter
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Oberparleiter @ 2017-05-08 10:54 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Martin Liška, lkml

I just realized (admittedly somewhat late) that this hasn't been
included yet. However this patch is still required for Linux
gcov-profiling to build with GCC 7.1.

@Andrew, could you pick this up via your tree?

The original post can be found at https://lkml.org/lkml/2016/11/24/293

On 08.12.2016 13:52, Peter Oberparleiter wrote:
> On 24.11.2016 13:46, Martin Liška wrote:
>> On 11/09/2016 10:21 AM, Peter Oberparleiter wrote:
>>> On 31.10.2016 10:35, Martin Liška wrote:
>>>> Starting from GCC 7.1, __gcov_exit is a new symbol expected
>>>> to be implemented in a profiling runtime.
>>>
>>> I tested your patch with kernel 4.9-rc4 compiled with GCC 7.0.0 20161107
>>> (experimental) and validated that it fixes the build error due to a
>>> missing __gcov_exit symbol.
>>>
>>> An attempt to read from one of the .gcda files generated by a kernel
>>> compiled this way resulted in a crash though. It appears that the number
>>> of GCOV_COUNTERS has changed again for GCC 7.x and must be adjusted in
>>> the kernel as well. Could you add that to your patch as well?
>>
>> Hello.
>>
>> Sorry, this is fixed in second version of the patch.
>>
>>> Given that GCC 7.1 has not yet been released, I'm wondering if it is
>>> safe to program against interfaces that have not yet been fully
>>> finalized. Can you provide an indication on whether these gcov-related
>>> aspects of GCC might still be changed until release?
>>
>> Well, we just flipped to stage3 which means that any new features should
>> be added to current master. If you prefer we can commit the patch after
>> a release of 7.1 will be done?
> 
> I've given this some more thought: if your patch is not applied, GCOV
> kernel profiling will definitely not work with GCC 7.x. If it is
> applied, there is a high probability that it will work, and a small
> chance that additional patches will be required. Overall I would say
> this justifies applying the patch now.
> 
>>> As a side note, please post your patches inline instead of as attachment
>>> as that helps quoting them in replies. See also
>>> linux/Documentation/SubmittingPatches.
>>
>> Sure, thanks for info. I'm attaching new version:
>>
>> Starting from GCC 7.1, __gcov_exit is a new symbol expected
>> to be implemented in a profiling runtime. Update number of profile
>> counters.
>>
>> Signed-off-by: Martin Liska <mliska@suse.cz>
> 
> Looks good, thanks! Tested successfully with GCC 7.0.0 20161208
> (experimental) on Linux kernel 4.9-rc8 (compiles successfully and
> produces valid kernel .gcda files).
> 
> Andrew, could you pick this change up via your tree?
> 
> Reviewed-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
> Tested-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
> 
>> ---
>>  kernel/gcov/base.c    | 6 ++++++
>>  kernel/gcov/gcc_4_7.c | 4 +++-
>>  2 files changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/kernel/gcov/base.c b/kernel/gcov/base.c
>> index 2f9df37..85dca5d 100644
>> --- a/kernel/gcov/base.c
>> +++ b/kernel/gcov/base.c
>> @@ -98,6 +98,12 @@ void __gcov_merge_icall_topn(gcov_type *counters, unsigned int n_counters)
>>  }
>>  EXPORT_SYMBOL(__gcov_merge_icall_topn);
>>
>> +void __gcov_exit (void)
>> +{
>> +	/* Unused. */
>> +}
>> +EXPORT_SYMBOL(__gcov_exit);
>> +
>>  /**
>>   * gcov_enable_events - enable event reporting through gcov_event()
>>   *
>> diff --git a/kernel/gcov/gcc_4_7.c b/kernel/gcov/gcc_4_7.c
>> index 6a5c239..46a18e7 100644
>> --- a/kernel/gcov/gcc_4_7.c
>> +++ b/kernel/gcov/gcc_4_7.c
>> @@ -18,7 +18,9 @@
>>  #include <linux/vmalloc.h>
>>  #include "gcov.h"
>>
>> -#if (__GNUC__ > 5) || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
>> +#if (__GNUC__ >= 7)
>> +#define GCOV_COUNTERS			9
>> +#elif (__GNUC__ > 5) || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
>>  #define GCOV_COUNTERS			10
>>  #elif __GNUC__ == 4 && __GNUC_MINOR__ >= 9
>>  #define GCOV_COUNTERS			9
>>

-- 
Peter Oberparleiter
Linux on z Systems Development - IBM Germany

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-05-08 10:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-31  9:35 [PATCH] gcov: support GCC 7.1 Martin Liška
2016-11-09  9:21 ` Peter Oberparleiter
2016-11-24 12:46   ` Martin Liška
2016-12-08 12:52     ` Peter Oberparleiter
2017-05-08 10:54       ` Peter Oberparleiter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.