public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alexander Monakov <amonakov@ispras.ru>
To: LIU Hao <lh_mouse@126.com>
Cc: Eli Zaretskii <eliz@gnu.org>, Florian Weimer <fweimer@redhat.com>,
	 gcc@gcc.gnu.org, 10walls@gmail.com, hubicka@ucw.cz,
	nathan@acm.org
Subject: Re: libgcov, fork, and mingw (and other targets without the full POSIX set)
Date: Fri, 1 Dec 2023 12:16:31 +0300 (MSK)	[thread overview]
Message-ID: <f2257d16-528a-c8af-cad4-596985b220e2@ispras.ru> (raw)
In-Reply-To: <dffbd23a-f54e-4f78-b9f3-2848fb005174@126.com>


On Fri, 1 Dec 2023, LIU Hao via Gcc wrote:

> >> What's the best way to fix this?  I expect it's going to impact other
> >> targets (perhaps for different functions) because all of
> >> libgcov-interface.c is built unconditionally.  I don't think we run
> >> configure for the target, so we can't simply check for a definition of
> >> the HAVE_FORK macro.

I'm pretty sure configure runs for the target, but for musl-cross-make
it would be nice to limit it to declaration check rather than link test
(musl-cross-make installs libc headers, then configures and builds gcc
and libgcc just once, then builds libc, then builds the rest of gcc target
libraries, IIRC).

> > I'm not familiar with this code, so apologies in advance if what I
> > suggest below makes no sense.
> > 
> > If the code which calls 'fork' is never expected to be called in the
> > MinGW build, then one way of handling this is to define a version of
> > 'fork' that always fails, conditioned by a suitable #ifdef, so that
> > its declaration and definition are visible when this file is compiled.
> 
> Makes sense. The target-specific macro `_WIN32` serves that purpose.
> 
> However `fork()` doesn't actually exist there, and linking should indeed fail.
> Maybe `__gcov_fork()` shouldn't be defined at all.

A possible stop-gap solution is using __builtin_fork() instead.

Alexander

  reply	other threads:[~2023-12-01  9:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-01  8:02 Florian Weimer
2023-12-01  8:19 ` Eli Zaretskii
2023-12-01  9:00   ` LIU Hao
2023-12-01  9:16     ` Alexander Monakov [this message]
2023-12-01  8:42 ` Richard Biener
2023-12-01  8:57   ` Florian Weimer
2023-12-01  9:09     ` Richard Biener
2023-12-01  9:23       ` LIU Hao
2023-12-01  9:23       ` Alexander Monakov
2023-12-01 10:48       ` Andreas Schwab
2023-12-01 12:03         ` Jan Hubicka
2023-12-01 12:09           ` Jakub Jelinek
2023-12-07 12:50             ` Mark Wielaard
2023-12-08 13:59               ` Florian Weimer
2023-12-10  9:27                 ` LIU Hao
2023-12-11  6:48                   ` Florian Weimer
2023-12-08  8:53 Julian Waters
2023-12-11 12:38 Julian Waters

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=f2257d16-528a-c8af-cad4-596985b220e2@ispras.ru \
    --to=amonakov@ispras.ru \
    --cc=10walls@gmail.com \
    --cc=eliz@gnu.org \
    --cc=fweimer@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=lh_mouse@126.com \
    --cc=nathan@acm.org \
    /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).