public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [build] Move unwinder to toplevel libgcc (v2)
@ 2011-08-03 13:33 Rainer Orth
  2011-08-03 16:07 ` Nick Clifton
                   ` (6 more replies)
  0 siblings, 7 replies; 57+ messages in thread
From: Rainer Orth @ 2011-08-03 13:33 UTC (permalink / raw)
  To: gcc-patches
  Cc: Joseph S. Myers, Paolo Bonzini, Ralf Wildenhues,
	Ian Lance Taylor, Steve Ellcey, Richard Earnshaw,
	Ramana Radhakrishnan, Nick Clifton, Douglas Rupp,
	Tristan Gingold, Mike Stump, Kaz Kojima, David Edelsohn,
	Sterling Augustine, Arnaud Charlet, java-patches, Nicola Pero,
	libstdc++,
	Richard Sandiford

This is the revised/updated version of the patch originally posted at

	[build] Move unwinder to toplevel libgcc
        http://gcc.gnu.org/ml/gcc-patches/2011-06/msg01452.html

and reposted as CFT at

	http://gcc.gnu.org/ml/gcc-patches/2011-07/msg00201.html

It should incorporate all review comments and a few errors I've noticed
during final review have been corrected.

I've received approval for the Darwin bits, Steve successfully tested on
HP-UX/IA64 and Linux/IA64 at least bootstrapped.  VMS/IA64 approval has
been given conditional on the approval of the other IA64 bits.  I've
also received approval for the libjava parts.

Bootstrapped without regressions (together with the next two, to be
resubmitted shortly: fp-bit and soft-fp moves) on
x86_64-unknown-linux-gnu.

i386-pc-solaris2.10, sparc-sun-solaris2.11, alpha-dec-osf5.1b,
mips-sgi-irix6.5 and i386-apple-darwin9.8.0 bootstraps in progress.
powerpc-apple-darwin9.8.0 currently broken (SIGBUS compiling
c-family/c-pretty-print.c and cp/call.c).

How should we proceed with this patch, especially given the quite
moderate comments from most affected target maintainers?

Thanks.
	Rainer


2011-06-12  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	gcc:
	* Makefile.in (UNWIND_H): Remove.
	(LIB2ADDEH, LIB2ADDEHSTATIC, LIB2ADDEHSHARED): Move to
	../libgcc/Makefile.in.
	(LIBUNWIND, SHLIBUNWIND_LINK, SHLIBUNWIND_INSTALL): Likewise.
	(LIBUNWINDDEP): Remove.
	(libgcc-support): Remove LIB2ADDEH, $(srcdir)/emutls.c dependencies.
	(libgcc.mvars): Remove LIB2ADDEH, LIB2ADDEHSTATIC, LIB2ADDEHSHARED,
	LIBUNWIND, SHLIBUNWIND_LINK, SHLIBUNWIND_INSTALL.
	(stmp-int-hdrs): Remove $(UNWIND_H) dependency.
	Don't copy $(UNWIND_H).
	* config.gcc (ia64*-*-linux*): Remove with_system_libunwind
	handling.
	* configure.ac (GCC_CHECK_UNWIND_GETIPINFO): Remove.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* emutls.c, unwind-c.c, unwind-compat.c, unwind-compat.h,
	unwind-dw2-fde-compat.c, unwind-dw2-fde-glibc.c, unwind-dw2-fde.c,
	unwind-dw2-fde.h, unwind-dw2.c, unwind-dw2.h, unwind-generic.h,
	unwind-pe.h, unwind-sjlj.c, unwind.inc: Move to ../libgcc.
	* unwind-dw2-fde-darwin.c: Move to ../libgcc/config.
	* config/arm/libunwind.S, config/arm/pr-support.c,
	config/arm/unwind-arm.c, config/arm/unwind-arm.h: Move to
	../libgcc/config/arm.
	* config/arm/t-bpabi (UNWIND_H, LIB2ADDEH): Remove.
	* config/arm/t-symbian (UNWIND_H, LIB2ADDEH): Remove.
	* config/frv/t-frv ($(T)frvbegin$(objext)): Use
	$(srcdir)/../libgcc to refer to unwind-dw2-fde.h.
	($(T)frvend$(objext)): Likewise.
	* config/ia64/t-glibc (LIB2ADDEH): Remove.
	* config/ia64/t-glibc-libunwind: Move to ../libgcc/config/ia64.
	* config/ia64/fde-glibc.c, config/ia64/fde-vms.c,
	config/ia64/unwind-ia64.c, config/ia64/unwind-ia64.h: Move to
	../libgcc/config/ia64.
	* config/ia64/t-hpux (LIB2ADDEH): Remove.
	* config/ia64/t-ia64 (LIB2ADDEH): Remove.
	* config/ia64/t-vms (LIB2ADDEH): Remove.
	* config/ia64/vms.h (UNW_IVMS_MODE,
	MD_UNW_COMPATIBLE_PERSONALITY_P): Remove.
	* config/picochip/t-picochip (LIB2ADDEH): Remove.
	* config/rs6000/aix.h (R_LR, MD_FROB_UPDATE_CONTEXT): Remove.
	* config/rs6000/t-darwin (LIB2ADDEH): Remove.
	* config/rs6000/darwin-fallback.c: Move to ../libgcc/config/rs6000.
	* config/sh/t-sh ($(T)unwind-dw2-Os-4-200.o): Use
	$(srcdir)/../libgcc to refer to unwinder sources.
	* config/spu/t-spu-elf (LIB2ADDEH): Remove.
	* config/t-darwin (LIB2ADDEH): Remove.
	* config/t-freebsd (LIB2ADDEH): Remove.
	* config/t-libunwind (LIB2ADDEH, LIB2ADDEHSTATIC): Remove.
	* config/t-libunwind-elf: Move to ../libgcc/config.
	* config/t-linux (LIB2ADDEH): Remove.
	* config/t-sol2 (LIB2ADDEH): Remove.
	* config/xtensa/t-xtensa (LIB2ADDEH): Remove.
	* system.h (MD_FROB_UPDATE_CONTEXT): Poison.

	gcc/po:
	* EXCLUDES (unwind-c.c, unwind-dw2-fde-darwin.c)
	(unwind-dw2-fde-glibc.c, unwind-dw2-fde.c, unwind-dw2-fde.h)
	(unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h): Remove.

	libgcc:
	* Makefile.in (LIB2ADDEH, LIB2ADDEHSTATIC, LIB2ADDEHSHARED): New
	variables.
	(LIBUNWIND, SHLIBUNWIND_LINK, SHLIBUNWIND_INSTALL): New variables.
	(LIB2ADDEH, LIB2ADDEHSTATIC, LIB2ADDEHSHARED): Add $(srcdir)/emutls.c.
	(install-unwind_h): New target.
	(all): Depend on it.
	* config.host (unwind_header): New variable.
	(*-*-freebsd*): Set tmake_file to t-eh-dw2-dip.
	(*-*-linux*, frv-*-*linux*, *-*-kfreebsd*-gnu, *-*-knetbsd*-gnu,
	*-*-gnu*): Likewise, also for *-*-kopensolaris*-gnu.
	(*-*-solaris2*): Add t-eh-dw2-dip to tmake_file.
	(arm*-*-linux*): Add arm/t-bpabi for arm*-*-linux-*eabi.
	Set unwind_header.
	(arm*-*-uclinux*): Add arm/t-bpabi for arm*-*-uclinux*eabi.
	Set unwind_header.
	(arm*-*-eabi*, arm*-*-symbianelf*): Add arm/t-bpabi for
	arm*-*-eabi*.
	Add arm/t-symbian to tmake_file for arm*-*-symbianelf*.
	Set unwind_header.
	(ia64*-*-elf*): Add ia64-t/eh-ia64 to tmake_file.
	(ia64*-*-freebsd*): Likewise.
	(ia64*-*-linux*): Add ia64/t-glibc, ia64/t-eh-ia64, t-libunwind to
	tmake_file.
	Add t-libunwind-elf, ia64/t-glibc-libunwind unless
	$with_system_libunwind.
	(ia64*-*-hpux*): Set tmake_file.
	(ia64-hp-*vms*): Add ia64/t-eh-ia64 to tmake_file.
	(picochip-*-*): Set tmake_file.
	(rs6000-ibm-aix4.[3456789]*, powerpc-ibm-aix4.[3456789]*): Set
	md_unwind_header.
	(rs6000-ibm-aix5.1.*, powerpc-ibm-aix5.1.*): Likewise.
	(rs6000-ibm-aix[56789].*, powerpc-ibm-aix[56789].*): Likewise.
	(s390x-ibm-tpf*): Add t-eh-dw2-dip to tmake_file.
	(xtensa*-*-elf*): Set tmake_file.
	(xtensa*-*-linux*): Likewise.
	* configure.ac: Include ../config/unwind_ipinfo.m4.
	Call GCC_CHECK_UNWIND_GETIPINFO.
	Link unwind.h to $unwind_header.
	* configure: Regenerate.
	* emutls.c, unwind-c.c, unwind-compat.c, unwind-compat.h,
	unwind-dw2-fde-compat.c, unwind-dw2-fde-dip.c, unwind-dw2-fde.c,
	unwind-dw2-fde.h, unwind-dw2.c, unwind-dw2.h, unwind-generic.h,
	unwind-pe.h, unwind-sjlj.c, unwind.inc: New files.
	* config/unwind-dw2-fde-darwin.c: New file.
	* config/arm/libunwind.S, config/arm/pr-support.c,
	config/arm/t-bpabi, config/arm/t-symbian, config/arm/unwind-arm.c,
	config/arm/unwind-arm.h,: New files.
	* config/ia64/fde-glibc.c, config/ia64/fde-vms.c,
	config/ia64/t-eh-ia64, config/ia64/t-glibc,
	config/ia64/t-glibc-libunwind, config/ia64/t-hpux,
	config/ia64/t-vms, config/ia64/unwind-ia64.c,
	config/ia64/unwind-ia64.h: New files.
	* config/picochip/t-picochip: New file.
	* config/rs6000/aix-unwind.h, config/rs6000/darwin-fallback.c: New
	files.
	* config/s390/t-tpf (LIB2ADDEH): Remove.
	* config/t-darwin: New file.
	* config/t-eh-dw2-dip: New file.
	* config/t-libunwind, config/t-libunwind-elf: New files.
	* config/t-sol2 (LIB2ADDEH): Remove.
	* config/extensa/t-xtensa: New file.

	gcc/ada:
	* gcc-interface/Makefile.in (raise-gcc.o): Search
	$(srcdir)/../libgcc.

	libgo:
	* Makefile.am (AM_CFLAGS): Search $(srcdir)/../libgcc.
	* Makefile.in: Regenerate.

	libjava:
	* configure.ac (GCC_UNWIND_INCLUDE): Rename to
	LIBGCC_UNWIND_INCLUDE.
	Point to $(multi_basedir)/./libjava/../libgcc.
	* configure: Regenerate.
	* Makefile.am (GCC_UNWIND_INCLUDE): Reflect this.
	* Makefile.in: Regenerate.

	libobjc:
	* Makefile.in (INCLUDES): Search
	$(srcdir)/$(MULTISRCTOP)../libgcc.

	libstdc++-v3:
	* acinclude.m4 (GLIBCXX_EXPORT_INCLUDES): Point TOPLEVEL_INCLUDES
	to $(toplevel_srcdir)/libgcc.
	* configure: Regenerate.

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -377,8 +377,6 @@ USER_H = $(srcdir)/ginclude/float.h \
 USER_H_INC_NEXT_PRE = @user_headers_inc_next_pre@
 USER_H_INC_NEXT_POST = @user_headers_inc_next_post@
 
-UNWIND_H = $(srcdir)/unwind-generic.h
-
 # The GCC to use for compiling crt*.o.
 # Usually the one we just built.
 # Don't use this as a dependency--use $(GCC_PASSES).
