Commit 07c9d2eb by Stan Shebs Committed by Stan Shebs

target.h (struct gcc_target): Add asm_out.exception_section, asm_out.eh_frame_section.

        * 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
parent bbea0391
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> 2001-10-22 Nick Clifton <nickc@cambridge.redhat.com>
* config/mips/mips.md (mul_acc_si): Fix precedence of conditional * config/mips/mips.md (mul_acc_si): Fix precedence of conditional
......
...@@ -352,7 +352,7 @@ do { if (!strcmp (alias_name, name)) \ ...@@ -352,7 +352,7 @@ do { if (!strcmp (alias_name, name)) \
in_machopic_lazy_symbol_ptr, \ in_machopic_lazy_symbol_ptr, \
in_machopic_symbol_stub, \ in_machopic_symbol_stub, \
in_machopic_picsymbol_stub, \ in_machopic_picsymbol_stub, \
in_darwin_exception, \ in_darwin_exception, in_darwin_eh_frame, \
num_sections num_sections
#undef EXTRA_SECTION_FUNCTIONS #undef EXTRA_SECTION_FUNCTIONS
...@@ -460,6 +460,9 @@ SECTION_FUNCTION (machopic_picsymbol_stub_section, \ ...@@ -460,6 +460,9 @@ SECTION_FUNCTION (machopic_picsymbol_stub_section, \
SECTION_FUNCTION (darwin_exception_section, \ SECTION_FUNCTION (darwin_exception_section, \
in_darwin_exception, \ in_darwin_exception, \
".section __TEXT,__gcc_except_tab", 0) \ ".section __TEXT,__gcc_except_tab", 0) \
SECTION_FUNCTION (darwin_eh_frame_section, \
in_darwin_eh_frame, \
".section __TEXT,__eh_frame", 0) \
\ \
void \ void \
objc_section_init () \ objc_section_init () \
...@@ -781,8 +784,10 @@ enum machopic_addr_class { ...@@ -781,8 +784,10 @@ enum machopic_addr_class {
} \ } \
} while (0) } 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) \ #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
(((CODE) == 1 || (GLOBAL) == 0) ? DW_EH_PE_pcrel : DW_EH_PE_absptr) (((CODE) == 1 || (GLOBAL) == 0) ? DW_EH_PE_pcrel : DW_EH_PE_absptr)
......
...@@ -217,13 +217,10 @@ Boston, MA 02111-1307, USA. */ ...@@ -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_constructor PARAMS ((struct rtx_def *, int));
extern void nextstep_asm_out_destructor 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 #define TARGET_ASM_EXCEPTION_SECTION nextstep_exception_section
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_EH_FRAME_SECTION nextstep_eh_frame_section
/* Don't output a .file directive. That is only used by the assembler for /* Don't output a .file directive. That is only used by the assembler for
error reporting. */ error reporting. */
#undef ASM_FILE_START #undef ASM_FILE_START
...@@ -326,6 +323,7 @@ FUNCTION () \ ...@@ -326,6 +323,7 @@ FUNCTION () \
#define EXTRA_SECTIONS \ #define EXTRA_SECTIONS \
in_const, in_cstring, in_literal4, in_literal8, \ in_const, in_cstring, in_literal4, in_literal8, \
in_constructor, in_destructor, \ in_constructor, in_destructor, \
in_nextstep_exception, in_nextstep_eh_frame, \
in_objc_class, in_objc_meta_class, in_objc_category, \ in_objc_class, in_objc_meta_class, in_objc_category, \
in_objc_class_vars, in_objc_instance_vars, \ in_objc_class_vars, in_objc_instance_vars, \
in_objc_cls_meth, in_objc_inst_meth, \ in_objc_cls_meth, in_objc_inst_meth, \
...@@ -357,6 +355,12 @@ SECTION_FUNCTION (constructor_section, \ ...@@ -357,6 +355,12 @@ SECTION_FUNCTION (constructor_section, \
SECTION_FUNCTION (destructor_section, \ SECTION_FUNCTION (destructor_section, \
in_destructor, \ in_destructor, \
".destructor", 0, 0) \ ".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, \ SECTION_FUNCTION (objc_class_section, \
in_objc_class, \ in_objc_class, \
".objc_class", 0, 1) \ ".objc_class", 0, 1) \
......
...@@ -265,7 +265,7 @@ do { \ ...@@ -265,7 +265,7 @@ do { \
complain. complain.
So, we force exception information into the data section. */ 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. */ /* Define the .bss section for ASM_OUTPUT_LOCAL to use. */
......
...@@ -1548,5 +1548,6 @@ ncrtn.o%s" ...@@ -1548,5 +1548,6 @@ ncrtn.o%s"
? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) \ ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) \
: DW_EH_PE_absptr) : 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" #define DOUBLE_INT_ASM_OP "\t.quad\t"
...@@ -495,7 +495,7 @@ toc_section () \ ...@@ -495,7 +495,7 @@ toc_section () \
/* Define the name of the section to use for the EH language specific /* Define the name of the section to use for the EH language specific
data areas (.gcc_except_table on most other systems). */ 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 /* Define to prevent DWARF2 unwind info in the data section rather
than in the .eh_frame section. We do this because the AIX linker than in the .eh_frame section. We do this because the AIX linker
......
...@@ -4493,23 +4493,6 @@ do { \ ...@@ -4493,23 +4493,6 @@ do { \
This macro need not be defined on most platforms. */ This macro need not be defined on most platforms. */
/* #define ASM_OUTPUT_EH_REGION_END() */ /* #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 /* A C expression that is nonzero if the normal exception table output should
be omitted. be omitted.
......
...@@ -7151,15 +7151,6 @@ A C expression to output text to mark the end of an exception region. ...@@ -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. 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 @findex EH_FRAME_SECTION_NAME
@item EH_FRAME_SECTION_NAME @item EH_FRAME_SECTION_NAME
If defined, a C string constant for the name of the section containing 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. ...@@ -7232,6 +7223,24 @@ the target supports DWARF 2 frame unwind information.
@end table @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 @node Alignment Output
@subsection Assembler Commands for Alignment @subsection Assembler Commands for Alignment
......
...@@ -59,6 +59,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -59,6 +59,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "tm_p.h" #include "tm_p.h"
#include "diagnostic.h" #include "diagnostic.h"
#include "debug.h" #include "debug.h"
#include "target.h"
#ifdef DWARF2_DEBUGGING_INFO #ifdef DWARF2_DEBUGGING_INFO
static void dwarf2out_source_line PARAMS ((unsigned int, const char *)); static void dwarf2out_source_line PARAMS ((unsigned int, const char *));
...@@ -1738,18 +1739,7 @@ output_call_frame_info (for_eh) ...@@ -1738,18 +1739,7 @@ output_call_frame_info (for_eh)
app_enable (); app_enable ();
if (for_eh) if (for_eh)
{ (*targetm.asm_out.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
}
else else
named_section_flags (DEBUG_FRAME_SECTION, SECTION_DEBUG); named_section_flags (DEBUG_FRAME_SECTION, SECTION_DEBUG);
...@@ -1978,6 +1968,21 @@ output_call_frame_info (for_eh) ...@@ -1978,6 +1968,21 @@ output_call_frame_info (for_eh)
app_disable (); 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 /* Output a marker (i.e. a label) for the beginning of a function, before
the prologue. */ the prologue. */
......
...@@ -69,7 +69,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -69,7 +69,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "intl.h" #include "intl.h"
#include "ggc.h" #include "ggc.h"
#include "tm_p.h" #include "tm_p.h"
#include "target.h"
/* Provide defaults for stuff that may not be defined when using /* Provide defaults for stuff that may not be defined when using
sjlj exceptions. */ sjlj exceptions. */
...@@ -3518,7 +3518,7 @@ output_function_exception_table () ...@@ -3518,7 +3518,7 @@ output_function_exception_table ()
/* Note that varasm still thinks we're in the function's code section. /* Note that varasm still thinks we're in the function's code section.
The ".endp" directive that will immediately follow will take us back. */ The ".endp" directive that will immediately follow will take us back. */
#else #else
exception_section (); (*targetm.asm_out.exception_section) ();
#endif #endif
have_tt_data = (VARRAY_ACTIVE_SIZE (cfun->eh->ttype_data) > 0 have_tt_data = (VARRAY_ACTIVE_SIZE (cfun->eh->ttype_data) > 0
......
...@@ -209,7 +209,10 @@ extern void named_section PARAMS ((tree, const char *, int)); ...@@ -209,7 +209,10 @@ extern void named_section PARAMS ((tree, const char *, int));
extern void function_section PARAMS ((tree)); extern void function_section PARAMS ((tree));
/* Tell assembler to switch to the section for the exception table. */ /* 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. */ /* Tell assembler to switch to the section for string merging. */
extern void mergeable_string_section PARAMS ((tree, unsigned HOST_WIDE_INT, extern void mergeable_string_section PARAMS ((tree, unsigned HOST_WIDE_INT,
......
...@@ -19,12 +19,16 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -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 You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding! */ 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. use it.
We want to have non-NULL default definitions of all hook functions, We want to have non-NULL default definitions of all hook functions,
even if they do nothing. */ 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. */ /* Assembler output. */
#define TARGET_ASM_OPEN_PAREN "(" #define TARGET_ASM_OPEN_PAREN "("
#define TARGET_ASM_CLOSE_PAREN ")" #define TARGET_ASM_CLOSE_PAREN ")"
...@@ -72,6 +76,14 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -72,6 +76,14 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define TARGET_HAVE_NAMED_SECTIONS false #define TARGET_HAVE_NAMED_SECTIONS false
#endif #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, \ #define TARGET_ASM_OUT {TARGET_ASM_OPEN_PAREN, \
TARGET_ASM_CLOSE_PAREN, \ TARGET_ASM_CLOSE_PAREN, \
TARGET_ASM_FUNCTION_PROLOGUE, \ TARGET_ASM_FUNCTION_PROLOGUE, \
...@@ -79,6 +91,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -79,6 +91,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
TARGET_ASM_FUNCTION_BEGIN_EPILOGUE, \ TARGET_ASM_FUNCTION_BEGIN_EPILOGUE, \
TARGET_ASM_FUNCTION_EPILOGUE, \ TARGET_ASM_FUNCTION_EPILOGUE, \
TARGET_ASM_NAMED_SECTION, \ TARGET_ASM_NAMED_SECTION, \
TARGET_ASM_EXCEPTION_SECTION, \
TARGET_ASM_EH_FRAME_SECTION, \
TARGET_ASM_CONSTRUCTOR, \ TARGET_ASM_CONSTRUCTOR, \
TARGET_ASM_DESTRUCTOR} TARGET_ASM_DESTRUCTOR}
......
...@@ -68,6 +68,12 @@ struct gcc_target ...@@ -68,6 +68,12 @@ struct gcc_target
specified by FLAGS. */ specified by FLAGS. */
void (* named_section) PARAMS ((const char *, unsigned int)); 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. */ /* Output a constructor for a symbol with a given priority. */
void (* constructor) PARAMS ((rtx, int)); void (* constructor) PARAMS ((rtx, int));
......
...@@ -603,18 +603,14 @@ variable_section (decl, reloc) ...@@ -603,18 +603,14 @@ variable_section (decl, reloc)
table. */ table. */
void void
exception_section () default_exception_section ()
{ {
#if defined (EXCEPTION_SECTION)
EXCEPTION_SECTION ();
#else
if (targetm.have_named_sections) if (targetm.have_named_sections)
named_section (NULL_TREE, ".gcc_except_table", 0); named_section (NULL_TREE, ".gcc_except_table", 0);
else if (flag_pic) else if (flag_pic)
data_section (); data_section ();
else else
readonly_data_section (); readonly_data_section ();
#endif
} }
/* Tell assembler to switch to the section for string merging. */ /* Tell assembler to switch to the section for string merging. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment