Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc

2011-07-05 Thread Thomas Schwinge
Hallo!

On Wed, 29 Jun 2011 10:40:10 +0200, Paolo Bonzini bonz...@gnu.org wrote:
 On 06/21/2011 12:04 PM, Rainer Orth wrote:
  For md_unwind_header on the other hand, you'd have almost as many cases
  as in the general case.  I fear it's hard to have the configuration
  split over too many places.  So I'd suggest to split the affected cases
  into Linux and non-Linux ones, with the slight duplication necessary for
  extra_parts and tmake_file.
 
 I agree.  Thomas, are you going to do that?

Like this?


libgcc/
config.host: Use i386/linux-unwind.h only for *-*-linux*.

---
 libgcc/config.host |   10 --
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/libgcc/config.host b/libgcc/config.host
index 326ce91..1d5b887 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -354,12 +354,18 @@ i[34567]86-*-openbsd*)
 i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | 
i[34567]86-*-gnu* | i[34567]86-*-kopensolaris*-gnu)
extra_parts=$extra_parts crtprec32.o crtprec64.o crtprec80.o 
crtfastmath.o
tmake_file=${tmake_file} i386/t-crtpc i386/t-crtfm
-   md_unwind_header=i386/linux-unwind.h
+case $host in
+*-*-linux*)
+   md_unwind_header=i386/linux-unwind.h;;
+esac
;;
 x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
extra_parts=$extra_parts crtprec32.o crtprec64.o crtprec80.o 
crtfastmath.o
tmake_file=${tmake_file} i386/t-crtpc i386/t-crtfm
-   md_unwind_header=i386/linux-unwind.h
+case $host in
+*-*-linux*)
+   md_unwind_header=i386/linux-unwind.h;;
+esac
;;
 i[34567]86-pc-msdosdjgpp*)
;;
-- 
tg: (1677490..) linux-unwind.h (depends on: master)

Manually tested as follows -- is that enough?

$ (host=i686-pc-linux-gnu  . libgcc/config.host  echo 
$md_unwind_header)
i386/linux-unwind.h
$ (host=i686-pc-kfreebsd-gnu  . libgcc/config.host  echo 
$md_unwind_header)
no-unwind.h
$ (host=i686-pc-gnu  . libgcc/config.host  echo $md_unwind_header)
no-unwind.h
$ (host=x86_64-pc-linux-gnu  . libgcc/config.host  echo 
$md_unwind_header)
i386/linux-unwind.h
$ (host=x86_64-pc-kfreebsd-gnu  . libgcc/config.host  echo 
$md_unwind_header)
no-unwind.h


Grüße,
 Thomas


pgpMovGGfxHVZ.pgp
Description: PGP signature


Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc

2011-07-05 Thread Rainer Orth
Hi Thomas,

 Like this?


   libgcc/
   config.host: Use i386/linux-unwind.h only for *-*-linux*.

 ---
  libgcc/config.host |   10 --
  1 files changed, 8 insertions(+), 2 deletions(-)

 diff --git a/libgcc/config.host b/libgcc/config.host
 index 326ce91..1d5b887 100644
 --- a/libgcc/config.host
 +++ b/libgcc/config.host
 @@ -354,12 +354,18 @@ i[34567]86-*-openbsd*)
  i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu 
 | i[34567]86-*-gnu* | i[34567]86-*-kopensolaris*-gnu)
   extra_parts=$extra_parts crtprec32.o crtprec64.o crtprec80.o 
 crtfastmath.o
   tmake_file=${tmake_file} i386/t-crtpc i386/t-crtfm
 - md_unwind_header=i386/linux-unwind.h
 +case $host in
 +*-*-linux*)
 + md_unwind_header=i386/linux-unwind.h;;
 +esac
   ;;
  x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
   extra_parts=$extra_parts crtprec32.o crtprec64.o crtprec80.o 
 crtfastmath.o
   tmake_file=${tmake_file} i386/t-crtpc i386/t-crtfm
 - md_unwind_header=i386/linux-unwind.h
 +case $host in
 +*-*-linux*)
 + md_unwind_header=i386/linux-unwind.h;;
 +esac

Instead of nested cases, I'd rather use one i[34567]86-*-linux* case and
another for the rest, duplicating extra_parts and tmake_file.  Same for
x86_64-*-linux* vs. the rest.

But that's just me.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc

2011-07-05 Thread Paolo Bonzini

On 07/05/2011 01:52 PM, Rainer Orth wrote:

Instead of nested cases, I'd rather use one i[34567]86-*-linux* case and
another for the rest, duplicating extra_parts and tmake_file.  Same for
x86_64-*-linux* vs. the rest.

But that's just me.


I agree.

Paolo


Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc

2011-07-05 Thread Thomas Schwinge
Hallo!

