public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Use -fbuilding-libgcc for more target macros used in libgcc
@ 2014-09-05 15:18 Dominique Dhumieres
  0 siblings, 0 replies; 3+ messages in thread
From: Dominique Dhumieres @ 2014-09-05 15:18 UTC (permalink / raw)
  To: gcc-patches; +Cc: iant, joseph

On Thu, Sep 4, 2014 at 6:15 PM, Joseph S. Myers <joseph@codesourcery.com> wrote:
>
> gcc/c-family:
> 2014-09-05  Joseph Myers  <joseph@codesourcery.com>
>
>         * c-cppbuiltin.c (c_cpp_builtins): Also define
>         __LIBGCC_EH_TABLES_CAN_BE_READ_ONLY__,
>         __LIBGCC_EH_FRAME_SECTION_NAME__, __LIBGCC_JCR_SECTION_NAME__,
>         __LIBGCC_CTORS_SECTION_ASM_OP__, __LIBGCC_DTORS_SECTION_ASM_OP__,
>         __LIBGCC_TEXT_SECTION_ASM_OP__, __LIBGCC_INIT_SECTION_ASM_OP__,
>         __LIBGCC_INIT_ARRAY_SECTION_ASM_OP__,
>         __LIBGCC_STACK_GROWS_DOWNWARD__,
>         __LIBGCC_DONT_USE_BUILTIN_SETJMP__,
>         __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__,
>         __LIBGCC_DWARF_FRAME_REGISTERS__,
> ...

This breaks bootstrap on x86_64-apple-darwin13, see

https://gcc.gnu.org/ml/gcc-bugs/2014-09/msg01135.html

TIA

Dominique

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

* Re: Use -fbuilding-libgcc for more target macros used in libgcc
  2014-09-05  1:15 Joseph S. Myers
@ 2014-09-05  3:18 ` Ian Lance Taylor
  0 siblings, 0 replies; 3+ messages in thread
From: Ian Lance Taylor @ 2014-09-05  3:18 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: gcc-patches

On Thu, Sep 4, 2014 at 6:15 PM, Joseph S. Myers <joseph@codesourcery.com> wrote:
>
> gcc/c-family:
> 2014-09-05  Joseph Myers  <joseph@codesourcery.com>
>
>         * c-cppbuiltin.c (c_cpp_builtins): Also define
>         __LIBGCC_EH_TABLES_CAN_BE_READ_ONLY__,
>         __LIBGCC_EH_FRAME_SECTION_NAME__, __LIBGCC_JCR_SECTION_NAME__,
>         __LIBGCC_CTORS_SECTION_ASM_OP__, __LIBGCC_DTORS_SECTION_ASM_OP__,
>         __LIBGCC_TEXT_SECTION_ASM_OP__, __LIBGCC_INIT_SECTION_ASM_OP__,
>         __LIBGCC_INIT_ARRAY_SECTION_ASM_OP__,
>         __LIBGCC_STACK_GROWS_DOWNWARD__,
>         __LIBGCC_DONT_USE_BUILTIN_SETJMP__,
>         __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__,
>         __LIBGCC_DWARF_FRAME_REGISTERS__,
>         __LIBGCC_EH_RETURN_STACKADJ_RTX__, __LIBGCC_JMP_BUF_SIZE__,
>         __LIBGCC_STACK_POINTER_REGNUM__ and
>         __LIBGCC_VTABLE_USES_DESCRIPTORS__ for -fbuilding-libgcc.
>         (builtin_define_with_value): Handle backslash-escaping in string
>         macro values.
>
> libgcc:
> 2014-09-05  Joseph Myers  <joseph@codesourcery.com>
>
>         * Makefile.in (CRTSTUFF_CFLAGS): Add -fbuilding-libgcc.
>         * config/aarch64/linux-unwind.h (STACK_POINTER_REGNUM): Change all
>         uses to __LIBGCC_STACK_POINTER_REGNUM__.
>         (DWARF_ALT_FRAME_RETURN_COLUMN): Change all uses to
>         __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__.
>         * config/alpha/vms-unwind.h (DWARF_ALT_FRAME_RETURN_COLUMN):
>         Change use to __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__.
>         * config/cr16/unwind-cr16.c (STACK_GROWS_DOWNWARD): Change all
>         uses to __LIBGCC_STACK_GROWS_DOWNWARD__.
>         (DWARF_FRAME_REGISTERS): Change all uses to
>         __LIBGCC_DWARF_FRAME_REGISTERS__.
>         (EH_RETURN_STACKADJ_RTX): Change all uses to
>         __LIBGCC_EH_RETURN_STACKADJ_RTX__.
>         * config/cr16/unwind-dw2.h (DWARF_FRAME_REGISTERS): Change use to
>         __LIBGCC_DWARF_FRAME_REGISTERS__.  Remove conditional definition.
>         * config/i386/cygming-crtbegin.c (EH_FRAME_SECTION_NAME): Change
>         use to __LIBGCC_EH_FRAME_SECTION_NAME__.
>         (JCR_SECTION_NAME): Change use to __LIBGCC_JCR_SECTION_NAME__.
>         * config/i386/cygming-crtend.c (EH_FRAME_SECTION_NAME): Change use
>         to __LIBGCC_EH_FRAME_SECTION_NAME__.
>         (JCR_SECTION_NAME): Change use to __LIBGCC_JCR_SECTION_NAME__
>         * config/mips/linux-unwind.h (STACK_POINTER_REGNUM): Change use to
>         __LIBGCC_STACK_POINTER_REGNUM__.
>         (DWARF_ALT_FRAME_RETURN_COLUMN): Change all uses to
>         __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__.
>         * config/nios2/linux-unwind.h (STACK_POINTER_REGNUM): Change use
>         to __LIBGCC_STACK_POINTER_REGNUM__.
>         * config/pa/hpux-unwind.h (DWARF_ALT_FRAME_RETURN_COLUMN): Change
>         all uses to __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__.
>         * config/pa/linux-unwind.h (DWARF_ALT_FRAME_RETURN_COLUMN): Change
>         all uses to __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__.
>         * config/rs6000/aix-unwind.h (DWARF_ALT_FRAME_RETURN_COLUMN):
>         Change all uses to __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__.
>         (STACK_POINTER_REGNUM): Change all uses to
>         __LIBGCC_STACK_POINTER_REGNUM__.
>         * config/rs6000/darwin-fallback.c (STACK_POINTER_REGNUM): Change
>         use to __LIBGCC_STACK_POINTER_REGNUM__.
>         * config/rs6000/linux-unwind.h (STACK_POINTER_REGNUM): Change all
>         uses to __LIBGCC_STACK_POINTER_REGNUM__.
>         * config/sparc/linux-unwind.h (DWARF_FRAME_REGISTERS): Change use
>         to __LIBGCC_DWARF_FRAME_REGISTERS__.
>         * config/sparc/sol2-unwind.h (DWARF_FRAME_REGISTERS): Change use
>         to __LIBGCC_DWARF_FRAME_REGISTERS__.
>         * config/tilepro/linux-unwind.h (STACK_POINTER_REGNUM): Change use
>         to __LIBGCC_STACK_POINTER_REGNUM__.
>         * config/xtensa/unwind-dw2-xtensa.h (DWARF_FRAME_REGISTERS):
>         Remove conditional definition.
>         * crtstuff.c (TEXT_SECTION_ASM_OP): Change all uses to
>         __LIBGCC_TEXT_SECTION_ASM_OP__.
>         (EH_FRAME_SECTION_NAME): Change all uses to
>         __LIBGCC_EH_FRAME_SECTION_NAME__.
>         (EH_TABLES_CAN_BE_READ_ONLY): Change all uses to
>         __LIBGCC_EH_TABLES_CAN_BE_READ_ONLY__.
>         (CTORS_SECTION_ASM_OP): Change all uses to
>         __LIBGCC_CTORS_SECTION_ASM_OP__.
>         (DTORS_SECTION_ASM_OP): Change all uses to
>         __LIBGCC_DTORS_SECTION_ASM_OP__.
>         (JCR_SECTION_NAME): Change all uses to
>         __LIBGCC_JCR_SECTION_NAME__.
>         (INIT_SECTION_ASM_OP): Change all uses to
>         __LIBGCC_INIT_SECTION_ASM_OP__.
>         (INIT_ARRAY_SECTION_ASM_OP): Change all uses to
>         __LIBGCC_INIT_ARRAY_SECTION_ASM_OP__.
>         * generic-morestack.c (STACK_GROWS_DOWNWARD): Change all uses to
>         __LIBGCC_STACK_GROWS_DOWNWARD__.
>         * libgcc2.c (INIT_SECTION_ASM_OP): Change all uses to
>         __LIBGCC_INIT_SECTION_ASM_OP__.
>         (INIT_ARRAY_SECTION_ASM_OP): Change all uses to
>         __LIBGCC_INIT_ARRAY_SECTION_ASM_OP__.
>         (EH_FRAME_SECTION_NAME): Change all uses to
>         __LIBGCC_EH_FRAME_SECTION_NAME__.
>         * libgcov-profiler.c (VTABLE_USES_DESCRIPTORS): Remove conditional
>         definitions.  Change all uses to
>         __LIBGCC_VTABLE_USES_DESCRIPTORS__.
>         * unwind-dw2.c (STACK_GROWS_DOWNWARD): Change all uses to
>         __LIBGCC_STACK_GROWS_DOWNWARD__.
>         (DWARF_FRAME_REGISTERS): Change all uses to
>         __LIBGCC_DWARF_FRAME_REGISTERS__.
>         (EH_RETURN_STACKADJ_RTX): Change all uses to
>         __LIBGCC_EH_RETURN_STACKADJ_RTX__.
>         * unwind-dw2.h (DWARF_FRAME_REGISTERS): Remove conditional
>         definition.  Change use to __LIBGCC_DWARF_FRAME_REGISTERS__.
>         * unwind-sjlj.c (DONT_USE_BUILTIN_SETJMP): Change all uses to
>         __LIBGCC_DONT_USE_BUILTIN_SETJMP__.
>         (JMP_BUF_SIZE): Change use to __LIBGCC_JMP_BUF_SIZE__.


This is OK.

Thanks.

Ian

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

* Use -fbuilding-libgcc for more target macros used in libgcc
@ 2014-09-05  1:15 Joseph S. Myers
  2014-09-05  3:18 ` Ian Lance Taylor
  0 siblings, 1 reply; 3+ messages in thread
From: Joseph S. Myers @ 2014-09-05  1:15 UTC (permalink / raw)
  To: gcc-patches

It is desirable for various reasons to stop target libraries from
using host-side tm.h: making the headers work on both host and target
(and on build as well) is fragile (especially when dealing with macros
depending on command-line options, which need different definitions
when being used for the target), prevents configuring and building
target libraries separately from host-side tools (consider a process
of bootstapping tools and libraries, where the host side of GCC should
be built before building libc but the final versions of target
libraries can only be configured and built after libc) and any target
macro used in target-side code cannot be turned into a target hook.