@@ -688,18 +686,6 @@ CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(IN
   -fno-stack-protector \
   $(INHIBIT_LIBC_CFLAGS)
 
-# Additional sources to handle exceptions; overridden by targets as needed.
-LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \
-   $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
-LIB2ADDEHSTATIC = $(LIB2ADDEH)
-LIB2ADDEHSHARED = $(LIB2ADDEH)
-
-# Don't build libunwind by default.
-LIBUNWIND =
-LIBUNWINDDEP =
-SHLIBUNWIND_LINK =
-SHLIBUNWIND_INSTALL =
-
 # nm flags to list global symbols in libgcc object files.
 SHLIB_NM_FLAGS = -pg
 
@@ -1894,7 +1880,7 @@ GCC_EXTRA_PARTS := $(sort $(EXTRA_MULTIL
 
 libgcc-support: libgcc.mvars stmp-int-hdrs $(TCONFIG_H) \
 	$(MACHMODE_H) $(FPBIT) $(DPBIT) $(TPBIT) $(LIB2ADD) \
-	$(LIB2ADD_ST) $(LIB2ADDEH) $(srcdir)/emutls.c gcov-iov.h $(SFP_MACHINE)
+	$(LIB2ADD_ST) gcov-iov.h $(SFP_MACHINE)
 
 libgcc.mvars: config.status Makefile $(LIB2ADD) $(LIB2ADD_ST) specs \
 		xgcc$(exeext)
@@ -1905,13 +1891,7 @@ libgcc.mvars: config.status Makefile $(L
 	echo LIB2FUNCS_EXCLUDE = '$(LIB2FUNCS_EXCLUDE)' >> tmp-libgcc.mvars
 	echo LIB2ADD = '$(call srcdirify,$(LIB2ADD))' >> tmp-libgcc.mvars
 	echo LIB2ADD_ST = '$(call srcdirify,$(LIB2ADD_ST))' >> tmp-libgcc.mvars
-	echo LIB2ADDEH = '$(call srcdirify,$(LIB2ADDEH) $(srcdir)/emutls.c)' >> tmp-libgcc.mvars
-	echo LIB2ADDEHSTATIC = '$(call srcdirify,$(LIB2ADDEHSTATIC) $(srcdir)/emutls.c)' >> tmp-libgcc.mvars
-	echo LIB2ADDEHSHARED = '$(call srcdirify,$(LIB2ADDEHSHARED) $(srcdir)/emutls.c)' >> tmp-libgcc.mvars
 	echo LIB2_SIDITI_CONV_FUNCS = '$(LIB2_SIDITI_CONV_FUNCS)' >> tmp-libgcc.mvars
-	echo LIBUNWIND = '$(call srcdirify,$(LIBUNWIND))' >> tmp-libgcc.mvars
-	echo SHLIBUNWIND_LINK = '$(SHLIBUNWIND_LINK)' >> tmp-libgcc.mvars
-	echo SHLIBUNWIND_INSTALL = '$(SHLIBUNWIND_INSTALL)' >> tmp-libgcc.mvars
 	echo FPBIT = '$(FPBIT)' >> tmp-libgcc.mvars
 	echo FPBIT_FUNCS = '$(FPBIT_FUNCS)' >> tmp-libgcc.mvars
 	echo LIB2_DIVMOD_FUNCS = '$(LIB2_DIVMOD_FUNCS)' >> tmp-libgcc.mvars
@@ -4096,7 +4076,7 @@ gcov-dump$(exeext): $(GCOV_DUMP_OBJS) $(
 # be rebuilt.
 
 # Build the include directories.
-stmp-int-hdrs: $(STMP_FIXINC) $(USER_H) $(UNWIND_H) fixinc_list
+stmp-int-hdrs: $(STMP_FIXINC) $(USER_H) fixinc_list
 # Copy in the headers provided with gcc.
 # The sed command gets just the last file name component;
 # this is necessary because VPATH could add a dirname.
@@ -4128,9 +4108,6 @@ stmp-int-hdrs: $(STMP_FIXINC) $(USER_H) 
 	    chmod a+r include/$$file; \
 	  fi; \
 	done
-	rm -f include/unwind.h
-	cp $(UNWIND_H) include/unwind.h
-	chmod a+r include/unwind.h
 	rm -f include/stdint.h
 	if [ $(USE_GCC_STDINT) = wrap ]; then \
 	  rm -f include/stdint-gcc.h; \
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -2796,7 +2796,7 @@ vx_stack_info.o : vx_stack_info.c
 
 raise-gcc.o : raise-gcc.c raise.h
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ADA_CFLAGS) \
-		-iquote $(srcdir) \
+		-iquote $(srcdir)/../libgcc \
 		$(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
 
 cio.o     : cio.c
diff --git a/gcc/config.gcc b/gcc/config.gcc
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1604,9 +1604,6 @@ ia64*-*-freebsd*)
 ia64*-*-linux*)
 	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ia64/sysv4.h ia64/linux.h"
 	tmake_file="${tmake_file} ia64/t-ia64 t-libunwind ia64/t-glibc"
-	if test x$with_system_libunwind != xyes ; then
-		tmake_file="${tmake_file} t-libunwind-elf ia64/t-glibc-libunwind"
-	fi
 	target_cpu_default="MASK_GNU_AS|MASK_GNU_LD"
 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
 	;;
diff --git a/gcc/config/arm/t-bpabi b/gcc/config/arm/t-bpabi
--- a/gcc/config/arm/t-bpabi
+++ b/gcc/config/arm/t-bpabi
@@ -25,11 +25,6 @@ LIB2FUNCS_EXTRA = $(srcdir)/config/arm/b
 
 LIB2FUNCS_STATIC_EXTRA = $(srcdir)/config/arm/fp16.c
 
-UNWIND_H = $(srcdir)/config/arm/unwind-arm.h
-LIB2ADDEH = $(srcdir)/config/arm/unwind-arm.c \
-  $(srcdir)/config/arm/libunwind.S \
-  $(srcdir)/config/arm/pr-support.c $(srcdir)/unwind-c.c
-
 # Add the BPABI names.
 SHLIB_MAPFILES += $(srcdir)/config/arm/libgcc-bpabi.ver
 
diff --git a/gcc/config/arm/t-symbian b/gcc/config/arm/t-symbian
--- a/gcc/config/arm/t-symbian
+++ b/gcc/config/arm/t-symbian
@@ -30,10 +30,6 @@ LIB1ASMFUNCS += \
 	_truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
 	_fixsfsi _fixunssfsi
 
-# Include the gcc personality routine
-UNWIND_H = $(srcdir)/config/arm/unwind-arm.h
-LIB2ADDEH = $(srcdir)/unwind-c.c $(srcdir)/config/arm/pr-support.c
-
 # Include half-float helpers.
 LIB2FUNCS_STATIC_EXTRA = $(srcdir)/config/arm/fp16.c
 
diff --git a/gcc/config/frv/t-frv b/gcc/config/frv/t-frv
--- a/gcc/config/frv/t-frv
+++ b/gcc/config/frv/t-frv
@@ -1,4 +1,4 @@
-# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 2011 Free Software Foundation, Inc.
 #
 # This file is part of GCC.
 #
@@ -81,12 +81,12 @@ EXTRA_MULTILIB_PARTS=frvbegin.o frvend.o
 FRVSTUFF_CFLAGS = $(TARGET_LIBGCC2_CFLAGS)
 
 $(T)frvbegin$(objext): $(srcdir)/config/frv/frvbegin.c $(GCC_PASSES) \
-  $(CONFIG_H) defaults.h unwind-dw2-fde.h gbl-ctors.h
+  $(CONFIG_H) defaults.h $(srcdir)/../libgcc/unwind-dw2-fde.h gbl-ctors.h
 	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) $(FRVSTUFF_CFLAGS) \
 	  -c $(srcdir)/config/frv/frvbegin.c -o $(T)frvbegin$(objext)
 
 $(T)frvend$(objext): $(srcdir)/config/frv/frvend.c $(GCC_PASSES) \
-  $(CONFIG_H) defaults.h unwind-dw2-fde.h gbl-ctors.h
+  $(CONFIG_H) defaults.h $(srcdir)/../libgcc/unwind-dw2-fde.h gbl-ctors.h
 	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) $(FRVSTUFF_CFLAGS) \
 	  -c $(srcdir)/config/frv/frvend.c -o $(T)frvend$(objext)
 
diff --git a/gcc/config/ia64/t-glibc b/gcc/config/ia64/t-glibc
--- a/gcc/config/ia64/t-glibc
+++ b/gcc/config/ia64/t-glibc
@@ -1,5 +1,1 @@
-# Use system libunwind library on IA-64 GLIBC based system.
-LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \
-  $(srcdir)/unwind-compat.c
-
 SHLIB_MAPFILES += $(srcdir)/config/ia64/libgcc-glibc.ver
diff --git a/gcc/config/ia64/t-hpux b/gcc/config/ia64/t-hpux
--- a/gcc/config/ia64/t-hpux
+++ b/gcc/config/ia64/t-hpux
@@ -1,5 +1,5 @@
 # Copyright (C) 2001, 2002, 2003, 2004, 2005,
-# 2006 Free Software Foundation, Inc.
+# 2006, 2011 Free Software Foundation, Inc.
 #
 # This file is part of GCC.
 #
@@ -50,8 +50,6 @@ LIBGCC1_TEST =
 
 T_CFLAGS += -DUSE_LIBUNWIND_EXCEPTIONS
 
-LIB2ADDEH = $(srcdir)/unwind-c.c
-
 SHLIB_EXT = .so
 # Must include -lunwind in the link, so that libgcc_s.so has the necessary
 # DT_NEEDED entry for libunwind.
diff --git a/gcc/config/ia64/t-ia64 b/gcc/config/ia64/t-ia64
--- a/gcc/config/ia64/t-ia64
+++ b/gcc/config/ia64/t-ia64
@@ -43,9 +43,6 @@ SHLIB_MAPFILES += $(srcdir)/config/ia64/
 # Effectively disable the crtbegin/end rules using crtstuff.c
 T = disable
 
-LIB2ADDEH = $(srcdir)/config/ia64/unwind-ia64.c $(srcdir)/unwind-sjlj.c \
-  $(srcdir)/unwind-c.c
-
 ia64-c.o: $(srcdir)/config/ia64/ia64-c.c $(CONFIG_H) $(SYSTEM_H) \
     coretypes.h $(TM_H) $(TREE_H) $(CPPLIB_H) $(C_COMMON_H) $(C_PRAGMA_H)
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
diff --git a/gcc/config/ia64/t-vms b/gcc/config/ia64/t-vms
--- a/gcc/config/ia64/t-vms
+++ b/gcc/config/ia64/t-vms
@@ -32,8 +32,6 @@ CRTSTUFF_T_CFLAGS_S = -O0
 	$(GCC_FOR_TARGET) -I. -c -o $(T)crtinitS.o -x assembler-with-cpp \
 		$(srcdir)/config/ia64/vms-crtinit.asm
 
-LIB2ADDEH += $(srcdir)/config/ia64/fde-vms.c
-
 # Shared library macros
 shlib_version:=$(shell echo $(BASEVER_c) | sed -e 's/\./,/' -e 's/\.//g')
 SHLIB_EXT = .exe
diff --git a/gcc/config/ia64/vms.h b/gcc/config/ia64/vms.h
--- a/gcc/config/ia64/vms.h
+++ b/gcc/config/ia64/vms.h
@@ -139,9 +139,6 @@ STATIC func_ptr __CTOR_LIST__[1]        
 /* Define this to be nonzero if static stack checking is supported.  */
 #define STACK_CHECK_STATIC_BUILTIN 1
 
-#define UNW_IVMS_MODE(HEADER) (((HEADER) >> 44) & 0x3L)
-#define MD_UNW_COMPATIBLE_PERSONALITY_P(HEADER) (!UNW_IVMS_MODE (HEADER))
-
 /* Minimum amount of stack required to recover from an anticipated stack
    overflow detection.  The default value conveys an estimate of the amount
    of stack required to propagate an exception.  */
diff --git a/gcc/config/picochip/t-picochip b/gcc/config/picochip/t-picochip
--- a/gcc/config/picochip/t-picochip
+++ b/gcc/config/picochip/t-picochip
@@ -43,9 +43,6 @@ LIB2FUNCS_EXTRA = \
 LIB1ASMFUNCS = _mulsc3 _divsc3
 LIB1ASMSRC = picochip/libgccExtras/fake_libgcc.asm
 
-# Turn off the building of exception handling libraries.
-LIB2ADDEH =
-
 # Turn off ranlib on target libraries.
 RANLIB_FOR_TARGET = cat
 
diff --git a/gcc/config/rs6000/aix.h b/gcc/config/rs6000/aix.h
--- a/gcc/config/rs6000/aix.h
+++ b/gcc/config/rs6000/aix.h
@@ -209,40 +209,6 @@
 /* And similarly for general purpose registers.  */
 #define GP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 32)
 
-/* If the current unwind info (FS) does not contain explicit info
-   saving R2, then we have to do a minor amount of code reading to
-   figure out if it was saved.  The big problem here is that the
-   code that does the save/restore is generated by the linker, so
-   we have no good way to determine at compile time what to do.  */
-
-#define R_LR 65
-
-#ifdef __64BIT__
-#define MD_FROB_UPDATE_CONTEXT(CTX, FS)					\
-  do {									\
-    if ((FS)->regs.reg[2].how == REG_UNSAVED)				\
-      {									\
-	unsigned int *insn						\
-	  = (unsigned int *)						\
-	    _Unwind_GetGR ((CTX), R_LR);				\
-	if (*insn == 0xE8410028)					\
-	  _Unwind_SetGRPtr ((CTX), 2, (CTX)->cfa + 40);			\
-      }									\
-  } while (0)
-#else
-#define MD_FROB_UPDATE_CONTEXT(CTX, FS)					\
-  do {									\
-    if ((FS)->regs.reg[2].how == REG_UNSAVED)				\
-      {									\
-	unsigned int *insn						\
-	  = (unsigned int *)						\
-	    _Unwind_GetGR ((CTX), R_LR);				\
-	if (*insn == 0x80410014)					\
-	  _Unwind_SetGRPtr ((CTX), 2, (CTX)->cfa + 20);			\
-      }									\
-  } while (0)
-#endif
-
 #define PROFILE_HOOK(LABEL)   output_profile_hook (LABEL)
 
 /* No version of AIX fully supports AltiVec or 64-bit instructions in
diff --git a/gcc/config/rs6000/t-darwin b/gcc/config/rs6000/t-darwin
--- a/gcc/config/rs6000/t-darwin
+++ b/gcc/config/rs6000/t-darwin
@@ -1,5 +1,5 @@
 # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006,
-# 2007 Free Software Foundation, Inc.
+# 2007, 2011 Free Software Foundation, Inc.
 #
 # This file is part of GCC.
 #
@@ -40,7 +40,5 @@ TARGET_LIBGCC2_CFLAGS = -Wa,-force_cpusu
 # Export the _xlq* symbols from darwin-ldouble.c.
 SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-ppc64.ver
 
-LIB2ADDEH += $(srcdir)/config/rs6000/darwin-fallback.c
-
 darwin-fpsave.o:	$(srcdir)/config/rs6000/darwin-asm.h
 darwin-tramp.o:		$(srcdir)/config/rs6000/darwin-asm.h
diff --git a/gcc/config/sh/t-sh b/gcc/config/sh/t-sh
--- a/gcc/config/sh/t-sh
+++ b/gcc/config/sh/t-sh
@@ -1,5 +1,5 @@
 # Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2006, 2008, 2009 Free Software Foundation, Inc.
+# 2003, 2004, 2006, 2008, 2009, 2011 Free Software Foundation, Inc.
 #
 # This file is part of GCC.
 #
@@ -149,7 +149,7 @@ EXTRA_MULTILIB_PARTS= $(IC_EXTRA_PARTS) 
 	$(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $@ -DL_sdivsi3_i4i -x assembler-with-cpp $<
 $(T)udivsi3_i4i-Os-4-200.o: $(srcdir)/config/sh/lib1funcs-Os-4-200.asm $(GCC_PASSES)
 	$(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $@ -DL_udivsi3_i4i -x assembler-with-cpp $<
-$(T)unwind-dw2-Os-4-200.o: $(srcdir)/unwind-dw2.c $(srcdir)/unwind-generic.h unwind-pe.h unwind.inc unwind-dw2-fde.h unwind-dw2.h $(CONFIG_H) coretypes.h $(TM_H) $(MACHMODE_H) longlong.h config.status stmp-int-hdrs tsystem.h $(GCC_PASSES)
+$(T)unwind-dw2-Os-4-200.o: $(srcdir)/../libgcc/unwind-dw2.c $(srcdir)/../libgcc/unwind-generic.h $(srcdir)/../libgcc/unwind-pe.h $(srcdir)/../libgcc/unwind.inc $(srcdir)/../libgcc/unwind-dw2-fde.h $(srcdir)/../libgcc/unwind-dw2.h $(CONFIG_H) coretypes.h $(TM_H) $(MACHMODE_H) longlong.h config.status stmp-int-hdrs tsystem.h $(GCC_PASSES)
 	$(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) $(LIBGCC2_CFLAGS) $(INCLUDES) $(vis_hide) -fexceptions -Os -c -o $@ $<
 OBJS_Os_4_200=$(T)sdivsi3_i4i-Os-4-200.o $(T)udivsi3_i4i-Os-4-200.o $(T)unwind-dw2-Os-4-200.o
 $(T)libgcc-Os-4-200.a: $(OBJS_Os_4_200) $(GCC_PASSES)
diff --git a/gcc/config/spu/t-spu-elf b/gcc/config/spu/t-spu-elf
--- a/gcc/config/spu/t-spu-elf
+++ b/gcc/config/spu/t-spu-elf
@@ -47,9 +47,6 @@ LIB2FUNCS_STATIC_EXTRA = $(srcdir)/confi
 			 $(srcdir)/config/spu/divmodti4.c \
 			 $(srcdir)/config/spu/divv2df3.c
 
-LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \
-   $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
-
 # We want fine grained libraries, so use the new code to build the
 # floating point emulation libraries.
 FPBIT = fp-bit.c
diff --git a/gcc/config/t-darwin b/gcc/config/t-darwin
--- a/gcc/config/t-darwin
+++ b/gcc/config/t-darwin
@@ -42,10 +42,6 @@ darwin-driver.o: $(srcdir)/config/darwin
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
 	  $(srcdir)/config/darwin-driver.c
 
-# Use unwind-dw2-fde-darwin
-LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde-darwin.c \
-  $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
-
 # -pipe because there's an assembler bug, 4077127, which causes
 # it to not properly process the first # directive, causing temporary
 # file names to appear in stabs, causing the bootstrap to fail.  Using -pipe
diff --git a/gcc/config/t-freebsd b/gcc/config/t-freebsd
--- a/gcc/config/t-freebsd
+++ b/gcc/config/t-freebsd
@@ -3,7 +3,3 @@ CRTSTUFF_T_CFLAGS_S = $(CRTSTUFF_T_CFLAG
 
 # Compile libgcc.a with pic.
 TARGET_LIBGCC2_CFLAGS += -fPIC
-
-# Use unwind-dw2-fde-glibc
-LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde-glibc.c \
-  $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
diff --git a/gcc/config/t-libunwind b/gcc/config/t-libunwind
--- a/gcc/config/t-libunwind
+++ b/gcc/config/t-libunwind
@@ -1,4 +1,4 @@
-# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 2011 Free Software Foundation, Inc.
 #
 # This file is part of GCC.
 #
@@ -22,9 +22,6 @@
 # so that the resulting libgcc_s.so has the necessary DT_NEEDED entry for
 # libunwind.
 SHLIB_LC = -lunwind -lc
-LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \
-  $(srcdir)/unwind-compat.c $(srcdir)/unwind-dw2-fde-compat.c
-LIB2ADDEHSTATIC = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
 
 T_CFLAGS += -DUSE_LIBUNWIND_EXCEPTIONS
 TARGET_LIBGCC2_CFLAGS += -DUSE_GAS_SYMVER
diff --git a/gcc/config/t-linux b/gcc/config/t-linux
--- a/gcc/config/t-linux
+++ b/gcc/config/t-linux
@@ -25,7 +25,3 @@ TARGET_LIBGCC2_CFLAGS = -fPIC
 # Override t-slibgcc-elf-ver to export some libgcc symbols with
 # the symbol versions that glibc used.
 SHLIB_MAPFILES += $(srcdir)/config/libgcc-glibc.ver
-
-# Use unwind-dw2-fde-glibc
-LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde-glibc.c \
-  $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
diff --git a/gcc/config/t-sol2 b/gcc/config/t-sol2
--- a/gcc/config/t-sol2
+++ b/gcc/config/t-sol2
@@ -31,8 +31,3 @@ sol2.o: $(srcdir)/config/sol2.c $(CONFIG
 
 # This is required by gcc/ada/gcc-interface/Makefile.in.
 TARGET_LIBGCC2_CFLAGS = -fPIC
-
-# Use unwind-dw2-fde-glibc.c.  Unless linker support and dl_iterate_phdr
-# are present, automatically falls back to unwind-dw2-fde.c.
-LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde-glibc.c \
-  $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
diff --git a/gcc/config/xtensa/t-xtensa b/gcc/config/xtensa/t-xtensa
--- a/gcc/config/xtensa/t-xtensa
+++ b/gcc/config/xtensa/t-xtensa
@@ -1,4 +1,5 @@
-# Copyright (C) 2002, 2003, 2006, 2007, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2006, 2007, 2008, 2011
+# Free Software Foundation, Inc.
 #
 # This file is part of GCC.
 #
@@ -29,8 +30,6 @@ LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3 _
 	_truncdfsf2 _extendsfdf2
 
 LIB2FUNCS_EXTRA = $(srcdir)/config/xtensa/lib2funcs.S
-LIB2ADDEH = $(srcdir)/config/xtensa/unwind-dw2-xtensa.c \
-   $(srcdir)/unwind-dw2-fde.c $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
 
 $(T)crti.o: $(srcdir)/config/xtensa/crti.asm $(GCC_PASSES)
 	$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \
diff --git a/gcc/configure.ac b/gcc/configure.ac
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1192,11 +1192,6 @@ if test $force_sjlj_exceptions = yes; th
     [Define 0/1 to force the choice for exception handling model.])
 fi
 
-# For platforms with the unwind ABI which includes an unwind library,
-# libunwind, we can choose to use the system libunwind.
-# config.gcc also contains tests of with_system_libunwind.
-GCC_CHECK_UNWIND_GETIPINFO
-
 # --------------------------------------------------------
 # Build, host, and target specific configuration fragments
 # --------------------------------------------------------
diff --git a/gcc/po/EXCLUDES b/gcc/po/EXCLUDES
--- a/gcc/po/EXCLUDES
+++ b/gcc/po/EXCLUDES
@@ -44,15 +44,6 @@ libgcc2.h
 limitx.h
 limity.h
 longlong.h
-unwind-c.c
-unwind-dw2-fde-darwin.c
-unwind-dw2-fde-glibc.c
-unwind-dw2-fde.c
-unwind-dw2-fde.h
-unwind-dw2.c
-unwind-pe.h
-unwind-sjlj.c
-unwind.h
 
 #   These programs are meant to be executed only by GCC maintainers or
 #   installers.  Such files do not need to be translated, as these
diff --git a/gcc/system.h b/gcc/system.h
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -802,7 +802,7 @@ extern void fancy_abort (const char *, i
 /* Target macros only used for code built for the target, that have
    moved to libgcc-tm.h or have never been present elsewhere.  */
  #pragma GCC poison DECLARE_LIBRARY_RENAMES LIBGCC2_GNU_PREFIX		\
-	MD_UNWIND_SUPPORT ENABLE_EXECUTE_STACK
+	MD_UNWIND_SUPPORT MD_FROB_UPDATE_CONTEXT ENABLE_EXECUTE_STACK
 
 /* Other obsolete target macros, or macros that used to be in target
    headers and were not used, and may be obsolete or may never have
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -256,6 +256,17 @@ LIBGCC_VER_GNU_PREFIX = __
 LIBGCC_VER_FIXEDPOINT_GNU_PREFIX = __
 LIBGCC_VER_SYMBOLS_PREFIX =
 
+# Additional sources to handle exceptions; overridden by targets as needed.
+LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \
+  $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
+LIB2ADDEHSTATIC = $(LIB2ADDEH)
+LIB2ADDEHSHARED = $(LIB2ADDEH)
+
+# Don't build libunwind by default.
+LIBUNWIND =
+SHLIBUNWIND_LINK =
+SHLIBUNWIND_INSTALL =
+
 tmake_file = @tmake_file@
 include $(srcdir)/empty.mk $(tmake_file)
 
@@ -316,6 +327,10 @@ endif
 
 LIB2ADD += enable-execute-stack.c
 
+LIB2ADDEH += $(srcdir)/emutls.c
+LIB2ADDEHSTATIC += $(srcdir)/emutls.c
+LIB2ADDEHSHARED += $(srcdir)/emutls.c
+
 # Library members defined in libgcc2.c.
 lib2funcs = _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 _cmpdi2 _ucmpdi2	   \
 	    _clear_cache _trampoline __main _absvsi2 \
@@ -967,6 +982,12 @@ gcc-extra-parts:
 
 all: $(extra-parts)
 
+install-unwind_h:
+	cp unwind.h $(gcc_objdir)/include/unwind.h
+	chmod a+r $(gcc_objdir)/include/unwind.h
+
+all: install-unwind_h
+
 # Documentation targets (empty).
 .PHONY: info html dvi pdf install-info install-html install-pdf
 
diff --git a/libgcc/config.host b/libgcc/config.host
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -57,12 +57,15 @@
 #  tmake_file		A list of machine-description-specific
 #			makefile-fragments, if different from
 #			"$cpu_type/t-$cpu_type".
+#  unwind_header	The name of the header file declaring the unwind
+#			runtime interface routines.
 
 asm_hidden_op=.hidden
 enable_execute_stack=
 extra_parts=
 tmake_file=
 md_unwind_header=no-unwind.h
+unwind_header=unwind-generic.h
 
 # Set default cpu_type so it can be updated in each machine entry.
 cpu_type=`echo ${host} | sed 's/-.*$//'`
@@ -171,8 +174,10 @@ case ${host} in
   # This is the generic ELF configuration of FreeBSD.  Later
   # machine-specific sections may refine and add to this
   # configuration.
+  tmake_file=t-eh-dw2-dip
   ;;
-*-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu*)
+*-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu)
+  tmake_file=t-eh-dw2-dip
   extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
   ;;
 *-*-netbsd*)
@@ -182,7 +187,9 @@ case ${host} in
 *-*-rtems*)
   ;;
 *-*-solaris2*)
-  tmake_file="$tmake_file t-sol2 t-slibgcc t-slibgcc-elf-ver"
+  # Unless linker support and dl_iterate_phdr are present,
+  # unwind-dw2-fde-dip.c automatically falls back to unwind-dw2-fde.c.
+  tmake_file="$tmake_file t-sol2 t-eh-dw2-dip t-slibgcc t-slibgcc-elf-ver"
   if test $with_gnu_ld = yes; then
     tmake_file="$tmake_file t-slibgcc-gld"
   else
@@ -265,14 +272,35 @@ arm*-*-netbsdelf*)
 	;;
 arm*-*-linux*)			# ARM GNU/Linux with ELF
 	tmake_file="${tmake_file} t-fixedpoint-gnu-prefix"
+	case ${host} in
+	arm*-*-linux-*eabi)
+	  tmake_file="${tmake_file} arm/t-bpabi"
+	  unwind_header=config/arm/unwind-arm.h
+	  ;;
+	esac
 	;;
 arm*-*-uclinux*)		# ARM ucLinux
 	tmake_file="${tmake_file} t-fixedpoint-gnu-prefix"
+	case ${host} in
+	arm*-*-uclinux*eabi)
+	  tmake_file="${tmake_file} arm/t-bpabi"
+	  unwind_header=config/arm/unwind-arm.h
+	  ;;
+	esac
 	;;
 arm*-*-ecos-elf)
 	;;
 arm*-*-eabi* | arm*-*-symbianelf* )
 	tmake_file="${tmake_file} t-fixedpoint-gnu-prefix"
+	case ${host} in
+	arm*-*-eabi*)
+	  tmake_file="${tmake_file} arm/t-bpabi"
+	  ;;
+	arm*-*-symbianelf*)
+	  tmake_file="${tmake_file} arm/t-symbian"
+	  ;;
+	esac
+	unwind_header=config/arm/unwind-arm.h
 	;;
 arm*-*-rtems*)
 	;;
@@ -408,21 +436,25 @@ i[34567]86-*-interix3*)
 	;;
 ia64*-*-elf*)
 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
-	tmake_file="ia64/t-ia64 t-crtfm"
+	tmake_file="ia64/t-ia64 ia64/t-eh-ia64 t-crtfm"
 	;;
 ia64*-*-freebsd*)
 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
-	tmake_file="ia64/t-ia64 t-crtfm"
+	tmake_file="ia64/t-ia64 ia64/t-eh-ia64 t-crtfm"
 	;;
 ia64*-*-linux*)
 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
-	tmake_file="ia64/t-ia64 t-crtfm t-softfp ia64/t-fprules-softfp ia64/t-softfp-compat"
+	tmake_file="ia64/t-ia64 t-crtfm t-softfp ia64/t-fprules-softfp ia64/t-softfp-compat ia64/t-glibc ia64/t-eh-ia64 t-libunwind"
+	if test x$with_system_libunwind != xyes ; then
+		tmake_file="${tmake_file} t-libunwind-elf ia64/t-glibc-libunwind"
+	fi
 	md_unwind_header=ia64/linux-unwind.h
 	;;
 ia64*-*-hpux*)
+	tmake_file="ia64/t-hpux"
 	;;
 ia64-hp-*vms*)
-	tmake_file="vms/t-vms vms/t-vms64 ia64/t-vms"
+	tmake_file="vms/t-vms vms/t-vms64 ia64/t-eh-ia64 ia64/t-vms"
 	md_unwind_header=ia64/vms-unwind.h
 	;;
 iq2000*-*-elf*)
@@ -522,6 +554,7 @@ moxie-*-*)
 pdp11-*-*)
 	;;
 picochip-*-*)
+	tmake_file=picochip/t-picochip
         ;;
 powerpc-*-darwin*)
 	case ${host} in
@@ -574,10 +607,13 @@ powerpcle-*-eabisim*)
 powerpcle-*-eabi*)
 	;;
 rs6000-ibm-aix4.[3456789]* | powerpc-ibm-aix4.[3456789]*)
+	md_unwind_header=rs6000/aix-unwind.h
 	;;
 rs6000-ibm-aix5.1.* | powerpc-ibm-aix5.1.*)
+	md_unwind_header=rs6000/aix-unwind.h
 	;;
 rs6000-ibm-aix[56789].* | powerpc-ibm-aix[56789].*)
+	md_unwind_header=rs6000/aix-unwind.h
 	;;
 rx-*-elf)
 	extra_parts="crtbegin.o crtend.o"
@@ -592,7 +628,7 @@ s390x-*-linux*)
 	md_unwind_header=s390/linux-unwind.h
 	;;
 s390x-ibm-tpf*)
-	tmake_file="${tmake_file} s390/t-crtstuff s390/t-tpf"
+	tmake_file="${tmake_file} s390/t-crtstuff s390/t-tpf t-eh-dw2-dip"
 	md_unwind_header=s390/tpf-unwind.h
 	;;
 score-*-elf)
@@ -674,8 +710,10 @@ vax-*-openbsd*)
 xstormy16-*-elf)
 	;;
 xtensa*-*-elf*)
+	tmake_file=xtensa/t-xtensa
 	;;
 xtensa*-*-linux*)
+	tmake_file=xtensa/t-xtensa
 	md_unwind_header=xtensa/linux-unwind.h
 	;;
 am33_2.0-*-linux*)
diff --git a/gcc/config/arm/libunwind.S b/libgcc/config/arm/libunwind.S
rename from gcc/config/arm/libunwind.S
rename to libgcc/config/arm/libunwind.S
--- a/gcc/config/arm/libunwind.S
+++ b/libgcc/config/arm/libunwind.S
@@ -1,5 +1,5 @@
 /* Support functions for the unwinder.
-   Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010
+   Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
    Free Software Foundation, Inc.
    Contributed by Paul Brook
 
@@ -40,7 +40,7 @@
 
 #ifndef __symbian__
 
-#include "lib1funcs.asm"
+#include "config/arm/lib1funcs.asm"
 
 .macro UNPREFIX name
 	.global SYM (\name)
diff --git a/gcc/config/arm/pr-support.c b/libgcc/config/arm/pr-support.c
rename from gcc/config/arm/pr-support.c
rename to libgcc/config/arm/pr-support.c
diff --git a/libgcc/config/arm/t-bpabi b/libgcc/config/arm/t-bpabi
new file mode 100644
--- /dev/null
+++ b/libgcc/config/arm/t-bpabi
@@ -0,0 +1,3 @@
+LIB2ADDEH = $(srcdir)/config/arm/unwind-arm.c \
+  $(srcdir)/config/arm/libunwind.S \
+  $(srcdir)/config/arm/pr-support.c $(srcdir)/unwind-c.c
diff --git a/libgcc/config/arm/t-symbian b/libgcc/config/arm/t-symbian
new file mode 100644
--- /dev/null
+++ b/libgcc/config/arm/t-symbian
@@ -0,0 +1,2 @@
+# Include the gcc personality routine
+LIB2ADDEH = $(srcdir)/unwind-c.c $(srcdir)/config/arm/pr-support.c
diff --git a/gcc/config/arm/unwind-arm.c b/libgcc/config/arm/unwind-arm.c
rename from gcc/config/arm/unwind-arm.c
rename to libgcc/config/arm/unwind-arm.c
diff --git a/gcc/config/arm/unwind-arm.h b/libgcc/config/arm/unwind-arm.h
rename from gcc/config/arm/unwind-arm.h
rename to libgcc/config/arm/unwind-arm.h
diff --git a/gcc/config/ia64/fde-glibc.c b/libgcc/config/ia64/fde-glibc.c
rename from gcc/config/ia64/fde-glibc.c
rename to libgcc/config/ia64/fde-glibc.c
diff --git a/gcc/config/ia64/fde-vms.c b/libgcc/config/ia64/fde-vms.c
rename from gcc/config/ia64/fde-vms.c
rename to libgcc/config/ia64/fde-vms.c
--- a/gcc/config/ia64/fde-vms.c
+++ b/libgcc/config/ia64/fde-vms.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2009, 2011 Free Software Foundation, Inc.
    Contributed by Douglas B Rupp <rupp@gnat.com>
 
    This file is part of GCC.
@@ -32,6 +32,7 @@
 #include <stddef.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include "md-unwind-support.h"
 #include "unwind-ia64.h"
 
 #define __int64 long
diff --git a/libgcc/config/ia64/t-eh-ia64 b/libgcc/config/ia64/t-eh-ia64
new file mode 100644
--- /dev/null
+++ b/libgcc/config/ia64/t-eh-ia64
@@ -0,0 +1,2 @@
+LIB2ADDEH = $(srcdir)/config/ia64/unwind-ia64.c $(srcdir)/unwind-sjlj.c \
+  $(srcdir)/unwind-c.c
diff --git a/libgcc/config/ia64/t-glibc b/libgcc/config/ia64/t-glibc
new file mode 100644
--- /dev/null
+++ b/libgcc/config/ia64/t-glibc
@@ -0,0 +1,3 @@
+# Use system libunwind library on IA-64 GLIBC based system.
+LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \
+  $(srcdir)/unwind-compat.c
diff --git a/gcc/config/ia64/t-glibc-libunwind b/libgcc/config/ia64/t-glibc-libunwind
rename from gcc/config/ia64/t-glibc-libunwind
rename to libgcc/config/ia64/t-glibc-libunwind
--- a/gcc/config/ia64/t-glibc-libunwind
+++ b/libgcc/config/ia64/t-glibc-libunwind
@@ -1,4 +1,3 @@
 # Build libunwind for IA-64 GLIBC based system.
 LIBUNWIND = $(srcdir)/config/ia64/fde-glibc.c \
   $(srcdir)/config/ia64/unwind-ia64.c
-LIBUNWINDDEP = unwind.inc
diff --git a/libgcc/config/ia64/t-hpux b/libgcc/config/ia64/t-hpux
new file mode 100644
--- /dev/null
+++ b/libgcc/config/ia64/t-hpux
@@ -0,0 +1,1 @@
+LIB2ADDEH = $(srcdir)/unwind-c.c
diff --git a/libgcc/config/ia64/t-vms b/libgcc/config/ia64/t-vms
new file mode 100644
--- /dev/null
+++ b/libgcc/config/ia64/t-vms
@@ -0,0 +1,1 @@
+LIB2ADDEH += $(srcdir)/config/ia64/fde-vms.c
diff --git a/gcc/config/ia64/unwind-ia64.c b/libgcc/config/ia64/unwind-ia64.c
rename from gcc/config/ia64/unwind-ia64.c
rename to libgcc/config/ia64/unwind-ia64.c
--- a/gcc/config/ia64/unwind-ia64.c
+++ b/libgcc/config/ia64/unwind-ia64.c
@@ -41,13 +41,6 @@
 
 #ifndef __USING_SJLJ_EXCEPTIONS__
 
-
-/* By default, assume personality routine interface compatibility with
-   our expectations.  */
-#ifndef MD_UNW_COMPATIBLE_PERSONALITY_P
-#define MD_UNW_COMPATIBLE_PERSONALITY_P(HEADER) 1
-#endif
-
 enum unw_application_register
 {
   UNW_AR_BSP,
@@ -1768,6 +1761,13 @@ _Unwind_GetBSP (struct _Unwind_Context *
 }
 
 #include "md-unwind-support.h"
+
+/* By default, assume personality routine interface compatibility with
+   our expectations.  */
+#ifndef MD_UNW_COMPATIBLE_PERSONALITY_P
+#define MD_UNW_COMPATIBLE_PERSONALITY_P(HEADER) 1
+#endif
+
 \f
 static _Unwind_Reason_Code
 uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs)
diff --git a/gcc/config/ia64/unwind-ia64.h b/libgcc/config/ia64/unwind-ia64.h
rename from gcc/config/ia64/unwind-ia64.h
rename to libgcc/config/ia64/unwind-ia64.h
diff --git a/libgcc/config/ia64/vms-unwind.h b/libgcc/config/ia64/vms-unwind.h
--- a/libgcc/config/ia64/vms-unwind.h
+++ b/libgcc/config/ia64/vms-unwind.h
@@ -1,5 +1,5 @@
 /* DWARF2 EH unwinding support for IA64 VMS.
-   Copyright (C) 2005-2009 Free Software Foundation, Inc.
+   Copyright (C) 2005-2011 Free Software Foundation, Inc.
 
    This file is part of GCC.
 
@@ -32,6 +32,9 @@
 #include <stdio.h>
 #include <string.h>
 
+#define UNW_IVMS_MODE(HEADER) (((HEADER) >> 44) & 0x3L)
+#define MD_UNW_COMPATIBLE_PERSONALITY_P(HEADER) (!UNW_IVMS_MODE (HEADER))
+
 #define DYN$C_SSENTRY 66
 /* ??? would rather get the proper header file.  */
 
diff --git a/libgcc/config/picochip/t-picochip b/libgcc/config/picochip/t-picochip
new file mode 100644
--- /dev/null
+++ b/libgcc/config/picochip/t-picochip
@@ -0,0 +1,2 @@
+# Turn off the building of exception handling libraries.
+LIB2ADDEH =
diff --git a/libgcc/config/rs6000/aix-unwind.h b/libgcc/config/rs6000/aix-unwind.h
new file mode 100644
--- /dev/null
+++ b/libgcc/config/rs6000/aix-unwind.h
@@ -0,0 +1,57 @@
+/* DWARF2 EH unwinding support for AIX.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+
+   This file is part of GCC.
+
+   GCC is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   GCC is distributed in the hope that it will be useful, but WITHOUT
+   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+   License for more details.
+
+   Under Section 7 of GPL version 3, you are granted additional
+   permissions described in the GCC Runtime Library Exception, version
+   3.1, as published by the Free Software Foundation.
+
+   You should have received a copy of the GNU General Public License and
+   a copy of the GCC Runtime Library Exception along with this program;
+   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* If the current unwind info (FS) does not contain explicit info
+   saving R2, then we have to do a minor amount of code reading to
+   figure out if it was saved.  The big problem here is that the
+   code that does the save/restore is generated by the linker, so
+   we have no good way to determine at compile time what to do.  */
+
+#define R_LR 65
+
+#ifdef __64BIT__
+#define MD_FROB_UPDATE_CONTEXT(CTX, FS)					\
+  do {									\
+    if ((FS)->regs.reg[2].how == REG_UNSAVED)				\
+      {									\
+	unsigned int *insn						\
+	  = (unsigned int *)						\
+	    _Unwind_GetGR ((CTX), R_LR);				\
+	if (*insn == 0xE8410028)					\
+	  _Unwind_SetGRPtr ((CTX), 2, (CTX)->cfa + 40);			\
+      }									\
+  } while (0)
+#else
+#define MD_FROB_UPDATE_CONTEXT(CTX, FS)					\
+  do {									\
+    if ((FS)->regs.reg[2].how == REG_UNSAVED)				\
+      {									\
+	unsigned int *insn						\
+	  = (unsigned int *)						\
+	    _Unwind_GetGR ((CTX), R_LR);				\
+	if (*insn == 0x80410014)					\
+	  _Unwind_SetGRPtr ((CTX), 2, (CTX)->cfa + 20);			\
+      }									\
+  } while (0)
+#endif
diff --git a/gcc/config/rs6000/darwin-fallback.c b/libgcc/config/rs6000/darwin-fallback.c
rename from gcc/config/rs6000/darwin-fallback.c
rename to libgcc/config/rs6000/darwin-fallback.c
diff --git a/libgcc/config/rs6000/t-darwin b/libgcc/config/rs6000/t-darwin
--- a/libgcc/config/rs6000/t-darwin
+++ b/libgcc/config/rs6000/t-darwin
@@ -3,4 +3,6 @@ DARWIN_EXTRA_CRT_BUILD_CFLAGS = -mlongca
 crt2.o: $(srcdir)/config/rs6000/darwin-crt2.c
 	$(crt_compile) $(DARWIN_EXTRA_CRT_BUILD_CFLAGS) -c $<
 
+LIB2ADDEH += $(srcdir)/config/rs6000/darwin-fallback.c
+
 SHLIB_VERPFX = $(gcc_srcdir)/config/rs6000/darwin-libgcc
diff --git a/libgcc/config/s390/t-tpf b/libgcc/config/s390/t-tpf
--- a/libgcc/config/s390/t-tpf
+++ b/libgcc/config/s390/t-tpf
@@ -1,7 +1,2 @@
 # Compile libgcc2.a with pic.
 HOST_LIBGCC2_CFLAGS += -fPIC
-
-# Use unwind-dw2-fde-glibc.
-LIB2ADDEH = $(gcc_srcdir)/unwind-dw2.c $(gcc_srcdir)/unwind-dw2-fde-glibc.c \
-  $(gcc_srcdir)/unwind-sjlj.c $(gcc_srcdir)/unwind-c.c \
-  $(gcc_srcdir)/emutls.c
diff --git a/libgcc/config/t-darwin b/libgcc/config/t-darwin
--- a/libgcc/config/t-darwin
+++ b/libgcc/config/t-darwin
@@ -2,3 +2,7 @@
 crt3.o: $(srcdir)/config/darwin-crt3.c
 	$(crt_compile) \
 	  -fno-tree-dominator-opts $(DARWIN_EXTRA_CRT_BUILD_CFLAGS) -c $<
+
+# Use unwind-dw2-fde-darwin
+LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/config/unwind-dw2-fde-darwin.c \
+  $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
diff --git a/libgcc/config/t-eh-dw2-dip b/libgcc/config/t-eh-dw2-dip
new file mode 100644
--- /dev/null
+++ b/libgcc/config/t-eh-dw2-dip
@@ -0,0 +1,3 @@
+# Use unwind-dw2-fde-dip.
+LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde-dip.c \
+  $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
diff --git a/libgcc/config/t-libunwind b/libgcc/config/t-libunwind
new file mode 100644
--- /dev/null
+++ b/libgcc/config/t-libunwind
@@ -0,0 +1,3 @@
+LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \
+  $(srcdir)/unwind-compat.c $(srcdir)/unwind-dw2-fde-compat.c
+LIB2ADDEHSTATIC = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
diff --git a/gcc/config/t-libunwind-elf b/libgcc/config/t-libunwind-elf
rename from gcc/config/t-libunwind-elf
rename to libgcc/config/t-libunwind-elf
--- a/gcc/config/t-libunwind-elf
+++ b/libgcc/config/t-libunwind-elf
@@ -1,4 +1,4 @@
-# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2005, 2011 Free Software Foundation, Inc.
 #
 # This file is part of GCC.
 #
@@ -18,14 +18,18 @@
 
 # Build libunwind for ELF with the GNU linker.
 
-# Use unwind-dw2-fde-glibc
-LIBUNWIND = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde-glibc.c
-LIBUNWINDDEP = unwind.inc unwind-dw2-fde.h unwind-dw2-fde.c
+SHLIB_SOLINK = @shlib_base_name@.so
+SHLIB_OBJS = @shlib_objs@
+SHLIB_DIR = @multilib_dir@
+SHLIB_SLIBDIR_QUAL = @shlib_slibdir_qual@
+
+# Use unwind-dw2-fde-dip
+LIBUNWIND = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde-dip.c
 
 SHLIBUNWIND_SOVERSION = 7
 SHLIBUNWIND_SONAME = @shlib_base_name@.so.$(SHLIBUNWIND_SOVERSION)
 
-SHLIBUNWIND_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared \
+SHLIBUNWIND_LINK = $(CC) $(LIBGCC2_CFLAGS) -shared \
 	-nodefaultlibs -Wl,-h,$(SHLIBUNWIND_SONAME) \
 	-Wl,-z,text -Wl,-z,defs -o $(SHLIB_DIR)/$(SHLIBUNWIND_SONAME).tmp \
 	@multilib_flags@ $(SHLIB_OBJS) -lc && \
@@ -38,12 +42,10 @@ SHLIBUNWIND_LINK = $(GCC_FOR_TARGET) $(L
 	   $(SHLIB_DIR)/$(SHLIBUNWIND_SONAME) && \
 	$(LN_S) $(SHLIBUNWIND_SONAME) $(SHLIB_DIR)/$(SHLIB_SOLINK)
 
-# $(slibdir) double quoted to protect it from expansion while building
-# libgcc.mk.  We want this delayed until actual install time.
 SHLIBUNWIND_INSTALL = \
-	$$(SHELL) $$(srcdir)/mkinstalldirs $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL); \
+	$(SHELL) $(srcdir)/mkinstalldirs $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL); \
 	$(INSTALL_DATA) $(SHLIB_DIR)/$(SHLIBUNWIND_SONAME) \
