From nobody Mon May 13 14:08:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=cloud.com ARC-Seal: i=1; a=rsa-sha256; t=1694190081; cv=none; d=zohomail.com; s=zohoarc; b=nyj+W6NmvYzRaOKaEnDN6qSB/WycC/wBfTvHoh2J29HxFsndOfBkjdP3eKFOYEUPGfCRk94bxO5+DiOOympeflu+lvhWq9sPitaCkpmi95eKsRi3C2vFjBrd9m+4yLH8tywxzWszo5mKq8zcBn7dYf7tPsilhPS/R9TptKnJrLk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694190081; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MOfLOXf8yDOC8XjMaviIU41n1ePC1cU7Y3evBR4kK7U=; b=H+sL1gnK37f4GpbOzAOh7kWmhRSvMzhn1YR6bPS8dMwGyOpvkfuPFGJUwSoOxUanTjs7XLFYN6rb643cRF69EO8VPVFYIhcJLLPa+2M1Do9YOkGHHWTsbxU1xZxIAkBAwKoQnflz9fyuRB0ixQJJ6SKnCXSsZlSfZ9+hNijdv0I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1694190081217487.7137764494239; Fri, 8 Sep 2023 09:21:21 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.598077.932579 (Exim 4.92) (envelope-from ) id 1qeeE2-0006Eu-Af; Fri, 08 Sep 2023 16:20:54 +0000 Received: by outflank-mailman (output) from mailman id 598077.932579; Fri, 08 Sep 2023 16:20:54 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qeeE2-0006El-7Q; Fri, 08 Sep 2023 16:20:54 +0000 Received: by outflank-mailman (input) for mailman id 598077; Fri, 08 Sep 2023 16:20:52 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qeeE0-0006Dr-N1 for xen-devel@lists.xenproject.org; Fri, 08 Sep 2023 16:20:52 +0000 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [2a00:1450:4864:20::330]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ad82f35e-4e63-11ee-8783-cb3800f73035; Fri, 08 Sep 2023 18:20:51 +0200 (CEST) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-401da71b85eso24135955e9.1 for ; Fri, 08 Sep 2023 09:20:51 -0700 (PDT) Received: from EMEAENG6DZjqCfH.citrite.net (default-46-102-197-194.interdsl.co.uk. [46.102.197.194]) by smtp.gmail.com with ESMTPSA id m24-20020a7bce18000000b003feee8d8011sm5574352wmc.41.2023.09.08.09.20.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Sep 2023 09:20:50 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ad82f35e-4e63-11ee-8783-cb3800f73035 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.com; s=cloud; t=1694190051; x=1694794851; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MOfLOXf8yDOC8XjMaviIU41n1ePC1cU7Y3evBR4kK7U=; b=K8mdn5Q94CNNnx2T8A6ViyRSfG/oVqGYMbGdZPc+CEFx3gQo/2gf54EKOkvy14ol32 pmp6dQwMDTCcIzb5L6Y7zglAiS9axfKTc5TXczo7Olwpha9q3bMAvzOwJrIVpO5KZupy d6BQRHEOQo7KjKlALJBVSV8hYo1LUHXagmoPw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694190051; x=1694794851; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MOfLOXf8yDOC8XjMaviIU41n1ePC1cU7Y3evBR4kK7U=; b=IShzHfP3NLw9AVva6/TWmD0VqkccWpU6Li7MP1DG2zjat2czu4c/iQPhn+p/7wcNZU Tcsge+REsYiIKJLE2TSkXHLyTMprbKWh+mYK+MmDGeSG4J5p9eo72ZdhVPG+q3Ac7AmF /fzkqMEGPe9+aCWV35EH3YElATB+TA2he3Hehl3ZaZSNU+MLSkqb+lHjQQvHleUU/7l4 u+yItmyf7CdNZA5S5+XPXNDX7C1Gj3aILSLCXPJC+VdR0po/SgQMqVq9KgzjNijWpqp2 ziyCByva0uviHb14fU7zJGoZRgH00uOlKEq/TjBPh4W5FA8h26ZDoaB5oqEDgEDMs5u3 70tw== X-Gm-Message-State: AOJu0Yz/I3CwvDEopT3WXLPejNb6NBBzi24WQQcZWGsGgoCktmqjvF19 zNJMsUoPTb7PBwR7JjO8/KTmclFaPvaBbFQ5seYp4g== X-Google-Smtp-Source: AGHT+IFLGgaR3GaQNT/hO3YT4Jx265RaO4F39ZDC5SpvsBK3M3KAx7cJhbueYwfpjTdAt+JecgOvpA== X-Received: by 2002:a05:600c:2249:b0:3fe:111a:d1d9 with SMTP id a9-20020a05600c224900b003fe111ad1d9mr2578357wmm.25.1694190050831; Fri, 08 Sep 2023 09:20:50 -0700 (PDT) From: Javi Merino To: xen-devel@lists.xenproject.org Cc: Javi Merino , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [XEN PATCH v2 1/2] coverage: simplify the logic of choosing the number of gcov counters depending on the gcc version Date: Fri, 8 Sep 2023 17:20:31 +0100 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @cloud.com) X-ZM-MESSAGEID: 1694190083567100001 Content-Type: text/plain; charset="utf-8" The current structure of choosing the correct file based on the compiler version makes us make 33 line files just to define a constant. The changes after gcc 4.7 are minimal, just the number of counters. Fold the changes in gcc_4_9.c, gcc_5.c and gcc_7.c into gcc_4_7.c to remove a lot of the boilerplate and keep the logic of choosing the GCOV_COUNTER in gcc_4_7.c. Signed-off-by: Javi Merino Reviewed-by: Jan Beulich --- xen/common/coverage/Makefile | 6 +----- xen/common/coverage/gcc_4_7.c | 17 +++++++++-------- xen/common/coverage/gcc_4_9.c | 33 --------------------------------- xen/common/coverage/gcc_5.c | 33 --------------------------------- xen/common/coverage/gcc_7.c | 30 ------------------------------ 5 files changed, 10 insertions(+), 109 deletions(-) delete mode 100644 xen/common/coverage/gcc_4_9.c delete mode 100644 xen/common/coverage/gcc_5.c delete mode 100644 xen/common/coverage/gcc_7.c diff --git a/xen/common/coverage/Makefile b/xen/common/coverage/Makefile index 63f98c71d6..d729afc9c7 100644 --- a/xen/common/coverage/Makefile +++ b/xen/common/coverage/Makefile @@ -1,11 +1,7 @@ obj-y +=3D coverage.o ifneq ($(CONFIG_CC_IS_CLANG),y) obj-y +=3D gcov_base.o gcov.o -obj-y +=3D $(call cc-ifversion,-lt,0407, \ - gcc_3_4.o, $(call cc-ifversion,-lt,0409, \ - gcc_4_7.o, $(call cc-ifversion,-lt,0500, \ - gcc_4_9.o, $(call cc-ifversion,-lt,0700, \ - gcc_5.o, gcc_7.o)))) +obj-y +=3D $(call cc-ifversion,-lt,0407, gcc_3_4.o, gcc_4_7.o) else obj-y +=3D llvm.o endif diff --git a/xen/common/coverage/gcc_4_7.c b/xen/common/coverage/gcc_4_7.c index 25b4a8bcdc..ddbc9f4bb0 100644 --- a/xen/common/coverage/gcc_4_7.c +++ b/xen/common/coverage/gcc_4_7.c @@ -18,15 +18,16 @@ =20 #include "gcov.h" =20 -/* - * GCOV_COUNTERS will be defined if this file is included by other - * source files. - */ -#ifndef GCOV_COUNTERS -# if !(GCC_VERSION >=3D 40700 && GCC_VERSION < 40900) -# error "Wrong version of GCC used to compile gcov" -# endif +#if (GCC_VERSION >=3D 40700 && GCC_VERSION < 40900) #define GCOV_COUNTERS 8 +#elif (GCC_VERSION >=3D 40900 && GCC_VERSION < 50000) +#define GCOV_COUNTERS 9 +#elif GCC_VERSION >=3D 50000 && GCC_VERSION < 70000 +#define GCOV_COUNTERS 10 +#elif GCC_VERSION >=3D 70000 +#define GCOV_COUNTERS 9 +#else +#error "Wrong version of GCC used to compile gcov" #endif =20 #define GCOV_TAG_FUNCTION_LENGTH 3 diff --git a/xen/common/coverage/gcc_4_9.c b/xen/common/coverage/gcc_4_9.c deleted file mode 100644 index dcea961936..0000000000 --- a/xen/common/coverage/gcc_4_9.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * This code provides functions to handle gcc's profiling data format - * introduced with gcc 4.7. - * - * For a better understanding, refer to gcc source: - * gcc/gcov-io.h - * libgcc/libgcov.c - * - * Uses gcc-internal data definitions. - * - * Imported from Linux and modified for Xen by - * Wei Liu - */ - -#include "gcov.h" - -#if !(GCC_VERSION >=3D 40900 && GCC_VERSION < 50000) -#error "Wrong version of GCC used to compile gcov" -#endif - -#define GCOV_COUNTERS 9 - -#include "gcc_4_7.c" - -/* - * Local variables: - * mode: C - * c-file-style: "BSD" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/xen/common/coverage/gcc_5.c b/xen/common/coverage/gcc_5.c deleted file mode 100644 index 6e0d276f3b..0000000000 --- a/xen/common/coverage/gcc_5.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * This code provides functions to handle gcc's profiling data format - * introduced with gcc 5. - * - * For a better understanding, refer to gcc source: - * gcc/gcov-io.h - * libgcc/libgcov.c - * - * Uses gcc-internal data definitions. - * - * Imported from Linux and modified for Xen by - * Wei Liu - */ - -#include "gcov.h" - -#if GCC_VERSION < 50000 || GCC_VERSION >=3D 70000 -#error "Wrong version of GCC used to compile gcov" -#endif - -#define GCOV_COUNTERS 10 - -#include "gcc_4_7.c" - -/* - * Local variables: - * mode: C - * c-file-style: "BSD" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/xen/common/coverage/gcc_7.c b/xen/common/coverage/gcc_7.c deleted file mode 100644 index 3962eb4c76..0000000000 --- a/xen/common/coverage/gcc_7.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * This code provides functions to handle gcc's profiling data format - * introduced with gcc 7. - * - * For a better understanding, refer to gcc source: - * gcc/gcov-io.h - * libgcc/libgcov.c - * - * Uses gcc-internal data definitions. - */ - -#include "gcov.h" - -#if GCC_VERSION < 70000 -#error "Wrong version of GCC used to compile gcov" -#endif - -#define GCOV_COUNTERS 9 - -#include "gcc_4_7.c" - -/* - * Local variables: - * mode: C - * c-file-style: "BSD" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ --=20 2.41.0 From nobody Mon May 13 14:08:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=cloud.com ARC-Seal: i=1; a=rsa-sha256; t=1694190087; cv=none; d=zohomail.com; s=zohoarc; b=YHmckfgARwZ8QbvhYNBEDnKNRxpA/hprvh6s+KOh2NgJ1yplluRUcvTSdrLZvXujHb6axxc29eL4iitgqAMSkVVoTrqYj45MYWNHtgQqWiytwAzaWwM7UlCvIjmBLRuqika1hHVye2h1WkNUVxs7h8N0HWA1P/LMmK9hj0WPNRE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694190087; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=i6wE+Q6YPhjgRGDUDttaAAhWjDOLXM9ZsbpkHij4TSA=; b=UV/SULoiG1H0ULm0r0BiQ+5dtJmNlt4g37dP6FvOqeOSLICdWiOSJu5Fjn4s/H3cvlk9M65UwKTu0UU+B8Vb773bgaljZQDcTxceuv2CMk6CDHO7F2cdln85gn7Ng0fMz7YOpLPxxJmtGAA5vds10kYNX6hM5hU5Cdn3Hk5PglQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1694190087448685.8154664439849; Fri, 8 Sep 2023 09:21:27 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.598078.932589 (Exim 4.92) (envelope-from ) id 1qeeE5-0006W7-JE; Fri, 08 Sep 2023 16:20:57 +0000 Received: by outflank-mailman (output) from mailman id 598078.932589; Fri, 08 Sep 2023 16:20:57 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qeeE5-0006Vt-Ft; Fri, 08 Sep 2023 16:20:57 +0000 Received: by outflank-mailman (input) for mailman id 598078; Fri, 08 Sep 2023 16:20:56 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qeeE4-0005vx-Az for xen-devel@lists.xenproject.org; Fri, 08 Sep 2023 16:20:56 +0000 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [2a00:1450:4864:20::336]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id af5fac43-4e63-11ee-9b0d-b553b5be7939; Fri, 08 Sep 2023 18:20:54 +0200 (CEST) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-3fef56f7248so23746055e9.3 for ; Fri, 08 Sep 2023 09:20:54 -0700 (PDT) Received: from EMEAENG6DZjqCfH.citrite.net (default-46-102-197-194.interdsl.co.uk. [46.102.197.194]) by smtp.gmail.com with ESMTPSA id m24-20020a7bce18000000b003feee8d8011sm5574352wmc.41.2023.09.08.09.20.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Sep 2023 09:20:53 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: af5fac43-4e63-11ee-9b0d-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.com; s=cloud; t=1694190054; x=1694794854; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=i6wE+Q6YPhjgRGDUDttaAAhWjDOLXM9ZsbpkHij4TSA=; b=jwk3vVjwzUxByXybHEWPNX/3lDDjDWBjQHyfjz2Ko591E4NpvYTNcskng4EJ3f8EML 7dXEfCJ/iKtioFl7sICe8tK6JpBTqREwY/H+ztYOjrUuNPFCF1AUInv9mvPth2E+jUJ3 IUATI6QltvbnlzQ/GZYdYdPhoZ7ZY23JM0OrU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694190054; x=1694794854; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=i6wE+Q6YPhjgRGDUDttaAAhWjDOLXM9ZsbpkHij4TSA=; b=ZLkbGo0zOp8aUf6AStWPxdmmCf3a0nW63ei2XJ/uxKyDgYQJTFAfUlhZ5RCr/ZQ4cr RozgQ1rxUwx93E0wpBmOP1tl7BobCv1LIBUyjsrbIQLDuDz8P3JwJjp+cj4vZpBhqudL euuNCe088I6/ger6m1T/iMYMFcIDT7JE4eYd8xRJp43juayk8gEJMF5InJgQuwt8gkN0 1+Pi7YKV/Bi/juiX28UgqLhdIJKKbPkg7I/s79VavjKgL+jHQU18ueAOj+RIz6RCmZrP 3YVebaDzQohtYL8w5tGU+a6hnImflI/Gazf+eZQ+MYCWb0Y8R+JnEJsIVza/juN1gE8p Z7jQ== X-Gm-Message-State: AOJu0YymcUhgsVMPFTo4xukL0ZSH6guCFfbeL/72MdP2ASRYS3j2gchG GZWxhVkFBS4FlXt6diVGlyTdX8lKO/NFkGqgGfihkA== X-Google-Smtp-Source: AGHT+IHpKLXmgdlDykh/Lnsr/L+EHgmoX4EoZJ5vI1LnOskXlwZ4GNncyfTrAy2rVtqS5OLbNIXq3g== X-Received: by 2002:a7b:c8c4:0:b0:402:8c7e:3fc4 with SMTP id f4-20020a7bc8c4000000b004028c7e3fc4mr2417637wml.30.1694190054134; Fri, 08 Sep 2023 09:20:54 -0700 (PDT) From: Javi Merino To: xen-devel@lists.xenproject.org Cc: Javi Merino , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [XEN PATCH v2 2/2] coverage: update gcov info for newer versions of gcc Date: Fri, 8 Sep 2023 17:20:32 +0100 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @cloud.com) X-ZM-MESSAGEID: 1694190088296100001 Content-Type: text/plain; charset="utf-8" Shamelessly copy changes to gcov_info structures from linux so that we can capture coverage for xen built with newer compilers. Signed-off-by: Javi Merino Acked-by: Jan Beulich --- xen/common/coverage/gcc_4_7.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/xen/common/coverage/gcc_4_7.c b/xen/common/coverage/gcc_4_7.c index ddbc9f4bb0..8f6e287474 100644 --- a/xen/common/coverage/gcc_4_7.c +++ b/xen/common/coverage/gcc_4_7.c @@ -24,14 +24,23 @@ #define GCOV_COUNTERS 9 #elif GCC_VERSION >=3D 50000 && GCC_VERSION < 70000 #define GCOV_COUNTERS 10 -#elif GCC_VERSION >=3D 70000 +#elif GCC_VERSION >=3D 70000 && GCC_VERSION < 100000 #define GCOV_COUNTERS 9 +#elif GCC_VERSION >=3D 100000 +#define GCOV_COUNTERS 8 #else #error "Wrong version of GCC used to compile gcov" #endif =20 #define GCOV_TAG_FUNCTION_LENGTH 3 =20 +#if GCC_VERSION >=3D 120000 +/* Since GCC 12.1, sizes are in BYTES and not in WORDS (4B). */ +#define GCOV_UNIT_SIZE 4 +#else +#define GCOV_UNIT_SIZE 1 +#endif + static struct gcov_info *gcov_info_head; =20 /** @@ -89,6 +98,10 @@ struct gcov_info { unsigned int version; struct gcov_info *next; unsigned int stamp; +#if (GCC_VERSION >=3D 120000) + /* GCC 12.1 introduced a checksum field */ + unsigned int checksum; +#endif const char *filename; void (*merge[GCOV_COUNTERS])(gcov_type *, unsigned int); unsigned int n_functions; @@ -161,13 +174,18 @@ size_t gcov_info_to_gcda(char *buffer, const struct g= cov_info *info) pos +=3D gcov_store_uint32(buffer, pos, info->version); pos +=3D gcov_store_uint32(buffer, pos, info->stamp); =20 +#if (GCC_VERSION >=3D 120000) + /* Use zero as checksum of the compilation unit. */ + pos +=3D gcov_store_uint32(buffer, pos, 0); +#endif + for ( fi_idx =3D 0; fi_idx < info->n_functions; fi_idx++ ) { fi_ptr =3D info->functions[fi_idx]; =20 /* Function record. */ pos +=3D gcov_store_uint32(buffer, pos, GCOV_TAG_FUNCTION); - pos +=3D gcov_store_uint32(buffer, pos, GCOV_TAG_FUNCTION_LENGTH); + pos +=3D gcov_store_uint32(buffer, pos, GCOV_TAG_FUNCTION_LENGTH *= GCOV_UNIT_SIZE); pos +=3D gcov_store_uint32(buffer, pos, fi_ptr->ident); pos +=3D gcov_store_uint32(buffer, pos, fi_ptr->lineno_checksum); pos +=3D gcov_store_uint32(buffer, pos, fi_ptr->cfg_checksum); @@ -182,7 +200,7 @@ size_t gcov_info_to_gcda(char *buffer, const struct gco= v_info *info) /* Counter record. */ pos +=3D gcov_store_uint32(buffer, pos, GCOV_TAG_FOR_COUNTER(ct_idx)); - pos +=3D gcov_store_uint32(buffer, pos, ci_ptr->num * 2); + pos +=3D gcov_store_uint32(buffer, pos, ci_ptr->num * 2 * GCOV= _UNIT_SIZE); =20 for ( cv_idx =3D 0; cv_idx < ci_ptr->num; cv_idx++ ) pos +=3D gcov_store_uint64(buffer, pos, ci_ptr->values[cv_= idx]); --=20 2.41.0