[committed] Fix frv build after C99 changes

Message ID ca9c93a6-d9f2-4cd8-87b5-d7b0b68502c1@gmail.com
State Committed
Commit 870b63fe71607b94c0e5b0c6e61cd807e0216ddd
Headers
Series [committed] Fix frv build after C99 changes |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm warning Patch is already merged
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 warning Patch is already merged

Commit Message

Jeff Law Dec. 3, 2023, 5 a.m. UTC
  Two issues prevent the frv-elf port from building after the C99 changes. 
  First the trampoline code emitted into libgcc has calls to exit, but 
no prototype.  Adding a trivial prototype for exit() into the macro 
fixes that little goof.

Second, frvbegin.c has a call to atexit, so a quick prototype is added 
into frvbegin.c to fix that problem.

That's enough to get the compiler building again.

Pushed to the trunk,
Jeff
commit 870b63fe71607b94c0e5b0c6e61cd807e0216ddd
Author: Jeff Law <jlaw@ventanamicro.com>
Date:   Sat Dec 2 21:54:36 2023 -0700

    [committed] Fix frv build after C99 changes
    
    Two issues prevent the frv-elf port from building after the C99 changes.  First
    the trampoline code emitted into libgcc has calls to exit, but no prototype.
    Adding a trivial prototype for exit() into the macro fixes that little goof.
    
    Second, frvbegin.c has a call to atexit, so a quick prototype is added into
    frvbegin.c to fix that problem.
    
    That's enough to get the compiler building again.
    
    gcc/
            * config/frv/frv.h (TRANSFER_FROM_TRAMPOLINE): Add prototype for exit.
    
    libgcc/
            * config/frv/frvbegin.c (atexit): Add prototype.
  

Patch

diff --git a/gcc/config/frv/frv.h b/gcc/config/frv/frv.h
index 979561126f8..93a7c6d0fcc 100644
--- a/gcc/config/frv/frv.h
+++ b/gcc/config/frv/frv.h
@@ -1241,6 +1241,7 @@  typedef struct frv_stack {
 #if ! __FRV_FDPIC__
 #define TRANSFER_FROM_TRAMPOLINE					\
 extern int Twrite (int, const void *, unsigned);			\
+extern void exit (int);							\
 									\
 void									\
 __trampoline_setup (short * addr, int size, int fnaddr, int sc)		\
@@ -1284,6 +1285,7 @@  __asm__("\n"								\
 #else
 #define TRANSFER_FROM_TRAMPOLINE					\
 extern int Twrite (int, const void *, unsigned);			\
+extern void exit (int);							\
 									\
 void									\
 __trampoline_setup (addr, size, fnaddr, sc)				\
diff --git a/libgcc/config/frv/frvbegin.c b/libgcc/config/frv/frvbegin.c
index 76b40ec46c6..24ea06b1ae7 100644
--- a/libgcc/config/frv/frvbegin.c
+++ b/libgcc/config/frv/frvbegin.c
@@ -119,6 +119,7 @@  __do_global_dtors (void)
     }
 }
 
+int atexit (void (*)(void));
 /* Run the global constructors.  */
 void
 __do_global_ctors (void)