-	  $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIBUNWIND_SONAME); \
-	rm -f $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK); \
+	  $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIBUNWIND_SONAME); \
+	rm -f $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK); \
 	$(LN_S) $(SHLIBUNWIND_SONAME) \
-	  $$(DESTDIR)$$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK)
+	  $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK)
diff --git a/libgcc/config/t-sol2 b/libgcc/config/t-sol2
--- a/libgcc/config/t-sol2
+++ b/libgcc/config/t-sol2
@@ -16,11 +16,6 @@
 # along with GCC; see the file COPYING3.  If not see
 # <http://www.gnu.org/licenses/>.
 
-# Use unwind-dw2-fde-glibc.c.  Unless linker support and dl_iterate_phdr
-# are present, automatically falls back to unwind-dw2-fde.c.
-LIB2ADDEH = $(gcc_srcdir)/unwind-dw2.c $(gcc_srcdir)/unwind-dw2-fde-glibc.c \
-  $(gcc_srcdir)/unwind-sjlj.c $(gcc_srcdir)/unwind-c.c $(gcc_srcdir)/emutls.c
-
 # gmon build rule:
 gmon.o:	$(srcdir)/config/gmon-sol2.c
 	$(gcc_compile) -c $<
diff --git a/gcc/unwind-dw2-fde-darwin.c b/libgcc/config/unwind-dw2-fde-darwin.c
rename from gcc/unwind-dw2-fde-darwin.c
rename to libgcc/config/unwind-dw2-fde-darwin.c
diff --git a/libgcc/config/xtensa/t-xtensa b/libgcc/config/xtensa/t-xtensa
new file mode 100644
--- /dev/null
+++ b/libgcc/config/xtensa/t-xtensa
@@ -0,0 +1,2 @@
+LIB2ADDEH = $(srcdir)/config/xtensa/unwind-dw2-xtensa.c \
+   $(srcdir)/unwind-dw2-fde.c $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
diff --git a/gcc/config/xtensa/unwind-dw2-xtensa.c b/libgcc/config/xtensa/unwind-dw2-xtensa.c
rename from gcc/config/xtensa/unwind-dw2-xtensa.c
rename to libgcc/config/xtensa/unwind-dw2-xtensa.c
diff --git a/gcc/config/xtensa/unwind-dw2-xtensa.h b/libgcc/config/xtensa/unwind-dw2-xtensa.h
rename from gcc/config/xtensa/unwind-dw2-xtensa.h
rename to libgcc/config/xtensa/unwind-dw2-xtensa.h
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -7,6 +7,7 @@ sinclude(../config/no-executables.m4)
 sinclude(../config/lib-ld.m4)
 sinclude(../config/override.m4)
 sinclude(../config/dfp.m4)
+sinclude(../config/unwind_ipinfo.m4)
 
 AC_PREREQ(2.64)
 AC_INIT([GNU C Runtime Library], 1.0,,[libgcc])
