]> gcc.gnu.org Git - gcc.git/commitdiff
target.h (struct gcc_target): Add asm_out.exception_section, asm_out.eh_frame_section.
authorStan Shebs <shebs@apple.com>
Mon, 22 Oct 2001 14:43:31 +0000 (14:43 +0000)
committerStan Shebs <shebs@gcc.gnu.org>
Mon, 22 Oct 2001 14:43:31 +0000 (14:43 +0000)
        * target.h (struct gcc_target): Add asm_out.exception_section,
        asm_out.eh_frame_section.
        * target-def.h (TARGET_ASM_EXCEPTION_SECTION): New macro.
        (TARGET_ASM_EH_FRAME_SECTION): New.
        (TARGET_INITIALIZER): Update.
        * output.h (default_exception_section): Declare.
        (default_eh_frame_section): Declare.
        * dwarf2out.c: Include target.h.
        (output_call_frame_info): Call target hook for eh frames.
        (default_eh_frame_section): New function.
        * except.c: Include target.h.
        (output_function_exception_table): Call target hook for exception
        section.
        * varasm.c (default_exception_section): Rename from
        exception_section, remove EXCEPTION_SECTION macro.

        * config/darwin.h (darwin_eh_frame_section): New function.
        (EXCEPTION_SECTION): Remove.
        (TARGET_ASM_EXCEPTION_SECTION): Define.
        * config/nextstep.h (EH_FRAME_SECTION_ASM_OP): Remove.
        (nextstep_exception_section): New function.
        (nextstep_eh_frame_section): New function.
        (TARGET_ASM_EXCEPTION_SECTION): Define.
        (TARGET_ASM_EH_FRAME_SECTION): Define.

        * config/pa/som.h (EXCEPTION_SECTION): Remove.
        (TARGET_ASM_EXCEPTION_SECTION): Define.
        * config/rs6000/sysv4.h, config/rs6000/xcoff.h
        (EXCEPTION_SECTION): Remove.
        (TARGET_ASM_EXCEPTION_SECTION): Define.
        * config/stormy16/stormy16.h: Remove comments referencing
        EXCEPTION_SECTION and EH_FRAME_SECTION_ASM_OP.

        * doc/tm.texi: Document TARGET_ASM_EXCEPTION_SECTION and
        TARGET_ASM_EH_FRAME_SECTION.

From-SVN: r46409

14 files changed:
gcc/ChangeLog
gcc/config/darwin.h
gcc/config/nextstep.h
gcc/config/pa/som.h
gcc/config/rs6000/sysv4.h
gcc/config/rs6000/xcoff.h
gcc/config/stormy16/stormy16.h
gcc/doc/tm.texi
gcc/dwarf2out.c
gcc/except.c
gcc/output.h
gcc/target-def.h
gcc/target.h
gcc/varasm.c

index 171f78ff865e41c72923f6c37e8e127c03cc175a..5b0816e21f4b63b17852adc575b82cfc80e264f8 100644 (file)
@@ -1,3 +1,41 @@
+2001-10-22  Stan Shebs  <shebs@apple.com>
+
+       * target.h (struct gcc_target): Add asm_out.exception_section,
+       asm_out.eh_frame_section.
+       * target-def.h (TARGET_ASM_EXCEPTION_SECTION): New macro.
+       (TARGET_ASM_EH_FRAME_SECTION): New.
+       (TARGET_INITIALIZER): Update.
+       * output.h (default_exception_section): Declare.
+       (default_eh_frame_section): Declare.
+       * dwarf2out.c: Include target.h.
+       (output_call_frame_info): Call target hook for eh frames.
+       (default_eh_frame_section): New function.
+       * except.c: Include target.h.
+       (output_function_exception_table): Call target hook for exception
+       section.
+       * varasm.c (default_exception_section): Rename from
+       exception_section, remove EXCEPTION_SECTION macro.
+
+       * config/darwin.h (darwin_eh_frame_section): New function.
+       (EXCEPTION_SECTION): Remove.
+       (TARGET_ASM_EXCEPTION_SECTION): Define.
+       * config/nextstep.h (EH_FRAME_SECTION_ASM_OP): Remove.
+       (nextstep_exception_section): New function.
+       (nextstep_eh_frame_section): New function.
+       (TARGET_ASM_EXCEPTION_SECTION): Define.
+       (TARGET_ASM_EH_FRAME_SECTION): Define.
+
+       * config/pa/som.h (EXCEPTION_SECTION): Remove.
+       (TARGET_ASM_EXCEPTION_SECTION): Define.
+       * config/rs6000/sysv4.h, config/rs6000/xcoff.h
+       (EXCEPTION_SECTION): Remove.
+       (TARGET_ASM_EXCEPTION_SECTION): Define.
+       * config/stormy16/stormy16.h: Remove comments referencing
+       EXCEPTION_SECTION and EH_FRAME_SECTION_ASM_OP.
+
+       * doc/tm.texi: Document TARGET_ASM_EXCEPTION_SECTION and
+       TARGET_ASM_EH_FRAME_SECTION.
+
 2001-10-22  Nick Clifton  <nickc@cambridge.redhat.com>
 
        * config/mips/mips.md (mul_acc_si): Fix precedence of conditional
