+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
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
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 () \
} \
} 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)
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
#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, \
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) \
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. */
? (((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"
/* 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
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.
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
@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
#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 *));
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);
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. */
#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. */
/* 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
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,
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 ")"
#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, \
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}
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));
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. */