Skip to contentSkip to conversation

gcov: Add support for checksum field

PATCH Applied Rickard Andersson 2 participants 3 messages Dec 20, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 gcov: Add support for checksum field

From: Rickard x Andersson <[email protected]>

In GCC version 12.1 a checksum field was added.

This patch fixes a kernel crash occurring during boot when using gcov-kernel with GCC version 12.2. The crash occurred on a system running on i.MX6SX.

Fixes 977ef30a7d88 ("gcov: support GCC 12.1 and newer compilers")
---
 kernel/gcov/gcc_4_7.c | 5 +++++
 1 file changed, 5 insertions(+)
kernel/gcov/gcc_4_7.c +5 -0
index c699feda21ac..04880d8fba25 100644
@@ -85,6 +85,7 @@ struct gcov_fn_info {
  * @version: gcov version magic indicating the gcc version used for compilation
  * @next: list head for a singly-linked list
  * @stamp: uniquifying time stamp
+ * @checksum: unique object checksum
  * @filename: name of the associated gcov data file
  * @merge: merge functions (null for unused counter type)
  * @n_functions: number of instrumented functions
@@ -97,6 +98,10 @@ struct gcov_info {
 	unsigned int version;
 	struct gcov_info *next;
 	unsigned int stamp;
+ /* Since GCC 12.1 a checksum field is added. */
+#if (__GNUC__ >= 12)
+	unsigned int checksum;
+#endif
 	const char *filename;
 	void (*merge[GCOV_COUNTERS])(gcov_type *, unsigned int);
 	unsigned int n_functions;
Signature · 1 line
2.30.2
#1 lore raw
Quoted 8 lines · Rickard Andersson

From: Rickard x Andersson <[email protected]>

In GCC version 12.1 a checksum field was added.

This patch fixes a kernel crash occurring during boot when using gcov-kernel with GCC version 12.2. The crash occurred on a system running on i.MX6SX.

Quoted 5 lines
Fixes 977ef30a7d88 ("gcov: support GCC 12.1 and newer compilers")

Thank you for the fix!

Andrew, could you pick this up via your tree?

Quoted 27 lines
---
 kernel/gcov/gcc_4_7.c | 5 +++++
 1 file changed, 5 insertions(+)
kernel/gcov/gcc_4_7.c +5 -0
index c699feda21ac..04880d8fba25 100644
@@ -85,6 +85,7 @@ struct gcov_fn_info {
  * @version: gcov version magic indicating the gcc version used for compilation
  * @next: list head for a singly-linked list
  * @stamp: uniquifying time stamp
+ * @checksum: unique object checksum
  * @filename: name of the associated gcov data file
  * @merge: merge functions (null for unused counter type)
  * @n_functions: number of instrumented functions
@@ -97,6 +98,10 @@ struct gcov_info {
 	unsigned int version;
 	struct gcov_info *next;
 	unsigned int stamp;
+ /* Since GCC 12.1 a checksum field is added. */
+#if (__GNUC__ >= 12)
+	unsigned int checksum;
+#endif
 	const char *filename;
 	void (*merge[GCOV_COUNTERS])(gcov_type *, unsigned int);
 	unsigned int n_functions;
Signature · 2 lines
Peter Oberparleiter
Linux on IBM Z Development - IBM Germany R&D
maintainer Reviewed-by Martin Liska
#2 lore raw
Quoted 15 lines · Peter Oberparleiter
Quoted 8 lines · Rickard Andersson

From: Rickard x Andersson <[email protected]>

In GCC version 12.1 a checksum field was added.

This patch fixes a kernel crash occurring during boot when using gcov-kernel with GCC version 12.2. The crash occurred on a system running on i.MX6SX.

Quoted 5 lines
Fixes 977ef30a7d88 ("gcov: support GCC 12.1 and newer compilers")
Quoted 3 lines

Thank you for the fix!

Andrew, could you pick this up via your tree?

Oh, I forgot to add Martin's R-B from the v1 review (see [1]), so please include:

https://lore.kernel.org/lkml/[email protected]/t/#mc2625879466e8af245cbebcc99acc4b8dd0b8cdc

Quoted 29 lines
Quoted 28 lines
---
 kernel/gcov/gcc_4_7.c | 5 +++++
 1 file changed, 5 insertions(+)
kernel/gcov/gcc_4_7.c +5 -0
index c699feda21ac..04880d8fba25 100644
@@ -85,6 +85,7 @@ struct gcov_fn_info {
  * @version: gcov version magic indicating the gcc version used for compilation
  * @next: list head for a singly-linked list
  * @stamp: uniquifying time stamp
+ * @checksum: unique object checksum
  * @filename: name of the associated gcov data file
  * @merge: merge functions (null for unused counter type)
  * @n_functions: number of instrumented functions
@@ -97,6 +98,10 @@ struct gcov_info {
 	unsigned int version;
 	struct gcov_info *next;
 	unsigned int stamp;
+ /* Since GCC 12.1 a checksum field is added. */
+#if (__GNUC__ >= 12)
+	unsigned int checksum;
+#endif
 	const char *filename;
 	void (*merge[GCOV_COUNTERS])(gcov_type *, unsigned int);
 	unsigned int n_functions;
Signature · 2 lines
Peter Oberparleiter
Linux on IBM Z Development - IBM Germany R&D