index d4a8197ce4a6ce9783ffc6e179edb5f68f0ed52b..35207af26d5d14d1115b06bb155b1409a56ed49b 100644 (file)
@@ -352,7 +352,7 @@ do { if (!strcmp (alias_name, name))                                        \
   in_machopic_lazy_symbol_ptr,                         \
   in_machopic_symbol_stub,                             \
   in_machopic_picsymbol_stub,                          \
-  in_darwin_exception, \
+  in_darwin_exception, in_darwin_eh_frame,             \
   num_sections
 
 #undef EXTRA_SECTION_FUNCTIONS
@@ -460,6 +460,9 @@ SECTION_FUNCTION (machopic_picsymbol_stub_section,  \
 SECTION_FUNCTION (darwin_exception_section,            \
                in_darwin_exception,                    \
                ".section __TEXT,__gcc_except_tab", 0)  \
+SECTION_FUNCTION (darwin_eh_frame_section,             \
+               in_darwin_eh_frame,                     \
+               ".section __TEXT,__eh_frame", 0)        \
                                                        \
 void                                           \
 objc_section_init ()                           \
@@ -781,8 +784,10 @@ enum machopic_addr_class {
       }                                                                \
   } while (0)
 
-#define EXCEPTION_SECTION() darwin_exception_section ()
+#define TARGET_ASM_EXCEPTION_SECTION darwin_exception_section
 
+#define TARGET_ASM_EH_FRAME_SECTION darwin_eh_frame_section
+  
 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)  \
   (((CODE) == 1 || (GLOBAL) == 0) ? DW_EH_PE_pcrel : DW_EH_PE_absptr)
 
index 956b9e27d42b56d87950d5401e88061cde3a35c9..827584371e16b9c526d6d2520e3e2e2573e4e874 100644 (file)
@@ -217,13 +217,10 @@ Boston, MA 02111-1307, USA.  */
 extern void nextstep_asm_out_constructor  PARAMS ((struct rtx_def *, int));
 extern void nextstep_asm_out_destructor  PARAMS ((struct rtx_def *, int));
 
-/* ??? Should be changed to EH_FRAME_SECTION_NAME, but that requires
-   named section support.  Based on this definition, it seems clear
-   that the object file format supports named sections, but it has
-   not been implemented in gcc.  */
-#error "Implement named section support"
-#define EH_FRAME_SECTION_ASM_OP "\t.section __TEXT,__eh_frame,regular"
+#define TARGET_ASM_EXCEPTION_SECTION nextstep_exception_section
 
+#define TARGET_ASM_EH_FRAME_SECTION nextstep_eh_frame_section
+  
 /* Don't output a .file directive.  That is only used by the assembler for
    error reporting.  */
 #undef ASM_FILE_START
@@ -326,6 +323,7 @@ FUNCTION ()                                                         \
 #define EXTRA_SECTIONS                                 \
   in_const, in_cstring, in_literal4, in_literal8,      \
   in_constructor, in_destructor,                       \
+  in_nextstep_exception, in_nextstep_eh_frame,         \
   in_objc_class, in_objc_meta_class, in_objc_category, \
   in_objc_class_vars, in_objc_instance_vars,           \
   in_objc_cls_meth, in_objc_inst_meth,                 \
