Bug 9911 - gnatmake fails to link when GCC configured with --with-sjlj-exceptions=yes
Summary: gnatmake fails to link when GCC configured with --with-sjlj-exceptions=yes
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: ada (show other bugs)
Version: 3.3
: P3 normal
Target Milestone: ---
Assignee: Geert Bosch
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-03 01:45 UTC by dave.anglin
Modified: 2003-07-25 17:33 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dave 2003-03-02 23:25:16 UTC
From: "John David Anglin" <dave@hiauly1.hia.nrc.ca>
To: dannysmith@users.sourceforge.net
Cc: gcc-gnats@gcc.gnu.org, hainque@gnat.com, gcc-bugs@gcc.gnu.org,
   dave.anglin@nrc.ca, nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org
Subject: Re: ada/9911: gnatmake fails to link when GCC configured with --w
Date: Sun, 2 Mar 2003 23:25:16 -0500 (EST)

 > 2003-03-03  Danny Smith  <dannysmith@users.sourceforge.net>
 > 
 >        * raise.c (_Unwind_RaiseException): New function to wrap
 > _Unwind_SjLj_RaiseException
 >        for sjlj eh model.
 
 Based on the comment in raise.c, I don't think the fix is
 correct although 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.  raise.o isn't in libgnat.a.
 
 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.  I'm also not set up to test the exception support in it.
 
 I suspect the same problem affects the hpux ports which use sjlj
 exceptions by default.
 
 Dave
 -- 
 J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
 National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)
 
 -- 
 J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
 National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

Comment 1 dave.anglin 2003-03-03 01:45:59 UTC
../../xgcc -B../../ -DIN_GCC   `echo -g -W -Wall -Wwrite-strings -Wstrict-protot
ypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long  |sed -e 's/-pe
dantic//g' -e 's/-Wtraditional//g'`   -o ../../gnatmake b_gnatm.o ali.o ali-util
.o alloc.o atree.o binderr.o butil.o casing.o csets.o debug.o einfo.o elists.o e
rrout.o fmap.o fname.o fname-uf.o fname-sf.o gnatmake.o gnatvsn.o hostparm.o kru
nch.o lib.o make.o makeusg.o mlib.o mlib-fil.o mlib-prj.o mlib-tgt.o mlib-utl.o
namet.o nlists.o opt.o osint.o osint-m.o output.o prj.o prj-attr.o prj-com.o prj
-dect.o prj-env.o prj-ext.o prj-nmsc.o prj-pars.o prj-part.o prj-proc.o prj-strt
.o prj-tree.o prj-util.o rident.o scans.o scn.o sdefault.o sfn_scan.o sinfo.o si
nfo-cn.o sinput.o sinput-l.o sinput-p.o snames.o stand.o stringt.o style.o style
sw.o validsw.o switch.o switch-m.o switch-c.o table.o targparm.o tree_io.o types
.o uintp.o uname.o urealp.o usage.o widechar.o \
      ../../prefix.o ../../version.o ../rts/libgnat.a  ../../../libiberty/libibe