@@ -167,6 +168,11 @@ AC_CACHE_CHECK([whether fixed-point is s
 fixed_point=$libgcc_cv_fixed_point
 AC_SUBST(fixed_point)
 
+# For platforms with the unwind ABI which includes an unwind library,
+# libunwind, we can choose to use the system libunwind.
+# config.gcc also contains tests of with_system_libunwind.
+GCC_CHECK_UNWIND_GETIPINFO
+
 AC_LIB_PROG_LD_GNU
 
 AC_MSG_CHECKING([for thread model used by GCC])
@@ -277,6 +283,7 @@ AC_SUBST(cpu_type)
 AC_SUBST(extra_parts)
 AC_SUBST(asm_hidden_op)
 AC_CONFIG_LINKS([enable-execute-stack.c:$enable_execute_stack])
+AC_CONFIG_LINKS([unwind.h:$unwind_header])
 AC_CONFIG_LINKS([md-unwind-support.h:config/$md_unwind_header])
 
 # We need multilib support.
diff --git a/gcc/emutls.c b/libgcc/emutls.c
rename from gcc/emutls.c
rename to libgcc/emutls.c
diff --git a/gcc/unwind-c.c b/libgcc/unwind-c.c
rename from gcc/unwind-c.c
rename to libgcc/unwind-c.c
diff --git a/gcc/unwind-compat.c b/libgcc/unwind-compat.c
rename from gcc/unwind-compat.c
rename to libgcc/unwind-compat.c
diff --git a/gcc/unwind-compat.h b/libgcc/unwind-compat.h
rename from gcc/unwind-compat.h
rename to libgcc/unwind-compat.h
diff --git a/gcc/unwind-dw2-fde-compat.c b/libgcc/unwind-dw2-fde-compat.c
rename from gcc/unwind-dw2-fde-compat.c
rename to libgcc/unwind-dw2-fde-compat.c
diff --git a/gcc/unwind-dw2-fde-glibc.c b/libgcc/unwind-dw2-fde-dip.c
rename from gcc/unwind-dw2-fde-glibc.c
rename to libgcc/unwind-dw2-fde-dip.c
diff --git a/gcc/unwind-dw2-fde.c b/libgcc/unwind-dw2-fde.c
rename from gcc/unwind-dw2-fde.c
rename to libgcc/unwind-dw2-fde.c
diff --git a/gcc/unwind-dw2-fde.h b/libgcc/unwind-dw2-fde.h
rename from gcc/unwind-dw2-fde.h
rename to libgcc/unwind-dw2-fde.h
diff --git a/gcc/unwind-dw2.c b/libgcc/unwind-dw2.c
rename from gcc/unwind-dw2.c
rename to libgcc/unwind-dw2.c
diff --git a/gcc/unwind-dw2.h b/libgcc/unwind-dw2.h
rename from gcc/unwind-dw2.h
rename to libgcc/unwind-dw2.h
diff --git a/gcc/unwind-generic.h b/libgcc/unwind-generic.h
rename from gcc/unwind-generic.h
rename to libgcc/unwind-generic.h
diff --git a/gcc/unwind-pe.h b/libgcc/unwind-pe.h
rename from gcc/unwind-pe.h
rename to libgcc/unwind-pe.h
diff --git a/gcc/unwind-sjlj.c b/libgcc/unwind-sjlj.c
rename from gcc/unwind-sjlj.c
rename to libgcc/unwind-sjlj.c
diff --git a/gcc/unwind.inc b/libgcc/unwind.inc
rename from gcc/unwind.inc
rename to libgcc/unwind.inc
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -38,7 +38,7 @@ ACLOCAL_AMFLAGS = -I ./config -I ../conf
 
 AM_CFLAGS = -fexceptions -fplan9-extensions $(SPLIT_STACK) $(WARN_CFLAGS) \
 	$(STRINGOPS_FLAG) \
-	-I $(srcdir)/../gcc -I $(MULTIBUILDTOP)../../gcc/include
+	-I $(srcdir)/../libgcc -I $(MULTIBUILDTOP)../../gcc/include
 
 if USING_SPLIT_STACK
 AM_LDFLAGS = -XCClinker $(SPLIT_STACK)
diff --git a/libjava/Makefile.am b/libjava/Makefile.am
--- a/libjava/Makefile.am
+++ b/libjava/Makefile.am
@@ -342,7 +342,7 @@ LIBLINK = $(LIBTOOL) --tag=CXX $(LIBTOOL
 CXXLINK = $(LIBTOOL) --tag=CXX $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
 	  $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LTLDFLAGS) -o $@
 
-GCC_UNWIND_INCLUDE = @GCC_UNWIND_INCLUDE@
+LIBGCC_UNWIND_INCLUDE = @LIBGCC_UNWIND_INCLUDE@
 
 WARNINGS = -Wextra -Wall
 ## Some systems don't allow `$' in identifiers by default, so we force
@@ -410,7 +410,7 @@ AM_CPPFLAGS = -I$(top_srcdir) \
 	-Iclasspath/include \
 	-I$(top_srcdir)/classpath/native/fdlibm \
 	$(GCINCS) $(THREADINCS) $(INCLTDL) \
-	$(GCC_UNWIND_INCLUDE) $(ZINCS) $(LIBFFIINCS)
+	$(LIBGCC_UNWIND_INCLUDE) $(ZINCS) $(LIBFFIINCS)
 
 BOOTCLASSPATH = $(srcdir)/classpath/lib
 
diff --git a/libjava/configure.ac b/libjava/configure.ac
--- a/libjava/configure.ac
+++ b/libjava/configure.ac
@@ -469,7 +469,7 @@ case "${which_gcj}" in
    cross)
       if test "x${with_newlib}" = "xyes"; then
          # FIXME (comment): Why is this needed?
-         GCC_UNWIND_INCLUDE=
+         LIBGCC_UNWIND_INCLUDE=
       fi
       GCJH='$(target_noncanonical)-gcjh'
    ;;
@@ -1204,8 +1204,8 @@ AC_SUBST(HASH_SYNC_SPEC)
 
 AM_CONDITIONAL(USING_GCC, test "$GCC" = yes)
 
-# We're in the tree with gcc, and need to include some of its headers.
-GCC_UNWIND_INCLUDE='-I$(multi_basedir)/./libjava/../gcc'
+# We're in the tree with libgcc, and need to include some of its headers.
+LIBGCC_UNWIND_INCLUDE='-I$(multi_basedir)/./libjava/../libgcc'
 
 if test "x${with_newlib}" = "xyes"; then
    # We are being configured with a cross compiler.  AC_REPLACE_FUNCS
@@ -1569,7 +1569,7 @@ AM_CONDITIONAL(NATIVE, test "$NATIVE" = 
 AM_CONDITIONAL(ENABLE_SHARED, test "$enable_shared" = yes)
 AM_CONDITIONAL(NEEDS_DATA_START, test "$NEEDS_DATA_START" = yes && test "$NATIVE" = yes)
 AM_CONDITIONAL(INSTALL_BINARIES, test -z "${with_multisubdir}")
-AC_SUBST(GCC_UNWIND_INCLUDE)
+AC_SUBST(LIBGCC_UNWIND_INCLUDE)
 
 # Process the option "--enable-version-specific-runtime-libs"
 # Calculate toolexeclibdir
diff --git a/libobjc/Makefile.in b/libobjc/Makefile.in
--- a/libobjc/Makefile.in
+++ b/libobjc/Makefile.in
@@ -101,6 +101,7 @@ OBJC_BOEHM_GC_LIBS=../boehm-gc/libgcjgc_
 INCLUDES = -I$(srcdir)/$(MULTISRCTOP)../gcc \
   -I$(srcdir)/$(MULTISRCTOP)../gcc/config \
   -I$(MULTIBUILDTOP)../../$(host_subdir)/gcc \
+  -I$(srcdir)/$(MULTISRCTOP)../libgcc \
   -I$(srcdir)/$(MULTISRCTOP)../include \
   $(OBJC_BOEHM_GC_INCLUDES)
 
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -685,9 +685,9 @@ AC_DEFUN([GLIBCXX_EXPORT_INCLUDES], [
   fi
 
   # Stuff in the actual top level.  Currently only used by libsupc++ to
-  # get unwind* headers from the gcc dir.
-  #TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc -I$(toplevel_srcdir)/include'
-  TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc'
+  # get unwind* headers from the libgcc dir.
+  #TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/libgcc -I$(toplevel_srcdir)/include'
+  TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/libgcc'
 
   # Now, export this to all the little Makefiles....
   AC_SUBST(GLIBCXX_INCLUDES)

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

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-03 13:33 [build] Move unwinder to toplevel libgcc (v2) Rainer Orth
@ 2011-08-03 16:07 ` Nick Clifton
  2011-08-03 21:11 ` Benjamin Kosnik
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 57+ messages in thread
From: Nick Clifton @ 2011-08-03 16:07 UTC (permalink / raw)
  To: Rainer Orth
  Cc: gcc-patches, Joseph S. Myers, Paolo Bonzini, Ralf Wildenhues,
	Ian Lance Taylor, Steve Ellcey, Richard Earnshaw,
	Ramana Radhakrishnan, Douglas Rupp, Tristan Gingold, Mike Stump,
	Kaz Kojima, David Edelsohn, Sterling Augustine, Arnaud Charlet,
	java-patches, Nicola Pero, libstdc++,
	Richard Sandiford

Hi Rainer,

> How should we proceed with this patch, especially given the quite
> moderate comments from most affected target maintainers?

I have no objections to the patch from an ARM or FRV point of view.

Cheers
   Nick

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-03 13:33 [build] Move unwinder to toplevel libgcc (v2) Rainer Orth
  2011-08-03 16:07 ` Nick Clifton
@ 2011-08-03 21:11 ` Benjamin Kosnik
  2011-08-05  9:50 ` Paolo Bonzini
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 57+ messages in thread
From: Benjamin Kosnik @ 2011-08-03 21:11 UTC (permalink / raw)
  To: Rainer Orth
  Cc: gcc-patches, Joseph S. Myers, Paolo Bonzini, Ralf Wildenhues,
	Ian Lance Taylor, Steve Ellcey, Richard Earnshaw,
	Ramana Radhakrishnan, Nick Clifton, Douglas Rupp,
	Tristan Gingold, Mike Stump, Kaz Kojima, David Edelsohn,
	Sterling Augustine, Arnaud Charlet, java-patches, Nicola Pero,
	libstdc++,
	Richard Sandiford


> +++ b/libstdc++-v3/acinclude.m4
> @@ -685,9 +685,9 @@ AC_DEFUN([GLIBCXX_EXPORT_INCLUDES], [
>    fi
>  
>    # Stuff in the actual top level.  Currently only used by libsupc++
> to
> -  # get unwind* headers from the gcc dir.
> -  #TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc
> -I$(toplevel_srcdir)/include'
> -  TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc'
> +  # get unwind* headers from the libgcc dir.
> +  #TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/libgcc
> -I$(toplevel_srcdir)/include'
> +  TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/libgcc'
>  
>    # Now, export this to all the little Makefiles....
>    AC_SUBST(GLIBCXX_INCLUDES)

Ok, as a formality.

-benjamin

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-03 13:33 [build] Move unwinder to toplevel libgcc (v2) Rainer Orth
  2011-08-03 16:07 ` Nick Clifton
  2011-08-03 21:11 ` Benjamin Kosnik
@ 2011-08-05  9:50 ` Paolo Bonzini
  2011-08-05 12:16   ` Rainer Orth
  2011-08-05 18:37 ` Mikael Morin
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 57+ messages in thread
From: Paolo Bonzini @ 2011-08-05  9:50 UTC (permalink / raw)
  To: Rainer Orth
  Cc: gcc-patches, Joseph S. Myers, Ralf Wildenhues, Ian Lance Taylor,
	Steve Ellcey, Richard Earnshaw, Ramana Radhakrishnan,
	Nick Clifton, Douglas Rupp, Tristan Gingold, Mike Stump,
	Kaz Kojima, David Edelsohn, Sterling Augustine, Arnaud Charlet,
	java-patches, Nicola Pero, libstdc++,
	Richard Sandiford

On 08/03/2011 03:32 PM, Rainer Orth wrote:
> It should incorporate all review comments and a few errors I've noticed
> during final review have been corrected.
>
> I've received approval for the Darwin bits, Steve successfully tested on
> HP-UX/IA64 and Linux/IA64 at least bootstrapped.  VMS/IA64 approval has
> been given conditional on the approval of the other IA64 bits.  I've
> also received approval for the libjava parts.
>
> Bootstrapped without regressions (together with the next two, to be
> resubmitted shortly: fp-bit and soft-fp moves) on
> x86_64-unknown-linux-gnu.
>
> i386-pc-solaris2.10, sparc-sun-solaris2.11, alpha-dec-osf5.1b,
> mips-sgi-irix6.5 and i386-apple-darwin9.8.0 bootstraps in progress.
> powerpc-apple-darwin9.8.0 currently broken (SIGBUS compiling
> c-family/c-pretty-print.c and cp/call.c).
>
> How should we proceed with this patch, especially given the quite
> moderate comments from most affected target maintainers?

ARM is the only target we should care a bit about.  Any chance you can 
try cross-compiling it (with a combined tree it should not be hard)? 
Just to see that it builds.

Paolo

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-05  9:50 ` Paolo Bonzini
@ 2011-08-05 12:16   ` Rainer Orth
  2011-08-05 13:56     ` Paolo Bonzini
  0 siblings, 1 reply; 57+ messages in thread
From: Rainer Orth @ 2011-08-05 12:16 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: gcc-patches, Joseph S. Myers, Ralf Wildenhues, Ian Lance Taylor,
	Steve Ellcey, Richard Earnshaw, Ramana Radhakrishnan,
	Nick Clifton, Douglas Rupp, Tristan Gingold, Mike Stump,
	Kaz Kojima, David Edelsohn, Sterling Augustine, Arnaud Charlet,
	java-patches, Nicola Pero, libstdc++,
	Richard Sandiford

Paolo Bonzini <bonzini@gnu.org> writes:

>> How should we proceed with this patch, especially given the quite
>> moderate comments from most affected target maintainers?
>
> ARM is the only target we should care a bit about.  Any chance you can try
> cross-compiling it (with a combined tree it should not be hard)? Just to
> see that it builds.

I've tried to setup crosstool-NG in the past, but failed and haven't
gotten around to debugging this yet.  I still mean to, especially given
that I need to investigate testsuite issues in a cross environment.

Nick already ok'ed the arm (and frv) parts, so we should be ok for now.

	Rainer

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

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-05 12:16   ` Rainer Orth
@ 2011-08-05 13:56     ` Paolo Bonzini
  0 siblings, 0 replies; 57+ messages in thread
From: Paolo Bonzini @ 2011-08-05 13:56 UTC (permalink / raw)
  To: Rainer Orth
  Cc: gcc-patches, Joseph S. Myers, Ralf Wildenhues, Ian Lance Taylor,
	Steve Ellcey, Richard Earnshaw, Ramana Radhakrishnan,
	Nick Clifton, Douglas Rupp, Tristan Gingold, Mike Stump,
	Kaz Kojima, David Edelsohn, Sterling Augustine, Arnaud Charlet,
	java-patches, Nicola Pero, libstdc++,
	Richard Sandiford

On 08/05/2011 01:46 PM, Rainer Orth wrote:
>>> >>  How should we proceed with this patch, especially given the quite
>>> >>  moderate comments from most affected target maintainers?
>> >
>> >  ARM is the only target we should care a bit about.  Any chance you can try
>> >  cross-compiling it (with a combined tree it should not be hard)? Just to
>> >  see that it builds.
> I've tried to setup crosstool-NG in the past, but failed and haven't
> gotten around to debugging this yet.  I still mean to, especially given
> that I need to investigate testsuite issues in a cross environment.
>
> Nick already ok'ed the arm (and frv) parts, so we should be ok for now.

Ok then.

Paolo

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-03 13:33 [build] Move unwinder to toplevel libgcc (v2) Rainer Orth
                   ` (2 preceding siblings ...)
  2011-08-05  9:50 ` Paolo Bonzini
@ 2011-08-05 18:37 ` Mikael Morin
  2011-08-05 20:58   ` Paolo Bonzini
  2011-08-06  9:54 ` Andreas Schwab
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 57+ messages in thread
From: Mikael Morin @ 2011-08-05 18:37 UTC (permalink / raw)
  To: gcc-patches
  Cc: Rainer Orth, Joseph S. Myers, Paolo Bonzini, Ralf Wildenhues,
	Ian Lance Taylor, Steve Ellcey, Richard Earnshaw,
	Ramana Radhakrishnan, Nick Clifton, Douglas Rupp,
	Tristan Gingold, Mike Stump, Kaz Kojima, David Edelsohn,
	Sterling Augustine, Arnaud Charlet, java-patches, Nicola Pero,
	libstdc++,
	Richard Sandiford

On Wednesday 03 August 2011 15:32:45 Rainer Orth wrote:
> This is the revised/updated version of the patch originally posted at
> 
> 	[build] Move unwinder to toplevel libgcc
>         http://gcc.gnu.org/ml/gcc-patches/2011-06/msg01452.html
> 
> and reposted as CFT at
> 
> 	http://gcc.gnu.org/ml/gcc-patches/2011-07/msg00201.html
> 
> It should incorporate all review comments and a few errors I've noticed
> during final review have been corrected.
> 
> I've received approval for the Darwin bits, Steve successfully tested on
> HP-UX/IA64 and Linux/IA64 at least bootstrapped.  VMS/IA64 approval has
> been given conditional on the approval of the other IA64 bits.  I've
> also received approval for the libjava parts.
> 
> Bootstrapped without regressions (together with the next two, to be
> resubmitted shortly: fp-bit and soft-fp moves) on
> x86_64-unknown-linux-gnu.
> 
> i386-pc-solaris2.10, sparc-sun-solaris2.11, alpha-dec-osf5.1b,
> mips-sgi-irix6.5 and i386-apple-darwin9.8.0 bootstraps in progress.
> powerpc-apple-darwin9.8.0 currently broken (SIGBUS compiling
> c-family/c-pretty-print.c and cp/call.c).
> 
> How should we proceed with this patch, especially given the quite
> moderate comments from most affected target maintainers?
> 
> Thanks.
> 	Rainer

Hello, 

I suppose it is this patch that breaks bootstrap on 86_64-unknown-freebsd8.2:
/home/mik/gcc4x/src/gcc/crtstuff.c:64:28: fatal error: unwind-dw2-fde.h: No 
such file or directory

Fixed by the the following pat^Whack
Index: crtstuff.c
===================================================================
--- crtstuff.c	(révision 177469)
+++ crtstuff.c	(copie de travail)
@@ -61,7 +61,7 @@
 #include "tsystem.h"
 #include "coretypes.h"
 #include "tm.h"
-#include "unwind-dw2-fde.h"
+#include "../libgcc/unwind-dw2-fde.h"
 
 #ifndef FORCE_CODE_SECTION_ALIGN
 # define FORCE_CODE_SECTION_ALIGN

There is probably something better, but I have no clue.

Mikael

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-05 18:37 ` Mikael Morin
@ 2011-08-05 20:58   ` Paolo Bonzini
  2011-08-06 10:58     ` Mikael Morin
  0 siblings, 1 reply; 57+ messages in thread
From: Paolo Bonzini @ 2011-08-05 20:58 UTC (permalink / raw)
  To: Mikael Morin
  Cc: gcc-patches, Rainer Orth, Joseph S. Myers, Ralf Wildenhues,
	Ian Lance Taylor, Steve Ellcey, Richard Earnshaw,
	Ramana Radhakrishnan, Nick Clifton, Douglas Rupp,
	Tristan Gingold, Mike Stump, Kaz Kojima, David Edelsohn,
	Sterling Augustine, Arnaud Charlet, java-patches, Nicola Pero,
	libstdc++,
	Richard Sandiford

On Fri, Aug 5, 2011 at 20:18, Mikael Morin <mikael.morin@sfr.fr> wrote:
> I suppose it is this patch that breaks bootstrap on 86_64-unknown-freebsd8.2:
> /home/mik/gcc4x/src/gcc/crtstuff.c:64:28: fatal error: unwind-dw2-fde.h: No
> such file or directory
>
> Fixed by the the following pat^Whack
> Index: crtstuff.c
> ===================================================================
> --- crtstuff.c  (révision 177469)
> +++ crtstuff.c  (copie de travail)
> @@ -61,7 +61,7 @@
>  #include "tsystem.h"
>  #include "coretypes.h"
>  #include "tm.h"
> -#include "unwind-dw2-fde.h"
> +#include "../libgcc/unwind-dw2-fde.h"
>
>  #ifndef FORCE_CODE_SECTION_ALIGN
>  # define FORCE_CODE_SECTION_ALIGN
>
> There is probably something better, but I have no clue.

Adding a -I flag?  I suppose that makes sense even if crtstuff is
moved soon to toplevel libgcc.

Paolo

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-03 13:33 [build] Move unwinder to toplevel libgcc (v2) Rainer Orth
                   ` (3 preceding siblings ...)
  2011-08-05 18:37 ` Mikael Morin
@ 2011-08-06  9:54 ` Andreas Schwab
  2011-08-08 17:29   ` Steve Ellcey
  2011-08-08 18:49   ` Rainer Orth
  2011-08-06 18:56 ` Richard Sandiford
  2011-08-10 13:57 ` Joseph S. Myers
  6 siblings, 2 replies; 57+ messages in thread
From: Andreas Schwab @ 2011-08-06  9:54 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gcc-patches

I'm seeing this bootstrap failure on ia64 (configured with
--with-system-libunwind):

/usr/local/gcc/gcc-20110806/Build/./prev-gcc/g++ -B/usr/local/gcc/gcc-20110806/Build/./prev-gcc/ -B/usr/ia64-suse-linux/bin/ -nostdinc++ -B/usr/local/gcc/gcc-20110806/Build/prev-ia64-suse-linux/libstdc++-v3/src/.libs -B/usr/local/gcc/gcc-20110806/Build/prev-ia64-suse-linux/libstdc++-v3/libsupc++/.libs -I/usr/local/gcc/gcc-20110806/Build/prev-ia64-suse-linux/libstdc++-v3/include/ia64-suse-linux -I/usr/local/gcc/gcc-20110806/Build/prev-ia64-suse-linux/libstdc++-v3/include -I/usr/local/gcc/gcc-20110806/libstdc++-v3/libsupc++ -L/usr/local/gcc/gcc-20110806/Build/prev-ia64-suse-linux/libstdc++-v3/src/.libs -L/usr/local/gcc/gcc-20110806/Build/prev-ia64-suse-linux/libstdc++-v3/libsupc++/.libs  -DUSE_LIBUNWIND_EXCEPTIONS -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common  -DHAVE_CONFIG_H -o gengtype gengtype.o gengtype-lex.o gengtype-parse.o gengtype-state.o version.o errors.o libcommon.a ../libcpp/libcpp.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a   ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a 
/usr/local/gcc/gcc-20110806/Build/./prev-gcc/libgcc_s.so: undefined reference to `__libunwind__Unwind_Find_FDE'
collect2: error: ld returned 1 exit status
make[3]: *** [gengtype] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory `/usr/local/gcc/gcc-20110806/Build/gcc'
make[2]: *** [all-stage2-gcc] Error 2
make[2]: Leaving directory `/usr/local/gcc/gcc-20110806/Build'
make[1]: *** [stage2-bubble] Error 2
make[1]: Leaving directory `/usr/local/gcc/gcc-20110806/Build'
make: *** [bootstrap] Error 2

Looks like -lunwind is missing somewhere.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-05 20:58   ` Paolo Bonzini
@ 2011-08-06 10:58     ` Mikael Morin
  2011-08-06 14:40       ` Paolo Bonzini
  0 siblings, 1 reply; 57+ messages in thread
From: Mikael Morin @ 2011-08-06 10:58 UTC (permalink / raw)
  To: gcc-patches
  Cc: Paolo Bonzini, Rainer Orth, Joseph S. Myers, Ralf Wildenhues,
	Ian Lance Taylor, Steve Ellcey, Richard Earnshaw,
	Ramana Radhakrishnan, Nick Clifton, Douglas Rupp,
	Tristan Gingold, Mike Stump, Kaz Kojima, David Edelsohn,
	Sterling Augustine, Arnaud Charlet, java-patches, Nicola Pero,
	libstdc++,
	Richard Sandiford

On Friday 05 August 2011 21:48:34 Paolo Bonzini wrote:
> On Fri, Aug 5, 2011 at 20:18, Mikael Morin <mikael.morin@sfr.fr> wrote:
> > I suppose it is this patch that breaks bootstrap
The culprit is indeed r177447.

> 
> Adding a -I flag?  I suppose that makes sense even if crtstuff is
> moved soon to toplevel libgcc.
How about this? It fixes the problem.

Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in	(révision 177491)
+++ gcc/Makefile.in	(copie de travail)
@@ -1088,7 +1088,7 @@
 INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
 	   -I$(srcdir)/../include @INCINTL@ \
 	   $(CPPINC) $(GMPINC) $(DECNUMINC) \
-	   $(PPLINC) $(CLOOGINC)
+	   $(PPLINC) $(CLOOGINC) -I$(srcdir)/../libgcc
 
 .c.o:
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $< $(OUTPUT_OPTION)


Mikael

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-06 10:58     ` Mikael Morin
@ 2011-08-06 14:40       ` Paolo Bonzini
  2011-08-06 15:26         ` Mikael Morin
  0 siblings, 1 reply; 57+ messages in thread
From: Paolo Bonzini @ 2011-08-06 14:40 UTC (permalink / raw)
  To: Mikael Morin
  Cc: gcc-patches, Rainer Orth, Joseph S. Myers, Ralf Wildenhues,
	Ian Lance Taylor, Steve Ellcey, Richard Earnshaw,
	Ramana Radhakrishnan, Nick Clifton, Douglas Rupp,
	Tristan Gingold, Mike Stump, Kaz Kojima, David Edelsohn,
	Sterling Augustine, Arnaud Charlet, java-patches, Nicola Pero,
	libstdc++,
	Richard Sandiford

[-- Attachment #1: Type: text/plain, Size: 1186 bytes --]

On 08/06/2011 12:43 PM, Mikael Morin wrote:
> On Friday 05 August 2011 21:48:34 Paolo Bonzini wrote:
>> On Fri, Aug 5, 2011 at 20:18, Mikael Morin<mikael.morin@sfr.fr>  wrote:
>>> I suppose it is this patch that breaks bootstrap
> The culprit is indeed r177447.
>
>>
>> Adding a -I flag?  I suppose that makes sense even if crtstuff is
>> moved soon to toplevel libgcc.
> How about this? It fixes the problem.
>
> Index: gcc/Makefile.in
> ===================================================================
> --- gcc/Makefile.in	(révision 177491)
> +++ gcc/Makefile.in	(copie de travail)
> @@ -1088,7 +1088,7 @@
>   INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
>   	   -I$(srcdir)/../include @INCINTL@ \
>   	   $(CPPINC) $(GMPINC) $(DECNUMINC) \
> -	   $(PPLINC) $(CLOOGINC)
> +	   $(PPLINC) $(CLOOGINC) -I$(srcdir)/../libgcc
>
>   .c.o:
>   	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $<  $(OUTPUT_OPTION)

Thanks.

Can you try this instead?

Paolo

2011-08-06  Paolo Bonzini  <bonzini@gnu.org>
             Mikael Morin   <mikael.morin@sfr.fr>

	* Makefile.in (INCLUDES_FOR_TARGET): New.
	(LIBGCC2_CFLAGS): Use it.
	(CRTSTUFF_CFLAGS): Use it instead of INCLUDES.

[-- Attachment #2: patch-for-bsd.patch --]
[-- Type: text/x-patch, Size: 1543 bytes --]

Index: ../gcc/gcc/Makefile.in
===================================================================
--- ../gcc/gcc/Makefile.in	(revision 177266)
+++ ../gcc/gcc/Makefile.in	(working copy)
@@ -668,9 +668,9 @@ endif
 # Options to use when compiling libgcc2.a.
 #
 LIBGCC2_DEBUG_CFLAGS = -g
-LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) \
-		 $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) \
-		 -DIN_LIBGCC2 \
+LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(INCLUDES_FOR_TARGET) $(GCC_CFLAGS) \
+		 $(TARGET_LIBGCC2_CFLAGS) $(LIBGCC2_DEBUG_CFLAGS) \
+		 $(GTHREAD_FLAGS) -DIN_LIBGCC2 \
 		 -fbuilding-libgcc -fno-stack-protector \
 		 $(INHIBIT_LIBC_CFLAGS)
 
@@ -682,8 +682,8 @@ LIBGCC2_INCLUDES =
 TARGET_LIBGCC2_CFLAGS =
 
 # Options to use when compiling crtbegin/end.
-CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
-  -finhibit-size-directive -fno-inline -fno-exceptions \
+CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES_FOR_TARGET) $(MULTILIB_CFLAGS) \
+  -g0 -finhibit-size-directive -fno-inline -fno-exceptions \
   -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \
   -fno-stack-protector \
   $(INHIBIT_LIBC_CFLAGS)
@@ -1102,6 +1102,9 @@ INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(s
 	   $(CPPINC) $(GMPINC) $(DECNUMINC) \
 	   $(PPLINC) $(CLOOGINC)
 
+INCLUDES_FOR_TARGET = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
+	   -I$(srcdir)/../include $(DECNUMINC) -I$(srcdir)/../libgcc
+
 .c.o:
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $< $(OUTPUT_OPTION)
 

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-06 14:40       ` Paolo Bonzini
@ 2011-08-06 15:26         ` Mikael Morin
  2011-08-06 15:39           ` Paolo Bonzini
  0 siblings, 1 reply; 57+ messages in thread
From: Mikael Morin @ 2011-08-06 15:26 UTC (permalink / raw)
  To: gcc-patches; +Cc: Paolo Bonzini, Rainer Orth

On Saturday 06 August 2011 16:31:48 Paolo Bonzini wrote:
> Can you try this instead?
It works. Thanks

Mikael

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-06 15:26         ` Mikael Morin
@ 2011-08-06 15:39           ` Paolo Bonzini
  2011-08-09 12:42             ` Rainer Orth
  0 siblings, 1 reply; 57+ messages in thread
From: Paolo Bonzini @ 2011-08-06 15:39 UTC (permalink / raw)
  To: Mikael Morin; +Cc: gcc-patches, Rainer Orth

On 08/06/2011 05:07 PM, Mikael Morin wrote:
> On Saturday 06 August 2011 16:31:48 Paolo Bonzini wrote:
>> Can you try this instead?
> It works. Thanks

Committed, thanks.

Paolo

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-03 13:33 [build] Move unwinder to toplevel libgcc (v2) Rainer Orth
                   ` (4 preceding siblings ...)
  2011-08-06  9:54 ` Andreas Schwab
@ 2011-08-06 18:56 ` Richard Sandiford
  2011-08-09 13:00   ` Rainer Orth
  2011-08-10 13:57 ` Joseph S. Myers
  6 siblings, 1 reply; 57+ messages in thread
From: Richard Sandiford @ 2011-08-06 18:56 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gcc-patches

Thanks again for doing this.

Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
> 	* config.host (unwind_header): New variable.
> 	(*-*-freebsd*): Set tmake_file to t-eh-dw2-dip.
> 	(*-*-linux*, frv-*-*linux*, *-*-kfreebsd*-gnu, *-*-knetbsd*-gnu,
> 	*-*-gnu*): Likewise, also for *-*-kopensolaris*-gnu.
> 	(*-*-solaris2*): Add t-eh-dw2-dip to tmake_file.

The combination of this and the soft-fp patch meant that t-mips
wasn't included by mips*-linux-gnu.  The fix below seemed obvious,
especially given the solaris case, so I applied it after testing
on mips64-linux-gnu.

Richard


libgcc/
	* config.host (*-*-darwin*, *-*-freebsd*, *-*-linux*, frv-*-*linux*)
	(*-*-kfreebsd*-gnu, *-*-knetbsd*-gnu, *-*-gnu*, *-*-kopensolaris*-gnu):
	Add to tmake_file rather than overriding it.

Index: libgcc/config.host
===================================================================
--- libgcc/config.host	2011-08-06 15:36:16.000000000 +0100
+++ libgcc/config.host	2011-08-06 15:36:52.000000000 +0100
@@ -163,7 +163,7 @@ esac
 case ${host} in
 *-*-darwin*)
   asm_hidden_op=.private_extern
-  tmake_file="t-darwin ${cpu_type}/t-darwin t-slibgcc-darwin"
+  tmake_file="$tmake_file t-darwin ${cpu_type}/t-darwin t-slibgcc-darwin"
   extra_parts=crt3.o
   ;;
 *-*-freebsd[12] | *-*-freebsd[12].* | *-*-freebsd*aout*)
@@ -179,10 +179,10 @@ case ${host} in
   # This is the generic ELF configuration of FreeBSD.  Later
   # machine-specific sections may refine and add to this
   # configuration.
-  tmake_file=t-eh-dw2-dip
+  tmake_file="$tmake_file t-eh-dw2-dip"
   ;;
 *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu)
-  tmake_file=t-eh-dw2-dip
+  tmake_file="$tmake_file t-eh-dw2-dip"
   extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
   ;;
 *-*-netbsd*)

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-06  9:54 ` Andreas Schwab
@ 2011-08-08 17:29   ` Steve Ellcey
  2011-08-08 18:49   ` Rainer Orth
  1 sibling, 0 replies; 57+ messages in thread
From: Steve Ellcey @ 2011-08-08 17:29 UTC (permalink / raw)
  To: Rainer Orth, Andreas Schwab; +Cc: gcc-patches

> I'm seeing this bootstrap failure on ia64 (configured with
> --with-system-libunwind):

> /usr/local/gcc/gcc-20110806/Build/./prev-gcc/libgcc_s.so: undefined referen=
> ce to `__libunwind__Unwind_Find_FDE'
> collect2: error: ld returned 1 exit status
> make[3]: *** [gengtype] Error 1

I get this on my IA64 Linux bootstrap too, but I am building without
--with-system-libunwind.  IA64 HP-UX appears to be fine.

Steve Ellcey
sje@cup.hp.com

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-06  9:54 ` Andreas Schwab
  2011-08-08 17:29   ` Steve Ellcey
@ 2011-08-08 18:49   ` Rainer Orth
  2011-08-09  1:03     ` Andreas Schwab
  1 sibling, 1 reply; 57+ messages in thread
From: Rainer Orth @ 2011-08-08 18:49 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gcc-patches

Andreas Schwab <schwab@linux-m68k.org> writes:

> I'm seeing this bootstrap failure on ia64 (configured with
> --with-system-libunwind):
>
> /usr/local/gcc/gcc-20110806/Build/./prev-gcc/g++ -B/usr/local/gcc/gcc-20110806/Build/./prev-gcc/ -B/usr/ia64-suse-linux/bin/ -nostdinc++ -B/usr/local/gcc/gcc-20110806/Build/prev-ia64-suse-linux/libstdc++-v3/src/.libs -B/usr/local/gcc/gcc-20110806/Build/prev-ia64-suse-linux/libstdc++-v3/libsupc++/.libs -I/usr/local/gcc/gcc-20110806/Build/prev-ia64-suse-linux/libstdc++-v3/include/ia64-suse-linux -I/usr/local/gcc/gcc-20110806/Build/prev-ia64-suse-linux/libstdc++-v3/include -I/usr/local/gcc/gcc-20110806/libstdc++-v3/libsupc++ -L/usr/local/gcc/gcc-20110806/Build/prev-ia64-suse-linux/libstdc++-v3/src/.libs -L/usr/local/gcc/gcc-20110806/Build/prev-ia64-suse-linux/libstdc++-v3/libsupc++/.libs  -DUSE_LIBUNWIND_EXCEPTIONS -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common  -DHAVE_CONFIG_H -o gengtype gengtype.o gengtype-lex.o gengtype-parse.o gengtype-state.o version.o errors.o libcommon.a ../libcpp/libcpp.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a   ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a 
> /usr/local/gcc/gcc-20110806/Build/./prev-gcc/libgcc_s.so: undefined reference to `__libunwind__Unwind_Find_FDE'
> collect2: error: ld returned 1 exit status
> make[3]: *** [gengtype] Error 1
> make[3]: *** Waiting for unfinished jobs....
> make[3]: Leaving directory `/usr/local/gcc/gcc-20110806/Build/gcc'
> make[2]: *** [all-stage2-gcc] Error 2
> make[2]: Leaving directory `/usr/local/gcc/gcc-20110806/Build'
> make[1]: *** [stage2-bubble] Error 2
> make[1]: Leaving directory `/usr/local/gcc/gcc-20110806/Build'
> make: *** [bootstrap] Error 2
>
> Looks like -lunwind is missing somewhere.

AFAICT -lunwind comes from gcc/config/t-libunwind (SHLIB_LC) and is
still present *if t-libunwind is used*.  The problem could be that there
are several different definitions of LIB2ADDEH for the ia64-*-*
configs.  In the case of Linux/IA-64, we now have 

> grep LIB2ADDEH ia64/t-ia64 ia64/t-glibc ia64/t-eh-ia64 t-libunwind
ia64/t-glibc:LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \
ia64/t-eh-ia64:LIB2ADDEH = $(srcdir)/config/ia64/unwind-ia64.c $(srcdir)/unwind-sjlj.c \
t-libunwind:LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \
t-libunwind:LIB2ADDEHSTATIC = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c

On the 4.6 branch (in gcc/config), we have

ia64/t-ia64:LIB2ADDEH = $(srcdir)/config/ia64/unwind-ia64.c $(srcdir)/unwind-sjlj.c \
t-libunwind:LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \
t-libunwind:LIB2ADDEHSTATIC = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
ia64/t-glibc:LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \

It seems the ordering is wrong, i.e. t-libunwind should come before
ia64/t-glibc.

Perhaps you could have a look at all those definitions of LIB2ADDEH*?
Probably some of them can be removed, or the t-* files not included in
particular configurations.

	Rainer

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

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-08 18:49   ` Rainer Orth
@ 2011-08-09  1:03     ` Andreas Schwab
  2011-08-09 12:52       ` Rainer Orth
  0 siblings, 1 reply; 57+ messages in thread
From: Andreas Schwab @ 2011-08-09  1:03 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gcc-patches

It's already fixed, 'twas the missing ldflags.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-06 15:39           ` Paolo Bonzini
@ 2011-08-09 12:42             ` Rainer Orth
  0 siblings, 0 replies; 57+ messages in thread
From: Rainer Orth @ 2011-08-09 12:42 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Mikael Morin, gcc-patches

Paolo Bonzini <bonzini@gnu.org> writes:

> On 08/06/2011 05:07 PM, Mikael Morin wrote:
>> On Saturday 06 August 2011 16:31:48 Paolo Bonzini wrote:
>>> Can you try this instead?
>> It works. Thanks
>
> Committed, thanks.

Thanks for fixing this.

	Rainer

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

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-09  1:03     ` Andreas Schwab
@ 2011-08-09 12:52       ` Rainer Orth
  2011-08-09 13:15         ` Andreas Schwab
  0 siblings, 1 reply; 57+ messages in thread
From: Rainer Orth @ 2011-08-09 12:52 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gcc-patches

Andreas Schwab <schwab@linux-m68k.org> writes:

> It's already fixed, 'twas the missing ldflags.

I see, so I wasn't the only victim :-)

Thanks.
        Rainer

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

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-06 18:56 ` Richard Sandiford
@ 2011-08-09 13:00   ` Rainer Orth
  0 siblings, 0 replies; 57+ messages in thread
From: Rainer Orth @ 2011-08-09 13:00 UTC (permalink / raw)
  To: gcc-patches; +Cc: rdsandiford

Richard Sandiford <rdsandiford@googlemail.com> writes:

> Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
>> 	* config.host (unwind_header): New variable.
>> 	(*-*-freebsd*): Set tmake_file to t-eh-dw2-dip.
>> 	(*-*-linux*, frv-*-*linux*, *-*-kfreebsd*-gnu, *-*-knetbsd*-gnu,
>> 	*-*-gnu*): Likewise, also for *-*-kopensolaris*-gnu.
>> 	(*-*-solaris2*): Add t-eh-dw2-dip to tmake_file.
>
> The combination of this and the soft-fp patch meant that t-mips
> wasn't included by mips*-linux-gnu.  The fix below seemed obvious,
> especially given the solaris case, so I applied it after testing
> on mips64-linux-gnu.

Indeed.  I think the default should be to append to variables, with
every exception requiring a comment explaining what's going on.  I'm
trying to do so in the rest of the patch series.  config.host (and
config.gcc) will probably require a final pass checking for such cases.

Thanks for fixing this.

	Rainer

> libgcc/
> 	* config.host (*-*-darwin*, *-*-freebsd*, *-*-linux*, frv-*-*linux*)
> 	(*-*-kfreebsd*-gnu, *-*-knetbsd*-gnu, *-*-gnu*, *-*-kopensolaris*-gnu):
> 	Add to tmake_file rather than overriding it.
>
> Index: libgcc/config.host
> ===================================================================
> --- libgcc/config.host	2011-08-06 15:36:16.000000000 +0100
> +++ libgcc/config.host	2011-08-06 15:36:52.000000000 +0100
> @@ -163,7 +163,7 @@ esac
>  case ${host} in
>  *-*-darwin*)
>    asm_hidden_op=.private_extern
> -  tmake_file="t-darwin ${cpu_type}/t-darwin t-slibgcc-darwin"
> +  tmake_file="$tmake_file t-darwin ${cpu_type}/t-darwin t-slibgcc-darwin"
>    extra_parts=crt3.o
>    ;;
>  *-*-freebsd[12] | *-*-freebsd[12].* | *-*-freebsd*aout*)
> @@ -179,10 +179,10 @@ case ${host} in
>    # This is the generic ELF configuration of FreeBSD.  Later
>    # machine-specific sections may refine and add to this
>    # configuration.
> -  tmake_file=t-eh-dw2-dip
> +  tmake_file="$tmake_file t-eh-dw2-dip"
>    ;;
>  *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu)
> -  tmake_file=t-eh-dw2-dip
> +  tmake_file="$tmake_file t-eh-dw2-dip"
>    extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
>    ;;
>  *-*-netbsd*)

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

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-09 12:52       ` Rainer Orth
@ 2011-08-09 13:15         ` Andreas Schwab
  2011-08-09 14:50           ` Andreas Schwab
  0 siblings, 1 reply; 57+ messages in thread
From: Andreas Schwab @ 2011-08-09 13:15 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gcc-patches

Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> Andreas Schwab <schwab@linux-m68k.org> writes:
>
>> It's already fixed, 'twas the missing ldflags.
>
> I see, so I wasn't the only victim :-)

Unfortunately it didn't really fix it, the undefined symbol is still
present in libgcc_s.so.  I'll experiment with the config file juggling.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-09 13:15         ` Andreas Schwab
@ 2011-08-09 14:50           ` Andreas Schwab
  2011-08-09 15:17             ` Rainer Orth
  0 siblings, 1 reply; 57+ messages in thread
From: Andreas Schwab @ 2011-08-09 14:50 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gcc-patches

The definition of LIB2ADDEH from ia64/t-glibc is supposed to prevail.
I've verified that the resulting libgcc_s.so aggrees with the one
produced by the 4.6 branch.  Checked in as obvious.

Andreas.

2011-08-09  Andreas Schwab  <schwab@linux-m68k.org>

	* config.host (ia64*-*-linux*): Move ia64/t-glibc after
	t-libunwind.

diff --git a/libgcc/config.host b/libgcc/config.host
index d35ee3a..9972bf0 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -472,7 +472,7 @@ ia64*-*-freebsd*)
 	;;
 ia64*-*-linux*)
 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