@@ -357,6 +355,12 @@ SECTION_FUNCTION (constructor_section,             \
 SECTION_FUNCTION (destructor_section,          \
                  in_destructor,                \
                  ".destructor", 0, 0)          \
+SECTION_FUNCTION (nextstep_exception_section,  \
+                 in_nextstep_exception,        \
+                 ".section __TEXT,__gcc_except_tab,regular", 0, 0)     \
+SECTION_FUNCTION (nextstep_eh_frame_section,   \
+                 in_nextstep_eh_frame,         \
+                 ".section __TEXT,__eh_frame,regular", 0, 0)           \
 SECTION_FUNCTION (objc_class_section,          \
                  in_objc_class,                \
                  ".objc_class", 0, 1)          \
index 7ce97ef05fab7c643708257565033b908d72a7e3..863b4f781646e32b5193dc7718c2a448716d55e5 100644 (file)
@@ -265,7 +265,7 @@ do {  \
    complain.
 
    So, we force exception information into the data section.  */
-#define EXCEPTION_SECTION data_section
+#define TARGET_ASM_EXCEPTION_SECTION data_section
 
 /* Define the .bss section for ASM_OUTPUT_LOCAL to use. */
 
index 554090cc080341302d42a53c30a2a9f606d993d3..0a24cc30be4849d083a407d3c55d2189b9f2217f 100644 (file)
@@ -1548,5 +1548,6 @@ ncrtn.o%s"
    ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) \
    : DW_EH_PE_absptr)
 
-#define EXCEPTION_SECTION readonly_data_section
+#define TARGET_ASM_EXCEPTION_SECTION readonly_data_section
+
 #define DOUBLE_INT_ASM_OP "\t.quad\t"
index 7fbc74aaf9344866956f88b7cdf92690e3b4e9a9..758a95b30fb59278bf869436ad5993f1f49f07ec 100644 (file)
@@ -495,7 +495,7 @@ toc_section ()                                              \
 
 /* Define the name of the section to use for the EH language specific
    data areas (.gcc_except_table on most other systems).  */
-#define EXCEPTION_SECTION data_section
+#define TARGET_ASM_EXCEPTION_SECTION data_section
 
 /* Define to prevent DWARF2 unwind info in the data section rather
    than in the .eh_frame section.  We do this because the AIX linker
index f6d3848c2cfc7b25a20855e91acca9dd1d52bac9..f625ae8f014574afd2aefe52d3c2fdb8bb64eb29 100644 (file)
@@ -4493,23 +4493,6 @@ do {                                                                     \
    This macro need not be defined on most platforms.  */
 /* #define ASM_OUTPUT_EH_REGION_END() */
 