Some target macros used only in target-side code can be moved into
libgcc_tm.h; the trickier cases are macros that are actually used on
both the host and the target.  We have a -fbuilding-libgcc option to
cause GCC to predefine additional macros for such cases, to
communicate the target macro setting to code built for the target.
This patch moves various additional target macros used on both the
host and the target to use this mechanism instead of using the target
macro directly in code built for the target.

The set of macros converted is smaller than the list I put on
<https://gcc.gnu.org/wiki/Top-Level_Libgcc_Migration> some time ago;
as well as excluding some used on the target only for a single target
architecture (where I think target-specific predefines if
-fbuilding-libgcc would be reasonable), there are others I think
should be investigated further to work out the best way to communicate
the relevant information to libgcc.

In general the conversions of the libgcc code here are mechanical.  I
removed conditional definitions of DWARF_FRAME_REGISTERS to
FIRST_PSEUDO_REGISTER (defaults.h has such a definition, meaning in
fact DWARF_FRAME_REGISTERS is always defined on the host and the
definition and uses of __LIBGCC_DWARF_FRAME_REGISTERS__ can safely be
unconditional).  This gets rid of uses of FIRST_PSEUDO_REGISTER in
target-side code.  In the case of TARGET_VTABLE_USES_DESCRIPTORS, I
made __LIBGCC_VTABLE_USES_DESCRIPTORS__ correspond to the host-side
value rather than to whether TARGET_VTABLE_USES_DESCRIPTORS is defined
by the target (note that defaults.h has a default definition of
TARGET_VTABLE_USES_DESCRIPTORS if not already defined, but in a
section of defaults.h that's only used on the host, so the #ifdef in
the target-side code was effective despire the default definition and
this is a correct translation to the -fbuilding-libgcc approach).

For ARM, CTORS_SECTION_ASM_OP and DTORS_SECTION_ASM_OP are defined (or
not) in arm.h differently depending on IN_LIBGCC2.  So this patch has
the effect that __LIBGCC_CTORS_SECTION_ASM_OP__ and
__LIBGCC_DTORS_SECTION_ASM_OP__ will be defined in libgcc for EABI
targets when the previous target macros were not.  But this is of no
effect because in fact CTOR_LIST_BEGIN, CTOR_LIST_END, DTOR_LIST_BEGIN
and DTOR_LIST_END being defined mean that nothing depends on whether
__LIBGCC_CTORS_SECTION_ASM_OP__ and __LIBGCC_DTORS_SECTION_ASM_OP__
are defined.  Rather than attempt a partial cleanup of the relevant
code and comments in arm.h, it seems better to leave that until
CTOR_LIST_BEGIN, CTOR_LIST_END, DTOR_LIST_BEGIN and DTOR_LIST_END move
to libgcc_tm.h.  (I don't believe there are any other cases where the
current definitions of affected target macros depend on whether tm.h
is being used for the target.)

Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  OK to
commit?

gcc/c-family:
2014-09-05  Joseph Myers  <joseph@codesourcery.com>

	* c-cppbuiltin.c (c_cpp_builtins): Also define
	__LIBGCC_EH_TABLES_CAN_BE_READ_ONLY__,
	__LIBGCC_EH_FRAME_SECTION_NAME__, __LIBGCC_JCR_SECTION_NAME__,
	__LIBGCC_CTORS_SECTION_ASM_OP__, __LIBGCC_DTORS_SECTION_ASM_OP__,
	__LIBGCC_TEXT_SECTION_ASM_OP__, __LIBGCC_INIT_SECTION_ASM_OP__,
	__LIBGCC_INIT_ARRAY_SECTION_ASM_OP__,
	__LIBGCC_STACK_GROWS_DOWNWARD__,
	__LIBGCC_DONT_USE_BUILTIN_SETJMP__,
	__LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__,
	__LIBGCC_DWARF_FRAME_REGISTERS__,
	__LIBGCC_EH_RETURN_STACKADJ_RTX__, __LIBGCC_JMP_BUF_SIZE__,
	__LIBGCC_STACK_POINTER_REGNUM__ and
	__LIBGCC_VTABLE_USES_DESCRIPTORS__ for -fbuilding-libgcc.
	(builtin_define_with_value): Handle backslash-escaping in string
	macro values.

libgcc:
2014-09-05  Joseph Myers  <joseph@codesourcery.com>

	* Makefile.in (CRTSTUFF_CFLAGS): Add -fbuilding-libgcc.
	* config/aarch64/linux-unwind.h (STACK_POINTER_REGNUM): Change all
	uses to __LIBGCC_STACK_POINTER_REGNUM__.
	(DWARF_ALT_FRAME_RETURN_COLUMN): Change all uses to
	__LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__.
	* config/alpha/vms-unwind.h (DWARF_ALT_FRAME_RETURN_COLUMN):
	Change use to __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__.
	* config/cr16/unwind-cr16.c (STACK_GROWS_DOWNWARD): Change all
	uses to __LIBGCC_STACK_GROWS_DOWNWARD__.
	(DWARF_FRAME_REGISTERS): Change all uses to
	__LIBGCC_DWARF_FRAME_REGISTERS__.
	(EH_RETURN_STACKADJ_RTX): Change all uses to
	__LIBGCC_EH_RETURN_STACKADJ_RTX__.
	* config/cr16/unwind-dw2.h (DWARF_FRAME_REGISTERS): Change use to
	__LIBGCC_DWARF_FRAME_REGISTERS__.  Remove conditional definition.
	* config/i386/cygming-crtbegin.c (EH_FRAME_SECTION_NAME): Change
	use to __LIBGCC_EH_FRAME_SECTION_NAME__.
	(JCR_SECTION_NAME): Change use to __LIBGCC_JCR_SECTION_NAME__.
	* config/i386/cygming-crtend.c (EH_FRAME_SECTION_NAME): Change use
	to __LIBGCC_EH_FRAME_SECTION_NAME__.
	(JCR_SECTION_NAME): Change use to __LIBGCC_JCR_SECTION_NAME__
	* config/mips/linux-unwind.h (STACK_POINTER_REGNUM): Change use to
	__LIBGCC_STACK_POINTER_REGNUM__.
	(DWARF_ALT_FRAME_RETURN_COLUMN): Change all uses to
	__LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__.
	* config/nios2/linux-unwind.h (STACK_POINTER_REGNUM): Change use
	to __LIBGCC_STACK_POINTER_REGNUM__.
	* config/pa/hpux-unwind.h (DWARF_ALT_FRAME_RETURN_COLUMN): Change
	all uses to __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__.
	* config/pa/linux-unwind.h (DWARF_ALT_FRAME_RETURN_COLUMN): Change
	all uses to __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__.
	* config/rs6000/aix-unwind.h (DWARF_ALT_FRAME_RETURN_COLUMN):
	Change all uses to __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__.
	(STACK_POINTER_REGNUM): Change all uses to
	__LIBGCC_STACK_POINTER_REGNUM__.
	* config/rs6000/darwin-fallback.c (STACK_POINTER_REGNUM): Change
	use to __LIBGCC_STACK_POINTER_REGNUM__.
	* config/rs6000/linux-unwind.h (STACK_POINTER_REGNUM): Change all
	uses to __LIBGCC_STACK_POINTER_REGNUM__.
	* config/sparc/linux-unwind.h (DWARF_FRAME_REGISTERS): Change use
	to __LIBGCC_DWARF_FRAME_REGISTERS__.
	* config/sparc/sol2-unwind.h (DWARF_FRAME_REGISTERS): Change use
	to __LIBGCC_DWARF_FRAME_REGISTERS__.
	* config/tilepro/linux-unwind.h (STACK_POINTER_REGNUM): Change use
	to __LIBGCC_STACK_POINTER_REGNUM__.
	* config/xtensa/unwind-dw2-xtensa.h (DWARF_FRAME_REGISTERS):
	Remove conditional definition.
	* crtstuff.c (TEXT_SECTION_ASM_OP): Change all uses to
	__LIBGCC_TEXT_SECTION_ASM_OP__.
	(EH_FRAME_SECTION_NAME): Change all uses to
	__LIBGCC_EH_FRAME_SECTION_NAME__.
	(EH_TABLES_CAN_BE_READ_ONLY): Change all uses to
	__LIBGCC_EH_TABLES_CAN_BE_READ_ONLY__.
	(CTORS_SECTION_ASM_OP): Change all uses to
	__LIBGCC_CTORS_SECTION_ASM_OP__.
	(DTORS_SECTION_ASM_OP): Change all uses to
	__LIBGCC_DTORS_SECTION_ASM_OP__.
	(JCR_SECTION_NAME): Change all uses to
	__LIBGCC_JCR_SECTION_NAME__.
	(INIT_SECTION_ASM_OP): Change all uses to
	__LIBGCC_INIT_SECTION_ASM_OP__.
	(INIT_ARRAY_SECTION_ASM_OP): Change all uses to
	__LIBGCC_INIT_ARRAY_SECTION_ASM_OP__.
	* generic-morestack.c (STACK_GROWS_DOWNWARD): Change all uses to
	__LIBGCC_STACK_GROWS_DOWNWARD__.
	* libgcc2.c (INIT_SECTION_ASM_OP): Change all uses to
	__LIBGCC_INIT_SECTION_ASM_OP__.
	(INIT_ARRAY_SECTION_ASM_OP): Change all uses to
	__LIBGCC_INIT_ARRAY_SECTION_ASM_OP__.
	(EH_FRAME_SECTION_NAME): Change all uses to
	__LIBGCC_EH_FRAME_SECTION_NAME__.
	* libgcov-profiler.c (VTABLE_USES_DESCRIPTORS): Remove conditional
	definitions.  Change all uses to
	__LIBGCC_VTABLE_USES_DESCRIPTORS__.
	* unwind-dw2.c (STACK_GROWS_DOWNWARD): Change all uses to
	__LIBGCC_STACK_GROWS_DOWNWARD__.
	(DWARF_FRAME_REGISTERS): Change all uses to
	__LIBGCC_DWARF_FRAME_REGISTERS__.
	(EH_RETURN_STACKADJ_RTX): Change all uses to
	__LIBGCC_EH_RETURN_STACKADJ_RTX__.
	* unwind-dw2.h (DWARF_FRAME_REGISTERS): Remove conditional
	definition.  Change use to __LIBGCC_DWARF_FRAME_REGISTERS__.
	* unwind-sjlj.c (DONT_USE_BUILTIN_SETJMP): Change all uses to
	__LIBGCC_DONT_USE_BUILTIN_SETJMP__.
	(JMP_BUF_SIZE): Change use to __LIBGCC_JMP_BUF_SIZE__.

Index: gcc/c-family/c-cppbuiltin.c
===================================================================
--- gcc/c-family/c-cppbuiltin.c	(revision 214898)
+++ gcc/c-family/c-cppbuiltin.c	(working copy)
@@ -943,10 +943,75 @@ c_cpp_builtins (cpp_reader *pfile)
 
   /* For libgcc-internal use only.  */
   if (flag_building_libgcc)
