From 325b8c3ceb2723870dd89f0da419841e2454b273 Mon Sep 17 00:00:00 2001 From: jsm28 Date: Fri, 5 Sep 2014 12:03:46 +0000 Subject: [PATCH] Use -fbuilding-libgcc for more target macros used in libgcc. gcc/c-family: * 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: * 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__. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@214954 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-family/ChangeLog | 18 +++++ gcc/c-family/c-cppbuiltin.c | 115 +++++++++++++++++++++++++++++-- libgcc/ChangeLog | 88 +++++++++++++++++++++++ libgcc/Makefile.in | 2 +- libgcc/config/aarch64/linux-unwind.h | 9 +-- libgcc/config/alpha/vms-unwind.h | 2 +- libgcc/config/cr16/unwind-cr16.c | 26 +++---- libgcc/config/cr16/unwind-dw2.h | 8 +-- libgcc/config/i386/cygming-crtbegin.c | 4 +- libgcc/config/i386/cygming-crtend.c | 4 +- libgcc/config/mips/linux-unwind.h | 9 +-- libgcc/config/nios2/linux-unwind.h | 2 +- libgcc/config/pa/hpux-unwind.h | 4 +- libgcc/config/pa/linux-unwind.h | 7 +- libgcc/config/rs6000/aix-unwind.h | 10 +-- libgcc/config/rs6000/darwin-fallback.c | 2 +- libgcc/config/rs6000/linux-unwind.h | 4 +- libgcc/config/sparc/linux-unwind.h | 2 +- libgcc/config/sparc/sol2-unwind.h | 2 +- libgcc/config/tilepro/linux-unwind.h | 2 +- libgcc/config/xtensa/unwind-dw2-xtensa.h | 6 -- libgcc/crtstuff.c | 102 ++++++++++++++------------- libgcc/generic-morestack.c | 24 +++---- libgcc/libgcc2.c | 14 ++-- libgcc/libgcov-profiler.c | 26 ++----- libgcc/unwind-dw2.c | 30 ++++---- libgcc/unwind-dw2.h | 8 +-- libgcc/unwind-sjlj.c | 8 +-- 28 files changed, 362 insertions(+), 176 deletions(-) diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 4f2cdd1d72e..38330fb9c8a 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,21 @@ +2014-09-05 Joseph Myers + + * 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. + 2014-09-05 Richard Biener PR middle-end/63148 diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c index d07c9809eab..a47473534b5 100644 --- a/gcc/c-family/c-cppbuiltin.c +++ b/gcc/c-family/c-cppbuiltin.c @@ -943,9 +943,74 @@ 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); @@ -1087,7 +1152,49 @@ builtin_define_with_value (const char *macro, const char *expansion, int is_str) 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) diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 014febb291a..01b5883fc72 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,91 @@ +2014-09-05 Joseph Myers + + * 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__. + 2014-09-02 Nathan sidwell * libgcov-interface.c (STRONG_ALIAS): New. diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in index e9caad3eeec..6a6cf66d698 100644 --- a/libgcc/Makefile.in +++ b/libgcc/Makefile.in @@ -283,7 +283,7 @@ INTERNAL_CFLAGS = $(CFLAGS) $(LIBGCC2_CFLAGS) $(HOST_LIBGCC2_CFLAGS) \ 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. diff --git a/libgcc/config/aarch64/linux-unwind.h b/libgcc/config/aarch64/linux-unwind.h index 6b5b3cd1d91..8521c0cf3ba 100644 --- a/libgcc/config/aarch64/linux-unwind.h +++ b/libgcc/config/aarch64/linux-unwind.h @@ -81,7 +81,7 @@ aarch64_fallback_frame_state (struct _Unwind_Context *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; for (i = 0; i < AARCH64_DWARF_NUMBER_R; i++) @@ -144,11 +144,12 @@ aarch64_fallback_frame_state (struct _Unwind_Context *context, 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; } diff --git a/libgcc/config/alpha/vms-unwind.h b/libgcc/config/alpha/vms-unwind.h index 8bb477786c1..8d89059135b 100644 --- a/libgcc/config/alpha/vms-unwind.h +++ b/libgcc/config/alpha/vms-unwind.h @@ -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, diff --git a/libgcc/config/cr16/unwind-cr16.c b/libgcc/config/cr16/unwind-cr16.c index a02e97d5eb4..757726a6497 100644 --- a/libgcc/config/cr16/unwind-cr16.c +++ b/libgcc/config/cr16/unwind-cr16.c @@ -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 val) 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]; /* Read unaligned data from the instruction buffer. */ @@ -1327,7 +1327,7 @@ uw_update_context_1 (struct _Unwind_Context *context, _Unwind_FrameState *fs) 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 *context, _Unwind_FrameState *fs) 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 *current, 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 *current, 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 *context) /* 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); diff --git a/libgcc/config/cr16/unwind-dw2.h b/libgcc/config/cr16/unwind-dw2.h index d39049bbeab..c90756bc722 100644 --- a/libgcc/config/cr16/unwind-dw2.h +++ b/libgcc/config/cr16/unwind-dw2.h @@ -22,12 +22,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ -/* 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; diff --git a/libgcc/config/i386/cygming-crtbegin.c b/libgcc/config/i386/cygming-crtbegin.c index 3e8ed2239e4..a1513b7c062 100644 --- a/libgcc/config/i386/cygming-crtbegin.c +++ b/libgcc/config/i386/cygming-crtbegin.c @@ -95,7 +95,7 @@ _Jv_RegisterClasses (__attribute__((unused)) const void *p) 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 *) = NULL; #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 diff --git a/libgcc/config/i386/cygming-crtend.c b/libgcc/config/i386/cygming-crtend.c index d3beaf96635..4580ab915e1 100644 --- a/libgcc/config/i386/cygming-crtend.c +++ b/libgcc/config/i386/cygming-crtend.c @@ -48,7 +48,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 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 diff --git a/libgcc/config/mips/linux-unwind.h b/libgcc/config/mips/linux-unwind.h index 9cf7c807e21..6965eb60643 100644 --- a/libgcc/config/mips/linux-unwind.h +++ b/libgcc/config/mips/linux-unwind.h @@ -90,7 +90,7 @@ mips_fallback_frame_state (struct _Unwind_Context *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 *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; } diff --git a/libgcc/config/nios2/linux-unwind.h b/libgcc/config/nios2/linux-unwind.h index 92ff1f62982..7f7eb4ac40d 100644 --- a/libgcc/config/nios2/linux-unwind.h +++ b/libgcc/config/nios2/linux-unwind.h @@ -81,7 +81,7 @@ nios2_fallback_frame_state (struct _Unwind_Context *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. */ diff --git a/libgcc/config/pa/hpux-unwind.h b/libgcc/config/pa/hpux-unwind.h index 567ddd447ef..b510e13f885 100644 --- a/libgcc/config/pa/hpux-unwind.h +++ b/libgcc/config/pa/hpux-unwind.h @@ -349,8 +349,8 @@ pa_fallback_frame_state (struct _Unwind_Context *context, 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; diff --git a/libgcc/config/pa/linux-unwind.h b/libgcc/config/pa/linux-unwind.h index 485f2d98e76..9939f612b5e 100644 --- a/libgcc/config/pa/linux-unwind.h +++ b/libgcc/config/pa/linux-unwind.h @@ -131,10 +131,11 @@ pa32_fallback_frame_state (struct _Unwind_Context *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; } diff --git a/libgcc/config/rs6000/aix-unwind.h b/libgcc/config/rs6000/aix-unwind.h index e62194cd76f..b925db2dcbb 100644 --- a/libgcc/config/rs6000/aix-unwind.h +++ b/libgcc/config/rs6000/aix-unwind.h @@ -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,17 +204,17 @@ ppc_aix_fallback_frame_state (struct _Unwind_Context *context, /* 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 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); diff --git a/libgcc/config/rs6000/darwin-fallback.c b/libgcc/config/rs6000/darwin-fallback.c index 3f502d09da0..95cd83a6ec9 100644 --- a/libgcc/config/rs6000/darwin-fallback.c +++ b/libgcc/config/rs6000/darwin-fallback.c @@ -438,7 +438,7 @@ handle_syscall (_Unwind_FrameState *fs, const reg_unit gprs[32], } 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. diff --git a/libgcc/config/rs6000/linux-unwind.h b/libgcc/config/rs6000/linux-unwind.h index ffb4f07eeb6..1cff1a5453e 100644 --- a/libgcc/config/rs6000/linux-unwind.h +++ b/libgcc/config/rs6000/linux-unwind.h @@ -205,9 +205,9 @@ ppc_fallback_frame_state (struct _Unwind_Context *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__ diff --git a/libgcc/config/sparc/linux-unwind.h b/libgcc/config/sparc/linux-unwind.h index 61ba4717412..81eb16e0435 100644 --- a/libgcc/config/sparc/linux-unwind.h +++ b/libgcc/config/sparc/linux-unwind.h @@ -121,7 +121,7 @@ sparc64_frob_update_context (struct _Unwind_Context *context, 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); diff --git a/libgcc/config/sparc/sol2-unwind.h b/libgcc/config/sparc/sol2-unwind.h index f0ececa3c96..6638464997c 100644 --- a/libgcc/config/sparc/sol2-unwind.h +++ b/libgcc/config/sparc/sol2-unwind.h @@ -139,7 +139,7 @@ sparc64_frob_update_context (struct _Unwind_Context *context, 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); diff --git a/libgcc/config/tilepro/linux-unwind.h b/libgcc/config/tilepro/linux-unwind.h index 27481cfcdc9..0ebac90ecc9 100644 --- a/libgcc/config/tilepro/linux-unwind.h +++ b/libgcc/config/tilepro/linux-unwind.h @@ -78,7 +78,7 @@ tile_fallback_frame_state (struct _Unwind_Context *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) diff --git a/libgcc/config/xtensa/unwind-dw2-xtensa.h b/libgcc/config/xtensa/unwind-dw2-xtensa.h index c962ebb1302..69f3bcdd848 100644 --- a/libgcc/config/xtensa/unwind-dw2-xtensa.h +++ b/libgcc/config/xtensa/unwind-dw2-xtensa.h @@ -22,12 +22,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ -/* 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. */ diff --git a/libgcc/crtstuff.c b/libgcc/crtstuff.c index 9d5399acb5e..4bea6b9f8cc 100644 --- a/libgcc/crtstuff.c +++ b/libgcc/crtstuff.c @@ -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,21 +479,21 @@ 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 (); #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,14 +528,14 @@ 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); } #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 @@ CRT_CALL_STATIC_FUNCTION (INIT_SECTION_ASM_OP, __do_global_ctors_aux) 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 diff --git a/libgcc/generic-morestack.c b/libgcc/generic-morestack.c index f2d6d835fc4..da878640d04 100644 --- a/libgcc/generic-morestack.c +++ b/libgcc/generic-morestack.c @@ -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_t len) 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 *old_stack, size_t param_size) /* 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, size_t *len, *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, size_t *len, *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 *context[NUMBER_OFFSETS], 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_t *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); diff --git a/libgcc/libgcc2.c b/libgcc/libgcc2.c index 4787a3371fa..aea476a34e6 100644 --- a/libgcc/libgcc2.c +++ b/libgcc/libgcc2.c @@ -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 */ diff --git a/libgcc/libgcov-profiler.c b/libgcc/libgcov-profiler.c index 3290bf62cc2..5f0b052b952 100644 --- a/libgcc/libgcov-profiler.c +++ b/libgcc/libgcov-profiler.c @@ -100,20 +100,11 @@ __gcov_one_value_profiler (gcov_type *counters, gcov_type value) /* 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, 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 == 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, void* cur_func) 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); } diff --git a/libgcc/unwind-dw2.c b/libgcc/unwind-dw2.c index 55fc4bca132..e4744336031 100644 --- a/libgcc/unwind-dw2.c +++ b/libgcc/unwind-dw2.c @@ -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 val) 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]; /* 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 *context, _Unwind_FrameState *fs) 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 *context, _Unwind_FrameState *fs) 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 *current, 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 *current, 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 *context) /* 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); diff --git a/libgcc/unwind-dw2.h b/libgcc/unwind-dw2.h index d39049bbeab..c90756bc722 100644 --- a/libgcc/unwind-dw2.h +++ b/libgcc/unwind-dw2.h @@ -22,12 +22,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ -/* 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; diff --git a/libgcc/unwind-sjlj.c b/libgcc/unwind-sjlj.c index 59f8faa3b3a..0d9171cf733 100644 --- a/libgcc/unwind-sjlj.c +++ b/libgcc/unwind-sjlj.c @@ -32,11 +32,11 @@ #ifdef __USING_SJLJ_EXCEPTIONS__ -#ifdef DONT_USE_BUILTIN_SETJMP +#ifdef __LIBGCC_DONT_USE_BUILTIN_SETJMP__ #ifndef inhibit_libc #include #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 __attribute__((unused))) { /* ??? 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 -- 2.11.4.GIT