-/* A C expression to switch to the section in which the main exception table is
-   to be placed.  The default is a section named `.gcc_except_table' on machines
-   that support named sections via `ASM_OUTPUT_SECTION_NAME', otherwise if `-fpic'
-   or `-fPIC' is in effect, the `data_section', otherwise the
-   `readonly_data_section'.  */
-/* #define EXCEPTION_SECTION() */
-
-/* If defined, a C string constant for the assembler operation to switch to the
-   section for exception handling frame unwind information.  If not defined,
-   GNU CC will provide a default definition if the target supports named
-   sections.  `crtstuff.c' uses this macro to switch to the appropriate
-   section.
-
-   You should define this symbol if your target supports DWARF 2 frame unwind
-   information and the default definition does not work.  */
-/* #define EH_FRAME_SECTION_ASM_OP */
-
 /* A C expression that is nonzero if the normal exception table output should
    be omitted.
 
index 227636f47a0eb92726b59e30ff9c4d2a302277e7..96c04d982d00394a0da700812f83c92546d6acf2 100644 (file)
@@ -7151,15 +7151,6 @@ A C expression to output text to mark the end of an exception region.
 
 This macro need not be defined on most platforms.
 
-@findex EXCEPTION_SECTION
-@item EXCEPTION_SECTION ()
-A C expression to switch to the section in which the main
-exception table is to be placed (@pxref{Sections}).  The default is a
-section named @code{.gcc_except_table} on machines that support named
-sections via @code{TARGET_ASM_NAMED_SECTION}, otherwise if @option{-fpic}
-or @option{-fPIC} is in effect, the @code{data_section}, otherwise the
-@code{readonly_data_section}.
-
 @findex EH_FRAME_SECTION_NAME
 @item EH_FRAME_SECTION_NAME
 If defined, a C string constant for the name of the section containing
@@ -7232,6 +7223,24 @@ the target supports DWARF 2 frame unwind information.
 
 @end table
 
+@deftypefn {Target Hook} void TARGET_ASM_EXCEPTION_SECTION ()
+If defined, a function that switches to the section in which the main
+exception table is to be placed (@pxref{Sections}).  The default is a
+function that switches to a section named @code{.gcc_except_table} on
+machines that support named sections via
+@code{TARGET_ASM_NAMED_SECTION}, otherwise if @option{-fpic} or
+@option{-fPIC} is in effect, the @code{data_section}, otherwise the
+@code{readonly_data_section}.
+@end deftypefn
+
+@deftypefn {Target Hook} void TARGET_ASM_EH_FRAME_SECTION ()
+If defined, a function that switches to the section in which the DWARF 2
+frame unwind information to be placed (@pxref{Sections}).  The default
+is a function that outputs a standard GAS section directive, if
+@code{EH_FRAME_SECTION_NAME} is defined, or else a data section
+directive followed by a synthetic label.
+@end deftypefn
+
 @node Alignment Output
 @subsection Assembler Commands for Alignment
 
index 486c7a20b27c1fe992939f05047c5b8ff108a82f..d98b3f2921b90e17f80c779c09aae49b0f0c9314 100644 (file)
@@ -59,6 +59,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "tm_p.h"
 #include "diagnostic.h"
 #include "debug.h"
+#include "target.h"
 
 #ifdef DWARF2_DEBUGGING_INFO
 static void dwarf2out_source_line      PARAMS ((unsigned int, const char *));
@@ -1738,18 +1739,7 @@ output_call_frame_info (for_eh)
     app_enable ();
 
   if (for_eh)
-    {
-#ifdef EH_FRAME_SECTION_NAME
-      named_section_flags (EH_FRAME_SECTION_NAME, SECTION_WRITE);
-#else
-      tree label = get_file_function_name ('F');
-
-      data_section ();
-      ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (PTR_SIZE));
-      ASM_GLOBALIZE_LABEL (asm_out_file, IDENTIFIER_POINTER (label));
-      ASM_OUTPUT_LABEL (asm_out_file, IDENTIFIER_POINTER (label));
-#endif
-    }
+    (*targetm.asm_out.eh_frame_section) ();
   else
     named_section_flags (DEBUG_FRAME_SECTION, SECTION_DEBUG);
 
@@ -1978,6 +1968,21 @@ output_call_frame_info (for_eh)
     app_disable ();
 }
 
+void
+default_eh_frame_section ()
+{
+#ifdef EH_FRAME_SECTION_NAME
+  named_section_flags (EH_FRAME_SECTION_NAME, SECTION_WRITE);
+#else
+  tree label = get_file_function_name ('F');
+
+  data_section ();
+  ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (PTR_SIZE));
+  ASM_GLOBALIZE_LABEL (asm_out_file, IDENTIFIER_POINTER (label));
+  ASM_OUTPUT_LABEL (asm_out_file, IDENTIFIER_POINTER (label));
+#endif
+}
+
 /* Output a marker (i.e. a label) for the beginning of a function, before
    the prologue.  */
 
index 6ea1723c24fa31b05f9a6254aed3ff8983f0c9a4..788f54ed34f3ca9ca605acd18cafe3a9ae6600d0 100644 (file)
@@ -69,7 +69,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "intl.h"
 #include "ggc.h"
 #include "tm_p.h"
-
+#include "target.h"
 
 /* Provide defaults for stuff that may not be defined when using
    sjlj exceptions.  */
@@ -3518,7 +3518,7 @@ output_function_exception_table ()
   /* Note that varasm still thinks we're in the function's code section.
      The ".endp" directive that will immediately follow will take us back.  */
 #else