-    /* For libgcc enable-execute-stack.c.  */
-    builtin_define_with_int_value ("__LIBGCC_TRAMPOLINE_SIZE__",
-				   TRAMPOLINE_SIZE);
+    {
+      /* For libgcc crtstuff.c and libgcc2.c.  */
+      builtin_define_with_int_value ("__LIBGCC_EH_TABLES_CAN_BE_READ_ONLY__",
+				     EH_TABLES_CAN_BE_READ_ONLY);
+#ifdef EH_FRAME_SECTION_NAME
+      builtin_define_with_value ("__LIBGCC_EH_FRAME_SECTION_NAME__",
+				 EH_FRAME_SECTION_NAME, 1);
+#endif
+#ifdef JCR_SECTION_NAME
+      builtin_define_with_value ("__LIBGCC_JCR_SECTION_NAME__",
+				 JCR_SECTION_NAME, 1);
+#endif
+#ifdef CTORS_SECTION_ASM_OP
+      builtin_define_with_value ("__LIBGCC_CTORS_SECTION_ASM_OP__",
+				 CTORS_SECTION_ASM_OP, 1);
+#endif
+#ifdef DTORS_SECTION_ASM_OP
+      builtin_define_with_value ("__LIBGCC_DTORS_SECTION_ASM_OP__",
+				 DTORS_SECTION_ASM_OP, 1);
+#endif
+#ifdef TEXT_SECTION_ASM_OP
+      builtin_define_with_value ("__LIBGCC_TEXT_SECTION_ASM_OP__",
+				 TEXT_SECTION_ASM_OP, 1);
+#endif
+#ifdef INIT_SECTION_ASM_OP
+      builtin_define_with_value ("__LIBGCC_INIT_SECTION_ASM_OP__",
+				 INIT_SECTION_ASM_OP, 1);
+#endif
+#ifdef INIT_ARRAY_SECTION_ASM_OP
+      /* Despite the name of this target macro, the expansion is not
+	 actually used, and may be empty rather than a string
+	 constant.  */
+      cpp_define (pfile, "__LIBGCC_INIT_ARRAY_SECTION_ASM_OP__");
+#endif
 
+      /* For libgcc enable-execute-stack.c.  */
+      builtin_define_with_int_value ("__LIBGCC_TRAMPOLINE_SIZE__",
+				     TRAMPOLINE_SIZE);
+
+      /* For libgcc generic-morestack.c and unwinder code.  */
+#ifdef STACK_GROWS_DOWNWARD
+      cpp_define (pfile, "__LIBGCC_STACK_GROWS_DOWNWARD__");
+#endif
+
+      /* For libgcc unwinder code.  */
+#ifdef DONT_USE_BUILTIN_SETJMP
+      cpp_define (pfile, "__LIBGCC_DONT_USE_BUILTIN_SETJMP__");
+#endif
+#ifdef DWARF_ALT_FRAME_RETURN_COLUMN
+      builtin_define_with_int_value ("__LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__",
+				     DWARF_ALT_FRAME_RETURN_COLUMN);
+#endif
+      builtin_define_with_int_value ("__LIBGCC_DWARF_FRAME_REGISTERS__",
+				     DWARF_FRAME_REGISTERS);
+#ifdef EH_RETURN_STACKADJ_RTX
+      cpp_define (pfile, "__LIBGCC_EH_RETURN_STACKADJ_RTX__");
+#endif
+#ifdef JMP_BUF_SIZE
+      builtin_define_with_int_value ("__LIBGCC_JMP_BUF_SIZE__",
+				     JMP_BUF_SIZE);
+#endif
+      builtin_define_with_int_value ("__LIBGCC_STACK_POINTER_REGNUM__",
+				     STACK_POINTER_REGNUM);
+
+      /* For libgcov.  */
+      builtin_define_with_int_value ("__LIBGCC_VTABLE_USES_DESCRIPTORS__",
+				     TARGET_VTABLE_USES_DESCRIPTORS);
+    }
+
   /* For use in assembly language.  */
   builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0);
   builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0);
