[PATCH] Use libunwind library when linking g++

Steve Ellcey sje@cup.hp.com
Wed Jun 5 12:11:00 GMT 2002


I am resending this patch because it was never checked in or rejected:

This is a followup to an earlier patch to enable the
--enable-libunwind-exceptions.  Benjamin Kosnik checked in the
libstdc++-v3 portion of that patch so that if
--enable-libunwind-exceptions is given when configuring libstdc++-v3
then that library will be linked against libunwind.  This is the gcc
portion of the patch to add -lunwind to the g++ link line if
--enable-libunwind-exceptions is specified.  It does not do anything
about creating libunwind.  If someone could review this patch and check
it in I would appreciate it.  I have a copyright assignment on file but
no write permission.

Steve Ellcey
sje@cup.hp.com



2002-03-11  Steve Ellcey  <sje@cup.hp.com>
	* gcc/configure.in (CONFIG_UNWIND_EXCEPTIONS): Add support to set
	CONFIG_UNWIND_EXCEPTIONS if --enable-libunwind-exceptions is set.
	* gcc/config.in (CONFIG_UNWIND_EXCEPTIONS): Ditto.
	* gcc/cp/g++spec.c (lang_specific_driver): Add -lunwind if
	CONFIG_UNWIND_EXCEPTIONS is set.


*** gcc.orig/gcc/configure.in	Mon Mar 11 10:52:48 2002
--- gcc/gcc/configure.in	Mon Mar 11 10:58:41 2002
*************** AC_ARG_ENABLE(sjlj-exceptions,
*** 2139,2144 ****
--- 2139,2153 ----
  AC_DEFINE_UNQUOTED(CONFIG_SJLJ_EXCEPTIONS, $sjlj,
    [Define 0/1 to force the choice for exception handling model.])])
  
+ # Use libunwind based exception handling.
+ AC_ARG_ENABLE(libunwind-exceptions,
+ [  --enable-libunwind-exceptions  force use libunwind for exceptions],
+ use_libunwind_exceptions=$enableval,
+ use_libunwind_exceptions=no)
+ if test x"$use_libunwind_exceptions" = xyes; then
+    AC_DEFINE_UNQUOTED(CONFIG_LIBUNWIND_EXCEPTIONS, 1)
+ fi
+ 
  # Make empty files to contain the specs and options for each language.
  # Then add #include lines to for a compiler that has specs and/or options.
  
*** gcc.orig/gcc/config.in	Mon Mar 11 10:55:57 2002
--- gcc/gcc/config.in	Thu Jan 10 14:21:38 2002
***************
*** 554,562 ****
  /* Define 0/1 to force the choice for exception handling model. */
  #undef CONFIG_SJLJ_EXCEPTIONS
  
- /* Define if you want to link in libunwind for exceptions. */
- #undef CONFIG_LIBUNWIND_EXCEPTIONS
- 
  
  /* Bison unconditionally undefines `const' if neither `__STDC__' nor
     __cplusplus are defined.  That's a problem since we use `const' in
--- 554,559 ----
*** gcc.orig/gcc/cp/g++spec.c	Mon Mar 11 10:52:48 2002
--- gcc/gcc/cp/g++spec.c	Mon Mar 11 10:57:00 2002
*************** Boston, MA 02111-1307, USA.  */
*** 37,42 ****
--- 37,46 ----
  #define LIBSTDCXX "-lstdc++"
  #endif
  
+ #ifndef LIBUNWIND
+ #define LIBUNWIND "-lunwind"
+ #endif
+ 
  void
  lang_specific_driver (in_argc, in_argv, in_added_libraries)
       int *in_argc;
*************** lang_specific_driver (in_argc, in_argv, 
*** 261,266 ****
--- 265,274 ----
      {
        arglist[j++] = LIBSTDCXX;
        added_libraries++;
+ #ifdef CONFIG_LIBUNWIND_EXCEPTIONS
+       arglist[j++] = LIBUNWIND;
+       added_libraries++;
+ #endif
      }
    if (saw_math)
      arglist[j++] = saw_math;



More information about the Gcc-patches mailing list