On Tue, 05 Jul 2011 13:52:08 +0200, Rainer Orth r...@cebitec.uni-bielefeld.de 
wrote:
  Like this?  [...]
 
 Instead of nested cases, I'd rather use one i[34567]86-*-linux* case and
 another for the rest, duplicating extra_parts and tmake_file.  Same for
 x86_64-*-linux* vs. the rest.
 
 But that's just me.

My idea was to keep the GNU systems' extra_parts and tmake_file stanzas
together.  But it's a bit wishi washi anyway in all these configuration
files, so we might as well use the following patch.

Manually tested as before -- more testing required?

libgcc/
config.host: Use i386/linux-unwind.h only for *-*-linux*.

---
 libgcc/config.host |   12 ++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/libgcc/config.host b/libgcc/config.host
index 326ce91..c89155f 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -351,16 +351,24 @@ i[34567]86-*-openbsd2.*|i[34567]86-*openbsd3.[0123])
;;
 i[34567]86-*-openbsd*)
;;
-i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | 
i[34567]86-*-gnu* | i[34567]86-*-kopensolaris*-gnu)
+i[34567]86-*-linux*)
extra_parts=$extra_parts crtprec32.o crtprec64.o crtprec80.o 
crtfastmath.o
tmake_file=${tmake_file} i386/t-crtpc i386/t-crtfm
md_unwind_header=i386/linux-unwind.h
;;
-x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
+i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i[34567]86-*-gnu* | 
i[34567]86-*-kopensolaris*-gnu)
+   extra_parts=$extra_parts crtprec32.o crtprec64.o crtprec80.o 
crtfastmath.o
+   tmake_file=${tmake_file} i386/t-crtpc i386/t-crtfm
+   ;;
+x86_64-*-linux*)
extra_parts=$extra_parts crtprec32.o crtprec64.o crtprec80.o 
crtfastmath.o
tmake_file=${tmake_file} i386/t-crtpc i386/t-crtfm
md_unwind_header=i386/linux-unwind.h
;;
+x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
+   extra_parts=$extra_parts crtprec32.o crtprec64.o crtprec80.o 
crtfastmath.o
+   tmake_file=${tmake_file} i386/t-crtpc i386/t-crtfm
+   ;;
 i[34567]86-pc-msdosdjgpp*)
;;
 i[34567]86-*-lynxos*)
-- 
tg: (1677490..) linux-unwind.h (depends on: master)


Grüße,
 Thomas


pgpDr1E5I8D33.pgp
Description: PGP signature


Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc

2011-07-05 Thread Paolo Bonzini

On 07/05/2011 02:13 PM, Thomas Schwinge wrote:

Hallo!

On Tue, 05 Jul 2011 13:52:08 +0200, Rainer Orthr...@cebitec.uni-bielefeld.de  
wrote:

Like this?  [...]


Instead of nested cases, I'd rather use one i[34567]86-*-linux* case and
another for the rest, duplicating extra_parts and tmake_file.  Same for
x86_64-*-linux* vs. the rest.

But that's just me.


My idea was to keep the GNU systems' extra_parts and tmake_file stanzas
together.  But it's a bit wishi washi anyway in all these configuration
files, so we might as well use the following patch.

Manually tested as before -- more testing required?

libgcc/
config.host: Use i386/linux-unwind.h only for *-*-linux*.


Ok, with changelog entry like

* config.host (i[34567]86-*-kfreebsd*-gnu,
i[34567]86-*-knetbsd*-gnu, i[34567]86-*-gnu*,
i[34567]86-*-kopensolaris*-gnu): Remove md_unwind_header
by splitting out of...
(i[34567]86-*-linux*): ... this.
* config.host (x86_64-*-kfreebsd*-gnu, x86_64-*-knetbsd*-gnu):
Remove md_unwind_header by splitting out of...
(x86_64-*-linux*): ... this.

Paolo


Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc

2011-06-29 Thread Paolo Bonzini

On 06/21/2011 12:04 PM, Rainer Orth wrote:

For md_unwind_header on the other hand, you'd have almost as many cases
as in the general case.  I fear it's hard to have the configuration
split over too many places.  So I'd suggest to split the affected cases
into Linux and non-Linux ones, with the slight duplication necessary for
extra_parts and tmake_file.


I agree.  Thomas, are you going to do that?

Paolo


Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc

2011-06-03 Thread Rainer Orth
Paolo Bonzini bonz...@gnu.org writes:

 On 05/30/2011 05:43 PM, Rainer Orth wrote:
 +md-unwind-support.h: config.status
 +if test -n $(md_unwind_header); then \
 +  echo #include \config/$(md_unwind_header)\  $@; \
 +else \
 +  :  $@; \
 +fi

 Can you add a default file md-unwind-none.h and use

 AC_CONFIG_LINKS([md-unwind-support.h:$md_unwind_header])

 instead of this (and instead of AC_SUBST'ing the variable)?

Sure, done in the revised patch below.

 -libgcc-eh-objects += $(addsuffix $(objext),$(basename $(notdir 
 $(LIB2ADDEHSTATIC
 -libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir 
 $(LIB2ADDEHSHARED
 +libgcc-eh-static-objects := $(addsuffix $(objext),$(basename $(notdir 
 $(LIB2ADDEHSTATIC
 +libgcc-eh-shared-objects := $(addsuffix _s$(objext),$(basename $(notdir 
 $(LIB2ADDEHSHARED
 +
 +$(libgcc-eh-static-objects) $(libgcc-eh-shared-objects): md-unwind-support.h
 +
 +libgcc-eh-objects += $(libgcc-eh-static-objects)
 +libgcc-s-objects += $(libgcc-eh-shared-objects)

 These changes to the dependencies should not be necessary, libgcc does
 automatic dependency tracking.

I suppose it was necessary before when md-unwind-support.h didn't exist
at build time, so dependency generation failed  With the new scheme
using AC_CONFIG_LINKS, they are indeed unnecessary.

 Also a good start, though.  Thanks for this work.

Apart from those changes, the patch addresses the PowerPC Darwin and
Windows32 issues as suggested:

* rs6000/darwin-unwind.h is wrapped in !__LP64__, while removing the
  need for the !DARWIN_LIBSYSTEM_HAS_UNWIND test (only defined on Darwin
  9 and up) by using the file only for PowerPC Darwin  9.

* i386/w32-unwind.h is wrapped in !__MINGW64__.

Bootstrapped without regressions on i386-pc-solaris2.11.

Ok for mainline?

Thanks.
Rainer


2011-05-29  Rainer Orth  r...@cebitec.uni-bielefeld.de

gcc:
* config/alpha/linux.h (MD_UNWIND_SUPPORT): Remove.
* config/alpha/osf5.h (MD_UNWIND_SUPPORT): Remove.
* config/alpha/vms.h (MD_UNWIND_SUPPORT): Remove.
* config/bfin/linux.h (MD_UNWIND_SUPPORT): Remove.
* config/bfin/uclinux.h (MD_UNWIND_SUPPORT): Remove.
* config/i386/linux.h (MD_UNWIND_SUPPORT): Remove.
* config/i386/linux64.h (MD_UNWIND_SUPPORT): Remove.
* config/i386/sol2.h (MD_UNWIND_SUPPORT): Remove.
* config/i386/mingw32.h (MD_UNWIND_SUPPORT): Remove.
* config/ia64/linux.h (MD_UNWIND_SUPPORT): Remove.
* config/ia64/vms.h (MD_UNWIND_SUPPORT): Remove.
* config/m68k/linux.h (MD_UNWIND_SUPPORT): Remove.
* config/mips/linux.h (MD_UNWIND_SUPPORT): Remove.
* config/pa/pa-hpux.h (MD_UNWIND_SUPPORT): Remove.
* config/pa/pa32-linux.h (MD_UNWIND_SUPPORT): Remove.
* config/rs6000/darwin.h (MD_UNWIND_SUPPORT): Remove.
* config/rs6000/linux.h (MD_UNWIND_SUPPORT): Remove.
* config/rs6000/linux64.h (MD_UNWIND_SUPPORT): Remove.
* config/s390/linux.h (MD_UNWIND_SUPPORT): Remove.
* config/s390/tpf.h (MD_UNWIND_SUPPORT): Remove.
* config/sh/linux.h (MD_UNWIND_SUPPORT): Remove.
* config/sparc/linux.h (MD_UNWIND_SUPPORT): Remove.
* config/sparc/linux64.h (MD_UNWIND_SUPPORT): Remove.
* config/sparc/sol2.h (MD_UNWIND_SUPPORT): Remove.
* config/xtensa/linux.h (MD_UNWIND_SUPPORT): Remove.
* config/alpha/linux-unwind.h: Move to ../libgcc/config/alpha.
* config/alpha/osf5-unwind.h: Move to ../libgcc/config/alpha.
* config/alpha/vms-unwind.h: Move to ../libgcc/config/alpha.
* config/bfin/linux-unwind.h: Move to ../libgcc/config/bfin.
* config/i386/linux-unwind.h: Move to ../libgcc/config/i386.
* config/i386/sol2-unwind.h: Move to ../libgcc/config/i386.
* config/i386/w32-unwind.h: Move to ../libgcc/config/i386.
* config/ia64/linux-unwind.h: Move to ../libgcc/config/ia64.
* config/ia64/vms-unwind.h: Move to ../libgcc/config/ia64.
* config/m68k/linux-unwind.h: Move to ../libgcc/config/m68k.
* config/mips/linux-unwind.h: Move to ../libgcc/config/mips.
* config/pa/hpux-unwind.h: Move to ../libgcc/config/pa.
* config/pa/linux-unwind.h: Move to ../libgcc/config/pa.
* config/rs6000/darwin-unwind.h: Move to ../libgcc/config/rs6000.
* config/rs6000/linux-unwind.h: Move to ../libgcc/config/rs6000.
* config/s390/linux-unwind.h: Move to ../libgcc/config/s390.
* config/s390/tpf-unwind.h: Move to ../libgcc/config/s390.
* config/sh/linux-unwind.h: Move to ../libgcc/config/sh.
* config/sparc/linux-unwind.h: Move to ../libgcc/config/sparc.
* config/sparc/sol2-unwind.h: Move to ../libgcc/config/sparc.
* config/xtensa/linux-unwind.h: Move to ../libgcc/config/xtensa.
* config/darwin9.h (DARWIN_LIBSYSTEM_HAS_UNWIND): Remove.
* system.h (MD_UNWIND_SUPPORT): Poison.
* doc/tm.texi.in (Exception 

Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc

2011-06-03 Thread Paolo Bonzini

On 06/03/2011 04:35 PM, Rainer Orth wrote:

Apart from those changes, the patch addresses the PowerPC Darwin and
Windows32 issues as suggested:

* rs6000/darwin-unwind.h is wrapped in !__LP64__, while removing the
   need for the !DARWIN_LIBSYSTEM_HAS_UNWIND test (only defined on Darwin
   9 and up) by using the file only for PowerPC Darwin  9.

* i386/w32-unwind.h is wrapped in !__MINGW64__.

Bootstrapped without regressions on i386-pc-solaris2.11.


Please give time to Kai and someone from Darwin (CCed Mike and 
Dominique) to test it and approve it.  The .h changes are trivial, so I 
think I can otherwise approve it.


Paolo


Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc

2011-06-03 Thread Kai Tietz
Ok, windows part of the patch is ok.

Thanks,
Kai


Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc

2011-06-03 Thread Mike Stump
On Jun 3, 2011, at 7:35 AM, Rainer Orth wrote:
 Apart from those changes, the patch addresses the PowerPC Darwin and
 Windows32 issues as suggested:

Darwin bits: Ok.


Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc

2011-06-01 Thread Rainer Orth
Mike Stump mikest...@comcast.net writes:

 On May 30, 2011, at 8:43 AM, Rainer Orth wrote:
 * The three users of MD_UNWIND_SUPPORT are modified to unconditionally
  include a new md-unwind-support.h header which is created from the
  info in config.host: if md_unwind_header exists, it is included in
  md-unwind-support.h, otherwise the generated header is empty.

 diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h
 --- a/gcc/config/rs6000/darwin.h
 +++ b/gcc/config/rs6000/darwin.h
 @@ -381,10 +381,6 @@ extern int darwin_emit_branch_islands;
 #include stdbool.h
 #endif
 
 -#if !defined(__LP64__)  !defined(DARWIN_LIBSYSTEM_HAS_UNWIND)
 -#define MD_UNWIND_SUPPORT config/rs6000/darwin-unwind.h
 -#endif
 -

 So, I'm wondering, can we just roll this check into the header, so instead of:

 #if A
 #include file
 #endif

 file:
 bla

 we have:

 #include file

 file:
 #if A
 bla
 #endif

 The advantages, any wrapping code is handled the exact same way.  Once this 
 is done, then the transformation to port is identical to every other port.  
 Also, this general rule would apply to the other corner cases as well, if I 
 read them right.

 ?

The problem with this approach is that some of the macros tested only
live in gcc, not libgcc once the libgcc sources no longer include tm.h
etc.  E.g. look at i386/mingw32.h:

#if !TARGET_64BIT_DEFAULT  !defined (TARGET_BI_ARCH)
#define MD_UNWIND_SUPPORT config/i386/w32-unwind.h
#endif

Both TARGET_64BIT_DEFAULT and TARGET_BI_ARCH live in gcc only, so at
least in the medium term, we need different tests here.

 Oh, once this is done, I think:

 /* libSystem contains unwind information for signal frames.  */
 #define DARWIN_LIBSYSTEM_HAS_UNWIND

 is only used by libgcc.  Does it have to move at the same time?  If so, then 
 it needs moving.  If it doesn't have to move, you can leave it behind if you 
 want, though my preference would be to move it.

It doesn't have to, but it could.  On the other hand, my question still
stands: DARWIN_LIBSYSTEM_HAS_UNWIND is defined in gcc/config/darwin9.h.
So if every release up to Darwin 8 on PowerPC is 32-bit only (I honestly
don't know), then we could just restrict rs6000/darwin-unwind.h to
darwin  9 and be done with it, no need for the macros above.

 I think the darwin bits are Ok with this change.

I can certainly do it this way for now, but if we could do away with the
tests completely, that would be cleaner.

Thanks.
Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc

2011-06-01 Thread Mike Stump
On Jun 1, 2011, at 9:01 AM, Rainer Orth wrote:
 Both TARGET_64BIT_DEFAULT and TARGET_BI_ARCH live in gcc only, so at
 least in the medium term, we need different tests here.

Ah, ick.  Oh well...  The next more general rule would be something like: one 
can set a feature (implicit -D__GCC_DO_UNWIND_BLA) in the compiler when 
TARGET_64BIT_DEFAULT and TARGET_BI_ARCH are set a certain way, and then in 
libgcc, one can just test that feature directly.  Ick, I hate inventing feature 
names here...

 I can certainly do it this way for now, but if we could do away with the
 tests completely, that would be cleaner.

Agreed, though, I don't believe the test is superfluous.



Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc

2011-06-01 Thread Richard Henderson
On 06/01/2011 09:01 AM, Rainer Orth wrote:
 The problem with this approach is that some of the macros tested only
 live in gcc, not libgcc once the libgcc sources no longer include tm.h
 etc.  E.g. look at i386/mingw32.h:
 
 #if !TARGET_64BIT_DEFAULT  !defined (TARGET_BI_ARCH)
 #define MD_UNWIND_SUPPORT config/i386/w32-unwind.h
 #endif
 
 Both TARGET_64BIT_DEFAULT and TARGET_BI_ARCH live in gcc only, so at
 least in the medium term, we need different tests here.

For this specific case, surely neither isn't relevant.
Surely the proper test, in the target header, is simply 

#ifndef __MINGW64__

as one would write in normal user-level code.


r~


Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc

2011-06-01 Thread Kai Tietz
2011/6/1 Richard Henderson r...@redhat.com:
 On 06/01/2011 09:01 AM, Rainer Orth wrote:
 The problem with this approach is that some of the macros tested only
 live in gcc, not libgcc once the libgcc sources no longer include tm.h
 etc.  E.g. look at i386/mingw32.h:

 #if !TARGET_64BIT_DEFAULT  !defined (TARGET_BI_ARCH)
 #define MD_UNWIND_SUPPORT config/i386/w32-unwind.h
 #endif

 Both TARGET_64BIT_DEFAULT and TARGET_BI_ARCH live in gcc only, so at
 least in the medium term, we need different tests here.

 For this specific case, surely neither isn't relevant.
 Surely the proper test, in the target header, is simply

 #ifndef __MINGW64__

 as one would write in normal user-level code.


 r~

Yes, thanks.  Well, we would loose here the ability to build for
mingw-w64 dw2 support for 32-bit (to be compatible to mingw.org's
32-bit variant, as they want to use this dw2 unwinder), but mingw-w64
doesn't want dw2-unwind in general, as dw2-unwind has some issues
about throwing of VC generated code. So this test might be ok too.

Regards,
Kai


Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc

2011-06-01 Thread Rainer Orth
Mike Stump mikest...@comcast.net writes:

 On Jun 1, 2011, at 9:01 AM, Rainer Orth wrote:
 Both TARGET_64BIT_DEFAULT and TARGET_BI_ARCH live in gcc only, so at
 least in the medium term, we need different tests here.

 Ah, ick.  Oh well...  The next more general rule would be something like: one 
 can set a feature (implicit -D__GCC_DO_UNWIND_BLA) in the compiler when 
 TARGET_64BIT_DEFAULT and TARGET_BI_ARCH are set a certain way, and then in 
 libgcc, one can just test that feature directly.  Ick, I hate inventing 
 feature names here...

True, but only as a last resort.  Alternatively, one could try to
determine the feature with autoconf.

 I can certainly do it this way for now, but if we could do away with the
 tests completely, that would be cleaner.

 Agreed, though, I don't believe the test is superfluous.

You still haven't answered my question wrt. Darwin 8 vs. 64-bit on
PowerPC.  Perhaps we can do away with DARWIN_LIBSYSTEM_HAS_UNWIND
completely?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc

2011-05-31 Thread Paolo Bonzini

On 05/30/2011 07:54 PM, Kai Tietz wrote:

 -/* For 64-bit Windows we can't use DW2 unwind info. Also for multilib
 -   builds we can't use it, too.  */
 -#if !TARGET_64BIT_DEFAULT  !defined (TARGET_BI_ARCH)
 -#define MD_UNWIND_SUPPORT config/i386/w32-unwind.h
 -#endif
 -
   /* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygming. */
   /* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygwin. */
   #if DWARF2_UNWIND_INFO

mingw part is not ok, as it breaks 32-bit defaulted multilib version
compiler.


Can you explain what is going on here?  Could it be fixed by wrapping 
w32-unwind.h in a #ifdef __x86_64__?


Rainer, the same solution that is found for Windows should be used for 
darwin, too.


Paolo


Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc

2011-05-31 Thread Paolo Bonzini

On 05/30/2011 05:43 PM, Rainer Orth wrote:

+md-unwind-support.h: config.status
+   if test -n $(md_unwind_header); then \
+ echo #include \config/$(md_unwind_header)\  $@; \
+   else \
+ :  $@; \
+   fi


Can you add a default file md-unwind-none.h and use

AC_CONFIG_LINKS([md-unwind-support.h:$md_unwind_header])

instead of this (and instead of AC_SUBST'ing the variable)?


-libgcc-eh-objects += $(addsuffix $(objext),$(basename $(notdir 
$(LIB2ADDEHSTATIC
-libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir 
$(LIB2ADDEHSHARED
+libgcc-eh-static-objects := $(addsuffix $(objext),$(basename $(notdir 
$(LIB2ADDEHSTATIC
+libgcc-eh-shared-objects := $(addsuffix _s$(objext),$(basename $(notdir 
$(LIB2ADDEHSHARED
+
+$(libgcc-eh-static-objects) $(libgcc-eh-shared-objects): md-unwind-support.h
+
+libgcc-eh-objects += $(libgcc-eh-static-objects)
+libgcc-s-objects += $(libgcc-eh-shared-objects)


These changes to the dependencies should not be necessary, libgcc does 
automatic dependency tracking.


Also a good start, though.  Thanks for this work.

Paolo


Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc

2011-05-31 Thread Kai Tietz
2011/5/31 Paolo Bonzini bonz...@gnu.org:
 On 05/30/2011 07:54 PM, Kai Tietz wrote:

  -/* For 64-bit Windows we can't use DW2 unwind info. Also for multilib
  -   builds we can't use it, too.  */
  -#if !TARGET_64BIT_DEFAULT  !defined (TARGET_BI_ARCH)
  -#define MD_UNWIND_SUPPORT config/i386/w32-unwind.h
  -#endif
  -
    /* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygming. */
    /* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygwin. */
    #if DWARF2_UNWIND_INFO

 mingw part is not ok, as it breaks 32-bit defaulted multilib version
 compiler.

 Can you explain what is going on here?  Could it be fixed by wrapping
 w32-unwind.h in a #ifdef __x86_64__?

To wrap it into __x86_64__ won't help. The issue is that in
combination of 32-bit and 64-bit we need to default here to SjLj, as
64-bit doesn't support dw2 unwinding stuff and uses here internally
instead SEH. So if target is 32-bit default, but a multilib version is
used, we can't use w32-unwind.h.

The line of interest is #if !TARGET_64BIT_DEFAULT   !defined
(TARGET_BI_ARCH), which says: if target is 64-bit then don't use
w32-unwind.h. if we are building for multilib then don't use
w32-unwind.h.

Well, wrapping header with __x64_64__ might helper partial. . But this
might be worth a try. Nevertheless I assume that then at least
produced DLL names for libgcc could get confused for their extensions.
Rainer: It would be helpful, if you could try this.

 Rainer, the same solution that is found for Windows should be used for
 darwin, too.

 Paolo


Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc

2011-05-31 Thread Paolo Bonzini

On 05/31/2011 11:30 AM, Kai Tietz wrote:

The issue is that in
combination of 32-bit and 64-bit we need to default here to SjLj,


Ok, then what you're testing is actually whether you're using sjlj or 
dw2 unwinding.  config/i386/cygming.h will ensure that this is the same 
as testing TARGET_BI_ARCH and TARGET_64BIT_DEFAULT.


Then you can just pass EH_MODEL or SHLIB_SONAME down to libgcc via 
libgcc.mvars, and look at it in libgcc/config.host to pick the 
appropriate header.


Paolo


Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc

2011-05-31 Thread Rainer Orth
Paolo Bonzini bonz...@gnu.org writes:

 Rainer, the same solution that is found for Windows should be used for
 darwin, too.

I'm uncertain if anything is needed for Darwin, though:
gcc/config/rs6000/darwin.h has

#if !defined(__LP64__)  !defined(DARWIN_LIBSYSTEM_HAS_UNWIND)
#define MD_UNWIND_SUPPORT config/rs6000/darwin-unwind.h
#endif

gcc/config/darwin9.h defines DARWIN_LIBSYSTEM_HAS_UNWIND, so this only
applies to Darwin 8 and earlier.  That's why I have this in
libgcc/config.host:

powerpc-*-darwin*)
case ${host} in
*-*-darwin9* | *-*-darwin[12][0-9]*)
  ;;
*)
  md_unwind_header=rs6000/darwin-unwind.h
  ;;
esac

I've no idea if Darwin 8 had 64-bit support, so rs6000/darwin-unwind.h
would still have to be disabled.  Perhaps the Darwin maintainers could
chime in?

Thanks.
Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc

2011-05-31 Thread Rainer Orth
Kai Tietz ktiet...@googlemail.com writes:

 mingw part is not ok, as it breaks 32-bit defaulted multilib version
 compiler.

 Can you explain what is going on here?  Could it be fixed by wrapping
 w32-unwind.h in a #ifdef __x86_64__?

 To wrap it into __x86_64__ won't help. The issue is that in
 combination of 32-bit and 64-bit we need to default here to SjLj, as
 64-bit doesn't support dw2 unwinding stuff and uses here internally
 instead SEH. So if target is 32-bit default, but a multilib version is
 used, we can't use w32-unwind.h.

Wouldn't it work to use DWARF-2 EH in the 32-bit multilib, but SjLj/SEH
for 64-bit?  If so, wrapping i386/w32-unwind.h in #ifdef __x86_64__
would have exactly this effect, irrespective of multilib use.

 Well, wrapping header with __x64_64__ might helper partial. . But this
 might be worth a try. Nevertheless I assume that then at least
 produced DLL names for libgcc could get confused for their extensions.
 Rainer: It would be helpful, if you could try this.

Unfortunately, I cannot: I don't have any access to windows systems, so
I'm relying on the target maintainers or other interested parties to
test.

Thanks.
Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc

2011-05-31 Thread Rainer Orth
Paolo Bonzini bonz...@gnu.org writes:

 On 05/30/2011 05:43 PM, Rainer Orth wrote:
 +md-unwind-support.h: config.status
 +if test -n $(md_unwind_header); then \
 +  echo #include \config/$(md_unwind_header)\  $@; \
 +else \
 +  :  $@; \
 +fi

 Can you add a default file md-unwind-none.h and use

 AC_CONFIG_LINKS([md-unwind-support.h:$md_unwind_header])

 instead of this (and instead of AC_SUBST'ing the variable)?

Sure, will do.

 -libgcc-eh-objects += $(addsuffix $(objext),$(basename $(notdir 
 $(LIB2ADDEHSTATIC
 -libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir 
 $(LIB2ADDEHSHARED
 +libgcc-eh-static-objects := $(addsuffix $(objext),$(basename $(notdir 
 $(LIB2ADDEHSTATIC
 +libgcc-eh-shared-objects := $(addsuffix _s$(objext),$(basename $(notdir 
 $(LIB2ADDEHSHARED
 +
 +$(libgcc-eh-static-objects) $(libgcc-eh-shared-objects): md-unwind-support.h
 +
 +libgcc-eh-objects += $(libgcc-eh-static-objects)
 +libgcc-s-objects += $(libgcc-eh-shared-objects)

 These changes to the dependencies should not be necessary, libgcc does
 automatic dependency tracking.

That's what I thought, but my bootstraps failed since there wasn't any
dependency that triggered the creation of the header.  That's when I
introduced this explicit dependency.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc

2011-05-31 Thread Mike Stump
On May 30, 2011, at 8:43 AM, Rainer Orth wrote:
 * The three users of MD_UNWIND_SUPPORT are modified to unconditionally
  include a new md-unwind-support.h header which is created from the
  info in config.host: if md_unwind_header exists, it is included in
  md-unwind-support.h, otherwise the generated header is empty.

 diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h
 --- a/gcc/config/rs6000/darwin.h
 +++ b/gcc/config/rs6000/darwin.h
 @@ -381,10 +381,6 @@ extern int darwin_emit_branch_islands;
 #include stdbool.h
 #endif
 
 -#if !defined(__LP64__)  !defined(DARWIN_LIBSYSTEM_HAS_UNWIND)
 -#define MD_UNWIND_SUPPORT config/rs6000/darwin-unwind.h
 -#endif
 -

So, I'm wondering, can we just roll this check into the header, so instead of:

#if A
#include file
#endif

file:
bla

we have:

#include file

file:
#if A
bla
#endif

The advantages, any wrapping code is handled the exact same way.  Once this is 
done, then the transformation to port is identical to every other port.  Also, 
this general rule would apply to the other corner cases as well, if I read them 
right.

?

Oh, once this is done, I think:

/* libSystem contains unwind information for signal frames.  */
#define DARWIN_LIBSYSTEM_HAS_UNWIND

is only used by libgcc.  Does it have to move at the same time?  If so, then it 
needs moving.  If it doesn't have to move, you can leave it behind if you want, 
though my preference would be to move it.

I think the darwin bits are Ok with this change.


Re: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc

2011-05-30 Thread Kai Tietz
- Original Message -
From: Rainer Orth r...@cebitec.uni-bielefeld.de
To: gcc-patches@gcc.gnu.org
Cc: Joseph S. Myers jos...@codesourcery.com, Paolo Bonzini 
bonz...@gnu.org, Ralf Wildenhues ralf.wildenh...@gmx.de, Douglas Rupp 
r...@gnat.com, Tristan Gingold ging...@adacore.com, John David Anglin 
dave.ang...@nrc-cnrc.gc.ca, Steve Ellcey s...@cup.hp.com, Kai Tietz 
kti...@redhat.com, Dave Korn dave.korn.cyg...@gmail.com, Mike Stump 
mikest...@comcast.net
Sent: Monday, May 30, 2011 5:43:22 PM
Subject: [build] Move MD_UNWIND_SUPPORT to toplevel libgcc

Once the initial Solaris 2 toplevel libgcc move

http://gcc.gnu.org/ml/gcc-patches/2011-05/msg00098.html

is complete, there are only two macros left that could be moved for my
targets: MD_UNWIND_SUPPORT (handled in this patch) and
ENABLE_EXECUTE_STACK (in a followup).

The following patch moves MD_UNWIND_SUPPORT and is pretty mechanical:

* It removes the macro in the gcc/config headers and poisons it in
  gcc/system.h.

* It introduces a new md_unwind_header variable in libgcc/config.host to
  capture the info.

* The three users of MD_UNWIND_SUPPORT are modified to unconditionally
  include a new md-unwind-support.h header which is created from the
  info in config.host: if md_unwind_header exists, it is included in
  md-unwind-support.h, otherwise the generated header is empty.

Bootstrapped without regressions on i386-pc-solaris2.11 and
sparc-sun-solaris2.11.

I'm Cc'ing the OS port maintainers if listed, but not the CPU port ones.

Given the straightforward nature of the patch, I'd really appreciate if
a build maintainer and global reviewer could approve it.

Thanks.
Rainer


2011-05-29  Rainer Orth  r...@cebitec.uni-bielefeld.de

gcc:
* config/alpha/linux.h (MD_UNWIND_SUPPORT): Remove.
* config/alpha/osf5.h (MD_UNWIND_SUPPORT): Remove.
* config/alpha/vms.h (MD_UNWIND_SUPPORT): Remove.
* config/bfin/linux.h (MD_UNWIND_SUPPORT): Remove.
* config/bfin/uclinux.h (MD_UNWIND_SUPPORT): Remove.
* config/i386/linux.h (MD_UNWIND_SUPPORT): Remove.
* config/i386/linux64.h (MD_UNWIND_SUPPORT): Remove.
* config/i386/sol2.h (MD_UNWIND_SUPPORT): Remove.
* config/i386/mingw32.h (MD_UNWIND_SUPPORT): Remove.
* config/ia64/linux.h (MD_UNWIND_SUPPORT): Remove.
* config/ia64/vms.h (MD_UNWIND_SUPPORT): Remove.
* config/m68k/linux.h (MD_UNWIND_SUPPORT): Remove.
* config/mips/linux.h (MD_UNWIND_SUPPORT): Remove.
* config/pa/pa-hpux.h (MD_UNWIND_SUPPORT): Remove.
* config/pa/pa32-linux.h (MD_UNWIND_SUPPORT): Remove.
* config/rs6000/darwin.h (MD_UNWIND_SUPPORT): Remove.
* config/rs6000/linux.h (MD_UNWIND_SUPPORT): Remove.
* config/rs6000/linux64.h (MD_UNWIND_SUPPORT): Remove.
* config/s390/linux.h (MD_UNWIND_SUPPORT): Remove.
* config/s390/tpf.h (MD_UNWIND_SUPPORT): Remove.
* config/sh/linux.h (MD_UNWIND_SUPPORT): Remove.
* config/sparc/linux.h (MD_UNWIND_SUPPORT): Remove.
* config/sparc/linux64.h (MD_UNWIND_SUPPORT): Remove.
* config/sparc/sol2.h (MD_UNWIND_SUPPORT): Remove.
* config/xtensa/linux.h (MD_UNWIND_SUPPORT): Remove.
* config/alpha/linux-unwind.h: Move to ../libgcc/config/alpha.
* config/alpha/osf5-unwind.h: Move to ../libgcc/config/alpha.
* config/alpha/vms-unwind.h: Move to ../libgcc/config/alpha.
* config/bfin/linux-unwind.h: Move to ../libgcc/config/bfin.
* config/i386/linux-unwind.h: Move to ../libgcc/config/i386.
* config/i386/sol2-unwind.h: Move to ../libgcc/config/i386.
* config/i386/w32-unwind.h: Move to ../libgcc/config/i386.
* config/ia64/linux-unwind.h: Move to ../libgcc/config/ia64.
* config/ia64/vms-unwind.h: Move to ../libgcc/config/ia64.
* config/m68k/linux-unwind.h: Move to ../libgcc/config/m68k.
* config/mips/linux-unwind.h: Move to ../libgcc/config/mips.
* config/pa/hpux-unwind.h: Move to ../libgcc/config/pa.
* config/pa/linux-unwind.h: Move to ../libgcc/config/pa.
* config/rs6000/darwin-unwind.h: Move to ../libgcc/config/rs6000.
* config/rs6000/linux-unwind.h: Move to ../libgcc/config/rs6000.
* config/s390/linux-unwind.h: Move to ../libgcc/config/s390.
* config/s390/tpf-unwind.h: Move to ../libgcc/config/s390.
* config/sh/linux-unwind.h: Move to ../libgcc/config/sh.
* config/sparc/linux-unwind.h: Move to ../libgcc/config/sparc.
* config/sparc/sol2-unwind.h: Move to ../libgcc/config/sparc.
* config/xtensa/linux-unwind.h: Move to ../libgcc/config/xtensa.
* system.h (MD_UNWIND_SUPPORT): Poison.
* doc/tm.texi.in (Exception Handling, MD_UNWIND_SUPPORT): Remove.
* doc/tm.texi: Regenerate.
* unwind-dw2.c: Include md-unwind-support.h instead of
MD_UNWIND_SUPPORT.
* config/ia64/unwind-ia64.c: Likewise.
*