From: Greg Kroah-Hartman Date: Mon, 24 Oct 2022 11:18:23 +0000 (+0200) Subject: 4.9-stable patches X-Git-Tag: v6.0.4~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=647481e2a88feac5d28f79bafaf6a8ae3604abaa;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: gcov-support-gcc-12.1-and-newer-compilers.patch --- diff --git a/queue-4.9/gcov-support-gcc-12.1-and-newer-compilers.patch b/queue-4.9/gcov-support-gcc-12.1-and-newer-compilers.patch new file mode 100644 index 00000000000..811dab8d4b2 --- /dev/null +++ b/queue-4.9/gcov-support-gcc-12.1-and-newer-compilers.patch @@ -0,0 +1,80 @@ +From 977ef30a7d888eeb52fb6908f99080f33e5309a8 Mon Sep 17 00:00:00 2001 +From: Martin Liska +Date: Thu, 13 Oct 2022 09:40:59 +0200 +Subject: gcov: support GCC 12.1 and newer compilers + +From: Martin Liska + +commit 977ef30a7d888eeb52fb6908f99080f33e5309a8 upstream. + +Starting with GCC 12.1, the created .gcda format can't be read by gcov +tool. There are 2 significant changes to the .gcda file format that +need to be supported: + +a) [gcov: Use system IO buffering] + (23eb66d1d46a34cb28c4acbdf8a1deb80a7c5a05) changed that all sizes in + the format are in bytes and not in words (4B) + +b) [gcov: make profile merging smarter] + (72e0c742bd01f8e7e6dcca64042b9ad7e75979de) add a new checksum to the + file header. + +Tested with GCC 7.5, 10.4, 12.2 and the current master. + +Link: https://lkml.kernel.org/r/624bda92-f307-30e9-9aaa-8cc678b2dfb2@suse.cz +Signed-off-by: Martin Liska +Tested-by: Peter Oberparleiter +Reviewed-by: Peter Oberparleiter +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Greg Kroah-Hartman +--- + kernel/gcov/gcc_4_7.c | 18 ++++++++++++++++-- + 1 file changed, 16 insertions(+), 2 deletions(-) + +--- a/kernel/gcov/gcc_4_7.c ++++ b/kernel/gcov/gcc_4_7.c +@@ -32,6 +32,13 @@ + + #define GCOV_TAG_FUNCTION_LENGTH 3 + ++/* Since GCC 12.1 sizes are in BYTES and not in WORDS (4B). */ ++#if (__GNUC__ >= 12) ++#define GCOV_UNIT_SIZE 4 ++#else ++#define GCOV_UNIT_SIZE 1 ++#endif ++ + static struct gcov_info *gcov_info_head; + + /** +@@ -438,12 +445,18 @@ static size_t convert_to_gcda(char *buff + pos += store_gcov_u32(buffer, pos, info->version); + pos += store_gcov_u32(buffer, pos, info->stamp); + ++#if (__GNUC__ >= 12) ++ /* Use zero as checksum of the compilation unit. */ ++ pos += store_gcov_u32(buffer, pos, 0); ++#endif ++ + for (fi_idx = 0; fi_idx < info->n_functions; fi_idx++) { + fi_ptr = info->functions[fi_idx]; + + /* Function record. */ + pos += store_gcov_u32(buffer, pos, GCOV_TAG_FUNCTION); +- pos += store_gcov_u32(buffer, pos, GCOV_TAG_FUNCTION_LENGTH); ++ pos += store_gcov_u32(buffer, pos, ++ GCOV_TAG_FUNCTION_LENGTH * GCOV_UNIT_SIZE); + pos += store_gcov_u32(buffer, pos, fi_ptr->ident); + pos += store_gcov_u32(buffer, pos, fi_ptr->lineno_checksum); + pos += store_gcov_u32(buffer, pos, fi_ptr->cfg_checksum); +@@ -457,7 +470,8 @@ static size_t convert_to_gcda(char *buff + /* Counter record. */ + pos += store_gcov_u32(buffer, pos, + GCOV_TAG_FOR_COUNTER(ct_idx)); +- pos += store_gcov_u32(buffer, pos, ci_ptr->num * 2); ++ pos += store_gcov_u32(buffer, pos, ++ ci_ptr->num * 2 * GCOV_UNIT_SIZE); + + for (cv_idx = 0; cv_idx < ci_ptr->num; cv_idx++) { + pos += store_gcov_u64(buffer, pos, diff --git a/queue-4.9/series b/queue-4.9/series index a4f33ceaa06..3b34852a546 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -156,3 +156,4 @@ net-ieee802154-don-t-warn-zero-sized-raw_sendmsg.patch ext4-continue-to-expand-file-system-when-the-target-size-doesn-t-reach.patch inet-fully-convert-sk-sk_rx_dst-to-rcu-rules.patch thermal-intel_powerclamp-use-first-online-cpu-as-control_cpu.patch +gcov-support-gcc-12.1-and-newer-compilers.patch