From 7c262518a45491adb8a04f5ec4006dbe957ab7a4 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Fri, 3 Aug 2001 18:31:41 -0700 Subject: target.h (gcc_target): Add asm_out.named_section, section_type_flags, have_named_sections. * target.h (gcc_target): Add asm_out.named_section, section_type_flags, have_named_sections. * target-def.h (TARGET_ASM_NAMED_SECTION): New. (TARGET_HAVE_NAMED_SECTIONS): New. (TARGET_SECTION_TYPE_FLAGS): New. * Makefile.in (toplev.o): Depend on TARGET_H. (varasm.o, dbxout.o): Likewise. * c-common.c (decl_attributes): Check targetm.have_named_sections instead of ifdef ASM_OUTPUT_SECTION_NAME. * dbxout.c (dbxout_function_decl): Likewise. (dbxout_function_end): Likewise. * toplev.c (compile_file): Likewise. * varasm.c (exception_section): Likewise. * cp/decl2.c (finish_objects): Likewise. * defaults.h (EH_FRAME_SECTION): Remove. (EH_FRAME_SECTION_ASM_OP): Remove. (EH_FRAME_SECTION_NAME): New. (UNIQUE_SECTION): Don't depend on ASM_OUTPUT_SECTION_NAME. (UNIQUE_SECTION_P): Remove. * dwarf2out.c (SECTION_FORMAT): Remove. (ASM_OUTPUT_SECTION): Remove. (output_call_frame_info): Use named_section_flags. (output_comp_unit, dwarf2out_start_source_file): Likewise. (dwarf2out_end_source_file, dwarf2out_define): Likewise. (dwarf2out_undef, dwarf2out_init, dwarf2out_finish): Likewise. * varasm.c (in_eh_frame, eh_frame_section): Remove. (named_section_flags): New. (named_section): Use it and targetm.section_type_flags. (resolve_unique_section): New. (assemble_start_function): Use it. (asm_emit_uninitialised, assemble_variable): Likewise. (default_section_type_flags): New. (default_no_named_section, default_elf_asm_named_section): New. (default_coff_asm_named_section, default_pe_asm_named_section): New. * output.h: Update varasm.c decls. (SECTION_*): New flags. * crtstuff.c: Check EH_FRAME_SECTION_NAME not EH_FRAME_SECTION_ASM_OP. (__EH_FRAME_BEGIN__, __FRAME_END__): Use attribute section. * config/elfos.h (UNIQUE_SECTION_P): Remove. * config/alpha/elf.h, config/arm/linux-elf.h: Likewise. * config/arm/pe.h, config/arm/unknown-elf.h: Likewise. * config/i386/cygwin.h, config/i386/djgpp.h: Likewise. * config/i386/i386-interix.h, config/i386/win32.h: Likewise. * config/ia64/sysv4.h, config/mcore/mcore-pe.h: Likewise. * config/mips/elf.h, config/mips/elf64.h: Likewise. * config/mips/iris6gld.h, config/mips/mips.h: Likewise. * config/pa/pa64-hpux.h, * config/elfos.h (ASM_OUTPUT_SECTION_NAME): Remove. (TARGET_ASM_NAMED_SECTION): New. * config/psos.h, config/a29k/a29k.h, config/alpha/elf.h: Likewise. * config/alpha/vms.h, config/arm/coff.h: Likewise. * config/arm/conix-elf.h, config/arm/elf.h: Likewise. * config/arm/linux-elf.h, config/arm/pe.h: Likewise. * config/arm/unknown-elf.h, config/avr/avr.h: Likewise. * config/c4x/c4x.h, config/h8300/h8300.h: Likewise. * config/i386/cygwin.h, config/i386/djgpp.h: Likewise. * config/i386/i386-interix.h, config/i386/i386elf.h : Likewise. * config/i386/sco5.h, config/i386/win32.h: Likewise. * config/m68k/coff.h, config/mcore/mcore-pe.h: Likewise. * config/mcore/mcore.h, config/mips/elf.h: Likewise. * config/mips/elf64.h, config/mips/iris6.h: Likewise. * config/mips/netbsd.h, config/mips/openbsd.h: Likewise. * config/pa/pa64-hpux.h, config/rs6000/sysv4.h: Likewise. * config/rs6000/xcoff.h, config/sh/sh.h: Likewise. * config/sparc/sysv4.h: Likewise. * config/nextstep.h: Error until named sections implemented. * config/a29k/a29k.c (a29k_asm_named_section): New. * config/alpha/alpha.c (SECTION_VMS_OVERLAY): New. (vms_section_type_flags, vms_asm_named_section): New. * config/arm/arm.c (arm_elf_asm_named_section): New. * config/avr/avr.c (asm_output_section_name): Remove. * config/avr/avr-protos.h: Update. * config/c4x/c4x.c (c4x_asm_named_section): New. * config/h8300/h8300.c (h8300_asm_named_section): New. * config/i386/i386.c (sco_asm_named_section): New. * config/i386/winnt.c (SECTION_PE_SHARED): New. (i386_pe_section_type_flags): New. (i386_pe_asm_named_section): New. * config/i386/i386-protos.h: Update. * config/m68k/m68k.c (m68k_coff_asm_named_section): New. * config/mcore/mcore.c (mcore_asm_named_section): New. * config/mips/mips.c (iris6_asm_named_section): New. * config/mips/mips.h (ENCODE_SECTION_INFO): Use DECL_ONE_ONLY instead of UNIQUE_SECTION_P. * config/rs6000/rs6000.c (rs6000_elf_section_type_flags): New. (xcoff_asm_named_section): New. * config/sh/sh.c (sh_asm_named_section): New. * config/sparc/sparc.c (sparc_elf_asm_named_section): New. * config/i386/djgpp.h (EH_FRAME_SECTION_ASM_OP): Remove. * config/i386/sco5.h (EH_FRAME_SECTION_ASM_OP*): Remove. (EH_FRAME_SECTION_NAME): New. (EXCEPTION_SECTION): New. * config/ia64/ia64.h (EH_FRAME_SECTION_ASM_OP): Remove. (DEBUG_*_SECTION): Remove. * config/m68k/rtemself.h (EH_FRAME_SECTION_ASM_OP): Remove. * config/mips/iris6.h (DEBUG_*_SECTION): Remove. (EH_FRAME_SECTION_ASM_OP): Remove. * doc/tm.texi (UNIQUE_SECTION_P): Remove. (ASM_OUTPUT_SECTION_NAME): Remove. (TARGET_ASM_NAMED_SECTION): New. (TARGET_HAVE_NAMED_SECTIONS): New. (TARGET_SECTION_TYPE_FLAGS): New. (EH_FRAME_SECTION_ASM_OP): Remove. (EH_FRAME_SECTION_NAME): New. From-SVN: r44623 --- gcc/doc/tm.texi | 64 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 33 insertions(+), 31 deletions(-) (limited to 'gcc/doc') diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index bdee2f8..e9c747a 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -5614,14 +5614,6 @@ Decode @var{sym_name} and store the real name part in @var{var}, sans the characters that encode section info. Define this macro if @code{ENCODE_SECTION_INFO} alters the symbol's name string. -@findex UNIQUE_SECTION_P -@item UNIQUE_SECTION_P (@var{decl}) -A C expression which evaluates to true if @var{decl} should be placed -into a unique section for some target-specific reason. If you do not -define this macro, the default is @samp{0}. Note that the flag -@option{-ffunction-sections} will also cause functions to be placed into -unique sections. - @findex UNIQUE_SECTION @item UNIQUE_SECTION (@var{decl}, @var{reloc}) A C statement to build up a unique section name, expressed as a @@ -5803,21 +5795,6 @@ A C statement to output something to the assembler file to handle a @samp{#ident} directive containing the text @var{string}. If this macro is not defined, nothing is output for a @samp{#ident} directive. -@findex ASM_OUTPUT_SECTION_NAME -@item ASM_OUTPUT_SECTION_NAME (@var{stream}, @var{decl}, @var{name}, @var{reloc}) -A C statement to output something to the assembler file to switch to section -@var{name} for object @var{decl} which is either a @code{FUNCTION_DECL}, a -@code{VAR_DECL} or @code{NULL_TREE}. @var{reloc} -indicates whether the initial value of @var{exp} requires link-time -relocations. The string given by @var{name} will always be the -canonical version stored in the global stringpool. - -Some target formats do not support arbitrary sections. Do not define -this macro in such cases. - -At present this macro is only used to support section attributes. -When this macro is undefined, section attributes are disabled. - @findex OBJC_PROLOGUE @item OBJC_PROLOGUE A C statement to output any assembler statements which are required to @@ -5825,6 +5802,32 @@ precede any Objective-C object definitions or message sending. The statement is executed only when compiling an Objective-C program. @end table +@deftypefn {Target Hook} void TARGET_ASM_NAMED_SECTION (const char *@var{name}, unsigned int @var{flags}, unsigned int @var{align}) +Output assembly directives to switch to section @var{name}. The section +should have attributes as specified by @var{flags}, which is a bit mask +of the @code{SECTION_*} flags defined in @file{output.h}. If @var{align} +is non-zero, it contains an alignment in bytes to be used for the section, +otherwise some target default should be used. Only targets that must +specify an alignment within the section directive need pay attention to +@var{align} -- we will still use @code{ASM_OUTPUT_ALIGN}. +@end deftypefn + +@deftypefn {Target Hook} bool TARGET_HAVE_NAMED_SECTIONS +This flag is true if the target supports @code{TARGET_ASM_NAMED_SECTION}. +@end deftypefn + +@deftypefn {Target Hook} {unsigned int} TARGET_SECTION_TYPE_FLAGS (tree @var{decl}, const char *@var{name}, int @var{reloc}) +Choose a set of section attributes for use by @code{TARGET_ASM_NAMED_SECTION} +based on a variable or function decl, a section name, and whether or not the +declaration's initializer may contain runtime relocations. @var{decl} may be + null, in which case read-write data should be assumed. + +The default version if this function handles choosing code vs data, +read-only vs read-write data, and @code{flag_pic}. You should only +need to override this if your target has special flags that might be +set via @code{__attribute__}. +@end deftypefn + @need 2000 @node Data Output @subsection Output of Data @@ -7058,17 +7061,16 @@ This macro need not be defined on most platforms. 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{ASM_OUTPUT_SECTION_NAME}, otherwise if @option{-fpic} +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_ASM_OP -@item EH_FRAME_SECTION_ASM_OP -If defined, a C string constant, including spacing, for the assembler -operation to switch to the section for exception handling frame unwind -information. If not defined, GCC will provide a default definition if the -target supports named sections. @file{crtstuff.c} uses this macro to -switch to the appropriate section. +@findex EH_FRAME_SECTION_NAME +@item EH_FRAME_SECTION_NAME +If defined, a C string constant for the name of the section containing +exception handling frame unwind information. If not defined, GCC will +provide a default definition if the target supports named sections. +@file{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. -- cgit v1.1