@@ -1087,8 +1152,50 @@ builtin_define_with_value (const char *macro, cons
   size_t extra = 2;  /* space for an = and a NUL */
 
   if (is_str)
-    extra += 2;  /* space for two quote marks */
+    {
+      char *quoted_expansion = (char *) alloca (elen * 4 + 1);
+      const char *p;
+      char *q;
+      extra += 2;  /* space for two quote marks */
+      for (p = expansion, q = quoted_expansion; *p; p++)
+	{
+	  switch (*p)
+	    {
+	    case '\n':
+	      *q++ = '\\';
+	      *q++ = 'n';
+	      break;
 
+	    case '\t':
+	      *q++ = '\\';
+	      *q++ = 't';
+	      break;
+
+	    case '\\':
+	      *q++ = '\\';
+	      *q++ = '\\';
+	      break;
+
+	    case '"':
+	      *q++ = '\\';
+	      *q++ = '"';
+	      break;
+
+	    default:
+	      if (ISPRINT ((unsigned char) *p))
+		*q++ = *p;
+	      else
+		{
+		  sprintf (q, "\\%03o", (unsigned char) *p);
+		  q += 4;
+		}
+	    }
+	}
+      *q = '\0';
+      expansion = quoted_expansion;
+      elen = q - expansion;
+    }
+
   buf = (char *) alloca (mlen + elen + extra);
   if (is_str)
     sprintf (buf, "%s=\"%s\"", macro, expansion);
Index: libgcc/Makefile.in
===================================================================
--- libgcc/Makefile.in	(revision 214898)
+++ libgcc/Makefile.in	(working copy)
@@ -283,7 +283,7 @@ INTERNAL_CFLAGS = $(CFLAGS) $(LIBGCC2_CFLAGS) $(HO
 CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
   -finhibit-size-directive -fno-inline -fno-exceptions \
   -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \
-  -fno-stack-protector \
+  -fbuilding-libgcc -fno-stack-protector \
   $(INHIBIT_LIBC_CFLAGS)
 
 # Extra flags to use when compiling crt{begin,end}.o.
Index: libgcc/config/aarch64/linux-unwind.h
===================================================================
--- libgcc/config/aarch64/linux-unwind.h	(revision 214898)
+++ libgcc/config/aarch64/linux-unwind.h	(working copy)
@@ -81,7 +81,7 @@ aarch64_fallback_frame_state (struct _Unwind_Conte
 
   new_cfa = (_Unwind_Ptr) sc;
   fs->regs.cfa_how = CFA_REG_OFFSET;
-  fs->regs.cfa_reg = STACK_POINTER_REGNUM;
+  fs->regs.cfa_reg = __LIBGCC_STACK_POINTER_REGNUM__;
   fs->regs.cfa_offset = new_cfa - (_Unwind_Ptr) context->cfa;
 
   for (i = 0; i < AARCH64_DWARF_NUMBER_R; i++)
@@ -144,11 +144,12 @@ aarch64_fallback_frame_state (struct _Unwind_Conte
 
   fs->signal_frame = 1;
 
-  fs->regs.reg[DWARF_ALT_FRAME_RETURN_COLUMN].how = REG_SAVED_VAL_OFFSET;
-  fs->regs.reg[DWARF_ALT_FRAME_RETURN_COLUMN].loc.offset =
+  fs->regs.reg[__LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__].how =
+    REG_SAVED_VAL_OFFSET;
+  fs->regs.reg[__LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__].loc.offset =
     (_Unwind_Ptr) (sc->pc) - new_cfa;
 
-  fs->retaddr_column = DWARF_ALT_FRAME_RETURN_COLUMN;
+  fs->retaddr_column = __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__;
 
   return _URC_NO_REASON;
 }
Index: libgcc/config/alpha/vms-unwind.h
===================================================================
--- libgcc/config/alpha/vms-unwind.h	(revision 214898)
+++ libgcc/config/alpha/vms-unwind.h	(working copy)
@@ -58,7 +58,7 @@ do { \
   { if ((((STATUS) & 1) != 1)) return _URC_END_OF_STACK; }
 #define DENOTES_EXC_DISPATCHER(PV) ((PV) == (ADDR) (REG) SYS$GL_CALL_HANDL)
 
-#define RA_COLUMN (DWARF_ALT_FRAME_RETURN_COLUMN)
+#define RA_COLUMN (__LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__)
 
 static int
 alpha_vms_fallback_frame_state (struct _Unwind_Context *context,
Index: libgcc/config/cr16/unwind-cr16.c
===================================================================
--- libgcc/config/cr16/unwind-cr16.c	(revision 214898)
+++ libgcc/config/cr16/unwind-cr16.c	(working copy)
@@ -42,16 +42,16 @@
 
 #ifndef __USING_SJLJ_EXCEPTIONS__
 
-#ifndef STACK_GROWS_DOWNWARD
-#define STACK_GROWS_DOWNWARD 0
+#ifndef __LIBGCC_STACK_GROWS_DOWNWARD__
+#define __LIBGCC_STACK_GROWS_DOWNWARD__ 0
 #else
-#undef STACK_GROWS_DOWNWARD
-#define STACK_GROWS_DOWNWARD 1
+#undef __LIBGCC_STACK_GROWS_DOWNWARD__
+#define __LIBGCC_STACK_GROWS_DOWNWARD__ 1
 #endif
 
 /* Dwarf frame registers used for pre gcc 3.0 compiled glibc.  */
 #ifndef PRE_GCC3_DWARF_FRAME_REGISTERS
-#define PRE_GCC3_DWARF_FRAME_REGISTERS DWARF_FRAME_REGISTERS
+#define PRE_GCC3_DWARF_FRAME_REGISTERS __LIBGCC_DWARF_FRAME_REGISTERS__
 #endif
 
 #ifndef DWARF_REG_TO_UNWIND_COLUMN
@@ -101,7 +101,7 @@ _Unwind_Get_Unwind_Context_Reg_Val (_Unwind_Word v
    to its caller.  */
 struct _Unwind_Context
 {
-  _Unwind_Context_Reg_Val reg[DWARF_FRAME_REGISTERS+1];
+  _Unwind_Context_Reg_Val reg[__LIBGCC_DWARF_FRAME_REGISTERS__+1];
   void *cfa;
   void *ra;
   void *lsda;
@@ -115,11 +115,11 @@ struct _Unwind_Context
      struct _Unwind_Context.  */
   _Unwind_Word version;
   _Unwind_Word args_size;
-  char by_value[DWARF_FRAME_REGISTERS+1];
+  char by_value[__LIBGCC_DWARF_FRAME_REGISTERS__+1];
 };
 
 /* Byte size of every register managed by these routines.  */
-static unsigned char dwarf_reg_size_table[DWARF_FRAME_REGISTERS+1];
+static unsigned char dwarf_reg_size_table[__LIBGCC_DWARF_FRAME_REGISTERS__+1];
 
 \f
 /* Read unaligned data from the instruction buffer.  */
@@ -1327,7 +1327,7 @@ uw_update_context_1 (struct _Unwind_Context *conte
   void *cfa;
   long i;
 
-#ifdef EH_RETURN_STACKADJ_RTX
+#ifdef __LIBGCC_EH_RETURN_STACKADJ_RTX__
   /* Special handling here: Many machines do not use a frame pointer,
      and track the CFA only through offsets from the stack pointer from
      one frame to the next.  In this case, the stack pointer is never
@@ -1375,7 +1375,7 @@ uw_update_context_1 (struct _Unwind_Context *conte
   context->cfa = cfa;
 
   /* Compute the addresses of all registers saved in this frame.  */
-  for (i = 0; i < DWARF_FRAME_REGISTERS + 1; ++i)
+  for (i = 0; i < __LIBGCC_DWARF_FRAME_REGISTERS__ + 1; ++i)
     switch (fs->regs.reg[i].how)
       {
       case REG_UNSAVED:
@@ -1601,7 +1601,7 @@ uw_install_context_1 (struct _Unwind_Context *curr
   if (!_Unwind_GetGRPtr (target, __builtin_dwarf_sp_column ()))
     _Unwind_SetSpColumn (target, target->cfa, &sp_slot);
 
-  for (i = 0; i < DWARF_FRAME_REGISTERS; ++i)
+  for (i = 0; i < __LIBGCC_DWARF_FRAME_REGISTERS__; ++i)
     {
       void *c = (void *) (_Unwind_Internal_Ptr) current->reg[i];
       void *t = (void *) (_Unwind_Internal_Ptr)target->reg[i];
@@ -1637,7 +1637,7 @@ uw_install_context_1 (struct _Unwind_Context *curr
       target_cfa = _Unwind_GetPtr (target, __builtin_dwarf_sp_column ());
 
       /* We adjust SP by the difference between CURRENT and TARGET's CFA.  */
-      if (STACK_GROWS_DOWNWARD)
+      if (__LIBGCC_STACK_GROWS_DOWNWARD__)
 	return target_cfa - current->cfa + target->args_size;
       else
 	return current->cfa - target_cfa - target->args_size;
@@ -1651,7 +1651,7 @@ uw_identify_context (struct _Unwind_Context *conte
   /* The CFA is not sufficient to disambiguate the context of a function
      interrupted by a signal before establishing its frame and the context
      of the signal itself.  */
-  if (STACK_GROWS_DOWNWARD)
+  if (__LIBGCC_STACK_GROWS_DOWNWARD__)
     return _Unwind_GetCFA (context) - _Unwind_IsSignalFrame (context);
   else
     return _Unwind_GetCFA (context) + _Unwind_IsSignalFrame (context);
Index: libgcc/config/cr16/unwind-dw2.h
===================================================================
--- libgcc/config/cr16/unwind-dw2.h	(revision 214898)
+++ libgcc/config/cr16/unwind-dw2.h	(working copy)
@@ -22,12 +22,6 @@
    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
-/* A target can override (perhaps for backward compatibility) how
-   many dwarf2 columns are unwound.  */
-#ifndef DWARF_FRAME_REGISTERS
-#define DWARF_FRAME_REGISTERS FIRST_PSEUDO_REGISTER
-#endif
-
 /* The result of interpreting the frame unwind info for a frame.
    This is all symbolic at this point, as none of the values can
    be resolved until the target pc is located.  */
@@ -52,7 +46,7 @@ typedef struct
 	REG_SAVED_VAL_EXP,
 	REG_UNDEFINED
       } how;
-    } reg[DWARF_FRAME_REGISTERS+1];
+    } reg[__LIBGCC_DWARF_FRAME_REGISTERS__+1];
 
     /* Used to implement DW_CFA_remember_state.  */
     struct frame_state_reg_info *prev;
Index: libgcc/config/i386/cygming-crtbegin.c
===================================================================
--- libgcc/config/i386/cygming-crtbegin.c	(revision 214898)
+++ libgcc/config/i386/cygming-crtbegin.c	(working copy)
@@ -95,7 +95,7 @@ _Jv_RegisterClasses (__attribute__((unused)) const
    register/deregister it with the exception handling library code.  */
 #if DWARF2_UNWIND_INFO
 static EH_FRAME_SECTION_CONST char __EH_FRAME_BEGIN__[]
-  __attribute__((used, section(EH_FRAME_SECTION_NAME), aligned(4)))
+  __attribute__((used, section(__LIBGCC_EH_FRAME_SECTION_NAME__), aligned(4)))
   = { };
 
 static struct object obj;
@@ -107,7 +107,7 @@ static void *  (*deregister_frame_fn) (const void
 
 #if TARGET_USE_JCR_SECTION
 static void *__JCR_LIST__[]
-  __attribute__ ((used, section(JCR_SECTION_NAME), aligned(4)))
+  __attribute__ ((used, section(__LIBGCC_JCR_SECTION_NAME__), aligned(4)))
   = { };
 #endif
 
Index: libgcc/config/i386/cygming-crtend.c
===================================================================
--- libgcc/config/i386/cygming-crtend.c	(revision 214898)
+++ libgcc/config/i386/cygming-crtend.c	(working copy)
@@ -48,7 +48,7 @@ see the files COPYING3 and COPYING.RUNTIME respect
    this would be the 'length' field in a real FDE.  */
 
 static EH_FRAME_SECTION_CONST int __FRAME_END__[]
-  __attribute__ ((used,  section(EH_FRAME_SECTION_NAME),
+  __attribute__ ((used,  section(__LIBGCC_EH_FRAME_SECTION_NAME__),
 		  aligned(4)))
   = { 0 };
 #endif
@@ -56,7 +56,7 @@ static EH_FRAME_SECTION_CONST int __FRAME_END__[]
 #if TARGET_USE_JCR_SECTION
 /* Null terminate the .jcr section array.  */
 static void *__JCR_END__[1] 
-   __attribute__ ((used, section(JCR_SECTION_NAME),
+   __attribute__ ((used, section(__LIBGCC_JCR_SECTION_NAME__),
 		   aligned(sizeof(void *))))
    = { 0 };
 #endif
Index: libgcc/config/mips/linux-unwind.h
===================================================================
--- libgcc/config/mips/linux-unwind.h	(revision 214898)
+++ libgcc/config/mips/linux-unwind.h	(working copy)
@@ -90,7 +90,7 @@ mips_fallback_frame_state (struct _Unwind_Context
 
   new_cfa = (_Unwind_Ptr) sc;
   fs->regs.cfa_how = CFA_REG_OFFSET;
-  fs->regs.cfa_reg = STACK_POINTER_REGNUM;
+  fs->regs.cfa_reg = __LIBGCC_STACK_POINTER_REGNUM__;
   fs->regs.cfa_offset = new_cfa - (_Unwind_Ptr) context->cfa;
 
   /* On o32 Linux, the register save slots in the sigcontext are
@@ -115,10 +115,11 @@ mips_fallback_frame_state (struct _Unwind_Context
      Note that setting fs->signal_frame would not work.  As the comment
      above MASK_RETURN_ADDR explains, MIPS unwinders must earch for an
      odd-valued address.  */
-  fs->regs.reg[DWARF_ALT_FRAME_RETURN_COLUMN].how = REG_SAVED_VAL_OFFSET;
-  fs->regs.reg[DWARF_ALT_FRAME_RETURN_COLUMN].loc.offset
+  fs->regs.reg[__LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__].how
+    = REG_SAVED_VAL_OFFSET;
+  fs->regs.reg[__LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__].loc.offset
     = (_Unwind_Ptr)(sc->sc_pc) + 2 - new_cfa;
-  fs->retaddr_column = DWARF_ALT_FRAME_RETURN_COLUMN;
+  fs->retaddr_column = __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__;
 
   return _URC_NO_REASON;
 }
Index: libgcc/config/nios2/linux-unwind.h
===================================================================
--- libgcc/config/nios2/linux-unwind.h	(revision 214898)
+++ libgcc/config/nios2/linux-unwind.h	(working copy)
@@ -81,7 +81,7 @@ nios2_fallback_frame_state (struct _Unwind_Context
       /* The CFA is the user's incoming stack pointer value.  */
       new_cfa = (_Unwind_Ptr)regs->gregs[28];
       fs->regs.cfa_how = CFA_REG_OFFSET;
-      fs->regs.cfa_reg = STACK_POINTER_REGNUM;
+      fs->regs.cfa_reg = __LIBGCC_STACK_POINTER_REGNUM__;
       fs->regs.cfa_offset = new_cfa - (_Unwind_Ptr) context->cfa;
 
       /* The sequential registers.  */
Index: libgcc/config/pa/hpux-unwind.h
===================================================================
--- libgcc/config/pa/hpux-unwind.h	(revision 214898)
+++ libgcc/config/pa/hpux-unwind.h	(working copy)
@@ -349,8 +349,8 @@ pa_fallback_frame_state (struct _Unwind_Context *c
 	  UPDATE_FS_FOR_SAR (fs, 88);
 	}
 
-      fs->retaddr_column = DWARF_ALT_FRAME_RETURN_COLUMN;
-      UPDATE_FS_FOR_PC (fs, DWARF_ALT_FRAME_RETURN_COLUMN);
+      fs->retaddr_column = __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__;
+      UPDATE_FS_FOR_PC (fs, __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__);
       fs->signal_frame = 1;
 
       return _URC_NO_REASON;
Index: libgcc/config/pa/linux-unwind.h
===================================================================
--- libgcc/config/pa/linux-unwind.h	(revision 214898)
+++ libgcc/config/pa/linux-unwind.h	(working copy)
@@ -131,10 +131,11 @@ pa32_fallback_frame_state (struct _Unwind_Context
     }
   fs->regs.reg[88].how = REG_SAVED_OFFSET;
   fs->regs.reg[88].loc.offset = (long) &sc->sc_sar - new_cfa;
-  fs->regs.reg[DWARF_ALT_FRAME_RETURN_COLUMN].how = REG_SAVED_OFFSET;
-  fs->regs.reg[DWARF_ALT_FRAME_RETURN_COLUMN].loc.offset
+  fs->regs.reg[__LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__].how
+    = REG_SAVED_OFFSET;
+  fs->regs.reg[__LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__].loc.offset
     = (long) &sc->sc_iaoq[0] - new_cfa;
-  fs->retaddr_column = DWARF_ALT_FRAME_RETURN_COLUMN;
+  fs->retaddr_column = __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__;
   fs->signal_frame = 1;
   return _URC_NO_REASON;
 }
Index: libgcc/config/rs6000/aix-unwind.h
===================================================================
--- libgcc/config/rs6000/aix-unwind.h	(revision 214898)
+++ libgcc/config/rs6000/aix-unwind.h	(working copy)
@@ -175,8 +175,8 @@ ucontext_for (struct _Unwind_Context *context)
 
 /* The fallback proper.  */
 
-#ifdef DWARF_ALT_FRAME_RETURN_COLUMN
-#define RETURN_COLUMN DWARF_ALT_FRAME_RETURN_COLUMN
+#ifdef __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__
+#define RETURN_COLUMN __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__
 #else
 #define RETURN_COLUMN ARG_POINTER_REGNUM
 #endif
@@ -204,10 +204,10 @@ ppc_aix_fallback_frame_state (struct _Unwind_Conte
 
   /* The "kernel" frame cfa is the stack pointer at the signal occurrence
      point.  */
-  new_cfa = mctx->gpr[STACK_POINTER_REGNUM];
+  new_cfa = mctx->gpr[__LIBGCC_STACK_POINTER_REGNUM__];
 
   fs->regs.cfa_how = CFA_REG_OFFSET;
-  fs->regs.cfa_reg = STACK_POINTER_REGNUM;
+  fs->regs.cfa_reg = __LIBGCC_STACK_POINTER_REGNUM__;
   fs->regs.cfa_offset = new_cfa - (long) context->cfa;
 
   /* And we state how to find the various registers it has saved with
@@ -214,7 +214,7 @@ ppc_aix_fallback_frame_state (struct _Unwind_Conte
      relative offset rules from there.  */
 
   for (i = 0; i < 32; i++)
-    if (i != STACK_POINTER_REGNUM)
+    if (i != __LIBGCC_STACK_POINTER_REGNUM__)
       REGISTER_CFA_OFFSET_FOR (fs, i, &mctx->gpr[i], new_cfa);
 
   REGISTER_CFA_OFFSET_FOR (fs, CR2_REGNO, &mctx->cr, new_cfa);
Index: libgcc/config/rs6000/darwin-fallback.c
===================================================================
--- libgcc/config/rs6000/darwin-fallback.c	(revision 214898)
+++ libgcc/config/rs6000/darwin-fallback.c	(working copy)
@@ -438,7 +438,7 @@ handle_syscall (_Unwind_FrameState *fs, const reg_
     }
 
   fs->regs.cfa_how = CFA_REG_OFFSET;
-  fs->regs.cfa_reg = STACK_POINTER_REGNUM;
+  fs->regs.cfa_reg = __LIBGCC_STACK_POINTER_REGNUM__;
   fs->regs.cfa_offset = new_cfa - old_cfa;;
   
   /* The choice of column for the return address is somewhat tricky.
Index: libgcc/config/rs6000/linux-unwind.h
===================================================================
--- libgcc/config/rs6000/linux-unwind.h	(revision 214898)
+++ libgcc/config/rs6000/linux-unwind.h	(working copy)
@@ -205,9 +205,9 @@ ppc_fallback_frame_state (struct _Unwind_Context *
   if (regs == NULL)
     return _URC_END_OF_STACK;
 
-  new_cfa = regs->gpr[STACK_POINTER_REGNUM];
+  new_cfa = regs->gpr[__LIBGCC_STACK_POINTER_REGNUM__];
   fs->regs.cfa_how = CFA_REG_OFFSET;
-  fs->regs.cfa_reg = STACK_POINTER_REGNUM;
+  fs->regs.cfa_reg = __LIBGCC_STACK_POINTER_REGNUM__;
   fs->regs.cfa_offset = new_cfa - (long) context->cfa;
 
 #ifdef __powerpc64__
Index: libgcc/config/sparc/linux-unwind.h
===================================================================
--- libgcc/config/sparc/linux-unwind.h	(revision 214898)
+++ libgcc/config/sparc/linux-unwind.h	(working copy)
@@ -121,7 +121,7 @@ sparc64_frob_update_context (struct _Unwind_Contex
 
       context->cfa -= STACK_BIAS;
 
-      for (i = 0; i < DWARF_FRAME_REGISTERS + 1; ++i)
+      for (i = 0; i < __LIBGCC_DWARF_FRAME_REGISTERS__ + 1; ++i)
 	if (fs->regs.reg[i].how == REG_SAVED_OFFSET)
 	  _Unwind_SetGRPtr (context, i,
 			    _Unwind_GetGRPtr (context, i) - STACK_BIAS);
Index: libgcc/config/sparc/sol2-unwind.h
===================================================================
--- libgcc/config/sparc/sol2-unwind.h	(revision 214898)
+++ libgcc/config/sparc/sol2-unwind.h	(working copy)
@@ -139,7 +139,7 @@ sparc64_frob_update_context (struct _Unwind_Contex
 
       context->cfa -= STACK_BIAS;
 
-      for (i = 0; i < DWARF_FRAME_REGISTERS + 1; ++i)
+      for (i = 0; i < __LIBGCC_DWARF_FRAME_REGISTERS__ + 1; ++i)
 	if (fs->regs.reg[i].how == REG_SAVED_OFFSET)
 	  _Unwind_SetGRPtr (context, i,
 			    _Unwind_GetGRPtr (context, i) - STACK_BIAS);
Index: libgcc/config/tilepro/linux-unwind.h
===================================================================
--- libgcc/config/tilepro/linux-unwind.h	(revision 214898)
+++ libgcc/config/tilepro/linux-unwind.h	(working copy)
@@ -78,7 +78,7 @@ tile_fallback_frame_state (struct _Unwind_Context
 
   new_cfa = sc->sp;
   fs->regs.cfa_how = CFA_REG_OFFSET;
-  fs->regs.cfa_reg = STACK_POINTER_REGNUM;
+  fs->regs.cfa_reg = __LIBGCC_STACK_POINTER_REGNUM__;
   fs->regs.cfa_offset = new_cfa - (long) context->cfa;
 
   for (i = 0; i < 56; ++i)
Index: libgcc/config/xtensa/unwind-dw2-xtensa.h
===================================================================
--- libgcc/config/xtensa/unwind-dw2-xtensa.h	(revision 214898)
+++ libgcc/config/xtensa/unwind-dw2-xtensa.h	(working copy)
@@ -22,12 +22,6 @@
    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
-/* A target can override (perhaps for backward compatibility) how
-   many dwarf2 columns are unwound.  */
-#ifndef DWARF_FRAME_REGISTERS
-#define DWARF_FRAME_REGISTERS FIRST_PSEUDO_REGISTER
-#endif
-
 /* Xtensa's variable-size register window save areas can be unwound without
    any unwind info.  This is a stripped down version of the standard DWARF
    _Unwind_FrameState.  */
Index: libgcc/crtstuff.c
===================================================================
--- libgcc/crtstuff.c	(revision 214898)
+++ libgcc/crtstuff.c	(working copy)
@@ -76,7 +76,7 @@ call_ ## FUNC (void)					\
   asm (SECTION_OP);					\
   FUNC ();						\
   FORCE_CODE_SECTION_ALIGN				\
-  asm (TEXT_SECTION_ASM_OP);				\
+  asm (__LIBGCC_TEXT_SECTION_ASM_OP__);				\
 }
 #endif
 
@@ -131,10 +131,11 @@ call_ ## FUNC (void)					\
 # define USE_PT_GNU_EH_FRAME
 #endif
 
-#if defined(EH_FRAME_SECTION_NAME) && !defined(USE_PT_GNU_EH_FRAME)
+#if defined(__LIBGCC_EH_FRAME_SECTION_NAME__) && !defined(USE_PT_GNU_EH_FRAME)
 # define USE_EH_FRAME_REGISTRY
 #endif
-#if defined(EH_FRAME_SECTION_NAME) && EH_TABLES_CAN_BE_READ_ONLY
+#if defined(__LIBGCC_EH_FRAME_SECTION_NAME__) \
+    && __LIBGCC_EH_TABLES_CAN_BE_READ_ONLY__
 # define EH_FRAME_SECTION_CONST const
 #else
 # define EH_FRAME_SECTION_CONST
@@ -224,11 +225,11 @@ typedef void (*func_ptr) (void);
    does not start with a count of elements.  */
 #ifdef CTOR_LIST_BEGIN
 CTOR_LIST_BEGIN;
-#elif defined(CTORS_SECTION_ASM_OP)
+#elif defined(__LIBGCC_CTORS_SECTION_ASM_OP__)
 /* Hack: force cc1 to switch to .data section early, so that assembling
    __CTOR_LIST__ does not undo our behind-the-back change to .ctors.  */
 static func_ptr force_to_data[1] __attribute__ ((__used__)) = { };
-asm (CTORS_SECTION_ASM_OP);
+asm (__LIBGCC_CTORS_SECTION_ASM_OP__);
 STATIC func_ptr __CTOR_LIST__[1]
   __attribute__ ((__used__, aligned(sizeof(func_ptr))))
   = { (func_ptr) (-1) };
@@ -240,8 +241,8 @@ STATIC func_ptr __CTOR_LIST__[1]
 
 #ifdef DTOR_LIST_BEGIN
 DTOR_LIST_BEGIN;
-#elif defined(DTORS_SECTION_ASM_OP)
-asm (DTORS_SECTION_ASM_OP);
+#elif defined(__LIBGCC_DTORS_SECTION_ASM_OP__)
+asm (__LIBGCC_DTORS_SECTION_ASM_OP__);
 STATIC func_ptr __DTOR_LIST__[1]
   __attribute__ ((aligned(sizeof(func_ptr))))
   = { (func_ptr) (-1) };
@@ -256,17 +257,18 @@ STATIC func_ptr __DTOR_LIST__[1]
 /* Stick a label at the beginning of the frame unwind info so we can register
    and deregister it with the exception handling library code.  */
 STATIC EH_FRAME_SECTION_CONST char __EH_FRAME_BEGIN__[]
-     __attribute__((section(EH_FRAME_SECTION_NAME), aligned(4)))
+     __attribute__((section(__LIBGCC_EH_FRAME_SECTION_NAME__), aligned(4)))
      = { };
 #endif /* USE_EH_FRAME_REGISTRY */
 
-#ifdef JCR_SECTION_NAME
+#ifdef __LIBGCC_JCR_SECTION_NAME__
 /* Stick a label at the beginning of the java class registration info
    so we can register them properly.  */
 STATIC void *__JCR_LIST__[]
-  __attribute__ ((used, section(JCR_SECTION_NAME), aligned(sizeof(void*))))
+  __attribute__ ((used, section(__LIBGCC_JCR_SECTION_NAME__),
+		  aligned(sizeof(void*))))
   = { };
-#endif /* JCR_SECTION_NAME */
+#endif /* __LIBGCC_JCR_SECTION_NAME__ */
 
 #if USE_TM_CLONE_REGISTRY
 STATIC func_ptr __TMC_LIST__[]
@@ -317,7 +319,8 @@ register_tm_clones (void)
 }
 #endif /* USE_TM_CLONE_REGISTRY */
 
-#if defined(INIT_SECTION_ASM_OP) || defined(INIT_ARRAY_SECTION_ASM_OP)
+#if defined(__LIBGCC_INIT_SECTION_ASM_OP__) \
+    || defined(__LIBGCC_INIT_ARRAY_SECTION_ASM_OP__)
 
 #ifdef OBJECT_FORMAT_ELF
 
@@ -438,11 +441,12 @@ __do_global_dtors_aux_1 (void)
 {
   atexit (__do_global_dtors_aux);
 }
-CRT_CALL_STATIC_FUNCTION (INIT_SECTION_ASM_OP, __do_global_dtors_aux_1)
+CRT_CALL_STATIC_FUNCTION (__LIBGCC_INIT_SECTION_ASM_OP__,
+			  __do_global_dtors_aux_1)
 #endif
 
 #if defined(USE_EH_FRAME_REGISTRY) \
-    || defined(JCR_SECTION_NAME) \
+    || defined(__LIBGCC_JCR_SECTION_NAME__) \
     || defined(USE_TM_CLONE_REGISTRY)
 /* Stick a call to __register_frame_info into the .init section.  For some
    reason calls with no arguments work more reliably in .init, so stick the
@@ -465,7 +469,7 @@ frame_dummy (void)
 #endif /* CRT_GET_RFIB_DATA */
 #endif /* USE_EH_FRAME_REGISTRY */
 
-#ifdef JCR_SECTION_NAME
+#ifdef __LIBGCC_JCR_SECTION_NAME__
   void **jcr_list;
   __asm ("" : "=g" (jcr_list) : "0" (__JCR_LIST__));
   if (__builtin_expect (*jcr_list != NULL, 0))
@@ -475,7 +479,7 @@ frame_dummy (void)
       if (register_classes)
 	register_classes (jcr_list);
     }
-#endif /* JCR_SECTION_NAME */
+#endif /* __LIBGCC_JCR_SECTION_NAME__ */
 
 #if USE_TM_CLONE_REGISTRY
   register_tm_clones ();
@@ -482,14 +486,14 @@ frame_dummy (void)
 #endif /* USE_TM_CLONE_REGISTRY */
 }
 
-#ifdef INIT_SECTION_ASM_OP
-CRT_CALL_STATIC_FUNCTION (INIT_SECTION_ASM_OP, frame_dummy)
-#else /* defined(INIT_SECTION_ASM_OP) */
+#ifdef __LIBGCC_INIT_SECTION_ASM_OP__
+CRT_CALL_STATIC_FUNCTION (__LIBGCC_INIT_SECTION_ASM_OP__, frame_dummy)
+#else /* defined(__LIBGCC_INIT_SECTION_ASM_OP__) */
 static func_ptr __frame_dummy_init_array_entry[]
   __attribute__ ((__used__, section(".init_array"), aligned(sizeof(func_ptr))))
   = { frame_dummy };
-#endif /* !defined(INIT_SECTION_ASM_OP) */
-#endif /* USE_EH_FRAME_REGISTRY || JCR_SECTION_NAME || USE_TM_CLONE_REGISTRY */
+#endif /* !defined(__LIBGCC_INIT_SECTION_ASM_OP__) */
+#endif /* USE_EH_FRAME_REGISTRY || __LIBGCC_JCR_SECTION_NAME__ || USE_TM_CLONE_REGISTRY */
 
 #else  /* OBJECT_FORMAT_ELF */
 
@@ -513,7 +517,7 @@ __do_global_ctors (void)
 #endif
 }
 
-asm (INIT_SECTION_ASM_OP);	/* cc1 doesn't know that we are switching! */
+asm (__LIBGCC_INIT_SECTION_ASM_OP__);	/* cc1 doesn't know that we are switching! */
 
 /* A routine to invoke all of the global constructors upon entry to the
    program.  We put this into the .init section (for systems that have
@@ -524,7 +528,7 @@ static void __attribute__((used))
 __do_global_ctors_aux (void)	/* prologue goes in .init section */
 {
   FORCE_CODE_SECTION_ALIGN	/* explicit align before switch to .text */
-  asm (TEXT_SECTION_ASM_OP);	/* don't put epilogue and body in .init */
+  asm (__LIBGCC_TEXT_SECTION_ASM_OP__);	/* don't put epilogue and body in .init */
   DO_GLOBAL_CTORS_BODY;
   atexit (__do_global_dtors);
 }
@@ -531,7 +535,7 @@ __do_global_ctors_aux (void)	/* prologue goes in .
 
 #endif /* OBJECT_FORMAT_ELF */
 
-#elif defined(HAS_INIT_SECTION) /* ! INIT_SECTION_ASM_OP */
+#elif defined(HAS_INIT_SECTION) /* ! __LIBGCC_INIT_SECTION_ASM_OP__ */
 
 extern void __do_global_dtors (void);
 
@@ -557,7 +561,7 @@ __do_global_dtors (void)
 }
 
 #if defined(USE_EH_FRAME_REGISTRY) \
-    || defined(JCR_SECTION_NAME) \
+    || defined(__LIBGCC_JCR_SECTION_NAME__) \
     || defined(USE_TM_CLONE_REGISTRY)
 /* A helper function for __do_global_ctors, which is in crtend.o.  Here
    in crtbegin.o, we can reference a couple of symbols not visible there.
@@ -572,7 +576,7 @@ __do_global_ctors_1(void)
     __register_frame_info (__EH_FRAME_BEGIN__, &object);
 #endif
 
-#ifdef JCR_SECTION_NAME
+#ifdef __LIBGCC_JCR_SECTION_NAME__
   void **jcr_list
   __asm ("" : "=g" (jcr_list) : "0" (__JCR_LIST__));
   if (__builtin_expect (*jcr_list != NULL, 0))
@@ -588,9 +592,9 @@ __do_global_ctors_1(void)
   register_tm_clones ();
 #endif /* USE_TM_CLONE_REGISTRY */
 }
-#endif /* USE_EH_FRAME_REGISTRY || JCR_SECTION_NAME || USE_TM_CLONE_REGISTRY */
+#endif /* USE_EH_FRAME_REGISTRY || __LIBGCC_JCR_SECTION_NAME__ || USE_TM_CLONE_REGISTRY */
 
-#else /* ! INIT_SECTION_ASM_OP && ! HAS_INIT_SECTION */
+#else /* ! __LIBGCC_INIT_SECTION_ASM_OP__ && ! HAS_INIT_SECTION */
 #error "What are you doing with crtstuff.c, then?"
 #endif
 
@@ -607,11 +611,11 @@ __do_global_ctors_1(void)
 
 #ifdef CTOR_LIST_END
 CTOR_LIST_END;
-#elif defined(CTORS_SECTION_ASM_OP)
+#elif defined(__LIBGCC_CTORS_SECTION_ASM_OP__)
 /* Hack: force cc1 to switch to .data section early, so that assembling
    __CTOR_LIST__ does not undo our behind-the-back change to .ctors.  */
 static func_ptr force_to_data[1] __attribute__ ((__used__)) = { };
-asm (CTORS_SECTION_ASM_OP);
+asm (__LIBGCC_CTORS_SECTION_ASM_OP__);
 STATIC func_ptr __CTOR_END__[1]
   __attribute__((aligned(sizeof(func_ptr))))
   = { (func_ptr) 0 };
@@ -624,18 +628,18 @@ STATIC func_ptr __CTOR_END__[1]
 #ifdef DTOR_LIST_END
 DTOR_LIST_END;
 #elif defined(HIDDEN_DTOR_LIST_END)
-#ifdef DTORS_SECTION_ASM_OP
-asm (DTORS_SECTION_ASM_OP);
+#ifdef __LIBGCC_DTORS_SECTION_ASM_OP__
+asm (__LIBGCC_DTORS_SECTION_ASM_OP__);
 #endif
 func_ptr __DTOR_END__[1]
   __attribute__ ((used,
-#ifndef DTORS_SECTION_ASM_OP
+#ifndef __LIBGCC_DTORS_SECTION_ASM_OP__
 		  section(".dtors"),
 #endif
 		  aligned(sizeof(func_ptr)), visibility ("hidden")))
   = { (func_ptr) 0 };
-#elif defined(DTORS_SECTION_ASM_OP)
-asm (DTORS_SECTION_ASM_OP);
+#elif defined(__LIBGCC_DTORS_SECTION_ASM_OP__)
+asm (__LIBGCC_DTORS_SECTION_ASM_OP__);
 STATIC func_ptr __DTOR_END__[1]
   __attribute__ ((used, aligned(sizeof(func_ptr))))
   = { (func_ptr) 0 };
@@ -646,7 +650,7 @@ STATIC func_ptr __DTOR_END__[1]
 #endif
 #endif /* USE_INITFINI_ARRAY */
 
-#ifdef EH_FRAME_SECTION_NAME
+#ifdef __LIBGCC_EH_FRAME_SECTION_NAME__
 /* Terminate the frame unwind info section with a 4byte 0 as a sentinel;
    this would be the 'length' field in a real FDE.  */
 # if __INT_MAX__ == 2147483647
@@ -659,18 +663,18 @@ typedef short int32;
 #  error "Missing a 4 byte integer"
 # endif
 STATIC EH_FRAME_SECTION_CONST int32 __FRAME_END__[]
-     __attribute__ ((used, section(EH_FRAME_SECTION_NAME),
+     __attribute__ ((used, section(__LIBGCC_EH_FRAME_SECTION_NAME__),
 		     aligned(sizeof(int32))))
      = { 0 };
-#endif /* EH_FRAME_SECTION_NAME */
+#endif /* __LIBGCC_EH_FRAME_SECTION_NAME__ */
 
-#ifdef JCR_SECTION_NAME
+#ifdef __LIBGCC_JCR_SECTION_NAME__
 /* Null terminate the .jcr section array.  */
 STATIC void *__JCR_END__[1]
-   __attribute__ ((used, section(JCR_SECTION_NAME),
+   __attribute__ ((used, section(__LIBGCC_JCR_SECTION_NAME__),
 		   aligned(sizeof(void *))))
    = { 0 };
-#endif /* JCR_SECTION_NAME */
+#endif /* __LIBGCC_JCR_SECTION_NAME__ */
 
 #if USE_TM_CLONE_REGISTRY
 # ifndef HAVE_GAS_HIDDEN
@@ -685,11 +689,11 @@ func_ptr __TMC_END__[]
 # endif
 #endif /* USE_TM_CLONE_REGISTRY */
 
-#ifdef INIT_ARRAY_SECTION_ASM_OP
+#ifdef __LIBGCC_INIT_ARRAY_SECTION_ASM_OP__
 
 /* If we are using .init_array, there is nothing to do.  */
 
-#elif defined(INIT_SECTION_ASM_OP)
+#elif defined(__LIBGCC_INIT_SECTION_ASM_OP__)
 
 #ifdef OBJECT_FORMAT_ELF
 static void __attribute__((used))
@@ -701,7 +705,7 @@ __do_global_ctors_aux (void)
 }
 
 /* Stick a call to __do_global_ctors_aux into the .init section.  */
-CRT_CALL_STATIC_FUNCTION (INIT_SECTION_ASM_OP, __do_global_ctors_aux)
+CRT_CALL_STATIC_FUNCTION (__LIBGCC_INIT_SECTION_ASM_OP__, __do_global_ctors_aux)
 #else  /* OBJECT_FORMAT_ELF */
 
 /* Stick the real initialization code, followed by a normal sort of
@@ -728,17 +732,17 @@ __do_global_ctors_aux (void)
 static void
 __do_global_ctors_aux (void)	/* prologue goes in .text section */
 {
-  asm (INIT_SECTION_ASM_OP);
+  asm (__LIBGCC_INIT_SECTION_ASM_OP__);
   DO_GLOBAL_CTORS_BODY;
   atexit (__do_global_dtors);
 }				/* epilogue and body go in .init section */
 
 FORCE_CODE_SECTION_ALIGN
-asm (TEXT_SECTION_ASM_OP);
+asm (__LIBGCC_TEXT_SECTION_ASM_OP__);
 
 #endif /* OBJECT_FORMAT_ELF */
 
-#elif defined(HAS_INIT_SECTION) /* ! INIT_SECTION_ASM_OP */
+#elif defined(HAS_INIT_SECTION) /* ! __LIBGCC_INIT_SECTION_ASM_OP__ */
 
 extern void __do_global_ctors (void);
 
@@ -750,7 +754,7 @@ __do_global_ctors (void)
 {
   func_ptr *p;
 #if defined(USE_EH_FRAME_REGISTRY) \
-    || defined(JCR_SECTION_NAME) \
+    || defined(__LIBGCC_JCR_SECTION_NAME__) \
     || defined(USE_TM_CLONE_REGISTRY)
   __do_global_ctors_1();
 #endif
@@ -758,7 +762,7 @@ __do_global_ctors (void)
     (*p) ();
 }
 
-#else /* ! INIT_SECTION_ASM_OP && ! HAS_INIT_SECTION */
+#else /* ! __LIBGCC_INIT_SECTION_ASM_OP__ && ! HAS_INIT_SECTION */
 #error "What are you doing with crtstuff.c, then?"
 #endif
 
Index: libgcc/generic-morestack.c
===================================================================
--- libgcc/generic-morestack.c	(revision 214898)
+++ libgcc/generic-morestack.c	(working copy)
@@ -378,7 +378,7 @@ allocate_segment (size_t frame_size)
     {
       void *guard;
 
-#ifdef STACK_GROWS_DOWNWARD
+#ifdef __LIBGCC_STACK_GROWS_DOWNWARD__
       guard = space;
       space = (char *) space + pagesize;
 #else
@@ -496,7 +496,7 @@ __generic_morestack_set_initial_sp (void *sp, size
      to the nearest 512 byte boundary.  It's not essential that we be
      precise here; getting it wrong will just leave some stack space
      unused.  */
-#ifdef STACK_GROWS_DOWNWARD
+#ifdef __LIBGCC_STACK_GROWS_DOWNWARD__
   sp = (void *) ((((__UINTPTR_TYPE__) sp + 511U) / 512U) * 512U);
 #else
   sp = (void *) ((((__UINTPTR_TYPE__) sp - 511U) / 512U) * 512U);
@@ -584,7 +584,7 @@ __generic_morestack (size_t *pframe_size, void *ol
   /* Align the returned stack to a 32-byte boundary.  */
   aligned = (param_size + 31) & ~ (size_t) 31;
 
-#ifdef STACK_GROWS_DOWNWARD
+#ifdef __LIBGCC_STACK_GROWS_DOWNWARD__
   {
     char *bottom = (char *) (current + 1) + current->size;
     to = bottom - aligned;
@@ -628,7 +628,7 @@ __generic_releasestack (size_t *pavailable)
 
   if (current != NULL)
     {
-#ifdef STACK_GROWS_DOWNWARD
+#ifdef __LIBGCC_STACK_GROWS_DOWNWARD__
       *pavailable = (char *) old_stack - (char *) (current + 1);
 #else
       *pavailable = (char *) (current + 1) + current->size - (char *) old_stack;
@@ -639,7 +639,7 @@ __generic_releasestack (size_t *pavailable)
       size_t used;
 
       /* We have popped back to the original stack.  */
-#ifdef STACK_GROWS_DOWNWARD
+#ifdef __LIBGCC_STACK_GROWS_DOWNWARD__
       if ((char *) old_stack >= (char *) __morestack_initial_sp.sp)
 	used = 0;
       else
@@ -778,7 +778,7 @@ __generic_findstack (void *stack)
 	  && (char *) pss + pss->size > (char *) stack)
 	{
 	  __morestack_current_segment = pss;
-#ifdef STACK_GROWS_DOWNWARD
+#ifdef __LIBGCC_STACK_GROWS_DOWNWARD__
 	  return (char *) stack - (char *) (pss + 1);
 #else
 	  return (char *) (pss + 1) + pss->size - (char *) stack;
@@ -791,7 +791,7 @@ __generic_findstack (void *stack)
   if (__morestack_initial_sp.sp == NULL)
     return 0;
 
-#ifdef STACK_GROWS_DOWNWARD
+#ifdef __LIBGCC_STACK_GROWS_DOWNWARD__
   if ((char *) stack >= (char *) __morestack_initial_sp.sp)
     used = 0;
   else
@@ -869,7 +869,7 @@ __splitstack_find (void *segment_arg, void *sp, si
 
       *next_segment = (void *) (uintptr_type) 2;
       *next_sp = NULL;
-#ifdef STACK_GROWS_DOWNWARD
+#ifdef __LIBGCC_STACK_GROWS_DOWNWARD__
       if ((char *) sp >= isp)
 	return NULL;
       *len = (char *) isp - (char *) sp;
@@ -942,7 +942,7 @@ __splitstack_find (void *segment_arg, void *sp, si
       *next_sp = (void *) nsp;
     }
 
-#ifdef STACK_GROWS_DOWNWARD
+#ifdef __LIBGCC_STACK_GROWS_DOWNWARD__
   *len = (char *) (segment + 1) + segment->size - (char *) sp;
   ret = (void *) sp;
 #else
@@ -1046,7 +1046,7 @@ __splitstack_makecontext (size_t stack_size, void
   segment = allocate_segment (stack_size);
   context[MORESTACK_SEGMENTS] = segment;
   context[CURRENT_SEGMENT] = segment;
-#ifdef STACK_GROWS_DOWNWARD
+#ifdef __LIBGCC_STACK_GROWS_DOWNWARD__
   initial_sp = (void *) ((char *) (segment + 1) + segment->size);
 #else
   initial_sp = (void *) (segment + 1);
@@ -1082,13 +1082,13 @@ __splitstack_resetcontext (void *context[10], size
       initial_sp = context[INITIAL_SP];
       initial_size = (uintptr_type) context[INITIAL_SP_LEN];
       ret = initial_sp;
-#ifdef STACK_GROWS_DOWNWARD
+#ifdef __LIBGCC_STACK_GROWS_DOWNWARD__
       ret = (void *) ((char *) ret - initial_size);
 #endif
     }
   else
     {
-#ifdef STACK_GROWS_DOWNWARD
+#ifdef __LIBGCC_STACK_GROWS_DOWNWARD__
       initial_sp = (void *) ((char *) (segment + 1) + segment->size);
 #else
       initial_sp = (void *) (segment + 1);
Index: libgcc/libgcc2.c
===================================================================
--- libgcc/libgcc2.c	(revision 214898)
+++ libgcc/libgcc2.c	(working copy)
@@ -2209,7 +2209,8 @@ TRANSFER_FROM_TRAMPOLINE
 #define SYMBOL__MAIN __main
 #endif
 
-#if defined (INIT_SECTION_ASM_OP) || defined (INIT_ARRAY_SECTION_ASM_OP)
+#if defined (__LIBGCC_INIT_SECTION_ASM_OP__) \
+    || defined (__LIBGCC_INIT_ARRAY_SECTION_ASM_OP__)
 #undef HAS_INIT_SECTION
 #define HAS_INIT_SECTION
 #endif
@@ -2219,7 +2220,7 @@ TRANSFER_FROM_TRAMPOLINE
 /* Some ELF crosses use crtstuff.c to provide __CTOR_LIST__, but use this
    code to run constructors.  In that case, we need to handle EH here, too.  */
 
-#ifdef EH_FRAME_SECTION_NAME
+#ifdef __LIBGCC_EH_FRAME_SECTION_NAME__
 #include "unwind-dw2-fde.h"
 extern unsigned char __EH_FRAME_BEGIN__[];
 #endif
@@ -2239,7 +2240,7 @@ __do_global_dtors (void)
       (*(p-1)) ();
     }
 #endif
-#if defined (EH_FRAME_SECTION_NAME) && !defined (HAS_INIT_SECTION)
+#if defined (__LIBGCC_EH_FRAME_SECTION_NAME__) && !defined (HAS_INIT_SECTION)
   {
     static int completed = 0;
     if (! completed)
@@ -2258,7 +2259,7 @@ __do_global_dtors (void)
 void
 __do_global_ctors (void)
 {
-#ifdef EH_FRAME_SECTION_NAME
+#ifdef __LIBGCC_EH_FRAME_SECTION_NAME__
   {
     static struct object object;
     __register_frame_info (__EH_FRAME_BEGIN__, &object);
@@ -2312,7 +2313,8 @@ SYMBOL__MAIN (void)
    must be in the bss/common section.
 
    Long term no port should use those extensions.  But many still do.  */
-#if !defined(INIT_SECTION_ASM_OP) && !defined(CTOR_LISTS_DEFINED_EXTERNALLY)
+#if !defined(__LIBGCC_INIT_SECTION_ASM_OP__) \
+    && !defined(CTOR_LISTS_DEFINED_EXTERNALLY)
 #if defined (TARGET_ASM_CONSTRUCTOR) || defined (USE_COLLECT2)
 func_ptr __CTOR_LIST__[2] = {0, 0};
 func_ptr __DTOR_LIST__[2] = {0, 0};
@@ -2320,6 +2322,6 @@ func_ptr __DTOR_LIST__[2] = {0, 0};
 func_ptr __CTOR_LIST__[2];
 func_ptr __DTOR_LIST__[2];
 #endif
-#endif /* no INIT_SECTION_ASM_OP and not CTOR_LISTS_DEFINED_EXTERNALLY */
+#endif /* no __LIBGCC_INIT_SECTION_ASM_OP__ and not CTOR_LISTS_DEFINED_EXTERNALLY */
 #endif /* L_ctors */
 #endif /* LIBGCC2_UNITS_PER_WORD <= MIN_UNITS_PER_WORD */
Index: libgcc/libgcov-profiler.c
===================================================================
--- libgcc/libgcov-profiler.c	(revision 214898)
+++ libgcc/libgcov-profiler.c	(working copy)
@@ -100,20 +100,11 @@ __gcov_one_value_profiler (gcov_type *counters, gc
 /* By default, the C++ compiler will use function addresses in the
    vtable entries.  Setting TARGET_VTABLE_USES_DESCRIPTORS to nonzero
    tells the compiler to use function descriptors instead.  The value
-   of this macro says how many words wide the descriptor is (normally 2),
-   but it may be dependent on target flags.  Since we do not have access
-   to the target flags here we just check to see if it is set and use
-   that to set VTABLE_USES_DESCRIPTORS to 0 or 1.
+   of this macro says how many words wide the descriptor is (normally 2).
 
    It is assumed that the address of a function descriptor may be treated
    as a pointer to a function.  */
 
-#ifdef TARGET_VTABLE_USES_DESCRIPTORS
-#define VTABLE_USES_DESCRIPTORS 1
-#else
-#define VTABLE_USES_DESCRIPTORS 0
-#endif
-
 /* Tries to determine the most common value among its inputs. */
 void
 __gcov_indirect_call_profiler (gcov_type* counter, gcov_type value,
@@ -123,7 +114,7 @@ __gcov_indirect_call_profiler (gcov_type* counter,
      function may have multiple descriptors and we need to dereference
      the descriptors to see if they point to the same function.  */
   if (cur_func == callee_func
-      || (VTABLE_USES_DESCRIPTORS && callee_func
+      || (__LIBGCC_VTABLE_USES_DESCRIPTORS__ && callee_func
           && *(void **) cur_func == *(void **) callee_func))
     __gcov_one_value_profiler_body (counter, value);
 }
@@ -148,20 +139,11 @@ gcov_type * __gcov_indirect_call_counters;
 /* By default, the C++ compiler will use function addresses in the
    vtable entries.  Setting TARGET_VTABLE_USES_DESCRIPTORS to nonzero
    tells the compiler to use function descriptors instead.  The value
-   of this macro says how many words wide the descriptor is (normally 2),
-   but it may be dependent on target flags.  Since we do not have access
-   to the target flags here we just check to see if it is set and use
-   that to set VTABLE_USES_DESCRIPTORS to 0 or 1.
+   of this macro says how many words wide the descriptor is (normally 2).
 
    It is assumed that the address of a function descriptor may be treated
    as a pointer to a function.  */
 
-#ifdef TARGET_VTABLE_USES_DESCRIPTORS
-#define VTABLE_USES_DESCRIPTORS 1
-#else
-#define VTABLE_USES_DESCRIPTORS 0
-#endif
-
 /* Tries to determine the most common value among its inputs. */
 void
 __gcov_indirect_call_profiler_v2 (gcov_type value, void* cur_func)
@@ -170,7 +152,7 @@ __gcov_indirect_call_profiler_v2 (gcov_type value,
      function may have multiple descriptors and we need to dereference
      the descriptors to see if they point to the same function.  */
   if (cur_func == __gcov_indirect_call_callee
-      || (VTABLE_USES_DESCRIPTORS && __gcov_indirect_call_callee
+      || (__LIBGCC_VTABLE_USES_DESCRIPTORS__ && __gcov_indirect_call_callee
           && *(void **) cur_func == *(void **) __gcov_indirect_call_callee))
     __gcov_one_value_profiler_body (__gcov_indirect_call_counters, value);
 }
Index: libgcc/unwind-dw2.c
===================================================================
--- libgcc/unwind-dw2.c	(revision 214898)
+++ libgcc/unwind-dw2.c	(working copy)
@@ -43,16 +43,16 @@
 
 #ifndef __USING_SJLJ_EXCEPTIONS__
 
-#ifndef STACK_GROWS_DOWNWARD
-#define STACK_GROWS_DOWNWARD 0
+#ifndef __LIBGCC_STACK_GROWS_DOWNWARD__
+#define __LIBGCC_STACK_GROWS_DOWNWARD__ 0
 #else
-#undef STACK_GROWS_DOWNWARD
-#define STACK_GROWS_DOWNWARD 1
+#undef __LIBGCC_STACK_GROWS_DOWNWARD__
+#define __LIBGCC_STACK_GROWS_DOWNWARD__ 1
 #endif
 
 /* Dwarf frame registers used for pre gcc 3.0 compiled glibc.  */
 #ifndef PRE_GCC3_DWARF_FRAME_REGISTERS
-#define PRE_GCC3_DWARF_FRAME_REGISTERS DWARF_FRAME_REGISTERS
+#define PRE_GCC3_DWARF_FRAME_REGISTERS __LIBGCC_DWARF_FRAME_REGISTERS__
 #endif
 
 #ifndef DWARF_REG_TO_UNWIND_COLUMN
@@ -86,7 +86,7 @@
    ignore unwind data for unknown columns.  */
 
 #define UNWIND_COLUMN_IN_RANGE(x) \
-    __builtin_expect((x) <= DWARF_FRAME_REGISTERS, 1)
+    __builtin_expect((x) <= __LIBGCC_DWARF_FRAME_REGISTERS__, 1)
 
 #ifdef REG_VALUE_IN_UNWIND_CONTEXT
 typedef _Unwind_Word _Unwind_Context_Reg_Val;
@@ -131,7 +131,7 @@ _Unwind_Get_Unwind_Context_Reg_Val (_Unwind_Word v
    to its caller.  */
 struct _Unwind_Context
 {
-  _Unwind_Context_Reg_Val reg[DWARF_FRAME_REGISTERS+1];
+  _Unwind_Context_Reg_Val reg[__LIBGCC_DWARF_FRAME_REGISTERS__+1];
   void *cfa;
   void *ra;
   void *lsda;
@@ -145,11 +145,11 @@ struct _Unwind_Context
      struct _Unwind_Context.  */
   _Unwind_Word version;
   _Unwind_Word args_size;
-  char by_value[DWARF_FRAME_REGISTERS+1];
+  char by_value[__LIBGCC_DWARF_FRAME_REGISTERS__+1];
 };
 
 /* Byte size of every register managed by these routines.  */
-static unsigned char dwarf_reg_size_table[DWARF_FRAME_REGISTERS+1];
+static unsigned char dwarf_reg_size_table[__LIBGCC_DWARF_FRAME_REGISTERS__+1];
 
 \f
 /* Read unaligned data from the instruction buffer.  */
@@ -1190,7 +1190,7 @@ execute_cfa_program (const unsigned char *insn_ptr
 
 	case DW_CFA_GNU_window_save:
 	  /* ??? Hardcoded for SPARC register window configuration.  */
-	  if (DWARF_FRAME_REGISTERS >= 32)
+	  if (__LIBGCC_DWARF_FRAME_REGISTERS__ >= 32)
 	    for (reg = 16; reg < 32; ++reg)
 	      {
 		fs->regs.reg[reg].how = REG_SAVED_OFFSET;
@@ -1384,7 +1384,7 @@ uw_update_context_1 (struct _Unwind_Context *conte
   void *cfa;
   long i;
 
-#ifdef EH_RETURN_STACKADJ_RTX
+#ifdef __LIBGCC_EH_RETURN_STACKADJ_RTX__
   /* Special handling here: Many machines do not use a frame pointer,
      and track the CFA only through offsets from the stack pointer from
      one frame to the next.  In this case, the stack pointer is never
@@ -1432,7 +1432,7 @@ uw_update_context_1 (struct _Unwind_Context *conte
   context->cfa = cfa;
 
   /* Compute the addresses of all registers saved in this frame.  */
-  for (i = 0; i < DWARF_FRAME_REGISTERS + 1; ++i)
+  for (i = 0; i < __LIBGCC_DWARF_FRAME_REGISTERS__ + 1; ++i)
     switch (fs->regs.reg[i].how)
       {
       case REG_UNSAVED:
@@ -1638,7 +1638,7 @@ uw_install_context_1 (struct _Unwind_Context *curr
   if (!_Unwind_GetGRPtr (target, __builtin_dwarf_sp_column ()))
     _Unwind_SetSpColumn (target, target->cfa, &sp_slot);
 
-  for (i = 0; i < DWARF_FRAME_REGISTERS; ++i)
+  for (i = 0; i < __LIBGCC_DWARF_FRAME_REGISTERS__; ++i)
     {
       void *c = (void *) (_Unwind_Internal_Ptr) current->reg[i];
       void *t = (void *) (_Unwind_Internal_Ptr)target->reg[i];
@@ -1674,7 +1674,7 @@ uw_install_context_1 (struct _Unwind_Context *curr
       target_cfa = _Unwind_GetPtr (target, __builtin_dwarf_sp_column ());
 
       /* We adjust SP by the difference between CURRENT and TARGET's CFA.  */
-      if (STACK_GROWS_DOWNWARD)
+      if (__LIBGCC_STACK_GROWS_DOWNWARD__)
 	return target_cfa - current->cfa + target->args_size;
       else
 	return current->cfa - target_cfa - target->args_size;
@@ -1688,7 +1688,7 @@ uw_identify_context (struct _Unwind_Context *conte
   /* The CFA is not sufficient to disambiguate the context of a function
      interrupted by a signal before establishing its frame and the context
      of the signal itself.  */
-  if (STACK_GROWS_DOWNWARD)
+  if (__LIBGCC_STACK_GROWS_DOWNWARD__)
     return _Unwind_GetCFA (context) - _Unwind_IsSignalFrame (context);
   else
     return _Unwind_GetCFA (context) + _Unwind_IsSignalFrame (context);
Index: libgcc/unwind-dw2.h
===================================================================
--- libgcc/unwind-dw2.h	(revision 214898)
+++ libgcc/unwind-dw2.h	(working copy)
@@ -22,12 +22,6 @@
    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
-/* A target can override (perhaps for backward compatibility) how
-   many dwarf2 columns are unwound.  */
-#ifndef DWARF_FRAME_REGISTERS
-#define DWARF_FRAME_REGISTERS FIRST_PSEUDO_REGISTER
-#endif
-
 /* The result of interpreting the frame unwind info for a frame.
    This is all symbolic at this point, as none of the values can
    be resolved until the target pc is located.  */
@@ -52,7 +46,7 @@ typedef struct
 	REG_SAVED_VAL_EXP,
 	REG_UNDEFINED
       } how;
-    } reg[DWARF_FRAME_REGISTERS+1];
+    } reg[__LIBGCC_DWARF_FRAME_REGISTERS__+1];
 
     /* Used to implement DW_CFA_remember_state.  */
     struct frame_state_reg_info *prev;
Index: libgcc/unwind-sjlj.c
===================================================================
--- libgcc/unwind-sjlj.c	(revision 214898)
+++ libgcc/unwind-sjlj.c	(working copy)
@@ -32,11 +32,11 @@
 
 #ifdef __USING_SJLJ_EXCEPTIONS__
 
-#ifdef DONT_USE_BUILTIN_SETJMP
+#ifdef __LIBGCC_DONT_USE_BUILTIN_SETJMP__
 #ifndef inhibit_libc
 #include <setjmp.h>
 #else
-typedef void *jmp_buf[JMP_BUF_SIZE];
+typedef void *jmp_buf[__LIBGCC_JMP_BUF_SIZE__];
 extern void longjmp(jmp_buf, int) __attribute__((noreturn));
 #endif
 #else
@@ -70,7 +70,7 @@ struct SjLj_Function_Context
   _Unwind_Personality_Fn personality;
   void *lsda;
 
-#ifdef DONT_USE_BUILTIN_SETJMP
+#ifdef __LIBGCC_DONT_USE_BUILTIN_SETJMP__
   /* We don't know what sort of alignment requirements the system
      jmp_buf has.  We over estimated in except.c, and now we have
      to match that here just in case the system *didn't* have more
@@ -185,7 +185,7 @@ _Unwind_GetCFA (struct _Unwind_Context *context __
 {
   /* ??? Ideally __builtin_setjmp places the CFA in the jmpbuf.  */
 
-#ifndef DONT_USE_BUILTIN_SETJMP
+#ifndef __LIBGCC_DONT_USE_BUILTIN_SETJMP__
   /* This is a crude imitation of the CFA: the saved stack pointer.
      This is roughly the CFA of the frame before CONTEXT.  When using the
      DWARF-2 unwinder _Unwind_GetCFA returns the CFA of the frame described

-- 
Joseph S. Myers
joseph@codesourcery.com

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

end of thread, other threads:[~2014-09-05 15:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-05 15:18 Use -fbuilding-libgcc for more target macros used in libgcc Dominique Dhumieres
  -- strict thread matches above, loose matches on Subject: below --
2014-09-05  1:15 Joseph S. Myers
2014-09-05  3:18 ` Ian Lance Taylor

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).