libgcov: Call __builtin_fork instead of fork

Message ID 87edg4epw5.fsf@oldenburg.str.redhat.com
State Committed
Commit 68d4138204b09b658506e8eefa231c985b8f5363
Headers
Series libgcov: Call __builtin_fork instead of fork |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gcc_check--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 success Testing passed

Commit Message

Florian Weimer Dec. 2, 2023, 12:43 p.m. UTC
  Some targets do not provide a prototype for fork, and compilation now
fails with an implicit-function-declaration error.

libgcc/

	* libgcov-interface.c (__gcov_fork):

Generated code is the same on x86_64-linux-gnu.  Okay for trunk?

Thanks,
Florian
---
 libgcc/libgcov-interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


base-commit: 193ef02a7f4f3e5349ad9cf8d3d4df466a99b677
  

Comments

Jakub Jelinek Dec. 8, 2023, 2:07 p.m. UTC | #1
On Sat, Dec 02, 2023 at 01:43:22PM +0100, Florian Weimer wrote:
> Some targets do not provide a prototype for fork, and compilation now
> fails with an implicit-function-declaration error.
> 
> libgcc/
> 
> 	* libgcov-interface.c (__gcov_fork):

Description missing (Use __builtin_fork instead of fork.).

Ok with that change.
> 
> Generated code is the same on x86_64-linux-gnu.  Okay for trunk?
> 
> Thanks,
> Florian
> ---
>  libgcc/libgcov-interface.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libgcc/libgcov-interface.c b/libgcc/libgcov-interface.c
> index b2ee9308641..d166e98510d 100644
> --- a/libgcc/libgcov-interface.c
> +++ b/libgcc/libgcov-interface.c
> @@ -182,7 +182,7 @@ pid_t
>  __gcov_fork (void)
>  {
>    pid_t pid;
> -  pid = fork ();
> +  pid = __builtin_fork ();
>    if (pid == 0)
>      {
>        __GTHREAD_MUTEX_INIT_FUNCTION (&__gcov_mx);
> 
> base-commit: 193ef02a7f4f3e5349ad9cf8d3d4df466a99b677

	Jakub
  
Florian Weimer Dec. 8, 2023, 3:28 p.m. UTC | #2
* Jakub Jelinek:

> On Sat, Dec 02, 2023 at 01:43:22PM +0100, Florian Weimer wrote:
>> Some targets do not provide a prototype for fork, and compilation now
>> fails with an implicit-function-declaration error.
>> 
>> libgcc/
>> 
>> 	* libgcov-interface.c (__gcov_fork):
>
> Description missing (Use __builtin_fork instead of fork.).
>
> Ok with that change.

Fixed & pushed, thanks.

Florian
  

Patch

diff --git a/libgcc/libgcov-interface.c b/libgcc/libgcov-interface.c
index b2ee9308641..d166e98510d 100644
--- a/libgcc/libgcov-interface.c
+++ b/libgcc/libgcov-interface.c
@@ -182,7 +182,7 @@  pid_t
 __gcov_fork (void)
 {
   pid_t pid;
-  pid = fork ();
+  pid = __builtin_fork ();
   if (pid == 0)
     {
       __GTHREAD_MUTEX_INIT_FUNCTION (&__gcov_mx);