public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* libgcov, fork, and mingw (and other targets without the full POSIX set)
@ 2023-12-01  8:02 Florian Weimer
  2023-12-01  8:19 ` Eli Zaretskii
  2023-12-01  8:42 ` Richard Biener
  0 siblings, 2 replies; 18+ messages in thread
From: Florian Weimer @ 2023-12-01  8:02 UTC (permalink / raw)
  To: gcc; +Cc: Jonathan Yong, Jan Hubicka, Nathan Sidwell

I've received a report of a mingw build failure:

../../../gcc/libgcc/libgcov-interface.c: In function '__gcov_fork':
../../../gcc/libgcc/libgcov-interface.c:185:9: error: implicit declaration of function 'fork' [-Wimplicit-function-declaration]
  185 |   pid = fork ();
      |         ^~~~
make[2]: *** [Makefile:932: _gcov_fork.o] Error 1
make[2]: *** Waiting for unfinished jobs....

As far as I understand it, mingw doesn't have fork and doesn't declare
it in <unistd.h>, so it's not clear to me how this has ever worked.  I
would expect a linker failure.  Maybe that doesn't happen because the
object containing a reference to fork is only ever pulled in if the
application calls the intercepted fork, which doesn't happen on mingw.

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.

Thanks,
Florian


^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: libgcov, fork, and mingw (and other targets without the full POSIX set)
@ 2023-12-08  8:53 Julian Waters
  0 siblings, 0 replies; 18+ messages in thread
From: Julian Waters @ 2023-12-08  8:53 UTC (permalink / raw)
  To: gcc

I think the most reasonable thing to do is to remove _gcov_fork from
LIBGCOV_INTERFACE in libgcc's Makefile.in when the target is Windows.

best regards,
Julian

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: libgcov, fork, and mingw (and other targets without the full POSIX set)
@ 2023-12-11 12:38 Julian Waters
  0 siblings, 0 replies; 18+ messages in thread
From: Julian Waters @ 2023-12-11 12:38 UTC (permalink / raw)
  To: gcc, fweimer

What about removing the _gcov_fork object file from the list of object
files in Makefile.in (Named LIBGCOV_INTERFACE last I remember) if the
target doesn't support fork? Seems cleaner in my opinion.

best regards,
Julian

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2023-12-11 12:39 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-01  8:02 libgcov, fork, and mingw (and other targets without the full POSIX set) Florian Weimer
2023-12-01  8:19 ` Eli Zaretskii
2023-12-01  9:00   ` LIU Hao
2023-12-01  9:16     ` Alexander Monakov
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

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).