This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ada/9911: gnatmake fails to link when GCC configured for sjlj


John David Anglin wrote:
> there probably does need to be a stub for _Unwind_SjLj_RaiseException in
> raise.c.

> We also need to fix the call issued from a-except.adb.  This is actually
> what caused the link failure in the PR.

 Right.

> I hacked a-except.adb and raise.c use to use _Unwind_SjLj_RaiseException
> but not being familiar with ada I'm not sure how to conditionalize the ada
> code. 

 To avoid the need for conditional compilation at the Ada level, we eventually
 chose to define stubs with consistent names across the various GCC
 configuration possibilities. 

 The patch achieves this, basically tested against today's 3.3 sources.

 Please tell me if it allows you to proceed further or not.

 Kind Regards,

 Olivier

*** a-except.adb.ori	Mon Mar  3 17:04:28 2003
--- a-except.adb	Mon Mar  3 17:12:01 2003
*************** package body Ada.Exceptions is
*** 199,205 ****
     function Unwind_RaiseException
       (E    : access GNAT_GCC_Exception)
        return Unwind_Reason_Code;
!    pragma Import (C, Unwind_RaiseException, "_Unwind_RaiseException");
  
     -----------------------
     -- Local Subprograms --
--- 199,205 ----
     function Unwind_RaiseException
       (E    : access GNAT_GCC_Exception)
        return Unwind_Reason_Code;
!    pragma Import (C, Unwind_RaiseException, "__gnat_Unwind_RaiseException");
  
     -----------------------
     -- Local Subprograms --
*** raise.c.ori	Mon Mar  3 17:04:16 2003
--- raise.c	Mon Mar  3 17:18:15 2003
*************** __gnat_eh_personality (version, actions,
*** 597,617 ****
  }
  
  
! #else   /* IN_RTS - For eh personality routine   */
  
  /* The calls to the GCC runtime interface for exception raising are currently
     issued from a-except.adb, which is used by both the runtime library and
     the compiler. As the compiler binary is not linked against the GCC runtime
     library, we need a stub for this interface in the compiler case.  */
  
  
  _Unwind_Reason_Code
! _Unwind_RaiseException (e)
       struct _Unwind_Exception *e ATTRIBUTE_UNUSED;
  {
-   /* Since we don't link the compiler with a host libgcc, we should not be
-      using the GCC eh mechanism for the compiler and so expect this function
-      never to be called.  */
    abort ();
  }
  
--- 597,644 ----
  }
  
  
! /* If the underlying GCC scheme for exception handling is SJLJ, the standard
!    propagation routine (_Unwind_RaiseException) is actually renamed using a
!    #define directive (see unwing-sjlj.c). We need a consistently named
!    interface to import from a-except, so stubs are defined here.  */
! 
! #ifdef __USING_SJLJ_EXCEPTIONS__
! 
! _Unwind_Reason_Code
! __gnat_Unwind_RaiseException (e)
!      struct _Unwind_Exception *e;
! {
!   return _Unwind_SjLj_RaiseException (e);
! }
! 
! #else
! /* __USING_SJLJ_EXCEPTIONS__ not defined */
! 
! void
! __gnat_Unwind_RaiseException (e)
!      struct _Unwind_Exception *e;
! {
!   return _Unwind_RaiseException (e);
! }
!  
! #endif
! 
! #else
! /* IN_RTS not defined */
  
  /* The calls to the GCC runtime interface for exception raising are currently
     issued from a-except.adb, which is used by both the runtime library and
     the compiler. As the compiler binary is not linked against the GCC runtime
     library, we need a stub for this interface in the compiler case.  */
  
+ /* Since we don't link the compiler with a host libgcc, we should not be
+    using the GCC eh mechanism for the compiler and so expect this function
+    never to be called.  */
  
  _Unwind_Reason_Code
! __gnat_Unwind_RaiseException (e)
       struct _Unwind_Exception *e ATTRIBUTE_UNUSED;
  {
    abort ();
  }
  




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]