public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Sebastian Huber <sebastian.huber@embedded-brains.de>
To: Christophe Lyon <christophe.lyon.oss@gmail.com>
Cc: "Martin Liška" <mliska@suse.cz>, "GCC Patches" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH v3] gcov: Add __gcov_info_to_gdca()
Date: Fri, 6 Aug 2021 10:05:01 +0200	[thread overview]
Message-ID: <535407c0-435a-87d2-3ca9-825bba0376b8@embedded-brains.de> (raw)
In-Reply-To: <CAKhMtS+-pwD-32O=7e80uGDb9wjDgviQwJacGmGjo4tRfKCSjQ@mail.gmail.com>

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

Hello Christophe,

On 06/08/2021 09:50, Christophe Lyon wrote:
> Looks like there's a problem with your patch:
>   /tmp/1784442_7.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-arm-none-eabi/gcc1/./gcc/xgcc -B/tmp/1784442_7.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-arm-none-eabi/gcc1/./gcc/ -B/tmp/1784442_7.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/bin/ -B/tmp/1784442_7.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/lib/ -isystem /tmp/1784442_7.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include -isystem /tmp/1784442_7.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/sys-include    -g -O2 -O2  -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include -fno-inline -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -Dinhibit_libc  -fno-inline -I. -I. -I../.././gcc -I/tmp/1784442_7.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/libgcc -I/tmp/1784442_7.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/libgcc/. -I/tmp/1784442_7.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/libgcc/../gcc -I/tmp/1784442_7.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/libgcc/../include    -o _gcov.o -MT _gcov.o -MD -MP -MF _gcov.dep -DL_gcov -c /tmp/1784442_7.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/libgcc/libgcov-driver.c
> 
> In file included from 
> /tmp/1784442_7.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/libgcc/libgcov-driver.c:29:
> /tmp/1784442_7.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-arm-none-eabi/gcc1/gcc/include/stdint.h:9:16: 
> fatal error: stdint.h: No such file or directory
>      9 | # include_next <stdint.h>
>        |                ^~~~~~~~~~
> compilation terminated.
> make[2]: *** [Makefile:928: _gcov.o] Error 1
> make[2]: *** Waiting for unfinished jobs....
> 
> Can you check?

I already feared that the <stdint.h> include may cause problems, from 
the commit message:

"With this patch, <stdint.h> is included in libgcov-driver.c even if 
inhibit_libc is defined.  This header file should be also available for 
freestanding environments.  If this is not the case, then we have to 
define intptr_t somehow."

What about the attached patch?

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/

[-- Attachment #2: 0001-gcov-Remove-stdint.h-from-libgcov-driver.c.patch --]
[-- Type: text/x-patch, Size: 1963 bytes --]

From 9e91c623116313312408a8809f32eac1f7ef6b16 Mon Sep 17 00:00:00 2001
From: Sebastian Huber <sebastian.huber@embedded-brains.de>
Date: Fri, 6 Aug 2021 09:57:43 +0200
Subject: [PATCH] gcov: Remove <stdint.h> from libgcov-driver.c

In the patch to add __gcov_info_to_gcda(), the include of <stdint.h> was added
to libgcov-driver.c even if inhibit_libc is defined.  It turned out that this
header file is not always available.  Remove the include of <stdin.h> and
replace the intptr_t with the compiler provided __INTPTR_TYPE__.

libgcc/

	* libgcov-driver.c (#include <stdint.h>): Remove.
	(write_topn_counters): Use __INTPTR_TYPE__ instead of intptr_t.
---
 libgcc/libgcov-driver.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/libgcc/libgcov-driver.c b/libgcc/libgcov-driver.c
index 9d7bc9c79950..087f71e01077 100644
--- a/libgcc/libgcov-driver.c
+++ b/libgcc/libgcov-driver.c
@@ -26,8 +26,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "libgcov.h"
 #include "gcov-io.h"
 
-#include <stdint.h>
-
 /* Return 1, if all counter values are zero, otherwise 0. */
 
 static inline int
@@ -453,7 +451,7 @@ write_topn_counters (const struct gcov_ctr_info *ci_ptr,
       gcov_type start = ci_ptr->values[GCOV_TOPN_MEM_COUNTERS * i + 2];
       unsigned sizes = 0;
 
-      for (struct gcov_kvp *node = (struct gcov_kvp *)(intptr_t)start;
+      for (struct gcov_kvp *node = (struct gcov_kvp *)(__INTPTR_TYPE__)start;
 	   node != NULL; node = node->next)
 	++sizes;
 
@@ -472,7 +470,7 @@ write_topn_counters (const struct gcov_ctr_info *ci_ptr,
       gcov_type start = ci_ptr->values[GCOV_TOPN_MEM_COUNTERS * i + 2];
 
       unsigned j = 0;
-      for (struct gcov_kvp *node = (struct gcov_kvp *)(intptr_t)start;
+      for (struct gcov_kvp *node = (struct gcov_kvp *)(__INTPTR_TYPE__)start;
 	   j < list_sizes[i]; node = node->next, j++)
 	{
 	  dump_counter (node->value, dump_fn, arg);
-- 
2.26.2


  reply	other threads:[~2021-08-06  8:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-23  9:39 Sebastian Huber
2021-08-05 12:53 ` Martin Liška
2021-08-06  5:31   ` Sebastian Huber
2021-08-06  7:50     ` Christophe Lyon
2021-08-06  8:05       ` Sebastian Huber [this message]
2021-08-06  9:15         ` Christophe Lyon
2021-08-06 10:26         ` Martin Liška
2021-08-06 10:29           ` Sebastian Huber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=535407c0-435a-87d2-3ca9-825bba0376b8@embedded-brains.de \
    --to=sebastian.huber@embedded-brains.de \
    --cc=christophe.lyon.oss@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mliska@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).