-	tmake_file="ia64/t-ia64 t-crtfm t-softfp-tf ia64/t-softfp t-softfp ia64/t-softfp-compat ia64/t-glibc ia64/t-eh-ia64 t-libunwind"
+	tmake_file="ia64/t-ia64 t-crtfm t-softfp-tf ia64/t-softfp t-softfp ia64/t-softfp-compat ia64/t-eh-ia64 t-libunwind ia64/t-glibc"
 	if test x$with_system_libunwind != xyes ; then
 		tmake_file="${tmake_file} t-libunwind-elf ia64/t-glibc-libunwind"
 	fi
-- 
1.7.6


-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-09 14:50           ` Andreas Schwab
@ 2011-08-09 15:17             ` Rainer Orth
  0 siblings, 0 replies; 57+ messages in thread
From: Rainer Orth @ 2011-08-09 15:17 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gcc-patches

Andreas,

> The definition of LIB2ADDEH from ia64/t-glibc is supposed to prevail.
> I've verified that the resulting libgcc_s.so aggrees with the one
> produced by the 4.6 branch.  Checked in as obvious.

in that case, ia64/t-eh-ia64 should be removed since it's overridden
completely and only serves to confuse.

Thanks.
        Rainer

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

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-03 13:33 [build] Move unwinder to toplevel libgcc (v2) Rainer Orth
                   ` (5 preceding siblings ...)
  2011-08-06 18:56 ` Richard Sandiford
@ 2011-08-10 13:57 ` Joseph S. Myers
  2011-08-10 14:05   ` Rainer Orth
  6 siblings, 1 reply; 57+ messages in thread
From: Joseph S. Myers @ 2011-08-10 13:57 UTC (permalink / raw)
  To: Rainer Orth
  Cc: gcc-patches, Paolo Bonzini, Ralf Wildenhues, Ian Lance Taylor,
	Steve Ellcey, Richard Earnshaw, Ramana Radhakrishnan,
	Nick Clifton, Douglas Rupp, Tristan Gingold, Mike Stump,
	Kaz Kojima, David Edelsohn, Sterling Augustine, Arnaud Charlet,
	java-patches, Nicola Pero, libstdc++,
	Richard Sandiford

This appears to have brought back PR 26478, build failure with readonly 
source directory:

cp unwind.h ../../.././gcc/include/unwind.h
cp: cannot create regular file `../../.././gcc/include/unwind.h': Permission denied
make[4]: *** [install-unwind_h] Error 1

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-10 13:57 ` Joseph S. Myers
@ 2011-08-10 14:05   ` Rainer Orth
  2011-08-10 14:12     ` Joseph S. Myers
  0 siblings, 1 reply; 57+ messages in thread
From: Rainer Orth @ 2011-08-10 14:05 UTC (permalink / raw)
  To: Joseph S. Myers
  Cc: gcc-patches, Paolo Bonzini, Ralf Wildenhues, Ian Lance Taylor,
	Steve Ellcey, Richard Earnshaw, Ramana Radhakrishnan,
	Nick Clifton, Douglas Rupp, Tristan Gingold, Mike Stump,
	Kaz Kojima, David Edelsohn, Sterling Augustine, Arnaud Charlet,
	java-patches, Nicola Pero, libstdc++,
	Richard Sandiford

"Joseph S. Myers" <joseph@codesourcery.com> writes:

> This appears to have brought back PR 26478, build failure with readonly 
> source directory:
>
> cp unwind.h ../../.././gcc/include/unwind.h
> cp: cannot create regular file `../../.././gcc/include/unwind.h': Permission denied
> make[4]: *** [install-unwind_h] Error 1

This is strange: they copy explicitly goes into $(gcc_objdir): from
libgcc/Makefile.in:

install-unwind_h:
        cp unwind.h $(gcc_objdir)/include/unwind.h
        chmod a+r $(gcc_objdir)/include/unwind.h

For an in-tree build, the source directory cannot be read-only, for a
VPATH build I don't see how this can happen.  Could you please check?

Thanks.
	Rainer

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

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-10 14:05   ` Rainer Orth
@ 2011-08-10 14:12     ` Joseph S. Myers
  2011-08-10 14:29       ` Rainer Orth
  0 siblings, 1 reply; 57+ messages in thread
From: Joseph S. Myers @ 2011-08-10 14:12 UTC (permalink / raw)
  To: Rainer Orth
  Cc: gcc-patches, Paolo Bonzini, Ralf Wildenhues, Ian Lance Taylor,
	Steve Ellcey, Richard Earnshaw, Ramana Radhakrishnan,
	Nick Clifton, Douglas Rupp, Tristan Gingold, Mike Stump,
	Kaz Kojima, David Edelsohn, Sterling Augustine, Arnaud Charlet,
	java-patches, Nicola Pero, libstdc++,
	Richard Sandiford

On Wed, 10 Aug 2011, Rainer Orth wrote:

> "Joseph S. Myers" <joseph@codesourcery.com> writes:
> 
> > This appears to have brought back PR 26478, build failure with readonly 
> > source directory:
> >
> > cp unwind.h ../../.././gcc/include/unwind.h
> > cp: cannot create regular file `../../.././gcc/include/unwind.h': Permission denied
> > make[4]: *** [install-unwind_h] Error 1
> 
> This is strange: they copy explicitly goes into $(gcc_objdir): from
> libgcc/Makefile.in:
> 
> install-unwind_h:
>         cp unwind.h $(gcc_objdir)/include/unwind.h
>         chmod a+r $(gcc_objdir)/include/unwind.h
> 
> For an in-tree build, the source directory cannot be read-only, for a
> VPATH build I don't see how this can happen.  Could you please check?

This is a VPATH build and the issue is that the *file* unwind.h is 
readonly having been copied from a readonly source (and install-unwind_h 
must, I suppose, end up getting called more than once so that the second 
copy tries to copy over a readonly file; the 26478 fix was to remove the 
target of the copy with rm -f before copying).

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-10 14:12     ` Joseph S. Myers
@ 2011-08-10 14:29       ` Rainer Orth
  2011-08-10 15:59         ` Joseph S. Myers
  2011-08-10 16:51         ` Paolo Bonzini
  0 siblings, 2 replies; 57+ messages in thread
From: Rainer Orth @ 2011-08-10 14:29 UTC (permalink / raw)
  To: Joseph S. Myers
  Cc: gcc-patches, Paolo Bonzini, Ralf Wildenhues, Ian Lance Taylor,
	Steve Ellcey, Richard Earnshaw, Ramana Radhakrishnan,
	Nick Clifton, Douglas Rupp, Tristan Gingold, Mike Stump,
	Kaz Kojima, David Edelsohn, Sterling Augustine, Arnaud Charlet,
	java-patches, Nicola Pero, libstdc++,
	Richard Sandiford

"Joseph S. Myers" <joseph@codesourcery.com> writes:

>> This is strange: they copy explicitly goes into $(gcc_objdir): from
>> libgcc/Makefile.in:
>> 
>> install-unwind_h:
>>         cp unwind.h $(gcc_objdir)/include/unwind.h
>>         chmod a+r $(gcc_objdir)/include/unwind.h
>> 
>> For an in-tree build, the source directory cannot be read-only, for a
>> VPATH build I don't see how this can happen.  Could you please check?
>
> This is a VPATH build and the issue is that the *file* unwind.h is 
> readonly having been copied from a readonly source (and install-unwind_h 

I see.  I'd been thinking of a source tree mounted read-only, not the
actual files changed to be read-only.

> must, I suppose, end up getting called more than once so that the second 
> copy tries to copy over a readonly file; the 26478 fix was to remove the 

True: it is called once per multilib.

> target of the copy with rm -f before copying).

Makes sense.  Toplevel dependencies should take care that the file isn't
used by another target library in the small time window between removal
and copy.

Could you try the obvious patch?  It's probably quicker than me
recreating the setup.

Thanks.
	Rainer

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

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-10 14:29       ` Rainer Orth
@ 2011-08-10 15:59         ` Joseph S. Myers
  2011-08-10 16:51         ` Paolo Bonzini
  1 sibling, 0 replies; 57+ messages in thread
From: Joseph S. Myers @ 2011-08-10 15:59 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gcc-patches

On Wed, 10 Aug 2011, Rainer Orth wrote:

> Could you try the obvious patch?  It's probably quicker than me
> recreating the setup.

Actually I think it will be quicker for you to do this test.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-10 14:29       ` Rainer Orth
  2011-08-10 15:59         ` Joseph S. Myers
@ 2011-08-10 16:51         ` Paolo Bonzini
  2011-08-10 16:53           ` Rainer Orth
  1 sibling, 1 reply; 57+ messages in thread
From: Paolo Bonzini @ 2011-08-10 16:51 UTC (permalink / raw)
  To: Rainer Orth
  Cc: Joseph S. Myers, gcc-patches, Ralf Wildenhues, Ian Lance Taylor,
	Steve Ellcey, Richard Earnshaw, Ramana Radhakrishnan,
	Nick Clifton, Douglas Rupp, Tristan Gingold, Mike Stump,
	Kaz Kojima, David Edelsohn, Sterling Augustine, Arnaud Charlet,
	java-patches, Nicola Pero, libstdc++,
	Richard Sandiford

On 08/10/2011 03:56 PM, Rainer Orth wrote:
> "Joseph S. Myers"<joseph@codesourcery.com>  writes:
>
>>> This is strange: they copy explicitly goes into $(gcc_objdir): from
>>> libgcc/Makefile.in:
>>>
>>> install-unwind_h:
>>>          cp unwind.h $(gcc_objdir)/include/unwind.h
>>>          chmod a+r $(gcc_objdir)/include/unwind.h
>>>
>>> For an in-tree build, the source directory cannot be read-only, for a
>>> VPATH build I don't see how this can happen.  Could you please check?
>>
>> This is a VPATH build and the issue is that the *file* unwind.h is
>> readonly having been copied from a readonly source (and install-unwind_h
>
> I see.  I'd been thinking of a source tree mounted read-only, not the
> actual files changed to be read-only.
>
>> must, I suppose, end up getting called more than once so that the second
>> copy tries to copy over a readonly file; the 26478 fix was to remove the
>
> True: it is called once per multilib.

Just to doublecheck, are we sure that unwind.h is always the same?

Paolo

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-10 16:51         ` Paolo Bonzini
@ 2011-08-10 16:53           ` Rainer Orth
  2011-08-10 17:00             ` Paolo Bonzini
  2011-08-10 17:22             ` Pedro Alves
  0 siblings, 2 replies; 57+ messages in thread
From: Rainer Orth @ 2011-08-10 16:53 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Joseph S. Myers, gcc-patches, Ralf Wildenhues, Ian Lance Taylor,
	Steve Ellcey, Richard Earnshaw, Ramana Radhakrishnan,
	Nick Clifton, Douglas Rupp, Tristan Gingold, Mike Stump,
	Kaz Kojima, David Edelsohn, Sterling Augustine, Arnaud Charlet,
	java-patches, Nicola Pero, libstdc++,
	Richard Sandiford

Paolo Bonzini <bonzini@gnu.org> writes:

>> True: it is called once per multilib.
>
> Just to doublecheck, are we sure that unwind.h is always the same?

Yep: it's unwind-generic.h for almost all targets, just a few arm
targets use config/arm/unwind-arm.h for all multilibs.

	Rainer

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

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-10 16:53           ` Rainer Orth
@ 2011-08-10 17:00             ` Paolo Bonzini
  2011-08-11 15:49               ` Rainer Orth
  2011-08-10 17:22             ` Pedro Alves
  1 sibling, 1 reply; 57+ messages in thread
From: Paolo Bonzini @ 2011-08-10 17:00 UTC (permalink / raw)
  To: Rainer Orth
  Cc: Joseph S. Myers, gcc-patches, Ralf Wildenhues, Ian Lance Taylor,
	Steve Ellcey, Richard Earnshaw, Ramana Radhakrishnan,
	Nick Clifton, Douglas Rupp, Tristan Gingold, Mike Stump,
	Kaz Kojima, David Edelsohn, Sterling Augustine, Arnaud Charlet,
	java-patches, Nicola Pero, libstdc++,
	Richard Sandiford

On 08/10/2011 06:05 PM, Rainer Orth wrote:
>>> >>  True: it is called once per multilib.
>> >
>> >  Just to doublecheck, are we sure that unwind.h is always the same?
> Yep: it's unwind-generic.h for almost all targets, just a few arm
> targets use config/arm/unwind-arm.h for all multilibs.

Patch doing rm -f is preapproved then.

Paolo

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-10 16:53           ` Rainer Orth
  2011-08-10 17:00             ` Paolo Bonzini
@ 2011-08-10 17:22             ` Pedro Alves
  2011-08-11 12:31               ` Paolo Bonzini
  1 sibling, 1 reply; 57+ messages in thread
From: Pedro Alves @ 2011-08-10 17:22 UTC (permalink / raw)
  To: gcc-patches
  Cc: Rainer Orth, Paolo Bonzini, Joseph S. Myers, Ralf Wildenhues,
	Ian Lance Taylor, Steve Ellcey, Richard Earnshaw,
	Ramana Radhakrishnan, Nick Clifton, Douglas Rupp,
	Tristan Gingold, Mike Stump, Kaz Kojima, David Edelsohn,
	Sterling Augustine, Arnaud Charlet, java-patches, Nicola Pero,
	libstdc++,
	Richard Sandiford

On Wednesday 10 August 2011 17:05:08, Rainer Orth wrote:
> Paolo Bonzini <bonzini@gnu.org> writes:
> 
> >> True: it is called once per multilib.
> >
> > Just to doublecheck, are we sure that unwind.h is always the same?
> 
> Yep: it's unwind-generic.h for almost all targets, just a few arm
> targets use config/arm/unwind-arm.h for all multilibs.

Doesn't each multilib get its own build subdir?
Can't the file be copied there instead and thus get rid of this wart?

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-10 17:22             ` Pedro Alves
@ 2011-08-11 12:31               ` Paolo Bonzini
  2011-08-11 12:40                 ` Rainer Orth
  0 siblings, 1 reply; 57+ messages in thread
From: Paolo Bonzini @ 2011-08-11 12:31 UTC (permalink / raw)
  To: Pedro Alves
  Cc: gcc-patches, Rainer Orth, Joseph S. Myers, Ralf Wildenhues,
	Ian Lance Taylor, Steve Ellcey, Richard Earnshaw,
	Ramana Radhakrishnan, Nick Clifton, Douglas Rupp,
	Tristan Gingold, Mike Stump, Kaz Kojima, David Edelsohn,
	Sterling Augustine, Arnaud Charlet, java-patches, Nicola Pero,
	libstdc++,
	Richard Sandiford

On 08/10/2011 06:50 PM, Pedro Alves wrote:
> On Wednesday 10 August 2011 17:05:08, Rainer Orth wrote:
>> >  Paolo Bonzini<bonzini@gnu.org>  writes:
>> >
>>>> >  >>  True: it is called once per multilib.
>>> >  >
>>> >  >  Just to doublecheck, are we sure that unwind.h is always the same?
>> >
>> >  Yep: it's unwind-generic.h for almost all targets, just a few arm
>> >  targets use config/arm/unwind-arm.h for all multilibs.
> Doesn't each multilib get its own build subdir?
> Can't the file be copied there instead and thus get rid of this wart?

It would need an additional per-multilib directory in the include path. 
  It's simpler for now to leave it as is, and it will go away as soon as 
nothing in the gcc directory will need unwind.h.  Rainer has already 
removed countless dependencies between gcc and libgcc, adding one is not 
too bad.

Paolo

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-11 12:31               ` Paolo Bonzini
@ 2011-08-11 12:40                 ` Rainer Orth
  2011-08-11 14:50                   ` Joseph S. Myers
  0 siblings, 1 reply; 57+ messages in thread
From: Rainer Orth @ 2011-08-11 12:40 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Pedro Alves, gcc-patches, Joseph S. Myers, Ralf Wildenhues,
	Ian Lance Taylor, Steve Ellcey, Richard Earnshaw,
	Ramana Radhakrishnan, Nick Clifton, Douglas Rupp,
	Tristan Gingold, Mike Stump, Kaz Kojima, David Edelsohn,
	Sterling Augustine, Arnaud Charlet, java-patches, Nicola Pero,
	libstdc++,
	Richard Sandiford

Paolo Bonzini <bonzini@gnu.org> writes:

> On 08/10/2011 06:50 PM, Pedro Alves wrote:
>> On Wednesday 10 August 2011 17:05:08, Rainer Orth wrote:
>>> >  Paolo Bonzini<bonzini@gnu.org>  writes:
>>> >
>>>>> >  >>  True: it is called once per multilib.
>>>> >  >
>>>> >  >  Just to doublecheck, are we sure that unwind.h is always the same?
>>> >
>>> >  Yep: it's unwind-generic.h for almost all targets, just a few arm
>>> >  targets use config/arm/unwind-arm.h for all multilibs.
>> Doesn't each multilib get its own build subdir?
>> Can't the file be copied there instead and thus get rid of this wart?
>
> It would need an additional per-multilib directory in the include
> path. It's simpler for now to leave it as is, and it will go away as soon
> as nothing in the gcc directory will need unwind.h.  Rainer has already
> removed countless dependencies between gcc and libgcc, adding one is not
> too bad.

The actual problem are not the runtime libraries, which already know to
search $builddir/.../libgcc for unwind.h and related files.  The
copyback is only for the benefit of the testsuite (gcc.target, g++.dg,
gnat.dg, and gcc.dg) where I was too lazy to deal with changing (or even
setting ) the include paths, but took the easy way out since gcc/include
is in the include path by default.

	Rainer

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

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-11 12:40                 ` Rainer Orth
@ 2011-08-11 14:50                   ` Joseph S. Myers
  2011-08-11 15:10                     ` Paolo Bonzini
  2011-08-11 15:14                     ` Rainer Orth
  0 siblings, 2 replies; 57+ messages in thread
From: Joseph S. Myers @ 2011-08-11 14:50 UTC (permalink / raw)
  To: Rainer Orth
  Cc: Paolo Bonzini, Pedro Alves, gcc-patches, Ralf Wildenhues,
	Ian Lance Taylor, Steve Ellcey, Richard Earnshaw,
	Ramana Radhakrishnan, Nick Clifton, Douglas Rupp,
	Tristan Gingold, Mike Stump, Kaz Kojima, David Edelsohn,
	Sterling Augustine, Arnaud Charlet, java-patches, Nicola Pero,
	libstdc++,
	Richard Sandiford

On Thu, 11 Aug 2011, Rainer Orth wrote:

> The actual problem are not the runtime libraries, which already know to
> search $builddir/.../libgcc for unwind.h and related files.  The
> copyback is only for the benefit of the testsuite (gcc.target, g++.dg,
> gnat.dg, and gcc.dg) where I was too lazy to deal with changing (or even
> setting ) the include paths, but took the easy way out since gcc/include
> is in the include path by default.

unwind.h is an installed header.  Are you sure nothing outside of GCC uses 
it?

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-11 14:50                   ` Joseph S. Myers
@ 2011-08-11 15:10                     ` Paolo Bonzini
  2011-08-11 15:23                       ` Joseph S. Myers
  2011-08-11 15:14                     ` Rainer Orth
  1 sibling, 1 reply; 57+ messages in thread
From: Paolo Bonzini @ 2011-08-11 15:10 UTC (permalink / raw)
  To: Joseph S. Myers
  Cc: Rainer Orth, Pedro Alves, gcc-patches, Ralf Wildenhues,
	Ian Lance Taylor, Steve Ellcey, Richard Earnshaw,
	Ramana Radhakrishnan, Nick Clifton, Douglas Rupp,
	Tristan Gingold, Mike Stump, Kaz Kojima, David Edelsohn,
	Sterling Augustine, Arnaud Charlet, java-patches, Nicola Pero,
	libstdc++,
	Richard Sandiford

On 08/11/2011 04:25 PM, Joseph S. Myers wrote:
> >  The actual problem are not the runtime libraries, which already know to
> >  search $builddir/.../libgcc for unwind.h and related files.  The
> >  copyback is only for the benefit of the testsuite (gcc.target, g++.dg,
> >  gnat.dg, and gcc.dg) where I was too lazy to deal with changing (or even
> >  setting ) the include paths, but took the easy way out since gcc/include
> >  is in the include path by default.
>
> unwind.h is an installed header.  Are you sure nothing outside of GCC uses
> it?

Why does it matter?  It is still installed in trunk, and you could also 
move the installation to libgcc's Makefiles if it weren't copied anymore 
to $builddir/gcc/include.

Paolo

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-11 14:50                   ` Joseph S. Myers
  2011-08-11 15:10                     ` Paolo Bonzini
@ 2011-08-11 15:14                     ` Rainer Orth
  1 sibling, 0 replies; 57+ messages in thread
From: Rainer Orth @ 2011-08-11 15:14 UTC (permalink / raw)
  To: Joseph S. Myers
  Cc: Paolo Bonzini, Pedro Alves, gcc-patches, Ralf Wildenhues,
	Ian Lance Taylor, Steve Ellcey, Richard Earnshaw,
	Ramana Radhakrishnan, Nick Clifton, Douglas Rupp,
	Tristan Gingold, Mike Stump, Kaz Kojima, David Edelsohn,
	Sterling Augustine, Arnaud Charlet, java-patches, Nicola Pero,
	libstdc++,
	Richard Sandiford

"Joseph S. Myers" <joseph@codesourcery.com> writes:

> On Thu, 11 Aug 2011, Rainer Orth wrote:
>
>> The actual problem are not the runtime libraries, which already know to
>> search $builddir/.../libgcc for unwind.h and related files.  The
>> copyback is only for the benefit of the testsuite (gcc.target, g++.dg,
>> gnat.dg, and gcc.dg) where I was too lazy to deal with changing (or even
>> setting ) the include paths, but took the easy way out since gcc/include
>> is in the include path by default.
>
> unwind.h is an installed header.  Are you sure nothing outside of GCC uses 
> it?

No, I'm not.  On the contrary, the patch that started to install it

	http://gcc.gnu.org/ml/gcc-patches/2003-02/msg01653.html

strongly suggests that it should stay this way.  If the backcopy is
removed some day, once testsuite users have been adapted, it has to be
added to the libgcc install target.

	Rainer

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

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-11 15:10                     ` Paolo Bonzini
@ 2011-08-11 15:23                       ` Joseph S. Myers
  2011-08-11 15:58                         ` Rainer Orth
  0 siblings, 1 reply; 57+ messages in thread
From: Joseph S. Myers @ 2011-08-11 15:23 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Rainer Orth, Pedro Alves, gcc-patches, Ralf Wildenhues,
	Ian Lance Taylor, Steve Ellcey, Richard Earnshaw,
	Ramana Radhakrishnan, Nick Clifton, Douglas Rupp,
	Tristan Gingold, Mike Stump, Kaz Kojima, David Edelsohn,
	Sterling Augustine, Arnaud Charlet, java-patches, Nicola Pero,
	libstdc++,
	Richard Sandiford

On Thu, 11 Aug 2011, Paolo Bonzini wrote:

> On 08/11/2011 04:25 PM, Joseph S. Myers wrote:
> > >  The actual problem are not the runtime libraries, which already know to
> > >  search $builddir/.../libgcc for unwind.h and related files.  The
> > >  copyback is only for the benefit of the testsuite (gcc.target, g++.dg,
> > >  gnat.dg, and gcc.dg) where I was too lazy to deal with changing (or even
> > >  setting ) the include paths, but took the easy way out since gcc/include
> > >  is in the include path by default.
> > 
> > unwind.h is an installed header.  Are you sure nothing outside of GCC uses
> > it?
> 
> Why does it matter?  It is still installed in trunk, and you could also move
> the installation to libgcc's Makefiles if it weren't copied anymore to
> $builddir/gcc/include.

Actually I think the installation of all the installed target headers 
should move to libgcc's Makefiles (and the headers themselves should move 
under the libgcc/ directory).

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-10 17:00             ` Paolo Bonzini
@ 2011-08-11 15:49               ` Rainer Orth
  2011-08-11 19:14                 ` H.J. Lu
  0 siblings, 1 reply; 57+ messages in thread
From: Rainer Orth @ 2011-08-11 15:49 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Joseph S. Myers, gcc-patches, Ralf Wildenhues, Ian Lance Taylor,
	Steve Ellcey, Richard Earnshaw, Ramana Radhakrishnan,
	Nick Clifton, Douglas Rupp, Tristan Gingold, Mike Stump,
	Kaz Kojima, David Edelsohn, Sterling Augustine, Arnaud Charlet,
	java-patches, Nicola Pero, libstdc++,
	Richard Sandiford

Paolo Bonzini <bonzini@gnu.org> writes:

> On 08/10/2011 06:05 PM, Rainer Orth wrote:
>>>> >>  True: it is called once per multilib.
>>> >
>>> >  Just to doublecheck, are we sure that unwind.h is always the same?
>> Yep: it's unwind-generic.h for almost all targets, just a few arm
>> targets use config/arm/unwind-arm.h for all multilibs.
>
> Patch doing rm -f is preapproved then.

Here's what I installed, after making libgcc/unwind-generic.h read-only,
reconfiguring and rebuilding first without and with the patch and
observe the bug gone on i386-pc-solaris2.10.

	Rainer


2011-08-11  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* Makefile.in (install-unwind_h): Remove destination file first.

diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -994,6 +994,7 @@ gcc-extra-parts:
 all: $(extra-parts)
 
 install-unwind_h:
+	rm -f $(gcc_objdir)/include/unwind.h
 	cp unwind.h $(gcc_objdir)/include/unwind.h
 	chmod a+r $(gcc_objdir)/include/unwind.h
 
-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-11 15:23                       ` Joseph S. Myers
@ 2011-08-11 15:58                         ` Rainer Orth
  2011-08-11 16:52                           ` Paolo Bonzini
  0 siblings, 1 reply; 57+ messages in thread
From: Rainer Orth @ 2011-08-11 15:58 UTC (permalink / raw)
  To: Joseph S. Myers
  Cc: Paolo Bonzini, Pedro Alves, gcc-patches, Ralf Wildenhues,
	Ian Lance Taylor, Steve Ellcey, Richard Earnshaw,
	Ramana Radhakrishnan, Nick Clifton, Douglas Rupp,
	Tristan Gingold, Mike Stump, Kaz Kojima, David Edelsohn,
	Sterling Augustine, Arnaud Charlet, java-patches, Nicola Pero,
	libstdc++,
	Richard Sandiford

"Joseph S. Myers" <joseph@codesourcery.com> writes:

> Actually I think the installation of all the installed target headers 
> should move to libgcc's Makefiles (and the headers themselves should move 
> under the libgcc/ directory).

Agreed, added to my ever-growing todo list for the libgcc move.  This
would be

