diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5e26b572a7e..27f5f129dca 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +Thu Sep 9 14:23:02 1999 Jason Merrill + + * defaults.h (EH_FRAME_SECTION, EH_FRAME_SECTION_ASM_OP): Define here. + * crtstuff.c: Not here. + * dwarf2out.c: Or here. + * libgcc2.c (__do_global_ctors, __do_global_dtors): Handle EH frame + info. + Thu Sep 9 09:40:58 1999 Mark Mitchell * function.h (free_after_compilation): Remove decl parameter. diff --git a/gcc/crtstuff.c b/gcc/crtstuff.c index ccebde1d2c9..6ce1c863acf 100644 --- a/gcc/crtstuff.c +++ b/gcc/crtstuff.c @@ -1,6 +1,6 @@ /* Specialized bits of code needed to support construction and destruction of file-scope objects in C++ code. - Copyright (C) 1991, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. + Copyright (C) 1991, 1994-1999 Free Software Foundation, Inc. Contributed by Ron Guilmette (rfg@monkeys.com). This file is part of GNU CC. @@ -108,9 +108,6 @@ extern void *__deregister_frame_info (void *) #ifndef DTORS_SECTION_ASM_OP #define DTORS_SECTION_ASM_OP ".section\t.dtors,\"aw\"" #endif -#if !defined (EH_FRAME_SECTION_ASM_OP) && defined (DWARF2_UNWIND_INFO) && defined(ASM_OUTPUT_SECTION_NAME) -#define EH_FRAME_SECTION_ASM_OP ".section\t.eh_frame,\"aw\"" -#endif #ifdef OBJECT_FORMAT_ELF diff --git a/gcc/defaults.h b/gcc/defaults.h index 90d483f308e..2fe8cd4772a 100644 --- a/gcc/defaults.h +++ b/gcc/defaults.h @@ -1,7 +1,7 @@ /* Definitions of various defaults for how to do assembler output (most of which are designed to be appropriate for GAS or for some BSD assembler). - Copyright (C) 1992, 1996, 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1992, 1996-1999 Free Software Foundation, Inc. Contributed by Ron Guilmette (rfg@monkeys.com) This file is part of GNU CC. @@ -155,6 +155,19 @@ do { fprintf (FILE, "\t%s\t", ASM_LONG); \ #define DWARF2_UNWIND_INFO 1 #endif +#if defined (DWARF2_UNWIND_INFO) && !defined (EH_FRAME_SECTION) +# if defined (EH_FRAME_SECTION_ASM_OP) +# define EH_FRAME_SECTION() eh_frame_section(); +# else + /* If we aren't using crtstuff to run ctors, don't use it for EH. */ +# if defined (ASM_OUTPUT_SECTION_NAME) && defined (ASM_OUTPUT_CONSTRUCTOR) +# define EH_FRAME_SECTION_ASM_OP ".section\t.eh_frame,\"aw\"" +# define EH_FRAME_SECTION() \ + do { named_section (NULL_TREE, ".eh_frame", 0); } while (0) +# endif +# endif +#endif + /* By default, we generate a label at the beginning and end of the text section, and compute the size of the text section by subtracting the two. However, on some platforms that doesn't diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 1d30f0d662a..a79339c32d1 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -1674,24 +1674,6 @@ output_cfi (cfi, fde) } } -#if !defined (EH_FRAME_SECTION) -#if defined (EH_FRAME_SECTION_ASM_OP) -#define EH_FRAME_SECTION() eh_frame_section(); -#else -#if defined (ASM_OUTPUT_SECTION_NAME) -#define EH_FRAME_SECTION() \ - do { \ - named_section (NULL_TREE, ".eh_frame", 0); \ - } while (0) -#endif -#endif -#endif - -/* If we aren't using crtstuff to run ctors, don't use it for EH. */ -#if !defined (HAS_INIT_SECTION) && !defined (INIT_SECTION_ASM_OP) -#undef EH_FRAME_SECTION -#endif - /* Output the call frame information used to used to record information that relates to calculating the frame pointer, and records the location of saved registers. */ diff --git a/gcc/libgcc2.c b/gcc/libgcc2.c index 6ac41438ecb..33481b14128 100644 --- a/gcc/libgcc2.c +++ b/gcc/libgcc2.c @@ -2836,6 +2836,15 @@ cacheflush (char *beg, int size, int flag) #endif #if !defined (HAS_INIT_SECTION) || !defined (OBJECT_FORMAT_ELF) + +/* 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 +#include "frame.h" +extern unsigned char __EH_FRAME_BEGIN__[]; +#endif + /* Run all the global destructors on exit from the program. */ void @@ -2851,6 +2860,9 @@ __do_global_dtors () (*(p-1)) (); } #endif +#ifdef EH_FRAME_SECTION + __deregister_frame_info (__EH_FRAME_BEGIN__); +#endif } #endif @@ -2871,6 +2883,12 @@ int *_exit_dummy_ref = &_exit_dummy_decl; void __do_global_ctors () { +#ifdef EH_FRAME_SECTION + { + static struct object object; + __register_frame_info (__EH_FRAME_BEGIN__, &object); + } +#endif DO_GLOBAL_CTORS_BODY; ON_EXIT (__do_global_dtors, 0); }