-  exception_section ();
+  (*targetm.asm_out.exception_section) ();
 #endif
 
   have_tt_data = (VARRAY_ACTIVE_SIZE (cfun->eh->ttype_data) > 0
index 18afc85c6e232c265af4ed72962b4af7bd500194..585d355bbcbd120b70b973ea90f6f7c807b4a5b7 100644 (file)
@@ -209,7 +209,10 @@ extern void named_section          PARAMS ((tree, const char *, int));
 extern void function_section           PARAMS ((tree));
 
 /* Tell assembler to switch to the section for the exception table.  */
-extern void exception_section          PARAMS ((void));
+extern void default_exception_section  PARAMS ((void));
+
+/* Tell assembler to switch to the section for the EH frames.  */
+extern void default_eh_frame_section   PARAMS ((void));
 
 /* Tell assembler to switch to the section for string merging.  */
 extern void mergeable_string_section   PARAMS ((tree, unsigned HOST_WIDE_INT,
index 4b298bc52887a6b5f02d7997d96945ffbe3f5c86..59b5e8de0c8929f9b6d0f099301cc3845e0006d9 100644 (file)
@@ -19,12 +19,16 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  You are forbidden to forbid anyone else to use, share and improve
  what you give them.   Help stamp out software-hoarding!  */
 
-/* See target.h for a desciption of what this file contains and how to
+/* See target.h for a description of what this file contains and how to
    use it.
 
    We want to have non-NULL default definitions of all hook functions,
    even if they do nothing.  */
 
+/* Note that if one of these macros must be defined in an OS .h file
+   rather than the .c file, then we need to wrap the default
+   definition in a #ifndef, since files include tm.h before this one.  */
+
 /* Assembler output.  */
 #define TARGET_ASM_OPEN_PAREN "("
 #define TARGET_ASM_CLOSE_PAREN ")"
@@ -72,6 +76,14 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #define TARGET_HAVE_NAMED_SECTIONS false
 #endif
 
+#ifndef TARGET_ASM_EXCEPTION_SECTION
+#define TARGET_ASM_EXCEPTION_SECTION default_exception_section
+#endif
+
+#ifndef TARGET_ASM_EH_FRAME_SECTION
+#define TARGET_ASM_EH_FRAME_SECTION default_eh_frame_section
+#endif
+
 #define TARGET_ASM_OUT {TARGET_ASM_OPEN_PAREN,                 \
                        TARGET_ASM_CLOSE_PAREN,                 \
                        TARGET_ASM_FUNCTION_PROLOGUE,           \
@@ -79,6 +91,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
                        TARGET_ASM_FUNCTION_BEGIN_EPILOGUE,     \
                        TARGET_ASM_FUNCTION_EPILOGUE,           \
                        TARGET_ASM_NAMED_SECTION,               \
+                       TARGET_ASM_EXCEPTION_SECTION,           \
+                       TARGET_ASM_EH_FRAME_SECTION,            \
                        TARGET_ASM_CONSTRUCTOR,                 \
                        TARGET_ASM_DESTRUCTOR}
 
index f7eca62368ecffaab66c2d0d8106a8f1f107e89b..a0545800c27865011715fbc973940c8881f5068d 100644 (file)
@@ -68,6 +68,12 @@ struct gcc_target
        specified by FLAGS.  */
     void (* named_section) PARAMS ((const char *, unsigned int));
 
+    /* Switch to the section that holds the exception table.  */
+    void (* exception_section) PARAMS ((void));
+
+    /* Switch to the section that holds the exception frames.  */
+    void (* eh_frame_section) PARAMS ((void));
+
     /* Output a constructor for a symbol with a given priority.  */
     void (* constructor) PARAMS ((rtx, int));
 
index 4d6f4b6483672bdc080ab44bc6e632053cd988f2..6658fec22b5b7825da998ec39c5a02bb8e881b81 100644 (file)
@@ -603,18 +603,14 @@ variable_section (decl, reloc)
    table.  */
 
 void
-exception_section ()
+default_exception_section ()
 {
-#if defined (EXCEPTION_SECTION)
-  EXCEPTION_SECTION ();
-#else
   if (targetm.have_named_sections)
     named_section (NULL_TREE, ".gcc_except_table", 0);
   else if (flag_pic)
     data_section ();
   else
     readonly_data_section ();
-#endif
 }
 
 /* Tell assembler to switch to the section for string merging.  */
This page took 0.08635 seconds and 5 git commands to generate.