* gcc/ginclude, from gcc/Makefile.in (USER_H),

* extra_headers from gcc/config.gcc, and

* EXTRA_HEADERS from the gcc/config t-* files.

	Rainer

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

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-11 15:58                         ` Rainer Orth
@ 2011-08-11 16:52                           ` Paolo Bonzini
  2011-08-11 17:14                             ` Rainer Orth
  0 siblings, 1 reply; 57+ messages in thread
From: Paolo Bonzini @ 2011-08-11 16:52 UTC (permalink / raw)
  To: Rainer Orth
  Cc: Joseph S. Myers, Pedro Alves, gcc-patches, Ralf Wildenhues,
	Ian Lance Taylor, Steve Ellcey, Richard Earnshaw,
	Ramana Radhakrishnan, Nick Clifton, Douglas Rupp,
	Tristan Gingold, Mike Stump, Kaz Kojima, David Edelsohn,
	Sterling Augustine, Arnaud Charlet, java-patches, Nicola Pero,
	libstdc++,
	Richard Sandiford

On 08/11/2011 05:26 PM, Rainer Orth wrote:
>
>> >  Actually I think the installation of all the installed target headers
>> >  should move to libgcc's Makefiles (and the headers themselves should move
>> >  under the libgcc/ directory).
> Agreed, added to my ever-growing todo list for the libgcc move.  This
> would be
>
> * gcc/ginclude, from gcc/Makefile.in (USER_H),
>
> * extra_headers from gcc/config.gcc, and
>
> * EXTRA_HEADERS from the gcc/config t-* files.

Writing that down in a wiki page (even as unformatted text)  would be 
useful.

Paolo

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-11 16:52                           ` Paolo Bonzini
@ 2011-08-11 17:14                             ` Rainer Orth
  0 siblings, 0 replies; 57+ messages in thread
From: Rainer Orth @ 2011-08-11 17:14 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Joseph S. Myers, Pedro Alves, gcc-patches, Ralf Wildenhues,
	Ian Lance Taylor, Steve Ellcey, Richard Earnshaw,
	Ramana Radhakrishnan, Nick Clifton, Douglas Rupp,
	Tristan Gingold, Mike Stump, Kaz Kojima, David Edelsohn,
	Sterling Augustine, Arnaud Charlet, java-patches, Nicola Pero,
	libstdc++,
	Richard Sandiford

Paolo Bonzini <bonzini@gnu.org> writes:

> Writing that down in a wiki page (even as unformatted text)  would be
> useful.

While I'm not too fond of WiKis, I've added some text to

	http://gcc.gnu.org/wiki/Top-Level_Libgcc_Migration

It's ugly right now, but better than nothing.

	Rainer

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

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-11 15:49               ` Rainer Orth
@ 2011-08-11 19:14                 ` H.J. Lu
  2011-08-11 19:28                   ` H.J. Lu
  2011-08-11 20:40                   ` Paolo Bonzini
  0 siblings, 2 replies; 57+ messages in thread
From: H.J. Lu @ 2011-08-11 19:14 UTC (permalink / raw)
  To: Rainer Orth
  Cc: Paolo Bonzini, Joseph S. Myers, gcc-patches, Ralf Wildenhues,
	Ian Lance Taylor, Steve Ellcey, Richard Earnshaw,
	Ramana Radhakrishnan, Nick Clifton, Douglas Rupp,
	Tristan Gingold, Mike Stump, Kaz Kojima, David Edelsohn,
	Sterling Augustine, Arnaud Charlet, java-patches, Nicola Pero,
	libstdc++,
	Richard Sandiford

On Thu, Aug 11, 2011 at 8:23 AM, Rainer Orth
<ro@cebitec.uni-bielefeld.de> wrote:
> Paolo Bonzini <bonzini@gnu.org> writes:
>
>> On 08/10/2011 06:05 PM, Rainer Orth wrote:
>>>>> >>  True: it is called once per multilib.
>>>> >
>>>> >  Just to doublecheck, are we sure that unwind.h is always the same?
>>> Yep: it's unwind-generic.h for almost all targets, just a few arm
>>> targets use config/arm/unwind-arm.h for all multilibs.
>>
>> Patch doing rm -f is preapproved then.
>
> Here's what I installed, after making libgcc/unwind-generic.h read-only,
> reconfiguring and rebuilding first without and with the patch and
> observe the bug gone on i386-pc-solaris2.10.
>
>        Rainer
>
>
> 2011-08-11  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
>
>        * Makefile.in (install-unwind_h): Remove destination file first.
>
> diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
> --- a/libgcc/Makefile.in
> +++ b/libgcc/Makefile.in
> @@ -994,6 +994,7 @@ gcc-extra-parts:
>  all: $(extra-parts)
>
>  install-unwind_h:
> +       rm -f $(gcc_objdir)/include/unwind.h
>        cp unwind.h $(gcc_objdir)/include/unwind.h
>        chmod a+r $(gcc_objdir)/include/unwind.h
>

It breaks bootstrap with "make -j12" on a 24 core Linux/x86-64  :

http://gcc.gnu.org/ml/gcc-regression/2011-08/msg00179.html

rm -f ../../.././gcc/include/unwind.h
cp unwind.h ../../.././gcc/include/unwind.h
rm -f ../.././gcc/include/unwind.h
chmod a+r ../../.././gcc/include/unwind.h
cp unwind.h ../.././gcc/include/unwind.h
chmod: cannot access `../../.././gcc/include/unwind.h': No such file
or directory
make[8]: *** [install-unwind_h] Error 1
make[8]: *** Waiting for unfinished jobs....
chmod a+r ../.././gcc/include/unwind.h

We may have a race condition here.

-- 
H.J.

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-11 19:14                 ` H.J. Lu
@ 2011-08-11 19:28                   ` H.J. Lu
  2011-08-12  7:39                     ` Paolo Bonzini
  2011-08-11 20:40                   ` Paolo Bonzini
  1 sibling, 1 reply; 57+ messages in thread
From: H.J. Lu @ 2011-08-11 19:28 UTC (permalink / raw)
  To: Rainer Orth; +Cc: GCC Patches

On Thu, Aug 11, 2011 at 11:19 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, Aug 11, 2011 at 8:23 AM, Rainer Orth
> <ro@cebitec.uni-bielefeld.de> wrote:
>> Paolo Bonzini <bonzini@gnu.org> writes:
>>
>>> On 08/10/2011 06:05 PM, Rainer Orth wrote:
>>>>>> >>  True: it is called once per multilib.
>>>>> >
>>>>> >  Just to doublecheck, are we sure that unwind.h is always the same?
>>>> Yep: it's unwind-generic.h for almost all targets, just a few arm
>>>> targets use config/arm/unwind-arm.h for all multilibs.
>>>
>>> Patch doing rm -f is preapproved then.
>>
>> Here's what I installed, after making libgcc/unwind-generic.h read-only,
>> reconfiguring and rebuilding first without and with the patch and
>> observe the bug gone on i386-pc-solaris2.10.
>>
>>        Rainer
>>
>>
>> 2011-08-11  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
>>
>>        * Makefile.in (install-unwind_h): Remove destination file first.
>>
>> diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
>> --- a/libgcc/Makefile.in
>> +++ b/libgcc/Makefile.in
>> @@ -994,6 +994,7 @@ gcc-extra-parts:
>>  all: $(extra-parts)
>>
>>  install-unwind_h:
>> +       rm -f $(gcc_objdir)/include/unwind.h
>>        cp unwind.h $(gcc_objdir)/include/unwind.h
>>        chmod a+r $(gcc_objdir)/include/unwind.h
>>
>
> It breaks bootstrap with "make -j12" on a 24 core Linux/x86-64  :
>
> http://gcc.gnu.org/ml/gcc-regression/2011-08/msg00179.html
>
> rm -f ../../.././gcc/include/unwind.h
> cp unwind.h ../../.././gcc/include/unwind.h
> rm -f ../.././gcc/include/unwind.h
> chmod a+r ../../.././gcc/include/unwind.h
> cp unwind.h ../.././gcc/include/unwind.h
> chmod: cannot access `../../.././gcc/include/unwind.h': No such file
> or directory
> make[8]: *** [install-unwind_h] Error 1
> make[8]: *** Waiting for unfinished jobs....
> chmod a+r ../.././gcc/include/unwind.h
>
> We may have a race condition here.

I opened:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50047


-- 
H.J.

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-11 19:14                 ` H.J. Lu
  2011-08-11 19:28                   ` H.J. Lu
@ 2011-08-11 20:40                   ` Paolo Bonzini
  1 sibling, 0 replies; 57+ messages in thread
From: Paolo Bonzini @ 2011-08-11 20:40 UTC (permalink / raw)
  To: H.J. Lu
  Cc: Rainer Orth, Joseph S. Myers, gcc-patches, Ralf Wildenhues,
	Ian Lance Taylor, Steve Ellcey, Richard Earnshaw,
	Ramana Radhakrishnan, Nick Clifton, Douglas Rupp,
	Tristan Gingold, Mike Stump, Kaz Kojima, David Edelsohn,
	Sterling Augustine, Arnaud Charlet, java-patches, Nicola Pero,
	libstdc++,
	Richard Sandiford

On Thu, Aug 11, 2011 at 20:19, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, Aug 11, 2011 at 8:23 AM, Rainer Orth
> <ro@cebitec.uni-bielefeld.de> wrote:
>> Paolo Bonzini <bonzini@gnu.org> writes:
>>
>>> On 08/10/2011 06:05 PM, Rainer Orth wrote:
>>>>>> >>  True: it is called once per multilib.
>>>>> >
>>>>> >  Just to doublecheck, are we sure that unwind.h is always the same?
>>>> Yep: it's unwind-generic.h for almost all targets, just a few arm
>>>> targets use config/arm/unwind-arm.h for all multilibs.
>>>
>>> Patch doing rm -f is preapproved then.
>>
>> Here's what I installed, after making libgcc/unwind-generic.h read-only,
>> reconfiguring and rebuilding first without and with the patch and
>> observe the bug gone on i386-pc-solaris2.10.
>>
>>        Rainer
>>
>>
>> 2011-08-11  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
>>
>>        * Makefile.in (install-unwind_h): Remove destination file first.
>>
>> diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
>> --- a/libgcc/Makefile.in
>> +++ b/libgcc/Makefile.in
>> @@ -994,6 +994,7 @@ gcc-extra-parts:
>>  all: $(extra-parts)
>>
>>  install-unwind_h:
>> +       rm -f $(gcc_objdir)/include/unwind.h
>>        cp unwind.h $(gcc_objdir)/include/unwind.h
>>        chmod a+r $(gcc_objdir)/include/unwind.h
>>
>
> It breaks bootstrap with "make -j12" on a 24 core Linux/x86-64  :
>
> http://gcc.gnu.org/ml/gcc-regression/2011-08/msg00179.html
>
> rm -f ../../.././gcc/include/unwind.h
> cp unwind.h ../../.././gcc/include/unwind.h
> rm -f ../.././gcc/include/unwind.h
> chmod a+r ../../.././gcc/include/unwind.h
> cp unwind.h ../.././gcc/include/unwind.h
> chmod: cannot access `../../.././gcc/include/unwind.h': No such file
> or directory
> make[8]: *** [install-unwind_h] Error 1
> make[8]: *** Waiting for unfinished jobs....
> chmod a+r ../.././gcc/include/unwind.h
>
> We may have a race condition here.

Will take a look tomorrow.

Paolo

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-11 19:28                   ` H.J. Lu
@ 2011-08-12  7:39                     ` Paolo Bonzini
  2011-08-12 12:27                       ` H.J. Lu
  0 siblings, 1 reply; 57+ messages in thread
From: Paolo Bonzini @ 2011-08-12  7:39 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Rainer Orth, GCC Patches