rty.a
../rts/libgnat.a(a-except.o)(.text+0x175c): In function `ada__exceptions__propag
ate_exception_with_gcc_support':
ada__exceptions__sdp_table_build__L_7__T222b___XDL_1/a-except.adb:1607: undefine
d reference to `_Unwind_RaiseException'
../rts/libgnat.a(a-except.o)(.text+0x1790):ada__exceptions__sdp_table_build__L_7
__T222b___XDL_1/a-except.adb:1635: undefined reference to ` _Unwind_RaiseException'

Looking at a-except.adb, I see it has been changed from that
in the 3.2 branch to directly call _Unwind_RaiseException.
However, this routine is not available when using SJLJ
exceptions.

As ada builds sucessfully on the port using the 3.2 branch
with SJLJ exceptions, this would appear to be a regression.

Release:
gcc-3.3

Environment:
hppa-unknown-linux-gnu
Comment 2 Danny Smith 2003-03-03 03:12:36 UTC
From: Danny Smith <dannysmith@clear.net.nz>
To: gcc-gnats@gcc.gnu.org, hainque@gnat.com, gcc-bugs@gcc.gnu.org,
 dave.anglin@nrc.ca, nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org
Cc:  
Subject: Re: ada/9911: gnatmake fails to link when GCC configured with
 --with-sjlj-exceptions=yes
Date: Mon, 03 Mar 2003 03:12:36 +0000

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=g
 cc&pr=9911
 
 
 This patch (against 3.3 branch) fixes.
 
 2003-03-03  Danny Smith  <dannysmith@users.sourceforge.net>
 
        * raise.c (_Unwind_RaiseException): New function to wrap
 _Unwind_SjLj_RaiseException
        for sjlj eh model.
 
 
 Index: raise.c
 ===================================================================
 RCS file: /cvs/gcc/gcc/gcc/ada/raise.c,v
 retrieving revision 1.5
 diff -c -3 -p -r1.5 raise.c
 *** raise.c 23 Oct 2002 07:33:28 -0000 1.5
 --- raise.c 3 Mar 2003 03:02:55 -0000
 *************** __gnat_eh_personality (version, actions,
 *** 596,601 ****
 --- 596,611 ----
     return _URC_INSTALL_CONTEXT;
   }
 
 + /* If __USING_SJLJ_EXCEPTIONS__  _Unwind_SjLj_RaiseException is
 exported
 +    from libgcc.a */
 + #ifdef __USING_SJLJ_EXCEPTIONS__
 + _Unwind_Reason_Code
 + _Unwind_RaiseException (e)
 +      struct _Unwind_Exception *e;
 + {
 +   return _Unwind_SjLj_RaiseException (e);
 + }
 + #endif
 
   #else   /* IN_RTS - For eh personality routine   */
 
 

Comment 3 dave 2003-03-03 14:21:29 UTC
From: "John David Anglin" <dave@hiauly1.hia.nrc.ca>
To: hainque@ACT-Europe.FR (Olivier Hainque)
Cc: dannysmith@users.sourceforge.net, gcc-gnats@gcc.gnu.org,
   gcc-bugs@gcc.gnu.org, dave.anglin@nrc.ca, gcc-prs@gcc.gnu.org,
   hainque@ACT-Europe.FR
Subject: Re: ada/9911: gnatmake fails to link when GCC configured for sjlj
Date: Mon, 3 Mar 2003 14:21:29 -0500 (EST)

 >  The patch achieves this, basically tested against today's 3.3 sources.
 > 
 >  Please tell me if it allows you to proceed further or not.
 
 Yes, it fixes the problem.  I will close the PR when it is installed.
 
 Thanks,
 Dave
 -- 
 J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
 National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

Comment 4 Olivier Hainque 2003-03-03 17:59:50 UTC
From: Olivier Hainque <hainque@ACT-Europe.FR>
To: John David Anglin <dave@hiauly1.hia.nrc.ca>
Cc: dannysmith@users.sourceforge.net, gcc-gnats@gcc.gnu.org,
	gcc-bugs@gcc.gnu.org, dave.anglin@nrc.ca, gcc-prs@gcc.gnu.org,
	hainque@ACT-Europe.FR
Subject: Re: ada/9911: gnatmake fails to link when GCC configured for sjlj
Date: Mon, 3 Mar 2003 17:59:50 +0100

 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 ();
   }
   
 
 
 

Comment 5 Geert Bosch 2003-03-04 20:11:24 UTC
From: bosch@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: ada/9911
Date: 4 Mar 2003 20:11:24 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_3-branch
 Changes by:	bosch@gcc.gnu.org	2003-03-04 20:11:23
 
 Modified files:
 	gcc/ada        : ChangeLog a-except.adb raise.c 
 
 Log message:
 	PR ada/9911
 	* a-except.adb (Unwind_RaiseException): Import a GNAT specific
 	wrapper, which name remains constant whatever underlying GCC
 	scheme.
 	
 	* raise.c (__gnat_Unwind_RaiseException): New wrappers, providing
 	the stable interface needed for a-except.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ada/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.270.2.8&r2=1.270.2.9
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ada/a-except.adb.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.6&r2=1.6.4.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ada/raise.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.5&r2=1.5.4.1
 
Comment 6 Geert Bosch 2003-03-04 20:21:18 UTC
Responsible-Changed-From-To: unassigned->bosch
Responsible-Changed-Why: installed patch.
Comment 7 Geert Bosch 2003-03-04 20:21:18 UTC
State-Changed-From-To: open->closed
State-Changed-Why: Fixed (both on 3.3 branch and mainline)