[-- Attachment #1: Type: text/plain, Size: 2081 bytes --]

On 08/11/2011 08:24 PM, H.J. Lu wrote:
> On Thu, Aug 11, 2011 at 11:19 AM, H.J. Lu<hjl.tools@gmail.com>  wrote:
>> On Thu, Aug 11, 2011 at 8:23 AM, Rainer Orth
>> <ro@cebitec.uni-bielefeld.de>  wrote:
>>> Paolo Bonzini<bonzini@gnu.org>  writes:
>>>
>>>> On 08/10/2011 06:05 PM, Rainer Orth wrote:
>>>>>>>>>   True: it is called once per multilib.
>>>>>>>
>>>>>>>   Just to doublecheck, are we sure that unwind.h is always the same?
>>>>> Yep: it's unwind-generic.h for almost all targets, just a few arm
>>>>> targets use config/arm/unwind-arm.h for all multilibs.
>>>>
>>>> Patch doing rm -f is preapproved then.
>>>
>>> Here's what I installed, after making libgcc/unwind-generic.h read-only,
>>> reconfiguring and rebuilding first without and with the patch and
>>> observe the bug gone on i386-pc-solaris2.10.
>>>
>>>         Rainer
>>>
>>>
>>> 2011-08-11  Rainer Orth<ro@CeBiTec.Uni-Bielefeld.DE>
>>>
>>>         * Makefile.in (install-unwind_h): Remove destination file first.
>>>
>>> diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
>>> --- a/libgcc/Makefile.in
>>> +++ b/libgcc/Makefile.in
>>> @@ -994,6 +994,7 @@ gcc-extra-parts:
>>>   all: $(extra-parts)
>>>
>>>   install-unwind_h:
>>> +       rm -f $(gcc_objdir)/include/unwind.h
>>>         cp unwind.h $(gcc_objdir)/include/unwind.h
>>>         chmod a+r $(gcc_objdir)/include/unwind.h
>>>
>>
>> It breaks bootstrap with "make -j12" on a 24 core Linux/x86-64  :
>>
>> http://gcc.gnu.org/ml/gcc-regression/2011-08/msg00179.html
>>
>> rm -f ../../.././gcc/include/unwind.h
>> cp unwind.h ../../.././gcc/include/unwind.h
>> rm -f ../.././gcc/include/unwind.h
>> chmod a+r ../../.././gcc/include/unwind.h
>> cp unwind.h ../.././gcc/include/unwind.h
>> chmod: cannot access `../../.././gcc/include/unwind.h': No such file
>> or directory
>> make[8]: *** [install-unwind_h] Error 1
>> make[8]: *** Waiting for unfinished jobs....
>> chmod a+r ../.././gcc/include/unwind.h
>>
>> We may have a race condition here.
>
> I opened:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50047

Does the attached patch work?

Paolo

[-- Attachment #2: Makefile.in --]
[-- Type: text/plain, Size: 34764 bytes --]

# Makefile.in

# Copyright (C) 2005, 2006, 2009, 2010, 2011 Free Software Foundation
#
# This file is part of GCC.
#
# GCC is free software; you can redistribute it and/or modify it under the
# terms of the GNU Library General Public License as published by the Free
# Software Foundation; either version 3 of the License, or (at your option)
# any later version.
#
# GCC is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with GCC; see the file COPYING3.  If not see
# <http://www.gnu.org/licenses/>.
#

libgcc_topdir = @libgcc_topdir@
host_subdir = @host_subdir@

gcc_srcdir = $(libgcc_topdir)/gcc
gcc_objdir = $(MULTIBUILDTOP)../../$(host_subdir)/gcc

srcdir = @srcdir@

prefix = @prefix@

exec_prefix = @exec_prefix@
libdir = @libdir@
shlib_slibdir = @slibdir@

SHELL = @SHELL@

cpu_type = @cpu_type@
enable_shared = @enable_shared@
double_type_size = @double_type_size@
long_double_type_size = @long_double_type_size@
decimal_float = @decimal_float@
enable_decimal_float = @enable_decimal_float@
fixed_point = @fixed_point@

host_noncanonical = @host_noncanonical@
target_noncanonical = @target_noncanonical@

# List of extra object files that should be compiled for this target machine.
# The rules for compiling them should be in the t-* file for the machine.
EXTRA_PARTS = @extra_parts@

# Multilib support variables.
MULTISRCTOP =
MULTIBUILDTOP =
MULTIDIRS =
MULTISUBDIR =
MULTIDO = true
MULTICLEAN = true

INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
mkinstalldirs = $(SHELL) $(libgcc_topdir)/mkinstalldirs

objext = .o

AR = @AR@
AR_FLAGS = rc

CC = @CC@
CFLAGS = @CFLAGS@
RANLIB = @RANLIB@
LN_S = @LN_S@

PWD_COMMAND = $${PWDCMD-pwd}

# Flags to pass to a recursive make.
FLAGS_TO_PASS = \
	"AR=$(AR)" \
	"AR_FLAGS=$(AR_FLAGS)" \
	"CC=$(CC)" \
	"CFLAGS=$(CFLAGS)" \
	"DESTDIR=$(DESTDIR)" \
	"EXTRA_OFILES=$(EXTRA_OFILES)" \
	"HDEFINES=$(HDEFINES)" \
	"INSTALL=$(INSTALL)" \
	"INSTALL_DATA=$(INSTALL_DATA)" \
	"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
	"LDFLAGS=$(LDFLAGS)" \
	"LOADLIBES=$(LOADLIBES)" \
	"RANLIB=$(RANLIB)" \
	"SHELL=$(SHELL)" \
	"prefix=$(prefix)" \
	"exec_prefix=$(exec_prefix)" \
	"libdir=$(libdir)" \
	"libsubdir=$(libsubdir)" \
	"tooldir=$(tooldir)"

# Dependencies for "all" are set later in the file.
all: all-multi
	# Now that we have built all the objects, we need to copy
	# them back to the GCC directory.  Too many things (other
	# in-tree libraries, and DejaGNU) know about the layout
	# of the build tree, for now.
	$(MAKE) install-leaf DESTDIR=$(gcc_objdir) \
	  slibdir= libsubdir= MULTIOSDIR=$(MULTIDIR)

.PHONY: all-multi
all-multi:
	# If this is the top-level multilib, build all the other
	# multilibs.
	@: $(MAKE) ; exec $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all

.PHONY: check installcheck
check:
installcheck:

.PHONY: all clean

clean:
	-rm -f config.h stamp-h stmp-ldirs libgcc.map
	-rm -f *$(objext)
	-rm -f *.dep
	-rm -f *.a
	-rm -f libunwind$(SHLIB_EXT)
	-rm -f libgcc_s*
	@$(MULTICLEAN) multi-clean DO=clean
distclean: clean
	@$(MULTICLEAN) multi-clean DO=distclean
	-rm -f *~ Makefile config.cache config.status multilib.out
	-rm -f config.log
maintainer-clean realclean: distclean

Makefile: $(srcdir)/Makefile.in config.status
	CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status

# Depending on Makefile makes sure that config.status has been re-run
# if needed.  This prevents problems with parallel builds.
config.h: stamp-h ; @true
stamp-h: $(srcdir)/config.in config.status Makefile
	CONFIG_FILES= CONFIG_HEADERS=config.h:$(srcdir)/config.in $(SHELL) ./config.status

config.status: $(srcdir)/configure $(srcdir)/config.host
	$(SHELL) ./config.status --recheck

AUTOCONF = autoconf
configure_deps = \
	$(srcdir)/../config/enable.m4 \
	$(srcdir)/../config/tls.m4 \
	$(srcdir)/../config/acx.m4 \
	$(srcdir)/../config/no-executables.m4 \
	$(srcdir)/../config/override.m4 \
	$(srcdir)/../config/dfp.m4 \

$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(configure_deps)
	cd $(srcdir) && $(AUTOCONF)

include $(gcc_objdir)/libgcc.mvars

# Flags to pass to recursive makes.

AR_FOR_TARGET = $(AR)
AR_FLAGS_FOR_TARGET =
AR_CREATE_FOR_TARGET = $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) rc
AR_EXTRACT_FOR_TARGET = $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) x
AWK = @AWK@
GCC_FOR_TARGET = $(CC)
LIPO = @LIPO@
LIPO_FOR_TARGET = $(LIPO)
MACHMODE_H = machmode.h mode-classes.def insn-modes.h
NM = @NM@
NM_FOR_TARGET = $(NM)
RANLIB_FOR_TARGET = $(RANLIB)
STRIP = @STRIP@
STRIP_FOR_TARGET = $(STRIP)

# Directory in which the compiler finds libraries etc.
libsubdir = $(libdir)/gcc/$(host_noncanonical)/$(version)
# Used to install the shared libgcc.
slibdir = @slibdir@
# Maybe used for DLLs on Windows targets.
toolexecdir = @toolexecdir@
toolexeclibdir = @toolexeclibdir@

export AR_FOR_TARGET
export AR_CREATE_FOR_TARGET
export AR_FLAGS_FOR_TARGET
export AR_EXTRACT_FOR_TARGET
export AWK
export DESTDIR
export GCC_FOR_TARGET
export INCLUDES
export INSTALL_DATA
export LIB1ASMSRC
export LIBGCC2_CFLAGS
export LIPO_FOR_TARGET
export MACHMODE_H
export NM_FOR_TARGET
export STRIP_FOR_TARGET
export RANLIB_FOR_TARGET
export libsubdir
export slibdir
export toolexecdir
export toolexeclibdir

version := $(shell $(CC) -dumpversion)

ifeq ($(decimal_float),yes)
ifeq ($(enable_decimal_float),bid)
DECNUMINC = -I$(srcdir)/config/libbid -DENABLE_DECIMAL_BID_FORMAT
else
DECNUMINC = -I$(srcdir)/../libdecnumber/$(enable_decimal_float) \
	    -I$(srcdir)/../libdecnumber
endif
else
DECNUMINC =
endif

# Specify the directories to be searched for header files.
# Both . and srcdir are used, in that order,
# so that *config.h will be found in the compilation
# subdirectory rather than in the source directory.
# -I$(@D) and -I$(srcdir)/$(@D) cause the subdirectory of the file
# currently being compiled, in both source trees, to be examined as well.
INCLUDES = -I. -I$(@D) -I$(gcc_objdir) \
	   -I$(srcdir) -I$(srcdir)/$(@D) -I$(srcdir)/../gcc \
	   -I$(srcdir)/../include $(DECNUMINC)

# Forcibly remove any profiling-related flags.  There is no point
# in supporting profiled bootstrap in this library.
override CFLAGS := $(filter-out -fprofile-generate -fprofile-use,$(CFLAGS))

# CFLAGS first is not perfect; normally setting CFLAGS should override any
# options in LIBGCC2_CFLAGS.  But LIBGCC2_CFLAGS may contain -g0, and CFLAGS
# will usually contain -g, so for the moment CFLAGS goes first.  We must
# include CFLAGS - that's where multilib options live.
INTERNAL_CFLAGS = $(CFLAGS) $(LIBGCC2_CFLAGS) $(HOST_LIBGCC2_CFLAGS) \
		  $(INCLUDES) @set_have_cc_tls@ @set_use_emutls@

MULTIDIR := $(shell $(CC) $(CFLAGS) -print-multi-directory)
MULTIOSDIR := $(shell $(CC) $(CFLAGS) -print-multi-os-directory)

MULTIOSSUBDIR := $(shell if test $(MULTIOSDIR) != .; then echo /$(MULTIOSDIR); fi)
inst_libdir = $(libsubdir)$(MULTISUBDIR)
inst_slibdir = $(slibdir)$(MULTIOSSUBDIR)

gcc_compile_bare = $(CC) $(INTERNAL_CFLAGS)
compile_deps = -MT $@ -MD -MP -MF $(basename $@).dep
gcc_compile = $(gcc_compile_bare) -o $@ $(compile_deps)
gcc_s_compile = $(gcc_compile) -DSHARED

objects = $(filter %$(objext),$^)

# Collect any host-specific information from Makefile fragments.

LIBGCC_VER_GNU_PREFIX = __
LIBGCC_VER_FIXEDPOINT_GNU_PREFIX = __
LIBGCC_VER_SYMBOLS_PREFIX =

FPBIT_FUNCS = _pack_sf _unpack_sf _addsub_sf _mul_sf _div_sf \
    _fpcmp_parts_sf _compare_sf _eq_sf _ne_sf _gt_sf _ge_sf \
    _lt_sf _le_sf _unord_sf _si_to_sf _sf_to_si _negate_sf _make_sf \
    _sf_to_df _sf_to_tf _thenan_sf _sf_to_usi _usi_to_sf

DPBIT_FUNCS = _pack_df _unpack_df _addsub_df _mul_df _div_df \
    _fpcmp_parts_df _compare_df _eq_df _ne_df _gt_df _ge_df \
    _lt_df _le_df _unord_df _si_to_df _df_to_si _negate_df _make_df \
    _df_to_sf _df_to_tf _thenan_df _df_to_usi _usi_to_df

TPBIT_FUNCS = _pack_tf _unpack_tf _addsub_tf _mul_tf _div_tf \
    _fpcmp_parts_tf _compare_tf _eq_tf _ne_tf _gt_tf _ge_tf \
    _lt_tf _le_tf _unord_tf _si_to_tf _tf_to_si _negate_tf _make_tf \
    _tf_to_df _tf_to_sf _thenan_tf _tf_to_usi _usi_to_tf

# Additional sources to handle exceptions; overridden by targets as needed.
LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \
  $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
LIB2ADDEHSTATIC = $(LIB2ADDEH)
LIB2ADDEHSHARED = $(LIB2ADDEH)

# Don't build libunwind by default.
LIBUNWIND =
SHLIBUNWIND_LINK =
SHLIBUNWIND_INSTALL =

tmake_file = @tmake_file@
include $(srcdir)/empty.mk $(tmake_file)

# Collect target defines and headers from config.host.
libgcc_tm_defines = @tm_defines@
libgcc_tm_file = @tm_file@
libgcc_tm.h: libgcc_tm.stamp; @true
libgcc_tm.stamp:
	DEFINES='$(libgcc_tm_defines)' HEADERS='$(libgcc_tm_file)' \
		$(srcdir)/mkheader.sh > tmp-libgcc_tm.h
	$(SHELL) $(srcdir)/../move-if-change tmp-libgcc_tm.h libgcc_tm.h
	echo timestamp > $@

# Only handle shared libraries if both:
#   - the user requested them
#   - we know how to build them
ifeq ($(SHLIB_LINK),)
  enable_shared := no
endif

ifeq ($(enable_shared),yes)
  iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/shared-object.mk,$(iter-items))

  install-shared = install-shared

  ifneq ($(LIBUNWIND),)
    install-libunwind = install-libunwind
  endif

# For -fvisibility=hidden.  We need both a -fvisibility=hidden on
# the command line, and a #define to prevent libgcc2.h etc from
# overriding that with #pragmas.
vis_hide = @vis_hide@

ifneq (,$(vis_hide))

# If we have -fvisibility=hidden, then we need to generate hide
# lists for object files implemented in assembly.
ASM_HIDDEN_OP = @asm_hidden_op@

define gen-hide-list
$(NM) -pg $< | \
  $(AWK) 'NF == 3 && $$2 !~ /^[UN]$$/ && $$3 !~ /.*_compat/ \
         && $$3 !~ /.*@.*/ \
	 { print "\t$(ASM_HIDDEN_OP)", $$3 }' > $@T
mv -f $@T $@
endef
else
gen-hide-list = echo > $@
endif

else
# Not enable_shared.
iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/static-object.mk,$(iter-items))
vis_hide =
gen-hide-list = echo > \$@
endif

ifneq ($(EXTRA_PARTS),)
  extra-parts = libgcc-extra-parts
  INSTALL_PARTS = $(EXTRA_PARTS)
else
ifneq ($(GCC_EXTRA_PARTS),)
  extra-parts = gcc-extra-parts
  INSTALL_PARTS = $(GCC_EXTRA_PARTS)
endif
endif

LIB2ADD += enable-execute-stack.c

LIB2ADDEH += $(srcdir)/emutls.c
LIB2ADDEHSTATIC += $(srcdir)/emutls.c
LIB2ADDEHSHARED += $(srcdir)/emutls.c

# Library members defined in libgcc2.c.
lib2funcs = _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 _cmpdi2 _ucmpdi2	   \
	    _clear_cache _trampoline __main _absvsi2 \
	    _absvdi2 _addvsi3 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 \
	    _negvsi2 _negvdi2 _ctors _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2  \
	    _ctzsi2 _ctzdi2 _popcount_tab _popcountsi2 _popcountdi2	   \
	    _paritysi2 _paritydi2 _powisf2 _powidf2 _powixf2 _powitf2	   \
	    _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3 _divxc3	   \
	    _divtc3 _bswapsi2 _bswapdi2 _clrsbsi2 _clrsbdi2

# The floating-point conversion routines that involve a single-word integer.
# XX stands for the integer mode.
swfloatfuncs = $(patsubst %,_fixuns%XX,sf df xf)

# Likewise double-word routines.
dwfloatfuncs = $(patsubst %,_fix%XX,sf df xf tf) \
	       $(patsubst %,_fixuns%XX,sf df xf tf) \
	       $(patsubst %,_floatXX%,sf df xf tf) \
	       $(patsubst %,_floatunXX%,sf df xf tf)

ifeq ($(LIB2_SIDITI_CONV_FUNCS),)
  lib2funcs += $(subst XX,si,$(swfloatfuncs))
  lib2funcs += $(subst XX,di,$(dwfloatfuncs))
endif

# These might cause a divide overflow trap and so are compiled with
# unwinder info.
LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4

# Remove any objects from lib2funcs and LIB2_DIVMOD_FUNCS that are
# defined as optimized assembly code in LIB1ASMFUNCS or as C code
# in LIB2FUNCS_EXCLUDE.
lib2funcs := $(filter-out $(LIB2FUNCS_EXCLUDE) $(LIB1ASMFUNCS),$(lib2funcs))
LIB2_DIVMOD_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE) $(LIB1ASMFUNCS), \
		       $(LIB2_DIVMOD_FUNCS))

# Build "libgcc1" (assembly) components.
ifeq ($(enable_shared),yes)

lib1asmfuncs-o = $(patsubst %,%$(objext),$(LIB1ASMFUNCS))
$(lib1asmfuncs-o): %$(objext): $(gcc_srcdir)/config/$(LIB1ASMSRC) %.vis
	$(gcc_compile) -DL$* -xassembler-with-cpp \
	  -c $(gcc_srcdir)/config/$(LIB1ASMSRC) -include $*.vis
$(patsubst %,%.vis,$(LIB1ASMFUNCS)): %.vis: %_s$(objext)
	$(gen-hide-list)
libgcc-objects += $(lib1asmfuncs-o)

lib1asmfuncs-s-o = $(patsubst %,%_s$(objext),$(LIB1ASMFUNCS))
$(lib1asmfuncs-s-o): %_s$(objext): $(gcc_srcdir)/config/$(LIB1ASMSRC)
	$(gcc_s_compile) -DL$* -xassembler-with-cpp \
	  -c $(gcc_srcdir)/config/$(LIB1ASMSRC)
libgcc-s-objects += $(lib1asmfuncs-s-o)

else

lib1asmfuncs-o = $(patsubst %,%$(objext),$(LIB1ASMFUNCS))
$(lib1asmfuncs-o): %$(objext): $(gcc_srcdir)/config/$(LIB1ASMSRC)
	$(gcc_compile) -DL$* -xassembler-with-cpp \
	  -c $(gcc_srcdir)/config/$(LIB1ASMSRC)
libgcc-objects += $(lib1asmfuncs-o)

endif

# Build lib2funcs.  For the static library also include LIB2FUNCS_ST.
lib2funcs-o = $(patsubst %,%$(objext),$(lib2funcs) $(LIB2FUNCS_ST))
$(lib2funcs-o): %$(objext): $(gcc_srcdir)/libgcc2.c
	$(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \
	  $(vis_hide)
libgcc-objects += $(lib2funcs-o)

ifeq ($(enable_shared),yes)
lib2funcs-s-o = $(patsubst %,%_s$(objext),$(lib2funcs))
$(lib2funcs-s-o): %_s$(objext): $(gcc_srcdir)/libgcc2.c
	$(gcc_s_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c
libgcc-s-objects += $(lib2funcs-s-o)
endif

ifneq ($(LIB2_SIDITI_CONV_FUNCS),)
# Build libgcc2.c for each conversion function, with a specific
# L<func> definition and LIBGCC2_UNITS_PER_WORD setting.  The DImode
# functions are built with a wordsize of 4; the TImode functions are
# built with the same labels, but a wordsize of 8.

sifuncs := $(filter-out $(LIB2FUNCS_EXCLUDE),$(subst XX,si,$(swfloatfuncs)))
difuncs := $(filter-out $(LIB2FUNCS_EXCLUDE),$(subst XX,di,$(dwfloatfuncs)))
tifuncs := $(filter-out $(LIB2FUNCS_EXCLUDE),$(subst XX,ti,$(dwfloatfuncs)))

iter-items := $(sifuncs) $(difuncs) $(tifuncs)
iter-labels := $(sifuncs) $(difuncs) $(difuncs)
iter-sizes := $(patsubst %,4,$(sifuncs) $(difuncs)) $(patsubst %,8,$(tifuncs))

include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/siditi-object.mk,$(iter-items))

libgcc-objects += $(patsubst %,%$(objext),$(sifuncs) $(difuncs) $(tifuncs))
ifeq ($(enable_shared),yes)
libgcc-s-objects += $(patsubst %,%_s$(objext),$(sifuncs) $(difuncs) $(tifuncs))
endif
endif

# Build LIB2_DIVMOD_FUNCS.
lib2-divmod-o = $(patsubst %,%$(objext),$(LIB2_DIVMOD_FUNCS))
$(lib2-divmod-o): %$(objext): $(gcc_srcdir)/libgcc2.c
	$(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \
	  -fexceptions -fnon-call-exceptions $(vis_hide)
libgcc-objects += $(lib2-divmod-o)

ifeq ($(enable_shared),yes)
lib2-divmod-s-o = $(patsubst %,%_s$(objext),$(LIB2_DIVMOD_FUNCS))
$(lib2-divmod-s-o): %_s$(objext): $(gcc_srcdir)/libgcc2.c
	$(gcc_s_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \
	  -fexceptions -fnon-call-exceptions
libgcc-s-objects += $(lib2-divmod-s-o)
endif

ifeq ($(TPBIT),)
# _sf_to_tf and _df_to_tf require tp-bit.c being compiled in.
FPBIT_FUNCS := $(filter-out _sf_to_tf,$(FPBIT_FUNCS))
DPBIT_FUNCS := $(filter-out _df_to_tf,$(DPBIT_FUNCS))
endif

fpbit-src := $(srcdir)/fp-bit.c

# Build FPBIT.
ifneq ($(FPBIT),)
fpbit-o = $(patsubst %,%$(objext),$(FPBIT_FUNCS))
$(fpbit-o): %$(objext): $(fpbit-src)
	$(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DFLOAT $(FPBIT_CFLAGS) -c $< $(vis_hide)
libgcc-objects += $(fpbit-o)

ifeq ($(enable_shared),yes)
fpbit-s-o = $(patsubst %,%_s$(objext),$(FPBIT_FUNCS))
$(fpbit-s-o): %_s$(objext): $(fpbit-src)
	$(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DFLOAT $(FPBIT_CFLAGS)  -c $<
libgcc-s-objects += $(fpbit-s-o)
endif
endif

# Build DPBIT.
ifneq ($(DPBIT),)
dpbit-o = $(patsubst %,%$(objext),$(DPBIT_FUNCS))
$(dpbit-o): %$(objext): $(fpbit-src)
	$(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* $(DPBIT_CFLAGS) -c $< $(vis_hide)
libgcc-objects += $(dpbit-o)

ifeq ($(enable_shared),yes)
dpbit-s-o = $(patsubst %,%_s$(objext),$(DPBIT_FUNCS))
$(dpbit-s-o): %_s$(objext): $(fpbit-src)
	$(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* $(DPBIT_CFLAGS) -c $<
libgcc-s-objects += $(dpbit-s-o)
endif
endif

# Build TPBIT.
ifneq ($(TPBIT),)
tpbit-o = $(patsubst %,%$(objext),$(TPBIT_FUNCS))
$(tpbit-o): %$(objext): $(fpbit-src)
	$(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DTFLOAT $(TPBIT_CFLAGS) -c $< $(vis_hide)
libgcc-objects += $(tpbit-o)

ifeq ($(enable_shared),yes)
tpbit-s-o = $(patsubst %,%_s$(objext),$(TPBIT_FUNCS))
$(tpbit-s-o): %_s$(objext): $(fpbit-src)
	$(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DTFLOAT $(TPBIT_CFLAGS) -c $<
libgcc-s-objects += $(tpbit-s-o)
endif
endif

# Build decimal floating point support.
ifeq ($(decimal_float),yes)

# If $DFP_ENABLE is set, then we want all data type sizes.
ifneq ($(DFP_ENABLE),)
D32PBIT = 1
D64PBIT = 1
D128PBIT = 1
endif

dfp-filenames =
ifneq ($(D32PBIT)$(D64PBIT)$(D128PBIT),)
ifeq ($(enable_decimal_float),bid)
dfp-filenames += bid_decimal_globals bid_decimal_data \
		 bid_binarydecimal bid_convert_data \
		 _isinfd32 _isinfd64 _isinfd128 bid64_noncomp \
		 bid128_noncomp bid128_fma bid_round bid_from_int \
		 bid64_add bid128_add bid64_div bid128_div \
		 bid64_mul bid128_mul bid64_compare bid128_compare \
		 bid128 bid32_to_bid64 bid32_to_bid128 bid64_to_bid128 \
		 bid64_to_int32 bid64_to_int64 \
		 bid64_to_uint32 bid64_to_uint64 \
		 bid128_to_int32 bid128_to_int64 \
		 bid128_to_uint32 bid128_to_uint64
else
dfp-filenames += decContext decNumber decExcept decRound decLibrary decDouble decPacked decQuad decSingle
endif
endif

dfp-objects = $(patsubst %,%$(objext),$(dfp-filenames))
ifeq ($(enable_decimal_float),bid)
$(dfp-objects): %$(objext): $(srcdir)/config/libbid/%.c
else
$(dfp-objects): %$(objext): $(srcdir)/../libdecnumber/%.c
endif
	$(gcc_compile) -c $<
libgcc-objects += $(dfp-objects)

decbits-filenames =
ifneq ($(enable_decimal_float),bid)
ifneq ($(D32PBIT),)
decbits-filenames += decimal32
endif

ifneq ($(D64PBIT),)
decbits-filenames += decimal64
endif

ifneq ($(D128PBIT),)
decbits-filenames += decimal128
endif
endif

decbits-objects = $(patsubst %,%$(objext),$(decbits-filenames))
ifeq ($(enable_decimal_float),bid)
$(decbits-objects): %$(objext): $(srcdir)/config/libbid/%.c
else
$(decbits-objects): %$(objext): $(srcdir)/../libdecnumber/$(enable_decimal_float)/%.c
endif
	$(gcc_compile) -c $<
libgcc-objects += $(decbits-objects)

# Next build individual support functions.
D32PBIT_FUNCS = _addsub_sd _div_sd _mul_sd _plus_sd _minus_sd \
	_eq_sd _ne_sd _lt_sd _gt_sd _le_sd _ge_sd \
	_sd_to_si _sd_to_di _sd_to_usi _sd_to_udi \
	_si_to_sd _di_to_sd _usi_to_sd _udi_to_sd \
	_sd_to_sf _sd_to_df _sd_to_xf _sd_to_tf \
	_sf_to_sd _df_to_sd _xf_to_sd _tf_to_sd \
	_sd_to_dd _sd_to_td _unord_sd _conv_sd

D64PBIT_FUNCS = _addsub_dd _div_dd _mul_dd _plus_dd _minus_dd \
	_eq_dd _ne_dd _lt_dd _gt_dd _le_dd _ge_dd \
	_dd_to_si _dd_to_di _dd_to_usi _dd_to_udi \
	_si_to_dd _di_to_dd _usi_to_dd _udi_to_dd \
	_dd_to_sf _dd_to_df _dd_to_xf _dd_to_tf \
	_sf_to_dd _df_to_dd _xf_to_dd _tf_to_dd \
	_dd_to_sd _dd_to_td _unord_dd _conv_dd

D128PBIT_FUNCS = _addsub_td _div_td _mul_td _plus_td _minus_td \
	_eq_td _ne_td _lt_td _gt_td _le_td _ge_td \
	_td_to_si _td_to_di _td_to_usi _td_to_udi \
	_si_to_td _di_to_td _usi_to_td _udi_to_td \
	_td_to_sf _td_to_df _td_to_xf _td_to_tf \
	_sf_to_td _df_to_td _xf_to_td _tf_to_td \
	_td_to_sd _td_to_dd _unord_td _conv_td

ifeq ($(enable_decimal_float),bid)
ifneq ($(D32PBIT),)
D32PBIT_FUNCS:=$(filter-out _plus_sd _minus_sd _conv_sd, $(D32PBIT_FUNCS))
endif

ifneq ($(D64PBIT),)
D64PBIT_FUNCS:=$(filter-out _plus_dd _minus_dd _conv_dd, $(D64PBIT_FUNCS))
endif

ifneq ($(D128PBIT),)
D128PBIT_FUNCS:=$(filter-out _plus_td _minus_td _conv_td, $(D128PBIT_FUNCS))
endif
endif

ifneq ($(D32PBIT),)
d32pbit-o = $(patsubst %,%$(objext),$(D32PBIT_FUNCS))
ifeq ($(enable_decimal_float),bid)
$(d32pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
else
$(d32pbit-o): %$(objext): $(srcdir)/dfp-bit.c
endif
	$(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=32 -c $<
libgcc-objects += $(d32pbit-o)
endif

ifneq ($(D64PBIT),)
d64pbit-o = $(patsubst %,%$(objext),$(D64PBIT_FUNCS))
ifeq ($(enable_decimal_float),bid)
$(d64pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
else
$(d64pbit-o): %$(objext): $(srcdir)/dfp-bit.c
endif
	$(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=64 -c $<
libgcc-objects += $(d64pbit-o)
endif

ifneq ($(D128PBIT),)
d128pbit-o = $(patsubst %,%$(objext),$(D128PBIT_FUNCS))
ifeq ($(enable_decimal_float),bid)
$(d128pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
else
$(d128pbit-o): %$(objext): $(srcdir)/dfp-bit.c
endif
	$(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=128 -c $<
libgcc-objects += $(d128pbit-o)
endif

endif

ifeq ($(SYNC),yes)
libgcc-sync-size-funcs := $(foreach op, add sub or and xor nand, \
			    sync_fetch_and_$(op) \
			    sync_$(op)_and_fetch) \
			  sync_bool_compare_and_swap \
			  sync_val_compare_and_swap \
			  sync_lock_test_and_set

libgcc-sync-size-funcs := $(foreach prefix, $(libgcc-sync-size-funcs), \
			    $(foreach suffix, 1 2 4 8 16, \
			      $(prefix)_$(suffix)))

libgcc-sync-size-funcs-o = $(patsubst %,%$(objext),$(libgcc-sync-size-funcs))
$(libgcc-sync-size-funcs-o): %$(objext): $(srcdir)/sync.c
	$(gcc_compile) $(SYNC_CFLAGS) \
	  -DFN=`echo "$*" | sed 's/_[^_]*$$//'` \
	  -DSIZE=`echo "$*" | sed 's/.*_//'` \
	  -c $< $(vis_hide)
libgcc-objects += $(libgcc-sync-size-funcs-o)

libgcc-sync-funcs := sync_synchronize

libgcc-sync-funcs-o = $(patsubst %,%$(objext),$(libgcc-sync-funcs))
$(libgcc-sync-funcs-o): %$(objext): $(srcdir)/sync.c
	$(gcc_compile) $(SYNC_CFLAGS) \
	  -DL$* \
	  -c $< $(vis_hide)
libgcc-objects += $(libgcc-sync-funcs-o)

ifeq ($(enable_shared),yes)
libgcc-sync-size-funcs-s-o = $(patsubst %,%_s$(objext), \
			       $(libgcc-sync-size-funcs))
$(libgcc-sync-size-funcs-s-o): %_s$(objext): $(srcdir)/sync.c
	$(gcc_s_compile) $(SYNC_CFLAGS) \
	  -DFN=`echo "$*" | sed 's/_[^_]*$$//'` \
	  -DSIZE=`echo "$*" | sed 's/.*_//'` \
	  -c $<
libgcc-s-objects += $(libgcc-sync-size-funcs-s-o)

libgcc-sync-funcs-s-o = $(patsubst %,%_s$(objext),$(libgcc-sync-funcs))
$(libgcc-sync-funcs-s-o): %_s$(objext): $(srcdir)/sync.c
	$(gcc_s_compile) $(SYNC_CFLAGS) \
	  -DL$*	\
	  -c $<
libgcc-s-objects += $(libgcc-sync-funcs-s-o)
endif
endif

# Build fixed-point support.
ifeq ($(fixed_point),yes)

# Generate permutations of function name and mode
fixed-labels := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith labels)
fixed-funcs := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith funcs)
fixed-modes := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith modes)

# Generate the rules for each arithmetic function
iter-items := $(fixed-funcs)
iter-labels := $(fixed-labels)
iter-from := $(fixed-modes)
iter-to := $(fixed-modes)
include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/fixed-obj.mk,$(iter-items))

# Add arithmetic functions to list of objects to be built
libgcc-objects += $(patsubst %,%$(objext),$(fixed-funcs))
ifeq ($(enable_shared),yes)
libgcc-s-objects += $(patsubst %,%_s$(objext),$(fixed-funcs))
endif

# Convert from or to fractional
fixed-conv-funcs := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv funcs)
fixed-conv-labels := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv labels)
fixed-conv-from := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv from)
fixed-conv-to :=  $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv to)

# Generate the make rules for each conversion function
iter-items := $(fixed-conv-funcs)
iter-labels := $(fixed-conv-labels)
iter-from := $(fixed-conv-from)
iter-to := $(fixed-conv-to)
include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/fixed-obj.mk,$(iter-items))

# Add conversion functions to list of objects to be built
libgcc-objects += $(patsubst %,%$(objext),$(fixed-conv-funcs))
ifeq ($(enable_shared),yes)
libgcc-s-objects += $(patsubst %,%_s$(objext),$(fixed-conv-funcs))
endif

endif

# Build LIB2ADD and LIB2ADD_ST.
ifneq ($(filter-out %.c %.S %.asm,$(LIB2ADD) $(LIB2ADD_ST)),)
$(error Unsupported files in LIB2ADD or LIB2ADD_ST.)
endif

libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD))))
libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD_ST))))

c_flags :=
iter-items := $(LIB2ADD) $(LIB2ADD_ST)
include $(iterator)

ifeq ($(enable_shared),yes)
libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADD))))
endif

# Build LIB2ADDEH, LIB2ADDEHSTATIC, and LIB2ADDEHSHARED.  If we don't have
# libgcc_eh.a, only LIB2ADDEH matters.  If we do, only LIB2ADDEHSTATIC and
# LIB2ADDEHSHARED matter.  (Usually all three are identical.)

c_flags := -fexceptions

ifeq ($(enable_shared),yes)

libgcc-eh-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEHSTATIC))))
libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADDEHSHARED))))

iter-items := $(sort $(LIB2ADDEHSTATIC) $(LIB2ADDEHSHARED))
include $(iterator)

else
# Not shared.  LIB2ADDEH are added to libgcc.a.

libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEH))))

iter-items := $(LIB2ADDEH)
include $(iterator)

endif

# Build LIBUNWIND.

c_flags := -fexceptions

libunwind-objects += $(addsuffix $(objext),$(basename $(notdir $(LIBUNWIND))))

ifeq ($(enable_shared),yes)
libunwind-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIBUNWIND))))
endif

iter-items := $(LIBUNWIND)
include $(iterator)

# Build libgcov components.

# Defined in libgcov.c, included only in gcov library
LIBGCOV = _gcov _gcov_merge_add _gcov_merge_single _gcov_merge_delta \
    _gcov_fork _gcov_execl _gcov_execlp _gcov_execle \
    _gcov_execv _gcov_execvp _gcov_execve \
    _gcov_interval_profiler _gcov_pow2_profiler _gcov_one_value_profiler \
    _gcov_indirect_call_profiler _gcov_average_profiler _gcov_ior_profiler \
    _gcov_merge_ior

libgcov-objects = $(patsubst %,%$(objext),$(LIBGCOV))

$(libgcov-objects): %$(objext): $(srcdir)/libgcov.c
	$(gcc_compile) -DL$* -c $(srcdir)/libgcov.c


# Static libraries.
libgcc.a: $(libgcc-objects)
libgcov.a: $(libgcov-objects)
libunwind.a: $(libunwind-objects)
libgcc_eh.a: $(libgcc-eh-objects)

libgcc.a libgcov.a libunwind.a libgcc_eh.a:
	-rm -f $@

	objects="$(objects)";					\
	if test -z "$$objects"; then				\
	  echo 'int __libgcc_eh_dummy;' > eh_dummy.c;		\
	  $(gcc_compile_bare) $(vis_hide) -c eh_dummy.c		\
	     -o eh_dummy$(objext);				\
	  objects=eh_dummy$(objext);				\
	fi;							\
	$(AR_CREATE_FOR_TARGET) $@ $$objects

	$(RANLIB) $@

all: libgcc.a libgcov.a

ifneq ($(LIBUNWIND),)
all: libunwind.a
libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
endif

ifeq ($(enable_shared),yes)
all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
ifneq ($(LIBUNWIND),)
all: libunwind$(SHLIB_EXT)
endif
endif

ifeq ($(enable_shared),yes)

# Map-file generation.
ifneq ($(SHLIB_MKMAP),)
libgcc.map: $(SHLIB_MKMAP) $(SHLIB_MAPFILES) $(libgcc-s-objects)
	{ $(NM) $(SHLIB_NM_FLAGS) $(libgcc-s-objects); echo %%; \
	  cat $(SHLIB_MAPFILES) \
	    | sed -e '/^[ 	]*#/d' \
		  -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \
	    | $(gcc_compile_bare) -E -xassembler-with-cpp -; \
	} | $(AWK) -f $(SHLIB_MKMAP) $(SHLIB_MKMAP_OPTS) > tmp-$@
	mv tmp-$@ $@
libgcc_s$(SHLIB_EXT): libgcc.map
mapfile = libgcc.map
endif

libgcc-std.ver: $(srcdir)/libgcc-std.ver.in
	sed -e 's/__PFX__/$(LIBGCC_VER_GNU_PREFIX)/g' \
	    -e 's/__FIXPTPFX__/$(LIBGCC_VER_FIXEDPOINT_GNU_PREFIX)/g' < $< > $@

libgcc_s$(SHLIB_EXT): $(libgcc-s-objects) $(extra-parts)
	# @multilib_flags@ is still needed because this may use
	# $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly.
	# @multilib_dir@ is not really necessary, but sometimes it has
	# more uses than just a directory name.
	$(mkinstalldirs) $(MULTIDIR)
	$(subst @multilib_flags@,$(CFLAGS) -B./,$(subst \
		@multilib_dir@,$(MULTIDIR),$(subst \
		@shlib_objs@,$(objects),$(subst \
		@shlib_base_name@,libgcc_s,$(subst \
		@shlib_map_file@,$(mapfile),$(subst \
		@shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(subst \
		@shlib_slibdir@,$(shlib_slibdir),$(SHLIB_LINK))))))))

libunwind$(SHLIB_EXT): $(libunwind-s-objects) $(extra-parts)
	# @multilib_flags@ is still needed because this may use
	# $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly.
	# @multilib_dir@ is not really necessary, but sometimes it has
	# more uses than just a directory name.
	$(mkinstalldirs) $(MULTIDIR)
	$(subst @multilib_flags@,$(CFLAGS) -B./,$(subst \
		@multilib_dir@,$(MULTIDIR),$(subst \
		@shlib_objs@,$(objects),$(subst \
		@shlib_base_name@,libunwind,$(subst \
		@shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIBUNWIND_LINK))))))

endif

# Build the standard GCC startfiles and endfiles.
ALL_CRT_CFLAGS = $(CFLAGS) $(CRTSTUFF_CFLAGS) $(INCLUDES)
crt_compile = $(CC) $(ALL_CRT_CFLAGS) -o $@ $(compile_deps)

ifeq ($(CUSTOM_CRTSTUFF),)
crtbegin$(objext): $(gcc_srcdir)/crtstuff.c
	$(crt_compile) $(CRTSTUFF_T_CFLAGS) \
	  -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN

crtend$(objext): $(gcc_srcdir)/crtstuff.c
	$(crt_compile) $(CRTSTUFF_T_CFLAGS) \
	  -c $(gcc_srcdir)/crtstuff.c -DCRT_END

# These are versions of crtbegin and crtend for shared libraries.
crtbeginS$(objext): $(gcc_srcdir)/crtstuff.c
	$(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \
	  -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFS_O

crtendS$(objext): $(gcc_srcdir)/crtstuff.c
	$(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \
	  -c $(gcc_srcdir)/crtstuff.c -DCRT_END -DCRTSTUFFS_O

# This is a version of crtbegin for -static links.
crtbeginT.o: $(gcc_srcdir)/crtstuff.c
	$(crt_compile) $(CRTSTUFF_T_CFLAGS) \
	  -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O
endif

# Build extra startfiles in the libgcc directory.
.PHONY: libgcc-extra-parts
libgcc-extra-parts: $(EXTRA_PARTS)
ifneq ($(GCC_EXTRA_PARTS),)
ifneq ($(sort $(EXTRA_PARTS)),$(GCC_EXTRA_PARTS))
	# If the gcc directory specifies which extra parts to
	# build for this target, and the libgcc configuration also
	# specifies, make sure they match.  This can be removed
	# when the gcc directory no longer holds libgcc configuration;
	# it is useful when migrating a target.
	@echo "Configuration mismatch!"
	@echo "Extra parts from gcc directory: $(GCC_EXTRA_PARTS)"
	@echo "Extra parts from libgcc: $(EXTRA_PARTS)"
	exit 1
endif
endif

	# Early copyback; see "all" above for the rationale.  The
	# early copy is necessary so that the gcc -B options find
	# the right startup files when linking shared libgcc.
	$(mkinstalldirs) $(gcc_objdir)$(MULTISUBDIR)
	parts="$(EXTRA_PARTS)";					\
	for file in $$parts; do					\
	  rm -f $(gcc_objdir)$(MULTISUBDIR)/$$file;		\
	  $(INSTALL_DATA) $$file $(gcc_objdir)$(MULTISUBDIR)/;	\
	  case $$file in 					\
	    *.a)						\
	      $(RANLIB) $(gcc_objdir)$(MULTISUBDIR)/$$file ;;	\
	  esac;							\
	done

# Build extra startfiles in the gcc directory, for unconverted
# targets.
.PHONY: gcc-extra-parts
gcc-extra-parts:
	# Recursively invoke make in the GCC directory to build any
	# startfiles (for now).  We must do this just once, passing
	# it all the GCC_EXTRA_PARTS as simultaneous goal targets,
	# so that rules which cannot execute simultaneously are properly
	# serialized.  We indirect through T_TARGET in case any multilib
	# directories contain an equals sign, to prevent make from
	# interpreting any of the goals as variable assignments.

	# We must use cd && make rather than make -C, or else the stage
	# number will be embedded in debug information.

	T=`$(PWD_COMMAND)`/ \
	&& cd $(gcc_objdir) \
	&& $(MAKE) GCC_FOR_TARGET="$(CC)" \
	  MULTILIB_CFLAGS="$(CFLAGS)" \
	  T=$$T \
	  T_TARGET="$(patsubst %,$${T}%,$(GCC_EXTRA_PARTS))" \
	  T_TARGET

	# Early copyback; see "all" above for the rationale.  The
	# early copy is necessary so that the gcc -B options find
	# the right startup files when linking shared libgcc.
	$(mkinstalldirs) $(gcc_objdir)$(MULTISUBDIR)
	parts="$(GCC_EXTRA_PARTS)";				\
	for file in $$parts; do					\
	  rm -f $(gcc_objdir)$(MULTISUBDIR)/$$file;		\
	  $(INSTALL_DATA) $$file $(gcc_objdir)$(MULTISUBDIR)/;	\
	  case $$file in 					\
	    *.a)						\
	      $(RANLIB) $(gcc_objdir)$(MULTISUBDIR)/$$file ;;	\
	  esac;							\
	done

all: $(extra-parts)

install-unwind_h:
	rm -f $(gcc_objdir)/include/tmp-unwind.h
	cp unwind.h $(gcc_objdir)/include/tmp-unwind.h
	chmod a+r $(gcc_objdir)/include/tmp-unwind.h
	sh $(srcdir)/../move-if-change \
		$(gcc_objdir)/include/tmp-unwind.h \
		$(gcc_objdir)/include/unwind.h

all: install-unwind_h

# Documentation targets (empty).
.PHONY: info html dvi pdf install-info install-html install-pdf

info:
install-info:
html:
install-html:
dvi:
pdf:
install-pdf:

# Install rules.  These do not depend on "all", so that they can be invoked
# recursively from it.
install-libunwind:
	$(mkinstalldirs) $(DESTDIR)$(inst_slibdir)

	# NOTE: Maybe this should go into $(inst_libdir), but this
	# is where the old mklibgcc.in put it.
	$(INSTALL_DATA) libunwind.a $(DESTDIR)$(inst_slibdir)/
	chmod 644 $(DESTDIR)$(inst_slibdir)/libunwind.a
	$(RANLIB) $(DESTDIR)$(inst_slibdir)/libunwind.a

	$(subst @multilib_dir@,$(MULTIDIR),$(subst \
		@shlib_base_name@,libunwind,$(subst \
		@shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIBUNWIND_INSTALL))))

install-shared:
	$(mkinstalldirs) $(DESTDIR)$(inst_libdir)

	$(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/
	chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
	$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a

	$(subst @multilib_dir@,$(MULTIDIR),$(subst \
		@shlib_base_name@,libgcc_s,$(subst \
		@shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))

install-leaf: $(install-shared) $(install-libunwind)
	$(mkinstalldirs) $(DESTDIR)$(inst_libdir)

	$(INSTALL_DATA) libgcc.a $(DESTDIR)$(inst_libdir)/
	chmod 644 $(DESTDIR)$(inst_libdir)/libgcc.a
	$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc.a
	$(INSTALL_DATA) libgcov.a $(DESTDIR)$(inst_libdir)/
	chmod 644 $(DESTDIR)$(inst_libdir)/libgcov.a
	$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a

	parts="$(INSTALL_PARTS)";				\
	for file in $$parts; do					\
	  rm -f $(DESTDIR)$(inst_libdir)/$$file;		\
	  $(INSTALL_DATA) $$file $(DESTDIR)$(inst_libdir)/;	\
	  case $$file in 					\
	    *.a)						\
	      $(RANLIB) $(gcc_objdir)$(MULTISUBDIR)/$$file ;;	\
	  esac;							\
	done

install: install-leaf
	@: $(MAKE) ; $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install

install-strip: install

.PHONY: install install-shared install-libunwind install-strip

# Don't export variables to the environment, in order to not confuse
# configure.
.NOEXPORT:

include $(srcdir)/empty.mk $(wildcard *.dep)

# TODO QUEUE:
#   Garbage collect in gcc/:
#     $(LIBGCC) settings in t-* are now unused
#
#   Remove use of $(gcc_srcdir).  Source files referenced using $(gcc_srcdir)
#   should move into the libgcc directory.


^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-12  7:39                     ` Paolo Bonzini
@ 2011-08-12 12:27                       ` H.J. Lu
  2011-08-12 12:59                         ` Paolo Bonzini
  0 siblings, 1 reply; 57+ messages in thread
From: H.J. Lu @ 2011-08-12 12:27 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Rainer Orth, GCC Patches

On Fri, Aug 12, 2011 at 12:04 AM, Paolo Bonzini <bonzini@gnu.org> wrote:
> On 08/11/2011 08:24 PM, H.J. Lu wrote:
>>
>> On Thu, Aug 11, 2011 at 11:19 AM, H.J. Lu<hjl.tools@gmail.com>  wrote:
>>>
>>> On Thu, Aug 11, 2011 at 8:23 AM, Rainer Orth
>>> <ro@cebitec.uni-bielefeld.de>  wrote:
>>>>
>>>> Paolo Bonzini<bonzini@gnu.org>  writes:
>>>>
>>>>> On 08/10/2011 06:05 PM, Rainer Orth wrote:
>>>>>>>>>>
>>>>>>>>>>  True: it is called once per multilib.
>>>>>>>>
>>>>>>>>  Just to doublecheck, are we sure that unwind.h is always the same?
>>>>>>
>>>>>> Yep: it's unwind-generic.h for almost all targets, just a few arm
>>>>>> targets use config/arm/unwind-arm.h for all multilibs.
>>>>>
>>>>> Patch doing rm -f is preapproved then.
>>>>
>>>> Here's what I installed, after making libgcc/unwind-generic.h read-only,
>>>> reconfiguring and rebuilding first without and with the patch and
>>>> observe the bug gone on i386-pc-solaris2.10.
>>>>
>>>>        Rainer
>>>>
>>>>
>>>> 2011-08-11  Rainer Orth<ro@CeBiTec.Uni-Bielefeld.DE>
>>>>
>>>>        * Makefile.in (install-unwind_h): Remove destination file first.
>>>>
>>>> diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
>>>> --- a/libgcc/Makefile.in
>>>> +++ b/libgcc/Makefile.in
>>>> @@ -994,6 +994,7 @@ gcc-extra-parts:
>>>>  all: $(extra-parts)
>>>>
>>>>  install-unwind_h:
>>>> +       rm -f $(gcc_objdir)/include/unwind.h
>>>>        cp unwind.h $(gcc_objdir)/include/unwind.h
>>>>        chmod a+r $(gcc_objdir)/include/unwind.h
>>>>
>>>
>>> It breaks bootstrap with "make -j12" on a 24 core Linux/x86-64  :
>>>
>>> http://gcc.gnu.org/ml/gcc-regression/2011-08/msg00179.html
>>>
>>> rm -f ../../.././gcc/include/unwind.h
>>> cp unwind.h ../../.././gcc/include/unwind.h
>>> rm -f ../.././gcc/include/unwind.h
>>> chmod a+r ../../.././gcc/include/unwind.h
>>> cp unwind.h ../.././gcc/include/unwind.h
>>> chmod: cannot access `../../.././gcc/include/unwind.h': No such file
>>> or directory
>>> make[8]: *** [install-unwind_h] Error 1
>>> make[8]: *** Waiting for unfinished jobs....
>>> chmod a+r ../.././gcc/include/unwind.h
>>>
>>> We may have a race condition here.
>>
>> I opened:
>>
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50047
>
> Does the attached patch work?
>

Can you provide a patch instead of the whole Makefile.in?


-- 
H.J.

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-12 12:27                       ` H.J. Lu
@ 2011-08-12 12:59                         ` Paolo Bonzini
  2011-08-12 13:47                           ` Pedro Alves
  0 siblings, 1 reply; 57+ messages in thread
From: Paolo Bonzini @ 2011-08-12 12:59 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Rainer Orth, GCC Patches

[-- Attachment #1: Type: text/plain, Size: 292 bytes --]

On 08/12/2011 02:13 PM, H.J. Lu wrote:
>>>> We may have a race condition here.
>>>
>>> I opened:
>>>
>>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50047
>>
>> Does the attached patch work?
>
> Can you provide a patch instead of the whole Makefile.in?

Sorry, that was not intended.

Paolo


[-- Attachment #2: fff.patch --]
[-- Type: text/x-patch, Size: 676 bytes --]

2011-08-12  Paolo Bonzini  <bonzini@gnu.org>

	* Makefile.in (install-unwind_h): Create $(gcc_objdir)/include/unwind.h
	atomically.

Index: Makefile.in
===================================================================
--- Makefile.in	(revision 177688)
+++ Makefile.in	(working copy)
@@ -991,8 +1001,10 @@ gcc-extra-parts:
 all: $(extra-parts)
 
 install-unwind_h:
-	rm -f $(gcc_objdir)/include/unwind.h
-	cp unwind.h $(gcc_objdir)/include/unwind.h
+	cp unwind.h $(gcc_objdir)/include/tmp-unwind.h
+	sh $(srcdir)/../move-if-change \
+		$(gcc_objdir)/include/tmp-unwind.h \
+		$(gcc_objdir)/include/unwind.h
 	chmod a+r $(gcc_objdir)/include/unwind.h
 
 all: install-unwind_h

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-12 12:59                         ` Paolo Bonzini
@ 2011-08-12 13:47                           ` Pedro Alves
  2011-08-12 13:53                             ` H.J. Lu
  0 siblings, 1 reply; 57+ messages in thread
From: Pedro Alves @ 2011-08-12 13:47 UTC (permalink / raw)
  To: gcc-patches; +Cc: Paolo Bonzini, H.J. Lu, Rainer Orth

On Friday 12 August 2011 13:17:21, Paolo Bonzini wrote:
>   2011-08-12  Paolo Bonzini  <bonzini@gnu.org>
> 
>         * Makefile.in (install-unwind_h): Create $(gcc_objdir)/include/unwind.h
>         atomically.
> 
> Index: Makefile.in
> ===================================================================
> --- Makefile.in (revision 177688)
> +++ Makefile.in (working copy)
> @@ -991,8 +1001,10 @@ gcc-extra-parts:
>  all: $(extra-parts)
>  
>  install-unwind_h:
> -       rm -f $(gcc_objdir)/include/unwind.h
> -       cp unwind.h $(gcc_objdir)/include/unwind.h
> +       cp unwind.h $(gcc_objdir)/include/tmp-unwind.h
> +       sh $(srcdir)/../move-if-change \
> +               $(gcc_objdir)/include/tmp-unwind.h \
> +               $(gcc_objdir)/include/unwind.h
>         chmod a+r $(gcc_objdir)/include/unwind.h
>  

Can't this sequence happen?

proc1:       cp unwind.h $(gcc_objdir)/include/tmp-unwind.h
proc2:       cp unwind.h $(gcc_objdir)/include/tmp-unwind.h
proc1:       sh $(srcdir)/../move-if-change \
               $(gcc_objdir)/include/tmp-unwind.h \
               $(gcc_objdir)/include/unwind.h
proc2:       sh $(srcdir)/../move-if-change \
               $(gcc_objdir)/include/tmp-unwind.h \
               $(gcc_objdir)/include/unwind.h

It sounds like the latter move-if-change could trip on
a non-extant tmp-unwind.h.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-12 13:47                           ` Pedro Alves
@ 2011-08-12 13:53                             ` H.J. Lu
  2011-08-12 16:18                               ` Paolo Bonzini
  0 siblings, 1 reply; 57+ messages in thread
From: H.J. Lu @ 2011-08-12 13:53 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gcc-patches, Paolo Bonzini, Rainer Orth

On Fri, Aug 12, 2011 at 5:38 AM, Pedro Alves <pedro@codesourcery.com> wrote:
> On Friday 12 August 2011 13:17:21, Paolo Bonzini wrote:
>>   2011-08-12  Paolo Bonzini  <bonzini@gnu.org>
>>
>>         * Makefile.in (install-unwind_h): Create $(gcc_objdir)/include/unwind.h
>>         atomically.
>>
>> Index: Makefile.in
>> ===================================================================
>> --- Makefile.in (revision 177688)
>> +++ Makefile.in (working copy)
>> @@ -991,8 +1001,10 @@ gcc-extra-parts:
>>  all: $(extra-parts)
>>
>>  install-unwind_h:
>> -       rm -f $(gcc_objdir)/include/unwind.h
>> -       cp unwind.h $(gcc_objdir)/include/unwind.h
>> +       cp unwind.h $(gcc_objdir)/include/tmp-unwind.h
>> +       sh $(srcdir)/../move-if-change \
>> +               $(gcc_objdir)/include/tmp-unwind.h \
>> +               $(gcc_objdir)/include/unwind.h
>>         chmod a+r $(gcc_objdir)/include/unwind.h
>>
>
> Can't this sequence happen?
>
> proc1:       cp unwind.h $(gcc_objdir)/include/tmp-unwind.h
> proc2:       cp unwind.h $(gcc_objdir)/include/tmp-unwind.h
> proc1:       sh $(srcdir)/../move-if-change \
>               $(gcc_objdir)/include/tmp-unwind.h \
>               $(gcc_objdir)/include/unwind.h
> proc2:       sh $(srcdir)/../move-if-change \
>               $(gcc_objdir)/include/tmp-unwind.h \
>               $(gcc_objdir)/include/unwind.h
>
> It sounds like the latter move-if-change could trip on
> a non-extant tmp-unwind.h.
>

Yes, we should use an unique tmp unwind.h.


-- 
H.J.

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-12 13:53                             ` H.J. Lu
@ 2011-08-12 16:18                               ` Paolo Bonzini
  2011-08-12 16:25                                 ` H.J. Lu
  2011-08-12 16:44                                 ` Pedro Alves
  0 siblings, 2 replies; 57+ messages in thread
From: Paolo Bonzini @ 2011-08-12 16:18 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Pedro Alves, gcc-patches, Rainer Orth

[-- Attachment #1: Type: text/plain, Size: 637 bytes --]

>> Can't this sequence happen?
>>
>> proc1:       cp unwind.h $(gcc_objdir)/include/tmp-unwind.h
>> proc2:       cp unwind.h $(gcc_objdir)/include/tmp-unwind.h
>> proc1:       sh $(srcdir)/../move-if-change \
>>                $(gcc_objdir)/include/tmp-unwind.h \
>>                $(gcc_objdir)/include/unwind.h
>> proc2:       sh $(srcdir)/../move-if-change \
>>                $(gcc_objdir)/include/tmp-unwind.h \
>>                $(gcc_objdir)/include/unwind.h
>>
>> It sounds like the latter move-if-change could trip on
>> a non-extant tmp-unwind.h.
>
> Yes, we should use an unique tmp unwind.h.

Thanks, you are correct.

Paolo

[-- Attachment #2: fff.patch --]
[-- Type: text/x-patch, Size: 683 bytes --]

2011-08-12  Paolo Bonzini  <bonzini@gnu.org>

	* Makefile.in (install-unwind_h): Create $(gcc_objdir)/include/unwind.h
	atomically.

Index: Makefile.in
===================================================================
--- Makefile.in	(revision 177688)
+++ Makefile.in	(working copy)
@@ -991,8 +1001,9 @@ gcc-extra-parts:
 all: $(extra-parts)
 
 install-unwind_h:
-	rm -f $(gcc_objdir)/include/unwind.h
-	cp unwind.h $(gcc_objdir)/include/unwind.h
-	chmod a+r $(gcc_objdir)/include/unwind.h
+	dest=$(gcc_objdir)/include/tmp$$$$-unwind.h; \
+	cp unwind.h $$dest; \
+	chmod a+r $$dest; \
+	sh $(srcdir)/../move-if-change $$dest $(gcc_objdir)/include/unwind.h
 
 all: install-unwind_h

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-12 16:18                               ` Paolo Bonzini
@ 2011-08-12 16:25                                 ` H.J. Lu
  2011-08-12 16:31                                   ` Paolo Bonzini
  2011-08-12 16:44                                 ` Pedro Alves
  1 sibling, 1 reply; 57+ messages in thread
From: H.J. Lu @ 2011-08-12 16:25 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Pedro Alves, gcc-patches, Rainer Orth

On Fri, Aug 12, 2011 at 8:40 AM, Paolo Bonzini <bonzini@gnu.org> wrote:
>>> Can't this sequence happen?
>>>
>>> proc1:       cp unwind.h $(gcc_objdir)/include/tmp-unwind.h
>>> proc2:       cp unwind.h $(gcc_objdir)/include/tmp-unwind.h
>>> proc1:       sh $(srcdir)/../move-if-change \
>>>               $(gcc_objdir)/include/tmp-unwind.h \
>>>               $(gcc_objdir)/include/unwind.h
>>> proc2:       sh $(srcdir)/../move-if-change \
>>>               $(gcc_objdir)/include/tmp-unwind.h \
>>>               $(gcc_objdir)/include/unwind.h
>>>
>>> It sounds like the latter move-if-change could trip on
>>> a non-extant tmp-unwind.h.
>>
>> Yes, we should use an unique tmp unwind.h.
>
> Thanks, you are correct.
>

It should work.

Thanks.

-- 
H.J.

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-12 16:25                                 ` H.J. Lu
@ 2011-08-12 16:31                                   ` Paolo Bonzini
  2011-08-12 17:12                                     ` H.J. Lu
  0 siblings, 1 reply; 57+ messages in thread
From: Paolo Bonzini @ 2011-08-12 16:31 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Pedro Alves, gcc-patches, Rainer Orth

On 08/12/2011 05:50 PM, H.J. Lu wrote:
> >  Thanks, you are correct.
>
> It should work.
>
> Thanks.

I prefer to wait for testing results to commit it, the breakage is minor.

Paolo

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-12 16:18                               ` Paolo Bonzini
  2011-08-12 16:25                                 ` H.J. Lu
@ 2011-08-12 16:44                                 ` Pedro Alves
  1 sibling, 0 replies; 57+ messages in thread
From: Pedro Alves @ 2011-08-12 16:44 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: H.J. Lu, gcc-patches, Rainer Orth

On Friday 12 August 2011 16:40:33, Paolo Bonzini wrote:
>  install-unwind_h:
> -       rm -f $(gcc_objdir)/include/unwind.h
> -       cp unwind.h $(gcc_objdir)/include/unwind.h
> -       chmod a+r $(gcc_objdir)/include/unwind.h
> +       dest=$(gcc_objdir)/include/tmp$$$$-unwind.h; \
> +       cp unwind.h $$dest; \
> +       chmod a+r $$dest; \
> +       sh $(srcdir)/../move-if-change $$dest $(gcc_objdir)/include/unwind.h

Thanks, that looks good to me.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-12 16:31                                   ` Paolo Bonzini
@ 2011-08-12 17:12                                     ` H.J. Lu
  2011-08-12 17:51                                       ` Paolo Bonzini
  0 siblings, 1 reply; 57+ messages in thread
From: H.J. Lu @ 2011-08-12 17:12 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Pedro Alves, gcc-patches, Rainer Orth

On Fri, Aug 12, 2011 at 8:57 AM, Paolo Bonzini <bonzini@gnu.org> wrote:
> On 08/12/2011 05:50 PM, H.J. Lu wrote:
>>
>> >  Thanks, you are correct.
>>
>> It should work.
>>
>> Thanks.
>
> I prefer to wait for testing results to commit it, the breakage is minor.

It bootstraps successfully with "make -j12" on a 24 core machine.

Thanks.


-- 
H.J.

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-12 17:12                                     ` H.J. Lu
@ 2011-08-12 17:51                                       ` Paolo Bonzini
  2011-08-12 18:27                                         ` Paolo Bonzini
  0 siblings, 1 reply; 57+ messages in thread
From: Paolo Bonzini @ 2011-08-12 17:51 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Pedro Alves, gcc-patches, Rainer Orth

On 08/12/2011 06:25 PM, H.J. Lu wrote:
>> >
>> >  I prefer to wait for testing results to commit it, the breakage is minor.
> It bootstraps successfully with "make -j12" on a 24 core machine.
>
> Thanks.

Committed.

Paolo

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [build] Move unwinder to toplevel libgcc (v2)
  2011-08-12 17:51                                       ` Paolo Bonzini
@ 2011-08-12 18:27                                         ` Paolo Bonzini
  0 siblings, 0 replies; 57+ messages in thread
From: Paolo Bonzini @ 2011-08-12 18:27 UTC (permalink / raw)
  To: gcc-patches; +Cc: Pedro Alves, gcc-patches, Rainer Orth

On 08/12/2011 06:25 PM, H.J. Lu wrote:
>> >
>> >  I prefer to wait for testing results to commit it, the breakage is minor.
> It bootstraps successfully with "make -j12" on a 24 core machine.
>
> Thanks.

Committed.

Paolo

^ permalink raw reply	[flat|nested] 57+ messages in thread

end of thread, other threads:[~2011-08-12 17:13 UTC | newest]

Thread overview: 57+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-03 13:33 [build] Move unwinder to toplevel libgcc (v2) Rainer Orth
2011-08-03 16:07 ` Nick Clifton
2011-08-03 21:11 ` Benjamin Kosnik
2011-08-05  9:50 ` Paolo Bonzini
2011-08-05 12:16   ` Rainer Orth
2011-08-05 13:56     ` Paolo Bonzini
2011-08-05 18:37 ` Mikael Morin
2011-08-05 20:58   ` Paolo Bonzini
2011-08-06 10:58     ` Mikael Morin
2011-08-06 14:40       ` Paolo Bonzini
2011-08-06 15:26         ` Mikael Morin
2011-08-06 15:39           ` Paolo Bonzini
2011-08-09 12:42             ` Rainer Orth
2011-08-06  9:54 ` Andreas Schwab
2011-08-08 17:29   ` Steve Ellcey
2011-08-08 18:49   ` Rainer Orth
2011-08-09  1:03     ` Andreas Schwab
2011-08-09 12:52       ` Rainer Orth
2011-08-09 13:15         ` Andreas Schwab
2011-08-09 14:50           ` Andreas Schwab
2011-08-09 15:17             ` Rainer Orth
2011-08-06 18:56 ` Richard Sandiford
2011-08-09 13:00   ` Rainer Orth
2011-08-10 13:57 ` Joseph S. Myers
2011-08-10 14:05   ` Rainer Orth
2011-08-10 14:12     ` Joseph S. Myers
2011-08-10 14:29       ` Rainer Orth
2011-08-10 15:59         ` Joseph S. Myers
2011-08-10 16:51         ` Paolo Bonzini
2011-08-10 16:53           ` Rainer Orth
2011-08-10 17:00             ` Paolo Bonzini
2011-08-11 15:49               ` Rainer Orth
2011-08-11 19:14                 ` H.J. Lu
2011-08-11 19:28                   ` H.J. Lu
2011-08-12  7:39                     ` Paolo Bonzini
2011-08-12 12:27                       ` H.J. Lu
2011-08-12 12:59                         ` Paolo Bonzini
2011-08-12 13:47                           ` Pedro Alves
2011-08-12 13:53                             ` H.J. Lu
2011-08-12 16:18                               ` Paolo Bonzini
2011-08-12 16:25                                 ` H.J. Lu
2011-08-12 16:31                                   ` Paolo Bonzini
2011-08-12 17:12                                     ` H.J. Lu
2011-08-12 17:51                                       ` Paolo Bonzini
2011-08-12 18:27                                         ` Paolo Bonzini
2011-08-12 16:44                                 ` Pedro Alves
2011-08-11 20:40                   ` Paolo Bonzini
2011-08-10 17:22             ` Pedro Alves
2011-08-11 12:31               ` Paolo Bonzini
2011-08-11 12:40                 ` Rainer Orth
2011-08-11 14:50                   ` Joseph S. Myers
2011-08-11 15:10                     ` Paolo Bonzini
2011-08-11 15:23                       ` Joseph S. Myers
2011-08-11 15:58                         ` Rainer Orth
2011-08-11 16:52                           ` Paolo Bonzini
2011-08-11 17:14                             ` Rainer Orth
2011-08-11 15:14                     ` Rainer Orth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).